65 * @return the selected system compiler factory
66 */
67 static JVMCICompilerFactory getCompilerFactory() {
68 if (compilerFactory == null) {
69 JVMCICompilerFactory factory = null;
70 String compilerName = Option.Compiler.getString();
71 if (compilerName != null) {
72 for (JVMCICompilerFactory f : Services.load(JVMCICompilerFactory.class)) {
73 if (f.getCompilerName().equals(compilerName)) {
74 Services.exportJVMCITo(f.getClass());
75 factory = f;
76 }
77 }
78 if (factory == null) {
79 throw new JVMCIError("JVMCI compiler '%s' not found", compilerName);
80 }
81 } else {
82 // Auto select a single available compiler
83 for (JVMCICompilerFactory f : Services.load(JVMCICompilerFactory.class)) {
84 if (factory == null) {
85 factory = f;
86 } else {
87 // Multiple factories seen - cancel auto selection
88 factory = null;
89 break;
90 }
91 }
92 if (factory == null) {
93 factory = new DummyCompilerFactory();
94 }
95 }
96 factory.onSelection();
97 compilerFactory = factory;
98 }
99 return compilerFactory;
100 }
101 }
|
65 * @return the selected system compiler factory
66 */
67 static JVMCICompilerFactory getCompilerFactory() {
68 if (compilerFactory == null) {
69 JVMCICompilerFactory factory = null;
70 String compilerName = Option.Compiler.getString();
71 if (compilerName != null) {
72 for (JVMCICompilerFactory f : Services.load(JVMCICompilerFactory.class)) {
73 if (f.getCompilerName().equals(compilerName)) {
74 Services.exportJVMCITo(f.getClass());
75 factory = f;
76 }
77 }
78 if (factory == null) {
79 throw new JVMCIError("JVMCI compiler '%s' not found", compilerName);
80 }
81 } else {
82 // Auto select a single available compiler
83 for (JVMCICompilerFactory f : Services.load(JVMCICompilerFactory.class)) {
84 if (factory == null) {
85 Services.exportJVMCITo(f.getClass());
86 factory = f;
87 } else {
88 // Multiple factories seen - cancel auto selection
89 factory = null;
90 break;
91 }
92 }
93 if (factory == null) {
94 factory = new DummyCompilerFactory();
95 }
96 }
97 factory.onSelection();
98 compilerFactory = factory;
99 }
100 return compilerFactory;
101 }
102 }
|