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