--- old/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/filter-tagged/HeapFilter.cpp 2018-11-28 21:23:41.000000000 -0800 +++ new/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/filter-tagged/HeapFilter.cpp 2018-11-28 21:23:41.000000000 -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 value 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(