comparison src/share/vm/runtime/deoptimization.cpp @ 3336:2e038ad0c1d0

7009361: JSR 292 Invalid value on stack on solaris-sparc with -Xcomp Reviewed-by: kvn, twisti
author never
date Mon, 02 May 2011 18:53:37 -0700
parents 4f148718983e
children bad7ecd0b6ed
comparison
equal deleted inserted replaced
3335:49d67a090fe2 3336:2e038ad0c1d0
187 frame deoptee = stub_frame.sender(&map); 187 frame deoptee = stub_frame.sender(&map);
188 // Set the deoptee nmethod 188 // Set the deoptee nmethod
189 assert(thread->deopt_nmethod() == NULL, "Pending deopt!"); 189 assert(thread->deopt_nmethod() == NULL, "Pending deopt!");
190 thread->set_deopt_nmethod(deoptee.cb()->as_nmethod_or_null()); 190 thread->set_deopt_nmethod(deoptee.cb()->as_nmethod_or_null());
191 191
192 if (VerifyStack) {
193 thread->validate_frame_layout();
194 }
195
192 // Create a growable array of VFrames where each VFrame represents an inlined 196 // Create a growable array of VFrames where each VFrame represents an inlined
193 // Java frame. This storage is allocated with the usual system arena. 197 // Java frame. This storage is allocated with the usual system arena.
194 assert(deoptee.is_compiled_frame(), "Wrong frame type"); 198 assert(deoptee.is_compiled_frame(), "Wrong frame type");
195 GrowableArray<compiledVFrame*>* chunk = new GrowableArray<compiledVFrame*>(10); 199 GrowableArray<compiledVFrame*>* chunk = new GrowableArray<compiledVFrame*>(10);
196 vframe* vf = vframe::new_vframe(&deoptee, &map, thread); 200 vframe* vf = vframe::new_vframe(&deoptee, &map, thread);
419 // than simply use array->sender.pc(). This requires us to walk the current set of frames 423 // than simply use array->sender.pc(). This requires us to walk the current set of frames
420 // 424 //
421 frame deopt_sender = stub_frame.sender(&dummy_map); // First is the deoptee frame 425 frame deopt_sender = stub_frame.sender(&dummy_map); // First is the deoptee frame
422 deopt_sender = deopt_sender.sender(&dummy_map); // Now deoptee caller 426 deopt_sender = deopt_sender.sender(&dummy_map); // Now deoptee caller
423 427
428 // It's possible that the number of paramters at the call site is
429 // different than number of arguments in the callee when method
430 // handles are used. If the caller is interpreted get the real
431 // value so that the proper amount of space can be added to it's
432 // frame.
433 int sender_callee_parameters = callee_parameters;
434 if (deopt_sender.is_interpreted_frame()) {
435 methodHandle method = deopt_sender.interpreter_frame_method();
436 Bytecode_invoke cur = Bytecode_invoke_check(method,
437 deopt_sender.interpreter_frame_bci());
438 Symbol* signature = method->constants()->signature_ref_at(cur.index());
439 ArgumentSizeComputer asc(signature);
440 sender_callee_parameters = asc.size() + cur.has_receiver() ? 1 : 0;
441 }
442
424 // Compute the amount the oldest interpreter frame will have to adjust 443 // Compute the amount the oldest interpreter frame will have to adjust
425 // its caller's stack by. If the caller is a compiled frame then 444 // its caller's stack by. If the caller is a compiled frame then
426 // we pretend that the callee has no parameters so that the 445 // we pretend that the callee has no parameters so that the
427 // extension counts for the full amount of locals and not just 446 // extension counts for the full amount of locals and not just
428 // locals-parms. This is because without a c2i adapter the parm 447 // locals-parms. This is because without a c2i adapter the parm
433 // QQQ I'd rather see this pushed down into last_frame_adjust 452 // QQQ I'd rather see this pushed down into last_frame_adjust
434 // and have it take the sender (aka caller). 453 // and have it take the sender (aka caller).
435 454
436 if (deopt_sender.is_compiled_frame()) { 455 if (deopt_sender.is_compiled_frame()) {
437 caller_adjustment = last_frame_adjust(0, callee_locals); 456 caller_adjustment = last_frame_adjust(0, callee_locals);
438 } else if (callee_locals > callee_parameters) { 457 } else if (callee_locals > sender_callee_parameters) {
439 // The caller frame may need extending to accommodate 458 // The caller frame may need extending to accommodate
440 // non-parameter locals of the first unpacked interpreted frame. 459 // non-parameter locals of the first unpacked interpreted frame.
441 // Compute that adjustment. 460 // Compute that adjustment.
442 caller_adjustment = last_frame_adjust(callee_parameters, callee_locals); 461 caller_adjustment = last_frame_adjust(sender_callee_parameters, callee_locals);
443 } 462 }
444
445 463
446 // If the sender is deoptimized the we must retrieve the address of the handler 464 // If the sender is deoptimized the we must retrieve the address of the handler
447 // since the frame will "magically" show the original pc before the deopt 465 // since the frame will "magically" show the original pc before the deopt
448 // and we'd undo the deopt. 466 // and we'd undo the deopt.
449 467
566 cleanup_deopt_info(thread, array); 584 cleanup_deopt_info(thread, array);
567 585
568 #ifndef PRODUCT 586 #ifndef PRODUCT
569 if (VerifyStack) { 587 if (VerifyStack) {
570 ResourceMark res_mark; 588 ResourceMark res_mark;
589
590 thread->validate_frame_layout();
571 591
572 // Verify that the just-unpacked frames match the interpreter's 592 // Verify that the just-unpacked frames match the interpreter's
573 // notions of expression stack and locals 593 // notions of expression stack and locals
574 vframeArray* cur_array = thread->vframe_array_last(); 594 vframeArray* cur_array = thread->vframe_array_last();
575 RegisterMap rm(thread, false); 595 RegisterMap rm(thread, false);