RFR: 8058255: Native jbyte Atomic::cmpxchg for supported x86 platforms
Andrew Haley
aph at redhat.com
Fri Sep 12 08:46:51 UTC 2014
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