[concurrency-interest] Array element compareAndSet

Roman Elizarov elizarov at devexperts.com
Thu Dec 18 07:58:06 EST 2008


Hello Doug!

On Thursday, December 18, 2008 2:59:42 AM you wrote:

DL> The idea is to subject these to the dynamic compilation
DL> strategy used for java.lang.reflect.Field methods, so that the
DL> type checks can then in turn be subject to the usual optimizations.
DL> This is probably the only path to reliably removing unnecessary
DL> checks.

This is the only path for API that takes "Object target" as an
argument. However, if API takes "int[] target" as an argument for int
operation, then it is straightforward to implement via sun.mics.Unsafe
(which uses intrinsics in HotSpot).

DL> But it will be a lot of work. If anyone else out there is
DL> interested in taking this on, please feel free.

Speedup of java.lang.reflect.Array operations may be of an interest to
a wider community (not just for concurrency). According to comment in
reflection.hpp:

// Class Reflection contains utility methods needed for implementing the
// reflection api. 
//
// Used by functions in the JVM interface.
//
// NOTE that in JDK 1.4 most of reflection is now implemented in Java
// using dynamic bytecode generation. The Array class has not yet been
// rewritten using bytecodes; if it were, most of the rest of this
// class could go away, as well as a few more entry points in jvm.cpp.

Sincerely,
Roman Elizarov




More information about the Concurrency-interest mailing list