Mercurial > hg > graal-jvmci-8
annotate jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotStackFrameReference.java @ 23738:1140503536ae jvmci-0.19
Backport style fixes and comments from jdk9.
author | Roland Schatz <roland.schatz@oracle.com> |
---|---|
date | Fri, 12 Aug 2016 11:07:39 +0200 |
parents | 1bbd4a7c274b |
children |
rev | line source |
---|---|
15063
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
1 /* |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
4 * |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
8 * |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
14 * |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
18 * |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
21 * questions. |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
22 */ |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22569
diff
changeset
|
23 package jdk.vm.ci.hotspot; |
15063
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
24 |
22569
ec96f33a101d
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22454
diff
changeset
|
25 import java.util.Arrays; |
15063
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
26 |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22569
diff
changeset
|
27 import jdk.vm.ci.code.stack.InspectedFrame; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22569
diff
changeset
|
28 import jdk.vm.ci.meta.ResolvedJavaMethod; |
21556
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21552
diff
changeset
|
29 |
15063
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
30 public class HotSpotStackFrameReference implements InspectedFrame { |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
31 |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
32 private CompilerToVM compilerToVM; |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
33 |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
34 // information used to find the stack frame |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
35 private long stackPointer; |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
36 private int frameNumber; |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
37 |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
38 // information about the stack frame's contents |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
39 private int bci; |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22054
diff
changeset
|
40 private HotSpotResolvedJavaMethod method; |
15063
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
41 private Object[] locals; |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
42 private boolean[] localIsVirtual; |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
43 |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
44 public long getStackPointer() { |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
45 return stackPointer; |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
46 } |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
47 |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
48 public int getFrameNumber() { |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
49 return frameNumber; |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
50 } |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
51 |
16529
f6ac86d3334e
Change API for stack walking to a visitor: TruffleRuntime#iterateFrames replaces TruffleRuntime#getStackTrace
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15063
diff
changeset
|
52 @Override |
15063
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
53 public Object getLocal(int index) { |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
54 return locals[index]; |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
55 } |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
56 |
16529
f6ac86d3334e
Change API for stack walking to a visitor: TruffleRuntime#iterateFrames replaces TruffleRuntime#getStackTrace
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15063
diff
changeset
|
57 @Override |
15063
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
58 public boolean isVirtual(int index) { |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
59 return localIsVirtual == null ? false : localIsVirtual[index]; |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
60 } |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
61 |
16529
f6ac86d3334e
Change API for stack walking to a visitor: TruffleRuntime#iterateFrames replaces TruffleRuntime#getStackTrace
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15063
diff
changeset
|
62 @Override |
15063
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
63 public void materializeVirtualObjects(boolean invalidateCode) { |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
64 compilerToVM.materializeVirtualObjects(this, invalidateCode); |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
65 } |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
66 |
16529
f6ac86d3334e
Change API for stack walking to a visitor: TruffleRuntime#iterateFrames replaces TruffleRuntime#getStackTrace
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15063
diff
changeset
|
67 @Override |
15063
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
68 public int getBytecodeIndex() { |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
69 return bci; |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
70 } |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
71 |
16529
f6ac86d3334e
Change API for stack walking to a visitor: TruffleRuntime#iterateFrames replaces TruffleRuntime#getStackTrace
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15063
diff
changeset
|
72 @Override |
15063
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
73 public ResolvedJavaMethod getMethod() { |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22054
diff
changeset
|
74 return method; |
15063
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
75 } |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
76 |
16529
f6ac86d3334e
Change API for stack walking to a visitor: TruffleRuntime#iterateFrames replaces TruffleRuntime#getStackTrace
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15063
diff
changeset
|
77 @Override |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22054
diff
changeset
|
78 public boolean isMethod(ResolvedJavaMethod otherMethod) { |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22054
diff
changeset
|
79 return method.equals(otherMethod); |
16529
f6ac86d3334e
Change API for stack walking to a visitor: TruffleRuntime#iterateFrames replaces TruffleRuntime#getStackTrace
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15063
diff
changeset
|
80 } |
f6ac86d3334e
Change API for stack walking to a visitor: TruffleRuntime#iterateFrames replaces TruffleRuntime#getStackTrace
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15063
diff
changeset
|
81 |
f6ac86d3334e
Change API for stack walking to a visitor: TruffleRuntime#iterateFrames replaces TruffleRuntime#getStackTrace
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15063
diff
changeset
|
82 @Override |
15063
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
83 public boolean hasVirtualObjects() { |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
84 return localIsVirtual != null; |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
85 } |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
86 |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
87 @Override |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
88 public String toString() { |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
89 return "HotSpotStackFrameReference [stackPointer=" + stackPointer + ", frameNumber=" + frameNumber + ", bci=" + bci + ", method=" + getMethod() + ", locals=" + Arrays.toString(locals) + |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
90 ", localIsVirtual=" + Arrays.toString(localIsVirtual) + "]"; |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
91 } |
36e1a11a72b3
new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
92 } |