8193577: nsk/jvmti/IterateThroughHeap/filter-tagged fails with Graal in Xcomp mode

Make field values opaque to compiler

Reviewed-by: dlong, sspitsyn
This commit is contained in:
Igor Veresov 2018-11-29 11:47:08 -08:00
parent bbfe9d2168
commit da77659d7e

View File

@ -61,10 +61,11 @@ static int reported_objects = 0;
//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 @@ int tag_objects(jvmtiEnv *jvmti, JNIEnv *jni) {
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(