RFR: 8058255: Native jbyte Atomic::cmpxchg for supported x86 platforms

Erik Österlund erik.osterlund at lnu.se
Fri Sep 12 09:14:49 UTC 2014


Sure, if you want a cleaner more OOP fix then I'm fine with slowing down. I won't be able to respond until wednesday anyway. :(

And yes that cmpxhgl should be cmpxhgb thanks for spotting that!

/Erik

> On 12 sep 2014, at 09:47, "Andrew Haley" <aph at redhat.com> wrote:
> 
>> On 12/09/14 02:40, David Holmes wrote:
>> Can we pause and give some more thought to a clean mechanism for 
>> allowing a shared implementation if desired with the ability to override 
>> if desired. I really do not like to see CPU specific ifdefs being added 
>> to shared code. (And I would also not like to see all platforms being 
>> forced to reimplement this natively).
> 
> Indeed.  Could we put the code for things like cmpxchg in an abstract
> class and override them?
> 
> Also, this doesn't look right:
> 
> +  // Support fori jbyte Atomic::cmpxchg(jbyte exchange_value,
> +  //                                    volatile jbyte *dest,
> +  //                                    jbyte compare_value)
> +  // An additional bool (os::is_MP()) is passed as the last argument.
> +      .inline _Atomic_cmpxchg_byte,4
> +      movb     8(%esp), %al   // compare_value
> +      movb     0(%esp), %cl   // exchange_value
> +      movl     4(%esp), %edx   // dest
> +      cmp      $0, 12(%esp)    // MP test
> +      jne      1f
> +      cmpxchgb %cl, (%edx)
> +      jmp      2f
> +1:    lock
> +      cmpxchgl %cl, (%edx)
> +2:
> +      .end
> 
> What is this cmpxchgl for?
> 
> Andrew.


More information about the hotspot-dev mailing list