Mercurial > hg > graal-jvmci-8
annotate jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCICompilerFactory.java @ 23996:11f0412408cd
8173912: [JVMCI] fix memory overhead of JVMCI
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Fri, 03 Feb 2017 21:08:05 +0100 |
parents | 5cf445d2acf6 |
children |
rev | line source |
---|---|
23379
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1 /* |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
4 * |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
8 * |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
14 * |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
18 * |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
21 * questions. |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
22 */ |
23785
5cf445d2acf6
Exported elements referring to inaccessible types in jdk.vm.ci (JDK-8167180)
Doug Simon <doug.simon@oracle.com>
parents:
23679
diff
changeset
|
23 package jdk.vm.ci.hotspot; |
23379
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
24 |
23785
5cf445d2acf6
Exported elements referring to inaccessible types in jdk.vm.ci (JDK-8167180)
Doug Simon <doug.simon@oracle.com>
parents:
23679
diff
changeset
|
25 import jdk.vm.ci.runtime.JVMCICompilerFactory; |
23379
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
26 |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
27 /** |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
28 * HotSpot extensions to {@link JVMCICompilerFactory}. |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
29 */ |
23785
5cf445d2acf6
Exported elements referring to inaccessible types in jdk.vm.ci (JDK-8167180)
Doug Simon <doug.simon@oracle.com>
parents:
23679
diff
changeset
|
30 public abstract class HotSpotJVMCICompilerFactory implements JVMCICompilerFactory { |
23379
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
31 |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
32 /** |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
33 * Gets 0 or more prefixes identifying classes that should by compiled by C1 in simple mode |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
34 * (i.e., {@code CompLevel_simple}) when HotSpot is running with tiered compilation. The |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
35 * prefixes should be class or package names using "/" as the separator, e.g. "jdk/vm/ci". |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
36 * |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
37 * @return 0 or more Strings identifying packages that should by compiled by the first tier only |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
38 * or null if no redirection to C1 should be performed. |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
39 */ |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
40 public String[] getTrivialPrefixes() { |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
41 return null; |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
42 } |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
43 |
23679
b5557b757040
fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents:
23379
diff
changeset
|
44 public enum CompilationLevelAdjustment { |
b5557b757040
fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents:
23379
diff
changeset
|
45 /** |
b5557b757040
fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents:
23379
diff
changeset
|
46 * No adjustment. |
b5557b757040
fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents:
23379
diff
changeset
|
47 */ |
b5557b757040
fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents:
23379
diff
changeset
|
48 None, |
b5557b757040
fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents:
23379
diff
changeset
|
49 |
b5557b757040
fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents:
23379
diff
changeset
|
50 /** |
b5557b757040
fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents:
23379
diff
changeset
|
51 * Adjust based on declaring class of method. |
b5557b757040
fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents:
23379
diff
changeset
|
52 */ |
b5557b757040
fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents:
23379
diff
changeset
|
53 ByHolder, |
b5557b757040
fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents:
23379
diff
changeset
|
54 |
b5557b757040
fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents:
23379
diff
changeset
|
55 /** |
b5557b757040
fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents:
23379
diff
changeset
|
56 * Adjust based on declaring class, name and signature of method. |
b5557b757040
fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents:
23379
diff
changeset
|
57 */ |
b5557b757040
fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents:
23379
diff
changeset
|
58 ByFullSignature |
b5557b757040
fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents:
23379
diff
changeset
|
59 } |
b5557b757040
fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents:
23379
diff
changeset
|
60 |
23379
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
61 /** |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
62 * Determines if this object may want to adjust the compilation level for a method that is being |
23679
b5557b757040
fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents:
23379
diff
changeset
|
63 * scheduled by the VM for compilation. |
23379
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
64 */ |
23679
b5557b757040
fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents:
23379
diff
changeset
|
65 public CompilationLevelAdjustment getCompilationLevelAdjustment() { |
b5557b757040
fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents:
23379
diff
changeset
|
66 return CompilationLevelAdjustment.None; |
b5557b757040
fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents:
23379
diff
changeset
|
67 } |
b5557b757040
fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents:
23379
diff
changeset
|
68 |
b5557b757040
fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents:
23379
diff
changeset
|
69 public enum CompilationLevel { |
b5557b757040
fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents:
23379
diff
changeset
|
70 None, |
b5557b757040
fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents:
23379
diff
changeset
|
71 Simple, |
b5557b757040
fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents:
23379
diff
changeset
|
72 LimitedProfile, |
b5557b757040
fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents:
23379
diff
changeset
|
73 FullProfile, |
b5557b757040
fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents:
23379
diff
changeset
|
74 FullOptimization |
23379
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
75 } |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
76 |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
77 /** |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
78 * Potentially modifies the compilation level currently selected by the VM compilation policy |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
79 * for a method. |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
80 * |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
81 * @param declaringClass the class in which the method is declared |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
82 * @param name the name of the method or {@code null} depending on the value that was returned |
23679
b5557b757040
fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents:
23379
diff
changeset
|
83 * by {@link #getCompilationLevelAdjustment()} |
23379
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
84 * @param signature the signature of the method or {@code null} depending on the value that was |
23679
b5557b757040
fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents:
23379
diff
changeset
|
85 * returned by {@link #getCompilationLevelAdjustment()} |
23379
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
86 * @param isOsr specifies if the compilation being scheduled in an OSR compilation |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
87 * @param level the compilation level currently selected by the VM compilation policy |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
88 * @return the compilation level to use for the compilation being scheduled (must be a valid |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
89 * {@code CompLevel} enum value) |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
90 */ |
23679
b5557b757040
fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents:
23379
diff
changeset
|
91 public CompilationLevel adjustCompilationLevel(Class<?> declaringClass, String name, String signature, boolean isOsr, CompilationLevel level) { |
23379
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
92 throw new InternalError("Should not reach here"); |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
93 } |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
94 } |