author | never |
Mon, 05 Sep 2011 17:09:05 -0700 | |
changeset 10517 | f92c9ff3a15f |
parent 5547 | f4b087cbb361 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
3261
diff
changeset
|
2 |
* Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved. |
1 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
3261
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
3261
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
3261
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
25 |
package sun.jvm.hotspot.runtime; |
|
26 |
||
27 |
import java.io.*; |
|
28 |
import sun.jvm.hotspot.debugger.*; |
|
29 |
import sun.jvm.hotspot.utilities.*; |
|
30 |
||
31 |
public class StackValue { |
|
32 |
private int type; |
|
33 |
private OopHandle handleValue; |
|
34 |
private long integerValue; |
|
35 |
||
36 |
public StackValue() { |
|
37 |
type = BasicType.getTConflict(); |
|
38 |
} |
|
39 |
||
3171
aa289b22b577
6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents:
1
diff
changeset
|
40 |
public StackValue(OopHandle h, long scalar_replaced) { |
1 | 41 |
handleValue = h; |
42 |
type = BasicType.getTObject(); |
|
3171
aa289b22b577
6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents:
1
diff
changeset
|
43 |
integerValue = scalar_replaced; |
aa289b22b577
6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents:
1
diff
changeset
|
44 |
Assert.that(integerValue == 0 || handleValue == null, "not null object should not be marked as scalar replaced"); |
1 | 45 |
} |
46 |
||
47 |
public StackValue(long i) { |
|
48 |
integerValue = i; |
|
49 |
type = BasicType.getTInt(); |
|
50 |
} |
|
51 |
||
52 |
/** This returns one of the "enum" values in BasicType.java */ |
|
53 |
public int getType() { |
|
54 |
return type; |
|
55 |
} |
|
56 |
||
57 |
public OopHandle getObject() { |
|
58 |
if (Assert.ASSERTS_ENABLED) { |
|
59 |
Assert.that(type == BasicType.getTObject(), "type check"); |
|
60 |
} |
|
61 |
return handleValue; |
|
62 |
} |
|
63 |
||
3171
aa289b22b577
6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents:
1
diff
changeset
|
64 |
boolean objIsScalarReplaced() { |
aa289b22b577
6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents:
1
diff
changeset
|
65 |
if (Assert.ASSERTS_ENABLED) { |
aa289b22b577
6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents:
1
diff
changeset
|
66 |
Assert.that(type == BasicType.getTObject(), "type check"); |
aa289b22b577
6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents:
1
diff
changeset
|
67 |
} |
aa289b22b577
6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents:
1
diff
changeset
|
68 |
return integerValue != 0; |
aa289b22b577
6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents:
1
diff
changeset
|
69 |
} |
aa289b22b577
6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents:
1
diff
changeset
|
70 |
|
1 | 71 |
public long getInteger() { |
72 |
if (Assert.ASSERTS_ENABLED) { |
|
73 |
Assert.that(type == BasicType.getTInt(), "type check"); |
|
74 |
} |
|
75 |
return integerValue; |
|
76 |
} |
|
77 |
||
78 |
public boolean equals(Object arg) { |
|
79 |
if (arg == null) { |
|
80 |
return false; |
|
81 |
} |
|
82 |
||
83 |
if (!arg.getClass().equals(getClass())) { |
|
84 |
return false; |
|
85 |
} |
|
86 |
||
87 |
StackValue sv = (StackValue) arg; |
|
88 |
if (type != sv.type) { |
|
89 |
return false; |
|
90 |
} |
|
91 |
if (type == BasicType.getTObject()) { |
|
92 |
return handleValue.equals(sv.handleValue); |
|
93 |
} else if (type == BasicType.getTInt()) { |
|
94 |
return (integerValue == sv.integerValue); |
|
95 |
} else { |
|
96 |
// Conflict type (not yet used) |
|
97 |
return true; |
|
98 |
} |
|
99 |
} |
|
100 |
||
101 |
public int hashCode() { |
|
102 |
if (type == BasicType.getTObject()) { |
|
10517
f92c9ff3a15f
7051798: SA-JDI: NPE in Frame.addressOfStackSlot(Frame.java:244)
never
parents:
5547
diff
changeset
|
103 |
return handleValue != null ? handleValue.hashCode() : 5; |
1 | 104 |
} else { |
105 |
// Returns 0 for conflict type |
|
106 |
return (int) integerValue; |
|
107 |
} |
|
108 |
} |
|
109 |
||
110 |
public void print() { |
|
111 |
printOn(System.out); |
|
112 |
} |
|
113 |
||
114 |
public void printOn(PrintStream tty) { |
|
115 |
if (type == BasicType.getTInt()) { |
|
116 |
tty.print(integerValue + " (long) " + (int) integerValue + " (int)"); |
|
117 |
} else if (type == BasicType.getTObject()) { |
|
118 |
tty.print("<" + handleValue + ">"); |
|
119 |
} else if (type == BasicType.getTConflict()) { |
|
120 |
tty.print("conflict"); |
|
121 |
} else { |
|
122 |
throw new RuntimeException("should not reach here"); |
|
123 |
} |
|
124 |
} |
|
125 |
} |