Skip to content
Permalink
Browse files

remove unnecessary JDK9Method class

  • Loading branch information...
dougxc committed Mar 18, 2018
1 parent 657491d commit a0a2d08f84ca5b78a8b880313a1082cc392c167a
Showing with 480 additions and 648 deletions.
  1. +0 −126 ...ler/src/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/util/ModuleAPI.java
  2. +61 −0 ...iler/src/org.graalvm.compiler.hotspot.jdk9/src/org/graalvm/compiler/hotspot/IsGraalPredicate.java
  3. +20 −9 ...c/org/graalvm/compiler/hotspot/meta/{HotSpotTrustedModules.java → IntrinsificationPredicate.java}
  4. +3 −3 ...org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/CheckGraalIntrinsics.java
  5. +4 −4 .../src/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/CompileTheWorld.java
  6. +6 −67 ...rc/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotGraalCompilerFactory.java
  7. +70 −0 compiler/src/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/IsGraalPredicate.java
  8. +2 −3 ...rg.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotGraphBuilderPlugins.java
  9. +4 −54 .../org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotInvocationPlugins.java
  10. +0 −43 ...src/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotTrustedModules.java
  11. +1 −1 ...rg.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotUnsafeSubstitutions.java
  12. +66 −0 ...org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/IntrinsificationPredicate.java
  13. +1 −1 ...org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/SHA2Substitutions.java
  14. +1 −1 ...org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/SHA5Substitutions.java
  15. +1 −1 .../org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/SHASubstitutions.java
  16. +1 −1 ....graalvm.compiler.phases/src/org/graalvm/compiler/phases/verify/VerifyCallerSensitiveMethods.java
  17. +3 −24 compiler/src/org.graalvm.compiler.printer/src/org/graalvm/compiler/printer/GraphPrinter.java
  18. +2 −2 ...iler.replacements.amd64/src/org/graalvm/compiler/replacements/amd64/AMD64GraphBuilderPlugins.java
  19. +1 −1 ...alvm.compiler.replacements/src/org/graalvm/compiler/replacements/StandardGraphBuilderPlugins.java
  20. +2 −19 ...piler.replacements/src/org/graalvm/compiler/replacements/classfile/ClassfileBytecodeProvider.java
  21. +181 −0 ...graalvm.compiler.serviceprovider.jdk9/src/org/graalvm/compiler/serviceprovider/GraalServices.java
  22. +0 −99 ...rg.graalvm.compiler.serviceprovider.jdk9/src/org/graalvm/compiler/serviceprovider/JDK9Method.java
  23. +48 −74 .../org.graalvm.compiler.serviceprovider/src/org/graalvm/compiler/serviceprovider/GraalServices.java
  24. +0 −107 ...src/org.graalvm.compiler.serviceprovider/src/org/graalvm/compiler/serviceprovider/JDK9Method.java
  25. +1 −1 ...raalvm.compiler.truffle.runtime/src/org/graalvm/compiler/truffle/runtime/GraalTruffleRuntime.java
  26. +1 −7 ...g.graalvm.compiler.truffle.test/src/org/graalvm/compiler/truffle/test/LazyInitializationTest.java

This file was deleted.

@@ -0,0 +1,61 @@
/*
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.graalvm.compiler.hotspot;

import jdk.vm.ci.hotspot.HotSpotJVMCICompilerFactory;

/**
* Determines if a given class is a JVMCI or Graal class for the purpose of
* {@link HotSpotGraalCompilerFactory.Options#CompileGraalWithC1Only}.
*/
public class IsGraalPredicate {
/**
* Module containing {@link HotSpotJVMCICompilerFactory}.
*/
private final Module jvmciModule;

/**
* Module containing {@link HotSpotGraalCompilerFactory}.
*/
private final Module graalModule;

/**
* Module containing the {@linkplain CompilerConfigurationFactory#selectFactory selected}
* configuration.
*/
private Module compilerConfigurationModule;

public IsGraalPredicate() {
jvmciModule = HotSpotJVMCICompilerFactory.class.getModule();
graalModule = HotSpotGraalCompilerFactory.class.getModule();
}

void onCompilerConfigurationFactorySelection(CompilerConfigurationFactory factory) {
compilerConfigurationModule = factory.getClass().getModule();
}

boolean apply(Class<?> declaringClass) {
Module module = declaringClass.getModule();
return jvmciModule == module || graalModule == module || compilerConfigurationModule == module;
}
}
@@ -28,28 +28,39 @@
import org.graalvm.compiler.phases.tiers.CompilerConfiguration;

