comparison src/share/vm/runtime/vframeArray.cpp @ 3534:1d7922586cf6

7023639: JSR 292 method handle invocation needs a fast path for compiled code 6984705: JSR 292 method handle creation should not go through JNI Summary: remove assembly code for JDK 7 chained method handles Reviewed-by: jrose, twisti, kvn, mhaupt Contributed-by: John Rose <john.r.rose@oracle.com>, Christian Thalinger <christian.thalinger@oracle.com>, Michael Haupt <michael.haupt@oracle.com>
author twisti
date Tue, 24 Jul 2012 10:51:00 -0700
parents d2a62e0f25eb
children da91efe96a93
comparison
equal deleted inserted replaced
14:8c13e9bf2ffb 15:b17c1e23cbe7
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 "interpreter/bytecode.hpp"
27 #include "interpreter/interpreter.hpp" 28 #include "interpreter/interpreter.hpp"
28 #include "memory/allocation.inline.hpp" 29 #include "memory/allocation.inline.hpp"
29 #include "memory/resourceArea.hpp" 30 #include "memory/resourceArea.hpp"
30 #include "memory/universe.inline.hpp" 31 #include "memory/universe.inline.hpp"
31 #include "oops/methodDataOop.hpp" 32 #include "oops/methodDataOop.hpp"
508 // 509 //
509 // This routine fills in the missing data for the skeletal interpreter frames 510 // This routine fills in the missing data for the skeletal interpreter frames
510 // in the above picture. 511 // in the above picture.
511 512
512 // Find the skeletal interpreter frames to unpack into 513 // Find the skeletal interpreter frames to unpack into
513 RegisterMap map(JavaThread::current(), false); 514 JavaThread* THREAD = JavaThread::current();
515 RegisterMap map(THREAD, false);
514 // Get the youngest frame we will unpack (last to be unpacked) 516 // Get the youngest frame we will unpack (last to be unpacked)
515 frame me = unpack_frame.sender(&map); 517 frame me = unpack_frame.sender(&map);
516 int index; 518 int index;
517 for (index = 0; index < frames(); index++ ) { 519 for (index = 0; index < frames(); index++ ) {
518 *element(index)->iframe() = me; 520 *element(index)->iframe() = me;
519 // Get the caller frame (possibly skeletal) 521 // Get the caller frame (possibly skeletal)
520 me = me.sender(&map); 522 me = me.sender(&map);
521 } 523 }
522 524
525 // Do the unpacking of interpreter frames; the frame at index 0 represents the top activation, so it has no callee
526 // Unpack the frames from the oldest (frames() -1) to the youngest (0)
523 frame caller_frame = me; 527 frame caller_frame = me;
524
525 // Do the unpacking of interpreter frames; the frame at index 0 represents the top activation, so it has no callee
526
527 // Unpack the frames from the oldest (frames() -1) to the youngest (0)
528
529 for (index = frames() - 1; index >= 0 ; index--) { 528 for (index = frames() - 1; index >= 0 ; index--) {
530 int callee_parameters = index == 0 ? 0 : element(index-1)->method()->size_of_parameters(); 529 vframeArrayElement* elem = element(index); // caller
531 int callee_locals = index == 0 ? 0 : element(index-1)->method()->max_locals(); 530 int callee_parameters, callee_locals;
532 element(index)->unpack_on_stack(caller_actual_parameters, 531 if (index == 0) {
533 callee_parameters, 532 callee_parameters = callee_locals = 0;
534 callee_locals, 533 } else {
535 &caller_frame, 534 methodHandle caller = elem->method();
536 index == 0, 535 methodHandle callee = element(index - 1)->method();
537 exec_mode); 536 Bytecode_invoke inv(caller, elem->bci());
537 // invokedynamic instructions don't have a class but obviously don't have a MemberName appendix.
538 // NOTE: Use machinery here that avoids resolving of any kind.
539 const bool has_member_arg =
540 !inv.is_invokedynamic() && MethodHandles::has_member_arg(inv.klass(), inv.name());
541 callee_parameters = callee->size_of_parameters() + (has_member_arg ? 1 : 0);
542 callee_locals = callee->max_locals();
543 }
544 elem->unpack_on_stack(caller_actual_parameters,
545 callee_parameters,
546 callee_locals,
547 &caller_frame,
548 index == 0,
549 exec_mode);
538 if (index == frames() - 1) { 550 if (index == frames() - 1) {
539 Deoptimization::unwind_callee_save_values(element(index)->iframe(), this); 551 Deoptimization::unwind_callee_save_values(elem->iframe(), this);
540 } 552 }
541 caller_frame = *element(index)->iframe(); 553 caller_frame = *elem->iframe();
542 caller_actual_parameters = callee_parameters; 554 caller_actual_parameters = callee_parameters;
543 } 555 }
544
545
546 deallocate_monitor_chunks(); 556 deallocate_monitor_chunks();
547 } 557 }
548 558
549 void vframeArray::deallocate_monitor_chunks() { 559 void vframeArray::deallocate_monitor_chunks() {
550 JavaThread* jt = JavaThread::current(); 560 JavaThread* jt = JavaThread::current();