changeset 52927:5e9d836c5ad8

8193577: nsk/jvmti/IterateThroughHeap/filter-tagged fails with Graal in Xcomp mode Summary: Make field values opaque to compiler Reviewed-by: dlong, sspitsyn
author iveresov
date Thu, 29 Nov 2018 11:47:08 -0800
parents 7c8d9a89e298
children fffe38c905a0
files test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/filter-tagged/HeapFilter.cpp
diffstat 1 files changed, 13 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/filter-tagged/HeapFilter.cpp	Thu Nov 29 11:14:36 2018 -0800
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/filter-tagged/HeapFilter.cpp	Thu Nov 29 11:47:08 2018 -0800
@@ -61,10 +61,11 @@
 //expected values
 #define INT_ARRAY_LENGTH 2
 
-static jint TAGGED_STATIC_INT_VALUE = 0xC0DE01;
-static jint TAGGED_INT_VALUE = 0xC0DE02;
-static jint UNTAGGED_STATIC_INT_VALUE = 0xC0DE03;
-static jint UNTAGGED_INT_VALUE = 0xC0DE04;
+static jint POISON = 0x1234;
+static jint TAGGED_STATIC_INT_VALUE = 0xC0DE01 + POISON;
+static jint TAGGED_INT_VALUE = 0xC0DE02 + POISON;
+static jint UNTAGGED_STATIC_INT_VALUE = 0xC0DE03 + POISON;
+static jint UNTAGGED_INT_VALUE = 0xC0DE04 + POISON;
 static jint TAGGED_INT_ARRAY_VALUE[] = {0xC0DE01,
                                                  0xC0DE01+1};
 static jint UNTAGGED_INT_ARRAY_VALUE[] = {0xC0DE03,
@@ -352,6 +353,14 @@
       if (is_primitive_type(objects_info[object].fields[field].signature)) {
         objects_info[object].fields[field].primitive = 1;
         is_primitive = 1;
+        // Add POISON to all int fields to make the values opaque to the JIT compiler.
+        if (is_static) {
+          jint value = jni->GetStaticIntField(targetClass, targetFields[field]);
+          jni->SetStaticIntField(targetClass, targetFields[field], value + POISON);
+        } else {
+          jint value = jni->GetIntField(target, targetFields[field]);
+          jni->SetIntField(target, targetFields[field], value + POISON);
+        }
       } else {
         jobject value;
         if (!NSK_JVMTI_VERIFY(jvmti->GetFieldModifiers(