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