Mercurial > hg > graal-compiler
annotate graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod.java @ 14107:800057208a2c
enable C1 + Graal tiered
author | Tom Rodriguez <tom.rodriguez@oracle.com> |
---|---|
date | Thu, 06 Mar 2014 17:11:39 -0800 |
parents | f62c770c22be |
children | fd7fcd2d2072 |
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 */ |
5548
8872bc0eebdf
Renaming hotspot.ri => hotspot.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5547
diff
changeset
|
23 package com.oracle.graal.hotspot.meta; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 |
9338
0266549ff6e0
added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9289
diff
changeset
|
25 import static com.oracle.graal.graph.UnsafeAccess.*; |
7037
dd81042f4eb1
added unit tests for ResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents:
7014
diff
changeset
|
26 import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*; |
9864
063a712fe8d8
converted remaining options in GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
9760
diff
changeset
|
27 import static com.oracle.graal.phases.GraalOptions.*; |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
28 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
29 import java.lang.annotation.*; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
30 import java.lang.reflect.*; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
31 import java.util.*; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
32 import java.util.concurrent.*; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
33 |
8217
dce9cefed571
Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7930
diff
changeset
|
34 import com.oracle.graal.api.code.*; |
5507
dc71b06d09f8
Moving classes from cri.ri to api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5346
diff
changeset
|
35 import com.oracle.graal.api.meta.*; |
8610
5407d1dd6450
API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents:
8217
diff
changeset
|
36 import com.oracle.graal.api.meta.ProfilingInfo.TriState; |
13164
70e6bb85d802
cleaned up HotSpotMethodData tracing a little and enabled it when -Dgraal.traceMethodDataFilter=true
Doug Simon <doug.simon@oracle.com>
parents:
12654
diff
changeset
|
37 import com.oracle.graal.debug.*; |
9636
ff4e8218d3dd
Remove hasVtableEntry, use isInVirtualMethodTable instead
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9610
diff
changeset
|
38 import com.oracle.graal.graph.*; |
5176
af59b4dfc9e4
compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5115
diff
changeset
|
39 import com.oracle.graal.hotspot.*; |
7310
79a7b761755c
Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7212
diff
changeset
|
40 import com.oracle.graal.hotspot.debug.*; |
14107
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
41 import com.oracle.graal.nodes.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
42 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
43 /** |
5775
2c088af17e59
Removed left over Ri* prefixed identifiers
Doug Simon <doug.simon@oracle.com>
parents:
5722
diff
changeset
|
44 * Implementation of {@link JavaMethod} for resolved HotSpot methods. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
45 */ |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
46 public final class HotSpotResolvedJavaMethod extends HotSpotMethod implements ResolvedJavaMethod { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
47 |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
48 private static final long serialVersionUID = -5486975070147586588L; |
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
49 |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
50 /** |
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
51 * Reference to metaspace Method object. |
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
52 */ |
13259
b16fb0b7479b
every HotSpotResolvedJavaMethod needs its own constant pool
twisti
parents:
13254
diff
changeset
|
53 private final long metaspaceMethod; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
54 |
7084
9ba90252ce08
HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7083
diff
changeset
|
55 private final HotSpotResolvedObjectType holder; |
13259
b16fb0b7479b
every HotSpotResolvedJavaMethod needs its own constant pool
twisti
parents:
13254
diff
changeset
|
56 private final HotSpotConstantPool constantPool; |
13254
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
13217
diff
changeset
|
57 private final HotSpotSignature signature; |
9416 | 58 private boolean callerSensitive; |
59 private boolean forceInline; | |
60 private boolean dontInline; | |
61 private boolean ignoredBySecurityStackWalk; | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
62 private Map<Object, Object> compilerStorage; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4220
diff
changeset
|
63 private HotSpotMethodData methodData; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
64 private byte[] code; |
5176
af59b4dfc9e4
compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5115
diff
changeset
|
65 private CompilationTask currentTask; |
8217
dce9cefed571
Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7930
diff
changeset
|
66 private SpeculationLog speculationLog; |
5176
af59b4dfc9e4
compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5115
diff
changeset
|
67 |
9760
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
68 /** |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
69 * Gets the holder of a HotSpot metaspace method native object. |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
70 * |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
71 * @param metaspaceMethod a metaspace Method object |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
72 * @return the {@link ResolvedJavaType} corresponding to the holder of the |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
73 * {@code metaspaceMethod} |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
74 */ |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
75 public static HotSpotResolvedObjectType getHolder(long metaspaceMethod) { |
12431
7080a96be216
rename: graalRuntime -> runtime, getGraalRuntime -> getRuntime
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
76 HotSpotVMConfig config = runtime().getConfig(); |
13264
b23cbfb4366a
merged CompilerToVM.getMetaspaceConstructor into CompilerToVM.getMetaspaceMethod
twisti
parents:
13259
diff
changeset
|
77 final long metaspaceConstMethod = unsafe.getAddress(metaspaceMethod + config.methodConstMethodOffset); |
b23cbfb4366a
merged CompilerToVM.getMetaspaceConstructor into CompilerToVM.getMetaspaceMethod
twisti
parents:
13259
diff
changeset
|
78 final long metaspaceConstantPool = unsafe.getAddress(metaspaceConstMethod + config.constMethodConstantsOffset); |
b23cbfb4366a
merged CompilerToVM.getMetaspaceConstructor into CompilerToVM.getMetaspaceMethod
twisti
parents:
13259
diff
changeset
|
79 final long metaspaceKlass = unsafe.getAddress(metaspaceConstantPool + config.constantPoolHolderOffset); |
b23cbfb4366a
merged CompilerToVM.getMetaspaceConstructor into CompilerToVM.getMetaspaceMethod
twisti
parents:
13259
diff
changeset
|
80 return (HotSpotResolvedObjectType) HotSpotResolvedObjectType.fromMetaspaceKlass(metaspaceKlass); |
9760
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
81 } |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
82 |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
83 /** |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
84 * Gets the {@link ResolvedJavaMethod} for a HotSpot metaspace method native object. |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
85 * |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
86 * @param metaspaceMethod a metaspace Method object |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
87 * @return the {@link ResolvedJavaMethod} corresponding to {@code metaspaceMethod} |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
88 */ |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
89 public static HotSpotResolvedJavaMethod fromMetaspace(long metaspaceMethod) { |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
90 HotSpotResolvedObjectType holder = getHolder(metaspaceMethod); |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
91 return holder.createMethod(metaspaceMethod); |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
92 } |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
93 |
7084
9ba90252ce08
HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7083
diff
changeset
|
94 HotSpotResolvedJavaMethod(HotSpotResolvedObjectType holder, long metaspaceMethod) { |
13259
b16fb0b7479b
every HotSpotResolvedJavaMethod needs its own constant pool
twisti
parents:
13254
diff
changeset
|
95 // It would be too much work to get the method name here so we fill it in later. |
b16fb0b7479b
every HotSpotResolvedJavaMethod needs its own constant pool
twisti
parents:
13254
diff
changeset
|
96 super(null); |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
97 this.metaspaceMethod = metaspaceMethod; |
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
98 this.holder = holder; |
13254
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
13217
diff
changeset
|
99 |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
13217
diff
changeset
|
100 HotSpotVMConfig config = runtime().getConfig(); |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
13217
diff
changeset
|
101 final long constMethod = getConstMethod(); |
13259
b16fb0b7479b
every HotSpotResolvedJavaMethod needs its own constant pool
twisti
parents:
13254
diff
changeset
|
102 |
b16fb0b7479b
every HotSpotResolvedJavaMethod needs its own constant pool
twisti
parents:
13254
diff
changeset
|
103 /* |
b16fb0b7479b
every HotSpotResolvedJavaMethod needs its own constant pool
twisti
parents:
13254
diff
changeset
|
104 * Get the constant pool from the metaspace method. Some methods (e.g. intrinsics for |
b16fb0b7479b
every HotSpotResolvedJavaMethod needs its own constant pool
twisti
parents:
13254
diff
changeset
|
105 * signature-polymorphic method handle methods) have their own constant pool instead of the |
b16fb0b7479b
every HotSpotResolvedJavaMethod needs its own constant pool
twisti
parents:
13254
diff
changeset
|
106 * one from their holder. |
b16fb0b7479b
every HotSpotResolvedJavaMethod needs its own constant pool
twisti
parents:
13254
diff
changeset
|
107 */ |
b16fb0b7479b
every HotSpotResolvedJavaMethod needs its own constant pool
twisti
parents:
13254
diff
changeset
|
108 final long metaspaceConstantPool = unsafe.getAddress(constMethod + config.constMethodConstantsOffset); |
b16fb0b7479b
every HotSpotResolvedJavaMethod needs its own constant pool
twisti
parents:
13254
diff
changeset
|
109 this.constantPool = new HotSpotConstantPool(metaspaceConstantPool); |
b16fb0b7479b
every HotSpotResolvedJavaMethod needs its own constant pool
twisti
parents:
13254
diff
changeset
|
110 |
b16fb0b7479b
every HotSpotResolvedJavaMethod needs its own constant pool
twisti
parents:
13254
diff
changeset
|
111 final int nameIndex = unsafe.getChar(constMethod + config.constMethodNameIndexOffset); |
b16fb0b7479b
every HotSpotResolvedJavaMethod needs its own constant pool
twisti
parents:
13254
diff
changeset
|
112 this.name = constantPool.lookupUtf8(nameIndex); |
b16fb0b7479b
every HotSpotResolvedJavaMethod needs its own constant pool
twisti
parents:
13254
diff
changeset
|
113 |
13254
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
13217
diff
changeset
|
114 final int signatureIndex = unsafe.getChar(constMethod + config.constMethodSignatureIndexOffset); |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
13217
diff
changeset
|
115 this.signature = (HotSpotSignature) constantPool.lookupSignature(signatureIndex); |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
13217
diff
changeset
|
116 |
12431
7080a96be216
rename: graalRuntime -> runtime, getGraalRuntime -> getRuntime
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
117 runtime().getCompilerToVM().initializeMethod(metaspaceMethod, this); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
118 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
119 |
13254
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
13217
diff
changeset
|
120 /** |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
13217
diff
changeset
|
121 * Returns a pointer to this method's constant method data structure ( |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
13217
diff
changeset
|
122 * {@code Method::_constMethod}). |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
13217
diff
changeset
|
123 * |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
13217
diff
changeset
|
124 * @return pointer to this method's ConstMethod |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
13217
diff
changeset
|
125 */ |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
13217
diff
changeset
|
126 private long getConstMethod() { |
13259
b16fb0b7479b
every HotSpotResolvedJavaMethod needs its own constant pool
twisti
parents:
13254
diff
changeset
|
127 assert metaspaceMethod != 0; |
b16fb0b7479b
every HotSpotResolvedJavaMethod needs its own constant pool
twisti
parents:
13254
diff
changeset
|
128 return unsafe.getAddress(metaspaceMethod + runtime().getConfig().methodConstMethodOffset); |
13254
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
13217
diff
changeset
|
129 } |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
13217
diff
changeset
|
130 |
13306
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
131 /** |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
132 * Returns this method's constant method flags ({@code ConstMethod::_flags}). |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
133 * |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
134 * @return flags of this method's ConstMethod |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
135 */ |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
136 private long getConstMethodFlags() { |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
137 return unsafe.getChar(getConstMethod() + runtime().getConfig().constMethodFlagsOffset); |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
138 } |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
139 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
140 @Override |
14089
280332c0180e
removed unnecessary explicit cast by tightening return type of overloaded method
Doug Simon <doug.simon@oracle.com>
parents:
13953
diff
changeset
|
141 public HotSpotResolvedObjectType getDeclaringClass() { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
142 return holder; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
143 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
144 |
7930
fe64b5da8229
Create direct call for Static and Special to avoid out-of-line patching stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7912
diff
changeset
|
145 /** |
fe64b5da8229
Create direct call for Static and Special to avoid out-of-line patching stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7912
diff
changeset
|
146 * Gets the address of the C++ Method object for this method. |
fe64b5da8229
Create direct call for Static and Special to avoid out-of-line patching stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7912
diff
changeset
|
147 */ |
fe64b5da8229
Create direct call for Static and Special to avoid out-of-line patching stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7912
diff
changeset
|
148 public Constant getMetaspaceMethodConstant() { |
12464
59ce8d220e11
replaced HotSpotGraalRuntime.wordKind with an access via the host backend (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12463
diff
changeset
|
149 return Constant.forIntegerKind(getHostWordKind(), metaspaceMethod, this); |
7930
fe64b5da8229
Create direct call for Static and Special to avoid out-of-line patching stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7912
diff
changeset
|
150 } |
fe64b5da8229
Create direct call for Static and Special to avoid out-of-line patching stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7912
diff
changeset
|
151 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
152 @Override |
9380
ee8cd087a731
Dispatch based on method instead of type if it seems more beneficial.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9338
diff
changeset
|
153 public Constant getEncoding() { |
ee8cd087a731
Dispatch based on method instead of type if it seems more beneficial.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9338
diff
changeset
|
154 return getMetaspaceMethodConstant(); |
ee8cd087a731
Dispatch based on method instead of type if it seems more beneficial.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9338
diff
changeset
|
155 } |
ee8cd087a731
Dispatch based on method instead of type if it seems more beneficial.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9338
diff
changeset
|
156 |
13787 | 157 /** |
158 * Gets the complete set of modifiers for this method which includes the JVM specification | |
159 * modifiers as well as the HotSpot internal modifiers. | |
160 */ | |
161 public int getAllModifiers() { | |
13777
b6cecbcfa503
fixed HotSpotResolvedJavaMethod.isSynthetic so that it doesn't do any class loading (JBS:GRAAL-5)
Doug Simon <doug.simon@oracle.com>
parents:
13373
diff
changeset
|
162 HotSpotVMConfig config = runtime().getConfig(); |
b6cecbcfa503
fixed HotSpotResolvedJavaMethod.isSynthetic so that it doesn't do any class loading (JBS:GRAAL-5)
Doug Simon <doug.simon@oracle.com>
parents:
13373
diff
changeset
|
163 return unsafe.getInt(metaspaceMethod + config.methodAccessFlagsOffset); |
b6cecbcfa503
fixed HotSpotResolvedJavaMethod.isSynthetic so that it doesn't do any class loading (JBS:GRAAL-5)
Doug Simon <doug.simon@oracle.com>
parents:
13373
diff
changeset
|
164 } |
b6cecbcfa503
fixed HotSpotResolvedJavaMethod.isSynthetic so that it doesn't do any class loading (JBS:GRAAL-5)
Doug Simon <doug.simon@oracle.com>
parents:
13373
diff
changeset
|
165 |
9380
ee8cd087a731
Dispatch based on method instead of type if it seems more beneficial.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9338
diff
changeset
|
166 @Override |
6539
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6525
diff
changeset
|
167 public int getModifiers() { |
13787 | 168 return getAllModifiers() & Modifier.methodModifiers(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
169 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
170 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
171 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
172 public boolean canBeStaticallyBound() { |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
173 int modifiers = getModifiers(); |
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
174 return (Modifier.isFinal(modifiers) || Modifier.isPrivate(modifiers) || Modifier.isStatic(modifiers)) && !Modifier.isAbstract(modifiers); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
175 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
176 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
177 @Override |
6539
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6525
diff
changeset
|
178 public byte[] getCode() { |
14105 | 179 if (getCodeSize() == 0) { |
7912
06ecee106195
added unit tests for bytecode and machine code disassembly
Doug Simon <doug.simon@oracle.com>
parents:
7786
diff
changeset
|
180 return null; |
06ecee106195
added unit tests for bytecode and machine code disassembly
Doug Simon <doug.simon@oracle.com>
parents:
7786
diff
changeset
|
181 } |
13214
3f34b8f91cc5
moved CompilerToVM.isTypeInitialized and isTypeLinked to Java
twisti
parents:
13183
diff
changeset
|
182 if (code == null && holder.isLinked()) { |
14105 | 183 code = runtime().getCompilerToVM().initializeBytecode(metaspaceMethod, new byte[getCodeSize()]); |
184 assert code.length == getCodeSize() : "expected: " + getCodeSize() + ", actual: " + code.length; | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
185 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
186 return code; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
187 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
188 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
189 @Override |
6539
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6525
diff
changeset
|
190 public int getCodeSize() { |
14105 | 191 return unsafe.getChar(getConstMethod() + runtime().getConfig().constMethodCodeSizeOffset); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
192 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
193 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
194 @Override |
6539
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6525
diff
changeset
|
195 public ExceptionHandler[] getExceptionHandlers() { |
14105 | 196 final boolean hasExceptionTable = (getConstMethodFlags() & runtime().getConfig().constMethodHasExceptionTable) != 0; |
197 if (!hasExceptionTable) { | |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
198 return new ExceptionHandler[0]; |
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
199 } |
13305
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
200 |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
201 HotSpotVMConfig config = runtime().getConfig(); |
14105 | 202 final int exceptionTableLength = runtime().getCompilerToVM().exceptionTableLength(metaspaceMethod); |
203 ExceptionHandler[] handlers = new ExceptionHandler[exceptionTableLength]; | |
13305
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
204 long exceptionTableElement = runtime().getCompilerToVM().exceptionTableStart(metaspaceMethod); |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
205 |
14105 | 206 for (int i = 0; i < exceptionTableLength; i++) { |
13305
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
207 final int startPc = unsafe.getChar(exceptionTableElement + config.exceptionTableElementStartPcOffset); |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
208 final int endPc = unsafe.getChar(exceptionTableElement + config.exceptionTableElementEndPcOffset); |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
209 final int handlerPc = unsafe.getChar(exceptionTableElement + config.exceptionTableElementHandlerPcOffset); |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
210 int catchTypeIndex = unsafe.getChar(exceptionTableElement + config.exceptionTableElementCatchTypeIndexOffset); |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
211 |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
212 JavaType catchType; |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
213 if (catchTypeIndex == 0) { |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
214 catchType = null; |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
215 } else { |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
216 final int opcode = -1; // opcode is not used |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
217 catchType = constantPool.lookupType(catchTypeIndex, opcode); |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
218 |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
219 // Check for Throwable which catches everything. |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
220 if (catchType instanceof HotSpotResolvedObjectType) { |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
221 HotSpotResolvedObjectType resolvedType = (HotSpotResolvedObjectType) catchType; |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
222 if (resolvedType.mirror() == Throwable.class) { |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
223 catchTypeIndex = 0; |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
224 catchType = null; |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
225 } |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
226 } |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
227 } |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
228 handlers[i] = new ExceptionHandler(startPc, endPc, handlerPc, catchTypeIndex, catchType); |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
229 |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
230 // Go to the next ExceptionTableElement |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
231 exceptionTableElement += config.exceptionTableElementSize; |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
232 } |
13305
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
233 |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
234 return handlers; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
235 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
236 |
9416 | 237 /** |
238 * Returns true if this method has a CallerSensitive annotation. | |
239 * | |
240 * @return true if CallerSensitive annotation present, false otherwise | |
241 */ | |
242 public boolean isCallerSensitive() { | |
243 return callerSensitive; | |
244 } | |
245 | |
246 /** | |
12532
9b1cc2628961
Extend the CompilerToVM interface to explicitly avoid compilation and inlining of methods
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
12464
diff
changeset
|
247 * Manually adds a DontInline annotation to this method. |
9b1cc2628961
Extend the CompilerToVM interface to explicitly avoid compilation and inlining of methods
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
12464
diff
changeset
|
248 */ |
13953
d587baa55dd7
Add shouldBeInlined method to ResolvedJavaMethod, implement it for HotSpot and use it in the inlining phase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13818
diff
changeset
|
249 public void setNotInlineable() { |
12532
9b1cc2628961
Extend the CompilerToVM interface to explicitly avoid compilation and inlining of methods
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
12464
diff
changeset
|
250 dontInline = true; |
12535
cee7f686c470
rename CompilerToVm.dontInline to doNotInlineOrCompile
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
12533
diff
changeset
|
251 runtime().getCompilerToVM().doNotInlineOrCompile(metaspaceMethod); |
12532
9b1cc2628961
Extend the CompilerToVM interface to explicitly avoid compilation and inlining of methods
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
12464
diff
changeset
|
252 } |
9b1cc2628961
Extend the CompilerToVM interface to explicitly avoid compilation and inlining of methods
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
12464
diff
changeset
|
253 |
9b1cc2628961
Extend the CompilerToVM interface to explicitly avoid compilation and inlining of methods
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
12464
diff
changeset
|
254 /** |
9416 | 255 * Returns true if this method is one of the special methods that is ignored by security stack |
256 * walks. | |
257 * | |
258 * @return true if special method ignored by security stack walks, false otherwise | |
259 */ | |
260 public boolean ignoredBySecurityStackWalk() { | |
261 return ignoredBySecurityStackWalk; | |
262 } | |
263 | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
264 public boolean hasBalancedMonitors() { |
14105 | 265 HotSpotVMConfig config = runtime().getConfig(); |
266 final int modifiers = getAllModifiers(); | |
267 | |
268 // Method has no monitorenter/exit bytecodes. | |
269 if ((modifiers & config.jvmAccHasMonitorBytecodes) == 0) { | |
270 return false; | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
271 } |
14105 | 272 |
273 // Check to see if a previous compilation computed the monitor-matching analysis. | |
274 if ((modifiers & config.jvmAccMonitorMatch) != 0) { | |
275 return true; | |
276 } | |
277 | |
278 // This either happens only once if monitors are balanced or very rarely multiple-times. | |
279 return runtime().getCompilerToVM().hasBalancedMonitors(metaspaceMethod); | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
280 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
281 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
282 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
283 public boolean isClassInitializer() { |
6539
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6525
diff
changeset
|
284 return "<clinit>".equals(name) && Modifier.isStatic(getModifiers()); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
285 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
286 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
287 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
288 public boolean isConstructor() { |
6539
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6525
diff
changeset
|
289 return "<init>".equals(name) && !Modifier.isStatic(getModifiers()); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
290 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
291 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
292 @Override |
6539
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6525
diff
changeset
|
293 public int getMaxLocals() { |
11718
f679f5411fd7
Better handling of methods which have no line number or variable name tables.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11521
diff
changeset
|
294 int modifiers = getModifiers(); |
f679f5411fd7
Better handling of methods which have no line number or variable name tables.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11521
diff
changeset
|
295 if (Modifier.isAbstract(modifiers) || Modifier.isNative(modifiers)) { |
f679f5411fd7
Better handling of methods which have no line number or variable name tables.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11521
diff
changeset
|
296 return 0; |
f679f5411fd7
Better handling of methods which have no line number or variable name tables.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11521
diff
changeset
|
297 } |
12431
7080a96be216
rename: graalRuntime -> runtime, getGraalRuntime -> getRuntime
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
298 HotSpotVMConfig config = runtime().getConfig(); |
13254
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
13217
diff
changeset
|
299 return unsafe.getChar(getConstMethod() + config.methodMaxLocalsOffset); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
300 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
301 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
302 @Override |
6539
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6525
diff
changeset
|
303 public int getMaxStackSize() { |
11718
f679f5411fd7
Better handling of methods which have no line number or variable name tables.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11521
diff
changeset
|
304 int modifiers = getModifiers(); |
f679f5411fd7
Better handling of methods which have no line number or variable name tables.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11521
diff
changeset
|
305 if (Modifier.isAbstract(modifiers) || Modifier.isNative(modifiers)) { |
f679f5411fd7
Better handling of methods which have no line number or variable name tables.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11521
diff
changeset
|
306 return 0; |
f679f5411fd7
Better handling of methods which have no line number or variable name tables.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11521
diff
changeset
|
307 } |
12431
7080a96be216
rename: graalRuntime -> runtime, getGraalRuntime -> getRuntime
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
308 HotSpotVMConfig config = runtime().getConfig(); |
13254
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
13217
diff
changeset
|
309 return config.extraStackEntries + unsafe.getChar(getConstMethod() + config.constMethodMaxStackOffset); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
310 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
311 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
312 @Override |
6539
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6525
diff
changeset
|
313 public StackTraceElement asStackTraceElement(int bci) { |
14105 | 314 if (bci < 0 || bci >= getCodeSize()) { |
5250
0f6f647e8a96
bug fix: can only use HotSpot code for constructing a StackTraceElement when the bci is valid
Doug Simon <doug.simon@oracle.com>
parents:
5247
diff
changeset
|
315 // HotSpot code can only construct stack trace elements for valid bcis |
12431
7080a96be216
rename: graalRuntime -> runtime, getGraalRuntime -> getRuntime
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
316 StackTraceElement ste = runtime().getCompilerToVM().getStackTraceElement(metaspaceMethod, 0); |
5250
0f6f647e8a96
bug fix: can only use HotSpot code for constructing a StackTraceElement when the bci is valid
Doug Simon <doug.simon@oracle.com>
parents:
5247
diff
changeset
|
317 return new StackTraceElement(ste.getClassName(), ste.getMethodName(), ste.getFileName(), -1); |
0f6f647e8a96
bug fix: can only use HotSpot code for constructing a StackTraceElement when the bci is valid
Doug Simon <doug.simon@oracle.com>
parents:
5247
diff
changeset
|
318 } |
12431
7080a96be216
rename: graalRuntime -> runtime, getGraalRuntime -> getRuntime
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
319 return runtime().getCompilerToVM().getStackTraceElement(metaspaceMethod, bci); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
320 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
321 |
5541
b4c406861c33
More renamings to drop Ri* prefix completely. Deleted graph.BitMap class and replaced with java.util.BitSet.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5536
diff
changeset
|
322 public ResolvedJavaMethod uniqueConcreteMethod() { |
13373
430c9f08728d
moved most CompilerToVM.getUniqueConcreteMethod logic up to Java and replace getUniqueConcreteMethod with findUniqueConcreteMethod
twisti
parents:
13306
diff
changeset
|
323 if (holder.isInterface()) { |
430c9f08728d
moved most CompilerToVM.getUniqueConcreteMethod logic up to Java and replace getUniqueConcreteMethod with findUniqueConcreteMethod
twisti
parents:
13306
diff
changeset
|
324 // Cannot trust interfaces. Because of: |
430c9f08728d
moved most CompilerToVM.getUniqueConcreteMethod logic up to Java and replace getUniqueConcreteMethod with findUniqueConcreteMethod
twisti
parents:
13306
diff
changeset
|
325 // interface I { void foo(); } |
430c9f08728d
moved most CompilerToVM.getUniqueConcreteMethod logic up to Java and replace getUniqueConcreteMethod with findUniqueConcreteMethod
twisti
parents:
13306
diff
changeset
|
326 // class A { public void foo() {} } |
430c9f08728d
moved most CompilerToVM.getUniqueConcreteMethod logic up to Java and replace getUniqueConcreteMethod with findUniqueConcreteMethod
twisti
parents:
13306
diff
changeset
|
327 // class B extends A implements I { } |
430c9f08728d
moved most CompilerToVM.getUniqueConcreteMethod logic up to Java and replace getUniqueConcreteMethod with findUniqueConcreteMethod
twisti
parents:
13306
diff
changeset
|
328 // class C extends B { public void foo() { } } |
430c9f08728d
moved most CompilerToVM.getUniqueConcreteMethod logic up to Java and replace getUniqueConcreteMethod with findUniqueConcreteMethod
twisti
parents:
13306
diff
changeset
|
329 // class D extends B { } |
430c9f08728d
moved most CompilerToVM.getUniqueConcreteMethod logic up to Java and replace getUniqueConcreteMethod with findUniqueConcreteMethod
twisti
parents:
13306
diff
changeset
|
330 // Would lead to identify C.foo() as the unique concrete method for I.foo() without |
430c9f08728d
moved most CompilerToVM.getUniqueConcreteMethod logic up to Java and replace getUniqueConcreteMethod with findUniqueConcreteMethod
twisti
parents:
13306
diff
changeset
|
331 // seeing A.foo(). |
430c9f08728d
moved most CompilerToVM.getUniqueConcreteMethod logic up to Java and replace getUniqueConcreteMethod with findUniqueConcreteMethod
twisti
parents:
13306
diff
changeset
|
332 return null; |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
333 } |
13373
430c9f08728d
moved most CompilerToVM.getUniqueConcreteMethod logic up to Java and replace getUniqueConcreteMethod with findUniqueConcreteMethod
twisti
parents:
13306
diff
changeset
|
334 final long uniqueConcreteMethod = runtime().getCompilerToVM().findUniqueConcreteMethod(metaspaceMethod); |
430c9f08728d
moved most CompilerToVM.getUniqueConcreteMethod logic up to Java and replace getUniqueConcreteMethod with findUniqueConcreteMethod
twisti
parents:
13306
diff
changeset
|
335 if (uniqueConcreteMethod == 0) { |
430c9f08728d
moved most CompilerToVM.getUniqueConcreteMethod logic up to Java and replace getUniqueConcreteMethod with findUniqueConcreteMethod
twisti
parents:
13306
diff
changeset
|
336 return null; |
430c9f08728d
moved most CompilerToVM.getUniqueConcreteMethod logic up to Java and replace getUniqueConcreteMethod with findUniqueConcreteMethod
twisti
parents:
13306
diff
changeset
|
337 } |
430c9f08728d
moved most CompilerToVM.getUniqueConcreteMethod logic up to Java and replace getUniqueConcreteMethod with findUniqueConcreteMethod
twisti
parents:
13306
diff
changeset
|
338 return fromMetaspace(uniqueConcreteMethod); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
339 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
340 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
341 @Override |
7676
ca9061b6694c
getMethodDescriptor does not need to be in the Signature interface
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7530
diff
changeset
|
342 public HotSpotSignature getSignature() { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
343 return signature; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
344 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
345 |
6539
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6525
diff
changeset
|
346 public int getCompiledCodeSize() { |
12431
7080a96be216
rename: graalRuntime -> runtime, getGraalRuntime -> getRuntime
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
347 return runtime().getCompilerToVM().getCompiledCodeSize(metaspaceMethod); |
4528
e6e14d25e608
added two inlining policies for comparison
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4527
diff
changeset
|
348 } |
e6e14d25e608
added two inlining policies for comparison
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4527
diff
changeset
|
349 |
14107
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
350 /** |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
351 * Gets the value of {@code Method::_code}. |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
352 * |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
353 * @return the value of {@code Method::_code} |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
354 */ |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
355 private long getCompiledCode() { |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
356 HotSpotVMConfig config = runtime().getConfig(); |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
357 return unsafe.getAddress(metaspaceMethod + config.methodCodeOffset); |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
358 } |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
359 |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
360 /** |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
361 * Returns whether this method has compiled code. |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
362 * |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
363 * @return true if this method has compiled code, false otherwise |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
364 */ |
10639
08e06d4a9e73
Removed API to access method invocation count from Graal.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10056
diff
changeset
|
365 public boolean hasCompiledCode() { |
14107
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
366 return getCompiledCode() != 0L; |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
367 } |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
368 |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
369 /** |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
370 * Gets the compilation level of the currently installed code for this method. |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
371 * |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
372 * @return compilation level |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
373 */ |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
374 public boolean hasCompiledCodeAtLevel(int level) { |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
375 long compiledCode = getCompiledCode(); |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
376 if (compiledCode != 0) { |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
377 return unsafe.getInt(compiledCode + runtime().getConfig().nmethodCompLevelOffset) == level; |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
378 } |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
379 return false; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
380 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
381 |
13164
70e6bb85d802
cleaned up HotSpotMethodData tracing a little and enabled it when -Dgraal.traceMethodDataFilter=true
Doug Simon <doug.simon@oracle.com>
parents:
12654
diff
changeset
|
382 private static final String TraceMethodDataFilter = System.getProperty("graal.traceMethodDataFilter"); |
70e6bb85d802
cleaned up HotSpotMethodData tracing a little and enabled it when -Dgraal.traceMethodDataFilter=true
Doug Simon <doug.simon@oracle.com>
parents:
12654
diff
changeset
|
383 |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4220
diff
changeset
|
384 @Override |
6539
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6525
diff
changeset
|
385 public ProfilingInfo getProfilingInfo() { |
13217
210f58e992a1
Use separate method profile for OSR compilations.
Roland Schatz <roland.schatz@oracle.com>
parents:
13214
diff
changeset
|
386 return getProfilingInfo(true, true); |
210f58e992a1
Use separate method profile for OSR compilations.
Roland Schatz <roland.schatz@oracle.com>
parents:
13214
diff
changeset
|
387 } |
210f58e992a1
Use separate method profile for OSR compilations.
Roland Schatz <roland.schatz@oracle.com>
parents:
13214
diff
changeset
|
388 |
210f58e992a1
Use separate method profile for OSR compilations.
Roland Schatz <roland.schatz@oracle.com>
parents:
13214
diff
changeset
|
389 public ProfilingInfo getCompilationProfilingInfo(boolean isOSR) { |
210f58e992a1
Use separate method profile for OSR compilations.
Roland Schatz <roland.schatz@oracle.com>
parents:
13214
diff
changeset
|
390 return getProfilingInfo(!isOSR, isOSR); |
210f58e992a1
Use separate method profile for OSR compilations.
Roland Schatz <roland.schatz@oracle.com>
parents:
13214
diff
changeset
|
391 } |
210f58e992a1
Use separate method profile for OSR compilations.
Roland Schatz <roland.schatz@oracle.com>
parents:
13214
diff
changeset
|
392 |
210f58e992a1
Use separate method profile for OSR compilations.
Roland Schatz <roland.schatz@oracle.com>
parents:
13214
diff
changeset
|
393 private ProfilingInfo getProfilingInfo(boolean includeNormal, boolean includeOSR) { |
5722
cdc3c0776f9f
removed mechanism for persisting profile information
Doug Simon <doug.simon@oracle.com>
parents:
5721
diff
changeset
|
394 ProfilingInfo info; |
5346
4c3d953f8131
added mechanism (enabled by -G:PICache and -G:PiFilter) for saving/loading method profiling info to/from disk
Doug Simon <doug.simon@oracle.com>
parents:
5344
diff
changeset
|
395 |
9864
063a712fe8d8
converted remaining options in GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
9760
diff
changeset
|
396 if (UseProfilingInformation.getValue() && methodData == null) { |
12431
7080a96be216
rename: graalRuntime -> runtime, getGraalRuntime -> getRuntime
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
397 long metaspaceMethodData = unsafeReadWord(metaspaceMethod + runtime().getConfig().methodDataOffset); |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
398 if (metaspaceMethodData != 0) { |
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
399 methodData = new HotSpotMethodData(metaspaceMethodData); |
13164
70e6bb85d802
cleaned up HotSpotMethodData tracing a little and enabled it when -Dgraal.traceMethodDataFilter=true
Doug Simon <doug.simon@oracle.com>
parents:
12654
diff
changeset
|
400 if (TraceMethodDataFilter != null && MetaUtil.format("%H.%n", this).contains(TraceMethodDataFilter)) { |
70e6bb85d802
cleaned up HotSpotMethodData tracing a little and enabled it when -Dgraal.traceMethodDataFilter=true
Doug Simon <doug.simon@oracle.com>
parents:
12654
diff
changeset
|
401 TTY.println("Raw method data for " + MetaUtil.format("%H.%n(%p)", this) + ":"); |
70e6bb85d802
cleaned up HotSpotMethodData tracing a little and enabled it when -Dgraal.traceMethodDataFilter=true
Doug Simon <doug.simon@oracle.com>
parents:
12654
diff
changeset
|
402 TTY.println(methodData.toString()); |
70e6bb85d802
cleaned up HotSpotMethodData tracing a little and enabled it when -Dgraal.traceMethodDataFilter=true
Doug Simon <doug.simon@oracle.com>
parents:
12654
diff
changeset
|
403 } |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
404 } |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4220
diff
changeset
|
405 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
406 |
5346
4c3d953f8131
added mechanism (enabled by -G:PICache and -G:PiFilter) for saving/loading method profiling info to/from disk
Doug Simon <doug.simon@oracle.com>
parents:
5344
diff
changeset
|
407 if (methodData == null || (!methodData.hasNormalData() && !methodData.hasExtraData())) { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7483
diff
changeset
|
408 // Be optimistic and return false for exceptionSeen. A methodDataOop is allocated in |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7483
diff
changeset
|
409 // case of a deoptimization. |
8610
5407d1dd6450
API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents:
8217
diff
changeset
|
410 info = DefaultProfilingInfo.get(TriState.FALSE); |
4446 | 411 } else { |
13217
210f58e992a1
Use separate method profile for OSR compilations.
Roland Schatz <roland.schatz@oracle.com>
parents:
13214
diff
changeset
|
412 info = new HotSpotProfilingInfo(methodData, this, includeNormal, includeOSR); |
4446 | 413 } |
5346
4c3d953f8131
added mechanism (enabled by -G:PICache and -G:PiFilter) for saving/loading method profiling info to/from disk
Doug Simon <doug.simon@oracle.com>
parents:
5344
diff
changeset
|
414 return info; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
415 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
416 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
417 @Override |
8611
6c4db417385a
added API to reset the profiling information for a method
Christian Haeubl <haeubl@ssw.jku.at>
parents:
8610
diff
changeset
|
418 public void reprofile() { |
12431
7080a96be216
rename: graalRuntime -> runtime, getGraalRuntime -> getRuntime
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
419 runtime().getCompilerToVM().reprofile(metaspaceMethod); |
8611
6c4db417385a
added API to reset the profiling information for a method
Christian Haeubl <haeubl@ssw.jku.at>
parents:
8610
diff
changeset
|
420 } |
6c4db417385a
added API to reset the profiling information for a method
Christian Haeubl <haeubl@ssw.jku.at>
parents:
8610
diff
changeset
|
421 |
6c4db417385a
added API to reset the profiling information for a method
Christian Haeubl <haeubl@ssw.jku.at>
parents:
8610
diff
changeset
|
422 @Override |
6539
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6525
diff
changeset
|
423 public Map<Object, Object> getCompilerStorage() { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
424 if (compilerStorage == null) { |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
425 compilerStorage = new ConcurrentHashMap<>(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
426 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
427 return compilerStorage; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
428 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
429 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
430 @Override |
5541
b4c406861c33
More renamings to drop Ri* prefix completely. Deleted graph.BitMap class and replaced with java.util.BitSet.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5536
diff
changeset
|
431 public ConstantPool getConstantPool() { |
13259
b16fb0b7479b
every HotSpotResolvedJavaMethod needs its own constant pool
twisti
parents:
13254
diff
changeset
|
432 return constantPool; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
433 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
434 |
5039
f3d2447db2d9
added detection for endless recompilation
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5003
diff
changeset
|
435 @Override |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
436 public Annotation[][] getParameterAnnotations() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
437 if (isConstructor()) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
438 Constructor javaConstructor = toJavaConstructor(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
439 return javaConstructor == null ? null : javaConstructor.getParameterAnnotations(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
440 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
441 Method javaMethod = toJava(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
442 return javaMethod == null ? null : javaMethod.getParameterAnnotations(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
443 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
444 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
445 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
446 public <T extends Annotation> T getAnnotation(Class<T> annotationClass) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
447 if (isConstructor()) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
448 Constructor<?> javaConstructor = toJavaConstructor(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
449 return javaConstructor == null ? null : javaConstructor.getAnnotation(annotationClass); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
450 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
451 Method javaMethod = toJava(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
452 return javaMethod == null ? null : javaMethod.getAnnotation(annotationClass); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
453 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
454 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
455 @Override |
9984
f3330a4487eb
added ResolvedJava[Field|Method].isSynthetic()
Doug Simon <doug.simon@oracle.com>
parents:
9928
diff
changeset
|
456 public boolean isSynthetic() { |
13787 | 457 int modifiers = getAllModifiers(); |
13818
d2f520f46180
added more unit tests for meta.api, discovering and fixing an issue with HotSpotResolvedJavaField.getModifiers() in the process
Doug Simon <doug.simon@oracle.com>
parents:
13787
diff
changeset
|
458 return (runtime().getConfig().syntheticFlag & modifiers) != 0; |
9984
f3330a4487eb
added ResolvedJava[Field|Method].isSynthetic()
Doug Simon <doug.simon@oracle.com>
parents:
9928
diff
changeset
|
459 } |
f3330a4487eb
added ResolvedJava[Field|Method].isSynthetic()
Doug Simon <doug.simon@oracle.com>
parents:
9928
diff
changeset
|
460 |
13183
0266ac3b26c0
JDK8: added support for default methods as well as interfaces containing static and private methods
Doug Simon <doug.simon@oracle.com>
parents:
13164
diff
changeset
|
461 public boolean isDefault() { |
0266ac3b26c0
JDK8: added support for default methods as well as interfaces containing static and private methods
Doug Simon <doug.simon@oracle.com>
parents:
13164
diff
changeset
|
462 if (isConstructor()) { |
0266ac3b26c0
JDK8: added support for default methods as well as interfaces containing static and private methods
Doug Simon <doug.simon@oracle.com>
parents:
13164
diff
changeset
|
463 return false; |
0266ac3b26c0
JDK8: added support for default methods as well as interfaces containing static and private methods
Doug Simon <doug.simon@oracle.com>
parents:
13164
diff
changeset
|
464 } |
0266ac3b26c0
JDK8: added support for default methods as well as interfaces containing static and private methods
Doug Simon <doug.simon@oracle.com>
parents:
13164
diff
changeset
|
465 // Copied from java.lang.Method.isDefault() |
0266ac3b26c0
JDK8: added support for default methods as well as interfaces containing static and private methods
Doug Simon <doug.simon@oracle.com>
parents:
13164
diff
changeset
|
466 int mask = Modifier.ABSTRACT | Modifier.PUBLIC | Modifier.STATIC; |
0266ac3b26c0
JDK8: added support for default methods as well as interfaces containing static and private methods
Doug Simon <doug.simon@oracle.com>
parents:
13164
diff
changeset
|
467 return ((getModifiers() & mask) == Modifier.PUBLIC) && getDeclaringClass().isInterface(); |
0266ac3b26c0
JDK8: added support for default methods as well as interfaces containing static and private methods
Doug Simon <doug.simon@oracle.com>
parents:
13164
diff
changeset
|
468 } |
0266ac3b26c0
JDK8: added support for default methods as well as interfaces containing static and private methods
Doug Simon <doug.simon@oracle.com>
parents:
13164
diff
changeset
|
469 |
9984
f3330a4487eb
added ResolvedJava[Field|Method].isSynthetic()
Doug Simon <doug.simon@oracle.com>
parents:
9928
diff
changeset
|
470 @Override |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
471 public Type[] getGenericParameterTypes() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
472 if (isConstructor()) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
473 Constructor javaConstructor = toJavaConstructor(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
474 return javaConstructor == null ? null : javaConstructor.getGenericParameterTypes(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
475 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
476 Method javaMethod = toJava(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
477 return javaMethod == null ? null : javaMethod.getGenericParameterTypes(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
478 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
479 |
7053
014727292ae0
removed more usages of ResolvedJavaType.toJava()
Doug Simon <doug.simon@oracle.com>
parents:
7037
diff
changeset
|
480 public Class<?>[] signatureToTypes() { |
014727292ae0
removed more usages of ResolvedJavaType.toJava()
Doug Simon <doug.simon@oracle.com>
parents:
7037
diff
changeset
|
481 Signature sig = getSignature(); |
014727292ae0
removed more usages of ResolvedJavaType.toJava()
Doug Simon <doug.simon@oracle.com>
parents:
7037
diff
changeset
|
482 int count = sig.getParameterCount(false); |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7483
diff
changeset
|
483 Class<?>[] result = new Class<?>[count]; |
7053
014727292ae0
removed more usages of ResolvedJavaType.toJava()
Doug Simon <doug.simon@oracle.com>
parents:
7037
diff
changeset
|
484 for (int i = 0; i < result.length; ++i) { |
7084
9ba90252ce08
HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7083
diff
changeset
|
485 result[i] = ((HotSpotResolvedJavaType) sig.getParameterType(i, holder).resolve(holder)).mirror(); |
7053
014727292ae0
removed more usages of ResolvedJavaType.toJava()
Doug Simon <doug.simon@oracle.com>
parents:
7037
diff
changeset
|
486 } |
014727292ae0
removed more usages of ResolvedJavaType.toJava()
Doug Simon <doug.simon@oracle.com>
parents:
7037
diff
changeset
|
487 return result; |
014727292ae0
removed more usages of ResolvedJavaType.toJava()
Doug Simon <doug.simon@oracle.com>
parents:
7037
diff
changeset
|
488 } |
014727292ae0
removed more usages of ResolvedJavaType.toJava()
Doug Simon <doug.simon@oracle.com>
parents:
7037
diff
changeset
|
489 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
490 private Method toJava() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
491 try { |
7053
014727292ae0
removed more usages of ResolvedJavaType.toJava()
Doug Simon <doug.simon@oracle.com>
parents:
7037
diff
changeset
|
492 return holder.mirror().getDeclaredMethod(name, signatureToTypes()); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
493 } catch (NoSuchMethodException e) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
494 return null; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
495 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
496 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
497 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
498 private Constructor toJavaConstructor() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
499 try { |
7053
014727292ae0
removed more usages of ResolvedJavaType.toJava()
Doug Simon <doug.simon@oracle.com>
parents:
7037
diff
changeset
|
500 return holder.mirror().getDeclaredConstructor(signatureToTypes()); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
501 } catch (NoSuchMethodException e) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
502 return null; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
503 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
504 } |
4296
d089b71a5237
Add possibility to disable inlining for specific methods.
Andreas Woess <andreas.woess@jku.at>
parents:
4220
diff
changeset
|
505 |
d089b71a5237
Add possibility to disable inlining for specific methods.
Andreas Woess <andreas.woess@jku.at>
parents:
4220
diff
changeset
|
506 @Override |
d089b71a5237
Add possibility to disable inlining for specific methods.
Andreas Woess <andreas.woess@jku.at>
parents:
4220
diff
changeset
|
507 public boolean canBeInlined() { |
9691 | 508 if (dontInline) { |
509 return false; | |
510 } | |
13953
d587baa55dd7
Add shouldBeInlined method to ResolvedJavaMethod, implement it for HotSpot and use it in the inlining phase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13818
diff
changeset
|
511 return runtime().getCompilerToVM().canInlineMethod(metaspaceMethod); |
d587baa55dd7
Add shouldBeInlined method to ResolvedJavaMethod, implement it for HotSpot and use it in the inlining phase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13818
diff
changeset
|
512 } |
d587baa55dd7
Add shouldBeInlined method to ResolvedJavaMethod, implement it for HotSpot and use it in the inlining phase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13818
diff
changeset
|
513 |
d587baa55dd7
Add shouldBeInlined method to ResolvedJavaMethod, implement it for HotSpot and use it in the inlining phase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13818
diff
changeset
|
514 @Override |
d587baa55dd7
Add shouldBeInlined method to ResolvedJavaMethod, implement it for HotSpot and use it in the inlining phase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13818
diff
changeset
|
515 public boolean shouldBeInlined() { |
d587baa55dd7
Add shouldBeInlined method to ResolvedJavaMethod, implement it for HotSpot and use it in the inlining phase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13818
diff
changeset
|
516 if (forceInline) { |
d587baa55dd7
Add shouldBeInlined method to ResolvedJavaMethod, implement it for HotSpot and use it in the inlining phase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13818
diff
changeset
|
517 return true; |
d587baa55dd7
Add shouldBeInlined method to ResolvedJavaMethod, implement it for HotSpot and use it in the inlining phase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13818
diff
changeset
|
518 } |
d587baa55dd7
Add shouldBeInlined method to ResolvedJavaMethod, implement it for HotSpot and use it in the inlining phase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13818
diff
changeset
|
519 return runtime().getCompilerToVM().shouldInlineMethod(metaspaceMethod); |
4319
3c21eee8ab4d
Add installMethodCallback() to HotSpotRuntime.
Andreas Woess <andreas.woess@jku.at>
parents:
4296
diff
changeset
|
520 } |
4296
d089b71a5237
Add possibility to disable inlining for specific methods.
Andreas Woess <andreas.woess@jku.at>
parents:
4220
diff
changeset
|
521 |
7310
79a7b761755c
Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7212
diff
changeset
|
522 @Override |
79a7b761755c
Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7212
diff
changeset
|
523 public LineNumberTable getLineNumberTable() { |
14105 | 524 final boolean hasLineNumberTable = (getConstMethodFlags() & runtime().getConfig().constMethodHasLineNumberTable) != 0; |
525 if (!hasLineNumberTable) { | |
11718
f679f5411fd7
Better handling of methods which have no line number or variable name tables.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11521
diff
changeset
|
526 return null; |
f679f5411fd7
Better handling of methods which have no line number or variable name tables.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11521
diff
changeset
|
527 } |
14105 | 528 |
529 long[] values = runtime().getCompilerToVM().getLineNumberTable(metaspaceMethod); | |
7310
79a7b761755c
Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7212
diff
changeset
|
530 assert values.length % 2 == 0; |
79a7b761755c
Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7212
diff
changeset
|
531 int[] bci = new int[values.length / 2]; |
79a7b761755c
Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7212
diff
changeset
|
532 int[] line = new int[values.length / 2]; |
79a7b761755c
Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7212
diff
changeset
|
533 |
79a7b761755c
Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7212
diff
changeset
|
534 for (int i = 0; i < values.length / 2; i++) { |
79a7b761755c
Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7212
diff
changeset
|
535 bci[i] = (int) values[i * 2]; |
79a7b761755c
Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7212
diff
changeset
|
536 line[i] = (int) values[i * 2 + 1]; |
79a7b761755c
Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7212
diff
changeset
|
537 } |
79a7b761755c
Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7212
diff
changeset
|
538 |
79a7b761755c
Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7212
diff
changeset
|
539 return new LineNumberTableImpl(line, bci); |
79a7b761755c
Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7212
diff
changeset
|
540 } |
79a7b761755c
Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7212
diff
changeset
|
541 |
7786
8bbbde9d0a52
extended ResolvedJavaMethod API by getLocalVariableTable
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
7676
diff
changeset
|
542 @Override |
8bbbde9d0a52
extended ResolvedJavaMethod API by getLocalVariableTable
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
7676
diff
changeset
|
543 public LocalVariableTable getLocalVariableTable() { |
14105 | 544 final boolean hasLocalVariableTable = (getConstMethodFlags() & runtime().getConfig().constMethodHasLocalVariableTable) != 0; |
545 if (!hasLocalVariableTable) { | |
11718
f679f5411fd7
Better handling of methods which have no line number or variable name tables.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11521
diff
changeset
|
546 return null; |
f679f5411fd7
Better handling of methods which have no line number or variable name tables.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11521
diff
changeset
|
547 } |
13306
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
548 |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
549 HotSpotVMConfig config = runtime().getConfig(); |
14104 | 550 long localVariableTableElement = runtime().getCompilerToVM().getLocalVariableTableStart(metaspaceMethod); |
551 final int localVariableTableLength = runtime().getCompilerToVM().getLocalVariableTableLength(metaspaceMethod); | |
13306
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
552 Local[] locals = new Local[localVariableTableLength]; |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
553 |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
554 for (int i = 0; i < localVariableTableLength; i++) { |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
555 final int startBci = unsafe.getChar(localVariableTableElement + config.localVariableTableElementStartBciOffset); |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
556 final int endBci = startBci + unsafe.getChar(localVariableTableElement + config.localVariableTableElementLengthOffset); |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
557 final int nameCpIndex = unsafe.getChar(localVariableTableElement + config.localVariableTableElementNameCpIndexOffset); |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
558 final int typeCpIndex = unsafe.getChar(localVariableTableElement + config.localVariableTableElementDescriptorCpIndexOffset); |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
559 final int slot = unsafe.getChar(localVariableTableElement + config.localVariableTableElementSlotOffset); |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
560 |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
561 String localName = getConstantPool().lookupUtf8(nameCpIndex); |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
562 String localType = getConstantPool().lookupUtf8(typeCpIndex); |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
563 |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
564 locals[i] = new LocalImpl(localName, localType, holder, startBci, endBci, slot); |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
565 |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
566 // Go to the next LocalVariableTableElement |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
567 localVariableTableElement += config.localVariableTableElementSize; |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
568 } |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
569 |
7786
8bbbde9d0a52
extended ResolvedJavaMethod API by getLocalVariableTable
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
7676
diff
changeset
|
570 return new LocalVariableTableImpl(locals); |
8bbbde9d0a52
extended ResolvedJavaMethod API by getLocalVariableTable
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
7676
diff
changeset
|
571 } |
8bbbde9d0a52
extended ResolvedJavaMethod API by getLocalVariableTable
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
7676
diff
changeset
|
572 |
6379
ad97777056ec
Checks on vtableEntryOffset to avoid calling to the VM if the holder is not initialized
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5775
diff
changeset
|
573 /** |
12559
ae412befde21
read HotSpotVMConfig fields from HotSpot's vmStructs via annotations
twisti
parents:
12535
diff
changeset
|
574 * Returns the offset of this method into the v-table. The method must have a v-table entry as |
9636
ff4e8218d3dd
Remove hasVtableEntry, use isInVirtualMethodTable instead
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9610
diff
changeset
|
575 * indicated by {@link #isInVirtualMethodTable()}, otherwise an exception is thrown. |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7483
diff
changeset
|
576 * |
6379
ad97777056ec
Checks on vtableEntryOffset to avoid calling to the VM if the holder is not initialized
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5775
diff
changeset
|
577 * @return the offset of this method into the v-table |
ad97777056ec
Checks on vtableEntryOffset to avoid calling to the VM if the holder is not initialized
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5775
diff
changeset
|
578 */ |
5000
b5dc2403c1e7
add option to inline VTable stubs
Lukas Stadler <lukas.stadler@jku.at>
parents:
4600
diff
changeset
|
579 public int vtableEntryOffset() { |
9636
ff4e8218d3dd
Remove hasVtableEntry, use isInVirtualMethodTable instead
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9610
diff
changeset
|
580 if (!isInVirtualMethodTable() || !holder.isInitialized()) { |
ff4e8218d3dd
Remove hasVtableEntry, use isInVirtualMethodTable instead
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9610
diff
changeset
|
581 throw new GraalInternalError("%s does not have a vtable entry", this); |
6379
ad97777056ec
Checks on vtableEntryOffset to avoid calling to the VM if the holder is not initialized
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5775
diff
changeset
|
582 } |
12559
ae412befde21
read HotSpotVMConfig fields from HotSpot's vmStructs via annotations
twisti
parents:
12535
diff
changeset
|
583 HotSpotVMConfig config = runtime().getConfig(); |
ae412befde21
read HotSpotVMConfig fields from HotSpot's vmStructs via annotations
twisti
parents:
12535
diff
changeset
|
584 final int vtableIndex = getVtableIndex(); |
ae412befde21
read HotSpotVMConfig fields from HotSpot's vmStructs via annotations
twisti
parents:
12535
diff
changeset
|
585 return config.instanceKlassVtableStartOffset + vtableIndex * config.vtableEntrySize + config.vtableEntryMethodOffset; |
5000
b5dc2403c1e7
add option to inline VTable stubs
Lukas Stadler <lukas.stadler@jku.at>
parents:
4600
diff
changeset
|
586 } |
5176
af59b4dfc9e4
compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5115
diff
changeset
|
587 |
9636
ff4e8218d3dd
Remove hasVtableEntry, use isInVirtualMethodTable instead
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9610
diff
changeset
|
588 @Override |
ff4e8218d3dd
Remove hasVtableEntry, use isInVirtualMethodTable instead
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9610
diff
changeset
|
589 public boolean isInVirtualMethodTable() { |
12559
ae412befde21
read HotSpotVMConfig fields from HotSpot's vmStructs via annotations
twisti
parents:
12535
diff
changeset
|
590 return getVtableIndex() >= 0; |
ae412befde21
read HotSpotVMConfig fields from HotSpot's vmStructs via annotations
twisti
parents:
12535
diff
changeset
|
591 } |
ae412befde21
read HotSpotVMConfig fields from HotSpot's vmStructs via annotations
twisti
parents:
12535
diff
changeset
|
592 |
13306
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
593 /** |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
594 * Returns this method's virtual table index. |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
595 * |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
596 * @return virtual table index |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
597 */ |
12559
ae412befde21
read HotSpotVMConfig fields from HotSpot's vmStructs via annotations
twisti
parents:
12535
diff
changeset
|
598 private int getVtableIndex() { |
ae412befde21
read HotSpotVMConfig fields from HotSpot's vmStructs via annotations
twisti
parents:
12535
diff
changeset
|
599 HotSpotVMConfig config = runtime().getConfig(); |
ae412befde21
read HotSpotVMConfig fields from HotSpot's vmStructs via annotations
twisti
parents:
12535
diff
changeset
|
600 return unsafe.getInt(metaspaceMethod + config.methodVtableIndexOffset); |
9610
ae17e540c5d2
More asserts while getting vtable offsets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9416
diff
changeset
|
601 } |
ae17e540c5d2
More asserts while getting vtable offsets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9416
diff
changeset
|
602 |
5176
af59b4dfc9e4
compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5115
diff
changeset
|
603 public void setCurrentTask(CompilationTask task) { |
af59b4dfc9e4
compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5115
diff
changeset
|
604 currentTask = task; |
af59b4dfc9e4
compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5115
diff
changeset
|
605 } |
af59b4dfc9e4
compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5115
diff
changeset
|
606 |
af59b4dfc9e4
compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5115
diff
changeset
|
607 public CompilationTask currentTask() { |
af59b4dfc9e4
compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5115
diff
changeset
|
608 return currentTask; |
af59b4dfc9e4
compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5115
diff
changeset
|
609 } |
7310
79a7b761755c
Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7212
diff
changeset
|
610 |
8217
dce9cefed571
Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7930
diff
changeset
|
611 public SpeculationLog getSpeculationLog() { |
dce9cefed571
Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7930
diff
changeset
|
612 if (speculationLog == null) { |
dce9cefed571
Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7930
diff
changeset
|
613 speculationLog = new SpeculationLog(); |
dce9cefed571
Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7930
diff
changeset
|
614 } |
dce9cefed571
Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7930
diff
changeset
|
615 return speculationLog; |
dce9cefed571
Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7930
diff
changeset
|
616 } |
9013
3b0ec709827c
added macro substitutions for the @PolymorphicSignature methods in MethodHandle
Doug Simon <doug.simon@oracle.com>
parents:
8949
diff
changeset
|
617 |
3b0ec709827c
added macro substitutions for the @PolymorphicSignature methods in MethodHandle
Doug Simon <doug.simon@oracle.com>
parents:
8949
diff
changeset
|
618 public int intrinsicId() { |
12431
7080a96be216
rename: graalRuntime -> runtime, getGraalRuntime -> getRuntime
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
619 HotSpotVMConfig config = runtime().getConfig(); |
9013
3b0ec709827c
added macro substitutions for the @PolymorphicSignature methods in MethodHandle
Doug Simon <doug.simon@oracle.com>
parents:
8949
diff
changeset
|
620 return unsafe.getByte(metaspaceMethod + config.methodIntrinsicIdOffset) & 0xff; |
3b0ec709827c
added macro substitutions for the @PolymorphicSignature methods in MethodHandle
Doug Simon <doug.simon@oracle.com>
parents:
8949
diff
changeset
|
621 } |
9100
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9013
diff
changeset
|
622 |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9013
diff
changeset
|
623 @Override |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9013
diff
changeset
|
624 public Constant invoke(Constant receiver, Constant[] arguments) { |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9013
diff
changeset
|
625 assert !isConstructor(); |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9013
diff
changeset
|
626 Method javaMethod = toJava(); |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9013
diff
changeset
|
627 javaMethod.setAccessible(true); |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9013
diff
changeset
|
628 |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9013
diff
changeset
|
629 Object[] objArguments = new Object[arguments.length]; |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9013
diff
changeset
|
630 for (int i = 0; i < arguments.length; i++) { |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9013
diff
changeset
|
631 objArguments[i] = arguments[i].asBoxedValue(); |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9013
diff
changeset
|
632 } |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9013
diff
changeset
|
633 Object objReceiver = receiver != null ? receiver.asObject() : null; |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9013
diff
changeset
|
634 |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9013
diff
changeset
|
635 try { |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9013
diff
changeset
|
636 Object objResult = javaMethod.invoke(objReceiver, objArguments); |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9013
diff
changeset
|
637 return javaMethod.getReturnType() == void.class ? null : Constant.forBoxed(getSignature().getReturnKind(), objResult); |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9013
diff
changeset
|
638 |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9013
diff
changeset
|
639 } catch (IllegalAccessException | InvocationTargetException ex) { |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9013
diff
changeset
|
640 throw new IllegalArgumentException(ex); |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9013
diff
changeset
|
641 } |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9013
diff
changeset
|
642 } |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9013
diff
changeset
|
643 |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9013
diff
changeset
|
644 @Override |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9013
diff
changeset
|
645 public Constant newInstance(Constant[] arguments) { |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9013
diff
changeset
|
646 assert isConstructor(); |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9013
diff
changeset
|
647 Constructor javaConstructor = toJavaConstructor(); |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9013
diff
changeset
|
648 javaConstructor.setAccessible(true); |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9013
diff
changeset
|
649 |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9013
diff
changeset
|
650 Object[] objArguments = new Object[arguments.length]; |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9013
diff
changeset
|
651 for (int i = 0; i < arguments.length; i++) { |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9013
diff
changeset
|
652 objArguments[i] = arguments[i].asBoxedValue(); |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9013
diff
changeset
|
653 } |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9013
diff
changeset
|
654 |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9013
diff
changeset
|
655 try { |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9013
diff
changeset
|
656 Object objResult = javaConstructor.newInstance(objArguments); |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9013
diff
changeset
|
657 assert objResult != null; |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9013
diff
changeset
|
658 return Constant.forObject(objResult); |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9013
diff
changeset
|
659 |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9013
diff
changeset
|
660 } catch (IllegalAccessException | InvocationTargetException | InstantiationException ex) { |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9013
diff
changeset
|
661 throw new IllegalArgumentException(ex); |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9013
diff
changeset
|
662 } |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9013
diff
changeset
|
663 } |
10056
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
664 |
14104 | 665 /** |
666 * Allocates a compile id for this method by asking the VM for one. | |
667 * | |
668 * @param entryBCI entry bci | |
669 * @return compile id | |
670 */ | |
671 public int allocateCompileId(int entryBCI) { | |
672 return runtime().getCompilerToVM().allocateCompileId(metaspaceMethod, entryBCI); | |
673 } | |
674 | |
10056
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
675 public boolean tryToQueueForCompilation() { |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
676 // other threads may update certain bits of the access flags field concurrently. So, the |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
677 // loop ensures that this method only returns false when another thread has set the |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
678 // queuedForCompilation bit. |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
679 do { |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
680 long address = getAccessFlagsAddress(); |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
681 int actualValue = unsafe.getInt(address); |
12431
7080a96be216
rename: graalRuntime -> runtime, getGraalRuntime -> getRuntime
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
682 int expectedValue = actualValue & ~runtime().getConfig().methodQueuedForCompilationBit; |
10056
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
683 if (actualValue != expectedValue) { |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
684 return false; |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
685 } else { |
12431
7080a96be216
rename: graalRuntime -> runtime, getGraalRuntime -> getRuntime
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
686 int newValue = expectedValue | runtime().getConfig().methodQueuedForCompilationBit; |
10056
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
687 boolean success = unsafe.compareAndSwapInt(null, address, expectedValue, newValue); |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
688 if (success) { |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
689 return true; |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
690 } |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
691 } |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
692 } while (true); |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
693 } |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
694 |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
695 public void clearQueuedForCompilation() { |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
696 long address = getAccessFlagsAddress(); |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
697 boolean success; |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
698 do { |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
699 int actualValue = unsafe.getInt(address); |
12431
7080a96be216
rename: graalRuntime -> runtime, getGraalRuntime -> getRuntime
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
700 int newValue = actualValue & ~runtime().getConfig().methodQueuedForCompilationBit; |
10056
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
701 assert isQueuedForCompilation() : "queued for compilation must be set"; |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
702 success = unsafe.compareAndSwapInt(null, address, actualValue, newValue); |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
703 } while (!success); |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
704 } |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
705 |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
706 public boolean isQueuedForCompilation() { |
12431
7080a96be216
rename: graalRuntime -> runtime, getGraalRuntime -> getRuntime
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
707 return (unsafe.getInt(getAccessFlagsAddress()) & runtime().getConfig().methodQueuedForCompilationBit) != 0; |
10056
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
708 } |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
709 |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
710 private long getAccessFlagsAddress() { |
12431
7080a96be216
rename: graalRuntime -> runtime, getGraalRuntime -> getRuntime
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
711 return metaspaceMethod + runtime().getConfig().methodAccessFlagsOffset; |
10056
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
712 } |
14107
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
713 |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
714 public boolean hasCodeAtLevel(int entryBCI, int level) { |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
715 if (entryBCI == StructuredGraph.INVOCATION_ENTRY_BCI) { |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
716 return hasCompiledCodeAtLevel(level); |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
717 } |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
718 return runtime().getCompilerToVM().hasCompiledCodeForOSR(metaspaceMethod, entryBCI, level); |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
719 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
720 } |