Mercurial > hg > graal-compiler
annotate graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotOptions.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 | 5b9adb645217 |
rev | line source |
---|---|
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
4 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
8 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
14 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
18 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
21 * questions. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
22 */ |
21552
9579a3c62a9e
use skeleton findbugs jar containing only SuppresFBWarnings to avoid external dependency for JVMCI classes (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21475
diff
changeset
|
23 package com.oracle.jvmci.hotspot; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 |
21563
4f63449b4422
revived post option parsing handler notification
Doug Simon <doug.simon@oracle.com>
parents:
21562
diff
changeset
|
25 import java.util.*; |
9935
2a091d2987bd
added graal.options mechanism for being able to override default option values
Doug Simon <doug.simon@oracle.com>
parents:
9919
diff
changeset
|
26 |
21554
b1530a6cce8c
renamed com.oracle.graal.[debug|options|hotspotvmconfig]* modules to com.oracle.jvmci.[debug|options|hotspotvmconfig]* modules (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21552
diff
changeset
|
27 import com.oracle.jvmci.options.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
28 |
16029
8bbfddf8483f
exclude CompilationQueue and HotSpotOptions from JaCoCo
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
29 //JaCoCo Exclude |
8bbfddf8483f
exclude CompilationQueue and HotSpotOptions from JaCoCo
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
30 |
9935
2a091d2987bd
added graal.options mechanism for being able to override default option values
Doug Simon <doug.simon@oracle.com>
parents:
9919
diff
changeset
|
31 /** |
21558
d563baeca9df
changed uses of Graal terminology to JVMCI (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
32 * Sets JVMCI options from the HotSpot command line. Such options are distinguished by the |
d563baeca9df
changed uses of Graal terminology to JVMCI (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
33 * {@link #JVMCI_OPTION_PREFIX} prefix. |
9935
2a091d2987bd
added graal.options mechanism for being able to override default option values
Doug Simon <doug.simon@oracle.com>
parents:
9919
diff
changeset
|
34 */ |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
35 public class HotSpotOptions { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
36 |
21558
d563baeca9df
changed uses of Graal terminology to JVMCI (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
37 private static final String JVMCI_OPTION_PREFIX = "-G:"; |
18684
137773e5250c
Factor out VM-independent parts of option parsing
Christian Wimmer <christian.wimmer@oracle.com>
parents:
16399
diff
changeset
|
38 |
21563
4f63449b4422
revived post option parsing handler notification
Doug Simon <doug.simon@oracle.com>
parents:
21562
diff
changeset
|
39 /** |
4f63449b4422
revived post option parsing handler notification
Doug Simon <doug.simon@oracle.com>
parents:
21562
diff
changeset
|
40 * Called from VM. |
4f63449b4422
revived post option parsing handler notification
Doug Simon <doug.simon@oracle.com>
parents:
21562
diff
changeset
|
41 */ |
4f63449b4422
revived post option parsing handler notification
Doug Simon <doug.simon@oracle.com>
parents:
21562
diff
changeset
|
42 static void printFlags() { |
4f63449b4422
revived post option parsing handler notification
Doug Simon <doug.simon@oracle.com>
parents:
21562
diff
changeset
|
43 SortedMap<String, OptionDescriptor> options = new TreeMap<>(); |
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
|
44 |
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
|
45 for (Options opts : ServiceLoader.load(Options.class, HotSpotOptions.class.getClassLoader())) { |
21563
4f63449b4422
revived post option parsing handler notification
Doug Simon <doug.simon@oracle.com>
parents:
21562
diff
changeset
|
46 for (OptionDescriptor desc : opts) { |
4f63449b4422
revived post option parsing handler notification
Doug Simon <doug.simon@oracle.com>
parents:
21562
diff
changeset
|
47 if (isHotSpotOption(desc)) { |
4f63449b4422
revived post option parsing handler notification
Doug Simon <doug.simon@oracle.com>
parents:
21562
diff
changeset
|
48 String name = desc.getName(); |
4f63449b4422
revived post option parsing handler notification
Doug Simon <doug.simon@oracle.com>
parents:
21562
diff
changeset
|
49 OptionDescriptor existing = options.put(name, desc); |
4f63449b4422
revived post option parsing handler notification
Doug Simon <doug.simon@oracle.com>
parents:
21562
diff
changeset
|
50 assert existing == null : "Option named \"" + name + "\" has multiple definitions: " + existing.getLocation() + " and " + desc.getLocation(); |
4f63449b4422
revived post option parsing handler notification
Doug Simon <doug.simon@oracle.com>
parents:
21562
diff
changeset
|
51 } |
4f63449b4422
revived post option parsing handler notification
Doug Simon <doug.simon@oracle.com>
parents:
21562
diff
changeset
|
52 } |
4f63449b4422
revived post option parsing handler notification
Doug Simon <doug.simon@oracle.com>
parents:
21562
diff
changeset
|
53 } |
21475
e538b5923ff0
fixed regression that disabled parsing of Graal command line options
Doug Simon <doug.simon@oracle.com>
parents:
21473
diff
changeset
|
54 |
21563
4f63449b4422
revived post option parsing handler notification
Doug Simon <doug.simon@oracle.com>
parents:
21562
diff
changeset
|
55 OptionUtils.printFlags(options, JVMCI_OPTION_PREFIX); |
9935
2a091d2987bd
added graal.options mechanism for being able to override default option values
Doug Simon <doug.simon@oracle.com>
parents:
9919
diff
changeset
|
56 } |
2a091d2987bd
added graal.options mechanism for being able to override default option values
Doug Simon <doug.simon@oracle.com>
parents:
9919
diff
changeset
|
57 |
15603
b7fb36e57da8
made Graal initialization be driven from Java to simplify sequencing and synchronization
Doug Simon <doug.simon@oracle.com>
parents:
15591
diff
changeset
|
58 /** |
21563
4f63449b4422
revived post option parsing handler notification
Doug Simon <doug.simon@oracle.com>
parents:
21562
diff
changeset
|
59 * Determines if a given option is a HotSpot command line option. |
15603
b7fb36e57da8
made Graal initialization be driven from Java to simplify sequencing and synchronization
Doug Simon <doug.simon@oracle.com>
parents:
15591
diff
changeset
|
60 */ |
21563
4f63449b4422
revived post option parsing handler notification
Doug Simon <doug.simon@oracle.com>
parents:
21562
diff
changeset
|
61 private static boolean isHotSpotOption(OptionDescriptor desc) { |
4f63449b4422
revived post option parsing handler notification
Doug Simon <doug.simon@oracle.com>
parents:
21562
diff
changeset
|
62 return desc.getDeclaringClass().getName().startsWith("com.oracle.graal"); |
13353
0e5c4f9fa9a5
enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents:
13106
diff
changeset
|
63 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
64 } |