changeset 22697:57646377e480

Rename Compiler to JVMCICompiler and expose it from JVMCIRuntime.
author Roland Schatz <roland.schatz@oracle.com>
date Wed, 21 Oct 2015 13:47:47 +0200
parents ce6b9837f602
children 37505a836aaf
files jvmci/jdk.vm.ci.compiler/src/jdk/vm/ci/compiler/Compiler.java jvmci/jdk.vm.ci.compiler/src/jdk/vm/ci/compiler/CompilerFactory.java jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCICompilerConfig.java jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntimeProvider.java jvmci/jdk.vm.ci.runtime/src/jdk/vm/ci/runtime/JVMCICompiler.java jvmci/jdk.vm.ci.runtime/src/jdk/vm/ci/runtime/JVMCICompilerFactory.java jvmci/jdk.vm.ci.runtime/src/jdk/vm/ci/runtime/JVMCIRuntime.java make/jvmci.make mx.jvmci/suite.py
diffstat 10 files changed, 118 insertions(+), 131 deletions(-) [+]
line wrap: on
line diff
--- a/jvmci/jdk.vm.ci.compiler/src/jdk/vm/ci/compiler/Compiler.java	Wed Oct 21 11:44:15 2015 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2015, 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 jdk.vm.ci.compiler;
-
-import jdk.vm.ci.code.CompilationRequest;
-import jdk.vm.ci.options.Option;
-import jdk.vm.ci.options.OptionType;
-import jdk.vm.ci.options.OptionValue;
-
-public interface Compiler {
-    int INVOCATION_ENTRY_BCI = -1;
-
-    @Option(help = "", type = OptionType.Debug) OptionValue<String> PrintFilter = new OptionValue<>(null);
-    @Option(help = "", type = OptionType.Debug) OptionValue<Boolean> PrintCompilation = new OptionValue<>(false);
-    @Option(help = "", type = OptionType.Debug) OptionValue<Boolean> PrintAfterCompilation = new OptionValue<>(false);
-    @Option(help = "", type = OptionType.Debug) OptionValue<Boolean> PrintBailout = new OptionValue<>(false);
-    @Option(help = "", type = OptionType.Debug) OptionValue<Boolean> ExitVMOnBailout = new OptionValue<>(false);
-    @Option(help = "", type = OptionType.Debug) OptionValue<Boolean> ExitVMOnException = new OptionValue<>(false);
-    @Option(help = "", type = OptionType.Debug) OptionValue<Boolean> PrintStackTraceOnException = new OptionValue<>(false);
-
-    /**
-     * Services a compilation request. This object should compile the method to machine code and
-     * install it in the code cache if the compilation is successful.
-     */
-    void compileMethod(CompilationRequest request);
-}
--- a/jvmci/jdk.vm.ci.compiler/src/jdk/vm/ci/compiler/CompilerFactory.java	Wed Oct 21 11:44:15 2015 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-/*
- * Copyright (c) 2015, 2015, 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 jdk.vm.ci.compiler;
-
-import jdk.vm.ci.runtime.JVMCIRuntime;
-
-/**
- * Factory for a JVMCI compiler.
- */
-public interface CompilerFactory {
-
-    /**
-     * Get the name of this compiler. The compiler will be selected when the jvmci.compiler system
-     * property is equal to this name.
-     */
-    String getCompilerName();
-
-    /**
-     * Create a new instance of the {@link Compiler}.
-     */
-    Compiler createCompiler(JVMCIRuntime runtime);
-
-    /**
-     * In a tiered system it might be advantageous for startup to keep the JVMCI compiler from
-     * compiling itself so provide a hook to request that certain packages are compiled only by an
-     * optimizing first tier. The prefixes should class or package names using / as the separator,
-     * i.e. jdk/vm/ci for instance.
-     *
-     * @return 0 or more Strings identifying packages that should by compiled by the first tier
-     *         only.
-     */
-    default String[] getTrivialPrefixes() {
-        return null;
-    }
-}
--- a/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCICompilerConfig.java	Wed Oct 21 11:44:15 2015 +0200
+++ b/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCICompilerConfig.java	Wed Oct 21 13:47:47 2015 +0200
@@ -24,14 +24,14 @@
 
 import jdk.vm.ci.code.CompilationRequest;
 import jdk.vm.ci.common.JVMCIError;
