From 0dc4878d300e5aa6cde422afcf2f2fc6e81dedf1 Mon Sep 17 00:00:00 2001 From: Doug Simon Date: Fri, 3 Feb 2017 11:42:41 +0100 Subject: [PATCH 1/6] adapt to removal of HotSpotVMConfigAccess.getTypeSize --- .../graalvm/compiler/hotspot/GraalHotSpotVMConfig.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/graal/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/GraalHotSpotVMConfig.java b/graal/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/GraalHotSpotVMConfig.java index 20457741c193..63d41932cf7f 100644 --- a/graal/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/GraalHotSpotVMConfig.java +++ b/graal/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/GraalHotSpotVMConfig.java @@ -242,7 +242,7 @@ public final int logMinObjAlignment() { return (int) (Math.log(objectAlignment) / Math.log(2)); } - public final int narrowKlassSize = getTypeSize("narrowKlass"); + public final int narrowKlassSize = getFieldValue("CompilerToVM::Data::sizeof_narrowKlass", Integer.class, "int"); public final long narrowKlassBase = getFieldValue("CompilerToVM::Data::Universe_narrow_klass_base", Long.class, "address"); public final int narrowKlassShift = getFieldValue("CompilerToVM::Data::Universe_narrow_klass_shift", Integer.class, "int"); public final int logKlassAlignment = getConstant("LogKlassAlignmentInBytes", Integer.class); @@ -288,7 +288,7 @@ public int layoutHelperElementTypePrimitiveInPlace() { return (layoutHelperArrayTagTypeValue & ~layoutHelperArrayTagObjectValue) << layoutHelperArrayTagShift; } - public final int vtableEntrySize = getTypeSize("vtableEntry"); + public final int vtableEntrySize = getFieldValue("CompilerToVM::Data::sizeof_vtableEntry", Integer.class, "int"); public final int vtableEntryMethodOffset = getFieldOffset("vtableEntry::_method", Integer.class, "Method*"); public final int instanceKlassInitStateOffset = getFieldOffset("InstanceKlass::_init_state", Integer.class, "u1"); @@ -300,7 +300,7 @@ public int layoutHelperElementTypePrimitiveInPlace() { public final int instanceKlassStateLinked = getConstant("InstanceKlass::linked", Integer.class); public final int instanceKlassStateFullyInitialized = getConstant("InstanceKlass::fully_initialized", Integer.class); - public final int arrayOopDescSize = getTypeSize("arrayOopDesc"); + public final int arrayOopDescSize = getFieldValue("CompilerToVM::Data::sizeof_arrayOopDesc", Integer.class, "int"); /** * The offset of the array length word in an array object's header. @@ -501,7 +501,7 @@ public long tlabIntArrayMarkWord() { public final int compilationLevelFullOptimization = getConstant("CompLevel_full_optimization", Integer.class); - public final int constantPoolSize = getTypeSize("ConstantPool"); + public final int constantPoolSize = getFieldValue("CompilerToVM::Data::sizeof_ConstantPool", Integer.class, "int"); public final int constantPoolLengthOffset = getFieldOffset("ConstantPool::_length", Integer.class, "int"); @@ -558,7 +558,7 @@ public int g1SATBQueueBufferOffset() { public final int klassOffset = getFieldValue("java_lang_Class::_klass_offset", Integer.class, "int"); public final int arrayKlassOffset = getFieldValue("java_lang_Class::_array_klass_offset", Integer.class, "int"); - public final int basicLockSize = getTypeSize("BasicLock"); + public final int basicLockSize = getFieldValue("CompilerToVM::Data::sizeof_BasicLock", Integer.class, "int"); public final int basicLockDisplacedHeaderOffset = getFieldOffset("BasicLock::_displaced_header", Integer.class, "markOop"); public final int threadAllocatedBytesOffset = getFieldOffset("Thread::_allocated_bytes", Integer.class, "jlong"); From 3e2893ba7c5c965748ec404bb32fc260836ef8c1 Mon Sep 17 00:00:00 2001 From: Doug Simon Date: Fri, 3 Feb 2017 12:00:04 +0100 Subject: [PATCH 2/6] update required jvmci version --- ci_common/common.hocon | 6 +++--- .../src/org/graalvm/compiler/hotspot/JVMCIVersionCheck.java | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ci_common/common.hocon b/ci_common/common.hocon index b5ea3f5872cd..d59a020076c0 100644 --- a/ci_common/common.hocon +++ b/ci_common/common.hocon @@ -2,10 +2,10 @@ overlay = 2547479e992d700df5c4d5207a8dfe9c00a89747 java7 : {name : oraclejdk, version : "7", platformspecific: true} -java8 : {name : labsjdk, version : "8u111-jvmci-0.23", platformspecific: true} +java8 : {name : labsjdk, version : "8u111-jvmci-0.24-dev", platformspecific: true} java9 : {name : labsjdk, version : "9-SNAPSHOT", platformspecific: true} -java9EA : {name : labsjdk, version : "9-ea+152", platformspecific: true} -java8Debug : {name : labsjdk, version : "8u111-jvmci-0.23-fastdebug", platformspecific: true} +java9EA : {name : labsjdk, version : "9-ea+156", platformspecific: true} +java8Debug : {name : labsjdk, version : "8u111-jvmci-0.24-dev-fastdebug", platformspecific: true} mx : { packages : { diff --git a/graal/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/JVMCIVersionCheck.java b/graal/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/JVMCIVersionCheck.java index 68f35f6445bc..71dc9a66b609 100644 --- a/graal/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/JVMCIVersionCheck.java +++ b/graal/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/JVMCIVersionCheck.java @@ -37,9 +37,9 @@ class JVMCIVersionCheck { private static final int JVMCI8_MIN_MAJOR_VERSION = 0; - private static final int JVMCI8_MIN_MINOR_VERSION = 23; + private static final int JVMCI8_MIN_MINOR_VERSION = 24; - private static final int JVMCI9_MIN_EA_BUILD = 152; + private static final int JVMCI9_MIN_EA_BUILD = 156; private static void failVersionCheck(boolean exit, String reason, Object... args) { Formatter errorMessage = new Formatter().format(reason, args); From f3d7bce9cc2b2ddbf4d5792a141c192c6202fad5 Mon Sep 17 00:00:00 2001 From: Doug Simon Date: Sat, 4 Feb 2017 11:12:05 +0100 Subject: [PATCH 3/6] fixed internal field equivalence test --- .../test/HotSpotResolvedJavaFieldTest.java | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/graal/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/HotSpotResolvedJavaFieldTest.java b/graal/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/HotSpotResolvedJavaFieldTest.java index 7de0cec8ad03..1265cd91f7f2 100644 --- a/graal/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/HotSpotResolvedJavaFieldTest.java +++ b/graal/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/HotSpotResolvedJavaFieldTest.java @@ -52,18 +52,24 @@ public class HotSpotResolvedJavaFieldTest extends HotSpotGraalCompilerTest { private static final Class[] classesWithInternalFields = {Class.class, ClassLoader.class}; private static final Method createFieldMethod; + private static final Field indexField; static { - Method ret = null; + Method m = null; + Field f = null; try { Class typeImpl = Class.forName("jdk.vm.ci.hotspot.HotSpotResolvedObjectTypeImpl"); - ret = typeImpl.getDeclaredMethod("createField", String.class, JavaType.class, long.class, int.class); - Util.setAccessible(ret, true); - } catch (ClassNotFoundException | NoSuchMethodException | SecurityException e) { - e.printStackTrace(); + m = typeImpl.getDeclaredMethod("createField", JavaType.class, long.class, int.class, int.class); + Util.setAccessible(m, true); + Class fieldImpl = Class.forName("jdk.vm.ci.hotspot.HotSpotResolvedJavaFieldImpl"); + f = fieldImpl.getDeclaredField("index"); + Util.setAccessible(f, true); + } catch (Exception e) { + throw new AssertionError(e); } - createFieldMethod = ret; + createFieldMethod = m; + indexField = f; } /** @@ -96,21 +102,22 @@ public void testModifiersForInternal() { /** * Tests that {@code HotSpotResolvedObjectType#createField(String, JavaType, long, int)} always - * returns the same object for an internal field. + * returns an {@linkplain ResolvedJavaField#equals(Object) equivalent} object for an internal + * field. * * @throws InvocationTargetException * @throws IllegalArgumentException * @throws IllegalAccessException */ @Test - public void testCachingForInternalFields() throws IllegalAccessException, IllegalArgumentException, InvocationTargetException { - Assert.assertTrue("HotSpotResolvedObjectTypeImpl.createField method not found", createFieldMethod != null); + public void testEquivalenceForInternalFields() throws IllegalAccessException, IllegalArgumentException, InvocationTargetException { for (Class c : classesWithInternalFields) { HotSpotResolvedObjectType type = HotSpotResolvedObjectType.fromObjectClass(c); for (ResolvedJavaField field : type.getInstanceFields(false)) { if (field.isInternal()) { HotSpotResolvedJavaField expected = (HotSpotResolvedJavaField) field; - ResolvedJavaField actual = (ResolvedJavaField) createFieldMethod.invoke(type, expected.getName(), expected.getType(), expected.offset(), expected.getModifiers()); + int index = indexField.getInt(expected); + ResolvedJavaField actual = (ResolvedJavaField) createFieldMethod.invoke(type, expected.getType(), expected.offset(), expected.getModifiers(), index); Assert.assertEquals(expected, actual); } } From 4e2a862c94a9b2e09e660471488251f7365c17ba Mon Sep 17 00:00:00 2001 From: Doug Simon Date: Mon, 6 Feb 2017 21:46:45 +0100 Subject: [PATCH 4/6] broaden class file search for test with @Snippet methods --- .../compiler/replacements/test/ObjectAccessTest.java | 8 +++++++- .../replacements/classfile/ClassfileBytecodeProvider.java | 6 ++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/graal/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/ObjectAccessTest.java b/graal/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/ObjectAccessTest.java index 79fca2a0b027..8502ad22f0ce 100644 --- a/graal/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/ObjectAccessTest.java +++ b/graal/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/ObjectAccessTest.java @@ -37,6 +37,7 @@ import org.graalvm.compiler.options.OptionValues; import org.graalvm.compiler.replacements.ReplacementsImpl; import org.graalvm.compiler.replacements.Snippets; +import org.graalvm.compiler.replacements.classfile.ClassfileBytecodeProvider; import org.graalvm.compiler.word.ObjectAccess; import org.graalvm.compiler.word.Pointer; import org.graalvm.compiler.word.Word; @@ -45,6 +46,7 @@ import jdk.vm.ci.code.BytecodeFrame; import jdk.vm.ci.meta.JavaKind; +import jdk.vm.ci.meta.MetaAccessProvider; import jdk.vm.ci.meta.ResolvedJavaMethod; /** @@ -57,7 +59,11 @@ public class ObjectAccessTest extends GraalCompilerTest implements Snippets { private final ReplacementsImpl installer; public ObjectAccessTest() { - installer = (ReplacementsImpl) getReplacements(); + ReplacementsImpl d = (ReplacementsImpl) getReplacements(); + MetaAccessProvider metaAccess = d.providers.getMetaAccess(); + ClassfileBytecodeProvider bytecodeProvider = new ClassfileBytecodeProvider(metaAccess, d.snippetReflection, ClassLoader.getSystemClassLoader()); + installer = new ReplacementsImpl(d.providers, d.snippetReflection, bytecodeProvider, d.target); + installer.setGraphBuilderPlugins(d.getGraphBuilderPlugins()); } @Override diff --git a/graal/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/classfile/ClassfileBytecodeProvider.java b/graal/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/classfile/ClassfileBytecodeProvider.java index de36dae39dcd..a162cf4eac5e 100644 --- a/graal/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/classfile/ClassfileBytecodeProvider.java +++ b/graal/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/classfile/ClassfileBytecodeProvider.java @@ -77,6 +77,12 @@ public ClassfileBytecodeProvider(MetaAccessProvider metaAccess, SnippetReflectio this.loader = cl == null ? ClassLoader.getSystemClassLoader() : cl; } + public ClassfileBytecodeProvider(MetaAccessProvider metaAccess, SnippetReflectionProvider snippetReflection, ClassLoader loader) { + this.metaAccess = metaAccess; + this.snippetReflection = snippetReflection; + this.loader = loader; + } + @Override public Bytecode getBytecode(ResolvedJavaMethod method) { Classfile classfile = getClassfile(resolveToClass(method.getDeclaringClass().getName())); From 5ee7023084bca89ba3e662d3494d3d2bf997e9f9 Mon Sep 17 00:00:00 2001 From: Doug Simon Date: Wed, 8 Feb 2017 15:03:00 +0100 Subject: [PATCH 5/6] update jvmci-0.24 reference --- ci_common/common.hocon | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci_common/common.hocon b/ci_common/common.hocon index d59a020076c0..96c6f9980a31 100644 --- a/ci_common/common.hocon +++ b/ci_common/common.hocon @@ -2,10 +2,10 @@ overlay = 2547479e992d700df5c4d5207a8dfe9c00a89747 java7 : {name : oraclejdk, version : "7", platformspecific: true} -java8 : {name : labsjdk, version : "8u111-jvmci-0.24-dev", platformspecific: true} +java8 : {name : labsjdk, version : "8u121-jvmci-0.24-dev", platformspecific: true} java9 : {name : labsjdk, version : "9-SNAPSHOT", platformspecific: true} java9EA : {name : labsjdk, version : "9-ea+156", platformspecific: true} -java8Debug : {name : labsjdk, version : "8u111-jvmci-0.24-dev-fastdebug", platformspecific: true} +java8Debug : {name : labsjdk, version : "8u121-jvmci-0.24-dev-fastdebug", platformspecific: true} mx : { packages : { From 958d3ce16c527b3d1b9d6338cfa03a32c1518ca1 Mon Sep 17 00:00:00 2001 From: Vojin Jovanovic Date: Fri, 10 Feb 2017 16:34:17 +0100 Subject: [PATCH 6/6] [ci] remove dev from jvmci --- .travis.yml | 4 ++-- ci_common/common.hocon | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3d2e5349a81d..a08d3389015b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,8 +15,8 @@ dist: trusty env: global: - - JVMCI_VERSION="jvmci-0.23" - - JVMCI_BASE_JDK8="jdk1.8.0_111" + - JVMCI_VERSION="jvmci-0.24" + - JVMCI_BASE_JDK8="jdk1.8.0_121" - JDK9_EA_BUILD="152" matrix: - JDK="jdk8" GATE="style,fullbuild" diff --git a/ci_common/common.hocon b/ci_common/common.hocon index 96c6f9980a31..5d14e4268aa8 100644 --- a/ci_common/common.hocon +++ b/ci_common/common.hocon @@ -2,10 +2,10 @@ overlay = 2547479e992d700df5c4d5207a8dfe9c00a89747 java7 : {name : oraclejdk, version : "7", platformspecific: true} -java8 : {name : labsjdk, version : "8u121-jvmci-0.24-dev", platformspecific: true} +java8 : {name : labsjdk, version : "8u121-jvmci-0.24", platformspecific: true} java9 : {name : labsjdk, version : "9-SNAPSHOT", platformspecific: true} java9EA : {name : labsjdk, version : "9-ea+156", platformspecific: true} -java8Debug : {name : labsjdk, version : "8u121-jvmci-0.24-dev-fastdebug", platformspecific: true} +java8Debug : {name : labsjdk, version : "8u121-jvmci-0.24-fastdebug", platformspecific: true} mx : { packages : {