Mercurial > hg > truffle
annotate graal/com.oracle.jvmci.service/src/com/oracle/jvmci/service/Services.java @ 21614:2f92172fa320
Truffle and NFI implementations are now accessed via JVMCI services instead of being hard coded in the VM (JBS:GRAAL-51)
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Sun, 31 May 2015 13:42:47 +0200 |
parents | 71b338926f2e |
children | 9966b358bc2b |
rev | line source |
---|---|
15916
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1 /* |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
4 * |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
8 * |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
14 * |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
18 * |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
21 * questions. |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
22 */ |
21604
93f282187d90
moved JVMCI service API into separate com.oracle.jvmci.service module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21558
diff
changeset
|
23 package com.oracle.jvmci.service; |
15916
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
24 |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
25 import static java.lang.String.*; |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
26 |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
27 import java.util.*; |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
28 |
21607
71b338926f2e
moved JVMCI classes into their own distributions (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21604
diff
changeset
|
29 import sun.reflect.*; |
71b338926f2e
moved JVMCI classes into their own distributions (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21604
diff
changeset
|
30 |
15916
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
31 /** |
21614
2f92172fa320
Truffle and NFI implementations are now accessed via JVMCI services instead of being hard coded in the VM (JBS:GRAAL-51)
Doug Simon <doug.simon@oracle.com>
parents:
21607
diff
changeset
|
32 * A mechanism on top of the standard {@link ServiceLoader} that enables JVMCI enabled runtime to |
2f92172fa320
Truffle and NFI implementations are now accessed via JVMCI services instead of being hard coded in the VM (JBS:GRAAL-51)
Doug Simon <doug.simon@oracle.com>
parents:
21607
diff
changeset
|
33 * efficiently load services marked by {@link Service}. This is important to avoid the performance |
2f92172fa320
Truffle and NFI implementations are now accessed via JVMCI services instead of being hard coded in the VM (JBS:GRAAL-51)
Doug Simon <doug.simon@oracle.com>
parents:
21607
diff
changeset
|
34 * overhead of the standard service loader mechanism for services loaded in the runtime |
2f92172fa320
Truffle and NFI implementations are now accessed via JVMCI services instead of being hard coded in the VM (JBS:GRAAL-51)
Doug Simon <doug.simon@oracle.com>
parents:
21607
diff
changeset
|
35 * initialization process. |
15916
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
36 */ |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
37 public class Services { |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
38 |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
39 private static final ClassValue<List<Service>> cache = new ClassValue<List<Service>>() { |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
40 @Override |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
41 protected List<Service> computeValue(Class<?> type) { |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
42 Service[] names = getServiceImpls(type); |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
43 if (names == null || names.length == 0) { |
19049
c198e397bb59
improved error message when Service loading fails
Doug Simon <doug.simon@oracle.com>
parents:
16732
diff
changeset
|
44 throw new InternalError( |
21604
93f282187d90
moved JVMCI service API into separate com.oracle.jvmci.service module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21558
diff
changeset
|
45 format("No implementations for %s found (ensure %s extends %s and that in suite.py the \"annotationProcessors\" attribute for the project enclosing %s includes \"com.oracle.jvmci.service.processor\")", |
19049
c198e397bb59
improved error message when Service loading fails
Doug Simon <doug.simon@oracle.com>
parents:
16732
diff
changeset
|
46 type.getSimpleName(), type.getSimpleName(), Service.class, type.getSimpleName())); |
15916
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
47 } |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
48 return Arrays.asList(names); |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
49 } |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
50 }; |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
51 |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
52 /** |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
53 * Gets an {@link Iterable} of the implementations available for a given service. |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
54 */ |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
55 @SuppressWarnings("unchecked") |
21607
71b338926f2e
moved JVMCI classes into their own distributions (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21604
diff
changeset
|
56 @CallerSensitive |
15916
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
57 public static <S> Iterable<S> load(Class<S> service) { |
21614
2f92172fa320
Truffle and NFI implementations are now accessed via JVMCI services instead of being hard coded in the VM (JBS:GRAAL-51)
Doug Simon <doug.simon@oracle.com>
parents:
21607
diff
changeset
|
58 // TODO(ds): add SecurityManager checks |
15916
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
59 if (Service.class.isAssignableFrom(service)) { |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
60 try { |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
61 return (Iterable<S>) cache.get(service); |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
62 } catch (UnsatisfiedLinkError e) { |
21607
71b338926f2e
moved JVMCI classes into their own distributions (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21604
diff
changeset
|
63 // Fall back to standard ServiceLoader |
15916
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
64 } |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
65 } |
21607
71b338926f2e
moved JVMCI classes into their own distributions (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21604
diff
changeset
|
66 |
71b338926f2e
moved JVMCI classes into their own distributions (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21604
diff
changeset
|
67 // Need to use the ClassLoader of the caller |
71b338926f2e
moved JVMCI classes into their own distributions (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21604
diff
changeset
|
68 ClassLoader cl = Reflection.getCallerClass().getClassLoader(); |
71b338926f2e
moved JVMCI classes into their own distributions (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21604
diff
changeset
|
69 return ServiceLoader.load(service, cl); |
15916
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
70 } |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
71 |
21614
2f92172fa320
Truffle and NFI implementations are now accessed via JVMCI services instead of being hard coded in the VM (JBS:GRAAL-51)
Doug Simon <doug.simon@oracle.com>
parents:
21607
diff
changeset
|
72 /** |
2f92172fa320
Truffle and NFI implementations are now accessed via JVMCI services instead of being hard coded in the VM (JBS:GRAAL-51)
Doug Simon <doug.simon@oracle.com>
parents:
21607
diff
changeset
|
73 * Gets the implementation for a given service for which at most one implementation must be |
2f92172fa320
Truffle and NFI implementations are now accessed via JVMCI services instead of being hard coded in the VM (JBS:GRAAL-51)
Doug Simon <doug.simon@oracle.com>
parents:
21607
diff
changeset
|
74 * available. |
2f92172fa320
Truffle and NFI implementations are now accessed via JVMCI services instead of being hard coded in the VM (JBS:GRAAL-51)
Doug Simon <doug.simon@oracle.com>
parents:
21607
diff
changeset
|
75 * |
2f92172fa320
Truffle and NFI implementations are now accessed via JVMCI services instead of being hard coded in the VM (JBS:GRAAL-51)
Doug Simon <doug.simon@oracle.com>
parents:
21607
diff
changeset
|
76 * @param service the service whose implementation is being requested |
2f92172fa320
Truffle and NFI implementations are now accessed via JVMCI services instead of being hard coded in the VM (JBS:GRAAL-51)
Doug Simon <doug.simon@oracle.com>
parents:
21607
diff
changeset
|
77 * @param required specifies if an {@link InternalError} should be thrown if no implementation |
2f92172fa320
Truffle and NFI implementations are now accessed via JVMCI services instead of being hard coded in the VM (JBS:GRAAL-51)
Doug Simon <doug.simon@oracle.com>
parents:
21607
diff
changeset
|
78 * of {@code service} is available |
2f92172fa320
Truffle and NFI implementations are now accessed via JVMCI services instead of being hard coded in the VM (JBS:GRAAL-51)
Doug Simon <doug.simon@oracle.com>
parents:
21607
diff
changeset
|
79 */ |
2f92172fa320
Truffle and NFI implementations are now accessed via JVMCI services instead of being hard coded in the VM (JBS:GRAAL-51)
Doug Simon <doug.simon@oracle.com>
parents:
21607
diff
changeset
|
80 @SuppressWarnings("unchecked") |
2f92172fa320
Truffle and NFI implementations are now accessed via JVMCI services instead of being hard coded in the VM (JBS:GRAAL-51)
Doug Simon <doug.simon@oracle.com>
parents:
21607
diff
changeset
|
81 @CallerSensitive |
2f92172fa320
Truffle and NFI implementations are now accessed via JVMCI services instead of being hard coded in the VM (JBS:GRAAL-51)
Doug Simon <doug.simon@oracle.com>
parents:
21607
diff
changeset
|
82 public static <S> S loadSingle(Class<S> service, boolean required) { |
2f92172fa320
Truffle and NFI implementations are now accessed via JVMCI services instead of being hard coded in the VM (JBS:GRAAL-51)
Doug Simon <doug.simon@oracle.com>
parents:
21607
diff
changeset
|
83 // TODO(ds): add SecurityManager checks |
2f92172fa320
Truffle and NFI implementations are now accessed via JVMCI services instead of being hard coded in the VM (JBS:GRAAL-51)
Doug Simon <doug.simon@oracle.com>
parents:
21607
diff
changeset
|
84 Iterable<S> impls = null; |
2f92172fa320
Truffle and NFI implementations are now accessed via JVMCI services instead of being hard coded in the VM (JBS:GRAAL-51)
Doug Simon <doug.simon@oracle.com>
parents:
21607
diff
changeset
|
85 if (Service.class.isAssignableFrom(service)) { |
2f92172fa320
Truffle and NFI implementations are now accessed via JVMCI services instead of being hard coded in the VM (JBS:GRAAL-51)
Doug Simon <doug.simon@oracle.com>
parents:
21607
diff
changeset
|
86 try { |
2f92172fa320
Truffle and NFI implementations are now accessed via JVMCI services instead of being hard coded in the VM (JBS:GRAAL-51)
Doug Simon <doug.simon@oracle.com>
parents:
21607
diff
changeset
|
87 impls = (Iterable<S>) cache.get(service); |
2f92172fa320
Truffle and NFI implementations are now accessed via JVMCI services instead of being hard coded in the VM (JBS:GRAAL-51)
Doug Simon <doug.simon@oracle.com>
parents:
21607
diff
changeset
|
88 } catch (UnsatisfiedLinkError e) { |
2f92172fa320
Truffle and NFI implementations are now accessed via JVMCI services instead of being hard coded in the VM (JBS:GRAAL-51)
Doug Simon <doug.simon@oracle.com>
parents:
21607
diff
changeset
|
89 // Fall back to standard ServiceLoader |
2f92172fa320
Truffle and NFI implementations are now accessed via JVMCI services instead of being hard coded in the VM (JBS:GRAAL-51)
Doug Simon <doug.simon@oracle.com>
parents:
21607
diff
changeset
|
90 } |
2f92172fa320
Truffle and NFI implementations are now accessed via JVMCI services instead of being hard coded in the VM (JBS:GRAAL-51)
Doug Simon <doug.simon@oracle.com>
parents:
21607
diff
changeset
|
91 } |
2f92172fa320
Truffle and NFI implementations are now accessed via JVMCI services instead of being hard coded in the VM (JBS:GRAAL-51)
Doug Simon <doug.simon@oracle.com>
parents:
21607
diff
changeset
|
92 |
2f92172fa320
Truffle and NFI implementations are now accessed via JVMCI services instead of being hard coded in the VM (JBS:GRAAL-51)
Doug Simon <doug.simon@oracle.com>
parents:
21607
diff
changeset
|
93 if (impls == null) { |
2f92172fa320
Truffle and NFI implementations are now accessed via JVMCI services instead of being hard coded in the VM (JBS:GRAAL-51)
Doug Simon <doug.simon@oracle.com>
parents:
21607
diff
changeset
|
94 // Need to use the ClassLoader of the caller |
2f92172fa320
Truffle and NFI implementations are now accessed via JVMCI services instead of being hard coded in the VM (JBS:GRAAL-51)
Doug Simon <doug.simon@oracle.com>
parents:
21607
diff
changeset
|
95 ClassLoader cl = Reflection.getCallerClass().getClassLoader(); |
2f92172fa320
Truffle and NFI implementations are now accessed via JVMCI services instead of being hard coded in the VM (JBS:GRAAL-51)
Doug Simon <doug.simon@oracle.com>
parents:
21607
diff
changeset
|
96 impls = ServiceLoader.load(service, cl); |
2f92172fa320
Truffle and NFI implementations are now accessed via JVMCI services instead of being hard coded in the VM (JBS:GRAAL-51)
Doug Simon <doug.simon@oracle.com>
parents:
21607
diff
changeset
|
97 } |
2f92172fa320
Truffle and NFI implementations are now accessed via JVMCI services instead of being hard coded in the VM (JBS:GRAAL-51)
Doug Simon <doug.simon@oracle.com>
parents:
21607
diff
changeset
|
98 S singleImpl = null; |
2f92172fa320
Truffle and NFI implementations are now accessed via JVMCI services instead of being hard coded in the VM (JBS:GRAAL-51)
Doug Simon <doug.simon@oracle.com>
parents:
21607
diff
changeset
|
99 for (S impl : impls) { |
2f92172fa320
Truffle and NFI implementations are now accessed via JVMCI services instead of being hard coded in the VM (JBS:GRAAL-51)
Doug Simon <doug.simon@oracle.com>
parents:
21607
diff
changeset
|
100 if (singleImpl != null) { |
2f92172fa320
Truffle and NFI implementations are now accessed via JVMCI services instead of being hard coded in the VM (JBS:GRAAL-51)
Doug Simon <doug.simon@oracle.com>
parents:
21607
diff
changeset
|
101 throw new InternalError(String.format("Multiple %s implementations found: %s, %s", service.getName(), singleImpl.getClass().getName(), impl.getClass().getName())); |
2f92172fa320
Truffle and NFI implementations are now accessed via JVMCI services instead of being hard coded in the VM (JBS:GRAAL-51)
Doug Simon <doug.simon@oracle.com>
parents:
21607
diff
changeset
|
102 } |
2f92172fa320
Truffle and NFI implementations are now accessed via JVMCI services instead of being hard coded in the VM (JBS:GRAAL-51)
Doug Simon <doug.simon@oracle.com>
parents:
21607
diff
changeset
|
103 singleImpl = impl; |
2f92172fa320
Truffle and NFI implementations are now accessed via JVMCI services instead of being hard coded in the VM (JBS:GRAAL-51)
Doug Simon <doug.simon@oracle.com>
parents:
21607
diff
changeset
|
104 } |
2f92172fa320
Truffle and NFI implementations are now accessed via JVMCI services instead of being hard coded in the VM (JBS:GRAAL-51)
Doug Simon <doug.simon@oracle.com>
parents:
21607
diff
changeset
|
105 if (singleImpl == null && required) { |
2f92172fa320
Truffle and NFI implementations are now accessed via JVMCI services instead of being hard coded in the VM (JBS:GRAAL-51)
Doug Simon <doug.simon@oracle.com>
parents:
21607
diff
changeset
|
106 String javaHome = System.getProperty("java.home"); |
2f92172fa320
Truffle and NFI implementations are now accessed via JVMCI services instead of being hard coded in the VM (JBS:GRAAL-51)
Doug Simon <doug.simon@oracle.com>
parents:
21607
diff
changeset
|
107 String vmName = System.getProperty("java.vm.name"); |
2f92172fa320
Truffle and NFI implementations are now accessed via JVMCI services instead of being hard coded in the VM (JBS:GRAAL-51)
Doug Simon <doug.simon@oracle.com>
parents:
21607
diff
changeset
|
108 Formatter errorMessage = new Formatter(); |
2f92172fa320
Truffle and NFI implementations are now accessed via JVMCI services instead of being hard coded in the VM (JBS:GRAAL-51)
Doug Simon <doug.simon@oracle.com>
parents:
21607
diff
changeset
|
109 errorMessage.format("The VM does not expose required service %s.%n", service.getName()); |
2f92172fa320
Truffle and NFI implementations are now accessed via JVMCI services instead of being hard coded in the VM (JBS:GRAAL-51)
Doug Simon <doug.simon@oracle.com>
parents:
21607
diff
changeset
|
110 errorMessage.format("Currently used Java home directory is %s.%n", javaHome); |
2f92172fa320
Truffle and NFI implementations are now accessed via JVMCI services instead of being hard coded in the VM (JBS:GRAAL-51)
Doug Simon <doug.simon@oracle.com>
parents:
21607
diff
changeset
|
111 errorMessage.format("Currently used VM configuration is: %s", vmName); |
2f92172fa320
Truffle and NFI implementations are now accessed via JVMCI services instead of being hard coded in the VM (JBS:GRAAL-51)
Doug Simon <doug.simon@oracle.com>
parents:
21607
diff
changeset
|
112 throw new UnsupportedOperationException(errorMessage.toString()); |
2f92172fa320
Truffle and NFI implementations are now accessed via JVMCI services instead of being hard coded in the VM (JBS:GRAAL-51)
Doug Simon <doug.simon@oracle.com>
parents:
21607
diff
changeset
|
113 } |
2f92172fa320
Truffle and NFI implementations are now accessed via JVMCI services instead of being hard coded in the VM (JBS:GRAAL-51)
Doug Simon <doug.simon@oracle.com>
parents:
21607
diff
changeset
|
114 return singleImpl; |
2f92172fa320
Truffle and NFI implementations are now accessed via JVMCI services instead of being hard coded in the VM (JBS:GRAAL-51)
Doug Simon <doug.simon@oracle.com>
parents:
21607
diff
changeset
|
115 } |
2f92172fa320
Truffle and NFI implementations are now accessed via JVMCI services instead of being hard coded in the VM (JBS:GRAAL-51)
Doug Simon <doug.simon@oracle.com>
parents:
21607
diff
changeset
|
116 |
15916
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
117 private static native <S> S[] getServiceImpls(Class<?> service); |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
118 } |