Mercurial > hg > graal-compiler
annotate agent/src/share/classes/sun/jvm/hotspot/runtime/StackValue.java @ 844:bd02caa94611
6862919: Update copyright year
Summary: Update copyright for files that have been modified in 2009, up to 07/09
Reviewed-by: tbell, ohair
author | xdono |
---|---|
date | Tue, 28 Jul 2009 12:12:40 -0700 |
parents | b109e761e927 |
children | c18cbe5936b8 |
rev | line source |
---|---|
0 | 1 /* |
844 | 2 * Copyright 2000-2009 Sun Microsystems, Inc. All Rights Reserved. |
0 | 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 * | |
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, | |
20 * CA 95054 USA or visit www.sun.com if you need additional information or | |
21 * have any questions. | |
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 | |
818
b109e761e927
6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents:
0
diff
changeset
|
40 public StackValue(OopHandle h, long scalar_replaced) { |
0 | 41 handleValue = h; |
42 type = BasicType.getTObject(); | |
818
b109e761e927
6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents:
0
diff
changeset
|
43 integerValue = scalar_replaced; |
b109e761e927
6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents:
0
diff
changeset
|
44 Assert.that(integerValue == 0 || handleValue == null, "not null object should not be marked as scalar replaced"); |
0 | 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 | |
818
b109e761e927
6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents:
0
diff
changeset
|
64 boolean objIsScalarReplaced() { |
b109e761e927
6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents:
0
diff
changeset
|
65 if (Assert.ASSERTS_ENABLED) { |
b109e761e927
6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents:
0
diff
changeset
|
66 Assert.that(type == BasicType.getTObject(), "type check"); |
b109e761e927
6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents:
0
diff
changeset
|
67 } |
b109e761e927
6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents:
0
diff
changeset
|
68 return integerValue != 0; |
b109e761e927
6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents:
0
diff
changeset
|
69 } |
b109e761e927
6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents:
0
diff
changeset
|
70 |
0 | 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()) { | |
103 return handleValue.hashCode(); | |
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 } |