1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/share/vm/runtime/stackValue.hpp Sat Dec 01 00:00:00 2007 +0000 1.3 @@ -0,0 +1,101 @@ 1.4 +/* 1.5 + * Copyright 1997-2005 Sun Microsystems, Inc. All Rights Reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. 1.11 + * 1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.15 + * version 2 for more details (a copy is included in the LICENSE file that 1.16 + * accompanied this code). 1.17 + * 1.18 + * You should have received a copy of the GNU General Public License version 1.19 + * 2 along with this work; if not, write to the Free Software Foundation, 1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.21 + * 1.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 1.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 1.24 + * have any questions. 1.25 + * 1.26 + */ 1.27 + 1.28 +class StackValue : public ResourceObj { 1.29 + private: 1.30 + BasicType _type; 1.31 + intptr_t _i; // Blank java stack slot value 1.32 + Handle _o; // Java stack slot value interpreted as a Handle 1.33 + public: 1.34 + 1.35 + StackValue(intptr_t value) { 1.36 + _type = T_INT; 1.37 + _i = value; 1.38 + } 1.39 + 1.40 + StackValue(Handle value) { 1.41 + _type = T_OBJECT; 1.42 + _o = value; 1.43 + } 1.44 + 1.45 + StackValue() { 1.46 + _type = T_CONFLICT; 1.47 + _i = 0; 1.48 + } 1.49 + 1.50 + // Only used during deopt- preserve object type. 1.51 + StackValue(intptr_t o, BasicType t) { 1.52 + assert(t == T_OBJECT, "should not be used"); 1.53 + _type = t; 1.54 + _i = o; 1.55 + } 1.56 + 1.57 + Handle get_obj() const { 1.58 + assert(type() == T_OBJECT, "type check"); 1.59 + return _o; 1.60 + } 1.61 + 1.62 + void set_obj(Handle value) { 1.63 + assert(type() == T_OBJECT, "type check"); 1.64 + _o = value; 1.65 + } 1.66 + 1.67 + intptr_t get_int() const { 1.68 + assert(type() == T_INT, "type check"); 1.69 + return _i; 1.70 + } 1.71 + 1.72 + // For special case in deopt. 1.73 + intptr_t get_int(BasicType t) const { 1.74 + assert(t == T_OBJECT && type() == T_OBJECT, "type check"); 1.75 + return _i; 1.76 + } 1.77 + 1.78 + void set_int(intptr_t value) { 1.79 + assert(type() == T_INT, "type check"); 1.80 + _i = value; 1.81 + } 1.82 + 1.83 + BasicType type() const { return _type; } 1.84 + 1.85 + bool equal(StackValue *value) { 1.86 + if (_type != value->_type) return false; 1.87 + if (_type == T_OBJECT) 1.88 + return (_o == value->_o); 1.89 + else { 1.90 + assert(_type == T_INT, "sanity check"); 1.91 + // [phh] compare only low addressed portions of intptr_t slots 1.92 + return (*(int *)&_i == *(int *)&value->_i); 1.93 + } 1.94 + } 1.95 + 1.96 + static StackValue* create_stack_value(const frame* fr, const RegisterMap* reg_map, ScopeValue* sv); 1.97 + static BasicLock* resolve_monitor_lock(const frame* fr, Location location); 1.98 + 1.99 +#ifndef PRODUCT 1.100 + public: 1.101 + // Printing 1.102 + void print_on(outputStream* st) const; 1.103 +#endif 1.104 +};