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