comparison src/share/vm/runtime/vframeArray.cpp @ 6275:957c266d8bc5

Merge with http://hg.openjdk.java.net/hsx/hsx24/hotspot/
author Doug Simon <doug.simon@oracle.com>
date Tue, 21 Aug 2012 10:39:19 +0200
parents 86478955e54c 1d7922586cf6
children e522a00b91aa
comparison
equal deleted inserted replaced
5891:fd8832ae511d 6275:957c266d8bc5
22 * 22 *
23 */ 23 */
24 24
25 #include "precompiled.hpp" 25 #include "precompiled.hpp"
26 #include "classfile/vmSymbols.hpp" 26 #include "classfile/vmSymbols.hpp"
27 #include "code/scopeDesc.hpp" 27 #include "interpreter/bytecode.hpp"
28 #include "interpreter/interpreter.hpp" 28 #include "interpreter/interpreter.hpp"
29 #include "memory/allocation.inline.hpp" 29 #include "memory/allocation.inline.hpp"
30 #include "memory/resourceArea.hpp" 30 #include "memory/resourceArea.hpp"
31 #include "memory/universe.inline.hpp" 31 #include "memory/universe.inline.hpp"
32 #include "oops/methodDataOop.hpp" 32 #include "oops/methodDataOop.hpp"
476 RegisterMap *reg_map, frame sender, frame caller, frame self) { 476 RegisterMap *reg_map, frame sender, frame caller, frame self) {
477 477
478 // Allocate the vframeArray 478 // Allocate the vframeArray
479 vframeArray * result = (vframeArray*) AllocateHeap(sizeof(vframeArray) + // fixed part 479 vframeArray * result = (vframeArray*) AllocateHeap(sizeof(vframeArray) + // fixed part
480 sizeof(vframeArrayElement) * (chunk->length() - 1), // variable part 480 sizeof(vframeArrayElement) * (chunk->length() - 1), // variable part
481 "vframeArray::allocate"); 481 mtCompiler);
482 result->_frames = chunk->length(); 482 result->_frames = chunk->length();
483 result->_owner_thread = thread; 483 result->_owner_thread = thread;
484 result->_sender = sender; 484 result->_sender = sender;
485 result->_caller = caller; 485 result->_caller = caller;
486 result->_original = self; 486 result->_original = self;
543 // 543 //
544 // This routine fills in the missing data for the skeletal interpreter frames 544 // This routine fills in the missing data for the skeletal interpreter frames
545 // in the above picture. 545 // in the above picture.
546 546
547 // Find the skeletal interpreter frames to unpack into 547 // Find the skeletal interpreter frames to unpack into
548 RegisterMap map(JavaThread::current(), false); 548 JavaThread* THREAD = JavaThread::current();
549 RegisterMap map(THREAD, false);
549 // Get the youngest frame we will unpack (last to be unpacked) 550 // Get the youngest frame we will unpack (last to be unpacked)
550 frame me = unpack_frame.sender(&map); 551 frame me = unpack_frame.sender(&map);
551 int index; 552 int index;
552 for (index = 0; index < frames(); index++ ) { 553 for (index = 0; index < frames(); index++ ) {
553 *element(index)->iframe() = me; 554 *element(index)->iframe() = me;
554 // Get the caller frame (possibly skeletal) 555 // Get the caller frame (possibly skeletal)
555 me = me.sender(&map); 556 me = me.sender(&map);
556 } 557 }
557 558
559 // Do the unpacking of interpreter frames; the frame at index 0 represents the top activation, so it has no callee
560 // Unpack the frames from the oldest (frames() -1) to the youngest (0)
558 frame caller_frame = me; 561 frame caller_frame = me;
559
560 // Do the unpacking of interpreter frames; the frame at index 0 represents the top activation, so it has no callee
561
562 // Unpack the frames from the oldest (frames() -1) to the youngest (0)
563
564 for (index = frames() - 1; index >= 0 ; index--) { 562 for (index = frames() - 1; index >= 0 ; index--) {
565 int callee_parameters = index == 0 ? 0 : element(index-1)->method()->size_of_parameters(); 563 vframeArrayElement* elem = element(index); // caller
566 int callee_locals = index == 0 ? 0 : element(index-1)->method()->max_locals(); 564 int callee_parameters, callee_locals;
567 element(index)->unpack_on_stack(caller_actual_parameters, 565 if (index == 0) {
568 callee_parameters, 566 callee_parameters = callee_locals = 0;
569 callee_locals, 567 } else {
570 &caller_frame, 568 methodHandle caller = elem->method();
571 index == 0, 569 methodHandle callee = element(index - 1)->method();
572 exec_mode); 570 Bytecode_invoke inv(caller, elem->bci());
571 // invokedynamic instructions don't have a class but obviously don't have a MemberName appendix.
572 // NOTE: Use machinery here that avoids resolving of any kind.
573 const bool has_member_arg =
574 !inv.is_invokedynamic() && MethodHandles::has_member_arg(inv.klass(), inv.name());
575 callee_parameters = callee->size_of_parameters() + (has_member_arg ? 1 : 0);
576 callee_locals = callee->max_locals();
577 }
578 elem->unpack_on_stack(caller_actual_parameters,
579 callee_parameters,
580 callee_locals,
581 &caller_frame,
582 index == 0,
583 exec_mode);
573 if (index == frames() - 1) { 584 if (index == frames() - 1) {
574 Deoptimization::unwind_callee_save_values(element(index)->iframe(), this); 585 Deoptimization::unwind_callee_save_values(elem->iframe(), this);
575 } 586 }
576 caller_frame = *element(index)->iframe(); 587 caller_frame = *elem->iframe();
577 caller_actual_parameters = callee_parameters; 588 caller_actual_parameters = callee_parameters;
578 } 589 }
579
580
581 deallocate_monitor_chunks(); 590 deallocate_monitor_chunks();
582 } 591 }
583 592
584 void vframeArray::deallocate_monitor_chunks() { 593 void vframeArray::deallocate_monitor_chunks() {
585 JavaThread* jt = JavaThread::current(); 594 JavaThread* jt = JavaThread::current();