To optimize JNI invokes (by caching resolves), three fields:
jint _resolved_lock; // Lock for updating _resolved fields
volatile methodOop _resolved_method; // Non NULL if method is resolved
volatile klassOop _resolved_receiver; // Receiver at time of resolve
and five methods:
inline void JNIid::lock();
inline void JNIid::unlock() ;
methodOop resolved_method() const;
klassOop resolved_receiver() const;
void set_resolved_method( methodOop m, klassOop r );
have been added to JNIid. However, HotSwaping can make the cache incorrect,
causing the following bug: a method is invoked via JNI, the resolved method
is cached in the JNIid, the method is replaced using HotSwap, the method
is invoked again and because of the cache, the old method is called.
jint _resolved_lock; // Lock for updating _resolved fields
volatile methodOop _resolved_method; // Non NULL if method is resolved
volatile klassOop _resolved_receiver; // Receiver at time of resolve
and five methods:
inline void JNIid::lock();
inline void JNIid::unlock() ;
methodOop resolved_method() const;
klassOop resolved_receiver() const;
void set_resolved_method( methodOop m, klassOop r );
have been added to JNIid. However, HotSwaping can make the cache incorrect,
causing the following bug: a method is invoked via JNI, the resolved method
is cached in the JNIid, the method is replaced using HotSwap, the method
is invoked again and because of the cache, the old method is called.
- relates to
-
JDK-4096069 (jni) Calling from C to Java is very slow.
-
- Closed
-