Use the following logic to speedup JNI primitive field accesses:
A _safepoint_counter is increment at the beginning and end of each
safepoint, with an initial value of 0.
// load _safepoint_counter into old_counter
// IF old_counter is odd THEN
// a safepoint is going on, return jni_GetXXXField
// ELSE
// load the primitive field value into result (speculatively)
// load _safepoint_counter into new_counter
// IF (old_counter == new_counter) THEN
// no safepoint happens during the field access, return result
// ELSE
// a safepoint might have happened in-between, return jni_GetXXXField()
// ENDIF
// ENDIF
GetObjectField requires local handle creation so the idea can't be applied
directly.
A _safepoint_counter is increment at the beginning and end of each
safepoint, with an initial value of 0.
// load _safepoint_counter into old_counter
// IF old_counter is odd THEN
// a safepoint is going on, return jni_GetXXXField
// ELSE
// load the primitive field value into result (speculatively)
// load _safepoint_counter into new_counter
// IF (old_counter == new_counter) THEN
// no safepoint happens during the field access, return result
// ELSE
// a safepoint might have happened in-between, return jni_GetXXXField()
// ENDIF
// ENDIF
GetObjectField requires local handle creation so the idea can't be applied
directly.
- relates to
-
JDK-5030246 speedup JNI primitive field accesses on amd64
-
- Closed
-