1 /*
2 * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
572 JavaThread* THREAD = JavaThread::current();
573 RegisterMap map(THREAD, false);
574 // Get the youngest frame we will unpack (last to be unpacked)
575 frame me = unpack_frame.sender(&map);
576 int index;
577 for (index = 0; index < frames(); index++ ) {
578 *element(index)->iframe() = me;
579 // Get the caller frame (possibly skeletal)
580 me = me.sender(&map);
581 }
582
583 // Do the unpacking of interpreter frames; the frame at index 0 represents the top activation, so it has no callee
584 // Unpack the frames from the oldest (frames() -1) to the youngest (0)
585 frame* caller_frame = &me;
586 for (index = frames() - 1; index >= 0 ; index--) {
587 vframeArrayElement* elem = element(index); // caller
588 int callee_parameters, callee_locals;
589 if (index == 0) {
590 callee_parameters = callee_locals = 0;
591 } else {
592 methodHandle caller = elem->method();
593 methodHandle callee = element(index - 1)->method();
594 Bytecode_invoke inv(caller, elem->bci());
595 // invokedynamic instructions don't have a class but obviously don't have a MemberName appendix.
596 // NOTE: Use machinery here that avoids resolving of any kind.
597 const bool has_member_arg =
598 !inv.is_invokedynamic() && MethodHandles::has_member_arg(inv.klass(), inv.name());
599 callee_parameters = callee->size_of_parameters() + (has_member_arg ? 1 : 0);
600 callee_locals = callee->max_locals();
601 }
602 elem->unpack_on_stack(caller_actual_parameters,
603 callee_parameters,
604 callee_locals,
605 caller_frame,
606 index == 0,
607 index == frames() - 1,
608 exec_mode);
609 if (index == frames() - 1) {
610 Deoptimization::unwind_callee_save_values(elem->iframe(), this);
611 }
612 caller_frame = elem->iframe();
613 caller_actual_parameters = callee_parameters;
|
1 /*
2 * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
572 JavaThread* THREAD = JavaThread::current();
573 RegisterMap map(THREAD, false);
574 // Get the youngest frame we will unpack (last to be unpacked)
575 frame me = unpack_frame.sender(&map);
576 int index;
577 for (index = 0; index < frames(); index++ ) {
578 *element(index)->iframe() = me;
579 // Get the caller frame (possibly skeletal)
580 me = me.sender(&map);
581 }
582
583 // Do the unpacking of interpreter frames; the frame at index 0 represents the top activation, so it has no callee
584 // Unpack the frames from the oldest (frames() -1) to the youngest (0)
585 frame* caller_frame = &me;
586 for (index = frames() - 1; index >= 0 ; index--) {
587 vframeArrayElement* elem = element(index); // caller
588 int callee_parameters, callee_locals;
589 if (index == 0) {
590 callee_parameters = callee_locals = 0;
591 } else {
592 methodHandle caller(THREAD, elem->method());
593 methodHandle callee(THREAD, element(index - 1)->method());
594 Bytecode_invoke inv(caller, elem->bci());
595 // invokedynamic instructions don't have a class but obviously don't have a MemberName appendix.
596 // NOTE: Use machinery here that avoids resolving of any kind.
597 const bool has_member_arg =
598 !inv.is_invokedynamic() && MethodHandles::has_member_arg(inv.klass(), inv.name());
599 callee_parameters = callee->size_of_parameters() + (has_member_arg ? 1 : 0);
600 callee_locals = callee->max_locals();
601 }
602 elem->unpack_on_stack(caller_actual_parameters,
603 callee_parameters,
604 callee_locals,
605 caller_frame,
606 index == 0,
607 index == frames() - 1,
608 exec_mode);
609 if (index == frames() - 1) {
610 Deoptimization::unwind_callee_save_values(elem->iframe(), this);
611 }
612 caller_frame = elem->iframe();
613 caller_actual_parameters = callee_parameters;
|