annotate src/share/vm/runtime/vframe_hp.cpp @ 1937:4853c5cad3aa

More deoptmization tracing.
author Thomas Wuerthinger <wuerthinger@ssw.jku.at>
date Thu, 23 Dec 2010 22:14:31 +0100
parents c18cbe5936b8
children 06f017f7daa7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 903
diff changeset
2 * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 903
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 903
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 903
diff changeset
21 * questions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
a61af66fc99e Initial load
duke
parents:
diff changeset
25 # include "incls/_precompiled.incl"
a61af66fc99e Initial load
duke
parents:
diff changeset
26 # include "incls/_vframe_hp.cpp.incl"
a61af66fc99e Initial load
duke
parents:
diff changeset
27
a61af66fc99e Initial load
duke
parents:
diff changeset
28
a61af66fc99e Initial load
duke
parents:
diff changeset
29 // ------------- compiledVFrame --------------
a61af66fc99e Initial load
duke
parents:
diff changeset
30
a61af66fc99e Initial load
duke
parents:
diff changeset
31 StackValueCollection* compiledVFrame::locals() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
32 // Natives has no scope
a61af66fc99e Initial load
duke
parents:
diff changeset
33 if (scope() == NULL) return new StackValueCollection(0);
a61af66fc99e Initial load
duke
parents:
diff changeset
34 GrowableArray<ScopeValue*>* scv_list = scope()->locals();
a61af66fc99e Initial load
duke
parents:
diff changeset
35 if (scv_list == NULL) return new StackValueCollection(0);
a61af66fc99e Initial load
duke
parents:
diff changeset
36
a61af66fc99e Initial load
duke
parents:
diff changeset
37 // scv_list is the list of ScopeValues describing the JVM stack state.
a61af66fc99e Initial load
duke
parents:
diff changeset
38 // There is one scv_list entry for every JVM stack state in use.
a61af66fc99e Initial load
duke
parents:
diff changeset
39 int length = scv_list->length();
a61af66fc99e Initial load
duke
parents:
diff changeset
40 StackValueCollection* result = new StackValueCollection(length);
a61af66fc99e Initial load
duke
parents:
diff changeset
41 // In rare instances set_locals may have occurred in which case
a61af66fc99e Initial load
duke
parents:
diff changeset
42 // there are local values that are not described by the ScopeValue anymore
a61af66fc99e Initial load
duke
parents:
diff changeset
43 GrowableArray<jvmtiDeferredLocalVariable*>* deferred = NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
44 GrowableArray<jvmtiDeferredLocalVariableSet*>* list = thread()->deferred_locals();
a61af66fc99e Initial load
duke
parents:
diff changeset
45 if (list != NULL ) {
a61af66fc99e Initial load
duke
parents:
diff changeset
46 // In real life this never happens or is typically a single element search
a61af66fc99e Initial load
duke
parents:
diff changeset
47 for (int i = 0; i < list->length(); i++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
48 if (list->at(i)->matches((vframe*)this)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
49 deferred = list->at(i)->locals();
a61af66fc99e Initial load
duke
parents:
diff changeset
50 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
51 }
a61af66fc99e Initial load
duke
parents:
diff changeset
52 }
a61af66fc99e Initial load
duke
parents:
diff changeset
53 }
a61af66fc99e Initial load
duke
parents:
diff changeset
54
1937
4853c5cad3aa More deoptmization tracing.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1552
diff changeset
55 if (TraceDeoptimization) {
4853c5cad3aa More deoptmization tracing.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1552
diff changeset
56 tty->print_cr("bci=%d length=%d", this->bci(), length);
4853c5cad3aa More deoptmization tracing.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1552
diff changeset
57 tty->print_cr(err_msg("method name = %s", this->method()->name()->as_C_string()));
4853c5cad3aa More deoptmization tracing.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1552
diff changeset
58 tty->print_cr("relative pc=%d", this->fr().pc() - this->nm()->code_begin());
4853c5cad3aa More deoptmization tracing.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1552
diff changeset
59 }
4853c5cad3aa More deoptmization tracing.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1552
diff changeset
60
0
a61af66fc99e Initial load
duke
parents:
diff changeset
61 for( int i = 0; i < length; i++ ) {
a61af66fc99e Initial load
duke
parents:
diff changeset
62 result->add( create_stack_value(scv_list->at(i)) );
a61af66fc99e Initial load
duke
parents:
diff changeset
63 }
a61af66fc99e Initial load
duke
parents:
diff changeset
64
a61af66fc99e Initial load
duke
parents:
diff changeset
65 // Replace specified locals with any deferred writes that are present
a61af66fc99e Initial load
duke
parents:
diff changeset
66 if (deferred != NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
67 for ( int l = 0; l < deferred->length() ; l ++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
68 jvmtiDeferredLocalVariable* val = deferred->at(l);
a61af66fc99e Initial load
duke
parents:
diff changeset
69 switch (val->type()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
70 case T_BOOLEAN:
a61af66fc99e Initial load
duke
parents:
diff changeset
71 result->set_int_at(val->index(), val->value().z);
a61af66fc99e Initial load
duke
parents:
diff changeset
72 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
73 case T_CHAR:
a61af66fc99e Initial load
duke
parents:
diff changeset
74 result->set_int_at(val->index(), val->value().c);
a61af66fc99e Initial load
duke
parents:
diff changeset
75 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
76 case T_FLOAT:
a61af66fc99e Initial load
duke
parents:
diff changeset
77 result->set_float_at(val->index(), val->value().f);
a61af66fc99e Initial load
duke
parents:
diff changeset
78 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
79 case T_DOUBLE:
a61af66fc99e Initial load
duke
parents:
diff changeset
80 result->set_double_at(val->index(), val->value().d);
a61af66fc99e Initial load
duke
parents:
diff changeset
81 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
82 case T_BYTE:
a61af66fc99e Initial load
duke
parents:
diff changeset
83 result->set_int_at(val->index(), val->value().b);
a61af66fc99e Initial load
duke
parents:
diff changeset
84 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
85 case T_SHORT:
a61af66fc99e Initial load
duke
parents:
diff changeset
86 result->set_int_at(val->index(), val->value().s);
a61af66fc99e Initial load
duke
parents:
diff changeset
87 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
88 case T_INT:
a61af66fc99e Initial load
duke
parents:
diff changeset
89 result->set_int_at(val->index(), val->value().i);
a61af66fc99e Initial load
duke
parents:
diff changeset
90 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
91 case T_LONG:
a61af66fc99e Initial load
duke
parents:
diff changeset
92 result->set_long_at(val->index(), val->value().j);
a61af66fc99e Initial load
duke
parents:
diff changeset
93 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
94 case T_OBJECT:
a61af66fc99e Initial load
duke
parents:
diff changeset
95 {
a61af66fc99e Initial load
duke
parents:
diff changeset
96 Handle obj((oop)val->value().l);
a61af66fc99e Initial load
duke
parents:
diff changeset
97 result->set_obj_at(val->index(), obj);
a61af66fc99e Initial load
duke
parents:
diff changeset
98 }
a61af66fc99e Initial load
duke
parents:
diff changeset
99 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
100 default:
a61af66fc99e Initial load
duke
parents:
diff changeset
101 ShouldNotReachHere();
a61af66fc99e Initial load
duke
parents:
diff changeset
102 }
a61af66fc99e Initial load
duke
parents:
diff changeset
103 }
a61af66fc99e Initial load
duke
parents:
diff changeset
104 }
a61af66fc99e Initial load
duke
parents:
diff changeset
105
a61af66fc99e Initial load
duke
parents:
diff changeset
106 return result;
a61af66fc99e Initial load
duke
parents:
diff changeset
107 }
a61af66fc99e Initial load
duke
parents:
diff changeset
108
a61af66fc99e Initial load
duke
parents:
diff changeset
109
a61af66fc99e Initial load
duke
parents:
diff changeset
110 void compiledVFrame::set_locals(StackValueCollection* values) const {
a61af66fc99e Initial load
duke
parents:
diff changeset
111
a61af66fc99e Initial load
duke
parents:
diff changeset
112 fatal("Should use update_local for each local update");
a61af66fc99e Initial load
duke
parents:
diff changeset
113 }
a61af66fc99e Initial load
duke
parents:
diff changeset
114
a61af66fc99e Initial load
duke
parents:
diff changeset
115 void compiledVFrame::update_local(BasicType type, int index, jvalue value) {
a61af66fc99e Initial load
duke
parents:
diff changeset
116
a61af66fc99e Initial load
duke
parents:
diff changeset
117 #ifdef ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
118
a61af66fc99e Initial load
duke
parents:
diff changeset
119 assert(fr().is_deoptimized_frame(), "frame must be scheduled for deoptimization");
a61af66fc99e Initial load
duke
parents:
diff changeset
120 #endif /* ASSERT */
a61af66fc99e Initial load
duke
parents:
diff changeset
121 GrowableArray<jvmtiDeferredLocalVariableSet*>* deferred = thread()->deferred_locals();
a61af66fc99e Initial load
duke
parents:
diff changeset
122 if (deferred != NULL ) {
a61af66fc99e Initial load
duke
parents:
diff changeset
123 // See if this vframe has already had locals with deferred writes
a61af66fc99e Initial load
duke
parents:
diff changeset
124 int f;
a61af66fc99e Initial load
duke
parents:
diff changeset
125 for ( f = 0 ; f < deferred->length() ; f++ ) {
a61af66fc99e Initial load
duke
parents:
diff changeset
126 if (deferred->at(f)->matches(this)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
127 // Matching, vframe now see if the local already had deferred write
a61af66fc99e Initial load
duke
parents:
diff changeset
128 GrowableArray<jvmtiDeferredLocalVariable*>* locals = deferred->at(f)->locals();
a61af66fc99e Initial load
duke
parents:
diff changeset
129 int l;
a61af66fc99e Initial load
duke
parents:
diff changeset
130 for (l = 0 ; l < locals->length() ; l++ ) {
a61af66fc99e Initial load
duke
parents:
diff changeset
131 if (locals->at(l)->index() == index) {
a61af66fc99e Initial load
duke
parents:
diff changeset
132 locals->at(l)->set_value(value);
a61af66fc99e Initial load
duke
parents:
diff changeset
133 return;
a61af66fc99e Initial load
duke
parents:
diff changeset
134 }
a61af66fc99e Initial load
duke
parents:
diff changeset
135 }
a61af66fc99e Initial load
duke
parents:
diff changeset
136 // No matching local already present. Push a new value onto the deferred collection
a61af66fc99e Initial load
duke
parents:
diff changeset
137 locals->push(new jvmtiDeferredLocalVariable(index, type, value));
a61af66fc99e Initial load
duke
parents:
diff changeset
138 return;
a61af66fc99e Initial load
duke
parents:
diff changeset
139 }
a61af66fc99e Initial load
duke
parents:
diff changeset
140 }
a61af66fc99e Initial load
duke
parents:
diff changeset
141 // No matching vframe must push a new vframe
a61af66fc99e Initial load
duke
parents:
diff changeset
142 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
143 // No deferred updates pending for this thread.
a61af66fc99e Initial load
duke
parents:
diff changeset
144 // allocate in C heap
a61af66fc99e Initial load
duke
parents:
diff changeset
145 deferred = new(ResourceObj::C_HEAP) GrowableArray<jvmtiDeferredLocalVariableSet*> (1, true);
a61af66fc99e Initial load
duke
parents:
diff changeset
146 thread()->set_deferred_locals(deferred);
a61af66fc99e Initial load
duke
parents:
diff changeset
147 }
a61af66fc99e Initial load
duke
parents:
diff changeset
148 deferred->push(new jvmtiDeferredLocalVariableSet(method(), bci(), fr().id()));
a61af66fc99e Initial load
duke
parents:
diff changeset
149 assert(deferred->top()->id() == fr().id(), "Huh? Must match");
a61af66fc99e Initial load
duke
parents:
diff changeset
150 deferred->top()->set_local_at(index, type, value);
a61af66fc99e Initial load
duke
parents:
diff changeset
151 }
a61af66fc99e Initial load
duke
parents:
diff changeset
152
a61af66fc99e Initial load
duke
parents:
diff changeset
153 StackValueCollection* compiledVFrame::expressions() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
154 // Natives has no scope
a61af66fc99e Initial load
duke
parents:
diff changeset
155 if (scope() == NULL) return new StackValueCollection(0);
a61af66fc99e Initial load
duke
parents:
diff changeset
156 GrowableArray<ScopeValue*>* scv_list = scope()->expressions();
a61af66fc99e Initial load
duke
parents:
diff changeset
157 if (scv_list == NULL) return new StackValueCollection(0);
a61af66fc99e Initial load
duke
parents:
diff changeset
158
a61af66fc99e Initial load
duke
parents:
diff changeset
159 // scv_list is the list of ScopeValues describing the JVM stack state.
a61af66fc99e Initial load
duke
parents:
diff changeset
160 // There is one scv_list entry for every JVM stack state in use.
a61af66fc99e Initial load
duke
parents:
diff changeset
161 int length = scv_list->length();
a61af66fc99e Initial load
duke
parents:
diff changeset
162 StackValueCollection* result = new StackValueCollection(length);
a61af66fc99e Initial load
duke
parents:
diff changeset
163 for( int i = 0; i < length; i++ )
a61af66fc99e Initial load
duke
parents:
diff changeset
164 result->add( create_stack_value(scv_list->at(i)) );
a61af66fc99e Initial load
duke
parents:
diff changeset
165
a61af66fc99e Initial load
duke
parents:
diff changeset
166 return result;
a61af66fc99e Initial load
duke
parents:
diff changeset
167 }
a61af66fc99e Initial load
duke
parents:
diff changeset
168
a61af66fc99e Initial load
duke
parents:
diff changeset
169
a61af66fc99e Initial load
duke
parents:
diff changeset
170 // The implementation of the following two methods was factorized into the
a61af66fc99e Initial load
duke
parents:
diff changeset
171 // class StackValue because it is also used from within deoptimization.cpp for
a61af66fc99e Initial load
duke
parents:
diff changeset
172 // rematerialization and relocking of non-escaping objects.
a61af66fc99e Initial load
duke
parents:
diff changeset
173
a61af66fc99e Initial load
duke
parents:
diff changeset
174 StackValue *compiledVFrame::create_stack_value(ScopeValue *sv) const {
a61af66fc99e Initial load
duke
parents:
diff changeset
175 return StackValue::create_stack_value(&_fr, register_map(), sv);
a61af66fc99e Initial load
duke
parents:
diff changeset
176 }
a61af66fc99e Initial load
duke
parents:
diff changeset
177
a61af66fc99e Initial load
duke
parents:
diff changeset
178 BasicLock* compiledVFrame::resolve_monitor_lock(Location location) const {
a61af66fc99e Initial load
duke
parents:
diff changeset
179 return StackValue::resolve_monitor_lock(&_fr, location);
a61af66fc99e Initial load
duke
parents:
diff changeset
180 }
a61af66fc99e Initial load
duke
parents:
diff changeset
181
a61af66fc99e Initial load
duke
parents:
diff changeset
182
a61af66fc99e Initial load
duke
parents:
diff changeset
183 GrowableArray<MonitorInfo*>* compiledVFrame::monitors() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
184 // Natives has no scope
a61af66fc99e Initial load
duke
parents:
diff changeset
185 if (scope() == NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
186 nmethod* nm = code();
a61af66fc99e Initial load
duke
parents:
diff changeset
187 methodOop method = nm->method();
a61af66fc99e Initial load
duke
parents:
diff changeset
188 assert(method->is_native(), "");
a61af66fc99e Initial load
duke
parents:
diff changeset
189 if (!method->is_synchronized()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
190 return new GrowableArray<MonitorInfo*>(0);
a61af66fc99e Initial load
duke
parents:
diff changeset
191 }
a61af66fc99e Initial load
duke
parents:
diff changeset
192 // This monitor is really only needed for UseBiasedLocking, but
a61af66fc99e Initial load
duke
parents:
diff changeset
193 // return it in all cases for now as it might be useful for stack
a61af66fc99e Initial load
duke
parents:
diff changeset
194 // traces and tools as well
a61af66fc99e Initial load
duke
parents:
diff changeset
195 GrowableArray<MonitorInfo*> *monitors = new GrowableArray<MonitorInfo*>(1);
a61af66fc99e Initial load
duke
parents:
diff changeset
196 // Casting away const
a61af66fc99e Initial load
duke
parents:
diff changeset
197 frame& fr = (frame&) _fr;
a61af66fc99e Initial load
duke
parents:
diff changeset
198 MonitorInfo* info = new MonitorInfo(fr.compiled_synchronized_native_monitor_owner(nm),
818
b109e761e927 6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents: 196
diff changeset
199 fr.compiled_synchronized_native_monitor(nm), false, false);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
200 monitors->push(info);
a61af66fc99e Initial load
duke
parents:
diff changeset
201 return monitors;
a61af66fc99e Initial load
duke
parents:
diff changeset
202 }
a61af66fc99e Initial load
duke
parents:
diff changeset
203 GrowableArray<MonitorValue*>* monitors = scope()->monitors();
a61af66fc99e Initial load
duke
parents:
diff changeset
204 if (monitors == NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
205 return new GrowableArray<MonitorInfo*>(0);
a61af66fc99e Initial load
duke
parents:
diff changeset
206 }
a61af66fc99e Initial load
duke
parents:
diff changeset
207 GrowableArray<MonitorInfo*>* result = new GrowableArray<MonitorInfo*>(monitors->length());
a61af66fc99e Initial load
duke
parents:
diff changeset
208 for (int index = 0; index < monitors->length(); index++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
209 MonitorValue* mv = monitors->at(index);
818
b109e761e927 6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents: 196
diff changeset
210 ScopeValue* ov = mv->owner();
b109e761e927 6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents: 196
diff changeset
211 StackValue *owner_sv = create_stack_value(ov); // it is an oop
b109e761e927 6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents: 196
diff changeset
212 if (ov->is_object() && owner_sv->obj_is_scalar_replaced()) { // The owner object was scalar replaced
b109e761e927 6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents: 196
diff changeset
213 assert(mv->eliminated(), "monitor should be eliminated for scalar replaced object");
b109e761e927 6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents: 196
diff changeset
214 // Put klass for scalar replaced object.
b109e761e927 6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents: 196
diff changeset
215 ScopeValue* kv = ((ObjectValue *)ov)->klass();
b109e761e927 6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents: 196
diff changeset
216 assert(kv->is_constant_oop(), "klass should be oop constant for scalar replaced object");
b109e761e927 6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents: 196
diff changeset
217 KlassHandle k(((ConstantOopReadValue*)kv)->value()());
b109e761e927 6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents: 196
diff changeset
218 result->push(new MonitorInfo(k->as_klassOop(), resolve_monitor_lock(mv->basic_lock()),
b109e761e927 6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents: 196
diff changeset
219 mv->eliminated(), true));
b109e761e927 6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents: 196
diff changeset
220 } else {
b109e761e927 6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents: 196
diff changeset
221 result->push(new MonitorInfo(owner_sv->get_obj()(), resolve_monitor_lock(mv->basic_lock()),
b109e761e927 6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents: 196
diff changeset
222 mv->eliminated(), false));
b109e761e927 6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14
kvn
parents: 196
diff changeset
223 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
224 }
a61af66fc99e Initial load
duke
parents:
diff changeset
225 return result;
a61af66fc99e Initial load
duke
parents:
diff changeset
226 }
a61af66fc99e Initial load
duke
parents:
diff changeset
227
a61af66fc99e Initial load
duke
parents:
diff changeset
228
a61af66fc99e Initial load
duke
parents:
diff changeset
229 compiledVFrame::compiledVFrame(const frame* fr, const RegisterMap* reg_map, JavaThread* thread, nmethod* nm)
a61af66fc99e Initial load
duke
parents:
diff changeset
230 : javaVFrame(fr, reg_map, thread) {
a61af66fc99e Initial load
duke
parents:
diff changeset
231 _scope = NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
232 // Compiled method (native stub or Java code)
a61af66fc99e Initial load
duke
parents:
diff changeset
233 // native wrappers have no scope data, it is implied
a61af66fc99e Initial load
duke
parents:
diff changeset
234 if (!nm->is_native_method()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
235 _scope = nm->scope_desc_at(_fr.pc());
a61af66fc99e Initial load
duke
parents:
diff changeset
236 }
a61af66fc99e Initial load
duke
parents:
diff changeset
237 }
a61af66fc99e Initial load
duke
parents:
diff changeset
238
a61af66fc99e Initial load
duke
parents:
diff changeset
239 compiledVFrame::compiledVFrame(const frame* fr, const RegisterMap* reg_map, JavaThread* thread, ScopeDesc* scope)
a61af66fc99e Initial load
duke
parents:
diff changeset
240 : javaVFrame(fr, reg_map, thread) {
a61af66fc99e Initial load
duke
parents:
diff changeset
241 _scope = scope;
a61af66fc99e Initial load
duke
parents:
diff changeset
242 guarantee(_scope != NULL, "scope must be present");
a61af66fc99e Initial load
duke
parents:
diff changeset
243 }
a61af66fc99e Initial load
duke
parents:
diff changeset
244
a61af66fc99e Initial load
duke
parents:
diff changeset
245
a61af66fc99e Initial load
duke
parents:
diff changeset
246 bool compiledVFrame::is_top() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
247 // FIX IT: Remove this when new native stubs are in place
a61af66fc99e Initial load
duke
parents:
diff changeset
248 if (scope() == NULL) return true;
a61af66fc99e Initial load
duke
parents:
diff changeset
249 return scope()->is_top();
a61af66fc99e Initial load
duke
parents:
diff changeset
250 }
a61af66fc99e Initial load
duke
parents:
diff changeset
251
a61af66fc99e Initial load
duke
parents:
diff changeset
252
a61af66fc99e Initial load
duke
parents:
diff changeset
253 nmethod* compiledVFrame::code() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
254 return CodeCache::find_nmethod(_fr.pc());
a61af66fc99e Initial load
duke
parents:
diff changeset
255 }
a61af66fc99e Initial load
duke
parents:
diff changeset
256
a61af66fc99e Initial load
duke
parents:
diff changeset
257
a61af66fc99e Initial load
duke
parents:
diff changeset
258 methodOop compiledVFrame::method() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
259 if (scope() == NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
260 // native nmethods have no scope the method is implied
a61af66fc99e Initial load
duke
parents:
diff changeset
261 nmethod* nm = code();
a61af66fc99e Initial load
duke
parents:
diff changeset
262 assert(nm->is_native_method(), "must be native");
a61af66fc99e Initial load
duke
parents:
diff changeset
263 return nm->method();
a61af66fc99e Initial load
duke
parents:
diff changeset
264 }
a61af66fc99e Initial load
duke
parents:
diff changeset
265 return scope()->method()();
a61af66fc99e Initial load
duke
parents:
diff changeset
266 }
a61af66fc99e Initial load
duke
parents:
diff changeset
267
a61af66fc99e Initial load
duke
parents:
diff changeset
268
a61af66fc99e Initial load
duke
parents:
diff changeset
269 int compiledVFrame::bci() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
270 int raw = raw_bci();
a61af66fc99e Initial load
duke
parents:
diff changeset
271 return raw == SynchronizationEntryBCI ? 0 : raw;
a61af66fc99e Initial load
duke
parents:
diff changeset
272 }
a61af66fc99e Initial load
duke
parents:
diff changeset
273
a61af66fc99e Initial load
duke
parents:
diff changeset
274
a61af66fc99e Initial load
duke
parents:
diff changeset
275 int compiledVFrame::raw_bci() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
276 if (scope() == NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
277 // native nmethods have no scope the method/bci is implied
a61af66fc99e Initial load
duke
parents:
diff changeset
278 nmethod* nm = code();
a61af66fc99e Initial load
duke
parents:
diff changeset
279 assert(nm->is_native_method(), "must be native");
a61af66fc99e Initial load
duke
parents:
diff changeset
280 return 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
281 }
a61af66fc99e Initial load
duke
parents:
diff changeset
282 return scope()->bci();
a61af66fc99e Initial load
duke
parents:
diff changeset
283 }
a61af66fc99e Initial load
duke
parents:
diff changeset
284
900
9987d9d5eb0e 6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents: 818
diff changeset
285 bool compiledVFrame::should_reexecute() const {
9987d9d5eb0e 6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents: 818
diff changeset
286 if (scope() == NULL) {
9987d9d5eb0e 6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents: 818
diff changeset
287 // native nmethods have no scope the method/bci is implied
9987d9d5eb0e 6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents: 818
diff changeset
288 nmethod* nm = code();
9987d9d5eb0e 6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents: 818
diff changeset
289 assert(nm->is_native_method(), "must be native");
9987d9d5eb0e 6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents: 818
diff changeset
290 return false;
9987d9d5eb0e 6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents: 818
diff changeset
291 }
9987d9d5eb0e 6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents: 818
diff changeset
292 return scope()->should_reexecute();
9987d9d5eb0e 6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents: 818
diff changeset
293 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
294
a61af66fc99e Initial load
duke
parents:
diff changeset
295 vframe* compiledVFrame::sender() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
296 const frame f = fr();
a61af66fc99e Initial load
duke
parents:
diff changeset
297 if (scope() == NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
298 // native nmethods have no scope the method/bci is implied
a61af66fc99e Initial load
duke
parents:
diff changeset
299 nmethod* nm = code();
a61af66fc99e Initial load
duke
parents:
diff changeset
300 assert(nm->is_native_method(), "must be native");
a61af66fc99e Initial load
duke
parents:
diff changeset
301 return vframe::sender();
a61af66fc99e Initial load
duke
parents:
diff changeset
302 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
303 return scope()->is_top()
a61af66fc99e Initial load
duke
parents:
diff changeset
304 ? vframe::sender()
a61af66fc99e Initial load
duke
parents:
diff changeset
305 : new compiledVFrame(&f, register_map(), thread(), scope()->sender());
a61af66fc99e Initial load
duke
parents:
diff changeset
306 }
a61af66fc99e Initial load
duke
parents:
diff changeset
307 }
a61af66fc99e Initial load
duke
parents:
diff changeset
308
a61af66fc99e Initial load
duke
parents:
diff changeset
309 jvmtiDeferredLocalVariableSet::jvmtiDeferredLocalVariableSet(methodOop method, int bci, intptr_t* id) {
a61af66fc99e Initial load
duke
parents:
diff changeset
310 _method = method;
a61af66fc99e Initial load
duke
parents:
diff changeset
311 _bci = bci;
a61af66fc99e Initial load
duke
parents:
diff changeset
312 _id = id;
a61af66fc99e Initial load
duke
parents:
diff changeset
313 // Alway will need at least one, must be on C heap
a61af66fc99e Initial load
duke
parents:
diff changeset
314 _locals = new(ResourceObj::C_HEAP) GrowableArray<jvmtiDeferredLocalVariable*> (1, true);
a61af66fc99e Initial load
duke
parents:
diff changeset
315 }
a61af66fc99e Initial load
duke
parents:
diff changeset
316
a61af66fc99e Initial load
duke
parents:
diff changeset
317 jvmtiDeferredLocalVariableSet::~jvmtiDeferredLocalVariableSet() {
a61af66fc99e Initial load
duke
parents:
diff changeset
318 for (int i = 0; i < _locals->length() ; i++ ) {
a61af66fc99e Initial load
duke
parents:
diff changeset
319 delete _locals->at(i);
a61af66fc99e Initial load
duke
parents:
diff changeset
320 }
a61af66fc99e Initial load
duke
parents:
diff changeset
321 // Free growableArray and c heap for elements
a61af66fc99e Initial load
duke
parents:
diff changeset
322 delete _locals;
a61af66fc99e Initial load
duke
parents:
diff changeset
323 }
a61af66fc99e Initial load
duke
parents:
diff changeset
324
a61af66fc99e Initial load
duke
parents:
diff changeset
325 bool jvmtiDeferredLocalVariableSet::matches(vframe* vf) {
a61af66fc99e Initial load
duke
parents:
diff changeset
326 if (!vf->is_compiled_frame()) return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
327 compiledVFrame* cvf = (compiledVFrame*)vf;
a61af66fc99e Initial load
duke
parents:
diff changeset
328 return cvf->fr().id() == id() && cvf->method() == method() && cvf->bci() == bci();
a61af66fc99e Initial load
duke
parents:
diff changeset
329 }
a61af66fc99e Initial load
duke
parents:
diff changeset
330
a61af66fc99e Initial load
duke
parents:
diff changeset
331 void jvmtiDeferredLocalVariableSet::set_local_at(int idx, BasicType type, jvalue val) {
a61af66fc99e Initial load
duke
parents:
diff changeset
332 int i;
a61af66fc99e Initial load
duke
parents:
diff changeset
333 for ( i = 0 ; i < locals()->length() ; i++ ) {
a61af66fc99e Initial load
duke
parents:
diff changeset
334 if ( locals()->at(i)->index() == idx) {
a61af66fc99e Initial load
duke
parents:
diff changeset
335 assert(locals()->at(i)->type() == type, "Wrong type");
a61af66fc99e Initial load
duke
parents:
diff changeset
336 locals()->at(i)->set_value(val);
a61af66fc99e Initial load
duke
parents:
diff changeset
337 return;
a61af66fc99e Initial load
duke
parents:
diff changeset
338 }
a61af66fc99e Initial load
duke
parents:
diff changeset
339 }
a61af66fc99e Initial load
duke
parents:
diff changeset
340 locals()->push(new jvmtiDeferredLocalVariable(idx, type, val));
a61af66fc99e Initial load
duke
parents:
diff changeset
341 }
a61af66fc99e Initial load
duke
parents:
diff changeset
342
a61af66fc99e Initial load
duke
parents:
diff changeset
343 void jvmtiDeferredLocalVariableSet::oops_do(OopClosure* f) {
a61af66fc99e Initial load
duke
parents:
diff changeset
344
a61af66fc99e Initial load
duke
parents:
diff changeset
345 f->do_oop((oop*) &_method);
a61af66fc99e Initial load
duke
parents:
diff changeset
346 for ( int i = 0; i < locals()->length(); i++ ) {
a61af66fc99e Initial load
duke
parents:
diff changeset
347 if ( locals()->at(i)->type() == T_OBJECT) {
a61af66fc99e Initial load
duke
parents:
diff changeset
348 f->do_oop(locals()->at(i)->oop_addr());
a61af66fc99e Initial load
duke
parents:
diff changeset
349 }
a61af66fc99e Initial load
duke
parents:
diff changeset
350 }
a61af66fc99e Initial load
duke
parents:
diff changeset
351 }
a61af66fc99e Initial load
duke
parents:
diff changeset
352
a61af66fc99e Initial load
duke
parents:
diff changeset
353 jvmtiDeferredLocalVariable::jvmtiDeferredLocalVariable(int index, BasicType type, jvalue value) {
a61af66fc99e Initial load
duke
parents:
diff changeset
354 _index = index;
a61af66fc99e Initial load
duke
parents:
diff changeset
355 _type = type;
a61af66fc99e Initial load
duke
parents:
diff changeset
356 _value = value;
a61af66fc99e Initial load
duke
parents:
diff changeset
357 }
a61af66fc99e Initial load
duke
parents:
diff changeset
358
a61af66fc99e Initial load
duke
parents:
diff changeset
359
a61af66fc99e Initial load
duke
parents:
diff changeset
360 #ifndef PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
361 void compiledVFrame::verify() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
362 Unimplemented();
a61af66fc99e Initial load
duke
parents:
diff changeset
363 }
a61af66fc99e Initial load
duke
parents:
diff changeset
364 #endif // PRODUCT