2007-12-01 00:00:00 +00:00
|
|
|
/*
|
2017-11-09 12:12:32 +05:30
|
|
|
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
2007-12-01 00:00:00 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
|
|
*
|
|
|
|
* This code is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License version 2 only, as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* version 2 for more details (a copy is included in the LICENSE file that
|
|
|
|
* accompanied this code).
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License version
|
|
|
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
|
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*
|
2010-05-27 19:08:38 -07:00
|
|
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
|
|
* or visit www.oracle.com if you need additional information or have any
|
|
|
|
* questions.
|
2007-12-01 00:00:00 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2010-11-23 13:22:55 -08:00
|
|
|
#ifndef SHARE_VM_RUNTIME_STACKVALUE_HPP
|
|
|
|
#define SHARE_VM_RUNTIME_STACKVALUE_HPP
|
|
|
|
|
|
|
|
#include "code/location.hpp"
|
|
|
|
#include "runtime/handles.hpp"
|
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
class StackValue : public ResourceObj {
|
|
|
|
private:
|
|
|
|
BasicType _type;
|
2017-11-09 12:12:32 +05:30
|
|
|
intptr_t _integer_value; // Blank java stack slot value
|
|
|
|
Handle _handle_value; // Java stack slot value interpreted as a Handle
|
2007-12-01 00:00:00 +00:00
|
|
|
public:
|
|
|
|
|
|
|
|
StackValue(intptr_t value) {
|
2017-11-09 12:12:32 +05:30
|
|
|
_type = T_INT;
|
|
|
|
_integer_value = value;
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
2009-06-09 16:19:10 -07:00
|
|
|
StackValue(Handle value, intptr_t scalar_replaced = 0) {
|
2017-11-09 12:12:32 +05:30
|
|
|
_type = T_OBJECT;
|
|
|
|
_integer_value = scalar_replaced;
|
|
|
|
_handle_value = value;
|
|
|
|
assert(_integer_value == 0 || _handle_value.is_null(), "not null object should not be marked as scalar replaced");
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
StackValue() {
|
2017-11-09 12:12:32 +05:30
|
|
|
_type = T_CONFLICT;
|
|
|
|
_integer_value = 0;
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Only used during deopt- preserve object type.
|
|
|
|
StackValue(intptr_t o, BasicType t) {
|
|
|
|
assert(t == T_OBJECT, "should not be used");
|
2017-11-09 12:12:32 +05:30
|
|
|
_type = t;
|
|
|
|
_integer_value = o;
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Handle get_obj() const {
|
|
|
|
assert(type() == T_OBJECT, "type check");
|
2017-11-09 12:12:32 +05:30
|
|
|
return _handle_value;
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
2009-06-09 16:19:10 -07:00
|
|
|
bool obj_is_scalar_replaced() const {
|
|
|
|
assert(type() == T_OBJECT, "type check");
|
2017-11-09 12:12:32 +05:30
|
|
|
return _integer_value != 0;
|
2009-06-09 16:19:10 -07:00
|
|
|
}
|
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
void set_obj(Handle value) {
|
|
|
|
assert(type() == T_OBJECT, "type check");
|
2017-11-09 12:12:32 +05:30
|
|
|
_handle_value = value;
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
intptr_t get_int() const {
|
|
|
|
assert(type() == T_INT, "type check");
|
2017-11-09 12:12:32 +05:30
|
|
|
return _integer_value;
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// For special case in deopt.
|
|
|
|
intptr_t get_int(BasicType t) const {
|
|
|
|
assert(t == T_OBJECT && type() == T_OBJECT, "type check");
|
2017-11-09 12:12:32 +05:30
|
|
|
return _integer_value;
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void set_int(intptr_t value) {
|
|
|
|
assert(type() == T_INT, "type check");
|
2017-11-09 12:12:32 +05:30
|
|
|
_integer_value = value;
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
BasicType type() const { return _type; }
|
|
|
|
|
|
|
|
bool equal(StackValue *value) {
|
|
|
|
if (_type != value->_type) return false;
|
|
|
|
if (_type == T_OBJECT)
|
2017-11-09 12:12:32 +05:30
|
|
|
return (_handle_value == value->_handle_value);
|
2007-12-01 00:00:00 +00:00
|
|
|
else {
|
|
|
|
assert(_type == T_INT, "sanity check");
|
|
|
|
// [phh] compare only low addressed portions of intptr_t slots
|
2017-11-09 12:12:32 +05:30
|
|
|
return (*(int *)&_integer_value == *(int *)&value->_integer_value);
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static StackValue* create_stack_value(const frame* fr, const RegisterMap* reg_map, ScopeValue* sv);
|
|
|
|
static BasicLock* resolve_monitor_lock(const frame* fr, Location location);
|
|
|
|
|
|
|
|
#ifndef PRODUCT
|
|
|
|
public:
|
|
|
|
// Printing
|
|
|
|
void print_on(outputStream* st) const;
|
|
|
|
#endif
|
|
|
|
};
|
2010-11-23 13:22:55 -08:00
|
|
|
|
|
|
|
#endif // SHARE_VM_RUNTIME_STACKVALUE_HPP
|