src/share/vm/runtime/stackValue.hpp

Wed, 09 Apr 2008 15:10:22 -0700

author
rasbold
date
Wed, 09 Apr 2008 15:10:22 -0700
changeset 544
9f4457a14b58
parent 435
a61af66fc99e
child 1253
b109e761e927
permissions
-rw-r--r--

Merge

duke@435 1 /*
duke@435 2 * Copyright 1997-2005 Sun Microsystems, Inc. All Rights Reserved.
duke@435 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 *
duke@435 5 * This code is free software; you can redistribute it and/or modify it
duke@435 6 * under the terms of the GNU General Public License version 2 only, as
duke@435 7 * published by the Free Software Foundation.
duke@435 8 *
duke@435 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 * accompanied this code).
duke@435 14 *
duke@435 15 * You should have received a copy of the GNU General Public License version
duke@435 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 18 *
duke@435 19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
duke@435 20 * CA 95054 USA or visit www.sun.com if you need additional information or
duke@435 21 * have any questions.
duke@435 22 *
duke@435 23 */
duke@435 24
duke@435 25 class StackValue : public ResourceObj {
duke@435 26 private:
duke@435 27 BasicType _type;
duke@435 28 intptr_t _i; // Blank java stack slot value
duke@435 29 Handle _o; // Java stack slot value interpreted as a Handle
duke@435 30 public:
duke@435 31
duke@435 32 StackValue(intptr_t value) {
duke@435 33 _type = T_INT;
duke@435 34 _i = value;
duke@435 35 }
duke@435 36
duke@435 37 StackValue(Handle value) {
duke@435 38 _type = T_OBJECT;
duke@435 39 _o = value;
duke@435 40 }
duke@435 41
duke@435 42 StackValue() {
duke@435 43 _type = T_CONFLICT;
duke@435 44 _i = 0;
duke@435 45 }
duke@435 46
duke@435 47 // Only used during deopt- preserve object type.
duke@435 48 StackValue(intptr_t o, BasicType t) {
duke@435 49 assert(t == T_OBJECT, "should not be used");
duke@435 50 _type = t;
duke@435 51 _i = o;
duke@435 52 }
duke@435 53
duke@435 54 Handle get_obj() const {
duke@435 55 assert(type() == T_OBJECT, "type check");
duke@435 56 return _o;
duke@435 57 }
duke@435 58
duke@435 59 void set_obj(Handle value) {
duke@435 60 assert(type() == T_OBJECT, "type check");
duke@435 61 _o = value;
duke@435 62 }
duke@435 63
duke@435 64 intptr_t get_int() const {
duke@435 65 assert(type() == T_INT, "type check");
duke@435 66 return _i;
duke@435 67 }
duke@435 68
duke@435 69 // For special case in deopt.
duke@435 70 intptr_t get_int(BasicType t) const {
duke@435 71 assert(t == T_OBJECT && type() == T_OBJECT, "type check");
duke@435 72 return _i;
duke@435 73 }
duke@435 74
duke@435 75 void set_int(intptr_t value) {
duke@435 76 assert(type() == T_INT, "type check");
duke@435 77 _i = value;
duke@435 78 }
duke@435 79
duke@435 80 BasicType type() const { return _type; }
duke@435 81
duke@435 82 bool equal(StackValue *value) {
duke@435 83 if (_type != value->_type) return false;
duke@435 84 if (_type == T_OBJECT)
duke@435 85 return (_o == value->_o);
duke@435 86 else {
duke@435 87 assert(_type == T_INT, "sanity check");
duke@435 88 // [phh] compare only low addressed portions of intptr_t slots
duke@435 89 return (*(int *)&_i == *(int *)&value->_i);
duke@435 90 }
duke@435 91 }
duke@435 92
duke@435 93 static StackValue* create_stack_value(const frame* fr, const RegisterMap* reg_map, ScopeValue* sv);
duke@435 94 static BasicLock* resolve_monitor_lock(const frame* fr, Location location);
duke@435 95
duke@435 96 #ifndef PRODUCT
duke@435 97 public:
duke@435 98 // Printing
duke@435 99 void print_on(outputStream* st) const;
duke@435 100 #endif
duke@435 101 };

mercurial