annotate graal/com.oracle.jvmci.options/src/com/oracle/jvmci/options/OptionsLoader.java @ 21604:93f282187d90

moved JVMCI service API into separate com.oracle.jvmci.service module (JBS:GRAAL-53)
author Doug Simon <doug.simon@oracle.com>
date Fri, 29 May 2015 17:01:57 +0200
parents 47bebae7454f
children 55058b8000ea
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15870
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
1 /*
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
4 *
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
8 *
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
13 * accompanied this code).
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
14 *
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
18 *
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
21 * questions.
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
22 */
21562
Doug Simon <doug.simon@oracle.com>
parents: 21519
diff changeset
23 package com.oracle.jvmci.options;
15870
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
24
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
25 import java.util.*;
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
26
21604
93f282187d90 moved JVMCI service API into separate com.oracle.jvmci.service module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21562
diff changeset
27 import com.oracle.jvmci.service.*;
15870
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
28
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
29 /**
21519
cecb4e39521c Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 18163
diff changeset
30 * Helper class used to load option descriptors. Only to be used in the slow-path.
15870
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
31 */
21519
cecb4e39521c Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 18163
diff changeset
32 public class OptionsLoader {
cecb4e39521c Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 18163
diff changeset
33 public static final SortedMap<String, OptionDescriptor> options = new TreeMap<>();
15870
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
34
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
35 /**
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
36 * Initializes {@link #options} from {@link Options} services.
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
37 */
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
38 static {
16732
c958f16fd52f use correct class loader when looking up services
Doug Simon <doug.simon@oracle.com>
parents: 15916
diff changeset
39 for (Options opts : Services.load(Options.class)) {
15870
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
40 for (OptionDescriptor desc : opts) {
21519
cecb4e39521c Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 18163
diff changeset
41 String name = desc.getName();
cecb4e39521c Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 18163
diff changeset
42 OptionDescriptor existing = options.put(name, desc);
cecb4e39521c Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 18163
diff changeset
43 assert existing == null : "Option named \"" + name + "\" has multiple definitions: " + existing.getLocation() + " and " + desc.getLocation();
15870
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
44 }
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
45 }
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
46 }
18163
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16732
diff changeset
47 }