Mercurial > hg > graal-jvmci-8
comparison jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCICompilerConfig.java @ 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 | 1bbd4a7c274b |
children | f2206f5bb62e |
comparison
equal
deleted
inserted
replaced
22696:ce6b9837f602 | 22697:57646377e480 |
---|---|
22 */ | 22 */ |
23 package jdk.vm.ci.hotspot; | 23 package jdk.vm.ci.hotspot; |
24 | 24 |
25 import jdk.vm.ci.code.CompilationRequest; | 25 import jdk.vm.ci.code.CompilationRequest; |
26 import jdk.vm.ci.common.JVMCIError; | 26 import jdk.vm.ci.common.JVMCIError; |
27 import jdk.vm.ci.compiler.Compiler; | 27 import jdk.vm.ci.runtime.JVMCICompiler; |
28 import jdk.vm.ci.compiler.CompilerFactory; | 28 import jdk.vm.ci.runtime.JVMCICompilerFactory; |
29 import jdk.vm.ci.runtime.JVMCIRuntime; | 29 import jdk.vm.ci.runtime.JVMCIRuntime; |
30 import jdk.vm.ci.service.Services; | 30 import jdk.vm.ci.service.Services; |
31 | 31 |
32 final class HotSpotJVMCICompilerConfig { | 32 final class HotSpotJVMCICompilerConfig { |
33 | 33 |
34 private static class DummyCompilerFactory implements CompilerFactory, Compiler { | 34 private static class DummyCompilerFactory implements JVMCICompilerFactory, JVMCICompiler { |
35 | 35 |
36 public void compileMethod(CompilationRequest request) { | 36 public void compileMethod(CompilationRequest request) { |
37 throw new JVMCIError("no JVMCI compiler selected"); | 37 throw new JVMCIError("no JVMCI compiler selected"); |
38 } | 38 } |
39 | 39 |
40 public String getCompilerName() { | 40 public String getCompilerName() { |
41 return "<none>"; | 41 return "<none>"; |
42 } | 42 } |
43 | 43 |
44 public Compiler createCompiler(JVMCIRuntime runtime) { | 44 public JVMCICompiler createCompiler(JVMCIRuntime runtime) { |
45 return this; | 45 return this; |
46 } | 46 } |
47 } | 47 } |
48 | 48 |
49 private static CompilerFactory compilerFactory; | 49 private static JVMCICompilerFactory compilerFactory; |
50 | 50 |
51 /** | 51 /** |
52 * Selects the system compiler. | 52 * Selects the system compiler. |
53 * | 53 * |
54 * Called from VM. This method has an object return type to allow it to be called with a VM | 54 * Called from VM. This method has an object return type to allow it to be called with a VM |
55 * utility function used to call other static initialization methods. | 55 * utility function used to call other static initialization methods. |
56 */ | 56 */ |
57 static Boolean selectCompiler(String compilerName) { | 57 static Boolean selectCompiler(String compilerName) { |
58 assert compilerFactory == null; | 58 assert compilerFactory == null; |
59 for (CompilerFactory factory : Services.load(CompilerFactory.class)) { | 59 for (JVMCICompilerFactory factory : Services.load(JVMCICompilerFactory.class)) { |
60 if (factory.getCompilerName().equals(compilerName)) { | 60 if (factory.getCompilerName().equals(compilerName)) { |
61 compilerFactory = factory; | 61 compilerFactory = factory; |
62 return Boolean.TRUE; | 62 return Boolean.TRUE; |
63 } | 63 } |
64 } | 64 } |
65 | 65 |
66 throw new JVMCIError("JVMCI compiler '%s' not found", compilerName); | 66 throw new JVMCIError("JVMCI compiler '%s' not found", compilerName); |
67 } | 67 } |
68 | 68 |
69 static CompilerFactory getCompilerFactory() { | 69 static JVMCICompilerFactory getCompilerFactory() { |
70 if (compilerFactory == null) { | 70 if (compilerFactory == null) { |
71 compilerFactory = new DummyCompilerFactory(); | 71 compilerFactory = new DummyCompilerFactory(); |
72 } | 72 } |
73 return compilerFactory; | 73 return compilerFactory; |
74 } | 74 } |