Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

source for native sun.misc.Unsafe operations in java

i've downloaded "openjdk-6-src-b23-05_jul_2011" to have a look at the native implementations for the methods in sun.misc.Unsafe. e.g. compareAndSwapInt(...) but i am not able find anything in the downloaded sources of openjdk. i want to get an idea how these methods look like (i was interested in the atomic stuff the jdk provides).

could anybody point me to the right location(s)?

$ ls jdk/src/
linux  share  solaris  windows

$ ls hotspot/src/os/
linux  posix  solaris  windows

any help appreciated

marcel

like image 753
Marcel Avatar asked Jul 19 '11 16:07

Marcel


1 Answers

Implementation of unsafe methods itself is not OS-specific, therefore it can be found in hotspot/src/share/vm/prims/unsafe.cpp. It delegates to hotspot/src/share/vm/runtime/atomic.cpp, which includes OS and CPU specific files, such as hotspot/src/os_cpu/windows_x86/atomic_windows_x86.inline.hpp.

like image 200
axtavt Avatar answered Sep 19 '22 22:09

axtavt