src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.services/src/jdk/vm/ci/services/JVMCIServiceLocator.java
equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
21 * questions. |
21 * questions. |
22 */ |
22 */ |
23 package jdk.vm.ci.services; |
23 package jdk.vm.ci.services; |
24 |
24 |
25 import static jdk.vm.ci.services.Services.IS_BUILDING_NATIVE_IMAGE; |
25 import static jdk.vm.ci.services.Services.IS_BUILDING_NATIVE_IMAGE; |
26 import static jdk.vm.ci.services.Services.IS_IN_NATIVE_IMAGE; |
|
27 |
26 |
28 import java.util.ArrayList; |
27 import java.util.ArrayList; |
29 import java.util.List; |
28 import java.util.List; |
30 import java.util.ServiceLoader; |
29 import java.util.ServiceLoader; |
31 |
30 |
79 return result; |
78 return result; |
80 } |
79 } |
81 result = ServiceLoader.load(JVMCIServiceLocator.class, ClassLoader.getSystemClassLoader()); |
80 result = ServiceLoader.load(JVMCIServiceLocator.class, ClassLoader.getSystemClassLoader()); |
82 if (IS_BUILDING_NATIVE_IMAGE) { |
81 if (IS_BUILDING_NATIVE_IMAGE) { |
83 ArrayList<JVMCIServiceLocator> l = new ArrayList<>(); |
82 ArrayList<JVMCIServiceLocator> l = new ArrayList<>(); |
84 for (JVMCIServiceLocator locator: result) { |
83 for (JVMCIServiceLocator locator : result) { |
85 l.add(locator); |
84 l.add(locator); |
86 } |
85 } |
87 l.trimToSize(); |
86 l.trimToSize(); |
88 cachedLocators = l; |
87 cachedLocators = l; |
89 return l; |
88 return l; |