Mercurial > hg > truffle
annotate src/cpu/ppc/vm/cppInterpreter_ppc.cpp @ 17831:876390ee9b6f
8039043: Implicit null check is in the wrong place in C1 -UseCompressedOops
Summary: Null check is placed in a wrong place when storing a null to an object field on x64 with compressed oops off
Reviewed-by: roland, vlivanov, kvn
author | iveresov |
---|---|
date | Wed, 02 Apr 2014 11:24:51 -0700 |
parents | fd1b9f02cc91 |
children | 92aa6797d639 63c5920a038d |
rev | line source |
---|---|
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1 /* |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3 * Copyright 2012, 2013 SAP AG. All rights reserved. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
5 * |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
6 * This code is free software; you can redistribute it and/or modify it |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
7 * under the terms of the GNU General Public License version 2 only, as |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
8 * published by the Free Software Foundation. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
9 * |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
10 * This code is distributed in the hope that it will be useful, but WITHOUT |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
13 * version 2 for more details (a copy is included in the LICENSE file that |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
14 * accompanied this code). |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
15 * |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
16 * You should have received a copy of the GNU General Public License version |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
17 * 2 along with this work; if not, write to the Free Software Foundation, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
19 * |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
21 * or visit www.oracle.com if you need additional information or have any |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
22 * questions. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
23 * |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
24 */ |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
25 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
26 #include "precompiled.hpp" |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
27 #include "asm/assembler.hpp" |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
28 #include "asm/macroAssembler.inline.hpp" |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
29 #include "interpreter/bytecodeHistogram.hpp" |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
30 #include "interpreter/cppInterpreter.hpp" |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
31 #include "interpreter/interpreter.hpp" |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
32 #include "interpreter/interpreterGenerator.hpp" |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
33 #include "interpreter/interpreterRuntime.hpp" |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
34 #include "oops/arrayOop.hpp" |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
35 #include "oops/methodData.hpp" |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
36 #include "oops/method.hpp" |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
37 #include "oops/oop.inline.hpp" |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
38 #include "prims/jvmtiExport.hpp" |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
39 #include "prims/jvmtiThreadState.hpp" |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
40 #include "runtime/arguments.hpp" |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
41 #include "runtime/deoptimization.hpp" |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
42 #include "runtime/frame.inline.hpp" |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
43 #include "runtime/interfaceSupport.hpp" |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
44 #include "runtime/sharedRuntime.hpp" |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
45 #include "runtime/stubRoutines.hpp" |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
46 #include "runtime/synchronizer.hpp" |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
47 #include "runtime/timer.hpp" |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
48 #include "runtime/vframeArray.hpp" |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
49 #include "utilities/debug.hpp" |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
50 #ifdef SHARK |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
51 #include "shark/shark_globals.hpp" |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
52 #endif |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
53 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
54 #ifdef CC_INTERP |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
55 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
56 #define __ _masm-> |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
57 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
58 // Contains is used for identifying interpreter frames during a stack-walk. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
59 // A frame with a PC in InterpretMethod must be identified as a normal C frame. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
60 bool CppInterpreter::contains(address pc) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
61 return _code->contains(pc); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
62 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
63 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
64 #ifdef PRODUCT |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
65 #define BLOCK_COMMENT(str) // nothing |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
66 #else |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
67 #define BLOCK_COMMENT(str) __ block_comment(str) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
68 #endif |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
69 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
70 #define BIND(label) bind(label); BLOCK_COMMENT(#label ":") |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
71 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
72 static address interpreter_frame_manager = NULL; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
73 static address frame_manager_specialized_return = NULL; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
74 static address native_entry = NULL; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
75 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
76 static address interpreter_return_address = NULL; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
77 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
78 static address unctrap_frame_manager_entry = NULL; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
79 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
80 static address deopt_frame_manager_return_atos = NULL; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
81 static address deopt_frame_manager_return_btos = NULL; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
82 static address deopt_frame_manager_return_itos = NULL; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
83 static address deopt_frame_manager_return_ltos = NULL; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
84 static address deopt_frame_manager_return_ftos = NULL; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
85 static address deopt_frame_manager_return_dtos = NULL; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
86 static address deopt_frame_manager_return_vtos = NULL; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
87 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
88 // A result handler converts/unboxes a native call result into |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
89 // a java interpreter/compiler result. The current frame is an |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
90 // interpreter frame. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
91 address CppInterpreterGenerator::generate_result_handler_for(BasicType type) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
92 return AbstractInterpreterGenerator::generate_result_handler_for(type); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
93 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
94 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
95 // tosca based result to c++ interpreter stack based result. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
96 address CppInterpreterGenerator::generate_tosca_to_stack_converter(BasicType type) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
97 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
98 // A result is in the native abi result register from a native |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
99 // method call. We need to return this result to the interpreter by |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
100 // pushing the result on the interpreter's stack. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
101 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
102 // Registers alive: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
103 // R3_ARG1(R3_RET)/F1_ARG1(F1_RET) - result to move |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
104 // R4_ARG2 - address of tos |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
105 // LR |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
106 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
107 // Registers updated: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
108 // R3_RET(R3_ARG1) - address of new tos (== R17_tos for T_VOID) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
109 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
110 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
111 int number_of_used_slots = 1; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
112 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
113 const Register tos = R4_ARG2; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
114 Label done; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
115 Label is_false; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
116 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
117 address entry = __ pc(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
118 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
119 switch (type) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
120 case T_BOOLEAN: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
121 __ cmpwi(CCR0, R3_RET, 0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
122 __ beq(CCR0, is_false); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
123 __ li(R3_RET, 1); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
124 __ stw(R3_RET, 0, tos); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
125 __ b(done); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
126 __ bind(is_false); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
127 __ li(R3_RET, 0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
128 __ stw(R3_RET, 0, tos); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
129 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
130 case T_BYTE: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
131 case T_CHAR: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
132 case T_SHORT: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
133 case T_INT: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
134 __ stw(R3_RET, 0, tos); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
135 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
136 case T_LONG: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
137 number_of_used_slots = 2; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
138 // mark unused slot for debugging |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
139 // long goes to topmost slot |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
140 __ std(R3_RET, -BytesPerWord, tos); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
141 __ li(R3_RET, 0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
142 __ std(R3_RET, 0, tos); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
143 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
144 case T_OBJECT: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
145 __ verify_oop(R3_RET); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
146 __ std(R3_RET, 0, tos); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
147 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
148 case T_FLOAT: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
149 __ stfs(F1_RET, 0, tos); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
150 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
151 case T_DOUBLE: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
152 number_of_used_slots = 2; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
153 // mark unused slot for debugging |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
154 __ li(R3_RET, 0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
155 __ std(R3_RET, 0, tos); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
156 // double goes to topmost slot |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
157 __ stfd(F1_RET, -BytesPerWord, tos); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
158 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
159 case T_VOID: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
160 number_of_used_slots = 0; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
161 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
162 default: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
163 ShouldNotReachHere(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
164 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
165 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
166 __ BIND(done); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
167 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
168 // new expression stack top |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
169 __ addi(R3_RET, tos, -BytesPerWord * number_of_used_slots); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
170 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
171 __ blr(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
172 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
173 return entry; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
174 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
175 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
176 address CppInterpreterGenerator::generate_stack_to_stack_converter(BasicType type) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
177 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
178 // Copy the result from the callee's stack to the caller's stack, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
179 // caller and callee both being interpreted. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
180 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
181 // Registers alive |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
182 // R3_ARG1 - address of callee's tos + BytesPerWord |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
183 // R4_ARG2 - address of caller's tos [i.e. free location] |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
184 // LR |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
185 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
186 // stack grows upwards, memory grows downwards. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
187 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
188 // [ free ] <-- callee's tos |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
189 // [ optional result ] <-- R3_ARG1 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
190 // [ optional dummy ] |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
191 // ... |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
192 // [ free ] <-- caller's tos, R4_ARG2 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
193 // ... |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
194 // Registers updated |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
195 // R3_RET(R3_ARG1) - address of caller's new tos |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
196 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
197 // stack grows upwards, memory grows downwards. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
198 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
199 // [ free ] <-- current tos, R3_RET |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
200 // [ optional result ] |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
201 // [ optional dummy ] |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
202 // ... |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
203 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
204 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
205 const Register from = R3_ARG1; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
206 const Register ret = R3_ARG1; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
207 const Register tos = R4_ARG2; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
208 const Register tmp1 = R21_tmp1; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
209 const Register tmp2 = R22_tmp2; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
210 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
211 address entry = __ pc(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
212 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
213 switch (type) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
214 case T_BOOLEAN: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
215 case T_BYTE: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
216 case T_CHAR: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
217 case T_SHORT: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
218 case T_INT: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
219 case T_FLOAT: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
220 __ lwz(tmp1, 0, from); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
221 __ stw(tmp1, 0, tos); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
222 // New expression stack top. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
223 __ addi(ret, tos, - BytesPerWord); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
224 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
225 case T_LONG: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
226 case T_DOUBLE: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
227 // Move both entries for debug purposes even though only one is live. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
228 __ ld(tmp1, BytesPerWord, from); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
229 __ ld(tmp2, 0, from); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
230 __ std(tmp1, 0, tos); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
231 __ std(tmp2, -BytesPerWord, tos); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
232 // New expression stack top. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
233 __ addi(ret, tos, - 2 * BytesPerWord); // two slots |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
234 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
235 case T_OBJECT: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
236 __ ld(tmp1, 0, from); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
237 __ verify_oop(tmp1); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
238 __ std(tmp1, 0, tos); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
239 // New expression stack top. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
240 __ addi(ret, tos, - BytesPerWord); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
241 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
242 case T_VOID: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
243 // New expression stack top. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
244 __ mr(ret, tos); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
245 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
246 default: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
247 ShouldNotReachHere(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
248 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
249 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
250 __ blr(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
251 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
252 return entry; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
253 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
254 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
255 address CppInterpreterGenerator::generate_stack_to_native_abi_converter(BasicType type) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
256 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
257 // Load a result from the callee's stack into the caller's expecting |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
258 // return register, callee being interpreted, caller being call stub |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
259 // or jit code. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
260 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
261 // Registers alive |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
262 // R3_ARG1 - callee expression tos + BytesPerWord |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
263 // LR |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
264 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
265 // stack grows upwards, memory grows downwards. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
266 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
267 // [ free ] <-- callee's tos |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
268 // [ optional result ] <-- R3_ARG1 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
269 // [ optional dummy ] |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
270 // ... |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
271 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
272 // Registers updated |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
273 // R3_RET(R3_ARG1)/F1_RET - result |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
274 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
275 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
276 const Register from = R3_ARG1; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
277 const Register ret = R3_ARG1; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
278 const FloatRegister fret = F1_ARG1; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
279 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
280 address entry = __ pc(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
281 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
282 // Implemented uniformly for both kinds of endianness. The interpreter |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
283 // implements boolean, byte, char, and short as jint (4 bytes). |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
284 switch (type) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
285 case T_BOOLEAN: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
286 case T_CHAR: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
287 // zero extension |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
288 __ lwz(ret, 0, from); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
289 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
290 case T_BYTE: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
291 case T_SHORT: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
292 case T_INT: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
293 // sign extension |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
294 __ lwa(ret, 0, from); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
295 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
296 case T_LONG: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
297 __ ld(ret, 0, from); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
298 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
299 case T_OBJECT: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
300 __ ld(ret, 0, from); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
301 __ verify_oop(ret); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
302 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
303 case T_FLOAT: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
304 __ lfs(fret, 0, from); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
305 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
306 case T_DOUBLE: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
307 __ lfd(fret, 0, from); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
308 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
309 case T_VOID: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
310 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
311 default: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
312 ShouldNotReachHere(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
313 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
314 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
315 __ blr(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
316 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
317 return entry; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
318 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
319 |
14426
600acc4b8b1e
8027969: Adapt PPC to 8026328: Setting a breakpoint on invokedynamic crashes the JVM
goetz
parents:
14408
diff
changeset
|
320 address CppInterpreter::return_entry(TosState state, int length, Bytecodes::Code code) { |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
321 assert(interpreter_return_address != NULL, "Not initialized"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
322 return interpreter_return_address; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
323 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
324 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
325 address CppInterpreter::deopt_entry(TosState state, int length) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
326 address ret = NULL; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
327 if (length != 0) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
328 switch (state) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
329 case atos: ret = deopt_frame_manager_return_atos; break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
330 case btos: ret = deopt_frame_manager_return_itos; break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
331 case ctos: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
332 case stos: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
333 case itos: ret = deopt_frame_manager_return_itos; break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
334 case ltos: ret = deopt_frame_manager_return_ltos; break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
335 case ftos: ret = deopt_frame_manager_return_ftos; break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
336 case dtos: ret = deopt_frame_manager_return_dtos; break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
337 case vtos: ret = deopt_frame_manager_return_vtos; break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
338 default: ShouldNotReachHere(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
339 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
340 } else { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
341 ret = unctrap_frame_manager_entry; // re-execute the bytecode (e.g. uncommon trap, popframe) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
342 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
343 assert(ret != NULL, "Not initialized"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
344 return ret; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
345 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
346 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
347 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
348 // Helpers for commoning out cases in the various type of method entries. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
349 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
350 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
351 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
352 // Registers alive |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
353 // R16_thread - JavaThread* |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
354 // R1_SP - old stack pointer |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
355 // R19_method - callee's Method |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
356 // R17_tos - address of caller's tos (prepushed) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
357 // R15_prev_state - address of caller's BytecodeInterpreter or 0 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
358 // return_pc in R21_tmp15 (only when called within generate_native_entry) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
359 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
360 // Registers updated |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
361 // R14_state - address of callee's interpreter state |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
362 // R1_SP - new stack pointer |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
363 // CCR4_is_synced - current method is synchronized |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
364 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
365 void CppInterpreterGenerator::generate_compute_interpreter_state(Label& stack_overflow_return) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
366 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
367 // Stack layout at this point: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
368 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
369 // F1 [TOP_IJAVA_FRAME_ABI] <-- R1_SP |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
370 // alignment (optional) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
371 // [F1's outgoing Java arguments] <-- R17_tos |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
372 // ... |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
373 // F2 [PARENT_IJAVA_FRAME_ABI] |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
374 // ... |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
375 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
376 //============================================================================= |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
377 // Allocate space for locals other than the parameters, the |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
378 // interpreter state, monitors, and the expression stack. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
379 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
380 const Register local_count = R21_tmp1; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
381 const Register parameter_count = R22_tmp2; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
382 const Register max_stack = R23_tmp3; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
383 // Must not be overwritten within this method! |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
384 // const Register return_pc = R29_tmp9; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
385 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
386 const ConditionRegister is_synced = CCR4_is_synced; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
387 const ConditionRegister is_native = CCR6; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
388 const ConditionRegister is_static = CCR7; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
389 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
390 assert(is_synced != is_native, "condition code registers must be distinct"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
391 assert(is_synced != is_static, "condition code registers must be distinct"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
392 assert(is_native != is_static, "condition code registers must be distinct"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
393 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
394 { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
395 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
396 // Local registers |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
397 const Register top_frame_size = R24_tmp4; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
398 const Register access_flags = R25_tmp5; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
399 const Register state_offset = R26_tmp6; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
400 Register mem_stack_limit = R27_tmp7; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
401 const Register page_size = R28_tmp8; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
402 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
403 BLOCK_COMMENT("compute_interpreter_state {"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
404 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
405 // access_flags = method->access_flags(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
406 // TODO: PPC port: assert(4 == methodOopDesc::sz_access_flags(), "unexpected field size"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
407 __ lwa(access_flags, method_(access_flags)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
408 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
409 // parameter_count = method->constMethod->size_of_parameters(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
410 // TODO: PPC port: assert(2 == ConstMethod::sz_size_of_parameters(), "unexpected field size"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
411 __ ld(max_stack, in_bytes(Method::const_offset()), R19_method); // Max_stack holds constMethod for a while. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
412 __ lhz(parameter_count, in_bytes(ConstMethod::size_of_parameters_offset()), max_stack); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
413 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
414 // local_count = method->constMethod()->max_locals(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
415 // TODO: PPC port: assert(2 == ConstMethod::sz_max_locals(), "unexpected field size"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
416 __ lhz(local_count, in_bytes(ConstMethod::size_of_locals_offset()), max_stack); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
417 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
418 // max_stack = method->constMethod()->max_stack(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
419 // TODO: PPC port: assert(2 == ConstMethod::sz_max_stack(), "unexpected field size"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
420 __ lhz(max_stack, in_bytes(ConstMethod::max_stack_offset()), max_stack); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
421 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
422 if (EnableInvokeDynamic) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
423 // Take into account 'extra_stack_entries' needed by method handles (see method.hpp). |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
424 __ addi(max_stack, max_stack, Method::extra_stack_entries()); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
425 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
426 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
427 // mem_stack_limit = thread->stack_limit(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
428 __ ld(mem_stack_limit, thread_(stack_overflow_limit)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
429 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
430 // Point locals at the first argument. Method's locals are the |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
431 // parameters on top of caller's expression stack. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
432 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
433 // tos points past last Java argument |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
434 __ sldi(R18_locals, parameter_count, Interpreter::logStackElementSize); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
435 __ add(R18_locals, R17_tos, R18_locals); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
436 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
437 // R18_locals - i*BytesPerWord points to i-th Java local (i starts at 0) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
438 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
439 // Set is_native, is_synced, is_static - will be used later. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
440 __ testbitdi(is_native, R0, access_flags, JVM_ACC_NATIVE_BIT); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
441 __ testbitdi(is_synced, R0, access_flags, JVM_ACC_SYNCHRONIZED_BIT); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
442 assert(is_synced->is_nonvolatile(), "is_synced must be non-volatile"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
443 __ testbitdi(is_static, R0, access_flags, JVM_ACC_STATIC_BIT); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
444 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
445 // PARENT_IJAVA_FRAME_ABI |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
446 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
447 // frame_size = |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
448 // round_to((local_count - parameter_count)*BytesPerWord + |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
449 // 2*BytesPerWord + |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
450 // alignment + |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
451 // frame::interpreter_frame_cinterpreterstate_size_in_bytes() |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
452 // sizeof(PARENT_IJAVA_FRAME_ABI) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
453 // method->is_synchronized() ? sizeof(BasicObjectLock) : 0 + |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
454 // max_stack*BytesPerWord, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
455 // 16) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
456 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
457 // Note that this calculation is exactly mirrored by |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
458 // AbstractInterpreter::layout_activation_impl() [ and |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
459 // AbstractInterpreter::size_activation() ]. Which is used by |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
460 // deoptimization so that it can allocate the proper sized |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
461 // frame. This only happens for interpreted frames so the extra |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
462 // notes below about max_stack below are not important. The other |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
463 // thing to note is that for interpreter frames other than the |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
464 // current activation the size of the stack is the size of the live |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
465 // portion of the stack at the particular bcp and NOT the maximum |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
466 // stack that the method might use. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
467 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
468 // If we're calling a native method, we replace max_stack (which is |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
469 // zero) with space for the worst-case signature handler varargs |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
470 // vector, which is: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
471 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
472 // max_stack = max(Argument::n_register_parameters, parameter_count+2); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
473 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
474 // We add two slots to the parameter_count, one for the jni |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
475 // environment and one for a possible native mirror. We allocate |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
476 // space for at least the number of ABI registers, even though |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
477 // InterpreterRuntime::slow_signature_handler won't write more than |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
478 // parameter_count+2 words when it creates the varargs vector at the |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
479 // top of the stack. The generated slow signature handler will just |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
480 // load trash into registers beyond the necessary number. We're |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
481 // still going to cut the stack back by the ABI register parameter |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
482 // count so as to get SP+16 pointing at the ABI outgoing parameter |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
483 // area, so we need to allocate at least that much even though we're |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
484 // going to throw it away. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
485 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
486 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
487 // Adjust max_stack for native methods: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
488 Label skip_native_calculate_max_stack; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
489 __ bfalse(is_native, skip_native_calculate_max_stack); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
490 // if (is_native) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
491 // max_stack = max(Argument::n_register_parameters, parameter_count+2); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
492 __ addi(max_stack, parameter_count, 2*Interpreter::stackElementWords); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
493 __ cmpwi(CCR0, max_stack, Argument::n_register_parameters); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
494 __ bge(CCR0, skip_native_calculate_max_stack); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
495 __ li(max_stack, Argument::n_register_parameters); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
496 // } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
497 __ bind(skip_native_calculate_max_stack); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
498 // max_stack is now in bytes |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
499 __ slwi(max_stack, max_stack, Interpreter::logStackElementSize); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
500 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
501 // Calculate number of non-parameter locals (in slots): |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
502 Label not_java; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
503 __ btrue(is_native, not_java); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
504 // if (!is_native) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
505 // local_count = non-parameter local count |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
506 __ sub(local_count, local_count, parameter_count); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
507 // } else { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
508 // // nothing to do: method->max_locals() == 0 for native methods |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
509 // } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
510 __ bind(not_java); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
511 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
512 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
513 // Calculate top_frame_size and parent_frame_resize. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
514 { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
515 const Register parent_frame_resize = R12_scratch2; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
516 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
517 BLOCK_COMMENT("Compute top_frame_size."); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
518 // top_frame_size = TOP_IJAVA_FRAME_ABI |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
519 // + size of interpreter state |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
520 __ li(top_frame_size, frame::top_ijava_frame_abi_size |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
521 + frame::interpreter_frame_cinterpreterstate_size_in_bytes()); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
522 // + max_stack |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
523 __ add(top_frame_size, top_frame_size, max_stack); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
524 // + stack slots for a BasicObjectLock for synchronized methods |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
525 { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
526 Label not_synced; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
527 __ bfalse(is_synced, not_synced); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
528 __ addi(top_frame_size, top_frame_size, frame::interpreter_frame_monitor_size_in_bytes()); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
529 __ bind(not_synced); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
530 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
531 // align |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
532 __ round_to(top_frame_size, frame::alignment_in_bytes); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
533 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
534 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
535 BLOCK_COMMENT("Compute parent_frame_resize."); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
536 // parent_frame_resize = R1_SP - R17_tos |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
537 __ sub(parent_frame_resize, R1_SP, R17_tos); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
538 //__ li(parent_frame_resize, 0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
539 // + PARENT_IJAVA_FRAME_ABI |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
540 // + extra two slots for the no-parameter/no-locals |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
541 // method result |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
542 __ addi(parent_frame_resize, parent_frame_resize, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
543 frame::parent_ijava_frame_abi_size |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
544 + 2*Interpreter::stackElementSize); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
545 // + (locals_count - params_count) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
546 __ sldi(R0, local_count, Interpreter::logStackElementSize); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
547 __ add(parent_frame_resize, parent_frame_resize, R0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
548 // align |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
549 __ round_to(parent_frame_resize, frame::alignment_in_bytes); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
550 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
551 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
552 // Stack layout at this point: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
553 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
554 // The new frame F0 hasn't yet been pushed, F1 is still the top frame. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
555 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
556 // F0 [TOP_IJAVA_FRAME_ABI] |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
557 // alignment (optional) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
558 // [F0's full operand stack] |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
559 // [F0's monitors] (optional) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
560 // [F0's BytecodeInterpreter object] |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
561 // F1 [PARENT_IJAVA_FRAME_ABI] |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
562 // alignment (optional) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
563 // [F0's Java result] |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
564 // [F0's non-arg Java locals] |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
565 // [F1's outgoing Java arguments] <-- R17_tos |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
566 // ... |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
567 // F2 [PARENT_IJAVA_FRAME_ABI] |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
568 // ... |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
569 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
570 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
571 // Calculate new R14_state |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
572 // and |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
573 // test that the new memory stack pointer is above the limit, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
574 // throw a StackOverflowError otherwise. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
575 __ sub(R11_scratch1/*F1's SP*/, R1_SP, parent_frame_resize); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
576 __ addi(R14_state, R11_scratch1/*F1's SP*/, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
577 -frame::interpreter_frame_cinterpreterstate_size_in_bytes()); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
578 __ sub(R11_scratch1/*F0's SP*/, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
579 R11_scratch1/*F1's SP*/, top_frame_size); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
580 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
581 BLOCK_COMMENT("Test for stack overflow:"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
582 __ cmpld(CCR0/*is_stack_overflow*/, R11_scratch1, mem_stack_limit); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
583 __ blt(CCR0/*is_stack_overflow*/, stack_overflow_return); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
584 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
585 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
586 //============================================================================= |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
587 // Frame_size doesn't overflow the stack. Allocate new frame and |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
588 // initialize interpreter state. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
589 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
590 // Register state |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
591 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
592 // R15 - local_count |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
593 // R16 - parameter_count |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
594 // R17 - max_stack |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
595 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
596 // R18 - frame_size |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
597 // R19 - access_flags |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
598 // CCR4_is_synced - is_synced |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
599 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
600 // GR_Lstate - pointer to the uninitialized new BytecodeInterpreter. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
601 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
602 // _last_Java_pc just needs to be close enough that we can identify |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
603 // the frame as an interpreted frame. It does not need to be the |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
604 // exact return address from either calling |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
605 // BytecodeInterpreter::InterpretMethod or the call to a jni native method. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
606 // So we can initialize it here with a value of a bundle in this |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
607 // code fragment. We only do this initialization for java frames |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
608 // where InterpretMethod needs a a way to get a good pc value to |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
609 // store in the thread state. For interpreter frames used to call |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
610 // jni native code we just zero the value in the state and move an |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
611 // ip as needed in the native entry code. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
612 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
613 // const Register last_Java_pc_addr = GR24_SCRATCH; // QQQ 27 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
614 // const Register last_Java_pc = GR26_SCRATCH; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
615 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
616 // Must reference stack before setting new SP since Windows |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
617 // will not be able to deliver the exception on a bad SP. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
618 // Windows also insists that we bang each page one at a time in order |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
619 // for the OS to map in the reserved pages. If we bang only |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
620 // the final page, Windows stops delivering exceptions to our |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
621 // VectoredExceptionHandler and terminates our program. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
622 // Linux only requires a single bang but it's rare to have |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
623 // to bang more than 1 page so the code is enabled for both OS's. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
624 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
625 // BANG THE STACK |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
626 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
627 // Nothing to do for PPC, because updating the SP will automatically |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
628 // bang the page. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
629 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
630 // Up to here we have calculated the delta for the new C-frame and |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
631 // checked for a stack-overflow. Now we can savely update SP and |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
632 // resize the C-frame. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
633 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
634 // R14_state has already been calculated. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
635 __ push_interpreter_frame(top_frame_size, parent_frame_resize, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
636 R25_tmp5, R26_tmp6, R27_tmp7, R28_tmp8); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
637 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
638 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
639 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
640 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
641 // Stack layout at this point: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
642 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
643 // F0 has been been pushed! |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
644 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
645 // F0 [TOP_IJAVA_FRAME_ABI] <-- R1_SP |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
646 // alignment (optional) (now it's here, if required) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
647 // [F0's full operand stack] |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
648 // [F0's monitors] (optional) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
649 // [F0's BytecodeInterpreter object] |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
650 // F1 [PARENT_IJAVA_FRAME_ABI] |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
651 // alignment (optional) (now it's here, if required) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
652 // [F0's Java result] |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
653 // [F0's non-arg Java locals] |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
654 // [F1's outgoing Java arguments] |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
655 // ... |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
656 // F2 [PARENT_IJAVA_FRAME_ABI] |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
657 // ... |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
658 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
659 // R14_state points to F0's BytecodeInterpreter object. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
660 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
661 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
662 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
663 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
664 //============================================================================= |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
665 // new BytecodeInterpreter-object is save, let's initialize it: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
666 BLOCK_COMMENT("New BytecodeInterpreter-object is save."); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
667 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
668 { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
669 // Locals |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
670 const Register bytecode_addr = R24_tmp4; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
671 const Register constants = R25_tmp5; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
672 const Register tos = R26_tmp6; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
673 const Register stack_base = R27_tmp7; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
674 const Register local_addr = R28_tmp8; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
675 { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
676 Label L; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
677 __ btrue(is_native, L); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
678 // if (!is_native) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
679 // bytecode_addr = constMethod->codes(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
680 __ ld(bytecode_addr, method_(const)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
681 __ addi(bytecode_addr, bytecode_addr, in_bytes(ConstMethod::codes_offset())); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
682 // } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
683 __ bind(L); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
684 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
685 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
686 __ ld(constants, in_bytes(Method::const_offset()), R19_method); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
687 __ ld(constants, in_bytes(ConstMethod::constants_offset()), constants); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
688 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
689 // state->_prev_link = prev_state; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
690 __ std(R15_prev_state, state_(_prev_link)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
691 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
692 // For assertions only. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
693 // TODO: not needed anyway because it coincides with `_monitor_base'. remove! |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
694 // state->_self_link = state; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
695 DEBUG_ONLY(__ std(R14_state, state_(_self_link));) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
696 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
697 // state->_thread = thread; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
698 __ std(R16_thread, state_(_thread)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
699 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
700 // state->_method = method; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
701 __ std(R19_method, state_(_method)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
702 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
703 // state->_locals = locals; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
704 __ std(R18_locals, state_(_locals)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
705 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
706 // state->_oop_temp = NULL; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
707 __ li(R0, 0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
708 __ std(R0, state_(_oop_temp)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
709 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
710 // state->_last_Java_fp = *R1_SP // Use *R1_SP as fp |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
711 __ ld(R0, _abi(callers_sp), R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
712 __ std(R0, state_(_last_Java_fp)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
713 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
714 BLOCK_COMMENT("load Stack base:"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
715 { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
716 // Stack_base. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
717 // if (!method->synchronized()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
718 // stack_base = state; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
719 // } else { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
720 // stack_base = (uintptr_t)state - sizeof(BasicObjectLock); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
721 // } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
722 Label L; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
723 __ mr(stack_base, R14_state); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
724 __ bfalse(is_synced, L); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
725 __ addi(stack_base, stack_base, -frame::interpreter_frame_monitor_size_in_bytes()); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
726 __ bind(L); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
727 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
728 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
729 // state->_mdx = NULL; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
730 __ li(R0, 0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
731 __ std(R0, state_(_mdx)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
732 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
733 { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
734 // if (method->is_native()) state->_bcp = NULL; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
735 // else state->_bcp = bytecode_addr; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
736 Label label1, label2; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
737 __ bfalse(is_native, label1); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
738 __ std(R0, state_(_bcp)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
739 __ b(label2); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
740 __ bind(label1); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
741 __ std(bytecode_addr, state_(_bcp)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
742 __ bind(label2); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
743 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
744 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
745 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
746 // state->_result._to_call._callee = NULL; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
747 __ std(R0, state_(_result._to_call._callee)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
748 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
749 // state->_monitor_base = state; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
750 __ std(R14_state, state_(_monitor_base)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
751 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
752 // state->_msg = BytecodeInterpreter::method_entry; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
753 __ li(R0, BytecodeInterpreter::method_entry); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
754 __ stw(R0, state_(_msg)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
755 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
756 // state->_last_Java_sp = R1_SP; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
757 __ std(R1_SP, state_(_last_Java_sp)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
758 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
759 // state->_stack_base = stack_base; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
760 __ std(stack_base, state_(_stack_base)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
761 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
762 // tos = stack_base - 1 slot (prepushed); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
763 // state->_stack.Tos(tos); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
764 __ addi(tos, stack_base, - Interpreter::stackElementSize); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
765 __ std(tos, state_(_stack)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
766 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
767 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
768 { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
769 BLOCK_COMMENT("get last_Java_pc:"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
770 // if (!is_native) state->_last_Java_pc = <some_ip_in_this_code_buffer>; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
771 // else state->_last_Java_pc = NULL; (just for neatness) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
772 Label label1, label2; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
773 __ btrue(is_native, label1); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
774 __ get_PC_trash_LR(R0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
775 __ std(R0, state_(_last_Java_pc)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
776 __ b(label2); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
777 __ bind(label1); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
778 __ li(R0, 0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
779 __ std(R0, state_(_last_Java_pc)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
780 __ bind(label2); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
781 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
782 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
783 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
784 // stack_limit = tos - max_stack; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
785 __ sub(R0, tos, max_stack); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
786 // state->_stack_limit = stack_limit; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
787 __ std(R0, state_(_stack_limit)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
788 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
789 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
790 // cache = method->constants()->cache(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
791 __ ld(R0, ConstantPool::cache_offset_in_bytes(), constants); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
792 // state->_constants = method->constants()->cache(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
793 __ std(R0, state_(_constants)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
794 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
795 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
796 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
797 //============================================================================= |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
798 // synchronized method, allocate and initialize method object lock. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
799 // if (!method->is_synchronized()) goto fill_locals_with_0x0s; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
800 Label fill_locals_with_0x0s; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
801 __ bfalse(is_synced, fill_locals_with_0x0s); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
802 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
803 // pool_holder = method->constants()->pool_holder(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
804 const int mirror_offset = in_bytes(Klass::java_mirror_offset()); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
805 { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
806 Label label1, label2; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
807 // lockee = NULL; for java methods, correct value will be inserted in BytecodeInterpretMethod.hpp |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
808 __ li(R0,0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
809 __ bfalse(is_native, label2); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
810 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
811 __ bfalse(is_static, label1); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
812 // if (method->is_static()) lockee = |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
813 // pool_holder->klass_part()->java_mirror(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
814 __ ld(R11_scratch1/*pool_holder*/, ConstantPool::pool_holder_offset_in_bytes(), constants); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
815 __ ld(R0/*lockee*/, mirror_offset, R11_scratch1/*pool_holder*/); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
816 __ b(label2); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
817 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
818 __ bind(label1); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
819 // else lockee = *(oop*)locals; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
820 __ ld(R0/*lockee*/, 0, R18_locals); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
821 __ bind(label2); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
822 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
823 // monitor->set_obj(lockee); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
824 __ std(R0/*lockee*/, BasicObjectLock::obj_offset_in_bytes(), stack_base); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
825 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
826 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
827 // See if we need to zero the locals |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
828 __ BIND(fill_locals_with_0x0s); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
829 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
830 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
831 //============================================================================= |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
832 // fill locals with 0x0s |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
833 Label locals_zeroed; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
834 __ btrue(is_native, locals_zeroed); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
835 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
836 if (true /* zerolocals */ || ClearInterpreterLocals) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
837 // local_count is already num_locals_slots - num_param_slots |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
838 __ sldi(R0, parameter_count, Interpreter::logStackElementSize); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
839 __ sub(local_addr, R18_locals, R0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
840 __ cmpdi(CCR0, local_count, 0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
841 __ ble(CCR0, locals_zeroed); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
842 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
843 __ mtctr(local_count); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
844 //__ ld_const_addr(R0, (address) 0xcafe0000babe); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
845 __ li(R0, 0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
846 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
847 Label zero_slot; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
848 __ bind(zero_slot); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
849 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
850 // first local is at local_addr |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
851 __ std(R0, 0, local_addr); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
852 __ addi(local_addr, local_addr, -BytesPerWord); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
853 __ bdnz(zero_slot); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
854 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
855 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
856 __ BIND(locals_zeroed); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
857 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
858 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
859 BLOCK_COMMENT("} compute_interpreter_state"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
860 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
861 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
862 // Generate code to initiate compilation on invocation counter overflow. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
863 void CppInterpreterGenerator::generate_counter_overflow(Label& continue_entry) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
864 // Registers alive |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
865 // R14_state |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
866 // R16_thread |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
867 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
868 // Registers updated |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
869 // R14_state |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
870 // R3_ARG1 (=R3_RET) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
871 // R4_ARG2 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
872 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
873 // After entering the vm we remove the activation and retry the |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
874 // entry point in case the compilation is complete. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
875 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
876 // InterpreterRuntime::frequency_counter_overflow takes one argument |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
877 // that indicates if the counter overflow occurs at a backwards |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
878 // branch (NULL bcp). We pass zero. The call returns the address |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
879 // of the verified entry point for the method or NULL if the |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
880 // compilation did not complete (either went background or bailed |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
881 // out). |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
882 __ li(R4_ARG2, 0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
883 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
884 // Pass false to call_VM so it doesn't check for pending exceptions, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
885 // since at this point in the method invocation the exception |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
886 // handler would try to exit the monitor of synchronized methods |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
887 // which haven't been entered yet. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
888 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
889 // Returns verified_entry_point or NULL, we don't care which. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
890 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
891 // Do not use the variant `frequency_counter_overflow' that returns |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
892 // a structure, because this will change the argument list by a |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
893 // hidden parameter (gcc 4.1). |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
894 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
895 __ call_VM(noreg, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
896 CAST_FROM_FN_PTR(address, InterpreterRuntime::frequency_counter_overflow), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
897 R4_ARG2, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
898 false); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
899 // Returns verified_entry_point or NULL, we don't care which as we ignore it |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
900 // and run interpreted. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
901 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
902 // Reload method, it may have moved. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
903 __ ld(R19_method, state_(_method)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
904 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
905 // We jump now to the label "continue_after_compile". |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
906 __ b(continue_entry); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
907 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
908 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
909 // Increment invocation count and check for overflow. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
910 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
911 // R19_method must contain Method* of method to profile. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
912 void CppInterpreterGenerator::generate_counter_incr(Label& overflow) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
913 Label done; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
914 const Register Rcounters = R12_scratch2; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
915 const Register iv_be_count = R11_scratch1; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
916 const Register invocation_limit = R12_scratch2; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
917 const Register invocation_limit_addr = invocation_limit; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
918 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
919 // Load and ev. allocate MethodCounters object. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
920 __ get_method_counters(R19_method, Rcounters, done); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
921 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
922 // Update standard invocation counters. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
923 __ increment_invocation_counter(Rcounters, iv_be_count, R0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
924 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
925 // Compare against limit. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
926 BLOCK_COMMENT("Compare counter against limit:"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
927 assert(4 == sizeof(InvocationCounter::InterpreterInvocationLimit), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
928 "must be 4 bytes"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
929 __ load_const(invocation_limit_addr, (address)&InvocationCounter::InterpreterInvocationLimit); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
930 __ lwa(invocation_limit, 0, invocation_limit_addr); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
931 __ cmpw(CCR0, iv_be_count, invocation_limit); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
932 __ bge(CCR0, overflow); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
933 __ bind(done); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
934 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
935 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
936 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
937 // Call a JNI method. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
938 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
939 // Interpreter stub for calling a native method. (C++ interpreter) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
940 // This sets up a somewhat different looking stack for calling the native method |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
941 // than the typical interpreter frame setup. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
942 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
943 address CppInterpreterGenerator::generate_native_entry(void) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
944 if (native_entry != NULL) return native_entry; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
945 address entry = __ pc(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
946 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
947 // Read |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
948 // R16_thread |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
949 // R15_prev_state - address of caller's BytecodeInterpreter, if this snippet |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
950 // gets called by the frame manager. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
951 // R19_method - callee's Method |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
952 // R17_tos - address of caller's tos |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
953 // R1_SP - caller's stack pointer |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
954 // R21_sender_SP - initial caller sp |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
955 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
956 // Update |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
957 // R14_state - address of caller's BytecodeInterpreter |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
958 // R3_RET - integer result, if any. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
959 // F1_RET - float result, if any. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
960 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
961 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
962 // Stack layout at this point: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
963 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
964 // 0 [TOP_IJAVA_FRAME_ABI] <-- R1_SP |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
965 // alignment (optional) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
966 // [outgoing Java arguments] <-- R17_tos |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
967 // ... |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
968 // PARENT [PARENT_IJAVA_FRAME_ABI] |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
969 // ... |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
970 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
971 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
972 const bool inc_counter = UseCompiler || CountCompiledCalls; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
973 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
974 const Register signature_handler_fd = R21_tmp1; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
975 const Register pending_exception = R22_tmp2; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
976 const Register result_handler_addr = R23_tmp3; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
977 const Register native_method_fd = R24_tmp4; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
978 const Register access_flags = R25_tmp5; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
979 const Register active_handles = R26_tmp6; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
980 const Register sync_state = R27_tmp7; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
981 const Register sync_state_addr = sync_state; // Address is dead after use. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
982 const Register suspend_flags = R24_tmp4; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
983 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
984 const Register return_pc = R28_tmp8; // Register will be locked for some time. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
985 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
986 const ConditionRegister is_synced = CCR4_is_synced; // Live-on-exit from compute_interpreter_state. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
987 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
988 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
989 // R1_SP still points to caller's SP at this point. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
990 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
991 // Save initial_caller_sp to caller's abi. The caller frame must be |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
992 // resized before returning to get rid of the c2i arguments (if |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
993 // any). |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
994 // Override the saved SP with the senderSP so we can pop c2i |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
995 // arguments (if any) off when we return |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
996 __ std(R21_sender_SP, _top_ijava_frame_abi(initial_caller_sp), R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
997 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
998 // Save LR to caller's frame. We don't use _abi(lr) here, because it is not safe. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
999 __ mflr(return_pc); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1000 __ std(return_pc, _top_ijava_frame_abi(frame_manager_lr), R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1001 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1002 assert(return_pc->is_nonvolatile(), "return_pc must be a non-volatile register"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1003 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1004 __ verify_method_ptr(R19_method); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1005 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1006 //============================================================================= |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1007 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1008 // If this snippet gets called by the frame manager (at label |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1009 // `call_special'), then R15_prev_state is valid. If this snippet |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1010 // is not called by the frame manager, but e.g. by the call stub or |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1011 // by compiled code, then R15_prev_state is invalid. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1012 { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1013 // Set R15_prev_state to 0 if we don't return to the frame |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1014 // manager; we will return to the call_stub or to compiled code |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1015 // instead. If R15_prev_state is 0 there will be only one |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1016 // interpreter frame (we will set this up later) in this C frame! |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1017 // So we must take care about retrieving prev_state_(_prev_link) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1018 // and restoring R1_SP when popping that interpreter. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1019 Label prev_state_is_valid; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1020 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1021 __ load_const(R11_scratch1/*frame_manager_returnpc_addr*/, (address)&frame_manager_specialized_return); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1022 __ ld(R12_scratch2/*frame_manager_returnpc*/, 0, R11_scratch1/*frame_manager_returnpc_addr*/); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1023 __ cmpd(CCR0, return_pc, R12_scratch2/*frame_manager_returnpc*/); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1024 __ beq(CCR0, prev_state_is_valid); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1025 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1026 __ li(R15_prev_state, 0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1027 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1028 __ BIND(prev_state_is_valid); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1029 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1030 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1031 //============================================================================= |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1032 // Allocate new frame and initialize interpreter state. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1033 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1034 Label exception_return; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1035 Label exception_return_sync_check; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1036 Label stack_overflow_return; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1037 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1038 // Generate new interpreter state and jump to stack_overflow_return in case of |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1039 // a stack overflow. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1040 generate_compute_interpreter_state(stack_overflow_return); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1041 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1042 //============================================================================= |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1043 // Increment invocation counter. On overflow, entry to JNI method |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1044 // will be compiled. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1045 Label invocation_counter_overflow; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1046 if (inc_counter) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1047 generate_counter_incr(invocation_counter_overflow); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1048 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1049 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1050 Label continue_after_compile; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1051 __ BIND(continue_after_compile); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1052 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1053 // access_flags = method->access_flags(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1054 // Load access flags. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1055 assert(access_flags->is_nonvolatile(), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1056 "access_flags must be in a non-volatile register"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1057 // Type check. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1058 // TODO: PPC port: assert(4 == methodOopDesc::sz_access_flags(), "unexpected field size"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1059 __ lwz(access_flags, method_(access_flags)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1060 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1061 // We don't want to reload R19_method and access_flags after calls |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1062 // to some helper functions. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1063 assert(R19_method->is_nonvolatile(), "R19_method must be a non-volatile register"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1064 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1065 // Check for synchronized methods. Must happen AFTER invocation counter |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1066 // check, so method is not locked if counter overflows. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1067 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1068 { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1069 Label method_is_not_synced; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1070 // Is_synced is still alive. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1071 assert(is_synced->is_nonvolatile(), "is_synced must be non-volatile"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1072 __ bfalse(is_synced, method_is_not_synced); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1073 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1074 lock_method(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1075 // Reload method, it may have moved. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1076 __ ld(R19_method, state_(_method)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1077 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1078 __ BIND(method_is_not_synced); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1079 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1080 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1081 // jvmti/jvmpi support |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1082 __ notify_method_entry(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1083 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1084 // Reload method, it may have moved. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1085 __ ld(R19_method, state_(_method)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1086 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1087 //============================================================================= |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1088 // Get and call the signature handler |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1089 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1090 __ ld(signature_handler_fd, method_(signature_handler)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1091 Label call_signature_handler; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1092 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1093 __ cmpdi(CCR0, signature_handler_fd, 0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1094 __ bne(CCR0, call_signature_handler); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1095 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1096 // Method has never been called. Either generate a specialized |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1097 // handler or point to the slow one. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1098 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1099 // Pass parameter 'false' to avoid exception check in call_VM. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1100 __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::prepare_native_call), R19_method, false); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1101 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1102 // Check for an exception while looking up the target method. If we |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1103 // incurred one, bail. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1104 __ ld(pending_exception, thread_(pending_exception)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1105 __ cmpdi(CCR0, pending_exception, 0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1106 __ bne(CCR0, exception_return_sync_check); // has pending exception |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1107 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1108 // reload method |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1109 __ ld(R19_method, state_(_method)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1110 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1111 // Reload signature handler, it may have been created/assigned in the meanwhile |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1112 __ ld(signature_handler_fd, method_(signature_handler)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1113 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1114 __ BIND(call_signature_handler); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1115 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1116 // Before we call the signature handler we push a new frame to |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1117 // protect the interpreter frame volatile registers when we return |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1118 // from jni but before we can get back to Java. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1119 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1120 // First set the frame anchor while the SP/FP registers are |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1121 // convenient and the slow signature handler can use this same frame |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1122 // anchor. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1123 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1124 // We have a TOP_IJAVA_FRAME here, which belongs to us. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1125 __ set_top_ijava_frame_at_SP_as_last_Java_frame(R1_SP, R12_scratch2/*tmp*/); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1126 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1127 // Now the interpreter frame (and its call chain) have been |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1128 // invalidated and flushed. We are now protected against eager |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1129 // being enabled in native code. Even if it goes eager the |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1130 // registers will be reloaded as clean and we will invalidate after |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1131 // the call so no spurious flush should be possible. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1132 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1133 // Call signature handler and pass locals address. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1134 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1135 // Our signature handlers copy required arguments to the C stack |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1136 // (outgoing C args), R3_ARG1 to R10_ARG8, and F1_ARG1 to |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1137 // F13_ARG13. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1138 __ mr(R3_ARG1, R18_locals); |
17803 | 1139 #if !defined(ABI_ELFv2) |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1140 __ ld(signature_handler_fd, 0, signature_handler_fd); |
17803 | 1141 #endif |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1142 __ call_stub(signature_handler_fd); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1143 // reload method |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1144 __ ld(R19_method, state_(_method)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1145 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1146 // Remove the register parameter varargs slots we allocated in |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1147 // compute_interpreter_state. SP+16 ends up pointing to the ABI |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1148 // outgoing argument area. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1149 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1150 // Not needed on PPC64. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1151 //__ add(SP, SP, Argument::n_register_parameters*BytesPerWord); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1152 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1153 assert(result_handler_addr->is_nonvolatile(), "result_handler_addr must be in a non-volatile register"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1154 // Save across call to native method. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1155 __ mr(result_handler_addr, R3_RET); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1156 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1157 // Set up fixed parameters and call the native method. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1158 // If the method is static, get mirror into R4_ARG2. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1159 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1160 { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1161 Label method_is_not_static; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1162 // access_flags is non-volatile and still, no need to restore it |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1163 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1164 // restore access flags |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1165 __ testbitdi(CCR0, R0, access_flags, JVM_ACC_STATIC_BIT); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1166 __ bfalse(CCR0, method_is_not_static); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1167 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1168 // constants = method->constants(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1169 __ ld(R11_scratch1, in_bytes(Method::const_offset()), R19_method); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1170 __ ld(R11_scratch1/*constants*/, in_bytes(ConstMethod::constants_offset()), R11_scratch1); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1171 // pool_holder = method->constants()->pool_holder(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1172 __ ld(R11_scratch1/*pool_holder*/, ConstantPool::pool_holder_offset_in_bytes(), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1173 R11_scratch1/*constants*/); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1174 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1175 const int mirror_offset = in_bytes(Klass::java_mirror_offset()); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1176 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1177 // mirror = pool_holder->klass_part()->java_mirror(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1178 __ ld(R0/*mirror*/, mirror_offset, R11_scratch1/*pool_holder*/); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1179 // state->_native_mirror = mirror; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1180 __ std(R0/*mirror*/, state_(_oop_temp)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1181 // R4_ARG2 = &state->_oop_temp; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1182 __ addir(R4_ARG2, state_(_oop_temp)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1183 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1184 __ BIND(method_is_not_static); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1185 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1186 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1187 // At this point, arguments have been copied off the stack into |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1188 // their JNI positions. Oops are boxed in-place on the stack, with |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1189 // handles copied to arguments. The result handler address is in a |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1190 // register. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1191 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1192 // pass JNIEnv address as first parameter |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1193 __ addir(R3_ARG1, thread_(jni_environment)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1194 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1195 // Load the native_method entry before we change the thread state. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1196 __ ld(native_method_fd, method_(native_function)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1197 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1198 //============================================================================= |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1199 // Transition from _thread_in_Java to _thread_in_native. As soon as |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1200 // we make this change the safepoint code needs to be certain that |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1201 // the last Java frame we established is good. The pc in that frame |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1202 // just needs to be near here not an actual return address. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1203 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1204 // We use release_store_fence to update values like the thread state, where |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1205 // we don't want the current thread to continue until all our prior memory |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1206 // accesses (including the new thread state) are visible to other threads. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1207 __ li(R0, _thread_in_native); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1208 __ release(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1209 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1210 // TODO: PPC port: assert(4 == JavaThread::sz_thread_state(), "unexpected field size"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1211 __ stw(R0, thread_(thread_state)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1212 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1213 if (UseMembar) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1214 __ fence(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1215 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1216 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1217 //============================================================================= |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1218 // Call the native method. Argument registers must not have been |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1219 // overwritten since "__ call_stub(signature_handler);" (except for |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1220 // ARG1 and ARG2 for static methods) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1221 __ call_c(native_method_fd); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1222 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1223 __ std(R3_RET, state_(_native_lresult)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1224 __ stfd(F1_RET, state_(_native_fresult)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1225 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1226 // The frame_manager_lr field, which we use for setting the last |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1227 // java frame, gets overwritten by the signature handler. Restore |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1228 // it now. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1229 __ get_PC_trash_LR(R11_scratch1); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1230 __ std(R11_scratch1, _top_ijava_frame_abi(frame_manager_lr), R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1231 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1232 // Because of GC R19_method may no longer be valid. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1233 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1234 // Block, if necessary, before resuming in _thread_in_Java state. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1235 // In order for GC to work, don't clear the last_Java_sp until after |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1236 // blocking. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1237 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1238 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1239 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1240 //============================================================================= |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1241 // Switch thread to "native transition" state before reading the |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1242 // synchronization state. This additional state is necessary |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1243 // because reading and testing the synchronization state is not |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1244 // atomic w.r.t. GC, as this scenario demonstrates: Java thread A, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1245 // in _thread_in_native state, loads _not_synchronized and is |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1246 // preempted. VM thread changes sync state to synchronizing and |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1247 // suspends threads for GC. Thread A is resumed to finish this |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1248 // native method, but doesn't block here since it didn't see any |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1249 // synchronization in progress, and escapes. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1250 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1251 // We use release_store_fence to update values like the thread state, where |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1252 // we don't want the current thread to continue until all our prior memory |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1253 // accesses (including the new thread state) are visible to other threads. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1254 __ li(R0/*thread_state*/, _thread_in_native_trans); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1255 __ release(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1256 __ stw(R0/*thread_state*/, thread_(thread_state)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1257 if (UseMembar) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1258 __ fence(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1259 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1260 // Write serialization page so that the VM thread can do a pseudo remote |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1261 // membar. We use the current thread pointer to calculate a thread |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1262 // specific offset to write to within the page. This minimizes bus |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1263 // traffic due to cache line collision. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1264 else { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1265 __ serialize_memory(R16_thread, R11_scratch1, R12_scratch2); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1266 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1267 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1268 // Now before we return to java we must look for a current safepoint |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1269 // (a new safepoint can not start since we entered native_trans). |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1270 // We must check here because a current safepoint could be modifying |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1271 // the callers registers right this moment. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1272 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1273 // Acquire isn't strictly necessary here because of the fence, but |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1274 // sync_state is declared to be volatile, so we do it anyway. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1275 __ load_const(sync_state_addr, SafepointSynchronize::address_of_state()); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1276 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1277 // TODO: PPC port: assert(4 == SafepointSynchronize::sz_state(), "unexpected field size"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1278 __ lwz(sync_state, 0, sync_state_addr); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1279 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1280 // TODO: PPC port: assert(4 == Thread::sz_suspend_flags(), "unexpected field size"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1281 __ lwz(suspend_flags, thread_(suspend_flags)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1282 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1283 __ acquire(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1284 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1285 Label sync_check_done; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1286 Label do_safepoint; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1287 // No synchronization in progress nor yet synchronized |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1288 __ cmpwi(CCR0, sync_state, SafepointSynchronize::_not_synchronized); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1289 // not suspended |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1290 __ cmpwi(CCR1, suspend_flags, 0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1291 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1292 __ bne(CCR0, do_safepoint); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1293 __ beq(CCR1, sync_check_done); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1294 __ bind(do_safepoint); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1295 // Block. We do the call directly and leave the current |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1296 // last_Java_frame setup undisturbed. We must save any possible |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1297 // native result acrosss the call. No oop is present |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1298 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1299 __ mr(R3_ARG1, R16_thread); |
17803 | 1300 #if defined(ABI_ELFv2) |
1301 __ call_c(CAST_FROM_FN_PTR(address, JavaThread::check_special_condition_for_native_trans), | |
1302 relocInfo::none); | |
1303 #else | |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1304 __ call_c(CAST_FROM_FN_PTR(FunctionDescriptor*, JavaThread::check_special_condition_for_native_trans), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1305 relocInfo::none); |
17803 | 1306 #endif |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1307 __ bind(sync_check_done); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1308 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1309 //============================================================================= |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1310 // <<<<<< Back in Interpreter Frame >>>>> |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1311 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1312 // We are in thread_in_native_trans here and back in the normal |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1313 // interpreter frame. We don't have to do anything special about |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1314 // safepoints and we can switch to Java mode anytime we are ready. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1315 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1316 // Note: frame::interpreter_frame_result has a dependency on how the |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1317 // method result is saved across the call to post_method_exit. For |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1318 // native methods it assumes that the non-FPU/non-void result is |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1319 // saved in _native_lresult and a FPU result in _native_fresult. If |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1320 // this changes then the interpreter_frame_result implementation |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1321 // will need to be updated too. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1322 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1323 // On PPC64, we have stored the result directly after the native call. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1324 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1325 //============================================================================= |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1326 // back in Java |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1327 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1328 // We use release_store_fence to update values like the thread state, where |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1329 // we don't want the current thread to continue until all our prior memory |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1330 // accesses (including the new thread state) are visible to other threads. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1331 __ li(R0/*thread_state*/, _thread_in_Java); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1332 __ release(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1333 __ stw(R0/*thread_state*/, thread_(thread_state)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1334 if (UseMembar) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1335 __ fence(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1336 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1337 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1338 __ reset_last_Java_frame(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1339 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1340 // Reload GR27_method, call killed it. We can't look at |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1341 // state->_method until we're back in java state because in java |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1342 // state gc can't happen until we get to a safepoint. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1343 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1344 // We've set thread_state to _thread_in_Java already, so restoring |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1345 // R19_method from R14_state works; R19_method is invalid, because |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1346 // GC may have happened. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1347 __ ld(R19_method, state_(_method)); // reload method, may have moved |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1348 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1349 // jvmdi/jvmpi support. Whether we've got an exception pending or |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1350 // not, and whether unlocking throws an exception or not, we notify |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1351 // on native method exit. If we do have an exception, we'll end up |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1352 // in the caller's context to handle it, so if we don't do the |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1353 // notify here, we'll drop it on the floor. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1354 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1355 __ notify_method_exit(true/*native method*/, |
17804 | 1356 ilgl /*illegal state (not used for native methods)*/, |
1357 InterpreterMacroAssembler::NotifyJVMTI, | |
1358 false /*check_exceptions*/); | |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1359 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1360 //============================================================================= |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1361 // Handle exceptions |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1362 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1363 // See if we must unlock. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1364 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1365 { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1366 Label method_is_not_synced; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1367 // is_synced is still alive |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1368 assert(is_synced->is_nonvolatile(), "is_synced must be non-volatile"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1369 __ bfalse(is_synced, method_is_not_synced); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1370 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1371 unlock_method(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1372 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1373 __ bind(method_is_not_synced); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1374 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1375 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1376 // Reset active handles after returning from native. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1377 // thread->active_handles()->clear(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1378 __ ld(active_handles, thread_(active_handles)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1379 // JNIHandleBlock::_top is an int. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1380 // TODO: PPC port: assert(4 == JNIHandleBlock::top_size_in_bytes(), "unexpected field size"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1381 __ li(R0, 0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1382 __ stw(R0, JNIHandleBlock::top_offset_in_bytes(), active_handles); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1383 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1384 Label no_pending_exception_from_native_method; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1385 __ ld(R0/*pending_exception*/, thread_(pending_exception)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1386 __ cmpdi(CCR0, R0/*pending_exception*/, 0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1387 __ beq(CCR0, no_pending_exception_from_native_method); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1388 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1389 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1390 //----------------------------------------------------------------------------- |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1391 // An exception is pending. We call into the runtime only if the |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1392 // caller was not interpreted. If it was interpreted the |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1393 // interpreter will do the correct thing. If it isn't interpreted |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1394 // (call stub/compiled code) we will change our return and continue. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1395 __ BIND(exception_return); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1396 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1397 Label return_to_initial_caller_with_pending_exception; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1398 __ cmpdi(CCR0, R15_prev_state, 0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1399 __ beq(CCR0, return_to_initial_caller_with_pending_exception); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1400 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1401 // We are returning to an interpreter activation, just pop the state, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1402 // pop our frame, leave the exception pending, and return. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1403 __ pop_interpreter_state(/*prev_state_may_be_0=*/false); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1404 __ pop_interpreter_frame(R11_scratch1, R12_scratch2, R21_tmp1 /* set to return pc */, R22_tmp2); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1405 __ mtlr(R21_tmp1); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1406 __ blr(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1407 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1408 __ BIND(exception_return_sync_check); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1409 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1410 assert(is_synced->is_nonvolatile(), "is_synced must be non-volatile"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1411 __ bfalse(is_synced, exception_return); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1412 unlock_method(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1413 __ b(exception_return); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1414 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1415 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1416 __ BIND(return_to_initial_caller_with_pending_exception); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1417 // We are returning to a c2i-adapter / call-stub, get the address of the |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1418 // exception handler, pop the frame and return to the handler. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1419 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1420 // First, pop to caller's frame. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1421 __ pop_interpreter_frame(R11_scratch1, R12_scratch2, R21_tmp1 /* set to return pc */, R22_tmp2); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1422 |
17803 | 1423 __ push_frame_reg_args(0, R11_scratch1); |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1424 // Get the address of the exception handler. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1425 __ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::exception_handler_for_return_address), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1426 R16_thread, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1427 R21_tmp1 /* return pc */); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1428 __ pop_frame(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1429 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1430 // Load the PC of the the exception handler into LR. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1431 __ mtlr(R3_RET); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1432 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1433 // Load exception into R3_ARG1 and clear pending exception in thread. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1434 __ ld(R3_ARG1/*exception*/, thread_(pending_exception)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1435 __ li(R4_ARG2, 0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1436 __ std(R4_ARG2, thread_(pending_exception)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1437 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1438 // Load the original return pc into R4_ARG2. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1439 __ mr(R4_ARG2/*issuing_pc*/, R21_tmp1); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1440 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1441 // Resize frame to get rid of a potential extension. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1442 __ resize_frame_to_initial_caller(R11_scratch1, R12_scratch2); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1443 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1444 // Return to exception handler. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1445 __ blr(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1446 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1447 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1448 //----------------------------------------------------------------------------- |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1449 // No exception pending. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1450 __ BIND(no_pending_exception_from_native_method); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1451 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1452 // Move native method result back into proper registers and return. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1453 // Invoke result handler (may unbox/promote). |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1454 __ ld(R3_RET, state_(_native_lresult)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1455 __ lfd(F1_RET, state_(_native_fresult)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1456 __ call_stub(result_handler_addr); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1457 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1458 // We have created a new BytecodeInterpreter object, now we must destroy it. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1459 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1460 // Restore previous R14_state and caller's SP. R15_prev_state may |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1461 // be 0 here, because our caller may be the call_stub or compiled |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1462 // code. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1463 __ pop_interpreter_state(/*prev_state_may_be_0=*/true); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1464 __ pop_interpreter_frame(R11_scratch1, R12_scratch2, R21_tmp1 /* set to return pc */, R22_tmp2); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1465 // Resize frame to get rid of a potential extension. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1466 __ resize_frame_to_initial_caller(R11_scratch1, R12_scratch2); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1467 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1468 // Must use the return pc which was loaded from the caller's frame |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1469 // as the VM uses return-pc-patching for deoptimization. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1470 __ mtlr(R21_tmp1); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1471 __ blr(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1472 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1473 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1474 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1475 //============================================================================= |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1476 // We encountered an exception while computing the interpreter |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1477 // state, so R14_state isn't valid. Act as if we just returned from |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1478 // the callee method with a pending exception. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1479 __ BIND(stack_overflow_return); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1480 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1481 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1482 // Register state: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1483 // R14_state invalid; trashed by compute_interpreter_state |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1484 // R15_prev_state valid, but may be 0 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1485 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1486 // R1_SP valid, points to caller's SP; wasn't yet updated by |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1487 // compute_interpreter_state |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1488 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1489 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1490 // Create exception oop and make it pending. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1491 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1492 // Throw the exception via RuntimeStub "throw_StackOverflowError_entry". |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1493 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1494 // Previously, we called C-Code directly. As a consequence, a |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1495 // possible GC tried to process the argument oops of the top frame |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1496 // (see RegisterMap::clear, which sets the corresponding flag to |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1497 // true). This lead to crashes because: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1498 // 1. The top register map did not contain locations for the argument registers |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1499 // 2. The arguments are dead anyway, could be already overwritten in the worst case |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1500 // Solution: Call via special runtime stub that pushes it's own |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1501 // frame. This runtime stub has the flag "CodeBlob::caller_must_gc_arguments()" |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1502 // set to "false", what prevents the dead arguments getting GC'd. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1503 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1504 // 2 cases exist: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1505 // 1. We were called by the c2i adapter / call stub |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1506 // 2. We were called by the frame manager |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1507 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1508 // Both cases are handled by this code: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1509 // 1. - initial_caller_sp was saved in both cases on entry, so it's safe to load it back even if it was not changed. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1510 // - control flow will be: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1511 // throw_stackoverflow_stub->VM->throw_stackoverflow_stub->forward_excep->excp_blob of caller method |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1512 // 2. - control flow will be: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1513 // throw_stackoverflow_stub->VM->throw_stackoverflow_stub->forward_excep->rethrow_excp_entry of frame manager->resume_method |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1514 // Since we restored the caller SP above, the rethrow_excp_entry can restore the original interpreter state |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1515 // registers using the stack and resume the calling method with a pending excp. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1516 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1517 // Pop any c2i extension from the stack, restore LR just to be sure |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1518 __ ld(R0, _top_ijava_frame_abi(frame_manager_lr), R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1519 __ mtlr(R0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1520 // Resize frame to get rid of a potential extension. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1521 __ resize_frame_to_initial_caller(R11_scratch1, R12_scratch2); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1522 |
17793 | 1523 assert(StubRoutines::throw_StackOverflowError_entry() != NULL, "generated in wrong order"); |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1524 // Load target address of the runtime stub. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1525 __ load_const(R12_scratch2, (StubRoutines::throw_StackOverflowError_entry())); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1526 __ mtctr(R12_scratch2); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1527 __ bctr(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1528 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1529 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1530 //============================================================================= |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1531 // Counter overflow. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1532 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1533 if (inc_counter) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1534 // Handle invocation counter overflow |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1535 __ bind(invocation_counter_overflow); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1536 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1537 generate_counter_overflow(continue_after_compile); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1538 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1539 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1540 native_entry = entry; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1541 return entry; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1542 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1543 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1544 bool AbstractInterpreter::can_be_compiled(methodHandle m) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1545 // No special entry points that preclude compilation. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1546 return true; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1547 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1548 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1549 // Unlock the current method. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1550 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1551 void CppInterpreterGenerator::unlock_method(void) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1552 // Find preallocated monitor and unlock method. Method monitor is |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1553 // the first one. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1554 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1555 // Registers alive |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1556 // R14_state |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1557 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1558 // Registers updated |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1559 // volatiles |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1560 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1561 const Register monitor = R4_ARG2; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1562 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1563 // Pass address of initial monitor we allocated. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1564 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1565 // First monitor. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1566 __ addi(monitor, R14_state, -frame::interpreter_frame_monitor_size_in_bytes()); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1567 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1568 // Unlock method |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1569 __ unlock_object(monitor); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1570 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1571 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1572 // Lock the current method. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1573 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1574 void CppInterpreterGenerator::lock_method(void) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1575 // Find preallocated monitor and lock method. Method monitor is the |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1576 // first one. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1577 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1578 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1579 // Registers alive |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1580 // R14_state |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1581 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1582 // Registers updated |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1583 // volatiles |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1584 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1585 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1586 const Register monitor = R4_ARG2; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1587 const Register object = R5_ARG3; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1588 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1589 // Pass address of initial monitor we allocated. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1590 __ addi(monitor, R14_state, -frame::interpreter_frame_monitor_size_in_bytes()); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1591 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1592 // Pass object address. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1593 __ ld(object, BasicObjectLock::obj_offset_in_bytes(), monitor); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1594 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1595 // Lock method. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1596 __ lock_object(monitor, object); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1597 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1598 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1599 // Generate code for handling resuming a deopted method. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1600 void CppInterpreterGenerator::generate_deopt_handling(Register result_index) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1601 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1602 //============================================================================= |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1603 // Returning from a compiled method into a deopted method. The |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1604 // bytecode at the bcp has completed. The result of the bytecode is |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1605 // in the native abi (the tosca for the template based |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1606 // interpreter). Any stack space that was used by the bytecode that |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1607 // has completed has been removed (e.g. parameters for an invoke) so |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1608 // all that we have to do is place any pending result on the |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1609 // expression stack and resume execution on the next bytecode. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1610 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1611 Label return_from_deopt_common; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1612 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1613 // R3_RET and F1_RET are live here! Load the array index of the |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1614 // required result stub address and continue at return_from_deopt_common. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1615 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1616 // Deopt needs to jump to here to enter the interpreter (return a result). |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1617 deopt_frame_manager_return_atos = __ pc(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1618 __ li(result_index, AbstractInterpreter::BasicType_as_index(T_OBJECT)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1619 __ b(return_from_deopt_common); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1620 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1621 deopt_frame_manager_return_btos = __ pc(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1622 __ li(result_index, AbstractInterpreter::BasicType_as_index(T_BOOLEAN)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1623 __ b(return_from_deopt_common); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1624 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1625 deopt_frame_manager_return_itos = __ pc(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1626 __ li(result_index, AbstractInterpreter::BasicType_as_index(T_INT)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1627 __ b(return_from_deopt_common); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1628 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1629 deopt_frame_manager_return_ltos = __ pc(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1630 __ li(result_index, AbstractInterpreter::BasicType_as_index(T_LONG)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1631 __ b(return_from_deopt_common); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1632 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1633 deopt_frame_manager_return_ftos = __ pc(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1634 __ li(result_index, AbstractInterpreter::BasicType_as_index(T_FLOAT)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1635 __ b(return_from_deopt_common); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1636 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1637 deopt_frame_manager_return_dtos = __ pc(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1638 __ li(result_index, AbstractInterpreter::BasicType_as_index(T_DOUBLE)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1639 __ b(return_from_deopt_common); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1640 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1641 deopt_frame_manager_return_vtos = __ pc(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1642 __ li(result_index, AbstractInterpreter::BasicType_as_index(T_VOID)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1643 // Last one, fall-through to return_from_deopt_common. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1644 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1645 // Deopt return common. An index is present that lets us move any |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1646 // possible result being return to the interpreter's stack. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1647 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1648 __ BIND(return_from_deopt_common); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1649 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1650 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1651 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1652 // Generate the code to handle a more_monitors message from the c++ interpreter. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1653 void CppInterpreterGenerator::generate_more_monitors() { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1654 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1655 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1656 // Registers alive |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1657 // R16_thread - JavaThread* |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1658 // R15_prev_state - previous BytecodeInterpreter or 0 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1659 // R14_state - BytecodeInterpreter* address of receiver's interpreter state |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1660 // R1_SP - old stack pointer |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1661 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1662 // Registers updated |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1663 // R1_SP - new stack pointer |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1664 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1665 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1666 // Very-local scratch registers. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1667 const Register old_tos = R21_tmp1; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1668 const Register new_tos = R22_tmp2; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1669 const Register stack_base = R23_tmp3; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1670 const Register stack_limit = R24_tmp4; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1671 const Register slot = R25_tmp5; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1672 const Register n_slots = R25_tmp5; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1673 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1674 // Interpreter state fields. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1675 const Register msg = R24_tmp4; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1676 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1677 // Load up relevant interpreter state. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1678 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1679 __ ld(stack_base, state_(_stack_base)); // Old stack_base |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1680 __ ld(old_tos, state_(_stack)); // Old tos |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1681 __ ld(stack_limit, state_(_stack_limit)); // Old stack_limit |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1682 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1683 // extracted monitor_size |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1684 int monitor_size = frame::interpreter_frame_monitor_size_in_bytes(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1685 assert(Assembler::is_aligned((unsigned int)monitor_size, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1686 (unsigned int)frame::alignment_in_bytes), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1687 "size of a monitor must respect alignment of SP"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1688 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1689 // Save and restore top LR |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1690 __ ld(R12_scratch2, _top_ijava_frame_abi(frame_manager_lr), R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1691 __ resize_frame(-monitor_size, R11_scratch1);// Allocate space for new monitor |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1692 __ std(R12_scratch2, _top_ijava_frame_abi(frame_manager_lr), R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1693 // Initial_caller_sp is used as unextended_sp for non initial callers. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1694 __ std(R1_SP, _top_ijava_frame_abi(initial_caller_sp), R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1695 __ addi(stack_base, stack_base, -monitor_size); // New stack_base |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1696 __ addi(new_tos, old_tos, -monitor_size); // New tos |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1697 __ addi(stack_limit, stack_limit, -monitor_size); // New stack_limit |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1698 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1699 __ std(R1_SP, state_(_last_Java_sp)); // Update frame_bottom |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1700 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1701 __ std(stack_base, state_(_stack_base)); // Update stack_base |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1702 __ std(new_tos, state_(_stack)); // Update tos |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1703 __ std(stack_limit, state_(_stack_limit)); // Update stack_limit |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1704 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1705 __ li(msg, BytecodeInterpreter::got_monitors); // Tell interpreter we allocated the lock |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1706 __ stw(msg, state_(_msg)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1707 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1708 // Shuffle expression stack down. Recall that stack_base points |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1709 // just above the new expression stack bottom. Old_tos and new_tos |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1710 // are used to scan thru the old and new expression stacks. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1711 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1712 Label copy_slot, copy_slot_finished; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1713 __ sub(n_slots, stack_base, new_tos); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1714 __ srdi_(n_slots, n_slots, LogBytesPerWord); // compute number of slots to copy |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1715 assert(LogBytesPerWord == 3, "conflicts assembler instructions"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1716 __ beq(CCR0, copy_slot_finished); // nothing to copy |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1717 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1718 __ mtctr(n_slots); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1719 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1720 // loop |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1721 __ bind(copy_slot); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1722 __ ldu(slot, BytesPerWord, old_tos); // slot = *++old_tos; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1723 __ stdu(slot, BytesPerWord, new_tos); // *++new_tos = slot; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1724 __ bdnz(copy_slot); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1725 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1726 __ bind(copy_slot_finished); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1727 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1728 // Restart interpreter |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1729 __ li(R0, 0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1730 __ std(R0, BasicObjectLock::obj_offset_in_bytes(), stack_base); // Mark lock as unused |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1731 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1732 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1733 address CppInterpreterGenerator::generate_normal_entry(void) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1734 if (interpreter_frame_manager != NULL) return interpreter_frame_manager; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1735 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1736 address entry = __ pc(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1737 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1738 address return_from_native_pc = (address) NULL; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1739 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1740 // Initial entry to frame manager (from call_stub or c2i_adapter) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1741 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1742 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1743 // Registers alive |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1744 // R16_thread - JavaThread* |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1745 // R19_method - callee's Method (method to be invoked) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1746 // R17_tos - address of sender tos (prepushed) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1747 // R1_SP - SP prepared by call stub such that caller's outgoing args are near top |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1748 // LR - return address to caller (call_stub or c2i_adapter) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1749 // R21_sender_SP - initial caller sp |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1750 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1751 // Registers updated |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1752 // R15_prev_state - 0 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1753 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1754 // Stack layout at this point: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1755 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1756 // 0 [TOP_IJAVA_FRAME_ABI] <-- R1_SP |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1757 // alignment (optional) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1758 // [outgoing Java arguments] <-- R17_tos |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1759 // ... |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1760 // PARENT [PARENT_IJAVA_FRAME_ABI] |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1761 // ... |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1762 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1763 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1764 // Save initial_caller_sp to caller's abi. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1765 // The caller frame must be resized before returning to get rid of |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1766 // the c2i part on top of the calling compiled frame (if any). |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1767 // R21_tmp1 must match sender_sp in gen_c2i_adapter. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1768 // Now override the saved SP with the senderSP so we can pop c2i |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1769 // arguments (if any) off when we return. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1770 __ std(R21_sender_SP, _top_ijava_frame_abi(initial_caller_sp), R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1771 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1772 // Save LR to caller's frame. We don't use _abi(lr) here, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1773 // because it is not safe. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1774 __ mflr(R0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1775 __ std(R0, _top_ijava_frame_abi(frame_manager_lr), R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1776 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1777 // If we come here, it is the first invocation of the frame manager. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1778 // So there is no previous interpreter state. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1779 __ li(R15_prev_state, 0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1780 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1781 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1782 // Fall through to where "recursive" invocations go. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1783 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1784 //============================================================================= |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1785 // Dispatch an instance of the interpreter. Recursive activations |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1786 // come here. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1787 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1788 Label re_dispatch; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1789 __ BIND(re_dispatch); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1790 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1791 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1792 // Registers alive |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1793 // R16_thread - JavaThread* |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1794 // R19_method - callee's Method |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1795 // R17_tos - address of caller's tos (prepushed) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1796 // R15_prev_state - address of caller's BytecodeInterpreter or 0 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1797 // R1_SP - caller's SP trimmed such that caller's outgoing args are near top. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1798 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1799 // Stack layout at this point: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1800 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1801 // 0 [TOP_IJAVA_FRAME_ABI] |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1802 // alignment (optional) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1803 // [outgoing Java arguments] |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1804 // ... |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1805 // PARENT [PARENT_IJAVA_FRAME_ABI] |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1806 // ... |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1807 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1808 // fall through to interpreted execution |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1809 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1810 //============================================================================= |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1811 // Allocate a new Java frame and initialize the new interpreter state. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1812 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1813 Label stack_overflow_return; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1814 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1815 // Create a suitable new Java frame plus a new BytecodeInterpreter instance |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1816 // in the current (frame manager's) C frame. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1817 generate_compute_interpreter_state(stack_overflow_return); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1818 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1819 // fall through |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1820 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1821 //============================================================================= |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1822 // Interpreter dispatch. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1823 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1824 Label call_interpreter; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1825 __ BIND(call_interpreter); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1826 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1827 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1828 // Registers alive |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1829 // R16_thread - JavaThread* |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1830 // R15_prev_state - previous BytecodeInterpreter or 0 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1831 // R14_state - address of receiver's BytecodeInterpreter |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1832 // R1_SP - receiver's stack pointer |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1833 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1834 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1835 // Thread fields. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1836 const Register pending_exception = R21_tmp1; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1837 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1838 // Interpreter state fields. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1839 const Register msg = R24_tmp4; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1840 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1841 // MethodOop fields. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1842 const Register parameter_count = R25_tmp5; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1843 const Register result_index = R26_tmp6; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1844 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1845 const Register dummy = R28_tmp8; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1846 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1847 // Address of various interpreter stubs. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1848 // R29_tmp9 is reserved. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1849 const Register stub_addr = R27_tmp7; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1850 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1851 // Uncommon trap needs to jump to here to enter the interpreter |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1852 // (re-execute current bytecode). |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1853 unctrap_frame_manager_entry = __ pc(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1854 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1855 // If we are profiling, store our fp (BSP) in the thread so we can |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1856 // find it during a tick. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1857 if (Arguments::has_profile()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1858 // On PPC64 we store the pointer to the current BytecodeInterpreter, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1859 // instead of the bsp of ia64. This should suffice to be able to |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1860 // find all interesting information. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1861 __ std(R14_state, thread_(last_interpreter_fp)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1862 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1863 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1864 // R16_thread, R14_state and R15_prev_state are nonvolatile |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1865 // registers. There is no need to save these. If we needed to save |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1866 // some state in the current Java frame, this could be a place to do |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1867 // so. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1868 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1869 // Call Java bytecode dispatcher passing "BytecodeInterpreter* istate". |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1870 __ call_VM_leaf(CAST_FROM_FN_PTR(address, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1871 JvmtiExport::can_post_interpreter_events() |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1872 ? BytecodeInterpreter::runWithChecks |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1873 : BytecodeInterpreter::run), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1874 R14_state); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1875 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1876 interpreter_return_address = __ last_calls_return_pc(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1877 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1878 // R16_thread, R14_state and R15_prev_state have their values preserved. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1879 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1880 // If we are profiling, clear the fp in the thread to tell |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1881 // the profiler that we are no longer in the interpreter. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1882 if (Arguments::has_profile()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1883 __ li(R11_scratch1, 0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1884 __ std(R11_scratch1, thread_(last_interpreter_fp)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1885 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1886 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1887 // Load message from bytecode dispatcher. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1888 // TODO: PPC port: guarantee(4 == BytecodeInterpreter::sz_msg(), "unexpected field size"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1889 __ lwz(msg, state_(_msg)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1890 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1891 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1892 Label more_monitors; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1893 Label return_from_native; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1894 Label return_from_native_common; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1895 Label return_from_native_no_exception; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1896 Label return_from_interpreted_method; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1897 Label return_from_recursive_activation; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1898 Label unwind_recursive_activation; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1899 Label resume_interpreter; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1900 Label return_to_initial_caller; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1901 Label unwind_initial_activation; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1902 Label unwind_initial_activation_pending_exception; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1903 Label call_method; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1904 Label call_special; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1905 Label retry_method; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1906 Label retry_method_osr; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1907 Label popping_frame; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1908 Label throwing_exception; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1909 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1910 // Branch according to the received message |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1911 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1912 __ cmpwi(CCR1, msg, BytecodeInterpreter::call_method); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1913 __ cmpwi(CCR2, msg, BytecodeInterpreter::return_from_method); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1914 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1915 __ beq(CCR1, call_method); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1916 __ beq(CCR2, return_from_interpreted_method); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1917 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1918 __ cmpwi(CCR3, msg, BytecodeInterpreter::more_monitors); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1919 __ cmpwi(CCR4, msg, BytecodeInterpreter::throwing_exception); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1920 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1921 __ beq(CCR3, more_monitors); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1922 __ beq(CCR4, throwing_exception); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1923 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1924 __ cmpwi(CCR5, msg, BytecodeInterpreter::popping_frame); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1925 __ cmpwi(CCR6, msg, BytecodeInterpreter::do_osr); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1926 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1927 __ beq(CCR5, popping_frame); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1928 __ beq(CCR6, retry_method_osr); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1929 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1930 __ stop("bad message from interpreter"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1931 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1932 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1933 //============================================================================= |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1934 // Add a monitor just below the existing one(s). State->_stack_base |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1935 // points to the lowest existing one, so we insert the new one just |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1936 // below it and shuffle the expression stack down. Ref. the above |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1937 // stack layout picture, we must update _stack_base, _stack, _stack_limit |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1938 // and _last_Java_sp in the interpreter state. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1939 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1940 __ BIND(more_monitors); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1941 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1942 generate_more_monitors(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1943 __ b(call_interpreter); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1944 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1945 generate_deopt_handling(result_index); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1946 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1947 // Restoring the R14_state is already done by the deopt_blob. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1948 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1949 // Current tos includes no parameter slots. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1950 __ ld(R17_tos, state_(_stack)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1951 __ li(msg, BytecodeInterpreter::deopt_resume); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1952 __ b(return_from_native_common); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1953 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1954 // We are sent here when we are unwinding from a native method or |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1955 // adapter with an exception pending. We need to notify the interpreter |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1956 // that there is an exception to process. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1957 // We arrive here also if the frame manager called an (interpreted) target |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1958 // which returns with a StackOverflow exception. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1959 // The control flow is in this case is: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1960 // frame_manager->throw_excp_stub->forward_excp->rethrow_excp_entry |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1961 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1962 AbstractInterpreter::_rethrow_exception_entry = __ pc(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1963 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1964 // Restore R14_state. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1965 __ ld(R14_state, 0, R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1966 __ addi(R14_state, R14_state, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1967 -frame::interpreter_frame_cinterpreterstate_size_in_bytes()); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1968 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1969 // Store exception oop into thread object. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1970 __ std(R3_RET, thread_(pending_exception)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1971 __ li(msg, BytecodeInterpreter::method_resume /*rethrow_exception*/); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1972 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1973 // NOTE: the interpreter frame as setup be deopt does NOT include |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1974 // any parameter slots (good thing since we have no callee here |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1975 // and couldn't remove them) so we don't have to do any calculations |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1976 // here to figure it out. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1977 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1978 __ ld(R17_tos, state_(_stack)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1979 __ b(return_from_native_common); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1980 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1981 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1982 //============================================================================= |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1983 // Returning from a native method. Result is in the native abi |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1984 // location so we must move it to the java expression stack. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1985 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1986 __ BIND(return_from_native); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1987 guarantee(return_from_native_pc == (address) NULL, "precondition"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1988 return_from_native_pc = __ pc(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1989 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1990 // Restore R14_state. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1991 __ ld(R14_state, 0, R1_SP); |
14445 | 1992 __ addi(R14_state, R14_state, -frame::interpreter_frame_cinterpreterstate_size_in_bytes()); |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1993 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1994 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1995 // Registers alive |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1996 // R16_thread |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1997 // R14_state - address of caller's BytecodeInterpreter. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1998 // R3_RET - integer result, if any. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1999 // F1_RET - float result, if any. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2000 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2001 // Registers updated |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2002 // R19_method - callee's Method |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2003 // R17_tos - caller's tos, with outgoing args popped |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2004 // result_index - index of result handler. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2005 // msg - message for resuming interpreter. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2006 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2007 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2008 // Very-local scratch registers. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2009 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2010 const ConditionRegister have_pending_exception = CCR0; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2011 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2012 // Load callee Method, gc may have moved it. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2013 __ ld(R19_method, state_(_result._to_call._callee)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2014 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2015 // Load address of caller's tos. includes parameter slots. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2016 __ ld(R17_tos, state_(_stack)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2017 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2018 // Pop callee's parameters. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2019 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2020 __ ld(parameter_count, in_bytes(Method::const_offset()), R19_method); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2021 __ lhz(parameter_count, in_bytes(ConstMethod::size_of_parameters_offset()), parameter_count); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2022 __ sldi(parameter_count, parameter_count, Interpreter::logStackElementSize); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2023 __ add(R17_tos, R17_tos, parameter_count); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2024 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2025 // Result stub address array index |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2026 // TODO: PPC port: assert(4 == methodOopDesc::sz_result_index(), "unexpected field size"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2027 __ lwa(result_index, method_(result_index)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2028 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2029 __ li(msg, BytecodeInterpreter::method_resume); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2030 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2031 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2032 // Registers alive |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2033 // R16_thread |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2034 // R14_state - address of caller's BytecodeInterpreter. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2035 // R17_tos - address of caller's tos with outgoing args already popped |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2036 // R3_RET - integer return value, if any. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2037 // F1_RET - float return value, if any. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2038 // result_index - index of result handler. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2039 // msg - message for resuming interpreter. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2040 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2041 // Registers updated |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2042 // R3_RET - new address of caller's tos, including result, if any |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2043 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2044 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2045 __ BIND(return_from_native_common); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2046 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2047 // Check for pending exception |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2048 __ ld(pending_exception, thread_(pending_exception)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2049 __ cmpdi(CCR0, pending_exception, 0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2050 __ beq(CCR0, return_from_native_no_exception); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2051 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2052 // If there's a pending exception, we really have no result, so |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2053 // R3_RET is dead. Resume_interpreter assumes the new tos is in |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2054 // R3_RET. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2055 __ mr(R3_RET, R17_tos); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2056 // `resume_interpreter' expects R15_prev_state to be alive. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2057 __ ld(R15_prev_state, state_(_prev_link)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2058 __ b(resume_interpreter); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2059 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2060 __ BIND(return_from_native_no_exception); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2061 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2062 // No pending exception, copy method result from native ABI register |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2063 // to tos. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2064 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2065 // Address of stub descriptor address array. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2066 __ load_const(stub_addr, CppInterpreter::tosca_result_to_stack()); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2067 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2068 // Pass address of tos to stub. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2069 __ mr(R4_ARG2, R17_tos); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2070 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2071 // Address of stub descriptor address. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2072 __ sldi(result_index, result_index, LogBytesPerWord); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2073 __ add(stub_addr, stub_addr, result_index); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2074 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2075 // Stub descriptor address. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2076 __ ld(stub_addr, 0, stub_addr); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2077 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2078 // TODO: don't do this via a call, do it in place! |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2079 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2080 // call stub via descriptor |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2081 // in R3_ARG1/F1_ARG1: result value (R3_RET or F1_RET) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2082 __ call_stub(stub_addr); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2083 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2084 // new tos = result of call in R3_RET |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2085 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2086 // `resume_interpreter' expects R15_prev_state to be alive. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2087 __ ld(R15_prev_state, state_(_prev_link)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2088 __ b(resume_interpreter); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2089 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2090 //============================================================================= |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2091 // We encountered an exception while computing the interpreter |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2092 // state, so R14_state isn't valid. Act as if we just returned from |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2093 // the callee method with a pending exception. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2094 __ BIND(stack_overflow_return); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2095 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2096 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2097 // Registers alive |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2098 // R16_thread - JavaThread* |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2099 // R1_SP - old stack pointer |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2100 // R19_method - callee's Method |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2101 // R17_tos - address of caller's tos (prepushed) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2102 // R15_prev_state - address of caller's BytecodeInterpreter or 0 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2103 // R18_locals - address of callee's locals array |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2104 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2105 // Registers updated |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2106 // R3_RET - address of resuming tos, if recursive unwind |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2107 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2108 Label Lskip_unextend_SP; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2109 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2110 { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2111 const ConditionRegister is_initial_call = CCR0; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2112 const Register tos_save = R21_tmp1; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2113 const Register tmp = R22_tmp2; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2114 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2115 assert(tos_save->is_nonvolatile(), "need a nonvolatile"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2116 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2117 // Is the exception thrown in the initial Java frame of this frame |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2118 // manager frame? |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2119 __ cmpdi(is_initial_call, R15_prev_state, 0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2120 __ bne(is_initial_call, Lskip_unextend_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2121 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2122 // Pop any c2i extension from the stack. This is necessary in the |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2123 // non-recursive case (that is we were called by the c2i adapter, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2124 // meaning we have to prev state). In this case we entered the frame |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2125 // manager through a special entry which pushes the orignal |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2126 // unextended SP to the stack. Here we load it back. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2127 __ ld(R0, _top_ijava_frame_abi(frame_manager_lr), R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2128 __ mtlr(R0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2129 // Resize frame to get rid of a potential extension. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2130 __ resize_frame_to_initial_caller(R11_scratch1, R12_scratch2); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2131 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2132 // Fall through |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2133 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2134 __ bind(Lskip_unextend_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2135 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2136 // Throw the exception via RuntimeStub "throw_StackOverflowError_entry". |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2137 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2138 // Previously, we called C-Code directly. As a consequence, a |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2139 // possible GC tried to process the argument oops of the top frame |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2140 // (see RegisterMap::clear, which sets the corresponding flag to |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2141 // true). This lead to crashes because: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2142 // 1. The top register map did not contain locations for the argument registers |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2143 // 2. The arguments are dead anyway, could be already overwritten in the worst case |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2144 // Solution: Call via special runtime stub that pushes it's own frame. This runtime stub has the flag |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2145 // "CodeBlob::caller_must_gc_arguments()" set to "false", what prevents the dead arguments getting GC'd. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2146 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2147 // 2 cases exist: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2148 // 1. We were called by the c2i adapter / call stub |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2149 // 2. We were called by the frame manager |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2150 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2151 // Both cases are handled by this code: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2152 // 1. - initial_caller_sp was saved on stack => Load it back and we're ok |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2153 // - control flow will be: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2154 // throw_stackoverflow_stub->VM->throw_stackoverflow_stub->forward_excep->excp_blob of calling method |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2155 // 2. - control flow will be: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2156 // throw_stackoverflow_stub->VM->throw_stackoverflow_stub->forward_excep-> |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2157 // ->rethrow_excp_entry of frame manager->resume_method |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2158 // Since we restored the caller SP above, the rethrow_excp_entry can restore the original interpreter state |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2159 // registers using the stack and resume the calling method with a pending excp. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2160 |
17793 | 2161 assert(StubRoutines::throw_StackOverflowError_entry() != NULL, "generated in wrong order"); |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2162 __ load_const(R3_ARG1, (StubRoutines::throw_StackOverflowError_entry())); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2163 __ mtctr(R3_ARG1); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2164 __ bctr(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2165 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2166 //============================================================================= |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2167 // We have popped a frame from an interpreted call. We are assured |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2168 // of returning to an interpreted call by the popframe abi. We have |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2169 // no return value all we have to do is pop the current frame and |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2170 // then make sure that the top of stack (of the caller) gets set to |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2171 // where it was when we entered the callee (i.e. the args are still |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2172 // in place). Or we are returning to the interpreter. In the first |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2173 // case we must extract result (if any) from the java expression |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2174 // stack and store it in the location the native abi would expect |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2175 // for a call returning this type. In the second case we must simply |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2176 // do a stack to stack move as we unwind. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2177 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2178 __ BIND(popping_frame); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2179 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2180 // Registers alive |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2181 // R14_state |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2182 // R15_prev_state |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2183 // R17_tos |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2184 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2185 // Registers updated |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2186 // R19_method |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2187 // R3_RET |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2188 // msg |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2189 { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2190 Label L; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2191 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2192 // Reload callee method, gc may have moved it. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2193 __ ld(R19_method, state_(_method)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2194 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2195 // We may be returning to a deoptimized frame in which case the |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2196 // usual assumption of a recursive return is not true. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2197 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2198 // not equal = is recursive call |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2199 __ cmpdi(CCR0, R15_prev_state, 0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2200 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2201 __ bne(CCR0, L); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2202 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2203 // Pop_frame capability. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2204 // The pop_frame api says that the underlying frame is a Java frame, in this case |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2205 // (prev_state==null) it must be a compiled frame: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2206 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2207 // Stack at this point: I, C2I + C, ... |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2208 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2209 // The outgoing arguments of the call have just been copied (popframe_preserve_args). |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2210 // By the pop_frame api, we must end up in an interpreted frame. So the compiled frame |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2211 // will be deoptimized. Deoptimization will restore the outgoing arguments from |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2212 // popframe_preserve_args, adjust the tos such that it includes the popframe_preserve_args, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2213 // and adjust the bci such that the call will be executed again. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2214 // We have no results, just pop the interpreter frame, resize the compiled frame to get rid |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2215 // of the c2i extension and return to the deopt_handler. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2216 __ b(unwind_initial_activation); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2217 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2218 // is recursive call |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2219 __ bind(L); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2220 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2221 // Resume_interpreter expects the original tos in R3_RET. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2222 __ ld(R3_RET, prev_state_(_stack)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2223 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2224 // We're done. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2225 __ li(msg, BytecodeInterpreter::popping_frame); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2226 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2227 __ b(unwind_recursive_activation); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2228 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2229 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2230 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2231 //============================================================================= |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2232 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2233 // We have finished an interpreted call. We are either returning to |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2234 // native (call_stub/c2) or we are returning to the interpreter. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2235 // When returning to native, we must extract the result (if any) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2236 // from the java expression stack and store it in the location the |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2237 // native abi expects. When returning to the interpreter we must |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2238 // simply do a stack to stack move as we unwind. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2239 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2240 __ BIND(return_from_interpreted_method); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2241 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2242 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2243 // Registers alive |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2244 // R16_thread - JavaThread* |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2245 // R15_prev_state - address of caller's BytecodeInterpreter or 0 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2246 // R14_state - address of callee's interpreter state |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2247 // R1_SP - callee's stack pointer |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2248 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2249 // Registers updated |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2250 // R19_method - callee's method |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2251 // R3_RET - address of result (new caller's tos), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2252 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2253 // if returning to interpreted |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2254 // msg - message for interpreter, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2255 // if returning to interpreted |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2256 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2257 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2258 // Check if this is the initial invocation of the frame manager. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2259 // If so, R15_prev_state will be null. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2260 __ cmpdi(CCR0, R15_prev_state, 0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2261 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2262 // Reload callee method, gc may have moved it. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2263 __ ld(R19_method, state_(_method)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2264 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2265 // Load the method's result type. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2266 __ lwz(result_index, method_(result_index)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2267 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2268 // Go to return_to_initial_caller if R15_prev_state is null. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2269 __ beq(CCR0, return_to_initial_caller); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2270 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2271 // Copy callee's result to caller's expression stack via inline stack-to-stack |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2272 // converters. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2273 { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2274 Register new_tos = R3_RET; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2275 Register from_temp = R4_ARG2; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2276 Register from = R5_ARG3; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2277 Register tos = R6_ARG4; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2278 Register tmp1 = R7_ARG5; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2279 Register tmp2 = R8_ARG6; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2280 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2281 ConditionRegister result_type_is_void = CCR1; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2282 ConditionRegister result_type_is_long = CCR2; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2283 ConditionRegister result_type_is_double = CCR3; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2284 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2285 Label stack_to_stack_void; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2286 Label stack_to_stack_double_slot; // T_LONG, T_DOUBLE |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2287 Label stack_to_stack_single_slot; // T_BOOLEAN, T_BYTE, T_CHAR, T_SHORT, T_INT, T_FLOAT, T_OBJECT |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2288 Label stack_to_stack_done; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2289 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2290 // Pass callee's address of tos + BytesPerWord |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2291 __ ld(from_temp, state_(_stack)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2292 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2293 // result type: void |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2294 __ cmpwi(result_type_is_void, result_index, AbstractInterpreter::BasicType_as_index(T_VOID)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2295 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2296 // Pass caller's tos == callee's locals address |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2297 __ ld(tos, state_(_locals)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2298 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2299 // result type: long |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2300 __ cmpwi(result_type_is_long, result_index, AbstractInterpreter::BasicType_as_index(T_LONG)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2301 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2302 __ addi(from, from_temp, Interpreter::stackElementSize); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2303 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2304 // !! don't branch above this line !! |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2305 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2306 // handle void |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2307 __ beq(result_type_is_void, stack_to_stack_void); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2308 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2309 // result type: double |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2310 __ cmpwi(result_type_is_double, result_index, AbstractInterpreter::BasicType_as_index(T_DOUBLE)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2311 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2312 // handle long or double |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2313 __ beq(result_type_is_long, stack_to_stack_double_slot); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2314 __ beq(result_type_is_double, stack_to_stack_double_slot); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2315 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2316 // fall through to single slot types (incl. object) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2317 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2318 { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2319 __ BIND(stack_to_stack_single_slot); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2320 // T_BOOLEAN, T_BYTE, T_CHAR, T_SHORT, T_INT, T_FLOAT, T_OBJECT |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2321 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2322 __ ld(tmp1, 0, from); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2323 __ std(tmp1, 0, tos); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2324 // New expression stack top |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2325 __ addi(new_tos, tos, - BytesPerWord); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2326 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2327 __ b(stack_to_stack_done); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2328 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2329 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2330 { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2331 __ BIND(stack_to_stack_double_slot); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2332 // T_LONG, T_DOUBLE |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2333 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2334 // Move both entries for debug purposes even though only one is live |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2335 __ ld(tmp1, BytesPerWord, from); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2336 __ ld(tmp2, 0, from); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2337 __ std(tmp1, 0, tos); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2338 __ std(tmp2, -BytesPerWord, tos); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2339 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2340 // new expression stack top |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2341 __ addi(new_tos, tos, - 2 * BytesPerWord); // two slots |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2342 __ b(stack_to_stack_done); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2343 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2344 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2345 { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2346 __ BIND(stack_to_stack_void); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2347 // T_VOID |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2348 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2349 // new expression stack top |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2350 __ mr(new_tos, tos); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2351 // fall through to stack_to_stack_done |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2352 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2353 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2354 __ BIND(stack_to_stack_done); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2355 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2356 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2357 // new tos = R3_RET |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2358 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2359 // Get the message for the interpreter |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2360 __ li(msg, BytecodeInterpreter::method_resume); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2361 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2362 // And fall thru |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2363 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2364 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2365 //============================================================================= |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2366 // Restore caller's interpreter state and pass pointer to caller's |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2367 // new tos to caller. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2368 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2369 __ BIND(unwind_recursive_activation); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2370 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2371 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2372 // Registers alive |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2373 // R15_prev_state - address of caller's BytecodeInterpreter |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2374 // R3_RET - address of caller's tos |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2375 // msg - message for caller's BytecodeInterpreter |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2376 // R1_SP - callee's stack pointer |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2377 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2378 // Registers updated |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2379 // R14_state - address of caller's BytecodeInterpreter |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2380 // R15_prev_state - address of its parent or 0 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2381 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2382 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2383 // Pop callee's interpreter and set R14_state to caller's interpreter. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2384 __ pop_interpreter_state(/*prev_state_may_be_0=*/false); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2385 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2386 // And fall thru |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2387 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2388 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2389 //============================================================================= |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2390 // Resume the (calling) interpreter after a call. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2391 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2392 __ BIND(resume_interpreter); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2393 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2394 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2395 // Registers alive |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2396 // R14_state - address of resuming BytecodeInterpreter |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2397 // R15_prev_state - address of its parent or 0 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2398 // R3_RET - address of resuming tos |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2399 // msg - message for resuming interpreter |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2400 // R1_SP - callee's stack pointer |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2401 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2402 // Registers updated |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2403 // R1_SP - caller's stack pointer |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2404 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2405 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2406 // Restore C stack pointer of caller (resuming interpreter), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2407 // R14_state already points to the resuming BytecodeInterpreter. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2408 __ pop_interpreter_frame_to_state(R14_state, R21_tmp1, R11_scratch1, R12_scratch2); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2409 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2410 // Store new address of tos (holding return value) in interpreter state. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2411 __ std(R3_RET, state_(_stack)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2412 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2413 // Store message for interpreter. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2414 __ stw(msg, state_(_msg)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2415 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2416 __ b(call_interpreter); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2417 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2418 //============================================================================= |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2419 // Interpreter returning to native code (call_stub/c1/c2) from |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2420 // initial activation. Convert stack result and unwind activation. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2421 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2422 __ BIND(return_to_initial_caller); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2423 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2424 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2425 // Registers alive |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2426 // R19_method - callee's Method |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2427 // R14_state - address of callee's interpreter state |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2428 // R16_thread - JavaThread |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2429 // R1_SP - callee's stack pointer |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2430 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2431 // Registers updated |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2432 // R3_RET/F1_RET - result in expected output register |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2433 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2434 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2435 // If we have an exception pending we have no result and we |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2436 // must figure out where to really return to. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2437 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2438 __ ld(pending_exception, thread_(pending_exception)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2439 __ cmpdi(CCR0, pending_exception, 0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2440 __ bne(CCR0, unwind_initial_activation_pending_exception); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2441 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2442 __ lwa(result_index, method_(result_index)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2443 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2444 // Address of stub descriptor address array. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2445 __ load_const(stub_addr, CppInterpreter::stack_result_to_native()); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2446 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2447 // Pass address of callee's tos + BytesPerWord. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2448 // Will then point directly to result. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2449 __ ld(R3_ARG1, state_(_stack)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2450 __ addi(R3_ARG1, R3_ARG1, Interpreter::stackElementSize); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2451 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2452 // Address of stub descriptor address |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2453 __ sldi(result_index, result_index, LogBytesPerWord); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2454 __ add(stub_addr, stub_addr, result_index); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2455 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2456 // Stub descriptor address |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2457 __ ld(stub_addr, 0, stub_addr); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2458 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2459 // TODO: don't do this via a call, do it in place! |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2460 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2461 // call stub via descriptor |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2462 __ call_stub(stub_addr); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2463 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2464 __ BIND(unwind_initial_activation); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2465 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2466 // Unwind from initial activation. No exception is pending. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2467 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2468 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2469 // Stack layout at this point: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2470 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2471 // 0 [TOP_IJAVA_FRAME_ABI] <-- R1_SP |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2472 // ... |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2473 // CALLER [PARENT_IJAVA_FRAME_ABI] |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2474 // ... |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2475 // CALLER [unextended ABI] |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2476 // ... |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2477 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2478 // The CALLER frame has a C2I adapter or is an entry-frame. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2479 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2480 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2481 // An interpreter frame exists, we may pop the TOP_IJAVA_FRAME and |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2482 // turn the caller's PARENT_IJAVA_FRAME back into a TOP_IJAVA_FRAME. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2483 // But, we simply restore the return pc from the caller's frame and |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2484 // use the caller's initial_caller_sp as the new SP which pops the |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2485 // interpreter frame and "resizes" the caller's frame to its "unextended" |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2486 // size. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2487 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2488 // get rid of top frame |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2489 __ pop_frame(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2490 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2491 // Load return PC from parent frame. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2492 __ ld(R21_tmp1, _parent_ijava_frame_abi(lr), R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2493 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2494 // Resize frame to get rid of a potential extension. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2495 __ resize_frame_to_initial_caller(R11_scratch1, R12_scratch2); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2496 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2497 // update LR |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2498 __ mtlr(R21_tmp1); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2499 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2500 // return |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2501 __ blr(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2502 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2503 //============================================================================= |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2504 // Unwind from initial activation. An exception is pending |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2505 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2506 __ BIND(unwind_initial_activation_pending_exception); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2507 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2508 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2509 // Stack layout at this point: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2510 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2511 // 0 [TOP_IJAVA_FRAME_ABI] <-- R1_SP |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2512 // ... |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2513 // CALLER [PARENT_IJAVA_FRAME_ABI] |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2514 // ... |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2515 // CALLER [unextended ABI] |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2516 // ... |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2517 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2518 // The CALLER frame has a C2I adapter or is an entry-frame. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2519 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2520 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2521 // An interpreter frame exists, we may pop the TOP_IJAVA_FRAME and |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2522 // turn the caller's PARENT_IJAVA_FRAME back into a TOP_IJAVA_FRAME. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2523 // But, we just pop the current TOP_IJAVA_FRAME and fall through |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2524 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2525 __ pop_frame(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2526 __ ld(R3_ARG1, _top_ijava_frame_abi(lr), R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2527 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2528 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2529 // Stack layout at this point: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2530 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2531 // CALLER [PARENT_IJAVA_FRAME_ABI] <-- R1_SP |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2532 // ... |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2533 // CALLER [unextended ABI] |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2534 // ... |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2535 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2536 // The CALLER frame has a C2I adapter or is an entry-frame. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2537 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2538 // Registers alive |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2539 // R16_thread |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2540 // R3_ARG1 - return address to caller |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2541 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2542 // Registers updated |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2543 // R3_ARG1 - address of pending exception |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2544 // R4_ARG2 - issuing pc = return address to caller |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2545 // LR - address of exception handler stub |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2546 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2547 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2548 // Resize frame to get rid of a potential extension. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2549 __ resize_frame_to_initial_caller(R11_scratch1, R12_scratch2); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2550 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2551 __ mr(R14, R3_ARG1); // R14 := ARG1 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2552 __ mr(R4_ARG2, R3_ARG1); // ARG2 := ARG1 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2553 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2554 // Find the address of the "catch_exception" stub. |
17803 | 2555 __ push_frame_reg_args(0, R11_scratch1); |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2556 __ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::exception_handler_for_return_address), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2557 R16_thread, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2558 R4_ARG2); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2559 __ pop_frame(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2560 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2561 // Load continuation address into LR. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2562 __ mtlr(R3_RET); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2563 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2564 // Load address of pending exception and clear it in thread object. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2565 __ ld(R3_ARG1/*R3_RET*/, thread_(pending_exception)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2566 __ li(R4_ARG2, 0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2567 __ std(R4_ARG2, thread_(pending_exception)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2568 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2569 // re-load issuing pc |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2570 __ mr(R4_ARG2, R14); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2571 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2572 // Branch to found exception handler. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2573 __ blr(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2574 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2575 //============================================================================= |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2576 // Call a new method. Compute new args and trim the expression stack |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2577 // to only what we are currently using and then recurse. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2578 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2579 __ BIND(call_method); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2580 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2581 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2582 // Registers alive |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2583 // R16_thread |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2584 // R14_state - address of caller's BytecodeInterpreter |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2585 // R1_SP - caller's stack pointer |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2586 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2587 // Registers updated |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2588 // R15_prev_state - address of caller's BytecodeInterpreter |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2589 // R17_tos - address of caller's tos |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2590 // R19_method - callee's Method |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2591 // R1_SP - trimmed back |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2592 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2593 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2594 // Very-local scratch registers. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2595 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2596 const Register offset = R21_tmp1; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2597 const Register tmp = R22_tmp2; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2598 const Register self_entry = R23_tmp3; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2599 const Register stub_entry = R24_tmp4; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2600 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2601 const ConditionRegister cr = CCR0; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2602 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2603 // Load the address of the frame manager. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2604 __ load_const(self_entry, &interpreter_frame_manager); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2605 __ ld(self_entry, 0, self_entry); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2606 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2607 // Load BytecodeInterpreter._result._to_call._callee (callee's Method). |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2608 __ ld(R19_method, state_(_result._to_call._callee)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2609 // Load BytecodeInterpreter._stack (outgoing tos). |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2610 __ ld(R17_tos, state_(_stack)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2611 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2612 // Save address of caller's BytecodeInterpreter. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2613 __ mr(R15_prev_state, R14_state); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2614 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2615 // Load the callee's entry point. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2616 // Load BytecodeInterpreter._result._to_call._callee_entry_point. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2617 __ ld(stub_entry, state_(_result._to_call._callee_entry_point)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2618 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2619 // Check whether stub_entry is equal to self_entry. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2620 __ cmpd(cr, self_entry, stub_entry); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2621 // if (self_entry == stub_entry) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2622 // do a re-dispatch |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2623 __ beq(cr, re_dispatch); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2624 // else |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2625 // call the specialized entry (adapter for jni or compiled code) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2626 __ BIND(call_special); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2627 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2628 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2629 // Call the entry generated by `InterpreterGenerator::generate_native_entry'. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2630 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2631 // Registers alive |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2632 // R16_thread |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2633 // R15_prev_state - address of caller's BytecodeInterpreter |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2634 // R19_method - callee's Method |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2635 // R17_tos - address of caller's tos |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2636 // R1_SP - caller's stack pointer |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2637 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2638 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2639 // Mark return from specialized entry for generate_native_entry. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2640 guarantee(return_from_native_pc != (address) NULL, "precondition"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2641 frame_manager_specialized_return = return_from_native_pc; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2642 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2643 // Set sender_SP in case we call interpreter native wrapper which |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2644 // will expect it. Compiled code should not care. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2645 __ mr(R21_sender_SP, R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2646 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2647 // Do a tail call here, and let the link register point to |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2648 // frame_manager_specialized_return which is return_from_native_pc. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2649 __ load_const(tmp, frame_manager_specialized_return); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2650 __ call_stub_and_return_to(stub_entry, tmp /* return_pc=tmp */); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2651 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2652 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2653 //============================================================================= |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2654 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2655 // InterpretMethod triggered OSR compilation of some Java method M |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2656 // and now asks to run the compiled code. We call this code the |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2657 // `callee'. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2658 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2659 // This is our current idea on how OSR should look like on PPC64: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2660 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2661 // While interpreting a Java method M the stack is: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2662 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2663 // (InterpretMethod (M), IJAVA_FRAME (M), ANY_FRAME, ...). |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2664 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2665 // After having OSR compiled M, `InterpretMethod' returns to the |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2666 // frame manager, sending the message `retry_method_osr'. The stack |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2667 // is: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2668 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2669 // (IJAVA_FRAME (M), ANY_FRAME, ...). |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2670 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2671 // The compiler will have generated an `nmethod' suitable for |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2672 // continuing execution of M at the bytecode index at which OSR took |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2673 // place. So now the frame manager calls the OSR entry. The OSR |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2674 // entry sets up a JIT_FRAME for M and continues execution of M with |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2675 // initial state determined by the IJAVA_FRAME. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2676 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2677 // (JIT_FRAME (M), IJAVA_FRAME (M), ANY_FRAME, ...). |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2678 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2679 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2680 __ BIND(retry_method_osr); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2681 { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2682 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2683 // Registers alive |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2684 // R16_thread |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2685 // R15_prev_state - address of caller's BytecodeInterpreter |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2686 // R14_state - address of callee's BytecodeInterpreter |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2687 // R1_SP - callee's SP before call to InterpretMethod |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2688 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2689 // Registers updated |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2690 // R17 - pointer to callee's locals array |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2691 // (declared via `interpreter_arg_ptr_reg' in the AD file) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2692 // R19_method - callee's Method |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2693 // R1_SP - callee's SP (will become SP of OSR adapter frame) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2694 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2695 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2696 // Provide a debugger breakpoint in the frame manager if breakpoints |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2697 // in osr'd methods are requested. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2698 #ifdef COMPILER2 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2699 NOT_PRODUCT( if (OptoBreakpointOSR) { __ illtrap(); } ) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2700 #endif |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2701 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2702 // Load callee's pointer to locals array from callee's state. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2703 // __ ld(R17, state_(_locals)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2704 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2705 // Load osr entry. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2706 __ ld(R12_scratch2, state_(_result._osr._osr_entry)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2707 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2708 // Load address of temporary osr buffer to arg1. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2709 __ ld(R3_ARG1, state_(_result._osr._osr_buf)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2710 __ mtctr(R12_scratch2); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2711 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2712 // Load method oop, gc may move it during execution of osr'd method. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2713 __ ld(R22_tmp2, state_(_method)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2714 // Load message 'call_method'. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2715 __ li(R23_tmp3, BytecodeInterpreter::call_method); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2716 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2717 { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2718 // Pop the IJAVA frame of the method which we are going to call osr'd. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2719 Label no_state, skip_no_state; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2720 __ pop_interpreter_state(/*prev_state_may_be_0=*/true); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2721 __ cmpdi(CCR0, R14_state,0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2722 __ beq(CCR0, no_state); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2723 // return to interpreter |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2724 __ pop_interpreter_frame_to_state(R14_state, R11_scratch1, R12_scratch2, R21_tmp1); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2725 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2726 // Init _result._to_call._callee and tell gc that it contains a valid oop |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2727 // by setting _msg to 'call_method'. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2728 __ std(R22_tmp2, state_(_result._to_call._callee)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2729 // TODO: PPC port: assert(4 == BytecodeInterpreter::sz_msg(), "unexpected field size"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2730 __ stw(R23_tmp3, state_(_msg)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2731 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2732 __ load_const(R21_tmp1, frame_manager_specialized_return); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2733 __ b(skip_no_state); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2734 __ bind(no_state); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2735 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2736 // Return to initial caller. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2737 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2738 // Get rid of top frame. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2739 __ pop_frame(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2740 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2741 // Load return PC from parent frame. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2742 __ ld(R21_tmp1, _parent_ijava_frame_abi(lr), R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2743 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2744 // Resize frame to get rid of a potential extension. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2745 __ resize_frame_to_initial_caller(R11_scratch1, R12_scratch2); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2746 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2747 __ bind(skip_no_state); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2748 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2749 // Update LR with return pc. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2750 __ mtlr(R21_tmp1); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2751 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2752 // Jump to the osr entry point. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2753 __ bctr(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2754 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2755 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2756 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2757 //============================================================================= |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2758 // Interpreted method "returned" with an exception, pass it on. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2759 // Pass no result, unwind activation and continue/return to |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2760 // interpreter/call_stub/c2. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2761 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2762 __ BIND(throwing_exception); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2763 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2764 // Check if this is the initial invocation of the frame manager. If |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2765 // so, previous interpreter state in R15_prev_state will be null. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2766 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2767 // New tos of caller is callee's first parameter address, that is |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2768 // callee's incoming arguments are popped. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2769 __ ld(R3_RET, state_(_locals)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2770 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2771 // Check whether this is an initial call. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2772 __ cmpdi(CCR0, R15_prev_state, 0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2773 // Yes, called from the call stub or from generated code via a c2i frame. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2774 __ beq(CCR0, unwind_initial_activation_pending_exception); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2775 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2776 // Send resume message, interpreter will see the exception first. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2777 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2778 __ li(msg, BytecodeInterpreter::method_resume); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2779 __ b(unwind_recursive_activation); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2780 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2781 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2782 //============================================================================= |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2783 // Push the last instruction out to the code buffer. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2784 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2785 { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2786 __ unimplemented("end of InterpreterGenerator::generate_normal_entry", 128); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2787 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2788 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2789 interpreter_frame_manager = entry; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2790 return interpreter_frame_manager; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2791 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2792 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2793 // Generate code for various sorts of method entries |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2794 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2795 address AbstractInterpreterGenerator::generate_method_entry(AbstractInterpreter::MethodKind kind) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2796 address entry_point = NULL; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2797 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2798 switch (kind) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2799 case Interpreter::zerolocals : break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2800 case Interpreter::zerolocals_synchronized : break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2801 case Interpreter::native : // Fall thru |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2802 case Interpreter::native_synchronized : entry_point = ((CppInterpreterGenerator*)this)->generate_native_entry(); break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2803 case Interpreter::empty : break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2804 case Interpreter::accessor : entry_point = ((InterpreterGenerator*)this)->generate_accessor_entry(); break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2805 case Interpreter::abstract : entry_point = ((InterpreterGenerator*)this)->generate_abstract_entry(); break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2806 // These are special interpreter intrinsics which we don't support so far. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2807 case Interpreter::java_lang_math_sin : break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2808 case Interpreter::java_lang_math_cos : break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2809 case Interpreter::java_lang_math_tan : break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2810 case Interpreter::java_lang_math_abs : break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2811 case Interpreter::java_lang_math_log : break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2812 case Interpreter::java_lang_math_log10 : break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2813 case Interpreter::java_lang_math_sqrt : break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2814 case Interpreter::java_lang_math_pow : break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2815 case Interpreter::java_lang_math_exp : break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2816 case Interpreter::java_lang_ref_reference_get: entry_point = ((InterpreterGenerator*)this)->generate_Reference_get_entry(); break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2817 default : ShouldNotReachHere(); break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2818 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2819 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2820 if (entry_point) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2821 return entry_point; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2822 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2823 return ((InterpreterGenerator*)this)->generate_normal_entry(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2824 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2825 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2826 InterpreterGenerator::InterpreterGenerator(StubQueue* code) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2827 : CppInterpreterGenerator(code) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2828 generate_all(); // down here so it can be "virtual" |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2829 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2830 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2831 // How much stack a topmost interpreter method activation needs in words. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2832 int AbstractInterpreter::size_top_interpreter_activation(Method* method) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2833 // Computation is in bytes not words to match layout_activation_impl |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2834 // below, but the return is in words. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2835 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2836 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2837 // 0 [TOP_IJAVA_FRAME_ABI] \ |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2838 // alignment (optional) \ | |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2839 // [operand stack / Java parameters] > stack | | |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2840 // [monitors] (optional) > monitors | | |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2841 // [PARENT_IJAVA_FRAME_ABI] \ | | |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2842 // [BytecodeInterpreter object] > interpreter \ | | | |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2843 // alignment (optional) | round | parent | round | top |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2844 // [Java result] (2 slots) > result | | | | |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2845 // [Java non-arg locals] \ locals | | | | |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2846 // [arg locals] / / / / / |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2847 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2848 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2849 int locals = method->max_locals() * BytesPerWord; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2850 int interpreter = frame::interpreter_frame_cinterpreterstate_size_in_bytes(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2851 int result = 2 * BytesPerWord; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2852 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2853 int parent = round_to(interpreter + result + locals, 16) + frame::parent_ijava_frame_abi_size; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2854 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2855 int stack = method->max_stack() * BytesPerWord; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2856 int monitors = method->is_synchronized() ? frame::interpreter_frame_monitor_size_in_bytes() : 0; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2857 int top = round_to(parent + monitors + stack, 16) + frame::top_ijava_frame_abi_size; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2858 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2859 return (top / BytesPerWord); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2860 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2861 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2862 void BytecodeInterpreter::layout_interpreterState(interpreterState to_fill, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2863 frame* caller, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2864 frame* current, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2865 Method* method, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2866 intptr_t* locals, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2867 intptr_t* stack, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2868 intptr_t* stack_base, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2869 intptr_t* monitor_base, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2870 intptr_t* frame_sp, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2871 bool is_top_frame) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2872 // What about any vtable? |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2873 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2874 to_fill->_thread = JavaThread::current(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2875 // This gets filled in later but make it something recognizable for now. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2876 to_fill->_bcp = method->code_base(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2877 to_fill->_locals = locals; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2878 to_fill->_constants = method->constants()->cache(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2879 to_fill->_method = method; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2880 to_fill->_mdx = NULL; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2881 to_fill->_stack = stack; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2882 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2883 if (is_top_frame && JavaThread::current()->popframe_forcing_deopt_reexecution()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2884 to_fill->_msg = deopt_resume2; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2885 } else { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2886 to_fill->_msg = method_resume; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2887 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2888 to_fill->_result._to_call._bcp_advance = 0; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2889 to_fill->_result._to_call._callee_entry_point = NULL; // doesn't matter to anyone |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2890 to_fill->_result._to_call._callee = NULL; // doesn't matter to anyone |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2891 to_fill->_prev_link = NULL; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2892 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2893 if (caller->is_interpreted_frame()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2894 interpreterState prev = caller->get_interpreterState(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2895 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2896 // Support MH calls. Make sure the interpreter will return the right address: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2897 // 1. Caller did ordinary interpreted->compiled call call: Set a prev_state |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2898 // which makes the CPP interpreter return to frame manager "return_from_interpreted_method" |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2899 // entry after finishing execution. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2900 // 2. Caller did a MH call: If the caller has a MethodHandleInvoke in it's |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2901 // state (invariant: must be the caller of the bottom vframe) we used the |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2902 // "call_special" entry to do the call, meaning the arguments have not been |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2903 // popped from the stack. Therefore, don't enter a prev state in this case |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2904 // in order to return to "return_from_native" frame manager entry which takes |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2905 // care of popping arguments. Also, don't overwrite the MH.invoke Method in |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2906 // the prev_state in order to be able to figure out the number of arguments to |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2907 // pop. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2908 // The parameter method can represent MethodHandle.invokeExact(...). |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2909 // The MethodHandleCompiler generates these synthetic Methods, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2910 // including bytecodes, if an invokedynamic call gets inlined. In |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2911 // this case we want to return like from any other interpreted |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2912 // Java call, so we set _prev_link. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2913 to_fill->_prev_link = prev; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2914 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2915 if (*prev->_bcp == Bytecodes::_invokeinterface || *prev->_bcp == Bytecodes::_invokedynamic) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2916 prev->_result._to_call._bcp_advance = 5; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2917 } else { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2918 prev->_result._to_call._bcp_advance = 3; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2919 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2920 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2921 to_fill->_oop_temp = NULL; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2922 to_fill->_stack_base = stack_base; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2923 // Need +1 here because stack_base points to the word just above the |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2924 // first expr stack entry and stack_limit is supposed to point to |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2925 // the word just below the last expr stack entry. See |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2926 // generate_compute_interpreter_state. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2927 to_fill->_stack_limit = stack_base - (method->max_stack() + 1); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2928 to_fill->_monitor_base = (BasicObjectLock*) monitor_base; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2929 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2930 to_fill->_frame_bottom = frame_sp; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2931 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2932 // PPC64 specific |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2933 to_fill->_last_Java_pc = NULL; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2934 to_fill->_last_Java_fp = NULL; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2935 to_fill->_last_Java_sp = frame_sp; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2936 #ifdef ASSERT |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2937 to_fill->_self_link = to_fill; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2938 to_fill->_native_fresult = 123456.789; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2939 to_fill->_native_lresult = CONST64(0xdeafcafedeadc0de); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2940 #endif |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2941 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2942 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2943 void BytecodeInterpreter::pd_layout_interpreterState(interpreterState istate, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2944 address last_Java_pc, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2945 intptr_t* last_Java_fp) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2946 istate->_last_Java_pc = last_Java_pc; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2947 istate->_last_Java_fp = last_Java_fp; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2948 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2949 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2950 int AbstractInterpreter::layout_activation(Method* method, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2951 int temps, // Number of slots on java expression stack in use. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2952 int popframe_args, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2953 int monitors, // Number of active monitors. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2954 int caller_actual_parameters, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2955 int callee_params,// Number of slots for callee parameters. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2956 int callee_locals,// Number of slots for locals. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2957 frame* caller, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2958 frame* interpreter_frame, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2959 bool is_top_frame, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2960 bool is_bottom_frame) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2961 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2962 // NOTE this code must exactly mimic what |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2963 // InterpreterGenerator::generate_compute_interpreter_state() does |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2964 // as far as allocating an interpreter frame. However there is an |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2965 // exception. With the C++ based interpreter only the top most frame |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2966 // has a full sized expression stack. The 16 byte slop factor is |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2967 // both the abi scratch area and a place to hold a result from a |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2968 // callee on its way to the callers stack. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2969 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2970 int monitor_size = frame::interpreter_frame_monitor_size_in_bytes() * monitors; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2971 int frame_size; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2972 int top_frame_size = round_to(frame::interpreter_frame_cinterpreterstate_size_in_bytes() |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2973 + monitor_size |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2974 + (method->max_stack() *Interpreter::stackElementWords * BytesPerWord) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2975 + 2*BytesPerWord, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2976 frame::alignment_in_bytes) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2977 + frame::top_ijava_frame_abi_size; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2978 if (is_top_frame) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2979 frame_size = top_frame_size; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2980 } else { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2981 frame_size = round_to(frame::interpreter_frame_cinterpreterstate_size_in_bytes() |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2982 + monitor_size |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2983 + ((temps - callee_params + callee_locals) * |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2984 Interpreter::stackElementWords * BytesPerWord) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2985 + 2*BytesPerWord, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2986 frame::alignment_in_bytes) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2987 + frame::parent_ijava_frame_abi_size; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2988 assert(popframe_args==0, "non-zero for top_frame only"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2989 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2990 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2991 // If we actually have a frame to layout we must now fill in all the pieces. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2992 if (interpreter_frame != NULL) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2993 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2994 intptr_t sp = (intptr_t)interpreter_frame->sp(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2995 intptr_t fp = *(intptr_t *)sp; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2996 assert(fp == (intptr_t)caller->sp(), "fp must match"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2997 interpreterState cur_state = |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2998 (interpreterState)(fp - frame::interpreter_frame_cinterpreterstate_size_in_bytes()); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2999 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3000 // Now fill in the interpreterState object. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3001 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3002 intptr_t* locals; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3003 if (caller->is_interpreted_frame()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3004 // Locals must agree with the caller because it will be used to set the |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3005 // caller's tos when we return. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3006 interpreterState prev = caller->get_interpreterState(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3007 // Calculate start of "locals" for MH calls. For MH calls, the |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3008 // current method() (= MH target) and prev->callee() (= |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3009 // MH.invoke*()) are different and especially have different |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3010 // signatures. To pop the argumentsof the caller, we must use |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3011 // the prev->callee()->size_of_arguments() because that's what |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3012 // the caller actually pushed. Currently, for synthetic MH |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3013 // calls (deoptimized from inlined MH calls), detected by |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3014 // is_method_handle_invoke(), we use the callee's arguments |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3015 // because here, the caller's and callee's signature match. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3016 if (true /*!caller->is_at_mh_callsite()*/) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3017 locals = prev->stack() + method->size_of_parameters(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3018 } else { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3019 // Normal MH call. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3020 locals = prev->stack() + prev->callee()->size_of_parameters(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3021 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3022 } else { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3023 bool is_deopted; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3024 locals = (intptr_t*) (fp + ((method->max_locals() - 1) * BytesPerWord) + |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3025 frame::parent_ijava_frame_abi_size); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3026 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3027 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3028 intptr_t* monitor_base = (intptr_t*) cur_state; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3029 intptr_t* stack_base = (intptr_t*) ((intptr_t) monitor_base - monitor_size); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3030 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3031 // Provide pop_frame capability on PPC64, add popframe_args. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3032 // +1 because stack is always prepushed. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3033 intptr_t* stack = (intptr_t*) ((intptr_t) stack_base - (temps + popframe_args + 1) * BytesPerWord); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3034 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3035 BytecodeInterpreter::layout_interpreterState(cur_state, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3036 caller, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3037 interpreter_frame, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3038 method, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3039 locals, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3040 stack, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3041 stack_base, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3042 monitor_base, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3043 (intptr_t*)(((intptr_t)fp)-top_frame_size), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3044 is_top_frame); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3045 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3046 BytecodeInterpreter::pd_layout_interpreterState(cur_state, interpreter_return_address, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3047 interpreter_frame->fp()); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3048 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3049 return frame_size/BytesPerWord; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3050 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3051 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3052 #endif // CC_INTERP |