Skip to content
Permalink
Browse files

Bring graal support up to date.

  • Loading branch information
aardvark179 committed Feb 27, 2020
1 parent 3bbda7a commit 866ba3e223716092c245e8e9299f4e14101e9024
@@ -184,6 +184,7 @@
nonstatic_field(JavaThread, _should_post_on_exceptions_flag, int) \
nonstatic_field(JavaThread, _jni_environment, JNIEnv) \
nonstatic_field(JavaThread, _reserved_stack_activation, address) \
nonstatic_field(JavaThread, _held_monitor_count, int) \
\
static_field(java_lang_Class, _klass_offset, int) \
static_field(java_lang_Class, _array_klass_offset, int) \
@@ -326,6 +326,7 @@ private int getJvmciJvmtiCapabilityOffset(String name) {
public final int doingUnsafeAccessOffset = getFieldOffset("JavaThread::_doing_unsafe_access", Integer.class, "bool", Integer.MAX_VALUE);
public final int javaThreadReservedStackActivationOffset = versioned.javaThreadReservedStackActivationOffset;
public final int jniEnvironmentOffset = getFieldOffset("JavaThread::_jni_environment", Integer.class, "JNIEnv", Integer.MIN_VALUE);
public final int javaThreadHeldMonitorCounterOffset = versioned.javaThreadHeldMonitorCounterOffset;

public boolean requiresReservedStackCheck(List<ResolvedJavaMethod> methods) {
if (enableStackReservedZoneAddress != 0 && methods != null) {
@@ -92,7 +92,9 @@

// JDK-8220049
boolean threadLocalHandshakes = true;


int javaThreadHeldMonitorCounterOffset = getFieldOffset("JavaThread::_held_monitor_count", Integer.class, "int");

long continuationThaw = getFieldValue("StubRoutines::_cont_thaw", Long.class, "address");
long continuationGetSP = getFieldValue("StubRoutines::_cont_getSP", Long.class, "address");
long continuationDoYield = getFieldValue("StubRoutines::_cont_doYield", Long.class, "address");
@@ -247,6 +247,10 @@ public static void monitorenter(Object object, KlassPointer hub, @ConstantParame

incCounter();

Word thread = registerAsWord(threadRegister);
int heldCount = thread.readInt(INJECTED_VMCONFIG.javaThreadHeldMonitorCounterOffset);
thread.writeInt(INJECTED_VMCONFIG.javaThreadHeldMonitorCounterOffset, heldCount + 1);

if (useBiasedLocking(INJECTED_VMCONFIG)) {
if (tryEnterBiased(object, hub, lock, mark, threadRegister, trace, counters)) {
return;
@@ -489,6 +493,11 @@ public static void monitorenterStub(Object object, @ConstantParameter int lockDe
public static void monitorexit(Object object, @ConstantParameter int lockDepth, @ConstantParameter Register threadRegister, @ConstantParameter boolean trace,
@ConstantParameter Counters counters) {
trace(trace, " object: 0x%016lx\n", Word.objectToTrackedPointer(object));

Word thread = registerAsWord(threadRegister);
int heldCount = thread.readInt(INJECTED_VMCONFIG.javaThreadHeldMonitorCounterOffset);
thread.writeInt(INJECTED_VMCONFIG.javaThreadHeldMonitorCounterOffset, heldCount - 1);

final Word mark = loadWordFromObject(object, markOffset(INJECTED_VMCONFIG));
if (useBiasedLocking(INJECTED_VMCONFIG)) {
// Check for biased locking unlock case, which is a no-op

0 comments on commit 866ba3e

Please sign in to comment.