Mercurial > hg > truffle
annotate graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotResolvedJavaMethodImpl.java @ 21562:47bebae7454f
Merge.
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Thu, 28 May 2015 21:58:33 +0200 |
parents | 48c1ebd24120 |
children | 36cf15e3219e |
rev | line source |
---|---|
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
14717 | 2 * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
4 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
8 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
14 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
18 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
21 * questions. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
22 */ |
21552
9579a3c62a9e
use skeleton findbugs jar containing only SuppresFBWarnings to avoid external dependency for JVMCI classes (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21411
diff
changeset
|
23 package com.oracle.jvmci.hotspot; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 |
21552
9579a3c62a9e
use skeleton findbugs jar containing only SuppresFBWarnings to avoid external dependency for JVMCI classes (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21411
diff
changeset
|
25 import static com.oracle.jvmci.common.UnsafeAccess.*; |
9579a3c62a9e
use skeleton findbugs jar containing only SuppresFBWarnings to avoid external dependency for JVMCI classes (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21411
diff
changeset
|
26 import static com.oracle.jvmci.hotspot.HotSpotJVMCIRuntime.*; |
9579a3c62a9e
use skeleton findbugs jar containing only SuppresFBWarnings to avoid external dependency for JVMCI classes (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21411
diff
changeset
|
27 import static com.oracle.jvmci.hotspot.HotSpotResolvedJavaMethodImpl.Options.*; |
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.*; |
15262
cd51b1253c4c
replaced the link between a HotSpotResolvedJavaMethod and a SpeculationLog with a ClassValue based mechanism (GRAAL-727)
Doug Simon <doug.simon@oracle.com>
parents:
15259
diff
changeset
|
31 import java.util.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
32 |
21556
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
33 import com.oracle.jvmci.code.*; |
21552
9579a3c62a9e
use skeleton findbugs jar containing only SuppresFBWarnings to avoid external dependency for JVMCI classes (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21411
diff
changeset
|
34 import com.oracle.jvmci.common.*; |
21554
b1530a6cce8c
renamed com.oracle.graal.[debug|options|hotspotvmconfig]* modules to com.oracle.jvmci.[debug|options|hotspotvmconfig]* modules (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21552
diff
changeset
|
35 import com.oracle.jvmci.debug.*; |
21556
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
36 import com.oracle.jvmci.meta.*; |
21554
b1530a6cce8c
renamed com.oracle.graal.[debug|options|hotspotvmconfig]* modules to com.oracle.jvmci.[debug|options|hotspotvmconfig]* modules (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21552
diff
changeset
|
37 import com.oracle.jvmci.options.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
38 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
39 /** |
5775
2c088af17e59
Removed left over Ri* prefixed identifiers
Doug Simon <doug.simon@oracle.com>
parents:
5722
diff
changeset
|
40 * 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
|
41 */ |
20902
7cc48e7e6bfe
generalized InvocationPluginIdHolder to MethodIdHolder
Doug Simon <doug.simon@oracle.com>
parents:
19967
diff
changeset
|
42 public final class HotSpotResolvedJavaMethodImpl extends HotSpotMethod implements HotSpotResolvedJavaMethod, HotSpotProxified, MethodIdHolder { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
43 |
21552
9579a3c62a9e
use skeleton findbugs jar containing only SuppresFBWarnings to avoid external dependency for JVMCI classes (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21411
diff
changeset
|
44 static class Options { |
9579a3c62a9e
use skeleton findbugs jar containing only SuppresFBWarnings to avoid external dependency for JVMCI classes (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21411
diff
changeset
|
45 // @formatter:off |
9579a3c62a9e
use skeleton findbugs jar containing only SuppresFBWarnings to avoid external dependency for JVMCI classes (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21411
diff
changeset
|
46 @Option(help = "", type = OptionType.Debug) |
9579a3c62a9e
use skeleton findbugs jar containing only SuppresFBWarnings to avoid external dependency for JVMCI classes (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21411
diff
changeset
|
47 public static final OptionValue<Boolean> UseProfilingInformation = new OptionValue<>(true); |
9579a3c62a9e
use skeleton findbugs jar containing only SuppresFBWarnings to avoid external dependency for JVMCI classes (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21411
diff
changeset
|
48 // @formatter:on |
9579a3c62a9e
use skeleton findbugs jar containing only SuppresFBWarnings to avoid external dependency for JVMCI classes (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21411
diff
changeset
|
49 } |
9579a3c62a9e
use skeleton findbugs jar containing only SuppresFBWarnings to avoid external dependency for JVMCI classes (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21411
diff
changeset
|
50 |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
51 /** |
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
52 * 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
|
53 */ |
13259
b16fb0b7479b
every HotSpotResolvedJavaMethod needs its own constant pool
twisti
parents:
13254
diff
changeset
|
54 private final long metaspaceMethod; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
55 |
18223
17c98fad6980
converted HotSpotResolvedObjectType to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18222
diff
changeset
|
56 private final HotSpotResolvedObjectTypeImpl holder; |
13259
b16fb0b7479b
every HotSpotResolvedJavaMethod needs its own constant pool
twisti
parents:
13254
diff
changeset
|
57 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
|
58 private final HotSpotSignature signature; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4220
diff
changeset
|
59 private HotSpotMethodData methodData; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
60 private byte[] code; |
15828
34c99f83795b
Cache result of toJava and toJavaConstructor, since it is an expensive operation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15731
diff
changeset
|
61 private Member toJavaCache; |
5176
af59b4dfc9e4
compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5115
diff
changeset
|
62 |
9760
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
63 /** |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
64 * Gets the holder of a HotSpot metaspace method native object. |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14717
diff
changeset
|
65 * |
9760
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
66 * @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
|
67 * @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
|
68 * {@code metaspaceMethod} |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
69 */ |
18223
17c98fad6980
converted HotSpotResolvedObjectType to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18222
diff
changeset
|
70 public static HotSpotResolvedObjectTypeImpl getHolder(long metaspaceMethod) { |
12431
7080a96be216
rename: graalRuntime -> runtime, getGraalRuntime -> getRuntime
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
71 HotSpotVMConfig config = runtime().getConfig(); |
13264
b23cbfb4366a
merged CompilerToVM.getMetaspaceConstructor into CompilerToVM.getMetaspaceMethod
twisti
parents:
13259
diff
changeset
|
72 final long metaspaceConstMethod = unsafe.getAddress(metaspaceMethod + config.methodConstMethodOffset); |
b23cbfb4366a
merged CompilerToVM.getMetaspaceConstructor into CompilerToVM.getMetaspaceMethod
twisti
parents:
13259
diff
changeset
|
73 final long metaspaceConstantPool = unsafe.getAddress(metaspaceConstMethod + config.constMethodConstantsOffset); |
b23cbfb4366a
merged CompilerToVM.getMetaspaceConstructor into CompilerToVM.getMetaspaceMethod
twisti
parents:
13259
diff
changeset
|
74 final long metaspaceKlass = unsafe.getAddress(metaspaceConstantPool + config.constantPoolHolderOffset); |
18223
17c98fad6980
converted HotSpotResolvedObjectType to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18222
diff
changeset
|
75 return HotSpotResolvedObjectTypeImpl.fromMetaspaceKlass(metaspaceKlass); |
9760
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
76 } |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
77 |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
78 /** |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
79 * Gets the {@link ResolvedJavaMethod} for a HotSpot metaspace method native object. |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14717
diff
changeset
|
80 * |
9760
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
81 * @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
|
82 * @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
|
83 */ |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
84 public static HotSpotResolvedJavaMethod fromMetaspace(long metaspaceMethod) { |
18223
17c98fad6980
converted HotSpotResolvedObjectType to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18222
diff
changeset
|
85 HotSpotResolvedObjectTypeImpl holder = getHolder(metaspaceMethod); |
9760
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
86 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
|
87 } |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
88 |
18223
17c98fad6980
converted HotSpotResolvedObjectType to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18222
diff
changeset
|
89 public HotSpotResolvedJavaMethodImpl(HotSpotResolvedObjectTypeImpl holder, long metaspaceMethod) { |
13259
b16fb0b7479b
every HotSpotResolvedJavaMethod needs its own constant pool
twisti
parents:
13254
diff
changeset
|
90 // 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
|
91 super(null); |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
92 this.metaspaceMethod = metaspaceMethod; |
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
93 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
|
94 |
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
|
95 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
|
96 final long constMethod = getConstMethod(); |
13259
b16fb0b7479b
every HotSpotResolvedJavaMethod needs its own constant pool
twisti
parents:
13254
diff
changeset
|
97 |
b16fb0b7479b
every HotSpotResolvedJavaMethod needs its own constant pool
twisti
parents:
13254
diff
changeset
|
98 /* |
b16fb0b7479b
every HotSpotResolvedJavaMethod needs its own constant pool
twisti
parents:
13254
diff
changeset
|
99 * 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
|
100 * 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
|
101 * one from their holder. |
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 final long metaspaceConstantPool = unsafe.getAddress(constMethod + config.constMethodConstantsOffset); |
b16fb0b7479b
every HotSpotResolvedJavaMethod needs its own constant pool
twisti
parents:
13254
diff
changeset
|
104 this.constantPool = new HotSpotConstantPool(metaspaceConstantPool); |
b16fb0b7479b
every HotSpotResolvedJavaMethod needs its own constant pool
twisti
parents:
13254
diff
changeset
|
105 |
b16fb0b7479b
every HotSpotResolvedJavaMethod needs its own constant pool
twisti
parents:
13254
diff
changeset
|
106 final int nameIndex = unsafe.getChar(constMethod + config.constMethodNameIndexOffset); |
b16fb0b7479b
every HotSpotResolvedJavaMethod needs its own constant pool
twisti
parents:
13254
diff
changeset
|
107 this.name = constantPool.lookupUtf8(nameIndex); |
b16fb0b7479b
every HotSpotResolvedJavaMethod needs its own constant pool
twisti
parents:
13254
diff
changeset
|
108 |
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
|
109 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
|
110 this.signature = (HotSpotSignature) constantPool.lookupSignature(signatureIndex); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
111 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
112 |
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
|
113 /** |
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 * 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
|
115 * {@code Method::_constMethod}). |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14717
diff
changeset
|
116 * |
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
|
117 * @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
|
118 */ |
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
|
119 private long getConstMethod() { |
13259
b16fb0b7479b
every HotSpotResolvedJavaMethod needs its own constant pool
twisti
parents:
13254
diff
changeset
|
120 assert metaspaceMethod != 0; |
b16fb0b7479b
every HotSpotResolvedJavaMethod needs its own constant pool
twisti
parents:
13254
diff
changeset
|
121 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
|
122 } |
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 |
14160
fd7fcd2d2072
replaced == with .equals() for comparisons between JavaMethod/JavaField/JavaType values
Doug Simon <doug.simon@oracle.com>
parents:
14107
diff
changeset
|
124 @Override |
fd7fcd2d2072
replaced == with .equals() for comparisons between JavaMethod/JavaField/JavaType values
Doug Simon <doug.simon@oracle.com>
parents:
14107
diff
changeset
|
125 public boolean equals(Object obj) { |
18366
c09fc2864097
fixed HotSpotResolvedJavaMethodImpl.equals
Doug Simon <doug.simon@oracle.com>
parents:
18323
diff
changeset
|
126 if (obj instanceof HotSpotResolvedJavaMethodImpl) { |
18222
a8cff27ca2e1
converted HotSpotResolvedJavaMethod to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
127 HotSpotResolvedJavaMethodImpl that = (HotSpotResolvedJavaMethodImpl) obj; |
14160
fd7fcd2d2072
replaced == with .equals() for comparisons between JavaMethod/JavaField/JavaType values
Doug Simon <doug.simon@oracle.com>
parents:
14107
diff
changeset
|
128 return that.metaspaceMethod == metaspaceMethod; |
fd7fcd2d2072
replaced == with .equals() for comparisons between JavaMethod/JavaField/JavaType values
Doug Simon <doug.simon@oracle.com>
parents:
14107
diff
changeset
|
129 } |
fd7fcd2d2072
replaced == with .equals() for comparisons between JavaMethod/JavaField/JavaType values
Doug Simon <doug.simon@oracle.com>
parents:
14107
diff
changeset
|
130 return false; |
fd7fcd2d2072
replaced == with .equals() for comparisons between JavaMethod/JavaField/JavaType values
Doug Simon <doug.simon@oracle.com>
parents:
14107
diff
changeset
|
131 } |
fd7fcd2d2072
replaced == with .equals() for comparisons between JavaMethod/JavaField/JavaType values
Doug Simon <doug.simon@oracle.com>
parents:
14107
diff
changeset
|
132 |
fd7fcd2d2072
replaced == with .equals() for comparisons between JavaMethod/JavaField/JavaType values
Doug Simon <doug.simon@oracle.com>
parents:
14107
diff
changeset
|
133 @Override |
fd7fcd2d2072
replaced == with .equals() for comparisons between JavaMethod/JavaField/JavaType values
Doug Simon <doug.simon@oracle.com>
parents:
14107
diff
changeset
|
134 public int hashCode() { |
fd7fcd2d2072
replaced == with .equals() for comparisons between JavaMethod/JavaField/JavaType values
Doug Simon <doug.simon@oracle.com>
parents:
14107
diff
changeset
|
135 return (int) metaspaceMethod; |
fd7fcd2d2072
replaced == with .equals() for comparisons between JavaMethod/JavaField/JavaType values
Doug Simon <doug.simon@oracle.com>
parents:
14107
diff
changeset
|
136 } |
fd7fcd2d2072
replaced == with .equals() for comparisons between JavaMethod/JavaField/JavaType values
Doug Simon <doug.simon@oracle.com>
parents:
14107
diff
changeset
|
137 |
13306
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
138 /** |
14717 | 139 * Returns this method's flags ({@code Method::_flags}). |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14717
diff
changeset
|
140 * |
14717 | 141 * @return flags of this method |
142 */ | |
143 private int getFlags() { | |
144 return unsafe.getByte(metaspaceMethod + runtime().getConfig().methodFlagsOffset); | |
145 } | |
146 | |
147 /** | |
13306
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
148 * Returns this method's constant method flags ({@code ConstMethod::_flags}). |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14717
diff
changeset
|
149 * |
13306
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
150 * @return flags of this method's ConstMethod |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
151 */ |
14717 | 152 private int getConstMethodFlags() { |
13306
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
153 return unsafe.getChar(getConstMethod() + runtime().getConfig().constMethodFlagsOffset); |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
154 } |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
155 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
156 @Override |
18223
17c98fad6980
converted HotSpotResolvedObjectType to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18222
diff
changeset
|
157 public HotSpotResolvedObjectTypeImpl getDeclaringClass() { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
158 return holder; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
159 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
160 |
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
|
161 /** |
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
|
162 * 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
|
163 */ |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
18176
diff
changeset
|
164 public JavaConstant getMetaspaceMethodConstant() { |
18266
ae181ec869c5
converted HotSpotMetaspaceConstant to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18262
diff
changeset
|
165 return HotSpotMetaspaceConstantImpl.forMetaspaceObject(getHostWordKind(), metaspaceMethod, this, false); |
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
|
166 } |
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
|
167 |
15088
d3add9b82b71
change to StackIntrospection and Truffle getStackTrace implementation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15040
diff
changeset
|
168 public long getMetaspaceMethod() { |
d3add9b82b71
change to StackIntrospection and Truffle getStackTrace implementation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15040
diff
changeset
|
169 return metaspaceMethod; |
d3add9b82b71
change to StackIntrospection and Truffle getStackTrace implementation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15040
diff
changeset
|
170 } |
d3add9b82b71
change to StackIntrospection and Truffle getStackTrace implementation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15040
diff
changeset
|
171 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
172 @Override |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
18176
diff
changeset
|
173 public JavaConstant getEncoding() { |
9380
ee8cd087a731
Dispatch based on method instead of type if it seems more beneficial.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9338
diff
changeset
|
174 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
|
175 } |
ee8cd087a731
Dispatch based on method instead of type if it seems more beneficial.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9338
diff
changeset
|
176 |
13787 | 177 /** |
178 * Gets the complete set of modifiers for this method which includes the JVM specification | |
179 * modifiers as well as the HotSpot internal modifiers. | |
180 */ | |
181 public int getAllModifiers() { | |
14717 | 182 return unsafe.getInt(metaspaceMethod + runtime().getConfig().methodAccessFlagsOffset); |
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
|
183 } |
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
|
184 |
9380
ee8cd087a731
Dispatch based on method instead of type if it seems more beneficial.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9338
diff
changeset
|
185 @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
|
186 public int getModifiers() { |
13787 | 187 return getAllModifiers() & Modifier.methodModifiers(); |
3733
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 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
190 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
191 public boolean canBeStaticallyBound() { |
18823
5a21cac1968f
Add utilities ModifiersProvider#isConcrete, ResolvedJavaMethod#hasReceiver, ResolvedJavaMethod#hasBytecodes to Graal API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18557
diff
changeset
|
192 return (isFinal() || isPrivate() || isStatic() || holder.isFinal()) && isConcrete(); |
3733
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 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
195 @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
|
196 public byte[] getCode() { |
14105 | 197 if (getCodeSize() == 0) { |
7912
06ecee106195
added unit tests for bytecode and machine code disassembly
Doug Simon <doug.simon@oracle.com>
parents:
7786
diff
changeset
|
198 return null; |
06ecee106195
added unit tests for bytecode and machine code disassembly
Doug Simon <doug.simon@oracle.com>
parents:
7786
diff
changeset
|
199 } |
13214
3f34b8f91cc5
moved CompilerToVM.isTypeInitialized and isTypeLinked to Java
twisti
parents:
13183
diff
changeset
|
200 if (code == null && holder.isLinked()) { |
15843
747bc4099ad8
rename initializeBytecode to getBytecode and eliminate extra copy
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15840
diff
changeset
|
201 code = runtime().getCompilerToVM().getBytecode(metaspaceMethod); |
14105 | 202 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
|
203 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
204 return code; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
205 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
206 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
207 @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
|
208 public int getCodeSize() { |
14105 | 209 return unsafe.getChar(getConstMethod() + runtime().getConfig().constMethodCodeSizeOffset); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
210 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
211 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
212 @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
|
213 public ExceptionHandler[] getExceptionHandlers() { |
14105 | 214 final boolean hasExceptionTable = (getConstMethodFlags() & runtime().getConfig().constMethodHasExceptionTable) != 0; |
215 if (!hasExceptionTable) { | |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
216 return new ExceptionHandler[0]; |
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
217 } |
13305
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 HotSpotVMConfig config = runtime().getConfig(); |
14105 | 220 final int exceptionTableLength = runtime().getCompilerToVM().exceptionTableLength(metaspaceMethod); |
221 ExceptionHandler[] handlers = new ExceptionHandler[exceptionTableLength]; | |
13305
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
222 long exceptionTableElement = runtime().getCompilerToVM().exceptionTableStart(metaspaceMethod); |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
223 |
14105 | 224 for (int i = 0; i < exceptionTableLength; i++) { |
13305
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
225 final int startPc = unsafe.getChar(exceptionTableElement + config.exceptionTableElementStartPcOffset); |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
226 final int endPc = unsafe.getChar(exceptionTableElement + config.exceptionTableElementEndPcOffset); |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
227 final int handlerPc = unsafe.getChar(exceptionTableElement + config.exceptionTableElementHandlerPcOffset); |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
228 int catchTypeIndex = unsafe.getChar(exceptionTableElement + config.exceptionTableElementCatchTypeIndexOffset); |
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 JavaType catchType; |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
231 if (catchTypeIndex == 0) { |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
232 catchType = null; |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
233 } else { |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
234 final int opcode = -1; // opcode is not used |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
235 catchType = constantPool.lookupType(catchTypeIndex, opcode); |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
236 |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
237 // Check for Throwable which catches everything. |
18223
17c98fad6980
converted HotSpotResolvedObjectType to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18222
diff
changeset
|
238 if (catchType instanceof HotSpotResolvedObjectTypeImpl) { |
17c98fad6980
converted HotSpotResolvedObjectType to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18222
diff
changeset
|
239 HotSpotResolvedObjectTypeImpl resolvedType = (HotSpotResolvedObjectTypeImpl) catchType; |
13305
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
240 if (resolvedType.mirror() == Throwable.class) { |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
241 catchTypeIndex = 0; |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
242 catchType = null; |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
243 } |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
244 } |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
245 } |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
246 handlers[i] = new ExceptionHandler(startPc, endPc, handlerPc, catchTypeIndex, catchType); |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
247 |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
248 // Go to the next ExceptionTableElement |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
249 exceptionTableElement += config.exceptionTableElementSize; |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
250 } |
13305
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
251 |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
252 return handlers; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
253 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
254 |
9416 | 255 /** |
14717 | 256 * Returns true if this method has a {@code CallerSensitive} annotation. |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14717
diff
changeset
|
257 * |
9416 | 258 * @return true if CallerSensitive annotation present, false otherwise |
259 */ | |
260 public boolean isCallerSensitive() { | |
14717 | 261 return (getFlags() & runtime().getConfig().methodFlagsCallerSensitive) != 0; |
262 } | |
263 | |
264 /** | |
265 * Returns true if this method has a {@code ForceInline} annotation. | |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14717
diff
changeset
|
266 * |
14717 | 267 * @return true if ForceInline annotation present, false otherwise |
268 */ | |
269 public boolean isForceInline() { | |
270 return (getFlags() & runtime().getConfig().methodFlagsForceInline) != 0; | |
271 } | |
272 | |
273 /** | |
274 * Returns true if this method has a {@code DontInline} annotation. | |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14717
diff
changeset
|
275 * |
14717 | 276 * @return true if DontInline annotation present, false otherwise |
277 */ | |
278 public boolean isDontInline() { | |
279 return (getFlags() & runtime().getConfig().methodFlagsDontInline) != 0; | |
9416 | 280 } |
281 | |
282 /** | |
12532
9b1cc2628961
Extend the CompilerToVM interface to explicitly avoid compilation and inlining of methods
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
12464
diff
changeset
|
283 * 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
|
284 */ |
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
|
285 public void setNotInlineable() { |
12535
cee7f686c470
rename CompilerToVm.dontInline to doNotInlineOrCompile
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
12533
diff
changeset
|
286 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
|
287 } |
9b1cc2628961
Extend the CompilerToVM interface to explicitly avoid compilation and inlining of methods
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
12464
diff
changeset
|
288 |
9b1cc2628961
Extend the CompilerToVM interface to explicitly avoid compilation and inlining of methods
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
12464
diff
changeset
|
289 /** |
9416 | 290 * Returns true if this method is one of the special methods that is ignored by security stack |
291 * walks. | |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14717
diff
changeset
|
292 * |
9416 | 293 * @return true if special method ignored by security stack walks, false otherwise |
294 */ | |
295 public boolean ignoredBySecurityStackWalk() { | |
14717 | 296 return runtime().getCompilerToVM().methodIsIgnoredBySecurityStackWalk(metaspaceMethod); |
9416 | 297 } |
298 | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
299 public boolean hasBalancedMonitors() { |
14105 | 300 HotSpotVMConfig config = runtime().getConfig(); |
301 final int modifiers = getAllModifiers(); | |
302 | |
303 // Method has no monitorenter/exit bytecodes. | |
304 if ((modifiers & config.jvmAccHasMonitorBytecodes) == 0) { | |
305 return false; | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
306 } |
14105 | 307 |
308 // Check to see if a previous compilation computed the monitor-matching analysis. | |
309 if ((modifiers & config.jvmAccMonitorMatch) != 0) { | |
310 return true; | |
311 } | |
312 | |
313 // This either happens only once if monitors are balanced or very rarely multiple-times. | |
314 return runtime().getCompilerToVM().hasBalancedMonitors(metaspaceMethod); | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
315 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
316 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
317 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
318 public boolean isClassInitializer() { |
15311
820c6d353358
added ModifiersProvider as superinterface for ResolvedJava[Method|Field|Type] and implemented all checks against modifiers as default methods
Doug Simon <doug.simon@oracle.com>
parents:
15291
diff
changeset
|
319 return "<clinit>".equals(name) && isStatic(); |
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 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
322 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
323 public boolean isConstructor() { |
15311
820c6d353358
added ModifiersProvider as superinterface for ResolvedJava[Method|Field|Type] and implemented all checks against modifiers as default methods
Doug Simon <doug.simon@oracle.com>
parents:
15291
diff
changeset
|
324 return "<init>".equals(name) && !isStatic(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
325 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
326 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
327 @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
|
328 public int getMaxLocals() { |
15311
820c6d353358
added ModifiersProvider as superinterface for ResolvedJava[Method|Field|Type] and implemented all checks against modifiers as default methods
Doug Simon <doug.simon@oracle.com>
parents:
15291
diff
changeset
|
329 if (isAbstract() || isNative()) { |
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
|
330 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
|
331 } |
12431
7080a96be216
rename: graalRuntime -> runtime, getGraalRuntime -> getRuntime
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
332 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
|
333 return unsafe.getChar(getConstMethod() + config.methodMaxLocalsOffset); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
334 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
335 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
336 @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
|
337 public int getMaxStackSize() { |
15311
820c6d353358
added ModifiersProvider as superinterface for ResolvedJava[Method|Field|Type] and implemented all checks against modifiers as default methods
Doug Simon <doug.simon@oracle.com>
parents:
15291
diff
changeset
|
338 if (isAbstract() || isNative()) { |
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
|
339 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
|
340 } |
12431
7080a96be216
rename: graalRuntime -> runtime, getGraalRuntime -> getRuntime
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
341 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
|
342 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
|
343 } |
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 @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
|
346 public StackTraceElement asStackTraceElement(int bci) { |
14105 | 347 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
|
348 // 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
|
349 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
|
350 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
|
351 } |
12431
7080a96be216
rename: graalRuntime -> runtime, getGraalRuntime -> getRuntime
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
352 return runtime().getCompilerToVM().getStackTraceElement(metaspaceMethod, bci); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
353 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
354 |
18323
301c5e3d683a
removed *Impl types in signatures of Remote interfaces
Doug Simon <doug.simon@oracle.com>
parents:
18293
diff
changeset
|
355 public ResolvedJavaMethod uniqueConcreteMethod(HotSpotResolvedObjectType receiver) { |
16184
8fde32ece68e
use receiver type in findUniqueConcreteMethod
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15843
diff
changeset
|
356 if (receiver.isInterface()) { |
13373
430c9f08728d
moved most CompilerToVM.getUniqueConcreteMethod logic up to Java and replace getUniqueConcreteMethod with findUniqueConcreteMethod
twisti
parents:
13306
diff
changeset
|
357 // Cannot trust interfaces. Because of: |
430c9f08728d
moved most CompilerToVM.getUniqueConcreteMethod logic up to Java and replace getUniqueConcreteMethod with findUniqueConcreteMethod
twisti
parents:
13306
diff
changeset
|
358 // interface I { void foo(); } |
430c9f08728d
moved most CompilerToVM.getUniqueConcreteMethod logic up to Java and replace getUniqueConcreteMethod with findUniqueConcreteMethod
twisti
parents:
13306
diff
changeset
|
359 // class A { public void foo() {} } |
430c9f08728d
moved most CompilerToVM.getUniqueConcreteMethod logic up to Java and replace getUniqueConcreteMethod with findUniqueConcreteMethod
twisti
parents:
13306
diff
changeset
|
360 // 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
|
361 // 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
|
362 // class D extends B { } |
430c9f08728d
moved most CompilerToVM.getUniqueConcreteMethod logic up to Java and replace getUniqueConcreteMethod with findUniqueConcreteMethod
twisti
parents:
13306
diff
changeset
|
363 // 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
|
364 // seeing A.foo(). |
430c9f08728d
moved most CompilerToVM.getUniqueConcreteMethod logic up to Java and replace getUniqueConcreteMethod with findUniqueConcreteMethod
twisti
parents:
13306
diff
changeset
|
365 return null; |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
366 } |
18323
301c5e3d683a
removed *Impl types in signatures of Remote interfaces
Doug Simon <doug.simon@oracle.com>
parents:
18293
diff
changeset
|
367 long metaspaceKlass = ((HotSpotResolvedObjectTypeImpl) receiver).getMetaspaceKlass(); |
301c5e3d683a
removed *Impl types in signatures of Remote interfaces
Doug Simon <doug.simon@oracle.com>
parents:
18293
diff
changeset
|
368 final long uniqueConcreteMethod = runtime().getCompilerToVM().findUniqueConcreteMethod(metaspaceKlass, metaspaceMethod); |
13373
430c9f08728d
moved most CompilerToVM.getUniqueConcreteMethod logic up to Java and replace getUniqueConcreteMethod with findUniqueConcreteMethod
twisti
parents:
13306
diff
changeset
|
369 if (uniqueConcreteMethod == 0) { |
430c9f08728d
moved most CompilerToVM.getUniqueConcreteMethod logic up to Java and replace getUniqueConcreteMethod with findUniqueConcreteMethod
twisti
parents:
13306
diff
changeset
|
370 return null; |
430c9f08728d
moved most CompilerToVM.getUniqueConcreteMethod logic up to Java and replace getUniqueConcreteMethod with findUniqueConcreteMethod
twisti
parents:
13306
diff
changeset
|
371 } |
430c9f08728d
moved most CompilerToVM.getUniqueConcreteMethod logic up to Java and replace getUniqueConcreteMethod with findUniqueConcreteMethod
twisti
parents:
13306
diff
changeset
|
372 return fromMetaspace(uniqueConcreteMethod); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
373 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
374 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
375 @Override |
7676
ca9061b6694c
getMethodDescriptor does not need to be in the Signature interface
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7530
diff
changeset
|
376 public HotSpotSignature getSignature() { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
377 return signature; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
378 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
379 |
14107
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
380 /** |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
381 * Gets the value of {@code Method::_code}. |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14717
diff
changeset
|
382 * |
14107
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
383 * @return the value of {@code Method::_code} |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
384 */ |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
385 private long getCompiledCode() { |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
386 HotSpotVMConfig config = runtime().getConfig(); |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
387 return unsafe.getAddress(metaspaceMethod + config.methodCodeOffset); |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
388 } |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
389 |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
390 /** |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
391 * Returns whether this method has compiled code. |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14717
diff
changeset
|
392 * |
14107
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
393 * @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
|
394 */ |
10639
08e06d4a9e73
Removed API to access method invocation count from Graal.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10056
diff
changeset
|
395 public boolean hasCompiledCode() { |
14107
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
396 return getCompiledCode() != 0L; |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
397 } |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
398 |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
399 /** |
14607 | 400 * @param level |
401 * @return true if the currently installed code was generated at {@code level}. | |
14107
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
402 */ |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
403 public boolean hasCompiledCodeAtLevel(int level) { |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
404 long compiledCode = getCompiledCode(); |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
405 if (compiledCode != 0) { |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
406 return unsafe.getInt(compiledCode + runtime().getConfig().nmethodCompLevelOffset) == level; |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
407 } |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
408 return false; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
409 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
410 |
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
|
411 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
|
412 |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4220
diff
changeset
|
413 @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
|
414 public ProfilingInfo getProfilingInfo() { |
13217
210f58e992a1
Use separate method profile for OSR compilations.
Roland Schatz <roland.schatz@oracle.com>
parents:
13214
diff
changeset
|
415 return getProfilingInfo(true, true); |
210f58e992a1
Use separate method profile for OSR compilations.
Roland Schatz <roland.schatz@oracle.com>
parents:
13214
diff
changeset
|
416 } |
210f58e992a1
Use separate method profile for OSR compilations.
Roland Schatz <roland.schatz@oracle.com>
parents:
13214
diff
changeset
|
417 |
210f58e992a1
Use separate method profile for OSR compilations.
Roland Schatz <roland.schatz@oracle.com>
parents:
13214
diff
changeset
|
418 public ProfilingInfo getCompilationProfilingInfo(boolean isOSR) { |
210f58e992a1
Use separate method profile for OSR compilations.
Roland Schatz <roland.schatz@oracle.com>
parents:
13214
diff
changeset
|
419 return getProfilingInfo(!isOSR, isOSR); |
210f58e992a1
Use separate method profile for OSR compilations.
Roland Schatz <roland.schatz@oracle.com>
parents:
13214
diff
changeset
|
420 } |
210f58e992a1
Use separate method profile for OSR compilations.
Roland Schatz <roland.schatz@oracle.com>
parents:
13214
diff
changeset
|
421 |
210f58e992a1
Use separate method profile for OSR compilations.
Roland Schatz <roland.schatz@oracle.com>
parents:
13214
diff
changeset
|
422 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
|
423 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
|
424 |
9864
063a712fe8d8
converted remaining options in GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
9760
diff
changeset
|
425 if (UseProfilingInformation.getValue() && methodData == null) { |
18557
80a6b4a23418
removed a usage of HotSPotGraalRuntime.unsafeReadWord()
Doug Simon <doug.simon@oracle.com>
parents:
18538
diff
changeset
|
426 long metaspaceMethodData = unsafe.getAddress(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
|
427 if (metaspaceMethodData != 0) { |
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
428 methodData = new HotSpotMethodData(metaspaceMethodData); |
16480
10c12d09a8d2
moved format(String format, JavaMethod method) from MetaUtil to be a default method in JavaMethod
Doug Simon <doug.simon@oracle.com>
parents:
16399
diff
changeset
|
429 if (TraceMethodDataFilter != null && this.format("%H.%n").contains(TraceMethodDataFilter)) { |
10c12d09a8d2
moved format(String format, JavaMethod method) from MetaUtil to be a default method in JavaMethod
Doug Simon <doug.simon@oracle.com>
parents:
16399
diff
changeset
|
430 TTY.println("Raw method data for " + this.format("%H.%n(%p)") + ":"); |
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
|
431 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
|
432 } |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
433 } |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4220
diff
changeset
|
434 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
435 |
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
|
436 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
|
437 // 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
|
438 // 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
|
439 info = DefaultProfilingInfo.get(TriState.FALSE); |
4446 | 440 } else { |
13217
210f58e992a1
Use separate method profile for OSR compilations.
Roland Schatz <roland.schatz@oracle.com>
parents:
13214
diff
changeset
|
441 info = new HotSpotProfilingInfo(methodData, this, includeNormal, includeOSR); |
4446 | 442 } |
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
|
443 return info; |
3733
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 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
446 @Override |
8611
6c4db417385a
added API to reset the profiling information for a method
Christian Haeubl <haeubl@ssw.jku.at>
parents:
8610
diff
changeset
|
447 public void reprofile() { |
12431
7080a96be216
rename: graalRuntime -> runtime, getGraalRuntime -> getRuntime
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
448 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
|
449 } |
6c4db417385a
added API to reset the profiling information for a method
Christian Haeubl <haeubl@ssw.jku.at>
parents:
8610
diff
changeset
|
450 |
6c4db417385a
added API to reset the profiling information for a method
Christian Haeubl <haeubl@ssw.jku.at>
parents:
8610
diff
changeset
|
451 @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
|
452 public ConstantPool getConstantPool() { |
13259
b16fb0b7479b
every HotSpotResolvedJavaMethod needs its own constant pool
twisti
parents:
13254
diff
changeset
|
453 return constantPool; |
3733
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 |
5039
f3d2447db2d9
added detection for endless recompilation
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5003
diff
changeset
|
456 @Override |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
457 public Annotation[][] getParameterAnnotations() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
458 if (isConstructor()) { |
15040
288c23143d47
Fix most raw type references.
Josef Eisl <josef.eisl@jku.at>
parents:
15018
diff
changeset
|
459 Constructor<?> javaConstructor = toJavaConstructor(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
460 return javaConstructor == null ? null : javaConstructor.getParameterAnnotations(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
461 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
462 Method javaMethod = toJava(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
463 return javaMethod == null ? null : javaMethod.getParameterAnnotations(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
464 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
465 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
466 @Override |
17125
ce1b6453c544
Add ResolvedJavaMethod.getAnnotations
Christian Wimmer <christian.wimmer@oracle.com>
parents:
16615
diff
changeset
|
467 public Annotation[] getAnnotations() { |
ce1b6453c544
Add ResolvedJavaMethod.getAnnotations
Christian Wimmer <christian.wimmer@oracle.com>
parents:
16615
diff
changeset
|
468 if (isConstructor()) { |
ce1b6453c544
Add ResolvedJavaMethod.getAnnotations
Christian Wimmer <christian.wimmer@oracle.com>
parents:
16615
diff
changeset
|
469 Constructor<?> javaConstructor = toJavaConstructor(); |
ce1b6453c544
Add ResolvedJavaMethod.getAnnotations
Christian Wimmer <christian.wimmer@oracle.com>
parents:
16615
diff
changeset
|
470 return javaConstructor == null ? new Annotation[0] : javaConstructor.getAnnotations(); |
ce1b6453c544
Add ResolvedJavaMethod.getAnnotations
Christian Wimmer <christian.wimmer@oracle.com>
parents:
16615
diff
changeset
|
471 } |
ce1b6453c544
Add ResolvedJavaMethod.getAnnotations
Christian Wimmer <christian.wimmer@oracle.com>
parents:
16615
diff
changeset
|
472 Method javaMethod = toJava(); |
ce1b6453c544
Add ResolvedJavaMethod.getAnnotations
Christian Wimmer <christian.wimmer@oracle.com>
parents:
16615
diff
changeset
|
473 return javaMethod == null ? new Annotation[0] : javaMethod.getAnnotations(); |
ce1b6453c544
Add ResolvedJavaMethod.getAnnotations
Christian Wimmer <christian.wimmer@oracle.com>
parents:
16615
diff
changeset
|
474 } |
ce1b6453c544
Add ResolvedJavaMethod.getAnnotations
Christian Wimmer <christian.wimmer@oracle.com>
parents:
16615
diff
changeset
|
475 |
ce1b6453c544
Add ResolvedJavaMethod.getAnnotations
Christian Wimmer <christian.wimmer@oracle.com>
parents:
16615
diff
changeset
|
476 @Override |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
477 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
|
478 if (isConstructor()) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
479 Constructor<?> javaConstructor = toJavaConstructor(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
480 return javaConstructor == null ? null : javaConstructor.getAnnotation(annotationClass); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
481 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
482 Method javaMethod = toJava(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
483 return javaMethod == null ? null : javaMethod.getAnnotation(annotationClass); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
484 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
485 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
486 @Override |
9984
f3330a4487eb
added ResolvedJava[Field|Method].isSynthetic()
Doug Simon <doug.simon@oracle.com>
parents:
9928
diff
changeset
|
487 public boolean isSynthetic() { |
13787 | 488 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
|
489 return (runtime().getConfig().syntheticFlag & modifiers) != 0; |
9984
f3330a4487eb
added ResolvedJava[Field|Method].isSynthetic()
Doug Simon <doug.simon@oracle.com>
parents:
9928
diff
changeset
|
490 } |
f3330a4487eb
added ResolvedJava[Field|Method].isSynthetic()
Doug Simon <doug.simon@oracle.com>
parents:
9928
diff
changeset
|
491 |
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
|
492 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
|
493 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
|
494 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
|
495 } |
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
|
496 // 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
|
497 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
|
498 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
|
499 } |
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
|
500 |
9984
f3330a4487eb
added ResolvedJava[Field|Method].isSynthetic()
Doug Simon <doug.simon@oracle.com>
parents:
9928
diff
changeset
|
501 @Override |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
502 public Type[] getGenericParameterTypes() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
503 if (isConstructor()) { |
15040
288c23143d47
Fix most raw type references.
Josef Eisl <josef.eisl@jku.at>
parents:
15018
diff
changeset
|
504 Constructor<?> javaConstructor = toJavaConstructor(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
505 return javaConstructor == null ? null : javaConstructor.getGenericParameterTypes(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
506 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
507 Method javaMethod = toJava(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
508 return javaMethod == null ? null : javaMethod.getGenericParameterTypes(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
509 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
510 |
7053
014727292ae0
removed more usages of ResolvedJavaType.toJava()
Doug Simon <doug.simon@oracle.com>
parents:
7037
diff
changeset
|
511 public Class<?>[] signatureToTypes() { |
014727292ae0
removed more usages of ResolvedJavaType.toJava()
Doug Simon <doug.simon@oracle.com>
parents:
7037
diff
changeset
|
512 Signature sig = getSignature(); |
014727292ae0
removed more usages of ResolvedJavaType.toJava()
Doug Simon <doug.simon@oracle.com>
parents:
7037
diff
changeset
|
513 int count = sig.getParameterCount(false); |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7483
diff
changeset
|
514 Class<?>[] result = new Class<?>[count]; |
7053
014727292ae0
removed more usages of ResolvedJavaType.toJava()
Doug Simon <doug.simon@oracle.com>
parents:
7037
diff
changeset
|
515 for (int i = 0; i < result.length; ++i) { |
19447
2452e881fad5
Do not eagerly resolve types in lookupType.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18867
diff
changeset
|
516 JavaType parameterType = sig.getParameterType(i, holder); |
2452e881fad5
Do not eagerly resolve types in lookupType.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18867
diff
changeset
|
517 HotSpotResolvedJavaType resolvedParameterType = (HotSpotResolvedJavaType) parameterType.resolve(holder); |
2452e881fad5
Do not eagerly resolve types in lookupType.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18867
diff
changeset
|
518 result[i] = resolvedParameterType.mirror(); |
7053
014727292ae0
removed more usages of ResolvedJavaType.toJava()
Doug Simon <doug.simon@oracle.com>
parents:
7037
diff
changeset
|
519 } |
014727292ae0
removed more usages of ResolvedJavaType.toJava()
Doug Simon <doug.simon@oracle.com>
parents:
7037
diff
changeset
|
520 return result; |
014727292ae0
removed more usages of ResolvedJavaType.toJava()
Doug Simon <doug.simon@oracle.com>
parents:
7037
diff
changeset
|
521 } |
014727292ae0
removed more usages of ResolvedJavaType.toJava()
Doug Simon <doug.simon@oracle.com>
parents:
7037
diff
changeset
|
522 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
523 private Method toJava() { |
15828
34c99f83795b
Cache result of toJava and toJavaConstructor, since it is an expensive operation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15731
diff
changeset
|
524 if (toJavaCache != null) { |
34c99f83795b
Cache result of toJava and toJavaConstructor, since it is an expensive operation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15731
diff
changeset
|
525 return (Method) toJavaCache; |
34c99f83795b
Cache result of toJava and toJavaConstructor, since it is an expensive operation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15731
diff
changeset
|
526 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
527 try { |
15828
34c99f83795b
Cache result of toJava and toJavaConstructor, since it is an expensive operation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15731
diff
changeset
|
528 Method result = holder.mirror().getDeclaredMethod(name, signatureToTypes()); |
34c99f83795b
Cache result of toJava and toJavaConstructor, since it is an expensive operation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15731
diff
changeset
|
529 toJavaCache = result; |
34c99f83795b
Cache result of toJava and toJavaConstructor, since it is an expensive operation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15731
diff
changeset
|
530 return result; |
19967
a5ee3e32dc62
Don't let NoClassDefFoundError leak when reflectively looking up Method
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19885
diff
changeset
|
531 } catch (NoSuchMethodException | NoClassDefFoundError e) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
532 return null; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
533 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
534 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
535 |
15040
288c23143d47
Fix most raw type references.
Josef Eisl <josef.eisl@jku.at>
parents:
15018
diff
changeset
|
536 private Constructor<?> toJavaConstructor() { |
15828
34c99f83795b
Cache result of toJava and toJavaConstructor, since it is an expensive operation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15731
diff
changeset
|
537 if (toJavaCache != null) { |
34c99f83795b
Cache result of toJava and toJavaConstructor, since it is an expensive operation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15731
diff
changeset
|
538 return (Constructor<?>) toJavaCache; |
34c99f83795b
Cache result of toJava and toJavaConstructor, since it is an expensive operation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15731
diff
changeset
|
539 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
540 try { |
15828
34c99f83795b
Cache result of toJava and toJavaConstructor, since it is an expensive operation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15731
diff
changeset
|
541 Constructor<?> result = holder.mirror().getDeclaredConstructor(signatureToTypes()); |
34c99f83795b
Cache result of toJava and toJavaConstructor, since it is an expensive operation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15731
diff
changeset
|
542 toJavaCache = result; |
34c99f83795b
Cache result of toJava and toJavaConstructor, since it is an expensive operation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15731
diff
changeset
|
543 return result; |
19967
a5ee3e32dc62
Don't let NoClassDefFoundError leak when reflectively looking up Method
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19885
diff
changeset
|
544 } catch (NoSuchMethodException | NoClassDefFoundError e) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
545 return null; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
546 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
547 } |
4296
d089b71a5237
Add possibility to disable inlining for specific methods.
Andreas Woess <andreas.woess@jku.at>
parents:
4220
diff
changeset
|
548 |
d089b71a5237
Add possibility to disable inlining for specific methods.
Andreas Woess <andreas.woess@jku.at>
parents:
4220
diff
changeset
|
549 @Override |
d089b71a5237
Add possibility to disable inlining for specific methods.
Andreas Woess <andreas.woess@jku.at>
parents:
4220
diff
changeset
|
550 public boolean canBeInlined() { |
14717 | 551 if (isDontInline()) { |
9691 | 552 return false; |
553 } | |
18829
40df42df39e0
Can be inlined must also return true for native methods that are intrinsified.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18823
diff
changeset
|
554 return runtime().getCompilerToVM().canInlineMethod(metaspaceMethod); |
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
|
555 } |
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
|
556 |
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
|
557 @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
|
558 public boolean shouldBeInlined() { |
14717 | 559 if (isForceInline()) { |
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
|
560 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
|
561 } |
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
|
562 return runtime().getCompilerToVM().shouldInlineMethod(metaspaceMethod); |
4319
3c21eee8ab4d
Add installMethodCallback() to HotSpotRuntime.
Andreas Woess <andreas.woess@jku.at>
parents:
4296
diff
changeset
|
563 } |
4296
d089b71a5237
Add possibility to disable inlining for specific methods.
Andreas Woess <andreas.woess@jku.at>
parents:
4220
diff
changeset
|
564 |
7310
79a7b761755c
Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7212
diff
changeset
|
565 @Override |
79a7b761755c
Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7212
diff
changeset
|
566 public LineNumberTable getLineNumberTable() { |
14105 | 567 final boolean hasLineNumberTable = (getConstMethodFlags() & runtime().getConfig().constMethodHasLineNumberTable) != 0; |
568 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
|
569 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
|
570 } |
14105 | 571 |
572 long[] values = runtime().getCompilerToVM().getLineNumberTable(metaspaceMethod); | |
16387
2bd6dbbd7842
treat empty LineNumberTable as non-existent
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16184
diff
changeset
|
573 if (values.length == 0) { |
2bd6dbbd7842
treat empty LineNumberTable as non-existent
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16184
diff
changeset
|
574 // Empty table so treat is as non-existent |
2bd6dbbd7842
treat empty LineNumberTable as non-existent
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16184
diff
changeset
|
575 return null; |
2bd6dbbd7842
treat empty LineNumberTable as non-existent
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16184
diff
changeset
|
576 } |
7310
79a7b761755c
Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7212
diff
changeset
|
577 assert values.length % 2 == 0; |
79a7b761755c
Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7212
diff
changeset
|
578 int[] bci = new int[values.length / 2]; |
79a7b761755c
Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7212
diff
changeset
|
579 int[] line = new int[values.length / 2]; |
79a7b761755c
Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7212
diff
changeset
|
580 |
79a7b761755c
Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7212
diff
changeset
|
581 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
|
582 bci[i] = (int) values[i * 2]; |
79a7b761755c
Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7212
diff
changeset
|
583 line[i] = (int) values[i * 2 + 1]; |
79a7b761755c
Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7212
diff
changeset
|
584 } |
79a7b761755c
Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7212
diff
changeset
|
585 |
79a7b761755c
Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7212
diff
changeset
|
586 return new LineNumberTableImpl(line, bci); |
79a7b761755c
Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7212
diff
changeset
|
587 } |
79a7b761755c
Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7212
diff
changeset
|
588 |
7786
8bbbde9d0a52
extended ResolvedJavaMethod API by getLocalVariableTable
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
7676
diff
changeset
|
589 @Override |
8bbbde9d0a52
extended ResolvedJavaMethod API by getLocalVariableTable
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
7676
diff
changeset
|
590 public LocalVariableTable getLocalVariableTable() { |
14105 | 591 final boolean hasLocalVariableTable = (getConstMethodFlags() & runtime().getConfig().constMethodHasLocalVariableTable) != 0; |
592 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
|
593 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
|
594 } |
13306
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 HotSpotVMConfig config = runtime().getConfig(); |
14104 | 597 long localVariableTableElement = runtime().getCompilerToVM().getLocalVariableTableStart(metaspaceMethod); |
598 final int localVariableTableLength = runtime().getCompilerToVM().getLocalVariableTableLength(metaspaceMethod); | |
13306
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
599 Local[] locals = new Local[localVariableTableLength]; |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
600 |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
601 for (int i = 0; i < localVariableTableLength; i++) { |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
602 final int startBci = unsafe.getChar(localVariableTableElement + config.localVariableTableElementStartBciOffset); |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
603 final int endBci = startBci + unsafe.getChar(localVariableTableElement + config.localVariableTableElementLengthOffset); |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
604 final int nameCpIndex = unsafe.getChar(localVariableTableElement + config.localVariableTableElementNameCpIndexOffset); |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
605 final int typeCpIndex = unsafe.getChar(localVariableTableElement + config.localVariableTableElementDescriptorCpIndexOffset); |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
606 final int slot = unsafe.getChar(localVariableTableElement + config.localVariableTableElementSlotOffset); |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
607 |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
608 String localName = getConstantPool().lookupUtf8(nameCpIndex); |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
609 String localType = getConstantPool().lookupUtf8(typeCpIndex); |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
610 |
18538
1b904c58f27f
removed static accesses to HotSpotGraalRuntime out of LocalImpl
Doug Simon <doug.simon@oracle.com>
parents:
18532
diff
changeset
|
611 locals[i] = new LocalImpl(localName, runtime().lookupType(localType, holder, false), startBci, endBci, slot); |
13306
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
612 |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
613 // Go to the next LocalVariableTableElement |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
614 localVariableTableElement += config.localVariableTableElementSize; |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
615 } |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
616 |
7786
8bbbde9d0a52
extended ResolvedJavaMethod API by getLocalVariableTable
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
7676
diff
changeset
|
617 return new LocalVariableTableImpl(locals); |
8bbbde9d0a52
extended ResolvedJavaMethod API by getLocalVariableTable
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
7676
diff
changeset
|
618 } |
8bbbde9d0a52
extended ResolvedJavaMethod API by getLocalVariableTable
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
7676
diff
changeset
|
619 |
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
|
620 /** |
12559
ae412befde21
read HotSpotVMConfig fields from HotSpot's vmStructs via annotations
twisti
parents:
12535
diff
changeset
|
621 * Returns the offset of this method into the v-table. The method must have a v-table entry as |
15725
ef6b8d1898e6
Add resolved receiver type to ResolvedJavaMethod.isInVirtualMethodTable in order to be able to do vtable-calls for miranda and default methods
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15722
diff
changeset
|
622 * indicated by {@link #isInVirtualMethodTable(ResolvedJavaType)}, otherwise an exception is |
ef6b8d1898e6
Add resolved receiver type to ResolvedJavaMethod.isInVirtualMethodTable in order to be able to do vtable-calls for miranda and default methods
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15722
diff
changeset
|
623 * thrown. |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14717
diff
changeset
|
624 * |
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
|
625 * @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
|
626 */ |
15725
ef6b8d1898e6
Add resolved receiver type to ResolvedJavaMethod.isInVirtualMethodTable in order to be able to do vtable-calls for miranda and default methods
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15722
diff
changeset
|
627 public int vtableEntryOffset(ResolvedJavaType resolved) { |
21552
9579a3c62a9e
use skeleton findbugs jar containing only SuppresFBWarnings to avoid external dependency for JVMCI classes (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21411
diff
changeset
|
628 if (!isInVirtualMethodTable(resolved)) { |
9579a3c62a9e
use skeleton findbugs jar containing only SuppresFBWarnings to avoid external dependency for JVMCI classes (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21411
diff
changeset
|
629 throw new JVMCIError("%s does not have a vtable entry", this); |
9579a3c62a9e
use skeleton findbugs jar containing only SuppresFBWarnings to avoid external dependency for JVMCI classes (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21411
diff
changeset
|
630 } |
12559
ae412befde21
read HotSpotVMConfig fields from HotSpot's vmStructs via annotations
twisti
parents:
12535
diff
changeset
|
631 HotSpotVMConfig config = runtime().getConfig(); |
18223
17c98fad6980
converted HotSpotResolvedObjectType to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18222
diff
changeset
|
632 final int vtableIndex = getVtableIndex((HotSpotResolvedObjectTypeImpl) resolved); |
12559
ae412befde21
read HotSpotVMConfig fields from HotSpot's vmStructs via annotations
twisti
parents:
12535
diff
changeset
|
633 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
|
634 } |
5176
af59b4dfc9e4
compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5115
diff
changeset
|
635 |
9636
ff4e8218d3dd
Remove hasVtableEntry, use isInVirtualMethodTable instead
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9610
diff
changeset
|
636 @Override |
15725
ef6b8d1898e6
Add resolved receiver type to ResolvedJavaMethod.isInVirtualMethodTable in order to be able to do vtable-calls for miranda and default methods
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15722
diff
changeset
|
637 public boolean isInVirtualMethodTable(ResolvedJavaType resolved) { |
18223
17c98fad6980
converted HotSpotResolvedObjectType to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18222
diff
changeset
|
638 if (resolved instanceof HotSpotResolvedObjectTypeImpl) { |
17c98fad6980
converted HotSpotResolvedObjectType to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18222
diff
changeset
|
639 HotSpotResolvedObjectTypeImpl hotspotResolved = (HotSpotResolvedObjectTypeImpl) resolved; |
16615
3812931f9350
Don't read beyond end of known vtable
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16480
diff
changeset
|
640 int vtableIndex = getVtableIndex(hotspotResolved); |
3812931f9350
Don't read beyond end of known vtable
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16480
diff
changeset
|
641 return vtableIndex >= 0 && vtableIndex < hotspotResolved.getVtableLength(); |
3812931f9350
Don't read beyond end of known vtable
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16480
diff
changeset
|
642 } |
3812931f9350
Don't read beyond end of known vtable
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16480
diff
changeset
|
643 return false; |
15725
ef6b8d1898e6
Add resolved receiver type to ResolvedJavaMethod.isInVirtualMethodTable in order to be able to do vtable-calls for miranda and default methods
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15722
diff
changeset
|
644 } |
ef6b8d1898e6
Add resolved receiver type to ResolvedJavaMethod.isInVirtualMethodTable in order to be able to do vtable-calls for miranda and default methods
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15722
diff
changeset
|
645 |
18223
17c98fad6980
converted HotSpotResolvedObjectType to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18222
diff
changeset
|
646 private int getVtableIndex(HotSpotResolvedObjectTypeImpl resolved) { |
15731
7260016882ef
fix assert in HotSpotResolvedJavaMethod.vtableEntryOffset
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15726
diff
changeset
|
647 if (!holder.isLinked()) { |
7260016882ef
fix assert in HotSpotResolvedJavaMethod.vtableEntryOffset
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15726
diff
changeset
|
648 return runtime().getConfig().invalidVtableIndex; |
7260016882ef
fix assert in HotSpotResolvedJavaMethod.vtableEntryOffset
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15726
diff
changeset
|
649 } |
15725
ef6b8d1898e6
Add resolved receiver type to ResolvedJavaMethod.isInVirtualMethodTable in order to be able to do vtable-calls for miranda and default methods
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15722
diff
changeset
|
650 if (holder.isInterface()) { |
16615
3812931f9350
Don't read beyond end of known vtable
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16480
diff
changeset
|
651 if (resolved.isInterface()) { |
15725
ef6b8d1898e6
Add resolved receiver type to ResolvedJavaMethod.isInVirtualMethodTable in order to be able to do vtable-calls for miranda and default methods
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15722
diff
changeset
|
652 return runtime().getConfig().invalidVtableIndex; |
ef6b8d1898e6
Add resolved receiver type to ResolvedJavaMethod.isInVirtualMethodTable in order to be able to do vtable-calls for miranda and default methods
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15722
diff
changeset
|
653 } |
ef6b8d1898e6
Add resolved receiver type to ResolvedJavaMethod.isInVirtualMethodTable in order to be able to do vtable-calls for miranda and default methods
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15722
diff
changeset
|
654 return getVtableIndexForInterface(resolved); |
ef6b8d1898e6
Add resolved receiver type to ResolvedJavaMethod.isInVirtualMethodTable in order to be able to do vtable-calls for miranda and default methods
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15722
diff
changeset
|
655 } |
ef6b8d1898e6
Add resolved receiver type to ResolvedJavaMethod.isInVirtualMethodTable in order to be able to do vtable-calls for miranda and default methods
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15722
diff
changeset
|
656 return getVtableIndex(); |
12559
ae412befde21
read HotSpotVMConfig fields from HotSpot's vmStructs via annotations
twisti
parents:
12535
diff
changeset
|
657 } |
ae412befde21
read HotSpotVMConfig fields from HotSpot's vmStructs via annotations
twisti
parents:
12535
diff
changeset
|
658 |
13306
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
659 /** |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
660 * Returns this method's virtual table index. |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14717
diff
changeset
|
661 * |
13306
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
662 * @return virtual table index |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
663 */ |
12559
ae412befde21
read HotSpotVMConfig fields from HotSpot's vmStructs via annotations
twisti
parents:
12535
diff
changeset
|
664 private int getVtableIndex() { |
15725
ef6b8d1898e6
Add resolved receiver type to ResolvedJavaMethod.isInVirtualMethodTable in order to be able to do vtable-calls for miranda and default methods
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15722
diff
changeset
|
665 assert !holder.isInterface(); |
12559
ae412befde21
read HotSpotVMConfig fields from HotSpot's vmStructs via annotations
twisti
parents:
12535
diff
changeset
|
666 HotSpotVMConfig config = runtime().getConfig(); |
15102
175111728365
improve canBeStaticallyBound
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15088
diff
changeset
|
667 int result = unsafe.getInt(metaspaceMethod + config.methodVtableIndexOffset); |
175111728365
improve canBeStaticallyBound
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15088
diff
changeset
|
668 assert result >= config.nonvirtualVtableIndex : "must be linked"; |
175111728365
improve canBeStaticallyBound
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15088
diff
changeset
|
669 return result; |
9610
ae17e540c5d2
More asserts while getting vtable offsets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9416
diff
changeset
|
670 } |
ae17e540c5d2
More asserts while getting vtable offsets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9416
diff
changeset
|
671 |
15725
ef6b8d1898e6
Add resolved receiver type to ResolvedJavaMethod.isInVirtualMethodTable in order to be able to do vtable-calls for miranda and default methods
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15722
diff
changeset
|
672 private int getVtableIndexForInterface(ResolvedJavaType resolved) { |
18223
17c98fad6980
converted HotSpotResolvedObjectType to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18222
diff
changeset
|
673 HotSpotResolvedObjectTypeImpl hotspotType = (HotSpotResolvedObjectTypeImpl) resolved; |
15726
668d158f780c
Rename HotSpotResolvedObjectType.metaspaceKlass to getMetaspaceKlass
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15725
diff
changeset
|
674 return runtime().getCompilerToVM().getVtableIndexForInterface(hotspotType.getMetaspaceKlass(), getMetaspaceMethod()); |
15725
ef6b8d1898e6
Add resolved receiver type to ResolvedJavaMethod.isInVirtualMethodTable in order to be able to do vtable-calls for miranda and default methods
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15722
diff
changeset
|
675 } |
ef6b8d1898e6
Add resolved receiver type to ResolvedJavaMethod.isInVirtualMethodTable in order to be able to do vtable-calls for miranda and default methods
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15722
diff
changeset
|
676 |
15262
cd51b1253c4c
replaced the link between a HotSpotResolvedJavaMethod and a SpeculationLog with a ClassValue based mechanism (GRAAL-727)
Doug Simon <doug.simon@oracle.com>
parents:
15259
diff
changeset
|
677 /** |
cd51b1253c4c
replaced the link between a HotSpotResolvedJavaMethod and a SpeculationLog with a ClassValue based mechanism (GRAAL-727)
Doug Simon <doug.simon@oracle.com>
parents:
15259
diff
changeset
|
678 * The {@link SpeculationLog} for methods compiled by Graal hang off this per-declaring-type |
cd51b1253c4c
replaced the link between a HotSpotResolvedJavaMethod and a SpeculationLog with a ClassValue based mechanism (GRAAL-727)
Doug Simon <doug.simon@oracle.com>
parents:
15259
diff
changeset
|
679 * {@link ClassValue}. The raw Method* value is safe to use as a key in the map as a) it is |
cd51b1253c4c
replaced the link between a HotSpotResolvedJavaMethod and a SpeculationLog with a ClassValue based mechanism (GRAAL-727)
Doug Simon <doug.simon@oracle.com>
parents:
15259
diff
changeset
|
680 * never moves and b) we never read from it. |
cd51b1253c4c
replaced the link between a HotSpotResolvedJavaMethod and a SpeculationLog with a ClassValue based mechanism (GRAAL-727)
Doug Simon <doug.simon@oracle.com>
parents:
15259
diff
changeset
|
681 * <p> |
cd51b1253c4c
replaced the link between a HotSpotResolvedJavaMethod and a SpeculationLog with a ClassValue based mechanism (GRAAL-727)
Doug Simon <doug.simon@oracle.com>
parents:
15259
diff
changeset
|
682 * One implication is that we will preserve {@link SpeculationLog}s for methods that have been |
cd51b1253c4c
replaced the link between a HotSpotResolvedJavaMethod and a SpeculationLog with a ClassValue based mechanism (GRAAL-727)
Doug Simon <doug.simon@oracle.com>
parents:
15259
diff
changeset
|
683 * redefined via class redefinition. It's tempting to periodically flush such logs but we cannot |
cd51b1253c4c
replaced the link between a HotSpotResolvedJavaMethod and a SpeculationLog with a ClassValue based mechanism (GRAAL-727)
Doug Simon <doug.simon@oracle.com>
parents:
15259
diff
changeset
|
684 * read the JVM_ACC_IS_OBSOLETE bit (or anything else) via the raw pointer as obsoleted methods |
cd51b1253c4c
replaced the link between a HotSpotResolvedJavaMethod and a SpeculationLog with a ClassValue based mechanism (GRAAL-727)
Doug Simon <doug.simon@oracle.com>
parents:
15259
diff
changeset
|
685 * are subject to clean up and deletion (see InstanceKlass::purge_previous_versions_internal). |
cd51b1253c4c
replaced the link between a HotSpotResolvedJavaMethod and a SpeculationLog with a ClassValue based mechanism (GRAAL-727)
Doug Simon <doug.simon@oracle.com>
parents:
15259
diff
changeset
|
686 */ |
cd51b1253c4c
replaced the link between a HotSpotResolvedJavaMethod and a SpeculationLog with a ClassValue based mechanism (GRAAL-727)
Doug Simon <doug.simon@oracle.com>
parents:
15259
diff
changeset
|
687 private static final ClassValue<Map<Long, SpeculationLog>> SpeculationLogs = new ClassValue<Map<Long, SpeculationLog>>() { |
cd51b1253c4c
replaced the link between a HotSpotResolvedJavaMethod and a SpeculationLog with a ClassValue based mechanism (GRAAL-727)
Doug Simon <doug.simon@oracle.com>
parents:
15259
diff
changeset
|
688 @Override |
cd51b1253c4c
replaced the link between a HotSpotResolvedJavaMethod and a SpeculationLog with a ClassValue based mechanism (GRAAL-727)
Doug Simon <doug.simon@oracle.com>
parents:
15259
diff
changeset
|
689 protected Map<Long, SpeculationLog> computeValue(java.lang.Class<?> type) { |
cd51b1253c4c
replaced the link between a HotSpotResolvedJavaMethod and a SpeculationLog with a ClassValue based mechanism (GRAAL-727)
Doug Simon <doug.simon@oracle.com>
parents:
15259
diff
changeset
|
690 return new HashMap<>(4); |
cd51b1253c4c
replaced the link between a HotSpotResolvedJavaMethod and a SpeculationLog with a ClassValue based mechanism (GRAAL-727)
Doug Simon <doug.simon@oracle.com>
parents:
15259
diff
changeset
|
691 } |
cd51b1253c4c
replaced the link between a HotSpotResolvedJavaMethod and a SpeculationLog with a ClassValue based mechanism (GRAAL-727)
Doug Simon <doug.simon@oracle.com>
parents:
15259
diff
changeset
|
692 }; |
cd51b1253c4c
replaced the link between a HotSpotResolvedJavaMethod and a SpeculationLog with a ClassValue based mechanism (GRAAL-727)
Doug Simon <doug.simon@oracle.com>
parents:
15259
diff
changeset
|
693 |
8217
dce9cefed571
Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7930
diff
changeset
|
694 public SpeculationLog getSpeculationLog() { |
15262
cd51b1253c4c
replaced the link between a HotSpotResolvedJavaMethod and a SpeculationLog with a ClassValue based mechanism (GRAAL-727)
Doug Simon <doug.simon@oracle.com>
parents:
15259
diff
changeset
|
695 Map<Long, SpeculationLog> map = SpeculationLogs.get(holder.mirror()); |
cd51b1253c4c
replaced the link between a HotSpotResolvedJavaMethod and a SpeculationLog with a ClassValue based mechanism (GRAAL-727)
Doug Simon <doug.simon@oracle.com>
parents:
15259
diff
changeset
|
696 synchronized (map) { |
cd51b1253c4c
replaced the link between a HotSpotResolvedJavaMethod and a SpeculationLog with a ClassValue based mechanism (GRAAL-727)
Doug Simon <doug.simon@oracle.com>
parents:
15259
diff
changeset
|
697 SpeculationLog log = map.get(this.metaspaceMethod); |
cd51b1253c4c
replaced the link between a HotSpotResolvedJavaMethod and a SpeculationLog with a ClassValue based mechanism (GRAAL-727)
Doug Simon <doug.simon@oracle.com>
parents:
15259
diff
changeset
|
698 if (log == null) { |
cd51b1253c4c
replaced the link between a HotSpotResolvedJavaMethod and a SpeculationLog with a ClassValue based mechanism (GRAAL-727)
Doug Simon <doug.simon@oracle.com>
parents:
15259
diff
changeset
|
699 log = new HotSpotSpeculationLog(); |
cd51b1253c4c
replaced the link between a HotSpotResolvedJavaMethod and a SpeculationLog with a ClassValue based mechanism (GRAAL-727)
Doug Simon <doug.simon@oracle.com>
parents:
15259
diff
changeset
|
700 map.put(metaspaceMethod, log); |
cd51b1253c4c
replaced the link between a HotSpotResolvedJavaMethod and a SpeculationLog with a ClassValue based mechanism (GRAAL-727)
Doug Simon <doug.simon@oracle.com>
parents:
15259
diff
changeset
|
701 } |
cd51b1253c4c
replaced the link between a HotSpotResolvedJavaMethod and a SpeculationLog with a ClassValue based mechanism (GRAAL-727)
Doug Simon <doug.simon@oracle.com>
parents:
15259
diff
changeset
|
702 return log; |
8217
dce9cefed571
Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7930
diff
changeset
|
703 } |
dce9cefed571
Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7930
diff
changeset
|
704 } |
9013
3b0ec709827c
added macro substitutions for the @PolymorphicSignature methods in MethodHandle
Doug Simon <doug.simon@oracle.com>
parents:
8949
diff
changeset
|
705 |
3b0ec709827c
added macro substitutions for the @PolymorphicSignature methods in MethodHandle
Doug Simon <doug.simon@oracle.com>
parents:
8949
diff
changeset
|
706 public int intrinsicId() { |
12431
7080a96be216
rename: graalRuntime -> runtime, getGraalRuntime -> getRuntime
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
707 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
|
708 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
|
709 } |
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
|
710 |
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
|
711 @Override |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
18176
diff
changeset
|
712 public JavaConstant invoke(JavaConstant receiver, JavaConstant[] arguments) { |
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
|
713 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
|
714 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
|
715 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
|
716 |
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
|
717 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
|
718 for (int i = 0; i < arguments.length; i++) { |
18262
f7d45e2426d4
converted HotSpotObjectConstant to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18223
diff
changeset
|
719 objArguments[i] = HotSpotObjectConstantImpl.asBoxedValue(arguments[i]); |
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
|
720 } |
18293
ab8fbaa5e72f
fixed minor regressions after removing HotSpotObjectConstantImpl.asObject()
Doug Simon <doug.simon@oracle.com>
parents:
18290
diff
changeset
|
721 Object objReceiver = receiver != null && !receiver.isNull() ? ((HotSpotObjectConstantImpl) receiver).object() : null; |
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
|
722 |
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
|
723 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
|
724 Object objResult = javaMethod.invoke(objReceiver, objArguments); |
18262
f7d45e2426d4
converted HotSpotObjectConstant to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18223
diff
changeset
|
725 return javaMethod.getReturnType() == void.class ? null : HotSpotObjectConstantImpl.forBoxedValue(getSignature().getReturnKind(), objResult); |
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
|
726 |
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
|
727 } 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
|
728 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
|
729 } |
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
|
730 } |
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
|
731 |
14104 | 732 /** |
733 * Allocates a compile id for this method by asking the VM for one. | |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14717
diff
changeset
|
734 * |
14104 | 735 * @param entryBCI entry bci |
736 * @return compile id | |
737 */ | |
738 public int allocateCompileId(int entryBCI) { | |
739 return runtime().getCompilerToVM().allocateCompileId(metaspaceMethod, entryBCI); | |
740 } | |
741 | |
14107
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
742 public boolean hasCodeAtLevel(int entryBCI, int level) { |
21552
9579a3c62a9e
use skeleton findbugs jar containing only SuppresFBWarnings to avoid external dependency for JVMCI classes (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21411
diff
changeset
|
743 if (entryBCI == runtime().getConfig().invocationEntryBci) { |
14107
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
744 return hasCompiledCodeAtLevel(level); |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
745 } |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
746 return runtime().getCompilerToVM().hasCompiledCodeForOSR(metaspaceMethod, entryBCI, level); |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
747 } |
19885
b950967f74c7
replaced HashMap with a side-table (i.e., an array) for looking up InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
19717
diff
changeset
|
748 |
20902
7cc48e7e6bfe
generalized InvocationPluginIdHolder to MethodIdHolder
Doug Simon <doug.simon@oracle.com>
parents:
19967
diff
changeset
|
749 private int methodId; |
19885
b950967f74c7
replaced HashMap with a side-table (i.e., an array) for looking up InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
19717
diff
changeset
|
750 |
20902
7cc48e7e6bfe
generalized InvocationPluginIdHolder to MethodIdHolder
Doug Simon <doug.simon@oracle.com>
parents:
19967
diff
changeset
|
751 public void setMethodId(int id) { |
7cc48e7e6bfe
generalized InvocationPluginIdHolder to MethodIdHolder
Doug Simon <doug.simon@oracle.com>
parents:
19967
diff
changeset
|
752 assert methodId == 0; |
7cc48e7e6bfe
generalized InvocationPluginIdHolder to MethodIdHolder
Doug Simon <doug.simon@oracle.com>
parents:
19967
diff
changeset
|
753 methodId = id; |
19885
b950967f74c7
replaced HashMap with a side-table (i.e., an array) for looking up InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
19717
diff
changeset
|
754 } |
b950967f74c7
replaced HashMap with a side-table (i.e., an array) for looking up InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
19717
diff
changeset
|
755 |
20902
7cc48e7e6bfe
generalized InvocationPluginIdHolder to MethodIdHolder
Doug Simon <doug.simon@oracle.com>
parents:
19967
diff
changeset
|
756 public int getMethodId() { |
7cc48e7e6bfe
generalized InvocationPluginIdHolder to MethodIdHolder
Doug Simon <doug.simon@oracle.com>
parents:
19967
diff
changeset
|
757 return methodId; |
19885
b950967f74c7
replaced HashMap with a side-table (i.e., an array) for looking up InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
19717
diff
changeset
|
758 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
759 } |