/**
* Builds the result for {@link HotSpotInvocationPlugins#initTrustedModules(CompilerConfiguration)}.
* Determines if methods in a given class can be intrinsified.
*
* This version of the class must be used on JDK 9 or later.
* Only classes loaded from the module defining the compiler configuration or any of its transitive
* dependencies can be intrinsified.
*
* @see "https://docs.oracle.com/javase/9/docs/specs/jar/jar.html#Multi-release"
* This version of the class must be used on JDK 9 or later.
*/
public final class HotSpotTrustedModules {
static EconomicSet<Object> build(CompilerConfiguration compilerConfiguration) {
EconomicSet<Object> res = EconomicSet.create();
public final class IntrinsificationPredicate {
/**
* Set of modules composed of the module defining the compiler configuration and its transitive
* dependencies.
*/
private final EconomicSet<Module> trustedModules;

IntrinsificationPredicate(CompilerConfiguration compilerConfiguration) {
trustedModules = EconomicSet.create();
Module compilerConfigurationModule = compilerConfiguration.getClass().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()));
}
res.add(compilerConfigurationModule);
trustedModules.add(compilerConfigurationModule);
for (Requires require : compilerConfigurationModule.getDescriptor().requires()) {
for (Module module : compilerConfigurationModule.getLayer().modules()) {
if (module.getName().equals(require.name())) {
res.add(module);
trustedModules.add(module);
}
}
}
return res;
}

public boolean apply(Class<?> declaringClass) {
Module module = declaringClass.getModule();
return trustedModules.contains(module);
}
}
@@ -43,7 +43,7 @@
import org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins;
import org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins.Binding;
import org.graalvm.compiler.runtime.RuntimeProvider;
import org.graalvm.compiler.serviceprovider.JDK9Method;
import org.graalvm.compiler.serviceprovider.GraalServices;
import org.graalvm.compiler.test.GraalTest;
import org.junit.Test;

@@ -542,11 +542,11 @@ public static ResolvedJavaMethod resolveIntrinsic(MetaAccessProvider metaAccess,
}

private static boolean isJDK9OrHigher() {
return JDK9Method.JAVA_SPECIFICATION_VERSION >= 9;
return GraalServices.JAVA_SPECIFICATION_VERSION >= 9;
}

private static boolean isJDK10OrHigher() {
return JDK9Method.JAVA_SPECIFICATION_VERSION >= 10;
return GraalServices.JAVA_SPECIFICATION_VERSION >= 10;
}

private static String getHostArchitectureName() {
@@ -29,7 +29,7 @@
import static org.graalvm.compiler.core.test.ReflectionOptionDescriptors.extractEntries;
import static org.graalvm.compiler.debug.MemUseTrackerKey.getCurrentThreadAllocatedBytes;
import static org.graalvm.compiler.hotspot.test.CompileTheWorld.Options.DESCRIPTORS;
import static org.graalvm.compiler.serviceprovider.JDK9Method.Java8OrEarlier;
import static org.graalvm.compiler.serviceprovider.GraalServices.Java8OrEarlier;

import java.io.Closeable;
import java.io.File;
@@ -88,7 +88,7 @@
import org.graalvm.compiler.options.OptionKey;
import org.graalvm.compiler.options.OptionValues;
import org.graalvm.compiler.options.OptionsParser;
import org.graalvm.compiler.serviceprovider.JDK9Method;
import org.graalvm.compiler.serviceprovider.GraalServices;

import jdk.vm.ci.hotspot.HotSpotCodeCacheProvider;
import jdk.vm.ci.hotspot.HotSpotCompilationRequest;
@@ -109,8 +109,8 @@

/**
* Magic token to denote that JDK classes are to be compiled. If
* {@link JDK9Method#Java8OrEarlier}, then the classes in {@code rt.jar} are compiled. Otherwise
* the classes in the Java runtime image are compiled.
* {@link GraalServices#Java8OrEarlier}, then the classes in {@code rt.jar} are compiled.
* Otherwise the classes in the Java runtime image are compiled.
*/
public static final String SUN_BOOT_CLASS_PATH = "sun.boot.class.path";

0 comments on commit a0a2d08

Please sign in to comment.
You can’t perform that action at this time.