annotate graal/com.oracle.jvmci.options/src/com/oracle/jvmci/options/OptionsLoader.java @ 21760:55058b8000ea

updated javadoc to document that JVMCI services are disjoint from the standard service loading mechanism and tightened generic type constraint such that Services and @ServiceProcessor can only be used with classes implementing Service
author Doug Simon <doug.simon@oracle.com>
date Sat, 06 Jun 2015 09:23:37 +0200
parents 93f282187d90
children
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
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
27 /**
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
28 * 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
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 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
31 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
32
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
33 /**
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 * 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
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 static {
21760
55058b8000ea updated javadoc to document that JVMCI services are disjoint from the standard service loading mechanism and tightened generic type constraint such that Services and @ServiceProcessor can only be used with classes implementing Service
Doug Simon <doug.simon@oracle.com>
parents: 21604
diff changeset
37 for (Options opts : ServiceLoader.load(Options.class, OptionsLoader.class.getClassLoader())) {
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
38 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
39 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
40 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
41 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
42 }
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
43 }
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 }
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
45 }