1 /*
2 * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * 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
37 StackValue(Handle value, intptr_t scalar_replaced = 0) {
38 _type = T_OBJECT;
39 _i = scalar_replaced;
40 _o = value;
41 assert(_i == 0 || _o.is_null(), "not null object should not be marked as scalar replaced");
42 }
43
44 StackValue() {
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 };
|
1 /*
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
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
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
44 StackValue(Handle value, intptr_t scalar_replaced = 0) {
45 _type = T_OBJECT;
46 _i = scalar_replaced;
47 _o = value;
48 assert(_i == 0 || _o.is_null(), "not null object should not be marked as scalar replaced");
49 }
50
51 StackValue() {
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 };
116
117 #endif // SHARE_VM_RUNTIME_STACKVALUE_HPP
|