Mercurial > hg > graal-jvmci-8
annotate jvmci/jdk.vm.ci.code/src/jdk/vm/ci/code/VirtualObject.java @ 24125:0c5404418ec2
Backout getMarkName fix
author | Tom Rodriguez <tom.rodriguez@oracle.com> |
---|---|
date | Tue, 11 Apr 2017 08:59:43 -0700 |
parents | 9e1235406b59 |
children |
rev | line source |
---|---|
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
22478
822922922f3c
Explicitly store slot kinds in DebugInfo.
Roland Schatz <roland.schatz@oracle.com>
parents:
22054
diff
changeset
|
2 * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
4 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
8 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
14 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
18 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
21 * questions. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
22 */ |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22600
diff
changeset
|
23 package jdk.vm.ci.code; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@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:
22536
diff
changeset
|
25 import java.util.Arrays; |
ec96f33a101d
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22536
diff
changeset
|
26 import java.util.Collections; |
ec96f33a101d
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22536
diff
changeset
|
27 import java.util.IdentityHashMap; |
ec96f33a101d
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22536
diff
changeset
|
28 import java.util.Set; |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
29 |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22600
diff
changeset
|
30 import jdk.vm.ci.meta.JavaKind; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22600
diff
changeset
|
31 import jdk.vm.ci.meta.JavaValue; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22600
diff
changeset
|
32 import jdk.vm.ci.meta.ResolvedJavaField; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22600
diff
changeset
|
33 import jdk.vm.ci.meta.ResolvedJavaType; |
22054 | 34 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
35 /** |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
36 * An instance of this class represents an object whose allocation was removed by escape analysis. |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7060
diff
changeset
|
37 * The information stored in the {@link VirtualObject} is used during deoptimization to recreate the |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7060
diff
changeset
|
38 * object. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
39 */ |
22478
822922922f3c
Explicitly store slot kinds in DebugInfo.
Roland Schatz <roland.schatz@oracle.com>
parents:
22054
diff
changeset
|
40 public final class VirtualObject implements JavaValue { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7060
diff
changeset
|
41 |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
42 private final ResolvedJavaType type; |
22478
822922922f3c
Explicitly store slot kinds in DebugInfo.
Roland Schatz <roland.schatz@oracle.com>
parents:
22054
diff
changeset
|
43 private JavaValue[] values; |
22536
dc1aeef79e7e
Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22478
diff
changeset
|
44 private JavaKind[] slotKinds; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
45 private final int id; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
46 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
47 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7060
diff
changeset
|
48 * Creates a new {@link VirtualObject} for the given type, with the given fields. If |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7060
diff
changeset
|
49 * {@code type} is an instance class then {@code values} provides the values for the fields |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7060
diff
changeset
|
50 * returned by {@link ResolvedJavaType#getInstanceFields(boolean) getInstanceFields(true)}. If |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7060
diff
changeset
|
51 * {@code type} is an array then the length of the values array determines the reallocated array |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7060
diff
changeset
|
52 * length. |
16094
c0b8d395368b
Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
14158
diff
changeset
|
53 * |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7060
diff
changeset
|
54 * @param type the type of the object whose allocation was removed during compilation. This can |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7060
diff
changeset
|
55 * be either an instance of an array type. |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7060
diff
changeset
|
56 * @param id a unique id that identifies the object within the debug information for one |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7060
diff
changeset
|
57 * position in the compiled code. |
5774
a1db0ea58b53
Removed left over Ci* prefixed identifiers
Doug Simon <doug.simon@oracle.com>
parents:
5550
diff
changeset
|
58 * @return a new {@link VirtualObject} instance. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
59 */ |
22478
822922922f3c
Explicitly store slot kinds in DebugInfo.
Roland Schatz <roland.schatz@oracle.com>
parents:
22054
diff
changeset
|
60 public static VirtualObject get(ResolvedJavaType type, int id) { |
822922922f3c
Explicitly store slot kinds in DebugInfo.
Roland Schatz <roland.schatz@oracle.com>
parents:
22054
diff
changeset
|
61 return new VirtualObject(type, id); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
62 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
63 |
22478
822922922f3c
Explicitly store slot kinds in DebugInfo.
Roland Schatz <roland.schatz@oracle.com>
parents:
22054
diff
changeset
|
64 private VirtualObject(ResolvedJavaType type, int id) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
65 this.type = type; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
66 this.id = id; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
67 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
68 |
22478
822922922f3c
Explicitly store slot kinds in DebugInfo.
Roland Schatz <roland.schatz@oracle.com>
parents:
22054
diff
changeset
|
69 private static StringBuilder appendValue(StringBuilder buf, JavaValue value, Set<VirtualObject> visited) { |
8289
59bd299750a8
fixed StackOverflowError in VirtualObject.toString()
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
70 if (value instanceof VirtualObject) { |
59bd299750a8
fixed StackOverflowError in VirtualObject.toString()
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
71 VirtualObject vo = (VirtualObject) value; |
16478
1f1ac8857d92
moved toJavaName(JavaType type, boolean qualified) from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
16094
diff
changeset
|
72 buf.append("vobject:").append(vo.type.toJavaName(false)).append(':').append(vo.id); |
8289
59bd299750a8
fixed StackOverflowError in VirtualObject.toString()
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
73 if (!visited.contains(vo)) { |
59bd299750a8
fixed StackOverflowError in VirtualObject.toString()
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
74 visited.add(vo); |
59bd299750a8
fixed StackOverflowError in VirtualObject.toString()
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
75 buf.append('{'); |
59bd299750a8
fixed StackOverflowError in VirtualObject.toString()
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
76 if (vo.values == null) { |
59bd299750a8
fixed StackOverflowError in VirtualObject.toString()
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
77 buf.append("<uninitialized>"); |
59bd299750a8
fixed StackOverflowError in VirtualObject.toString()
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
78 } else { |
59bd299750a8
fixed StackOverflowError in VirtualObject.toString()
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
79 if (vo.type.isArray()) { |
59bd299750a8
fixed StackOverflowError in VirtualObject.toString()
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
80 for (int i = 0; i < vo.values.length; i++) { |
59bd299750a8
fixed StackOverflowError in VirtualObject.toString()
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
81 if (i != 0) { |
59bd299750a8
fixed StackOverflowError in VirtualObject.toString()
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
82 buf.append(','); |
59bd299750a8
fixed StackOverflowError in VirtualObject.toString()
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
83 } |
59bd299750a8
fixed StackOverflowError in VirtualObject.toString()
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
84 buf.append(i).append('='); |
59bd299750a8
fixed StackOverflowError in VirtualObject.toString()
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
85 appendValue(buf, vo.values[i], visited); |
59bd299750a8
fixed StackOverflowError in VirtualObject.toString()
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
86 } |
59bd299750a8
fixed StackOverflowError in VirtualObject.toString()
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
87 } else { |
59bd299750a8
fixed StackOverflowError in VirtualObject.toString()
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
88 ResolvedJavaField[] fields = vo.type.getInstanceFields(true); |
14157 | 89 assert fields.length == vo.values.length : vo.type + ", fields=" + Arrays.toString(fields) + ", values=" + Arrays.toString(vo.values); |
8289
59bd299750a8
fixed StackOverflowError in VirtualObject.toString()
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
90 for (int i = 0; i < vo.values.length; i++) { |
59bd299750a8
fixed StackOverflowError in VirtualObject.toString()
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
91 if (i != 0) { |
59bd299750a8
fixed StackOverflowError in VirtualObject.toString()
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
92 buf.append(','); |
59bd299750a8
fixed StackOverflowError in VirtualObject.toString()
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
93 } |
59bd299750a8
fixed StackOverflowError in VirtualObject.toString()
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
94 buf.append(fields[i].getName()).append('='); |
59bd299750a8
fixed StackOverflowError in VirtualObject.toString()
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
95 appendValue(buf, vo.values[i], visited); |
59bd299750a8
fixed StackOverflowError in VirtualObject.toString()
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
96 } |
59bd299750a8
fixed StackOverflowError in VirtualObject.toString()
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
97 } |
59bd299750a8
fixed StackOverflowError in VirtualObject.toString()
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
98 } |
59bd299750a8
fixed StackOverflowError in VirtualObject.toString()
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
99 buf.append('}'); |
59bd299750a8
fixed StackOverflowError in VirtualObject.toString()
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
100 } |
59bd299750a8
fixed StackOverflowError in VirtualObject.toString()
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
101 } else { |
59bd299750a8
fixed StackOverflowError in VirtualObject.toString()
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
102 buf.append(value); |
59bd299750a8
fixed StackOverflowError in VirtualObject.toString()
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
103 } |
59bd299750a8
fixed StackOverflowError in VirtualObject.toString()
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
104 return buf; |
59bd299750a8
fixed StackOverflowError in VirtualObject.toString()
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
105 } |
59bd299750a8
fixed StackOverflowError in VirtualObject.toString()
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
106 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
107 @Override |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4142
diff
changeset
|
108 public String toString() { |
8289
59bd299750a8
fixed StackOverflowError in VirtualObject.toString()
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
109 Set<VirtualObject> visited = Collections.newSetFromMap(new IdentityHashMap<VirtualObject, Boolean>()); |
59bd299750a8
fixed StackOverflowError in VirtualObject.toString()
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
110 return appendValue(new StringBuilder(), this, visited).toString(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
111 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
112 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
113 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7060
diff
changeset
|
114 * Returns the type of the object whose allocation was removed during compilation. This can be |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7060
diff
changeset
|
115 * either an instance of an array type. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
116 */ |
6959
9c71ad0a0652
extra assertion checking when initializing the values of a VirtualObject
Doug Simon <doug.simon@oracle.com>
parents:
6950
diff
changeset
|
117 public ResolvedJavaType getType() { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
118 return type; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
119 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
120 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
121 /** |
23700
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
122 * Returns the array containing all the values to be stored into the object when it is |
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
123 * recreated. This field is intentional exposed as a mutable array that a compiler may modify |
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
124 * (e.g. during register allocation). |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
125 */ |
23700
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
126 @SuppressFBWarnings(value = "EI_EXPOSE_REP", justification = "`values` is intentional mutable")// |
22478
822922922f3c
Explicitly store slot kinds in DebugInfo.
Roland Schatz <roland.schatz@oracle.com>
parents:
22054
diff
changeset
|
127 public JavaValue[] getValues() { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
128 return values; |
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 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
131 /** |
23700
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
132 * Returns the kind of the value at {@code index}. |
22478
822922922f3c
Explicitly store slot kinds in DebugInfo.
Roland Schatz <roland.schatz@oracle.com>
parents:
22054
diff
changeset
|
133 */ |
23700
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
134 public JavaKind getSlotKind(int index) { |
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
135 return slotKinds[index]; |
22478
822922922f3c
Explicitly store slot kinds in DebugInfo.
Roland Schatz <roland.schatz@oracle.com>
parents:
22054
diff
changeset
|
136 } |
822922922f3c
Explicitly store slot kinds in DebugInfo.
Roland Schatz <roland.schatz@oracle.com>
parents:
22054
diff
changeset
|
137 |
822922922f3c
Explicitly store slot kinds in DebugInfo.
Roland Schatz <roland.schatz@oracle.com>
parents:
22054
diff
changeset
|
138 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7060
diff
changeset
|
139 * Returns the unique id that identifies the object within the debug information for one |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7060
diff
changeset
|
140 * position in the compiled code. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
141 */ |
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:
6329
diff
changeset
|
142 public int getId() { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
143 return id; |
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 |
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 * Overwrites the current set of values with a new one. |
16094
c0b8d395368b
Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
14158
diff
changeset
|
148 * |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7060
diff
changeset
|
149 * @param values an array containing all the values to be stored into the object when it is |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7060
diff
changeset
|
150 * recreated. |
23700
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
151 * @param slotKinds an array containing the Java kinds of the values. This must have the same |
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
152 * length as {@code values}. This array is now owned by this object and must not be |
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
153 * mutated by the caller. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
154 */ |
23700
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
155 @SuppressFBWarnings(value = "EI_EXPOSE_REP2", justification = "caller transfers ownership of `slotKinds`") |
22536
dc1aeef79e7e
Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22478
diff
changeset
|
156 public void setValues(JavaValue[] values, JavaKind[] slotKinds) { |
23700
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
157 assert values.length == slotKinds.length; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
158 this.values = values; |
22478
822922922f3c
Explicitly store slot kinds in DebugInfo.
Roland Schatz <roland.schatz@oracle.com>
parents:
22054
diff
changeset
|
159 this.slotKinds = slotKinds; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
160 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
161 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
162 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
163 public int hashCode() { |
22478
822922922f3c
Explicitly store slot kinds in DebugInfo.
Roland Schatz <roland.schatz@oracle.com>
parents:
22054
diff
changeset
|
164 return 42 + type.hashCode(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
165 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
166 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
167 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
168 public boolean equals(Object o) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
169 if (o == this) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
170 return true; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
171 } |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5541
diff
changeset
|
172 if (o instanceof VirtualObject) { |
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5541
diff
changeset
|
173 VirtualObject l = (VirtualObject) o; |
14158
fd7fcd2d2072
replaced == with .equals() for comparisons between JavaMethod/JavaField/JavaType values
Doug Simon <doug.simon@oracle.com>
parents:
14157
diff
changeset
|
174 if (!l.type.equals(type) || l.values.length != values.length) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
175 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
176 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
177 for (int i = 0; i < values.length; i++) { |
16530
6694631668a6
Avoid infinite recursion of deep equals checks, but also satisfy the automatic checking that does not allow == on values
Christian Wimmer <christian.wimmer@oracle.com>
parents:
16478
diff
changeset
|
178 /* |
6694631668a6
Avoid infinite recursion of deep equals checks, but also satisfy the automatic checking that does not allow == on values
Christian Wimmer <christian.wimmer@oracle.com>
parents:
16478
diff
changeset
|
179 * Virtual objects can form cycles. Calling equals() could therefore lead to |
6694631668a6
Avoid infinite recursion of deep equals checks, but also satisfy the automatic checking that does not allow == on values
Christian Wimmer <christian.wimmer@oracle.com>
parents:
16478
diff
changeset
|
180 * infinite recursion. |
6694631668a6
Avoid infinite recursion of deep equals checks, but also satisfy the automatic checking that does not allow == on values
Christian Wimmer <christian.wimmer@oracle.com>
parents:
16478
diff
changeset
|
181 */ |
6694631668a6
Avoid infinite recursion of deep equals checks, but also satisfy the automatic checking that does not allow == on values
Christian Wimmer <christian.wimmer@oracle.com>
parents:
16478
diff
changeset
|
182 if (!same(values[i], l.values[i])) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
183 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
184 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
185 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
186 return true; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
187 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
188 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
189 } |
16530
6694631668a6
Avoid infinite recursion of deep equals checks, but also satisfy the automatic checking that does not allow == on values
Christian Wimmer <christian.wimmer@oracle.com>
parents:
16478
diff
changeset
|
190 |
6694631668a6
Avoid infinite recursion of deep equals checks, but also satisfy the automatic checking that does not allow == on values
Christian Wimmer <christian.wimmer@oracle.com>
parents:
16478
diff
changeset
|
191 private static boolean same(Object o1, Object o2) { |
6694631668a6
Avoid infinite recursion of deep equals checks, but also satisfy the automatic checking that does not allow == on values
Christian Wimmer <christian.wimmer@oracle.com>
parents:
16478
diff
changeset
|
192 return o1 == o2; |
6694631668a6
Avoid infinite recursion of deep equals checks, but also satisfy the automatic checking that does not allow == on values
Christian Wimmer <christian.wimmer@oracle.com>
parents:
16478
diff
changeset
|
193 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
194 } |