stackValue.hpp revision 0
0N/A/*
0N/A * Copyright 1997-2005 Sun Microsystems, Inc. All Rights Reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
0N/A * published by the Free Software Foundation.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
0N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
0N/A * CA 95054 USA or visit www.sun.com if you need additional information or
0N/A * have any questions.
0N/A *
0N/A */
0N/A
0N/Aclass StackValue : public ResourceObj {
0N/A private:
0N/A BasicType _type;
0N/A intptr_t _i; // Blank java stack slot value
0N/A Handle _o; // Java stack slot value interpreted as a Handle
0N/A public:
0N/A
0N/A StackValue(intptr_t value) {
0N/A _type = T_INT;
0N/A _i = value;
0N/A }
0N/A
0N/A StackValue(Handle value) {
0N/A _type = T_OBJECT;
0N/A _o = value;
0N/A }
0N/A
0N/A StackValue() {
0N/A _type = T_CONFLICT;
0N/A _i = 0;
0N/A }
0N/A
0N/A // Only used during deopt- preserve object type.
0N/A StackValue(intptr_t o, BasicType t) {
0N/A assert(t == T_OBJECT, "should not be used");
0N/A _type = t;
0N/A _i = o;
0N/A }
0N/A
0N/A Handle get_obj() const {
0N/A assert(type() == T_OBJECT, "type check");
0N/A return _o;
0N/A }
0N/A
0N/A void set_obj(Handle value) {
0N/A assert(type() == T_OBJECT, "type check");
0N/A _o = value;
0N/A }
0N/A
0N/A intptr_t get_int() const {
0N/A assert(type() == T_INT, "type check");
0N/A return _i;
0N/A }
0N/A
0N/A // For special case in deopt.
0N/A intptr_t get_int(BasicType t) const {
0N/A assert(t == T_OBJECT && type() == T_OBJECT, "type check");
0N/A return _i;
0N/A }
0N/A
0N/A void set_int(intptr_t value) {
0N/A assert(type() == T_INT, "type check");
0N/A _i = value;
0N/A }
0N/A
0N/A BasicType type() const { return _type; }
0N/A
0N/A bool equal(StackValue *value) {
0N/A if (_type != value->_type) return false;
0N/A if (_type == T_OBJECT)
0N/A return (_o == value->_o);
0N/A else {
0N/A assert(_type == T_INT, "sanity check");
0N/A // [phh] compare only low addressed portions of intptr_t slots
0N/A return (*(int *)&_i == *(int *)&value->_i);
0N/A }
0N/A }
0N/A
0N/A static StackValue* create_stack_value(const frame* fr, const RegisterMap* reg_map, ScopeValue* sv);
0N/A static BasicLock* resolve_monitor_lock(const frame* fr, Location location);
0N/A
0N/A#ifndef PRODUCT
0N/A public:
0N/A // Printing
0N/A void print_on(outputStream* st) const;
0N/A#endif
0N/A};