156 // No deferred updates pending for this thread. |
156 // No deferred updates pending for this thread. |
157 // allocate in C heap |
157 // allocate in C heap |
158 deferred = new(ResourceObj::C_HEAP, mtCompiler) GrowableArray<jvmtiDeferredLocalVariableSet*> (1, true); |
158 deferred = new(ResourceObj::C_HEAP, mtCompiler) GrowableArray<jvmtiDeferredLocalVariableSet*> (1, true); |
159 thread()->set_deferred_locals(deferred); |
159 thread()->set_deferred_locals(deferred); |
160 } |
160 } |
161 deferred->push(new jvmtiDeferredLocalVariableSet(method(), bci(), fr().id())); |
161 deferred->push(new jvmtiDeferredLocalVariableSet(method(), bci(), fr().id(), vframe_id())); |
162 assert(deferred->top()->id() == fr().id(), "Huh? Must match"); |
162 assert(deferred->top()->id() == fr().id(), "Huh? Must match"); |
163 deferred->top()->set_local_at(index, type, value); |
163 deferred->top()->set_local_at(index, type, value); |
164 } |
164 } |
165 |
165 |
166 StackValueCollection* compiledVFrame::expressions() const { |
166 StackValueCollection* compiledVFrame::expressions() const { |
241 |
241 |
242 |
242 |
243 compiledVFrame::compiledVFrame(const frame* fr, const RegisterMap* reg_map, JavaThread* thread, CompiledMethod* nm) |
243 compiledVFrame::compiledVFrame(const frame* fr, const RegisterMap* reg_map, JavaThread* thread, CompiledMethod* nm) |
244 : javaVFrame(fr, reg_map, thread) { |
244 : javaVFrame(fr, reg_map, thread) { |
245 _scope = NULL; |
245 _scope = NULL; |
|
246 _vframe_id = 0; |
246 // Compiled method (native stub or Java code) |
247 // Compiled method (native stub or Java code) |
247 // native wrappers have no scope data, it is implied |
248 // native wrappers have no scope data, it is implied |
248 if (!nm->is_compiled() || !nm->as_compiled_method()->is_native_method()) { |
249 if (!nm->is_compiled() || !nm->as_compiled_method()->is_native_method()) { |
249 _scope = nm->scope_desc_at(_fr.pc()); |
250 _scope = nm->scope_desc_at(_fr.pc()); |
250 } |
251 } |
251 } |
252 } |
252 |
253 |
253 compiledVFrame::compiledVFrame(const frame* fr, const RegisterMap* reg_map, JavaThread* thread, ScopeDesc* scope) |
254 compiledVFrame::compiledVFrame(const frame* fr, const RegisterMap* reg_map, JavaThread* thread, ScopeDesc* scope, int vframe_id) |
254 : javaVFrame(fr, reg_map, thread) { |
255 : javaVFrame(fr, reg_map, thread) { |
255 _scope = scope; |
256 _scope = scope; |
|
257 _vframe_id = vframe_id; |
256 guarantee(_scope != NULL, "scope must be present"); |
258 guarantee(_scope != NULL, "scope must be present"); |
257 } |
259 } |
258 |
260 |
259 |
261 |
260 bool compiledVFrame::is_top() const { |
262 bool compiledVFrame::is_top() const { |
314 assert(nm->is_native_method(), "must be native"); |
316 assert(nm->is_native_method(), "must be native"); |
315 return vframe::sender(); |
317 return vframe::sender(); |
316 } else { |
318 } else { |
317 return scope()->is_top() |
319 return scope()->is_top() |
318 ? vframe::sender() |
320 ? vframe::sender() |
319 : new compiledVFrame(&f, register_map(), thread(), scope()->sender()); |
321 : new compiledVFrame(&f, register_map(), thread(), scope()->sender(), vframe_id() + 1); |
320 } |
322 } |
321 } |
323 } |
322 |
324 |
323 jvmtiDeferredLocalVariableSet::jvmtiDeferredLocalVariableSet(Method* method, int bci, intptr_t* id) { |
325 jvmtiDeferredLocalVariableSet::jvmtiDeferredLocalVariableSet(Method* method, int bci, intptr_t* id, int vframe_id) { |
324 _method = method; |
326 _method = method; |
325 _bci = bci; |
327 _bci = bci; |
326 _id = id; |
328 _id = id; |
|
329 _vframe_id = vframe_id; |
327 // Alway will need at least one, must be on C heap |
330 // Alway will need at least one, must be on C heap |
328 _locals = new(ResourceObj::C_HEAP, mtCompiler) GrowableArray<jvmtiDeferredLocalVariable*> (1, true); |
331 _locals = new(ResourceObj::C_HEAP, mtCompiler) GrowableArray<jvmtiDeferredLocalVariable*> (1, true); |
329 } |
332 } |
330 |
333 |
331 jvmtiDeferredLocalVariableSet::~jvmtiDeferredLocalVariableSet() { |
334 jvmtiDeferredLocalVariableSet::~jvmtiDeferredLocalVariableSet() { |
337 } |
340 } |
338 |
341 |
339 bool jvmtiDeferredLocalVariableSet::matches(vframe* vf) { |
342 bool jvmtiDeferredLocalVariableSet::matches(vframe* vf) { |
340 if (!vf->is_compiled_frame()) return false; |
343 if (!vf->is_compiled_frame()) return false; |
341 compiledVFrame* cvf = (compiledVFrame*)vf; |
344 compiledVFrame* cvf = (compiledVFrame*)vf; |
342 return cvf->fr().id() == id() && cvf->method() == method() && cvf->bci() == bci(); |
345 if (cvf->fr().id() == id() && cvf->vframe_id() == vframe_id()) { |
|
346 assert(cvf->method() == method() && cvf->bci() == bci(), "must agree"); |
|
347 return true; |
|
348 } |
|
349 return false; |
343 } |
350 } |
344 |
351 |
345 void jvmtiDeferredLocalVariableSet::set_local_at(int idx, BasicType type, jvalue val) { |
352 void jvmtiDeferredLocalVariableSet::set_local_at(int idx, BasicType type, jvalue val) { |
346 int i; |
353 int i; |
347 for ( i = 0 ; i < locals()->length() ; i++ ) { |
354 for ( i = 0 ; i < locals()->length() ; i++ ) { |