9

Source for native sun.misc.Unsafe operations in java

 2 years ago
source link: https://www.codesd.com/item/source-for-native-sun-misc-unsafe-operations-in-java.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Source for native sun.misc.Unsafe operations in java

advertisements

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


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.

Related Articles

In Android, how to call sun.misc.Unsafe methods using Java reflection?

Although there are similar questions (such as A, B and C), their answers do not solve my problem. I am using Android Studio 1.5.1 targeting Android API 18 (before Android KitKat 4.4, so I'm dealing with Dalvik, not ART runtime). My questions are: (1)

EXPECTED to sun.misc.Unsafe.park (native method)

One of my applications hangs under some period of running under load, does anyone know what could cause such output in jstack: "scheduler-5" prio=10 tid=0x00007f49481d0000 nid=0x2061 waiting on condition [0x00007f494e8d0000] java.lang.Thread.Sta

Examples of forcing the release of native direct memory ByteBuffer assigned, using sun.misc.Unsafe?

JDK provides abillity to allocate so-called direct ByteBuffers, where memory is allocate outside of Java heap. This can be beneficial since this memory is not touched by garbage collector, and as such does not contribute to GC overhead: this is a ver

** BUSTED ** How to speed up a search byte [] to be faster using sun.misc.Unsafe?

I am experimenting with Unsafe to iterate over memory instead of iterating over the values in a byte[]. A memory block is allocated using unsafe. The memory is sufficient to hold 65536 byte values. I AM TRYING THIS: char aChar = some character if ((b

Using sun.misc.Unsafe to get the address of Java table elements?

I'm struggling to understand the documentation of sun.misc.Unsafe -- I guess as it's not intended for general use, nobody's really bothered with making it readable -- but I actually really need a way to find the address of an element in an array (so

Can you break a security manager with sun.misc.unsafe?

Following a conversation on another question, an interesting issue is being raised. Classes loaded with a security manager are protected with the corresponding security. This security could disable reflection (for example). The question is: is it pos

Tools for Debugging Bit-to-Bit Operations in Java

I have inherited a library that uses and abuses of bitwise operations. Up to now, I have developed a method that prints the bit representation of the variables that are used in such bitwise operations. Furthermore, the developed method can also be us

How set works for duplicate entry and delete operations in Java

I have written following code class Test { public static void main(String... args) throws Exception{ Set<Integer> s = new HashSet(); Integer i1 = new Integer(1); s.add(i1); Integer i2 = new Integer(2); s.add(i2); i1 = 5; s.remove(i1); System.out.pri

Where can I find the source code for "native" methods in the Java library?

In the sun.misc package, I saw these methods under Unsafe class. public final native boolean compareAndSwapObject(Object var1, long var2, Object var4, Object var5); public final native boolean compareAndSwapInt(Object var1, long var2, int var4, int v

Applet error - java.lang.NoClassDefFoundError: sun / misc / ProxyGenerator

I am running an applet from browser and am getting error: sun/misc/ProxyGenerator java.lang.NoClassDefFoundError: sun/misc/ProxyGenerator at java.lang.reflect.Proxy$ProxyClassFactory.apply(Unknown Source) at java.lang.reflect.Proxy$ProxyClassFactory.

What is a free BLAS / LAPACK library (open source) for .net (C #)?

I have a project written in C# where I need to do various linear algebraic operations on matrices (like LU-factorization). Since the program is mainly a prototype created to confirm a theory, a C# implementation will suffice (compared to a possibly s

Is there a reminder for ng-bind-html-unsafe in AngularJS

I would like to remove some of the elements that are brought into the DOM by this... <div ng-bind-html-unsafe="whatever"></div> I wrote a function that will remove the elements, but I need a way to trigger the function after ng-bind-

Array Queue - recompiled with -xlint: unchecked / unsafe operations

Probably tons of mistakes, sorry. I'm new to java and I'm having a rather hard time with all the syntax and whatnot. I can't get past this error but I fail to see where it is. I can't even compile because I get the message: "...uses unchecked or unsa

Is the sun.misc package still available in java?

I would like to use the Base64 encoder of the package sun.misc.BASE64Encoder because I need to encode a password. However an error is being generated when I type in the import for this package. the message where the code for the encoder is to be used

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK