--- old/src/hotspot/.mx.jvmci/suite.py 2018-08-15 23:16:26.000000000 +0200 +++ new/src/hotspot/.mx.jvmci/suite.py 2018-08-15 23:16:26.000000000 +0200 @@ -43,7 +43,8 @@ "jdk.vm.ci.services" : { "subDir" : "../jdk.internal.vm.ci/share/classes", "sourceDirs" : ["src"], - "javaCompliance" : "9", + "javaCompliance" : "9+", + "checkstyleVersion" : "8.8", "workingSets" : "API,JVMCI", }, @@ -53,7 +54,7 @@ "subDir" : "../jdk.internal.vm.ci/share/classes", "sourceDirs" : ["src"], "checkstyle" : "jdk.vm.ci.services", - "javaCompliance" : "9", + "javaCompliance" : "9+", "workingSets" : "API,JVMCI", }, @@ -61,7 +62,7 @@ "subDir" : "../jdk.internal.vm.ci/share/classes", "sourceDirs" : ["src"], "checkstyle" : "jdk.vm.ci.services", - "javaCompliance" : "9", + "javaCompliance" : "9+", "workingSets" : "API,JVMCI", }, @@ -70,7 +71,7 @@ "sourceDirs" : ["src"], "dependencies" : ["jdk.vm.ci.meta"], "checkstyle" : "jdk.vm.ci.services", - "javaCompliance" : "9", + "javaCompliance" : "9+", "workingSets" : "API,JVMCI", }, @@ -85,7 +86,7 @@ "jdk.vm.ci.hotspot", ], "checkstyle" : "jdk.vm.ci.services", - "javaCompliance" : "9", + "javaCompliance" : "9+", "workingSets" : "API,JVMCI", }, @@ -97,7 +98,7 @@ "jdk.vm.ci.services", ], "checkstyle" : "jdk.vm.ci.services", - "javaCompliance" : "9", + "javaCompliance" : "9+", "workingSets" : "API,JVMCI", }, @@ -110,7 +111,7 @@ "jdk.vm.ci.runtime", ], "checkstyle" : "jdk.vm.ci.services", - "javaCompliance" : "9", + "javaCompliance" : "9+", "workingSets" : "API,JVMCI", }, @@ -121,7 +122,7 @@ "sourceDirs" : ["src"], "dependencies" : ["jdk.vm.ci.code"], "checkstyle" : "jdk.vm.ci.services", - "javaCompliance" : "9", + "javaCompliance" : "9+", "workingSets" : "JVMCI,AArch64", }, @@ -130,7 +131,7 @@ "sourceDirs" : ["src"], "dependencies" : ["jdk.vm.ci.code"], "checkstyle" : "jdk.vm.ci.services", - "javaCompliance" : "9", + "javaCompliance" : "9+", "workingSets" : "JVMCI,AMD64", }, @@ -139,7 +140,7 @@ "sourceDirs" : ["src"], "dependencies" : ["jdk.vm.ci.code"], "checkstyle" : "jdk.vm.ci.services", - "javaCompliance" : "9", + "javaCompliance" : "9+", "workingSets" : "JVMCI,SPARC", }, @@ -156,7 +157,7 @@ "jdk.internal.org.objectweb.asm", ], "checkstyle" : "jdk.vm.ci.services", - "javaCompliance" : "9", + "javaCompliance" : "9+", "workingSets" : "JVMCI", }, @@ -168,7 +169,7 @@ "jdk.vm.ci.hotspot", ], "checkstyle" : "jdk.vm.ci.services", - "javaCompliance" : "9", + "javaCompliance" : "9+", "workingSets" : "API,JVMCI", }, @@ -180,7 +181,7 @@ "jdk.vm.ci.hotspot", ], "checkstyle" : "jdk.vm.ci.services", - "javaCompliance" : "9", + "javaCompliance" : "9+", "workingSets" : "JVMCI,HotSpot,AArch64", }, @@ -192,7 +193,7 @@ "jdk.vm.ci.hotspot", ], "checkstyle" : "jdk.vm.ci.services", - "javaCompliance" : "9", + "javaCompliance" : "9+", "workingSets" : "JVMCI,HotSpot,AMD64", }, @@ -204,7 +205,7 @@ "jdk.vm.ci.hotspot", ], "checkstyle" : "jdk.vm.ci.services", - "javaCompliance" : "9", + "javaCompliance" : "9+", "workingSets" : "JVMCI,HotSpot,SPARC", }, --- old/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotConstantPool.java 2018-08-15 23:16:27.000000000 +0200 +++ new/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotConstantPool.java 2018-08-15 23:16:27.000000000 +0200 @@ -647,20 +647,22 @@ } /* - * Converts a raw index from the bytecodes to a constant pool index - * (not a cache index). + * Converts a raw index from the bytecodes to a constant pool index (not a cache index). * * @param rawIndex index from the bytecode + * * @param opcode bytecode to convert the index for + * * @return constant pool index */ - public int rawIndexToConstantPoolIndex(int index, int opcode) { - if (isInvokedynamicIndex(index)) { + public int rawIndexToConstantPoolIndex(int rawIndex, int opcode) { + int index; + if (isInvokedynamicIndex(rawIndex)) { assert opcode == Bytecodes.INVOKEDYNAMIC; - index = decodeInvokedynamicIndex(index) + config().constantPoolCpCacheIndexTag; + index = decodeInvokedynamicIndex(rawIndex) + config().constantPoolCpCacheIndexTag; } else { assert opcode != Bytecodes.INVOKEDYNAMIC; - index = rawIndexToConstantPoolCacheIndex(index, opcode); + index = rawIndexToConstantPoolCacheIndex(rawIndex, opcode); } return compilerToVM().constantPoolRemapInstructionOperandFromCache(this, index); } @@ -772,19 +774,20 @@ } /** - * Check for a resolved dynamic adapter method at the specified index, - * resulting from either a resolved invokedynamic or invokevirtual on a signature polymorphic - * MethodHandle method (HotSpot invokehandle). + * Check for a resolved dynamic adapter method at the specified index, resulting from either a + * resolved invokedynamic or invokevirtual on a signature polymorphic MethodHandle method + * (HotSpot invokehandle). * * @param cpi the constant pool index * @param opcode the opcode of the instruction for which the lookup is being performed - * @return {@code true} if a signature polymorphic method reference was found, otherwise {@code false} + * @return {@code true} if a signature polymorphic method reference was found, otherwise + * {@code false} */ public boolean isResolvedDynamicInvoke(int cpi, int opcode) { if (Bytecodes.isInvokeHandleAlias(opcode)) { final int methodRefCacheIndex = rawIndexToConstantPoolCacheIndex(cpi, opcode); assert checkTag(compilerToVM().constantPoolRemapInstructionOperandFromCache(this, methodRefCacheIndex), JVM_CONSTANT.MethodRef); - int op = compilerToVM().isResolvedInvokeHandleInPool(this, methodRefCacheIndex); + int op = compilerToVM().isResolvedInvokeHandleInPool(this, methodRefCacheIndex); return op == opcode; } return false; --- old/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotConstantPoolObject.java 2018-08-15 23:16:28.000000000 +0200 +++ new/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotConstantPoolObject.java 2018-08-15 23:16:28.000000000 +0200 @@ -23,11 +23,10 @@ package jdk.vm.ci.hotspot; import jdk.vm.ci.meta.JavaConstant; -import jdk.vm.ci.meta.ResolvedJavaType; /** - * Represents a constant that was retrieved from a constant pool. - * Used to keep track of the constant pool slot for the constant. + * Represents a constant that was retrieved from a constant pool. Used to keep track of the constant + * pool slot for the constant. */ public final class HotSpotConstantPoolObject extends HotSpotObjectConstantImpl { @@ -36,14 +35,19 @@ } public static JavaConstant forObject(HotSpotResolvedObjectType type, int cpi, JavaConstant object) { - return forObject(type, cpi, ((HotSpotObjectConstantImpl)object).object()); + return forObject(type, cpi, ((HotSpotObjectConstantImpl) object).object()); } private final HotSpotResolvedObjectType type; private final int cpi; - public HotSpotResolvedObjectType getCpType() { return type; } - public int getCpi() { return cpi; } + public HotSpotResolvedObjectType getCpType() { + return type; + } + + public int getCpi() { + return cpi; + } HotSpotConstantPoolObject(HotSpotResolvedObjectType type, int cpi, Object object) { super(object, false); --- old/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIMetaAccessContext.java 2018-08-15 23:16:29.000000000 +0200 +++ new/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIMetaAccessContext.java 2018-08-15 23:16:29.000000000 +0200 @@ -145,7 +145,7 @@ } } - private final ClassValue> resolvedJavaType = new ClassValue>() { + private final ClassValue> resolvedJavaType = new ClassValue<>() { @Override protected WeakReference computeValue(Class type) { return new WeakReference<>(createClass(type)); @@ -164,10 +164,9 @@ javaType = type.get(); if (javaType == null) { /* - * If the referent has become null, clear out the current value - * and let computeValue above create a new value. Reload the - * value in a loop because in theory the WeakReference referent - * can be reclaimed at any point. + * If the referent has become null, clear out the current value and let computeValue + * above create a new value. Reload the value in a loop because in theory the + * WeakReference referent can be reclaimed at any point. */ resolvedJavaType.remove(javaClass); } --- old/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java 2018-08-15 23:16:30.000000000 +0200 +++ new/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java 2018-08-15 23:16:30.000000000 +0200 @@ -363,44 +363,44 @@ */ public Predicate getIntrinsificationTrustPredicate(Class... compilerLeafClasses) { if (intrinsificationTrustPredicate == null) { - intrinsificationTrustPredicate = new Predicate() { - @Override - public boolean test(ResolvedJavaType type) { - if (type instanceof HotSpotResolvedJavaType) { - Class mirror = getMirror((HotSpotResolvedJavaType) type); - Module module = mirror.getModule(); - return getTrustedModules().contains(module); - } else { - return false; - } + intrinsificationTrustPredicate = new Predicate<>() { + @Override + public boolean test(ResolvedJavaType type) { + if (type instanceof HotSpotResolvedJavaType) { + Class mirror = getMirror(type); + Module module = mirror.getModule(); + return getTrustedModules().contains(module); + } else { + return false; } + } - private volatile Set trustedModules; + private volatile Set trustedModules; - private Set getTrustedModules() { - Set modules = trustedModules; - if (modules == null) { - modules = new HashSet<>(); - for (Class compilerConfiguration : compilerLeafClasses) { - Module compilerConfigurationModule = compilerConfiguration.getModule(); - if (compilerConfigurationModule.getDescriptor().isAutomatic()) { - throw new IllegalArgumentException(String.format("The module '%s' defining the Graal compiler configuration class '%s' must not be an automatic module", - compilerConfigurationModule.getName(), compilerConfiguration.getClass().getName())); - } - modules.add(compilerConfigurationModule); - for (Requires require : compilerConfigurationModule.getDescriptor().requires()) { - for (Module module : compilerConfigurationModule.getLayer().modules()) { - if (module.getName().equals(require.name())) { - modules.add(module); - } + private Set getTrustedModules() { + Set modules = trustedModules; + if (modules == null) { + modules = new HashSet<>(); + for (Class compilerConfiguration : compilerLeafClasses) { + Module compilerConfigurationModule = compilerConfiguration.getModule(); + if (compilerConfigurationModule.getDescriptor().isAutomatic()) { + throw new IllegalArgumentException(String.format("The module '%s' defining the Graal compiler configuration class '%s' must not be an automatic module", + compilerConfigurationModule.getName(), compilerConfiguration.getClass().getName())); + } + modules.add(compilerConfigurationModule); + for (Requires require : compilerConfigurationModule.getDescriptor().requires()) { + for (Module module : compilerConfigurationModule.getLayer().modules()) { + if (module.getName().equals(require.name())) { + modules.add(module); } } } - trustedModules = modules; } - return modules; + trustedModules = modules; } - }; + return modules; + } + }; } return intrinsificationTrustPredicate; } @@ -413,6 +413,7 @@ * does not support mapping {@link ResolvedJavaType} instances to {@link Class} * instances */ + @SuppressWarnings("static-method") public Class getMirror(ResolvedJavaType type) { return ((HotSpotResolvedJavaType) type).mirror(); } @@ -654,6 +655,7 @@ * * @return the offset in bytes */ + @SuppressWarnings("static-method") public int getArrayBaseOffset(JavaKind kind) { switch (kind) { case Boolean: @@ -685,6 +687,7 @@ * * @return the scale in order to convert the index into a byte offset */ + @SuppressWarnings("static-method") public int getArrayIndexScale(JavaKind kind) { switch (kind) { case Boolean: @@ -759,6 +762,7 @@ * {@code clazz} is already linked or the SVM JVMCI library does not contain a * JNI-compliant symbol for a native method in {@code clazz} */ + @SuppressWarnings({"static-method", "unused"}) public void registerNativeMethods(Class clazz) { throw new UnsatisfiedLinkError("SVM library is not available"); } --- old/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaFieldImpl.java 2018-08-15 23:16:31.000000000 +0200 +++ new/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaFieldImpl.java 2018-08-15 23:16:31.000000000 +0200 @@ -191,7 +191,7 @@ } try { return holder.mirror().getDeclaredField(getName()); - } catch (NoSuchFieldException | NoClassDefFoundError e) { + } catch (NoSuchFieldException e) { return null; } } --- old/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaMethodImpl.java 2018-08-15 23:16:32.000000000 +0200 +++ new/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaMethodImpl.java 2018-08-15 23:16:32.000000000 +0200 @@ -73,7 +73,13 @@ private final HotSpotSignature signature; private HotSpotMethodData methodData; private byte[] code; - private Executable toJavaCache; + + /** + * Cache for {@link #toJava()}. Set to {@link #signature} when resolving reflection object fails + * due to reflection filtering (see {@code Reflection.fieldFilterMap} and + * {@code Reflection.methodFilterMap}). + */ + private Object toJavaCache; /** * Only 30% of {@link HotSpotResolvedJavaMethodImpl}s have their name accessed so compute it @@ -322,7 +328,8 @@ } /** - * Sets flags on {@code method} indicating that it should never be inlined or compiled by the VM. + * Sets flags on {@code method} indicating that it should never be inlined or compiled by the + * VM. */ @Override public void setNotInlinableOrCompilable() { @@ -581,25 +588,33 @@ private Executable toJava() { if (toJavaCache != null) { - return toJavaCache; + if (toJavaCache == signature) { + return null; + } + return (Executable) toJavaCache; } - try { - Class[] parameterTypes = signatureToTypes(); - Class returnType = ((HotSpotResolvedJavaType) getSignature().getReturnType(holder).resolve(holder)).mirror(); + Class[] parameterTypes = signatureToTypes(); + Class returnType = ((HotSpotResolvedJavaType) getSignature().getReturnType(holder).resolve(holder)).mirror(); - Executable result; - if (isConstructor()) { + Executable result; + if (isConstructor()) { + try { result = holder.mirror().getDeclaredConstructor(parameterTypes); - } else { - // Do not use Method.getDeclaredMethod() as it can return a bridge method - // when this.isBridge() is false and vice versa. - result = searchMethods(holder.mirror().getDeclaredMethods(), getName(), returnType, parameterTypes); + } catch (NoSuchMethodException e) { + toJavaCache = signature; + return null; + } + } else { + // Do not use Method.getDeclaredMethod() as it can return a bridge method + // when this.isBridge() is false and vice versa. + result = searchMethods(holder.mirror().getDeclaredMethods(), getName(), returnType, parameterTypes); + if (result == null) { + toJavaCache = signature; + return null; } - toJavaCache = result; - return result; - } catch (NoSuchMethodException | NoClassDefFoundError e) { - return null; } + toJavaCache = result; + return result; } @Override @@ -746,7 +761,7 @@ * read the JVM_ACC_IS_OBSOLETE bit (or anything else) via the raw pointer as obsoleted methods * are subject to clean up and deletion (see InstanceKlass::purge_previous_versions_internal). */ - private static final ClassValue> SpeculationLogs = new ClassValue>() { + private static final ClassValue> SpeculationLogs = new ClassValue<>() { @Override protected Map computeValue(java.lang.Class type) { return new HashMap<>(4); @@ -796,6 +811,7 @@ return compilerToVM().hasCompiledCodeForOSR(this, entryBCI, level); } + @Override public int methodIdnum() { return UNSAFE.getChar(getConstMethod() + config().constMethodMethodIdnumOffset); } --- old/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java 2018-08-15 23:16:33.000000000 +0200 +++ new/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java 2018-08-15 23:16:33.000000000 +0200 @@ -984,6 +984,7 @@ return UNSAFE.getInt(getMetaspaceKlass() + config().instanceKlassMiscFlagsOffset); } + @Override public boolean isAnonymous() { return (getMiscFlags() & config().instanceKlassMiscIsAnonymous) != 0; } --- old/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotSignature.java 2018-08-15 23:16:34.000000000 +0200 +++ new/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotSignature.java 2018-08-15 23:16:34.000000000 +0200 @@ -25,7 +25,6 @@ import java.util.ArrayList; import java.util.List; -import jdk.vm.ci.common.JVMCIError; import jdk.vm.ci.meta.JavaKind; import jdk.vm.ci.meta.JavaType; import jdk.vm.ci.meta.ResolvedJavaType; --- old/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/Assumptions.java 2018-08-15 23:16:35.000000000 +0200 +++ new/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/Assumptions.java 2018-08-15 23:16:35.000000000 +0200 @@ -98,7 +98,7 @@ } /** - * An assumption that a given class has no subclasses implementing {@link Object#finalize()}). + * An assumption that a given class has no subclasses implementing {@code Object#finalize()}). */ public static final class NoFinalizableSubclass extends Assumption { --- old/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.services/.checkstyle_checks.xml 2018-08-15 23:16:36.000000000 +0200 +++ new/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.services/.checkstyle_checks.xml 2018-08-15 23:16:36.000000000 +0200 @@ -9,7 +9,6 @@ - @@ -132,6 +131,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -145,69 +204,9 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --- old/test/hotspot/jtreg/compiler/jvmci/compilerToVM/AllocateCompileIdTest.java 2018-08-15 23:16:37.000000000 +0200 +++ new/test/hotspot/jtreg/compiler/jvmci/compilerToVM/AllocateCompileIdTest.java 2018-08-15 23:16:37.000000000 +0200 @@ -35,6 +35,7 @@ * * @build jdk.internal.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.parser.DiagnosticCommand * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI