You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the below example, compareAndExchangeRelease translates to an
OutOfLine INL method named
OutOfLineINL_jdk_internal_misc_Unsafe_compareAndExchangeIntVolatile.
Example:
InstFieldVH <- InstanceFieldVarHandle provides access to an int field in
an object.
1000 threads concurrently execute {
int old, new;
do {
old = (int)InstFieldVH.getVolatile(object);
new = old + 2;
} while (old != InstFieldVH.compareAndExchangeRelease(object, old,
new));
}
There is a race condition between 1) invoking the target method in
BytecodeInterpreter.hpp::outOfLineINL; and 2) resolving the native
address (J9Method->extra) of the target method in
BytecodeInterpreter.hpp::bindNative.
Due to the race condition, the native address of the target method may
not be resolved when certain threads invoke outOfLineINL. In such cases,
outOfLineINL should resolve the native address before proceeding.
bindnatv.cpp::resolveNativeAddress - The code to resolve the native
address is protected by the J9JavaVM->bindNativeMutex. So, it can be
safely invoked by multiple threads. If the native address is already
resolved, then it returns without repeating the resolution process.
Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
0 commit comments