-import jdk.vm.ci.compiler.Compiler;
-import jdk.vm.ci.compiler.CompilerFactory;
+import jdk.vm.ci.runtime.JVMCICompiler;
+import jdk.vm.ci.runtime.JVMCICompilerFactory;
 import jdk.vm.ci.runtime.JVMCIRuntime;
 import jdk.vm.ci.service.Services;
 
 final class HotSpotJVMCICompilerConfig {
 
-    private static class DummyCompilerFactory implements CompilerFactory, Compiler {
+    private static class DummyCompilerFactory implements JVMCICompilerFactory, JVMCICompiler {
 
         public void compileMethod(CompilationRequest request) {
             throw new JVMCIError("no JVMCI compiler selected");
@@ -41,12 +41,12 @@
             return "<none>";
         }
 
-        public Compiler createCompiler(JVMCIRuntime runtime) {
+        public JVMCICompiler createCompiler(JVMCIRuntime runtime) {
             return this;
         }
     }
 
-    private static CompilerFactory compilerFactory;
+    private static JVMCICompilerFactory compilerFactory;
 
     /**
      * Selects the system compiler.
@@ -56,7 +56,7 @@
      */
     static Boolean selectCompiler(String compilerName) {
         assert compilerFactory == null;
-        for (CompilerFactory factory : Services.load(CompilerFactory.class)) {
+        for (JVMCICompilerFactory factory : Services.load(JVMCICompilerFactory.class)) {
             if (factory.getCompilerName().equals(compilerName)) {
                 compilerFactory = factory;
                 return Boolean.TRUE;
@@ -66,7 +66,7 @@
         throw new JVMCIError("JVMCI compiler '%s' not found", compilerName);
     }
 
-    static CompilerFactory getCompilerFactory() {
+    static JVMCICompilerFactory getCompilerFactory() {
         if (compilerFactory == null) {
             compilerFactory = new DummyCompilerFactory();
         }
--- a/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java	Wed Oct 21 11:44:15 2015 +0200
+++ b/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java	Wed Oct 21 13:47:47 2015 +0200
@@ -40,7 +40,6 @@
 import jdk.vm.ci.code.CompilationResult;
 import jdk.vm.ci.code.InstalledCode;
 import jdk.vm.ci.common.JVMCIError;
-import jdk.vm.ci.compiler.Compiler;
 import jdk.vm.ci.inittimer.InitTimer;
 import jdk.vm.ci.meta.JVMCIMetaAccessContext;
 import jdk.vm.ci.meta.JavaKind;
@@ -48,6 +47,7 @@
 import jdk.vm.ci.meta.ResolvedJavaType;
 import jdk.vm.ci.runtime.JVMCI;
 import jdk.vm.ci.runtime.JVMCIBackend;
+import jdk.vm.ci.runtime.JVMCICompiler;
 import jdk.vm.ci.service.Services;
 
 //JaCoCo Exclude
@@ -105,7 +105,7 @@
     protected final HotSpotVMConfig config;
     private final JVMCIBackend hostBackend;
 
-    private volatile Compiler compiler;
+    private volatile JVMCICompiler compiler;
     protected final JVMCIMetaAccessContext metaAccessContext;
 
     private final Map<Class<? extends Architecture>, JVMCIBackend> backends = new HashMap<>();
@@ -177,7 +177,7 @@
         return metaAccessContext;
     }
 
-    public Compiler getCompiler() {
+    public JVMCICompiler getCompiler() {
         if (compiler == null) {
             synchronized (this) {
                 if (compiler == null) {
--- a/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntimeProvider.java	Wed Oct 21 11:44:15 2015 +0200
+++ b/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntimeProvider.java	Wed Oct 21 13:47:47 2015 +0200
@@ -25,7 +25,6 @@
 import java.io.OutputStream;
 
 import jdk.vm.ci.common.JVMCIError;
-import jdk.vm.ci.compiler.Compiler;
 import jdk.vm.ci.meta.JVMCIMetaAccessContext;
 import jdk.vm.ci.meta.JavaKind;
 import jdk.vm.ci.meta.JavaType;
@@ -44,8 +43,6 @@
 
     CompilerToVM getCompilerToVM();
 
-    Compiler getCompiler();
-
     /**
      * Gets an output stream that writes to the HotSpot's {@code tty} stream.
      */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jvmci/jdk.vm.ci.runtime/src/jdk/vm/ci/runtime/JVMCICompiler.java	Wed Oct 21 13:47:47 2015 +0200
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2015, 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 jdk.vm.ci.runtime;
+
+import jdk.vm.ci.code.CompilationRequest;
+import jdk.vm.ci.options.Option;
+import jdk.vm.ci.options.OptionType;
+import jdk.vm.ci.options.OptionValue;
+
+public interface JVMCICompiler {
+    int INVOCATION_ENTRY_BCI = -1;
+
+    @Option(help = "", type = OptionType.Debug) OptionValue<String> PrintFilter = new OptionValue<>(null);
+    @Option(help = "", type = OptionType.Debug) OptionValue<Boolean> PrintCompilation = new OptionValue<>(false);
+    @Option(help = "", type = OptionType.Debug) OptionValue<Boolean> PrintAfterCompilation = new OptionValue<>(false);
+    @Option(help = "", type = OptionType.Debug) OptionValue<Boolean> PrintBailout = new OptionValue<>(false);
+    @Option(help = "", type = OptionType.Debug) OptionValue<Boolean> ExitVMOnBailout = new OptionValue<>(false);
+    @Option(help = "", type = OptionType.Debug) OptionValue<Boolean> ExitVMOnException = new OptionValue<>(false);
+    @Option(help = "", type = OptionType.Debug) OptionValue<Boolean> PrintStackTraceOnException = new OptionValue<>(false);
+
+    /**
+     * Services a compilation request. This object should compile the method to machine code and
+     * install it in the code cache if the compilation is successful.
+     */
+    void compileMethod(CompilationRequest request);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jvmci/jdk.vm.ci.runtime/src/jdk/vm/ci/runtime/JVMCICompilerFactory.java	Wed Oct 21 13:47:47 2015 +0200
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2015, 2015, 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 jdk.vm.ci.runtime;
+
+/**
+ * Factory for a JVMCI compiler.
+ */
+public interface JVMCICompilerFactory {
+
+    /**
+     * Get the name of this compiler. The compiler will be selected when the jvmci.compiler system
+     * property is equal to this name.
+     */
+    String getCompilerName();
+
+    /**
+     * Create a new instance of the {@link JVMCICompiler}.
+     */
+    JVMCICompiler createCompiler(JVMCIRuntime runtime);
+
+    /**
+     * In a tiered system it might be advantageous for startup to keep the JVMCI compiler from
+     * compiling itself so provide a hook to request that certain packages are compiled only by an
+     * optimizing first tier. The prefixes should class or package names using / as the separator,
+     * i.e. jdk/vm/ci for instance.
+     *
+     * @return 0 or more Strings identifying packages that should by compiled by the first tier
+     *         only.
+     */
+    default String[] getTrivialPrefixes() {
+        return null;
+    }
+}
--- a/jvmci/jdk.vm.ci.runtime/src/jdk/vm/ci/runtime/JVMCIRuntime.java	Wed Oct 21 11:44:15 2015 +0200
+++ b/jvmci/jdk.vm.ci.runtime/src/jdk/vm/ci/runtime/JVMCIRuntime.java	Wed Oct 21 13:47:47 2015 +0200
@@ -30,6 +30,11 @@
 public interface JVMCIRuntime {
 
     /**
+     * Gets the default system compiler.
+     */
+    JVMCICompiler getCompiler();
+
+    /**
      * Gets the host JVMCI backend.
      */
     JVMCIBackend getHostJVMCIBackend();
--- a/make/jvmci.make	Wed Oct 21 11:44:15 2015 +0200
+++ b/make/jvmci.make	Wed Oct 21 13:47:47 2015 +0200
@@ -142,7 +142,6 @@
 JVMCI_API_SRC += $(shell find jvmci/jdk.vm.ci.code/src -type f 2> /dev/null)
 JVMCI_API_SRC += $(shell find jvmci/jdk.vm.ci.runtime/src -type f 2> /dev/null)
 JVMCI_API_SRC += $(shell find jvmci/jdk.vm.ci.common/src -type f 2> /dev/null)
-JVMCI_API_SRC += $(shell find jvmci/jdk.vm.ci.compiler/src -type f 2> /dev/null)
 JVMCI_API_SRC += $(shell find jvmci/jdk.vm.ci.amd64/src -type f 2> /dev/null)
 JVMCI_API_SRC += $(shell find jvmci/jdk.vm.ci.sparc/src -type f 2> /dev/null)
 
--- a/mx.jvmci/suite.py	Wed Oct 21 11:44:15 2015 +0200
+++ b/mx.jvmci/suite.py	Wed Oct 21 13:47:47 2015 +0200
@@ -108,9 +108,11 @@
       "subDir" : "jvmci",
       "sourceDirs" : ["src"],
       "dependencies" : [
-        "jdk.vm.ci.code"
+        "jdk.vm.ci.code",
+        "jdk.vm.ci.options"
       ],
       "checkstyle" : "jdk.vm.ci.service",
+      "annotationProcessors" : ["JVMCI_OPTIONS_PROCESSOR"],
       "javaCompliance" : "1.8",
       "workingSets" : "API,JVMCI",
     },
@@ -145,19 +147,6 @@
       "workingSets" : "JVMCI",
     },
 
-    "jdk.vm.ci.compiler" : {
-      "subDir" : "jvmci",
-      "sourceDirs" : ["src"],
-      "dependencies" : [
-        "jdk.vm.ci.options",
-        "jdk.vm.ci.runtime",
-      ],
-      "checkstyle" : "jdk.vm.ci.service",
-      "annotationProcessors" : ["JVMCI_OPTIONS_PROCESSOR"],
-      "javaCompliance" : "1.8",
-      "workingSets" : "JVMCI",
-    },
-
     "jdk.vm.ci.options.processor" : {
       "subDir" : "jvmci",
       "sourceDirs" : ["src"],
@@ -206,8 +195,8 @@
       "sourceDirs" : ["src"],
       "dependencies" : [
         "jdk.vm.ci.hotspotvmconfig",
-        "jdk.vm.ci.compiler",
         "jdk.vm.ci.common",
+        "jdk.vm.ci.runtime",
         "jdk.vm.ci.service",
       ],
       "annotationProcessors" : [
@@ -365,7 +354,6 @@
         "jdk.vm.ci.inittimer",
         "jdk.vm.ci.runtime",
         "jdk.vm.ci.common",
-        "jdk.vm.ci.compiler",
         "jdk.vm.ci.amd64",
         "jdk.vm.ci.sparc",
       ],