src/share/vm/runtime/stackValue.hpp

Thu, 27 May 2010 19:08:38 -0700

author
trims
date
Thu, 27 May 2010 19:08:38 -0700
changeset 1907
c18cbe5936b8
parent 1279
bd02caa94611
child 2314
f95d63e2154a
permissions
-rw-r--r--

6941466: Oracle rebranding changes for Hotspot repositories
Summary: Change all the Sun copyrights to Oracle copyright
Reviewed-by: ohair

duke@435 1 /*
trims@1907 2 * Copyright (c) 1997, 2009, Oracle and/or its affiliates. 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 *
trims@1907 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 * or visit www.oracle.com if you need additional information or have any
trims@1907 21 * 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
kvn@1253 37 StackValue(Handle value, intptr_t scalar_replaced = 0) {
duke@435 38 _type = T_OBJECT;
kvn@1253 39 _i = scalar_replaced;
duke@435 40 _o = value;
kvn@1253 41 assert(_i == 0 || _o.is_null(), "not null object should not be marked as scalar replaced");
duke@435 42 }
duke@435 43
duke@435 44 StackValue() {
duke@435 45 _type = T_CONFLICT;
duke@435 46 _i = 0;
duke@435 47 }
duke@435 48
duke@435 49 // Only used during deopt- preserve object type.
duke@435 50 StackValue(intptr_t o, BasicType t) {
duke@435 51 assert(t == T_OBJECT, "should not be used");
duke@435 52 _type = t;
duke@435 53 _i = o;
duke@435 54 }
duke@435 55
duke@435 56 Handle get_obj() const {
duke@435 57 assert(type() == T_OBJECT, "type check");
duke@435 58 return _o;
duke@435 59 }
duke@435 60
kvn@1253 61 bool obj_is_scalar_replaced() const {
kvn@1253 62 assert(type() == T_OBJECT, "type check");
kvn@1253 63 return _i != 0;
kvn@1253 64 }
kvn@1253 65
duke@435 66 void set_obj(Handle value) {
duke@435 67 assert(type() == T_OBJECT, "type check");
duke@435 68 _o = value;
duke@435 69 }
duke@435 70
duke@435 71 intptr_t get_int() const {
duke@435 72 assert(type() == T_INT, "type check");
duke@435 73 return _i;
duke@435 74 }
duke@435 75
duke@435 76 // For special case in deopt.
duke@435 77 intptr_t get_int(BasicType t) const {
duke@435 78 assert(t == T_OBJECT && type() == T_OBJECT, "type check");
duke@435 79 return _i;
duke@435 80 }
duke@435 81
duke@435 82 void set_int(intptr_t value) {
duke@435 83 assert(type() == T_INT, "type check");
duke@435 84 _i = value;
duke@435 85 }
duke@435 86
duke@435 87 BasicType type() const { return _type; }
duke@435 88
duke@435 89 bool equal(StackValue *value) {
duke@435 90 if (_type != value->_type) return false;
duke@435 91 if (_type == T_OBJECT)
duke@435 92 return (_o == value->_o);
duke@435 93 else {
duke@435 94 assert(_type == T_INT, "sanity check");
duke@435 95 // [phh] compare only low addressed portions of intptr_t slots
duke@435 96 return (*(int *)&_i == *(int *)&value->_i);
duke@435 97 }
duke@435 98 }
duke@435 99
duke@435 100 static StackValue* create_stack_value(const frame* fr, const RegisterMap* reg_map, ScopeValue* sv);
duke@435 101 static BasicLock* resolve_monitor_lock(const frame* fr, Location location);
duke@435 102
duke@435 103 #ifndef PRODUCT
duke@435 104 public:
duke@435 105 // Printing
duke@435 106 void print_on(outputStream* st) const;
duke@435 107 #endif
duke@435 108 };

mercurial