author | phh |
Wed, 28 Oct 2009 16:25:51 -0400 | |
changeset 4434 | 4b41e5b42f81 |
parent 3261 | c7d5aae8d3f7 |
child 5547 | f4b087cbb361 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
3261 | 2 |
* Copyright 1997-2009 Sun Microsystems, Inc. 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 |
* |
|
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 |
class StackValue : public ResourceObj { |
|
26 |
private: |
|
27 |
BasicType _type; |
|
28 |
intptr_t _i; // Blank java stack slot value |
|
29 |
Handle _o; // Java stack slot value interpreted as a Handle |
|
30 |
public: |
|
31 |
||
32 |
StackValue(intptr_t value) { |
|
33 |
_type = T_INT; |
|
34 |
_i = value; |
|
35 |
} |
|
36 |
||
3171
aa289b22b577
6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents:
1
diff
changeset
|
37 |
StackValue(Handle value, intptr_t scalar_replaced = 0) { |
1 | 38 |
_type = T_OBJECT; |
3171
aa289b22b577
6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents:
1
diff
changeset
|
39 |
_i = scalar_replaced; |
1 | 40 |
_o = value; |
3171
aa289b22b577
6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents:
1
diff
changeset
|
41 |
assert(_i == 0 || _o.is_null(), "not null object should not be marked as scalar replaced"); |
1 | 42 |
} |
43 |
||
44 |
StackValue() { |
|
45 |
_type = T_CONFLICT; |
|
46 |
_i = 0; |
|
47 |
} |
|
48 |
||
49 |
// Only used during deopt- preserve object type. |
|
50 |
StackValue(intptr_t o, BasicType t) { |
|
51 |
assert(t == T_OBJECT, "should not be used"); |
|
52 |
_type = t; |
|
53 |
_i = o; |
|
54 |
} |
|
55 |
||
56 |
Handle get_obj() const { |
|
57 |
assert(type() == T_OBJECT, "type check"); |
|
58 |
return _o; |
|
59 |
} |
|
60 |
||
3171
aa289b22b577
6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents:
1
diff
changeset
|
61 |
bool obj_is_scalar_replaced() const { |
aa289b22b577
6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents:
1
diff
changeset
|
62 |
assert(type() == T_OBJECT, "type check"); |
aa289b22b577
6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents:
1
diff
changeset
|
63 |
return _i != 0; |
aa289b22b577
6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents:
1
diff
changeset
|
64 |
} |
aa289b22b577
6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents:
1
diff
changeset
|
65 |
|
1 | 66 |
void set_obj(Handle value) { |
67 |
assert(type() == T_OBJECT, "type check"); |
|
68 |
_o = value; |
|
69 |
} |
|
70 |
||
71 |
intptr_t get_int() const { |
|
72 |
assert(type() == T_INT, "type check"); |
|
73 |
return _i; |
|
74 |
} |
|
75 |
||
76 |
// For special case in deopt. |
|
77 |
intptr_t get_int(BasicType t) const { |
|
78 |
assert(t == T_OBJECT && type() == T_OBJECT, "type check"); |
|
79 |
return _i; |
|
80 |
} |
|
81 |
||
82 |
void set_int(intptr_t value) { |
|
83 |
assert(type() == T_INT, "type check"); |
|
84 |
_i = value; |
|
85 |
} |
|
86 |
||
87 |
BasicType type() const { return _type; } |
|
88 |
||
89 |
bool equal(StackValue *value) { |
|
90 |
if (_type != value->_type) return false; |
|
91 |
if (_type == T_OBJECT) |
|
92 |
return (_o == value->_o); |
|
93 |
else { |
|
94 |
assert(_type == T_INT, "sanity check"); |
|
95 |
// [phh] compare only low addressed portions of intptr_t slots |
|
96 |
return (*(int *)&_i == *(int *)&value->_i); |
|
97 |
} |
|
98 |
} |
|
99 |
||
100 |
static StackValue* create_stack_value(const frame* fr, const RegisterMap* reg_map, ScopeValue* sv); |
|
101 |
static BasicLock* resolve_monitor_lock(const frame* fr, Location location); |
|
102 |
||
103 |
#ifndef PRODUCT |
|
104 |
public: |
|
105 |
// Printing |
|
106 |
void print_on(outputStream* st) const; |
|
107 |
#endif |
|
108 |
}; |