8174957: [JVMCI] jaotc is broken in Xcomp mode

Reviewed-by: iveresov
This commit is contained in:
Doug Simon 2017-02-15 11:14:45 +01:00
parent 5c88e780c2
commit 896fc63787
6 changed files with 23 additions and 13 deletions

View file

@ -70,8 +70,8 @@ class DataBuilder {
*/ */
private void fillVMAddresses(HotSpotVMConfigStore config) { private void fillVMAddresses(HotSpotVMConfigStore config) {
for (VMField vmField : config.getFields().values()) { for (VMField vmField : config.getFields().values()) {
if (vmField.value != null) { if (vmField.value != null && vmField.value instanceof Long) {
final long address = vmField.value; final long address = (Long) vmField.value;
String value = vmField.name; String value = vmField.name;
/* /*
* Some fields don't contain addresses but integer values. At least don't add zero * Some fields don't contain addresses but integer values. At least don't add zero

View file

@ -76,7 +76,7 @@ public class HotSpotCodeCacheProvider implements CodeCacheProvider {
HotSpotVMConfigStore store = runtime.getConfigStore(); HotSpotVMConfigStore store = runtime.getConfigStore();
for (Map.Entry<String, VMField> e : store.getFields().entrySet()) { for (Map.Entry<String, VMField> e : store.getFields().entrySet()) {
VMField field = e.getValue(); VMField field = e.getValue();
if (field.isStatic() && field.value != null && field.value == address) { if (field.isStatic() && field.value != null && field.value instanceof Long && ((Long) field.value) == address) {
return e.getValue() + ":0x" + Long.toHexString(address); return e.getValue() + ":0x" + Long.toHexString(address);
} }
} }

View file

@ -497,7 +497,7 @@ public final class HotSpotJVMCIRuntime implements HotSpotJVMCIRuntimeProvider {
if (!field.isStatic()) { if (!field.isStatic()) {
printConfigLine(vm, "[vmconfig:instance field] %s %s {offset=%d[0x%x]}%n", field.type, field.name, field.offset, field.offset); printConfigLine(vm, "[vmconfig:instance field] %s %s {offset=%d[0x%x]}%n", field.type, field.name, field.offset, field.offset);
} else { } else {
String value = field.value == null ? "null" : String.format("%d[0x%x]", field.value, field.value); String value = field.value == null ? "null" : field.value instanceof Boolean ? field.value.toString() : String.format("%d[0x%x]", field.value, field.value);
printConfigLine(vm, "[vmconfig:static field] %s %s = %s {address=0x%x}%n", field.type, field.name, value, field.address); printConfigLine(vm, "[vmconfig:static field] %s %s = %s {address=0x%x}%n", field.type, field.name, value, field.address);
} }
} }

View file

@ -38,22 +38,22 @@ public final class VMField {
public final String type; public final String type;
/** /**
* If represented field is non-static, this is its offset within the containing structure. * If the represented field is non-static, this is its offset within the containing structure.
*/ */
public final long offset; public final long offset;
/** /**
* If represented field is static, this is its address. Otherwise, this field is 0. * If the represented field is static, this is its address. Otherwise, this is 0.
*/ */
public final long address; public final long address;
/** /**
* Value of the field represented as a boxed long; only valid for non-oop static fields. This * Value of the field represented as a boxed boolean if its C++ type is bool otherwise as a
* value is only captured once, during JVMCI initialization. If {@link #type} cannot be * boxed long; only valid for non-oop static fields. This value is only captured once, during
* meaningfully (e.g., a struct) or safely (e.g., an oop) expressed as a boxed long, this is * JVMCI initialization. If {@link #type} cannot be meaningfully (e.g., a struct) or safely
* {@code null}. * (e.g., an oop) expressed as a boxed object, this is {@code null}.
*/ */
public final Long value; public final Object value;
/** /**
* Determines if the represented field is static. * Determines if the represented field is static.

View file

@ -117,7 +117,7 @@ class JVMCIJavaClasses : AllStatic {
oop_field(VMField, type, "Ljava/lang/String;") \ oop_field(VMField, type, "Ljava/lang/String;") \
long_field(VMField, offset) \ long_field(VMField, offset) \
long_field(VMField, address) \ long_field(VMField, address) \
oop_field(VMField, value, "Ljava/lang/Long;") \ oop_field(VMField, value, "Ljava/lang/Object;") \
end_class \ end_class \
start_class(VMFlag) \ start_class(VMFlag) \
oop_field(VMFlag, name, "Ljava/lang/String;") \ oop_field(VMFlag, name, "Ljava/lang/String;") \

View file

@ -38,6 +38,7 @@
package compiler.jvmci.compilerToVM; package compiler.jvmci.compilerToVM;
import jdk.test.lib.Asserts; import jdk.test.lib.Asserts;
import jdk.vm.ci.hotspot.VMField;
import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime; import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime;
import jdk.vm.ci.hotspot.HotSpotVMConfigAccess; import jdk.vm.ci.hotspot.HotSpotVMConfigAccess;
import jdk.vm.ci.hotspot.HotSpotVMConfigStore; import jdk.vm.ci.hotspot.HotSpotVMConfigStore;
@ -49,10 +50,19 @@ public class ReadConfigurationTest {
} }
private void runTest() { private void runTest() {
TestHotSpotVMConfig config = new TestHotSpotVMConfig(HotSpotJVMCIRuntime.runtime().getConfigStore()); HotSpotVMConfigStore store = HotSpotJVMCIRuntime.runtime().getConfigStore();
TestHotSpotVMConfig config = new TestHotSpotVMConfig(store);
Asserts.assertNE(config.codeCacheHighBound, 0L, "Got null address"); Asserts.assertNE(config.codeCacheHighBound, 0L, "Got null address");
Asserts.assertNE(config.stubRoutineJintArrayCopy, 0L, "Got null address"); Asserts.assertNE(config.stubRoutineJintArrayCopy, 0L, "Got null address");
for (VMField field : store.getFields().values()) {
Object value = field.value;
if (value != null) {
Asserts.assertTrue(value instanceof Long || value instanceof Boolean,
"Got unexpected value type for VM field " + field.name + ": " + value.getClass());
}
}
for (VMIntrinsicMethod m : config.getStore().getIntrinsics()) { for (VMIntrinsicMethod m : config.getStore().getIntrinsics()) {
Asserts.assertNotNull(m); Asserts.assertNotNull(m);
Asserts.assertNotNull(m.declaringClass); Asserts.assertNotNull(m.declaringClass);