annotate jvmci/jdk.vm.ci.runtime/src/jdk/vm/ci/runtime/services/JVMCICompilerFactory.java @ 23777:6c8eaf47db9a

added -XX:+JVMCIPrintFlags to support printing of JVMCI flags without having to know how to trigger JVMCI initialization
author Doug Simon <doug.simon@oracle.com>
date Tue, 04 Oct 2016 22:14:32 +0200
parents 3db9e47b477a
children 276858bc6ac6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
22429
a1b0a76567c7 Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
1 /*
23358
7eaa740eaca2 make JVMCICompilerFactory an abstract class with security checks (JDK-8155622)
Doug Simon <doug.simon@oracle.com>
parents: 22697
diff changeset
2 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
22429
a1b0a76567c7 Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a1b0a76567c7 Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
4 *
a1b0a76567c7 Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a1b0a76567c7 Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a1b0a76567c7 Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
a1b0a76567c7 Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
8 *
a1b0a76567c7 Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a1b0a76567c7 Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a1b0a76567c7 Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a1b0a76567c7 Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a1b0a76567c7 Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
13 * accompanied this code).
a1b0a76567c7 Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
14 *
a1b0a76567c7 Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a1b0a76567c7 Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a1b0a76567c7 Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a1b0a76567c7 Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
18 *
a1b0a76567c7 Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
a1b0a76567c7 Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
a1b0a76567c7 Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
21 * questions.
a1b0a76567c7 Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
22 */
23363
56479400913e jdk.vm.ci needs to securely export services (JDK-8155023)
Doug Simon <doug.simon@oracle.com>
parents: 23358
diff changeset
23 package jdk.vm.ci.runtime.services;
56479400913e jdk.vm.ci needs to securely export services (JDK-8155023)
Doug Simon <doug.simon@oracle.com>
parents: 23358
diff changeset
24
23777
6c8eaf47db9a added -XX:+JVMCIPrintFlags to support printing of JVMCI flags without having to know how to trigger JVMCI initialization
Doug Simon <doug.simon@oracle.com>
parents: 23723
diff changeset
25 import java.io.PrintStream;
6c8eaf47db9a added -XX:+JVMCIPrintFlags to support printing of JVMCI flags without having to know how to trigger JVMCI initialization
Doug Simon <doug.simon@oracle.com>
parents: 23723
diff changeset
26
23363
56479400913e jdk.vm.ci needs to securely export services (JDK-8155023)
Doug Simon <doug.simon@oracle.com>
parents: 23358
diff changeset
27 import jdk.vm.ci.runtime.JVMCICompiler;
56479400913e jdk.vm.ci needs to securely export services (JDK-8155023)
Doug Simon <doug.simon@oracle.com>
parents: 23358
diff changeset
28 import jdk.vm.ci.runtime.JVMCIRuntime;
23380
cd8fd4cced6c added JVMCIPermission (JDK-8155023)
Doug Simon <doug.simon@oracle.com>
parents: 23379
diff changeset
29 import jdk.vm.ci.services.JVMCIPermission;
22429
a1b0a76567c7 Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
30
a1b0a76567c7 Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
31 /**
23358
7eaa740eaca2 make JVMCICompilerFactory an abstract class with security checks (JDK-8155622)
Doug Simon <doug.simon@oracle.com>
parents: 22697
diff changeset
32 * Service-provider class for creating JVMCI compilers.
22429
a1b0a76567c7 Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
33 */
23358
7eaa740eaca2 make JVMCICompilerFactory an abstract class with security checks (JDK-8155622)
Doug Simon <doug.simon@oracle.com>
parents: 22697
diff changeset
34 public abstract class JVMCICompilerFactory {
7eaa740eaca2 make JVMCICompilerFactory an abstract class with security checks (JDK-8155622)
Doug Simon <doug.simon@oracle.com>
parents: 22697
diff changeset
35
7eaa740eaca2 make JVMCICompilerFactory an abstract class with security checks (JDK-8155622)
Doug Simon <doug.simon@oracle.com>
parents: 22697
diff changeset
36 private static Void checkPermission() {
7eaa740eaca2 make JVMCICompilerFactory an abstract class with security checks (JDK-8155622)
Doug Simon <doug.simon@oracle.com>
parents: 22697
diff changeset
37 SecurityManager sm = System.getSecurityManager();
23364
8153a654bd10 checkstyle fixes
Doug Simon <doug.simon@oracle.com>
parents: 23363
diff changeset
38 if (sm != null) {
23380
cd8fd4cced6c added JVMCIPermission (JDK-8155023)
Doug Simon <doug.simon@oracle.com>
parents: 23379
diff changeset
39 sm.checkPermission(new JVMCIPermission());
23364
8153a654bd10 checkstyle fixes
Doug Simon <doug.simon@oracle.com>
parents: 23363
diff changeset
40 }
23358
7eaa740eaca2 make JVMCICompilerFactory an abstract class with security checks (JDK-8155622)
Doug Simon <doug.simon@oracle.com>
parents: 22697
diff changeset
41 return null;
7eaa740eaca2 make JVMCICompilerFactory an abstract class with security checks (JDK-8155622)
Doug Simon <doug.simon@oracle.com>
parents: 22697
diff changeset
42 }
7eaa740eaca2 make JVMCICompilerFactory an abstract class with security checks (JDK-8155622)
Doug Simon <doug.simon@oracle.com>
parents: 22697
diff changeset
43
7eaa740eaca2 make JVMCICompilerFactory an abstract class with security checks (JDK-8155622)
Doug Simon <doug.simon@oracle.com>
parents: 22697
diff changeset
44 @SuppressWarnings("unused")
7eaa740eaca2 make JVMCICompilerFactory an abstract class with security checks (JDK-8155622)
Doug Simon <doug.simon@oracle.com>
parents: 22697
diff changeset
45 private JVMCICompilerFactory(Void ignore) {
7eaa740eaca2 make JVMCICompilerFactory an abstract class with security checks (JDK-8155622)
Doug Simon <doug.simon@oracle.com>
parents: 22697
diff changeset
46 }
22429
a1b0a76567c7 Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
47
a1b0a76567c7 Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
48 /**
23358
7eaa740eaca2 make JVMCICompilerFactory an abstract class with security checks (JDK-8155622)
Doug Simon <doug.simon@oracle.com>
parents: 22697
diff changeset
49 * Initializes a new instance of this class.
7eaa740eaca2 make JVMCICompilerFactory an abstract class with security checks (JDK-8155622)
Doug Simon <doug.simon@oracle.com>
parents: 22697
diff changeset
50 *
7eaa740eaca2 make JVMCICompilerFactory an abstract class with security checks (JDK-8155622)
Doug Simon <doug.simon@oracle.com>
parents: 22697
diff changeset
51 * @throws SecurityException if a security manager has been installed and it denies
23380
cd8fd4cced6c added JVMCIPermission (JDK-8155023)
Doug Simon <doug.simon@oracle.com>
parents: 23379
diff changeset
52 * {@link JVMCIPermission}
22429
a1b0a76567c7 Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
53 */
23358
7eaa740eaca2 make JVMCICompilerFactory an abstract class with security checks (JDK-8155622)
Doug Simon <doug.simon@oracle.com>
parents: 22697
diff changeset
54 protected JVMCICompilerFactory() {
7eaa740eaca2 make JVMCICompilerFactory an abstract class with security checks (JDK-8155622)
Doug Simon <doug.simon@oracle.com>
parents: 22697
diff changeset
55 this(checkPermission());
7eaa740eaca2 make JVMCICompilerFactory an abstract class with security checks (JDK-8155622)
Doug Simon <doug.simon@oracle.com>
parents: 22697
diff changeset
56 }
22429
a1b0a76567c7 Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
57
a1b0a76567c7 Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
58 /**
23358
7eaa740eaca2 make JVMCICompilerFactory an abstract class with security checks (JDK-8155622)
Doug Simon <doug.simon@oracle.com>
parents: 22697
diff changeset
59 * Get the name of this compiler. The name is used by JVMCI to determine which factory to use.
22429
a1b0a76567c7 Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
60 */
23358
7eaa740eaca2 make JVMCICompilerFactory an abstract class with security checks (JDK-8155622)
Doug Simon <doug.simon@oracle.com>
parents: 22697
diff changeset
61 public abstract String getCompilerName();
7eaa740eaca2 make JVMCICompilerFactory an abstract class with security checks (JDK-8155622)
Doug Simon <doug.simon@oracle.com>
parents: 22697
diff changeset
62
7eaa740eaca2 make JVMCICompilerFactory an abstract class with security checks (JDK-8155622)
Doug Simon <doug.simon@oracle.com>
parents: 22697
diff changeset
63 /**
7eaa740eaca2 make JVMCICompilerFactory an abstract class with security checks (JDK-8155622)
Doug Simon <doug.simon@oracle.com>
parents: 22697
diff changeset
64 * Notifies this object that it has been selected to {@linkplain #createCompiler(JVMCIRuntime)
7eaa740eaca2 make JVMCICompilerFactory an abstract class with security checks (JDK-8155622)
Doug Simon <doug.simon@oracle.com>
parents: 22697
diff changeset
65 * create} a compiler and it should now perform any heavy weight initialization that it deferred
7eaa740eaca2 make JVMCICompilerFactory an abstract class with security checks (JDK-8155622)
Doug Simon <doug.simon@oracle.com>
parents: 22697
diff changeset
66 * during construction.
7eaa740eaca2 make JVMCICompilerFactory an abstract class with security checks (JDK-8155622)
Doug Simon <doug.simon@oracle.com>
parents: 22697
diff changeset
67 */
7eaa740eaca2 make JVMCICompilerFactory an abstract class with security checks (JDK-8155622)
Doug Simon <doug.simon@oracle.com>
parents: 22697
diff changeset
68 public void onSelection() {
7eaa740eaca2 make JVMCICompilerFactory an abstract class with security checks (JDK-8155622)
Doug Simon <doug.simon@oracle.com>
parents: 22697
diff changeset
69 }
7eaa740eaca2 make JVMCICompilerFactory an abstract class with security checks (JDK-8155622)
Doug Simon <doug.simon@oracle.com>
parents: 22697
diff changeset
70
7eaa740eaca2 make JVMCICompilerFactory an abstract class with security checks (JDK-8155622)
Doug Simon <doug.simon@oracle.com>
parents: 22697
diff changeset
71 /**
7eaa740eaca2 make JVMCICompilerFactory an abstract class with security checks (JDK-8155622)
Doug Simon <doug.simon@oracle.com>
parents: 22697
diff changeset
72 * Create a new instance of a {@link JVMCICompiler}.
7eaa740eaca2 make JVMCICompilerFactory an abstract class with security checks (JDK-8155622)
Doug Simon <doug.simon@oracle.com>
parents: 22697
diff changeset
73 */
7eaa740eaca2 make JVMCICompilerFactory an abstract class with security checks (JDK-8155622)
Doug Simon <doug.simon@oracle.com>
parents: 22697
diff changeset
74 public abstract JVMCICompiler createCompiler(JVMCIRuntime runtime);
23777
6c8eaf47db9a added -XX:+JVMCIPrintFlags to support printing of JVMCI flags without having to know how to trigger JVMCI initialization
Doug Simon <doug.simon@oracle.com>
parents: 23723
diff changeset
75
6c8eaf47db9a added -XX:+JVMCIPrintFlags to support printing of JVMCI flags without having to know how to trigger JVMCI initialization
Doug Simon <doug.simon@oracle.com>
parents: 23723
diff changeset
76 /**
6c8eaf47db9a added -XX:+JVMCIPrintFlags to support printing of JVMCI flags without having to know how to trigger JVMCI initialization
Doug Simon <doug.simon@oracle.com>
parents: 23723
diff changeset
77 * Prints a help message describing the flags supported by this compiler and how to set them.
6c8eaf47db9a added -XX:+JVMCIPrintFlags to support printing of JVMCI flags without having to know how to trigger JVMCI initialization
Doug Simon <doug.simon@oracle.com>
parents: 23723
diff changeset
78 *
6c8eaf47db9a added -XX:+JVMCIPrintFlags to support printing of JVMCI flags without having to know how to trigger JVMCI initialization
Doug Simon <doug.simon@oracle.com>
parents: 23723
diff changeset
79 * @param out where to print the message
6c8eaf47db9a added -XX:+JVMCIPrintFlags to support printing of JVMCI flags without having to know how to trigger JVMCI initialization
Doug Simon <doug.simon@oracle.com>
parents: 23723
diff changeset
80 */
6c8eaf47db9a added -XX:+JVMCIPrintFlags to support printing of JVMCI flags without having to know how to trigger JVMCI initialization
Doug Simon <doug.simon@oracle.com>
parents: 23723
diff changeset
81 public void printFlags(PrintStream out) {
6c8eaf47db9a added -XX:+JVMCIPrintFlags to support printing of JVMCI flags without having to know how to trigger JVMCI initialization
Doug Simon <doug.simon@oracle.com>
parents: 23723
diff changeset
82 }
22429
a1b0a76567c7 Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
83 }