annotate src/share/vm/runtime/stackValue.hpp @ 844:bd02caa94611

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