43972
|
1 |
/*
|
|
2 |
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
4 |
*
|
|
5 |
* This code is free software; you can redistribute it and/or modify it
|
|
6 |
* under the terms of the GNU General Public License version 2 only, as
|
|
7 |
* published by the Free Software Foundation.
|
|
8 |
*
|
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that
|
|
13 |
* accompanied this code).
|
|
14 |
*
|
|
15 |
* You should have received a copy of the GNU General Public License version
|
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
18 |
*
|
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
20 |
* or visit www.oracle.com if you need additional information or have any
|
|
21 |
* questions.
|
|
22 |
*/
|
|
23 |
package jdk.vm.ci.hotspot;
|
|
24 |
|
50858
|
25 |
import jdk.vm.ci.meta.JavaType;
|
43972
|
26 |
import jdk.vm.ci.runtime.JVMCICompilerFactory;
|
|
27 |
|
|
28 |
/**
|
|
29 |
* HotSpot extensions to {@link JVMCICompilerFactory}.
|
|
30 |
*/
|
|
31 |
public abstract class HotSpotJVMCICompilerFactory implements JVMCICompilerFactory {
|
|
32 |
|
|
33 |
public enum CompilationLevelAdjustment {
|
|
34 |
/**
|
|
35 |
* No adjustment.
|
|
36 |
*/
|
|
37 |
None,
|
|
38 |
|
|
39 |
/**
|
|
40 |
* Adjust based on declaring class of method.
|
|
41 |
*/
|
|
42 |
ByHolder,
|
|
43 |
|
|
44 |
/**
|
|
45 |
* Adjust based on declaring class, name and signature of method.
|
|
46 |
*/
|
|
47 |
ByFullSignature
|
|
48 |
}
|
|
49 |
|
|
50 |
/**
|
|
51 |
* Determines if this object may want to adjust the compilation level for a method that is being
|
|
52 |
* scheduled by the VM for compilation.
|
|
53 |
*/
|
|
54 |
public CompilationLevelAdjustment getCompilationLevelAdjustment() {
|
|
55 |
return CompilationLevelAdjustment.None;
|
|
56 |
}
|
|
57 |
|
|
58 |
public enum CompilationLevel {
|
|
59 |
None,
|
|
60 |
Simple,
|
|
61 |
LimitedProfile,
|
|
62 |
FullProfile,
|
|
63 |
FullOptimization
|
|
64 |
}
|
|
65 |
|
|
66 |
/**
|
|
67 |
* Potentially modifies the compilation level currently selected by the VM compilation policy
|
|
68 |
* for a method.
|
|
69 |
*
|
50858
|
70 |
* @param declaringClass the class in which the method is declared. This value is either a
|
|
71 |
* {@code Class} instance or a {@code String} representing the
|
|
72 |
* {@link JavaType#toJavaName() name} of the class.
|
43972
|
73 |
* @param name the name of the method or {@code null} depending on the value that was returned
|
|
74 |
* by {@link #getCompilationLevelAdjustment()}
|
|
75 |
* @param signature the signature of the method or {@code null} depending on the value that was
|
|
76 |
* returned by {@link #getCompilationLevelAdjustment()}
|
|
77 |
* @param isOsr specifies if the compilation being scheduled in an OSR compilation
|
|
78 |
* @param level the compilation level currently selected by the VM compilation policy
|
|
79 |
* @return the compilation level to use for the compilation being scheduled (must be a valid
|
|
80 |
* {@code CompLevel} enum value)
|
|
81 |
*/
|
50858
|
82 |
public CompilationLevel adjustCompilationLevel(Object declaringClass, String name, String signature, boolean isOsr, CompilationLevel level) {
|
|
83 |
throw new InternalError(getClass().getName() + " must override adjustCompilationLevel(...) since it returned a value other than " + CompilationLevel.class.getName() + "." +
|
|
84 |
CompilationLevel.None + " from getCompilationLevelAdjustment()");
|
43972
|
85 |
}
|
|
86 |
}
|