Mercurial > hg > graal-jvmci-8
annotate graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod.java @ 10056:a323a9e20f9d
Fixed a few race conditions in the compilation queue.
author | Christian Haeubl <haeubl@ssw.jku.at> |
---|---|
date | Fri, 14 Jun 2013 19:12:56 +0200 |
parents | d9c14b1828fc |
children | 08e06d4a9e73 |
rev | line source |
---|---|
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
4 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
8 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
14 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
18 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
21 * questions. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
22 */ |
5548
8872bc0eebdf
Renaming hotspot.ri => hotspot.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5547
diff
changeset
|
23 package com.oracle.graal.hotspot.meta; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 |
9338
0266549ff6e0
added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9289
diff
changeset
|
25 import static com.oracle.graal.graph.UnsafeAccess.*; |
7037
dd81042f4eb1
added unit tests for ResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents:
7014
diff
changeset
|
26 import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*; |
9864
063a712fe8d8
converted remaining options in GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
9760
diff
changeset
|
27 import static com.oracle.graal.phases.GraalOptions.*; |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
28 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
29 import java.lang.annotation.*; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
30 import java.lang.reflect.*; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
31 import java.util.*; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
32 import java.util.concurrent.*; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
33 |
8217
dce9cefed571
Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7930
diff
changeset
|
34 import com.oracle.graal.api.code.*; |
5507
dc71b06d09f8
Moving classes from cri.ri to api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5346
diff
changeset
|
35 import com.oracle.graal.api.meta.*; |
8610
5407d1dd6450
API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents:
8217
diff
changeset
|
36 import com.oracle.graal.api.meta.ProfilingInfo.TriState; |
9636
ff4e8218d3dd
Remove hasVtableEntry, use isInVirtualMethodTable instead
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9610
diff
changeset
|
37 import com.oracle.graal.graph.*; |
5176
af59b4dfc9e4
compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5115
diff
changeset
|
38 import com.oracle.graal.hotspot.*; |
7310
79a7b761755c
Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7212
diff
changeset
|
39 import com.oracle.graal.hotspot.debug.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
40 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
41 /** |
5775
2c088af17e59
Removed left over Ri* prefixed identifiers
Doug Simon <doug.simon@oracle.com>
parents:
5722
diff
changeset
|
42 * 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
|
43 */ |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
44 public final class HotSpotResolvedJavaMethod extends HotSpotMethod implements ResolvedJavaMethod { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
45 |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
46 private static final long serialVersionUID = -5486975070147586588L; |
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
47 |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
48 /** |
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
49 * 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
|
50 */ |
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
51 final long metaspaceMethod; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
52 |
7084
9ba90252ce08
HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7083
diff
changeset
|
53 private final HotSpotResolvedObjectType holder; |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7483
diff
changeset
|
54 private/* final */int codeSize; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7483
diff
changeset
|
55 private/* final */int exceptionHandlerCount; |
9416 | 56 private boolean callerSensitive; |
57 private boolean forceInline; | |
58 private boolean dontInline; | |
59 private boolean ignoredBySecurityStackWalk; | |
7676
ca9061b6694c
getMethodDescriptor does not need to be in the Signature interface
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7530
diff
changeset
|
60 private HotSpotSignature signature; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
61 private Boolean hasBalancedMonitors; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
62 private Map<Object, Object> compilerStorage; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4220
diff
changeset
|
63 private HotSpotMethodData methodData; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
64 private byte[] code; |
5176
af59b4dfc9e4
compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5115
diff
changeset
|
65 private CompilationTask currentTask; |
8217
dce9cefed571
Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7930
diff
changeset
|
66 private SpeculationLog speculationLog; |
5176
af59b4dfc9e4
compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5115
diff
changeset
|
67 |
9760
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
68 /** |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
69 * Gets the holder of a HotSpot metaspace method native object. |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
70 * |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
71 * @param metaspaceMethod a metaspace Method object |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
72 * @return the {@link ResolvedJavaType} corresponding to the holder of the |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
73 * {@code metaspaceMethod} |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
74 */ |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
75 public static HotSpotResolvedObjectType getHolder(long metaspaceMethod) { |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
76 HotSpotVMConfig config = graalRuntime().getConfig(); |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
77 long constMethod = unsafe.getLong(metaspaceMethod + config.methodConstMethodOffset); |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
78 assert constMethod != 0; |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
79 long constantPool = unsafe.getLong(constMethod + config.constMethodConstantsOffset); |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
80 assert constantPool != 0; |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
81 long holder = unsafe.getLong(constantPool + config.constantPoolHolderOffset); |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
82 assert holder != 0; |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
83 return (HotSpotResolvedObjectType) HotSpotResolvedObjectType.fromMetaspaceKlass(holder); |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
84 } |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
85 |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
86 /** |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
87 * Gets the {@link ResolvedJavaMethod} for a HotSpot metaspace method native object. |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
88 * |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
89 * @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
|
90 * @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
|
91 */ |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
92 public static HotSpotResolvedJavaMethod fromMetaspace(long metaspaceMethod) { |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
93 HotSpotResolvedObjectType holder = getHolder(metaspaceMethod); |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
94 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
|
95 } |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
96 |
7084
9ba90252ce08
HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7083
diff
changeset
|
97 HotSpotResolvedJavaMethod(HotSpotResolvedObjectType holder, long metaspaceMethod) { |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
98 this.metaspaceMethod = metaspaceMethod; |
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
99 this.holder = holder; |
9289
261a43921c5e
rename: HotSpotGraalRuntime.getInstance() -> graalRuntime()
Doug Simon <doug.simon@oracle.com>
parents:
9100
diff
changeset
|
100 graalRuntime().getCompilerToVM().initializeMethod(metaspaceMethod, this); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
101 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
102 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
103 @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
|
104 public ResolvedJavaType getDeclaringClass() { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
105 return holder; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
106 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
107 |
8564
bbd8167f21f9
Added executeHelper to HotSpotInstalled code that gets replaced by a MethodSubstitution
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
8217
diff
changeset
|
108 public long getMetaspaceMethod() { |
bbd8167f21f9
Added executeHelper to HotSpotInstalled code that gets replaced by a MethodSubstitution
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
8217
diff
changeset
|
109 return metaspaceMethod; |
bbd8167f21f9
Added executeHelper to HotSpotInstalled code that gets replaced by a MethodSubstitution
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
8217
diff
changeset
|
110 } |
bbd8167f21f9
Added executeHelper to HotSpotInstalled code that gets replaced by a MethodSubstitution
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
8217
diff
changeset
|
111 |
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
|
112 /** |
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
|
113 * 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
|
114 */ |
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
|
115 public Constant getMetaspaceMethodConstant() { |
9289
261a43921c5e
rename: HotSpotGraalRuntime.getInstance() -> graalRuntime()
Doug Simon <doug.simon@oracle.com>
parents:
9100
diff
changeset
|
116 return Constant.forIntegerKind(graalRuntime().getTarget().wordKind, metaspaceMethod, this); |
7930
fe64b5da8229
Create direct call for Static and Special to avoid out-of-line patching stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7912
diff
changeset
|
117 } |
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
|
118 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
119 @Override |
9380
ee8cd087a731
Dispatch based on method instead of type if it seems more beneficial.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9338
diff
changeset
|
120 public Constant getEncoding() { |
ee8cd087a731
Dispatch based on method instead of type if it seems more beneficial.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9338
diff
changeset
|
121 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
|
122 } |
ee8cd087a731
Dispatch based on method instead of type if it seems more beneficial.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9338
diff
changeset
|
123 |
ee8cd087a731
Dispatch based on method instead of type if it seems more beneficial.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9338
diff
changeset
|
124 @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
|
125 public int getModifiers() { |
9289
261a43921c5e
rename: HotSpotGraalRuntime.getInstance() -> graalRuntime()
Doug Simon <doug.simon@oracle.com>
parents:
9100
diff
changeset
|
126 HotSpotVMConfig config = graalRuntime().getConfig(); |
7159
3fbde10a77b0
replaced usage of Unsafe.get<kind>(Object object, long offset) where object == null with Unsafe.get<kind>(long address)
Doug Simon <doug.simon@oracle.com>
parents:
7084
diff
changeset
|
127 return unsafe.getInt(metaspaceMethod + config.methodAccessFlagsOffset) & Modifier.methodModifiers(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
128 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
129 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
130 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
131 public boolean canBeStaticallyBound() { |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
132 int modifiers = getModifiers(); |
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
133 return (Modifier.isFinal(modifiers) || Modifier.isPrivate(modifiers) || Modifier.isStatic(modifiers)) && !Modifier.isAbstract(modifiers); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
134 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
135 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
136 @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
|
137 public byte[] getCode() { |
7912
06ecee106195
added unit tests for bytecode and machine code disassembly
Doug Simon <doug.simon@oracle.com>
parents:
7786
diff
changeset
|
138 if (codeSize == 0) { |
06ecee106195
added unit tests for bytecode and machine code disassembly
Doug Simon <doug.simon@oracle.com>
parents:
7786
diff
changeset
|
139 return null; |
06ecee106195
added unit tests for bytecode and machine code disassembly
Doug Simon <doug.simon@oracle.com>
parents:
7786
diff
changeset
|
140 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
141 if (code == null) { |
9289
261a43921c5e
rename: HotSpotGraalRuntime.getInstance() -> graalRuntime()
Doug Simon <doug.simon@oracle.com>
parents:
9100
diff
changeset
|
142 code = graalRuntime().getCompilerToVM().initializeBytecode(metaspaceMethod, new byte[codeSize]); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
143 assert code.length == codeSize : "expected: " + codeSize + ", actual: " + code.length; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
144 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
145 return code; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
146 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
147 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
148 @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
|
149 public int getCodeSize() { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
150 return codeSize; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
151 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
152 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
153 @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
|
154 public ExceptionHandler[] getExceptionHandlers() { |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
155 if (exceptionHandlerCount == 0) { |
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
156 return new ExceptionHandler[0]; |
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
157 } |
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
158 ExceptionHandler[] handlers = new ExceptionHandler[exceptionHandlerCount]; |
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
159 for (int i = 0; i < exceptionHandlerCount; i++) { |
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
160 handlers[i] = new ExceptionHandler(-1, -1, -1, -1, null); |
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
161 } |
9289
261a43921c5e
rename: HotSpotGraalRuntime.getInstance() -> graalRuntime()
Doug Simon <doug.simon@oracle.com>
parents:
9100
diff
changeset
|
162 return graalRuntime().getCompilerToVM().initializeExceptionHandlers(metaspaceMethod, handlers); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
163 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
164 |
9416 | 165 /** |
166 * Returns true if this method has a CallerSensitive annotation. | |
167 * | |
168 * @return true if CallerSensitive annotation present, false otherwise | |
169 */ | |
170 public boolean isCallerSensitive() { | |
171 return callerSensitive; | |
172 } | |
173 | |
174 /** | |
175 * Returns true if this method has a ForceInline annotation. | |
176 * | |
177 * @return true if ForceInline annotation present, false otherwise | |
178 */ | |
179 public boolean isForceInline() { | |
180 return forceInline; | |
181 } | |
182 | |
183 /** | |
184 * Returns true if this method has a DontInline annotation. | |
185 * | |
186 * @return true if DontInline annotation present, false otherwise | |
187 */ | |
188 public boolean isDontInline() { | |
189 return dontInline; | |
190 } | |
191 | |
192 /** | |
193 * Returns true if this method is one of the special methods that is ignored by security stack | |
194 * walks. | |
195 * | |
196 * @return true if special method ignored by security stack walks, false otherwise | |
197 */ | |
198 public boolean ignoredBySecurityStackWalk() { | |
199 return ignoredBySecurityStackWalk; | |
200 } | |
201 | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
202 public boolean hasBalancedMonitors() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
203 if (hasBalancedMonitors == null) { |
9289
261a43921c5e
rename: HotSpotGraalRuntime.getInstance() -> graalRuntime()
Doug Simon <doug.simon@oracle.com>
parents:
9100
diff
changeset
|
204 hasBalancedMonitors = graalRuntime().getCompilerToVM().hasBalancedMonitors(metaspaceMethod); |
3733
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 return hasBalancedMonitors; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
207 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
208 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
209 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
210 public boolean isClassInitializer() { |
6539
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6525
diff
changeset
|
211 return "<clinit>".equals(name) && Modifier.isStatic(getModifiers()); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
212 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
213 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
214 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
215 public boolean isConstructor() { |
6539
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6525
diff
changeset
|
216 return "<init>".equals(name) && !Modifier.isStatic(getModifiers()); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
217 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
218 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
219 @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
|
220 public int getMaxLocals() { |
9289
261a43921c5e
rename: HotSpotGraalRuntime.getInstance() -> graalRuntime()
Doug Simon <doug.simon@oracle.com>
parents:
9100
diff
changeset
|
221 HotSpotVMConfig config = graalRuntime().getConfig(); |
7483
729a79037bd5
Fixes after merge with hs25-b15.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7310
diff
changeset
|
222 long metaspaceConstMethod = unsafe.getLong(metaspaceMethod + config.methodConstMethodOffset); |
729a79037bd5
Fixes after merge with hs25-b15.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7310
diff
changeset
|
223 return unsafe.getShort(metaspaceConstMethod + config.methodMaxLocalsOffset) & 0xFFFF; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
224 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
225 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
226 @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
|
227 public int getMaxStackSize() { |
9289
261a43921c5e
rename: HotSpotGraalRuntime.getInstance() -> graalRuntime()
Doug Simon <doug.simon@oracle.com>
parents:
9100
diff
changeset
|
228 HotSpotVMConfig config = graalRuntime().getConfig(); |
7212
291ffc492eb6
Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/
Doug Simon <doug.simon@oracle.com>
parents:
7159
diff
changeset
|
229 long metaspaceConstMethod = unsafe.getLong(metaspaceMethod + config.methodConstMethodOffset); |
291ffc492eb6
Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/
Doug Simon <doug.simon@oracle.com>
parents:
7159
diff
changeset
|
230 return config.extraStackEntries + (unsafe.getShort(metaspaceConstMethod + config.constMethodMaxStackOffset) & 0xFFFF); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
231 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
232 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
233 @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
|
234 public StackTraceElement asStackTraceElement(int bci) { |
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
|
235 if (bci < 0 || bci >= codeSize) { |
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
|
236 // HotSpot code can only construct stack trace elements for valid bcis |
9289
261a43921c5e
rename: HotSpotGraalRuntime.getInstance() -> graalRuntime()
Doug Simon <doug.simon@oracle.com>
parents:
9100
diff
changeset
|
237 StackTraceElement ste = graalRuntime().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
|
238 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
|
239 } |
9289
261a43921c5e
rename: HotSpotGraalRuntime.getInstance() -> graalRuntime()
Doug Simon <doug.simon@oracle.com>
parents:
9100
diff
changeset
|
240 return graalRuntime().getCompilerToVM().getStackTraceElement(metaspaceMethod, bci); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
241 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
242 |
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
|
243 public ResolvedJavaMethod uniqueConcreteMethod() { |
7084
9ba90252ce08
HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7083
diff
changeset
|
244 HotSpotResolvedObjectType[] resultHolder = {null}; |
9289
261a43921c5e
rename: HotSpotGraalRuntime.getInstance() -> graalRuntime()
Doug Simon <doug.simon@oracle.com>
parents:
9100
diff
changeset
|
245 long ucm = graalRuntime().getCompilerToVM().getUniqueConcreteMethod(metaspaceMethod, resultHolder); |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
246 if (ucm != 0L) { |
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
247 assert resultHolder[0] != null; |
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
248 return resultHolder[0].createMethod(ucm); |
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
249 } |
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
250 return null; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
251 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
252 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
253 @Override |
7676
ca9061b6694c
getMethodDescriptor does not need to be in the Signature interface
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7530
diff
changeset
|
254 public HotSpotSignature getSignature() { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
255 if (signature == null) { |
9289
261a43921c5e
rename: HotSpotGraalRuntime.getInstance() -> graalRuntime()
Doug Simon <doug.simon@oracle.com>
parents:
9100
diff
changeset
|
256 signature = new HotSpotSignature(graalRuntime().getCompilerToVM().getSignature(metaspaceMethod)); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
257 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
258 return signature; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
259 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
260 |
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
|
261 public int getCompiledCodeSize() { |
9289
261a43921c5e
rename: HotSpotGraalRuntime.getInstance() -> graalRuntime()
Doug Simon <doug.simon@oracle.com>
parents:
9100
diff
changeset
|
262 return graalRuntime().getCompilerToVM().getCompiledCodeSize(metaspaceMethod); |
4528
e6e14d25e608
added two inlining policies for comparison
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4527
diff
changeset
|
263 } |
e6e14d25e608
added two inlining policies for comparison
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4527
diff
changeset
|
264 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
265 public int invocationCount() { |
9289
261a43921c5e
rename: HotSpotGraalRuntime.getInstance() -> graalRuntime()
Doug Simon <doug.simon@oracle.com>
parents:
9100
diff
changeset
|
266 return graalRuntime().getCompilerToVM().getInvocationCount(metaspaceMethod); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
267 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
268 |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4220
diff
changeset
|
269 @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
|
270 public ProfilingInfo getProfilingInfo() { |
5722
cdc3c0776f9f
removed mechanism for persisting profile information
Doug Simon <doug.simon@oracle.com>
parents:
5721
diff
changeset
|
271 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
|
272 |
9864
063a712fe8d8
converted remaining options in GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
9760
diff
changeset
|
273 if (UseProfilingInformation.getValue() && methodData == null) { |
9289
261a43921c5e
rename: HotSpotGraalRuntime.getInstance() -> graalRuntime()
Doug Simon <doug.simon@oracle.com>
parents:
9100
diff
changeset
|
274 long metaspaceMethodData = unsafeReadWord(metaspaceMethod + graalRuntime().getConfig().methodDataOffset); |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
275 if (metaspaceMethodData != 0) { |
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
276 methodData = new HotSpotMethodData(metaspaceMethodData); |
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
277 } |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4220
diff
changeset
|
278 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
279 |
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
|
280 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
|
281 // 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
|
282 // 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
|
283 info = DefaultProfilingInfo.get(TriState.FALSE); |
4446 | 284 } else { |
9928
a9311ec68721
Avoid graph caching if immature or no profiling information was used for graph building.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9864
diff
changeset
|
285 info = new HotSpotProfilingInfo(methodData, this); |
4446 | 286 } |
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
|
287 return info; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
288 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
289 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
290 @Override |
8611
6c4db417385a
added API to reset the profiling information for a method
Christian Haeubl <haeubl@ssw.jku.at>
parents:
8610
diff
changeset
|
291 public void reprofile() { |
9289
261a43921c5e
rename: HotSpotGraalRuntime.getInstance() -> graalRuntime()
Doug Simon <doug.simon@oracle.com>
parents:
9100
diff
changeset
|
292 graalRuntime().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
|
293 } |
6c4db417385a
added API to reset the profiling information for a method
Christian Haeubl <haeubl@ssw.jku.at>
parents:
8610
diff
changeset
|
294 |
6c4db417385a
added API to reset the profiling information for a method
Christian Haeubl <haeubl@ssw.jku.at>
parents:
8610
diff
changeset
|
295 @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
|
296 public Map<Object, Object> getCompilerStorage() { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
297 if (compilerStorage == null) { |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
298 compilerStorage = new ConcurrentHashMap<>(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
299 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
300 return compilerStorage; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
301 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
302 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
303 @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
|
304 public ConstantPool getConstantPool() { |
7084
9ba90252ce08
HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7083
diff
changeset
|
305 return ((HotSpotResolvedObjectType) getDeclaringClass()).constantPool(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
306 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
307 |
5039
f3d2447db2d9
added detection for endless recompilation
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5003
diff
changeset
|
308 @Override |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
309 public Annotation[][] getParameterAnnotations() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
310 if (isConstructor()) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
311 Constructor javaConstructor = toJavaConstructor(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
312 return javaConstructor == null ? null : javaConstructor.getParameterAnnotations(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
313 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
314 Method javaMethod = toJava(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
315 return javaMethod == null ? null : javaMethod.getParameterAnnotations(); |
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 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
318 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
319 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
|
320 if (isConstructor()) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
321 Constructor<?> javaConstructor = toJavaConstructor(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
322 return javaConstructor == null ? null : javaConstructor.getAnnotation(annotationClass); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
323 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
324 Method javaMethod = toJava(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
325 return javaMethod == null ? null : javaMethod.getAnnotation(annotationClass); |
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 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
328 @Override |
9984
f3330a4487eb
added ResolvedJava[Field|Method].isSynthetic()
Doug Simon <doug.simon@oracle.com>
parents:
9928
diff
changeset
|
329 public boolean isSynthetic() { |
f3330a4487eb
added ResolvedJava[Field|Method].isSynthetic()
Doug Simon <doug.simon@oracle.com>
parents:
9928
diff
changeset
|
330 if (isConstructor()) { |
f3330a4487eb
added ResolvedJava[Field|Method].isSynthetic()
Doug Simon <doug.simon@oracle.com>
parents:
9928
diff
changeset
|
331 Constructor<?> javaConstructor = toJavaConstructor(); |
f3330a4487eb
added ResolvedJava[Field|Method].isSynthetic()
Doug Simon <doug.simon@oracle.com>
parents:
9928
diff
changeset
|
332 return javaConstructor == null ? false : javaConstructor.isSynthetic(); |
f3330a4487eb
added ResolvedJava[Field|Method].isSynthetic()
Doug Simon <doug.simon@oracle.com>
parents:
9928
diff
changeset
|
333 } |
f3330a4487eb
added ResolvedJava[Field|Method].isSynthetic()
Doug Simon <doug.simon@oracle.com>
parents:
9928
diff
changeset
|
334 |
f3330a4487eb
added ResolvedJava[Field|Method].isSynthetic()
Doug Simon <doug.simon@oracle.com>
parents:
9928
diff
changeset
|
335 // Cannot use toJava() as it ignores the return type |
f3330a4487eb
added ResolvedJava[Field|Method].isSynthetic()
Doug Simon <doug.simon@oracle.com>
parents:
9928
diff
changeset
|
336 HotSpotSignature sig = getSignature(); |
f3330a4487eb
added ResolvedJava[Field|Method].isSynthetic()
Doug Simon <doug.simon@oracle.com>
parents:
9928
diff
changeset
|
337 JavaType[] sigTypes = MetaUtil.signatureToTypes(sig, null); |
f3330a4487eb
added ResolvedJava[Field|Method].isSynthetic()
Doug Simon <doug.simon@oracle.com>
parents:
9928
diff
changeset
|
338 HotSpotRuntime runtime = graalRuntime().getRuntime(); |
f3330a4487eb
added ResolvedJava[Field|Method].isSynthetic()
Doug Simon <doug.simon@oracle.com>
parents:
9928
diff
changeset
|
339 for (Method method : holder.mirror().getDeclaredMethods()) { |
f3330a4487eb
added ResolvedJava[Field|Method].isSynthetic()
Doug Simon <doug.simon@oracle.com>
parents:
9928
diff
changeset
|
340 if (method.getName().equals(name)) { |
f3330a4487eb
added ResolvedJava[Field|Method].isSynthetic()
Doug Simon <doug.simon@oracle.com>
parents:
9928
diff
changeset
|
341 if (runtime.lookupJavaType(method.getReturnType()).equals(sig.getReturnType(holder))) { |
f3330a4487eb
added ResolvedJava[Field|Method].isSynthetic()
Doug Simon <doug.simon@oracle.com>
parents:
9928
diff
changeset
|
342 if (matches(runtime, sigTypes, method.getParameterTypes())) { |
f3330a4487eb
added ResolvedJava[Field|Method].isSynthetic()
Doug Simon <doug.simon@oracle.com>
parents:
9928
diff
changeset
|
343 return method.isSynthetic(); |
f3330a4487eb
added ResolvedJava[Field|Method].isSynthetic()
Doug Simon <doug.simon@oracle.com>
parents:
9928
diff
changeset
|
344 } |
f3330a4487eb
added ResolvedJava[Field|Method].isSynthetic()
Doug Simon <doug.simon@oracle.com>
parents:
9928
diff
changeset
|
345 } |
f3330a4487eb
added ResolvedJava[Field|Method].isSynthetic()
Doug Simon <doug.simon@oracle.com>
parents:
9928
diff
changeset
|
346 } |
f3330a4487eb
added ResolvedJava[Field|Method].isSynthetic()
Doug Simon <doug.simon@oracle.com>
parents:
9928
diff
changeset
|
347 } |
f3330a4487eb
added ResolvedJava[Field|Method].isSynthetic()
Doug Simon <doug.simon@oracle.com>
parents:
9928
diff
changeset
|
348 return false; |
f3330a4487eb
added ResolvedJava[Field|Method].isSynthetic()
Doug Simon <doug.simon@oracle.com>
parents:
9928
diff
changeset
|
349 } |
f3330a4487eb
added ResolvedJava[Field|Method].isSynthetic()
Doug Simon <doug.simon@oracle.com>
parents:
9928
diff
changeset
|
350 |
f3330a4487eb
added ResolvedJava[Field|Method].isSynthetic()
Doug Simon <doug.simon@oracle.com>
parents:
9928
diff
changeset
|
351 @Override |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
352 public Type[] getGenericParameterTypes() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
353 if (isConstructor()) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
354 Constructor javaConstructor = toJavaConstructor(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
355 return javaConstructor == null ? null : javaConstructor.getGenericParameterTypes(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
356 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
357 Method javaMethod = toJava(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
358 return javaMethod == null ? null : javaMethod.getGenericParameterTypes(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
359 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
360 |
7053
014727292ae0
removed more usages of ResolvedJavaType.toJava()
Doug Simon <doug.simon@oracle.com>
parents:
7037
diff
changeset
|
361 public Class<?>[] signatureToTypes() { |
014727292ae0
removed more usages of ResolvedJavaType.toJava()
Doug Simon <doug.simon@oracle.com>
parents:
7037
diff
changeset
|
362 Signature sig = getSignature(); |
014727292ae0
removed more usages of ResolvedJavaType.toJava()
Doug Simon <doug.simon@oracle.com>
parents:
7037
diff
changeset
|
363 int count = sig.getParameterCount(false); |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7483
diff
changeset
|
364 Class<?>[] result = new Class<?>[count]; |
7053
014727292ae0
removed more usages of ResolvedJavaType.toJava()
Doug Simon <doug.simon@oracle.com>
parents:
7037
diff
changeset
|
365 for (int i = 0; i < result.length; ++i) { |
7084
9ba90252ce08
HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7083
diff
changeset
|
366 result[i] = ((HotSpotResolvedJavaType) sig.getParameterType(i, holder).resolve(holder)).mirror(); |
7053
014727292ae0
removed more usages of ResolvedJavaType.toJava()
Doug Simon <doug.simon@oracle.com>
parents:
7037
diff
changeset
|
367 } |
014727292ae0
removed more usages of ResolvedJavaType.toJava()
Doug Simon <doug.simon@oracle.com>
parents:
7037
diff
changeset
|
368 return result; |
014727292ae0
removed more usages of ResolvedJavaType.toJava()
Doug Simon <doug.simon@oracle.com>
parents:
7037
diff
changeset
|
369 } |
014727292ae0
removed more usages of ResolvedJavaType.toJava()
Doug Simon <doug.simon@oracle.com>
parents:
7037
diff
changeset
|
370 |
9984
f3330a4487eb
added ResolvedJava[Field|Method].isSynthetic()
Doug Simon <doug.simon@oracle.com>
parents:
9928
diff
changeset
|
371 private static boolean matches(HotSpotRuntime runtime, JavaType[] sigTypes, Class<?>[] parameterTypes) { |
f3330a4487eb
added ResolvedJava[Field|Method].isSynthetic()
Doug Simon <doug.simon@oracle.com>
parents:
9928
diff
changeset
|
372 if (parameterTypes.length == sigTypes.length) { |
f3330a4487eb
added ResolvedJava[Field|Method].isSynthetic()
Doug Simon <doug.simon@oracle.com>
parents:
9928
diff
changeset
|
373 for (int i = 0; i < parameterTypes.length; i++) { |
f3330a4487eb
added ResolvedJava[Field|Method].isSynthetic()
Doug Simon <doug.simon@oracle.com>
parents:
9928
diff
changeset
|
374 if (!runtime.lookupJavaType(parameterTypes[i]).equals(sigTypes[i])) { |
f3330a4487eb
added ResolvedJava[Field|Method].isSynthetic()
Doug Simon <doug.simon@oracle.com>
parents:
9928
diff
changeset
|
375 return false; |
f3330a4487eb
added ResolvedJava[Field|Method].isSynthetic()
Doug Simon <doug.simon@oracle.com>
parents:
9928
diff
changeset
|
376 } |
f3330a4487eb
added ResolvedJava[Field|Method].isSynthetic()
Doug Simon <doug.simon@oracle.com>
parents:
9928
diff
changeset
|
377 } |
f3330a4487eb
added ResolvedJava[Field|Method].isSynthetic()
Doug Simon <doug.simon@oracle.com>
parents:
9928
diff
changeset
|
378 return true; |
f3330a4487eb
added ResolvedJava[Field|Method].isSynthetic()
Doug Simon <doug.simon@oracle.com>
parents:
9928
diff
changeset
|
379 } |
f3330a4487eb
added ResolvedJava[Field|Method].isSynthetic()
Doug Simon <doug.simon@oracle.com>
parents:
9928
diff
changeset
|
380 return false; |
f3330a4487eb
added ResolvedJava[Field|Method].isSynthetic()
Doug Simon <doug.simon@oracle.com>
parents:
9928
diff
changeset
|
381 } |
f3330a4487eb
added ResolvedJava[Field|Method].isSynthetic()
Doug Simon <doug.simon@oracle.com>
parents:
9928
diff
changeset
|
382 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
383 private Method toJava() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
384 try { |
7053
014727292ae0
removed more usages of ResolvedJavaType.toJava()
Doug Simon <doug.simon@oracle.com>
parents:
7037
diff
changeset
|
385 return holder.mirror().getDeclaredMethod(name, signatureToTypes()); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
386 } catch (NoSuchMethodException e) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
387 return null; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
388 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
389 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
390 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
391 private Constructor toJavaConstructor() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
392 try { |
7053
014727292ae0
removed more usages of ResolvedJavaType.toJava()
Doug Simon <doug.simon@oracle.com>
parents:
7037
diff
changeset
|
393 return holder.mirror().getDeclaredConstructor(signatureToTypes()); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
394 } catch (NoSuchMethodException e) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
395 return null; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
396 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
397 } |
4296
d089b71a5237
Add possibility to disable inlining for specific methods.
Andreas Woess <andreas.woess@jku.at>
parents:
4220
diff
changeset
|
398 |
d089b71a5237
Add possibility to disable inlining for specific methods.
Andreas Woess <andreas.woess@jku.at>
parents:
4220
diff
changeset
|
399 @Override |
d089b71a5237
Add possibility to disable inlining for specific methods.
Andreas Woess <andreas.woess@jku.at>
parents:
4220
diff
changeset
|
400 public boolean canBeInlined() { |
9691 | 401 if (dontInline) { |
402 return false; | |
403 } | |
9289
261a43921c5e
rename: HotSpotGraalRuntime.getInstance() -> graalRuntime()
Doug Simon <doug.simon@oracle.com>
parents:
9100
diff
changeset
|
404 return graalRuntime().getCompilerToVM().isMethodCompilable(metaspaceMethod); |
4319
3c21eee8ab4d
Add installMethodCallback() to HotSpotRuntime.
Andreas Woess <andreas.woess@jku.at>
parents:
4296
diff
changeset
|
405 } |
4296
d089b71a5237
Add possibility to disable inlining for specific methods.
Andreas Woess <andreas.woess@jku.at>
parents:
4220
diff
changeset
|
406 |
7310
79a7b761755c
Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7212
diff
changeset
|
407 @Override |
79a7b761755c
Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7212
diff
changeset
|
408 public LineNumberTable getLineNumberTable() { |
9289
261a43921c5e
rename: HotSpotGraalRuntime.getInstance() -> graalRuntime()
Doug Simon <doug.simon@oracle.com>
parents:
9100
diff
changeset
|
409 long[] values = graalRuntime().getCompilerToVM().getLineNumberTable(this); |
7310
79a7b761755c
Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7212
diff
changeset
|
410 assert values.length % 2 == 0; |
79a7b761755c
Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7212
diff
changeset
|
411 int[] bci = new int[values.length / 2]; |
79a7b761755c
Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7212
diff
changeset
|
412 int[] line = new int[values.length / 2]; |
79a7b761755c
Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7212
diff
changeset
|
413 |
79a7b761755c
Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7212
diff
changeset
|
414 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
|
415 bci[i] = (int) values[i * 2]; |
79a7b761755c
Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7212
diff
changeset
|
416 line[i] = (int) values[i * 2 + 1]; |
79a7b761755c
Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7212
diff
changeset
|
417 } |
79a7b761755c
Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7212
diff
changeset
|
418 |
79a7b761755c
Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7212
diff
changeset
|
419 return new LineNumberTableImpl(line, bci); |
79a7b761755c
Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7212
diff
changeset
|
420 } |
79a7b761755c
Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7212
diff
changeset
|
421 |
7786
8bbbde9d0a52
extended ResolvedJavaMethod API by getLocalVariableTable
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
7676
diff
changeset
|
422 @Override |
8bbbde9d0a52
extended ResolvedJavaMethod API by getLocalVariableTable
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
7676
diff
changeset
|
423 public LocalVariableTable getLocalVariableTable() { |
9289
261a43921c5e
rename: HotSpotGraalRuntime.getInstance() -> graalRuntime()
Doug Simon <doug.simon@oracle.com>
parents:
9100
diff
changeset
|
424 Local[] locals = graalRuntime().getCompilerToVM().getLocalVariableTable(this); |
7786
8bbbde9d0a52
extended ResolvedJavaMethod API by getLocalVariableTable
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
7676
diff
changeset
|
425 return new LocalVariableTableImpl(locals); |
8bbbde9d0a52
extended ResolvedJavaMethod API by getLocalVariableTable
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
7676
diff
changeset
|
426 } |
8bbbde9d0a52
extended ResolvedJavaMethod API by getLocalVariableTable
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
7676
diff
changeset
|
427 |
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
|
428 /** |
9636
ff4e8218d3dd
Remove hasVtableEntry, use isInVirtualMethodTable instead
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9610
diff
changeset
|
429 * Returns the offset of this method into the v-table. The method must have a v-table entry has |
ff4e8218d3dd
Remove hasVtableEntry, use isInVirtualMethodTable instead
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9610
diff
changeset
|
430 * indicated by {@link #isInVirtualMethodTable()}, otherwise an exception is thrown. |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7483
diff
changeset
|
431 * |
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
|
432 * @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
|
433 */ |
5000
b5dc2403c1e7
add option to inline VTable stubs
Lukas Stadler <lukas.stadler@jku.at>
parents:
4600
diff
changeset
|
434 public int vtableEntryOffset() { |
9636
ff4e8218d3dd
Remove hasVtableEntry, use isInVirtualMethodTable instead
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9610
diff
changeset
|
435 if (!isInVirtualMethodTable() || !holder.isInitialized()) { |
ff4e8218d3dd
Remove hasVtableEntry, use isInVirtualMethodTable instead
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9610
diff
changeset
|
436 throw new GraalInternalError("%s does not have a vtable entry", this); |
6379
ad97777056ec
Checks on vtableEntryOffset to avoid calling to the VM if the holder is not initialized
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5775
diff
changeset
|
437 } |
9289
261a43921c5e
rename: HotSpotGraalRuntime.getInstance() -> graalRuntime()
Doug Simon <doug.simon@oracle.com>
parents:
9100
diff
changeset
|
438 return graalRuntime().getCompilerToVM().getVtableEntryOffset(metaspaceMethod); |
5000
b5dc2403c1e7
add option to inline VTable stubs
Lukas Stadler <lukas.stadler@jku.at>
parents:
4600
diff
changeset
|
439 } |
5176
af59b4dfc9e4
compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5115
diff
changeset
|
440 |
9636
ff4e8218d3dd
Remove hasVtableEntry, use isInVirtualMethodTable instead
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9610
diff
changeset
|
441 @Override |
ff4e8218d3dd
Remove hasVtableEntry, use isInVirtualMethodTable instead
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9610
diff
changeset
|
442 public boolean isInVirtualMethodTable() { |
9610
ae17e540c5d2
More asserts while getting vtable offsets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9416
diff
changeset
|
443 return graalRuntime().getCompilerToVM().hasVtableEntry(metaspaceMethod); |
ae17e540c5d2
More asserts while getting vtable offsets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9416
diff
changeset
|
444 } |
ae17e540c5d2
More asserts while getting vtable offsets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9416
diff
changeset
|
445 |
5176
af59b4dfc9e4
compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5115
diff
changeset
|
446 public void setCurrentTask(CompilationTask task) { |
af59b4dfc9e4
compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5115
diff
changeset
|
447 currentTask = task; |
af59b4dfc9e4
compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5115
diff
changeset
|
448 } |
af59b4dfc9e4
compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5115
diff
changeset
|
449 |
af59b4dfc9e4
compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5115
diff
changeset
|
450 public CompilationTask currentTask() { |
af59b4dfc9e4
compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5115
diff
changeset
|
451 return currentTask; |
af59b4dfc9e4
compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5115
diff
changeset
|
452 } |
7310
79a7b761755c
Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7212
diff
changeset
|
453 |
8217
dce9cefed571
Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7930
diff
changeset
|
454 public SpeculationLog getSpeculationLog() { |
dce9cefed571
Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7930
diff
changeset
|
455 if (speculationLog == null) { |
dce9cefed571
Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7930
diff
changeset
|
456 speculationLog = new SpeculationLog(); |
dce9cefed571
Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7930
diff
changeset
|
457 } |
dce9cefed571
Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7930
diff
changeset
|
458 return speculationLog; |
dce9cefed571
Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7930
diff
changeset
|
459 } |
9013
3b0ec709827c
added macro substitutions for the @PolymorphicSignature methods in MethodHandle
Doug Simon <doug.simon@oracle.com>
parents:
8949
diff
changeset
|
460 |
3b0ec709827c
added macro substitutions for the @PolymorphicSignature methods in MethodHandle
Doug Simon <doug.simon@oracle.com>
parents:
8949
diff
changeset
|
461 public int intrinsicId() { |
9289
261a43921c5e
rename: HotSpotGraalRuntime.getInstance() -> graalRuntime()
Doug Simon <doug.simon@oracle.com>
parents:
9100
diff
changeset
|
462 HotSpotVMConfig config = graalRuntime().getConfig(); |
9013
3b0ec709827c
added macro substitutions for the @PolymorphicSignature methods in MethodHandle
Doug Simon <doug.simon@oracle.com>
parents:
8949
diff
changeset
|
463 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
|
464 } |
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
|
465 |
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
|
466 @Override |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9013
diff
changeset
|
467 public Constant invoke(Constant receiver, Constant[] arguments) { |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9013
diff
changeset
|
468 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
|
469 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
|
470 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
|
471 |
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
|
472 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
|
473 for (int i = 0; i < arguments.length; i++) { |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9013
diff
changeset
|
474 objArguments[i] = arguments[i].asBoxedValue(); |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9013
diff
changeset
|
475 } |
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
|
476 Object objReceiver = receiver != null ? receiver.asObject() : null; |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9013
diff
changeset
|
477 |
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
|
478 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
|
479 Object objResult = javaMethod.invoke(objReceiver, objArguments); |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9013
diff
changeset
|
480 return javaMethod.getReturnType() == void.class ? null : Constant.forBoxed(getSignature().getReturnKind(), objResult); |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9013
diff
changeset
|
481 |
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
|
482 } 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
|
483 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
|
484 } |
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
|
485 } |
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
|
486 |
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
|
487 @Override |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9013
diff
changeset
|
488 public Constant newInstance(Constant[] arguments) { |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9013
diff
changeset
|
489 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
|
490 Constructor javaConstructor = toJavaConstructor(); |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9013
diff
changeset
|
491 javaConstructor.setAccessible(true); |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9013
diff
changeset
|
492 |
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
|
493 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
|
494 for (int i = 0; i < arguments.length; i++) { |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9013
diff
changeset
|
495 objArguments[i] = arguments[i].asBoxedValue(); |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9013
diff
changeset
|
496 } |
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
|
497 |
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
|
498 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
|
499 Object objResult = javaConstructor.newInstance(objArguments); |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9013
diff
changeset
|
500 assert objResult != null; |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9013
diff
changeset
|
501 return Constant.forObject(objResult); |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9013
diff
changeset
|
502 |
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
|
503 } catch (IllegalAccessException | InvocationTargetException | InstantiationException ex) { |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9013
diff
changeset
|
504 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
|
505 } |
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
|
506 } |
10056
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
507 |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
508 public boolean tryToQueueForCompilation() { |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
509 // other threads may update certain bits of the access flags field concurrently. So, the |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
510 // loop ensures that this method only returns false when another thread has set the |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
511 // queuedForCompilation bit. |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
512 do { |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
513 long address = getAccessFlagsAddress(); |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
514 int actualValue = unsafe.getInt(address); |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
515 int expectedValue = actualValue & ~graalRuntime().getConfig().methodQueuedForCompilationBit; |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
516 if (actualValue != expectedValue) { |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
517 return false; |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
518 } else { |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
519 int newValue = expectedValue | graalRuntime().getConfig().methodQueuedForCompilationBit; |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
520 boolean success = unsafe.compareAndSwapInt(null, address, expectedValue, newValue); |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
521 if (success) { |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
522 return true; |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
523 } |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
524 } |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
525 } while (true); |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
526 } |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
527 |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
528 public void clearQueuedForCompilation() { |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
529 long address = getAccessFlagsAddress(); |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
530 boolean success; |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
531 do { |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
532 int actualValue = unsafe.getInt(address); |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
533 int newValue = actualValue & ~graalRuntime().getConfig().methodQueuedForCompilationBit; |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
534 assert isQueuedForCompilation() : "queued for compilation must be set"; |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
535 success = unsafe.compareAndSwapInt(null, address, actualValue, newValue); |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
536 } while (!success); |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
537 } |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
538 |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
539 public boolean isQueuedForCompilation() { |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
540 return (unsafe.getInt(getAccessFlagsAddress()) & graalRuntime().getConfig().methodQueuedForCompilationBit) != 0; |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
541 } |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
542 |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
543 private long getAccessFlagsAddress() { |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
544 return metaspaceMethod + graalRuntime().getConfig().methodAccessFlagsOffset; |
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10000
diff
changeset
|
545 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
546 } |