author | coleenp |
Wed, 14 Aug 2019 10:07:00 -0400 | |
changeset 57745 | 789e967c2731 |
parent 57626 | 91bc70505019 |
child 57777 | 90ead0febf56 |
permissions | -rw-r--r-- |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1 |
/* |
48626
9f6f48d4f9a1
8194814: [ppc, s390] A row of minor fixes and cleanups
goetz
parents:
48332
diff
changeset
|
2 |
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. |
9f6f48d4f9a1
8194814: [ppc, s390] A row of minor fixes and cleanups
goetz
parents:
48332
diff
changeset
|
3 |
* Copyright (c) 2012, 2018 SAP SE. All rights reserved. |
22824
28258dd5cb2e
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. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
5 |
* |
28258dd5cb2e
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 |
28258dd5cb2e
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 |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
8 |
* published by the Free Software Foundation. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
9 |
* |
28258dd5cb2e
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 |
28258dd5cb2e
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 |
28258dd5cb2e
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 |
28258dd5cb2e
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 |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
14 |
* accompanied this code). |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
15 |
* |
28258dd5cb2e
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 |
28258dd5cb2e
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, |
28258dd5cb2e
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. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
19 |
* |
28258dd5cb2e
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 |
28258dd5cb2e
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 |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
22 |
* questions. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
23 |
* |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
24 |
*/ |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
25 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
26 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
27 |
#include "precompiled.hpp" |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
28 |
#include "asm/macroAssembler.inline.hpp" |
49748 | 29 |
#include "gc/shared/barrierSet.hpp" |
30 |
#include "gc/shared/barrierSetAssembler.hpp" |
|
40010 | 31 |
#include "interp_masm_ppc.hpp" |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
32 |
#include "interpreter/interpreterRuntime.hpp" |
23221 | 33 |
#include "prims/jvmtiThreadState.hpp" |
49480
d7df2dd501ce
8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
48965
diff
changeset
|
34 |
#include "runtime/frame.inline.hpp" |
48332
651a95f30dfb
8193257: PPC64, s390 implementation for Thread-local handshakes
mdoerr
parents:
47634
diff
changeset
|
35 |
#include "runtime/safepointMechanism.hpp" |
29080
a16b0d9a08f5
8072910: Move the g1EvacFailure.hpp implementation to g1EvacFailure.cpp
stefank
parents:
28492
diff
changeset
|
36 |
#include "runtime/sharedRuntime.hpp" |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
37 |
|
48626
9f6f48d4f9a1
8194814: [ppc, s390] A row of minor fixes and cleanups
goetz
parents:
48332
diff
changeset
|
38 |
// Implementation of InterpreterMacroAssembler. |
9f6f48d4f9a1
8194814: [ppc, s390] A row of minor fixes and cleanups
goetz
parents:
48332
diff
changeset
|
39 |
|
9f6f48d4f9a1
8194814: [ppc, s390] A row of minor fixes and cleanups
goetz
parents:
48332
diff
changeset
|
40 |
// This file specializes the assembler with interpreter-specific macros. |
9f6f48d4f9a1
8194814: [ppc, s390] A row of minor fixes and cleanups
goetz
parents:
48332
diff
changeset
|
41 |
|
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
42 |
#ifdef PRODUCT |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
43 |
#define BLOCK_COMMENT(str) // nothing |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
44 |
#else |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
45 |
#define BLOCK_COMMENT(str) block_comment(str) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
46 |
#endif |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
47 |
|
22861 | 48 |
void InterpreterMacroAssembler::null_check_throw(Register a, int offset, Register temp_reg) { |
49 |
address exception_entry = Interpreter::throw_NullPointerException_entry(); |
|
50 |
MacroAssembler::null_check_throw(a, offset, temp_reg, exception_entry); |
|
51 |
} |
|
52 |
||
33070
54f3f085b165
8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents:
32074
diff
changeset
|
53 |
void InterpreterMacroAssembler::jump_to_entry(address entry, Register Rscratch) { |
23221 | 54 |
assert(entry, "Entry must have been generated by now"); |
55 |
if (is_within_range_of_b(entry, pc())) { |
|
56 |
b(entry); |
|
57 |
} else { |
|
58 |
load_const_optimized(Rscratch, entry, R0); |
|
59 |
mtctr(Rscratch); |
|
60 |
bctr(); |
|
61 |
} |
|
62 |
} |
|
63 |
||
48332
651a95f30dfb
8193257: PPC64, s390 implementation for Thread-local handshakes
mdoerr
parents:
47634
diff
changeset
|
64 |
void InterpreterMacroAssembler::dispatch_next(TosState state, int bcp_incr, bool generate_poll) { |
23221 | 65 |
Register bytecode = R12_scratch2; |
66 |
if (bcp_incr != 0) { |
|
67 |
lbzu(bytecode, bcp_incr, R14_bcp); |
|
68 |
} else { |
|
69 |
lbz(bytecode, 0, R14_bcp); |
|
70 |
} |
|
71 |
||
48332
651a95f30dfb
8193257: PPC64, s390 implementation for Thread-local handshakes
mdoerr
parents:
47634
diff
changeset
|
72 |
dispatch_Lbyte_code(state, bytecode, Interpreter::dispatch_table(state), generate_poll); |
23221 | 73 |
} |
74 |
||
75 |
void InterpreterMacroAssembler::dispatch_via(TosState state, address* table) { |
|
76 |
// Load current bytecode. |
|
77 |
Register bytecode = R12_scratch2; |
|
78 |
lbz(bytecode, 0, R14_bcp); |
|
79 |
dispatch_Lbyte_code(state, bytecode, table); |
|
80 |
} |
|
81 |
||
82 |
// Dispatch code executed in the prolog of a bytecode which does not do it's |
|
83 |
// own dispatch. The dispatch address is computed and placed in R24_dispatch_addr. |
|
84 |
void InterpreterMacroAssembler::dispatch_prolog(TosState state, int bcp_incr) { |
|
85 |
Register bytecode = R12_scratch2; |
|
86 |
lbz(bytecode, bcp_incr, R14_bcp); |
|
87 |
||
88 |
load_dispatch_table(R24_dispatch_addr, Interpreter::dispatch_table(state)); |
|
89 |
||
90 |
sldi(bytecode, bytecode, LogBytesPerWord); |
|
91 |
ldx(R24_dispatch_addr, R24_dispatch_addr, bytecode); |
|
92 |
} |
|
93 |
||
94 |
// Dispatch code executed in the epilog of a bytecode which does not do it's |
|
95 |
// own dispatch. The dispatch address in R24_dispatch_addr is used for the |
|
96 |
// dispatch. |
|
97 |
void InterpreterMacroAssembler::dispatch_epilog(TosState state, int bcp_incr) { |
|
35085 | 98 |
if (bcp_incr) { addi(R14_bcp, R14_bcp, bcp_incr); } |
23221 | 99 |
mtctr(R24_dispatch_addr); |
35085 | 100 |
bcctr(bcondAlways, 0, bhintbhBCCTRisNotPredictable); |
23221 | 101 |
} |
102 |
||
103 |
void InterpreterMacroAssembler::check_and_handle_popframe(Register scratch_reg) { |
|
104 |
assert(scratch_reg != R0, "can't use R0 as scratch_reg here"); |
|
105 |
if (JvmtiExport::can_pop_frame()) { |
|
106 |
Label L; |
|
107 |
||
108 |
// Check the "pending popframe condition" flag in the current thread. |
|
109 |
lwz(scratch_reg, in_bytes(JavaThread::popframe_condition_offset()), R16_thread); |
|
110 |
||
111 |
// Initiate popframe handling only if it is not already being |
|
112 |
// processed. If the flag has the popframe_processing bit set, it |
|
113 |
// means that this code is called *during* popframe handling - we |
|
114 |
// don't want to reenter. |
|
115 |
andi_(R0, scratch_reg, JavaThread::popframe_pending_bit); |
|
116 |
beq(CCR0, L); |
|
117 |
||
118 |
andi_(R0, scratch_reg, JavaThread::popframe_processing_bit); |
|
119 |
bne(CCR0, L); |
|
120 |
||
121 |
// Call the Interpreter::remove_activation_preserving_args_entry() |
|
122 |
// func to get the address of the same-named entrypoint in the |
|
123 |
// generated interpreter code. |
|
25916
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
124 |
#if defined(ABI_ELFv2) |
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
125 |
call_c(CAST_FROM_FN_PTR(address, |
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
126 |
Interpreter::remove_activation_preserving_args_entry), |
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
127 |
relocInfo::none); |
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
128 |
#else |
23221 | 129 |
call_c(CAST_FROM_FN_PTR(FunctionDescriptor*, |
130 |
Interpreter::remove_activation_preserving_args_entry), |
|
131 |
relocInfo::none); |
|
25916
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
132 |
#endif |
23221 | 133 |
|
134 |
// Jump to Interpreter::_remove_activation_preserving_args_entry. |
|
135 |
mtctr(R3_RET); |
|
136 |
bctr(); |
|
137 |
||
138 |
align(32, 12); |
|
139 |
bind(L); |
|
140 |
} |
|
141 |
} |
|
142 |
||
143 |
void InterpreterMacroAssembler::check_and_handle_earlyret(Register scratch_reg) { |
|
144 |
const Register Rthr_state_addr = scratch_reg; |
|
145 |
if (JvmtiExport::can_force_early_return()) { |
|
146 |
Label Lno_early_ret; |
|
147 |
ld(Rthr_state_addr, in_bytes(JavaThread::jvmti_thread_state_offset()), R16_thread); |
|
148 |
cmpdi(CCR0, Rthr_state_addr, 0); |
|
149 |
beq(CCR0, Lno_early_ret); |
|
150 |
||
151 |
lwz(R0, in_bytes(JvmtiThreadState::earlyret_state_offset()), Rthr_state_addr); |
|
152 |
cmpwi(CCR0, R0, JvmtiThreadState::earlyret_pending); |
|
153 |
bne(CCR0, Lno_early_ret); |
|
154 |
||
155 |
// Jump to Interpreter::_earlyret_entry. |
|
156 |
lwz(R3_ARG1, in_bytes(JvmtiThreadState::earlyret_tos_offset()), Rthr_state_addr); |
|
157 |
call_VM_leaf(CAST_FROM_FN_PTR(address, Interpreter::remove_activation_early_entry)); |
|
158 |
mtlr(R3_RET); |
|
159 |
blr(); |
|
160 |
||
161 |
align(32, 12); |
|
162 |
bind(Lno_early_ret); |
|
163 |
} |
|
164 |
} |
|
165 |
||
166 |
void InterpreterMacroAssembler::load_earlyret_value(TosState state, Register Rscratch1) { |
|
167 |
const Register RjvmtiState = Rscratch1; |
|
168 |
const Register Rscratch2 = R0; |
|
169 |
||
170 |
ld(RjvmtiState, in_bytes(JavaThread::jvmti_thread_state_offset()), R16_thread); |
|
171 |
li(Rscratch2, 0); |
|
172 |
||
173 |
switch (state) { |
|
174 |
case atos: ld(R17_tos, in_bytes(JvmtiThreadState::earlyret_oop_offset()), RjvmtiState); |
|
175 |
std(Rscratch2, in_bytes(JvmtiThreadState::earlyret_oop_offset()), RjvmtiState); |
|
176 |
break; |
|
177 |
case ltos: ld(R17_tos, in_bytes(JvmtiThreadState::earlyret_value_offset()), RjvmtiState); |
|
178 |
break; |
|
179 |
case btos: // fall through |
|
37488 | 180 |
case ztos: // fall through |
23221 | 181 |
case ctos: // fall through |
182 |
case stos: // fall through |
|
183 |
case itos: lwz(R17_tos, in_bytes(JvmtiThreadState::earlyret_value_offset()), RjvmtiState); |
|
184 |
break; |
|
185 |
case ftos: lfs(F15_ftos, in_bytes(JvmtiThreadState::earlyret_value_offset()), RjvmtiState); |
|
186 |
break; |
|
187 |
case dtos: lfd(F15_ftos, in_bytes(JvmtiThreadState::earlyret_value_offset()), RjvmtiState); |
|
188 |
break; |
|
189 |
case vtos: break; |
|
190 |
default : ShouldNotReachHere(); |
|
191 |
} |
|
192 |
||
193 |
// Clean up tos value in the jvmti thread state. |
|
194 |
std(Rscratch2, in_bytes(JvmtiThreadState::earlyret_value_offset()), RjvmtiState); |
|
195 |
// Set tos state field to illegal value. |
|
196 |
li(Rscratch2, ilgl); |
|
197 |
stw(Rscratch2, in_bytes(JvmtiThreadState::earlyret_tos_offset()), RjvmtiState); |
|
198 |
} |
|
199 |
||
200 |
// Common code to dispatch and dispatch_only. |
|
201 |
// Dispatch value in Lbyte_code and increment Lbcp. |
|
202 |
||
203 |
void InterpreterMacroAssembler::load_dispatch_table(Register dst, address* table) { |
|
204 |
address table_base = (address)Interpreter::dispatch_table((TosState)0); |
|
205 |
intptr_t table_offs = (intptr_t)table - (intptr_t)table_base; |
|
206 |
if (is_simm16(table_offs)) { |
|
207 |
addi(dst, R25_templateTableBase, (int)table_offs); |
|
208 |
} else { |
|
209 |
load_const_optimized(dst, table, R0); |
|
210 |
} |
|
211 |
} |
|
212 |
||
35166
23125410af16
8145117: PPC64: Remove cpp interpreter implementation
goetz
parents:
33083
diff
changeset
|
213 |
void InterpreterMacroAssembler::dispatch_Lbyte_code(TosState state, Register bytecode, |
48332
651a95f30dfb
8193257: PPC64, s390 implementation for Thread-local handshakes
mdoerr
parents:
47634
diff
changeset
|
214 |
address* table, bool generate_poll) { |
23221 | 215 |
assert_different_registers(bytecode, R11_scratch1); |
216 |
||
217 |
// Calc dispatch table address. |
|
218 |
load_dispatch_table(R11_scratch1, table); |
|
219 |
||
48332
651a95f30dfb
8193257: PPC64, s390 implementation for Thread-local handshakes
mdoerr
parents:
47634
diff
changeset
|
220 |
if (SafepointMechanism::uses_thread_local_poll() && generate_poll) { |
651a95f30dfb
8193257: PPC64, s390 implementation for Thread-local handshakes
mdoerr
parents:
47634
diff
changeset
|
221 |
address *sfpt_tbl = Interpreter::safept_table(state); |
651a95f30dfb
8193257: PPC64, s390 implementation for Thread-local handshakes
mdoerr
parents:
47634
diff
changeset
|
222 |
if (table != sfpt_tbl) { |
651a95f30dfb
8193257: PPC64, s390 implementation for Thread-local handshakes
mdoerr
parents:
47634
diff
changeset
|
223 |
Label dispatch; |
651a95f30dfb
8193257: PPC64, s390 implementation for Thread-local handshakes
mdoerr
parents:
47634
diff
changeset
|
224 |
ld(R0, in_bytes(Thread::polling_page_offset()), R16_thread); |
651a95f30dfb
8193257: PPC64, s390 implementation for Thread-local handshakes
mdoerr
parents:
47634
diff
changeset
|
225 |
// Armed page has poll_bit set, if poll bit is cleared just continue. |
651a95f30dfb
8193257: PPC64, s390 implementation for Thread-local handshakes
mdoerr
parents:
47634
diff
changeset
|
226 |
andi_(R0, R0, SafepointMechanism::poll_bit()); |
651a95f30dfb
8193257: PPC64, s390 implementation for Thread-local handshakes
mdoerr
parents:
47634
diff
changeset
|
227 |
beq(CCR0, dispatch); |
651a95f30dfb
8193257: PPC64, s390 implementation for Thread-local handshakes
mdoerr
parents:
47634
diff
changeset
|
228 |
load_dispatch_table(R11_scratch1, sfpt_tbl); |
651a95f30dfb
8193257: PPC64, s390 implementation for Thread-local handshakes
mdoerr
parents:
47634
diff
changeset
|
229 |
align(32, 16); |
651a95f30dfb
8193257: PPC64, s390 implementation for Thread-local handshakes
mdoerr
parents:
47634
diff
changeset
|
230 |
bind(dispatch); |
651a95f30dfb
8193257: PPC64, s390 implementation for Thread-local handshakes
mdoerr
parents:
47634
diff
changeset
|
231 |
} |
651a95f30dfb
8193257: PPC64, s390 implementation for Thread-local handshakes
mdoerr
parents:
47634
diff
changeset
|
232 |
} |
651a95f30dfb
8193257: PPC64, s390 implementation for Thread-local handshakes
mdoerr
parents:
47634
diff
changeset
|
233 |
|
23221 | 234 |
sldi(R12_scratch2, bytecode, LogBytesPerWord); |
235 |
ldx(R11_scratch1, R11_scratch1, R12_scratch2); |
|
236 |
||
237 |
// Jump off! |
|
238 |
mtctr(R11_scratch1); |
|
35085 | 239 |
bcctr(bcondAlways, 0, bhintbhBCCTRisNotPredictable); |
23221 | 240 |
} |
241 |
||
242 |
void InterpreterMacroAssembler::load_receiver(Register Rparam_count, Register Rrecv_dst) { |
|
243 |
sldi(Rrecv_dst, Rparam_count, Interpreter::logStackElementSize); |
|
244 |
ldx(Rrecv_dst, Rrecv_dst, R15_esp); |
|
245 |
} |
|
246 |
||
247 |
// helpers for expression stack |
|
248 |
||
249 |
void InterpreterMacroAssembler::pop_i(Register r) { |
|
250 |
lwzu(r, Interpreter::stackElementSize, R15_esp); |
|
251 |
} |
|
252 |
||
253 |
void InterpreterMacroAssembler::pop_ptr(Register r) { |
|
254 |
ldu(r, Interpreter::stackElementSize, R15_esp); |
|
255 |
} |
|
256 |
||
257 |
void InterpreterMacroAssembler::pop_l(Register r) { |
|
258 |
ld(r, Interpreter::stackElementSize, R15_esp); |
|
259 |
addi(R15_esp, R15_esp, 2 * Interpreter::stackElementSize); |
|
260 |
} |
|
261 |
||
262 |
void InterpreterMacroAssembler::pop_f(FloatRegister f) { |
|
263 |
lfsu(f, Interpreter::stackElementSize, R15_esp); |
|
264 |
} |
|
265 |
||
266 |
void InterpreterMacroAssembler::pop_d(FloatRegister f) { |
|
267 |
lfd(f, Interpreter::stackElementSize, R15_esp); |
|
268 |
addi(R15_esp, R15_esp, 2 * Interpreter::stackElementSize); |
|
269 |
} |
|
270 |
||
271 |
void InterpreterMacroAssembler::push_i(Register r) { |
|
272 |
stw(r, 0, R15_esp); |
|
273 |
addi(R15_esp, R15_esp, - Interpreter::stackElementSize ); |
|
274 |
} |
|
275 |
||
276 |
void InterpreterMacroAssembler::push_ptr(Register r) { |
|
277 |
std(r, 0, R15_esp); |
|
278 |
addi(R15_esp, R15_esp, - Interpreter::stackElementSize ); |
|
279 |
} |
|
280 |
||
281 |
void InterpreterMacroAssembler::push_l(Register r) { |
|
41342
18c64f6a5cc3
8166765: [ppc] Port "8163014: Mysterious/wrong value for long frame local variable on 64-bit"
goetz
parents:
40010
diff
changeset
|
282 |
// Clear unused slot. |
18c64f6a5cc3
8166765: [ppc] Port "8163014: Mysterious/wrong value for long frame local variable on 64-bit"
goetz
parents:
40010
diff
changeset
|
283 |
load_const_optimized(R0, 0L); |
18c64f6a5cc3
8166765: [ppc] Port "8163014: Mysterious/wrong value for long frame local variable on 64-bit"
goetz
parents:
40010
diff
changeset
|
284 |
std(R0, 0, R15_esp); |
23221 | 285 |
std(r, - Interpreter::stackElementSize, R15_esp); |
286 |
addi(R15_esp, R15_esp, - 2 * Interpreter::stackElementSize ); |
|
287 |
} |
|
288 |
||
289 |
void InterpreterMacroAssembler::push_f(FloatRegister f) { |
|
290 |
stfs(f, 0, R15_esp); |
|
291 |
addi(R15_esp, R15_esp, - Interpreter::stackElementSize ); |
|
292 |
} |
|
293 |
||
294 |
void InterpreterMacroAssembler::push_d(FloatRegister f) { |
|
295 |
stfd(f, - Interpreter::stackElementSize, R15_esp); |
|
296 |
addi(R15_esp, R15_esp, - 2 * Interpreter::stackElementSize ); |
|
297 |
} |
|
298 |
||
299 |
void InterpreterMacroAssembler::push_2ptrs(Register first, Register second) { |
|
300 |
std(first, 0, R15_esp); |
|
301 |
std(second, -Interpreter::stackElementSize, R15_esp); |
|
302 |
addi(R15_esp, R15_esp, - 2 * Interpreter::stackElementSize ); |
|
303 |
} |
|
304 |
||
46615 | 305 |
void InterpreterMacroAssembler::move_l_to_d(Register l, FloatRegister d) { |
306 |
if (VM_Version::has_mtfprd()) { |
|
307 |
mtfprd(d, l); |
|
308 |
} else { |
|
309 |
std(l, 0, R15_esp); |
|
310 |
lfd(d, 0, R15_esp); |
|
311 |
} |
|
23221 | 312 |
} |
313 |
||
46615 | 314 |
void InterpreterMacroAssembler::move_d_to_l(FloatRegister d, Register l) { |
315 |
if (VM_Version::has_mtfprd()) { |
|
316 |
mffprd(l, d); |
|
317 |
} else { |
|
318 |
stfd(d, 0, R15_esp); |
|
319 |
ld(l, 0, R15_esp); |
|
320 |
} |
|
23221 | 321 |
} |
322 |
||
323 |
void InterpreterMacroAssembler::push(TosState state) { |
|
324 |
switch (state) { |
|
325 |
case atos: push_ptr(); break; |
|
326 |
case btos: |
|
37488 | 327 |
case ztos: |
23221 | 328 |
case ctos: |
329 |
case stos: |
|
330 |
case itos: push_i(); break; |
|
331 |
case ltos: push_l(); break; |
|
332 |
case ftos: push_f(); break; |
|
333 |
case dtos: push_d(); break; |
|
334 |
case vtos: /* nothing to do */ break; |
|
335 |
default : ShouldNotReachHere(); |
|
336 |
} |
|
337 |
} |
|
338 |
||
339 |
void InterpreterMacroAssembler::pop(TosState state) { |
|
340 |
switch (state) { |
|
341 |
case atos: pop_ptr(); break; |
|
342 |
case btos: |
|
37488 | 343 |
case ztos: |
23221 | 344 |
case ctos: |
345 |
case stos: |
|
346 |
case itos: pop_i(); break; |
|
347 |
case ltos: pop_l(); break; |
|
348 |
case ftos: pop_f(); break; |
|
349 |
case dtos: pop_d(); break; |
|
350 |
case vtos: /* nothing to do */ break; |
|
351 |
default : ShouldNotReachHere(); |
|
352 |
} |
|
353 |
verify_oop(R17_tos, state); |
|
354 |
} |
|
355 |
||
356 |
void InterpreterMacroAssembler::empty_expression_stack() { |
|
357 |
addi(R15_esp, R26_monitor, - Interpreter::stackElementSize); |
|
358 |
} |
|
359 |
||
360 |
void InterpreterMacroAssembler::get_2_byte_integer_at_bcp(int bcp_offset, |
|
361 |
Register Rdst, |
|
362 |
signedOrNot is_signed) { |
|
25916
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
363 |
#if defined(VM_LITTLE_ENDIAN) |
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
364 |
if (bcp_offset) { |
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
365 |
load_const_optimized(Rdst, bcp_offset); |
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
366 |
lhbrx(Rdst, R14_bcp, Rdst); |
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
367 |
} else { |
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
368 |
lhbrx(Rdst, R14_bcp); |
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
369 |
} |
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
370 |
if (is_signed == Signed) { |
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
371 |
extsh(Rdst, Rdst); |
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
372 |
} |
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
373 |
#else |
23221 | 374 |
// Read Java big endian format. |
375 |
if (is_signed == Signed) { |
|
376 |
lha(Rdst, bcp_offset, R14_bcp); |
|
377 |
} else { |
|
378 |
lhz(Rdst, bcp_offset, R14_bcp); |
|
379 |
} |
|
380 |
#endif |
|
381 |
} |
|
382 |
||
383 |
void InterpreterMacroAssembler::get_4_byte_integer_at_bcp(int bcp_offset, |
|
384 |
Register Rdst, |
|
385 |
signedOrNot is_signed) { |
|
25916
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
386 |
#if defined(VM_LITTLE_ENDIAN) |
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
387 |
if (bcp_offset) { |
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
388 |
load_const_optimized(Rdst, bcp_offset); |
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
389 |
lwbrx(Rdst, R14_bcp, Rdst); |
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
390 |
} else { |
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
391 |
lwbrx(Rdst, R14_bcp); |
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
392 |
} |
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
393 |
if (is_signed == Signed) { |
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
394 |
extsw(Rdst, Rdst); |
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
395 |
} |
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
396 |
#else |
23221 | 397 |
// Read Java big endian format. |
398 |
if (bcp_offset & 3) { // Offset unaligned? |
|
399 |
load_const_optimized(Rdst, bcp_offset); |
|
400 |
if (is_signed == Signed) { |
|
401 |
lwax(Rdst, R14_bcp, Rdst); |
|
402 |
} else { |
|
403 |
lwzx(Rdst, R14_bcp, Rdst); |
|
404 |
} |
|
405 |
} else { |
|
406 |
if (is_signed == Signed) { |
|
407 |
lwa(Rdst, bcp_offset, R14_bcp); |
|
408 |
} else { |
|
409 |
lwz(Rdst, bcp_offset, R14_bcp); |
|
410 |
} |
|
411 |
} |
|
25916
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
412 |
#endif |
23221 | 413 |
} |
414 |
||
25916
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
415 |
|
23221 | 416 |
// Load the constant pool cache index from the bytecode stream. |
417 |
// |
|
418 |
// Kills / writes: |
|
419 |
// - Rdst, Rscratch |
|
35166
23125410af16
8145117: PPC64: Remove cpp interpreter implementation
goetz
parents:
33083
diff
changeset
|
420 |
void InterpreterMacroAssembler::get_cache_index_at_bcp(Register Rdst, int bcp_offset, |
23125410af16
8145117: PPC64: Remove cpp interpreter implementation
goetz
parents:
33083
diff
changeset
|
421 |
size_t index_size) { |
23221 | 422 |
assert(bcp_offset > 0, "bcp is still pointing to start of bytecode"); |
25916
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
423 |
// Cache index is always in the native format, courtesy of Rewriter. |
23221 | 424 |
if (index_size == sizeof(u2)) { |
25916
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
425 |
lhz(Rdst, bcp_offset, R14_bcp); |
23221 | 426 |
} else if (index_size == sizeof(u4)) { |
25916
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
427 |
if (bcp_offset & 3) { |
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
428 |
load_const_optimized(Rdst, bcp_offset); |
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
429 |
lwax(Rdst, R14_bcp, Rdst); |
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
430 |
} else { |
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
431 |
lwa(Rdst, bcp_offset, R14_bcp); |
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
432 |
} |
23221 | 433 |
assert(ConstantPool::decode_invokedynamic_index(~123) == 123, "else change next line"); |
434 |
nand(Rdst, Rdst, Rdst); // convert to plain index |
|
435 |
} else if (index_size == sizeof(u1)) { |
|
436 |
lbz(Rdst, bcp_offset, R14_bcp); |
|
437 |
} else { |
|
438 |
ShouldNotReachHere(); |
|
439 |
} |
|
440 |
// Rdst now contains cp cache index. |
|
441 |
} |
|
442 |
||
35166
23125410af16
8145117: PPC64: Remove cpp interpreter implementation
goetz
parents:
33083
diff
changeset
|
443 |
void InterpreterMacroAssembler::get_cache_and_index_at_bcp(Register cache, int bcp_offset, |
23125410af16
8145117: PPC64: Remove cpp interpreter implementation
goetz
parents:
33083
diff
changeset
|
444 |
size_t index_size) { |
23221 | 445 |
get_cache_index_at_bcp(cache, bcp_offset, index_size); |
446 |
sldi(cache, cache, exact_log2(in_words(ConstantPoolCacheEntry::size()) * BytesPerWord)); |
|
447 |
add(cache, R27_constPoolCache, cache); |
|
448 |
} |
|
449 |
||
25916
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
450 |
// Load 4-byte signed or unsigned integer in Java format (that is, big-endian format) |
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
451 |
// from (Rsrc)+offset. |
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
452 |
void InterpreterMacroAssembler::get_u4(Register Rdst, Register Rsrc, int offset, |
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
453 |
signedOrNot is_signed) { |
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
454 |
#if defined(VM_LITTLE_ENDIAN) |
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
455 |
if (offset) { |
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
456 |
load_const_optimized(Rdst, offset); |
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
457 |
lwbrx(Rdst, Rdst, Rsrc); |
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
458 |
} else { |
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
459 |
lwbrx(Rdst, Rsrc); |
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
460 |
} |
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
461 |
if (is_signed == Signed) { |
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
462 |
extsw(Rdst, Rdst); |
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
463 |
} |
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
464 |
#else |
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
465 |
if (is_signed == Signed) { |
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
466 |
lwa(Rdst, offset, Rsrc); |
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
467 |
} else { |
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
468 |
lwz(Rdst, offset, Rsrc); |
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
469 |
} |
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
470 |
#endif |
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
471 |
} |
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
24322
diff
changeset
|
472 |
|
23221 | 473 |
// Load object from cpool->resolved_references(index). |
50162
f9fe56417050
8202713: Create a MacroAssembler::access_load/store_at wrapper for S390 and PPC
mdoerr
parents:
49748
diff
changeset
|
474 |
void InterpreterMacroAssembler::load_resolved_reference_at_index(Register result, Register index, Label *L_handle_null) { |
23221 | 475 |
assert_different_registers(result, index); |
476 |
get_constant_pool(result); |
|
477 |
||
478 |
// Convert from field index to resolved_references() index and from |
|
479 |
// word index to byte offset. Since this is a java object, it can be compressed. |
|
480 |
Register tmp = index; // reuse |
|
481 |
sldi(tmp, index, LogBytesPerHeapOop); |
|
482 |
// Load pointer for resolved_references[] objArray. |
|
46427
54713555867e
8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents:
41342
diff
changeset
|
483 |
ld(result, ConstantPool::cache_offset_in_bytes(), result); |
54713555867e
8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents:
41342
diff
changeset
|
484 |
ld(result, ConstantPoolCache::resolved_references_offset_in_bytes(), result); |
46961
c9094b1e5f87
8186088: ConstantPoolCache::_resolved_references is not a JNIHandle
coleenp
parents:
46615
diff
changeset
|
485 |
resolve_oop_handle(result); |
23221 | 486 |
#ifdef ASSERT |
487 |
Label index_ok; |
|
488 |
lwa(R0, arrayOopDesc::length_offset_in_bytes(), result); |
|
489 |
sldi(R0, R0, LogBytesPerHeapOop); |
|
490 |
cmpd(CCR0, tmp, R0); |
|
491 |
blt(CCR0, index_ok); |
|
492 |
stop("resolved reference index out of bounds", 0x09256); |
|
493 |
bind(index_ok); |
|
494 |
#endif |
|
495 |
// Add in the index. |
|
496 |
add(result, tmp, result); |
|
50162
f9fe56417050
8202713: Create a MacroAssembler::access_load/store_at wrapper for S390 and PPC
mdoerr
parents:
49748
diff
changeset
|
497 |
load_heap_oop(result, arrayOopDesc::base_offset_in_bytes(T_OBJECT), result, tmp, R0, false, 0, L_handle_null); |
23221 | 498 |
} |
499 |
||
46427
54713555867e
8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents:
41342
diff
changeset
|
500 |
// load cpool->resolved_klass_at(index) |
54713555867e
8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents:
41342
diff
changeset
|
501 |
void InterpreterMacroAssembler::load_resolved_klass_at_offset(Register Rcpool, Register Roffset, Register Rklass) { |
54713555867e
8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents:
41342
diff
changeset
|
502 |
// int value = *(Rcpool->int_at_addr(which)); |
54713555867e
8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents:
41342
diff
changeset
|
503 |
// int resolved_klass_index = extract_low_short_from_int(value); |
54713555867e
8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents:
41342
diff
changeset
|
504 |
add(Roffset, Rcpool, Roffset); |
54713555867e
8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents:
41342
diff
changeset
|
505 |
#if defined(VM_LITTLE_ENDIAN) |
54713555867e
8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents:
41342
diff
changeset
|
506 |
lhz(Roffset, sizeof(ConstantPool), Roffset); // Roffset = resolved_klass_index |
54713555867e
8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents:
41342
diff
changeset
|
507 |
#else |
54713555867e
8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents:
41342
diff
changeset
|
508 |
lhz(Roffset, sizeof(ConstantPool) + 2, Roffset); // Roffset = resolved_klass_index |
54713555867e
8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents:
41342
diff
changeset
|
509 |
#endif |
54713555867e
8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents:
41342
diff
changeset
|
510 |
|
54713555867e
8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents:
41342
diff
changeset
|
511 |
ld(Rklass, ConstantPool::resolved_klasses_offset_in_bytes(), Rcpool); // Rklass = Rcpool->_resolved_klasses |
54713555867e
8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents:
41342
diff
changeset
|
512 |
|
54713555867e
8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents:
41342
diff
changeset
|
513 |
sldi(Roffset, Roffset, LogBytesPerWord); |
54713555867e
8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents:
41342
diff
changeset
|
514 |
addi(Roffset, Roffset, Array<Klass*>::base_offset_in_bytes()); |
54713555867e
8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents:
41342
diff
changeset
|
515 |
isync(); // Order load of instance Klass wrt. tags. |
54713555867e
8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents:
41342
diff
changeset
|
516 |
ldx(Rklass, Rklass, Roffset); |
54713555867e
8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents:
41342
diff
changeset
|
517 |
} |
54713555867e
8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents:
41342
diff
changeset
|
518 |
|
55322
bc5baf205475
8224826: Implement fast class initialization checks on PPC64
mdoerr
parents:
50162
diff
changeset
|
519 |
void InterpreterMacroAssembler::load_resolved_method_at_index(int byte_no, |
bc5baf205475
8224826: Implement fast class initialization checks on PPC64
mdoerr
parents:
50162
diff
changeset
|
520 |
Register cache, |
bc5baf205475
8224826: Implement fast class initialization checks on PPC64
mdoerr
parents:
50162
diff
changeset
|
521 |
Register method) { |
bc5baf205475
8224826: Implement fast class initialization checks on PPC64
mdoerr
parents:
50162
diff
changeset
|
522 |
const int method_offset = in_bytes( |
bc5baf205475
8224826: Implement fast class initialization checks on PPC64
mdoerr
parents:
50162
diff
changeset
|
523 |
ConstantPoolCache::base_offset() + |
bc5baf205475
8224826: Implement fast class initialization checks on PPC64
mdoerr
parents:
50162
diff
changeset
|
524 |
((byte_no == TemplateTable::f2_byte) |
bc5baf205475
8224826: Implement fast class initialization checks on PPC64
mdoerr
parents:
50162
diff
changeset
|
525 |
? ConstantPoolCacheEntry::f2_offset() |
bc5baf205475
8224826: Implement fast class initialization checks on PPC64
mdoerr
parents:
50162
diff
changeset
|
526 |
: ConstantPoolCacheEntry::f1_offset())); |
bc5baf205475
8224826: Implement fast class initialization checks on PPC64
mdoerr
parents:
50162
diff
changeset
|
527 |
|
bc5baf205475
8224826: Implement fast class initialization checks on PPC64
mdoerr
parents:
50162
diff
changeset
|
528 |
ld(method, method_offset, cache); // get f1 Method* |
bc5baf205475
8224826: Implement fast class initialization checks on PPC64
mdoerr
parents:
50162
diff
changeset
|
529 |
} |
bc5baf205475
8224826: Implement fast class initialization checks on PPC64
mdoerr
parents:
50162
diff
changeset
|
530 |
|
23221 | 531 |
// Generate a subtype check: branch to ok_is_subtype if sub_klass is |
532 |
// a subtype of super_klass. Blows registers Rsub_klass, tmp1, tmp2. |
|
533 |
void InterpreterMacroAssembler::gen_subtype_check(Register Rsub_klass, Register Rsuper_klass, Register Rtmp1, |
|
534 |
Register Rtmp2, Register Rtmp3, Label &ok_is_subtype) { |
|
535 |
// Profile the not-null value's klass. |
|
536 |
profile_typecheck(Rsub_klass, Rtmp1, Rtmp2); |
|
537 |
check_klass_subtype(Rsub_klass, Rsuper_klass, Rtmp1, Rtmp2, ok_is_subtype); |
|
538 |
profile_typecheck_failed(Rtmp1, Rtmp2); |
|
539 |
} |
|
540 |
||
541 |
// Separate these two to allow for delay slot in middle. |
|
542 |
// These are used to do a test and full jump to exception-throwing code. |
|
543 |
||
544 |
// Check that index is in range for array, then shift index by index_shift, |
|
545 |
// and put arrayOop + shifted_index into res. |
|
546 |
// Note: res is still shy of address by array offset into object. |
|
547 |
||
35166
23125410af16
8145117: PPC64: Remove cpp interpreter implementation
goetz
parents:
33083
diff
changeset
|
548 |
void InterpreterMacroAssembler::index_check_without_pop(Register Rarray, Register Rindex, |
23125410af16
8145117: PPC64: Remove cpp interpreter implementation
goetz
parents:
33083
diff
changeset
|
549 |
int index_shift, Register Rtmp, Register Rres) { |
23221 | 550 |
// Check that index is in range for array, then shift index by index_shift, |
551 |
// and put arrayOop + shifted_index into res. |
|
552 |
// Note: res is still shy of address by array offset into object. |
|
553 |
// Kills: |
|
554 |
// - Rindex |
|
555 |
// Writes: |
|
556 |
// - Rres: Address that corresponds to the array index if check was successful. |
|
557 |
verify_oop(Rarray); |
|
558 |
const Register Rlength = R0; |
|
559 |
const Register RsxtIndex = Rtmp; |
|
560 |
Label LisNull, LnotOOR; |
|
561 |
||
562 |
// Array nullcheck |
|
563 |
if (!ImplicitNullChecks) { |
|
564 |
cmpdi(CCR0, Rarray, 0); |
|
565 |
beq(CCR0, LisNull); |
|
566 |
} else { |
|
567 |
null_check_throw(Rarray, arrayOopDesc::length_offset_in_bytes(), /*temp*/RsxtIndex); |
|
568 |
} |
|
569 |
||
570 |
// Rindex might contain garbage in upper bits (remember that we don't sign extend |
|
571 |
// during integer arithmetic operations). So kill them and put value into same register |
|
572 |
// where ArrayIndexOutOfBounds would expect the index in. |
|
573 |
rldicl(RsxtIndex, Rindex, 0, 32); // zero extend 32 bit -> 64 bit |
|
574 |
||
575 |
// Index check |
|
576 |
lwz(Rlength, arrayOopDesc::length_offset_in_bytes(), Rarray); |
|
577 |
cmplw(CCR0, Rindex, Rlength); |
|
578 |
sldi(RsxtIndex, RsxtIndex, index_shift); |
|
579 |
blt(CCR0, LnotOOR); |
|
28187
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
580 |
// Index should be in R17_tos, array should be in R4_ARG2. |
35085 | 581 |
mr_if_needed(R17_tos, Rindex); |
582 |
mr_if_needed(R4_ARG2, Rarray); |
|
23221 | 583 |
load_dispatch_table(Rtmp, (address*)Interpreter::_throw_ArrayIndexOutOfBoundsException_entry); |
584 |
mtctr(Rtmp); |
|
585 |
bctr(); |
|
586 |
||
587 |
if (!ImplicitNullChecks) { |
|
588 |
bind(LisNull); |
|
589 |
load_dispatch_table(Rtmp, (address*)Interpreter::_throw_NullPointerException_entry); |
|
590 |
mtctr(Rtmp); |
|
591 |
bctr(); |
|
592 |
} |
|
593 |
||
594 |
align(32, 16); |
|
595 |
bind(LnotOOR); |
|
596 |
||
597 |
// Calc address |
|
598 |
add(Rres, RsxtIndex, Rarray); |
|
599 |
} |
|
600 |
||
35166
23125410af16
8145117: PPC64: Remove cpp interpreter implementation
goetz
parents:
33083
diff
changeset
|
601 |
void InterpreterMacroAssembler::index_check(Register array, Register index, |
23125410af16
8145117: PPC64: Remove cpp interpreter implementation
goetz
parents:
33083
diff
changeset
|
602 |
int index_shift, Register tmp, Register res) { |
23221 | 603 |
// pop array |
604 |
pop_ptr(array); |
|
605 |
||
606 |
// check array |
|
607 |
index_check_without_pop(array, index, index_shift, tmp, res); |
|
608 |
} |
|
609 |
||
610 |
void InterpreterMacroAssembler::get_const(Register Rdst) { |
|
611 |
ld(Rdst, in_bytes(Method::const_offset()), R19_method); |
|
612 |
} |
|
613 |
||
614 |
void InterpreterMacroAssembler::get_constant_pool(Register Rdst) { |
|
615 |
get_const(Rdst); |
|
616 |
ld(Rdst, in_bytes(ConstMethod::constants_offset()), Rdst); |
|
617 |
} |
|
618 |
||
619 |
void InterpreterMacroAssembler::get_constant_pool_cache(Register Rdst) { |
|
620 |
get_constant_pool(Rdst); |
|
621 |
ld(Rdst, ConstantPool::cache_offset_in_bytes(), Rdst); |
|
622 |
} |
|
623 |
||
624 |
void InterpreterMacroAssembler::get_cpool_and_tags(Register Rcpool, Register Rtags) { |
|
625 |
get_constant_pool(Rcpool); |
|
626 |
ld(Rtags, ConstantPool::tags_offset_in_bytes(), Rcpool); |
|
627 |
} |
|
628 |
||
629 |
// Unlock if synchronized method. |
|
630 |
// |
|
631 |
// Unlock the receiver if this is a synchronized method. |
|
632 |
// Unlock any Java monitors from synchronized blocks. |
|
633 |
// |
|
634 |
// If there are locked Java monitors |
|
635 |
// If throw_monitor_exception |
|
636 |
// throws IllegalMonitorStateException |
|
637 |
// Else if install_monitor_exception |
|
638 |
// installs IllegalMonitorStateException |
|
639 |
// Else |
|
640 |
// no error processing |
|
641 |
void InterpreterMacroAssembler::unlock_if_synchronized_method(TosState state, |
|
642 |
bool throw_monitor_exception, |
|
643 |
bool install_monitor_exception) { |
|
644 |
Label Lunlocked, Lno_unlock; |
|
645 |
{ |
|
646 |
Register Rdo_not_unlock_flag = R11_scratch1; |
|
647 |
Register Raccess_flags = R12_scratch2; |
|
648 |
||
649 |
// Check if synchronized method or unlocking prevented by |
|
650 |
// JavaThread::do_not_unlock_if_synchronized flag. |
|
651 |
lbz(Rdo_not_unlock_flag, in_bytes(JavaThread::do_not_unlock_if_synchronized_offset()), R16_thread); |
|
652 |
lwz(Raccess_flags, in_bytes(Method::access_flags_offset()), R19_method); |
|
653 |
li(R0, 0); |
|
654 |
stb(R0, in_bytes(JavaThread::do_not_unlock_if_synchronized_offset()), R16_thread); // reset flag |
|
655 |
||
656 |
push(state); |
|
657 |
||
658 |
// Skip if we don't have to unlock. |
|
659 |
rldicl_(R0, Raccess_flags, 64-JVM_ACC_SYNCHRONIZED_BIT, 63); // Extract bit and compare to 0. |
|
660 |
beq(CCR0, Lunlocked); |
|
661 |
||
662 |
cmpwi(CCR0, Rdo_not_unlock_flag, 0); |
|
663 |
bne(CCR0, Lno_unlock); |
|
664 |
} |
|
665 |
||
666 |
// Unlock |
|
667 |
{ |
|
668 |
Register Rmonitor_base = R11_scratch1; |
|
669 |
||
670 |
Label Lunlock; |
|
671 |
// If it's still locked, everything is ok, unlock it. |
|
672 |
ld(Rmonitor_base, 0, R1_SP); |
|
35166
23125410af16
8145117: PPC64: Remove cpp interpreter implementation
goetz
parents:
33083
diff
changeset
|
673 |
addi(Rmonitor_base, Rmonitor_base, |
23125410af16
8145117: PPC64: Remove cpp interpreter implementation
goetz
parents:
33083
diff
changeset
|
674 |
-(frame::ijava_state_size + frame::interpreter_frame_monitor_size_in_bytes())); // Monitor base |
23221 | 675 |
|
676 |
ld(R0, BasicObjectLock::obj_offset_in_bytes(), Rmonitor_base); |
|
677 |
cmpdi(CCR0, R0, 0); |
|
678 |
bne(CCR0, Lunlock); |
|
679 |
||
680 |
// If it's already unlocked, throw exception. |
|
681 |
if (throw_monitor_exception) { |
|
682 |
call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_illegal_monitor_state_exception)); |
|
683 |
should_not_reach_here(); |
|
684 |
} else { |
|
685 |
if (install_monitor_exception) { |
|
686 |
call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::new_illegal_monitor_state_exception)); |
|
687 |
b(Lunlocked); |
|
688 |
} |
|
689 |
} |
|
690 |
||
691 |
bind(Lunlock); |
|
692 |
unlock_object(Rmonitor_base); |
|
693 |
} |
|
694 |
||
695 |
// Check that all other monitors are unlocked. Throw IllegelMonitorState exception if not. |
|
696 |
bind(Lunlocked); |
|
697 |
{ |
|
698 |
Label Lexception, Lrestart; |
|
699 |
Register Rcurrent_obj_addr = R11_scratch1; |
|
700 |
const int delta = frame::interpreter_frame_monitor_size_in_bytes(); |
|
701 |
assert((delta & LongAlignmentMask) == 0, "sizeof BasicObjectLock must be even number of doublewords"); |
|
702 |
||
703 |
bind(Lrestart); |
|
704 |
// Set up search loop: Calc num of iterations. |
|
705 |
{ |
|
706 |
Register Riterations = R12_scratch2; |
|
707 |
Register Rmonitor_base = Rcurrent_obj_addr; |
|
708 |
ld(Rmonitor_base, 0, R1_SP); |
|
709 |
addi(Rmonitor_base, Rmonitor_base, - frame::ijava_state_size); // Monitor base |
|
710 |
||
711 |
subf_(Riterations, R26_monitor, Rmonitor_base); |
|
712 |
ble(CCR0, Lno_unlock); |
|
713 |
||
35166
23125410af16
8145117: PPC64: Remove cpp interpreter implementation
goetz
parents:
33083
diff
changeset
|
714 |
addi(Rcurrent_obj_addr, Rmonitor_base, |
23125410af16
8145117: PPC64: Remove cpp interpreter implementation
goetz
parents:
33083
diff
changeset
|
715 |
BasicObjectLock::obj_offset_in_bytes() - frame::interpreter_frame_monitor_size_in_bytes()); |
23221 | 716 |
// Check if any monitor is on stack, bail out if not |
717 |
srdi(Riterations, Riterations, exact_log2(delta)); |
|
718 |
mtctr(Riterations); |
|
719 |
} |
|
720 |
||
721 |
// The search loop: Look for locked monitors. |
|
722 |
{ |
|
723 |
const Register Rcurrent_obj = R0; |
|
724 |
Label Lloop; |
|
725 |
||
726 |
ld(Rcurrent_obj, 0, Rcurrent_obj_addr); |
|
727 |
addi(Rcurrent_obj_addr, Rcurrent_obj_addr, -delta); |
|
728 |
bind(Lloop); |
|
729 |
||
730 |
// Check if current entry is used. |
|
731 |
cmpdi(CCR0, Rcurrent_obj, 0); |
|
732 |
bne(CCR0, Lexception); |
|
733 |
// Preload next iteration's compare value. |
|
734 |
ld(Rcurrent_obj, 0, Rcurrent_obj_addr); |
|
735 |
addi(Rcurrent_obj_addr, Rcurrent_obj_addr, -delta); |
|
736 |
bdnz(Lloop); |
|
737 |
} |
|
738 |
// Fell through: Everything's unlocked => finish. |
|
739 |
b(Lno_unlock); |
|
740 |
||
741 |
// An object is still locked => need to throw exception. |
|
742 |
bind(Lexception); |
|
743 |
if (throw_monitor_exception) { |
|
744 |
call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_illegal_monitor_state_exception)); |
|
745 |
should_not_reach_here(); |
|
746 |
} else { |
|
747 |
// Stack unrolling. Unlock object and if requested, install illegal_monitor_exception. |
|
748 |
// Unlock does not block, so don't have to worry about the frame. |
|
749 |
Register Rmonitor_addr = R11_scratch1; |
|
750 |
addi(Rmonitor_addr, Rcurrent_obj_addr, -BasicObjectLock::obj_offset_in_bytes() + delta); |
|
751 |
unlock_object(Rmonitor_addr); |
|
752 |
if (install_monitor_exception) { |
|
753 |
call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::new_illegal_monitor_state_exception)); |
|
754 |
} |
|
755 |
b(Lrestart); |
|
756 |
} |
|
757 |
} |
|
758 |
||
759 |
align(32, 12); |
|
760 |
bind(Lno_unlock); |
|
761 |
pop(state); |
|
762 |
} |
|
763 |
||
764 |
// Support function for remove_activation & Co. |
|
35166
23125410af16
8145117: PPC64: Remove cpp interpreter implementation
goetz
parents:
33083
diff
changeset
|
765 |
void InterpreterMacroAssembler::merge_frames(Register Rsender_sp, Register return_pc, |
23125410af16
8145117: PPC64: Remove cpp interpreter implementation
goetz
parents:
33083
diff
changeset
|
766 |
Register Rscratch1, Register Rscratch2) { |
23221 | 767 |
// Pop interpreter frame. |
768 |
ld(Rscratch1, 0, R1_SP); // *SP |
|
769 |
ld(Rsender_sp, _ijava_state_neg(sender_sp), Rscratch1); // top_frame_sp |
|
770 |
ld(Rscratch2, 0, Rscratch1); // **SP |
|
771 |
if (return_pc!=noreg) { |
|
772 |
ld(return_pc, _abi(lr), Rscratch1); // LR |
|
773 |
} |
|
774 |
||
775 |
// Merge top frames. |
|
776 |
subf(Rscratch1, R1_SP, Rsender_sp); // top_frame_sp - SP |
|
777 |
stdux(Rscratch2, R1_SP, Rscratch1); // atomically set *(SP = top_frame_sp) = **SP |
|
778 |
} |
|
779 |
||
37488 | 780 |
void InterpreterMacroAssembler::narrow(Register result) { |
781 |
Register ret_type = R11_scratch1; |
|
782 |
ld(R11_scratch1, in_bytes(Method::const_offset()), R19_method); |
|
783 |
lbz(ret_type, in_bytes(ConstMethod::result_type_offset()), R11_scratch1); |
|
784 |
||
785 |
Label notBool, notByte, notChar, done; |
|
786 |
||
787 |
// common case first |
|
788 |
cmpwi(CCR0, ret_type, T_INT); |
|
789 |
beq(CCR0, done); |
|
790 |
||
791 |
cmpwi(CCR0, ret_type, T_BOOLEAN); |
|
792 |
bne(CCR0, notBool); |
|
793 |
andi(result, result, 0x1); |
|
794 |
b(done); |
|
795 |
||
796 |
bind(notBool); |
|
797 |
cmpwi(CCR0, ret_type, T_BYTE); |
|
798 |
bne(CCR0, notByte); |
|
799 |
extsb(result, result); |
|
800 |
b(done); |
|
801 |
||
802 |
bind(notByte); |
|
803 |
cmpwi(CCR0, ret_type, T_CHAR); |
|
804 |
bne(CCR0, notChar); |
|
805 |
andi(result, result, 0xffff); |
|
806 |
b(done); |
|
807 |
||
808 |
bind(notChar); |
|
809 |
// cmpwi(CCR0, ret_type, T_SHORT); // all that's left |
|
810 |
// bne(CCR0, done); |
|
811 |
extsh(result, result); |
|
812 |
||
813 |
// Nothing to do for T_INT |
|
814 |
bind(done); |
|
815 |
} |
|
816 |
||
23221 | 817 |
// Remove activation. |
818 |
// |
|
819 |
// Unlock the receiver if this is a synchronized method. |
|
820 |
// Unlock any Java monitors from synchronized blocks. |
|
821 |
// Remove the activation from the stack. |
|
822 |
// |
|
823 |
// If there are locked Java monitors |
|
824 |
// If throw_monitor_exception |
|
825 |
// throws IllegalMonitorStateException |
|
826 |
// Else if install_monitor_exception |
|
827 |
// installs IllegalMonitorStateException |
|
828 |
// Else |
|
829 |
// no error processing |
|
830 |
void InterpreterMacroAssembler::remove_activation(TosState state, |
|
831 |
bool throw_monitor_exception, |
|
832 |
bool install_monitor_exception) { |
|
38931
3cf28d630349
8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents:
37488
diff
changeset
|
833 |
BLOCK_COMMENT("remove_activation {"); |
23221 | 834 |
unlock_if_synchronized_method(state, throw_monitor_exception, install_monitor_exception); |
835 |
||
836 |
// Save result (push state before jvmti call and pop it afterwards) and notify jvmti. |
|
837 |
notify_method_exit(false, state, NotifyJVMTI, true); |
|
838 |
||
38931
3cf28d630349
8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents:
37488
diff
changeset
|
839 |
BLOCK_COMMENT("reserved_stack_check:"); |
3cf28d630349
8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents:
37488
diff
changeset
|
840 |
if (StackReservedPages > 0) { |
3cf28d630349
8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents:
37488
diff
changeset
|
841 |
// Test if reserved zone needs to be enabled. |
3cf28d630349
8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents:
37488
diff
changeset
|
842 |
Label no_reserved_zone_enabling; |
3cf28d630349
8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents:
37488
diff
changeset
|
843 |
|
3cf28d630349
8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents:
37488
diff
changeset
|
844 |
// Compare frame pointers. There is no good stack pointer, as with stack |
3cf28d630349
8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents:
37488
diff
changeset
|
845 |
// frame compression we can get different SPs when we do calls. A subsequent |
3cf28d630349
8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents:
37488
diff
changeset
|
846 |
// call could have a smaller SP, so that this compare succeeds for an |
3cf28d630349
8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents:
37488
diff
changeset
|
847 |
// inner call of the method annotated with ReservedStack. |
3cf28d630349
8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents:
37488
diff
changeset
|
848 |
ld_ptr(R0, JavaThread::reserved_stack_activation_offset(), R16_thread); |
3cf28d630349
8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents:
37488
diff
changeset
|
849 |
ld_ptr(R11_scratch1, _abi(callers_sp), R1_SP); // Load frame pointer. |
3cf28d630349
8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents:
37488
diff
changeset
|
850 |
cmpld(CCR0, R11_scratch1, R0); |
3cf28d630349
8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents:
37488
diff
changeset
|
851 |
blt_predict_taken(CCR0, no_reserved_zone_enabling); |
3cf28d630349
8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents:
37488
diff
changeset
|
852 |
|
3cf28d630349
8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents:
37488
diff
changeset
|
853 |
// Enable reserved zone again, throw stack overflow exception. |
3cf28d630349
8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents:
37488
diff
changeset
|
854 |
call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::enable_stack_reserved_zone), R16_thread); |
3cf28d630349
8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents:
37488
diff
changeset
|
855 |
call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_delayed_StackOverflowError)); |
3cf28d630349
8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents:
37488
diff
changeset
|
856 |
|
3cf28d630349
8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents:
37488
diff
changeset
|
857 |
should_not_reach_here(); |
3cf28d630349
8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents:
37488
diff
changeset
|
858 |
|
3cf28d630349
8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents:
37488
diff
changeset
|
859 |
bind(no_reserved_zone_enabling); |
3cf28d630349
8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents:
37488
diff
changeset
|
860 |
} |
3cf28d630349
8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents:
37488
diff
changeset
|
861 |
|
23221 | 862 |
verify_oop(R17_tos, state); |
863 |
verify_thread(); |
|
864 |
||
865 |
merge_frames(/*top_frame_sp*/ R21_sender_SP, /*return_pc*/ R0, R11_scratch1, R12_scratch2); |
|
866 |
mtlr(R0); |
|
38931
3cf28d630349
8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents:
37488
diff
changeset
|
867 |
BLOCK_COMMENT("} remove_activation"); |
23221 | 868 |
} |
869 |
||
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
870 |
// Lock object |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
871 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
872 |
// Registers alive |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
873 |
// monitor - Address of the BasicObjectLock to be used for locking, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
874 |
// which must be initialized with the object to lock. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
875 |
// object - Address of the object to be locked. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
876 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
877 |
void InterpreterMacroAssembler::lock_object(Register monitor, Register object) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
878 |
if (UseHeavyMonitors) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
879 |
call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorenter), |
35166
23125410af16
8145117: PPC64: Remove cpp interpreter implementation
goetz
parents:
33083
diff
changeset
|
880 |
monitor, /*check_for_exceptions=*/true); |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
881 |
} else { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
882 |
// template code: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
883 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
884 |
// markOop displaced_header = obj->mark().set_unlocked(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
885 |
// monitor->lock()->set_displaced_header(displaced_header); |
47634
6a0c42c40cd1
8188220: Remove Atomic::*_ptr() uses and overloads from hotspot
coleenp
parents:
47216
diff
changeset
|
886 |
// if (Atomic::cmpxchg(/*ex=*/monitor, /*addr*/obj->mark_addr(), /*cmp*/displaced_header) == displaced_header) { |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
887 |
// // We stored the monitor address into the object's mark word. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
888 |
// } else if (THREAD->is_lock_owned((address)displaced_header)) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
889 |
// // Simple recursive case. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
890 |
// monitor->lock()->set_displaced_header(NULL); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
891 |
// } else { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
892 |
// // Slow path. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
893 |
// InterpreterRuntime::monitorenter(THREAD, monitor); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
894 |
// } |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
895 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
896 |
const Register displaced_header = R7_ARG5; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
897 |
const Register object_mark_addr = R8_ARG6; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
898 |
const Register current_header = R9_ARG7; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
899 |
const Register tmp = R10_ARG8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
900 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
901 |
Label done; |
22861 | 902 |
Label cas_failed, slow_case; |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
903 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
904 |
assert_different_registers(displaced_header, object_mark_addr, current_header, tmp); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
905 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
906 |
// markOop displaced_header = obj->mark().set_unlocked(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
907 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
908 |
// Load markOop from object into displaced_header. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
909 |
ld(displaced_header, oopDesc::mark_offset_in_bytes(), object); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
910 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
911 |
if (UseBiasedLocking) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
912 |
biased_locking_enter(CCR0, object, displaced_header, tmp, current_header, done, &slow_case); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
913 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
914 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
915 |
// Set displaced_header to be (markOop of object | UNLOCK_VALUE). |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
916 |
ori(displaced_header, displaced_header, markOopDesc::unlocked_value); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
917 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
918 |
// monitor->lock()->set_displaced_header(displaced_header); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
919 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
920 |
// Initialize the box (Must happen before we update the object mark!). |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
921 |
std(displaced_header, BasicObjectLock::lock_offset_in_bytes() + |
22861 | 922 |
BasicLock::displaced_header_offset_in_bytes(), monitor); |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
923 |
|
47634
6a0c42c40cd1
8188220: Remove Atomic::*_ptr() uses and overloads from hotspot
coleenp
parents:
47216
diff
changeset
|
924 |
// if (Atomic::cmpxchg(/*ex=*/monitor, /*addr*/obj->mark_addr(), /*cmp*/displaced_header) == displaced_header) { |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
925 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
926 |
// Store stack address of the BasicObjectLock (this is monitor) into object. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
927 |
addi(object_mark_addr, object, oopDesc::mark_offset_in_bytes()); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
928 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
929 |
// Must fence, otherwise, preceding store(s) may float below cmpxchg. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
930 |
// CmpxchgX sets CCR0 to cmpX(current, displaced). |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
931 |
cmpxchgd(/*flag=*/CCR0, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
932 |
/*current_value=*/current_header, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
933 |
/*compare_value=*/displaced_header, /*exchange_value=*/monitor, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
934 |
/*where=*/object_mark_addr, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
935 |
MacroAssembler::MemBarRel | MacroAssembler::MemBarAcq, |
22861 | 936 |
MacroAssembler::cmpxchgx_hint_acquire_lock(), |
937 |
noreg, |
|
35085 | 938 |
&cas_failed, |
939 |
/*check without membar and ldarx first*/true); |
|
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
940 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
941 |
// If the compare-and-exchange succeeded, then we found an unlocked |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
942 |
// object and we have now locked it. |
22861 | 943 |
b(done); |
944 |
bind(cas_failed); |
|
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
945 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
946 |
// } else if (THREAD->is_lock_owned((address)displaced_header)) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
947 |
// // Simple recursive case. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
948 |
// monitor->lock()->set_displaced_header(NULL); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
949 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
950 |
// We did not see an unlocked object so try the fast recursive case. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
951 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
952 |
// Check if owner is self by comparing the value in the markOop of object |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
953 |
// (current_header) with the stack pointer. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
954 |
sub(current_header, current_header, R1_SP); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
955 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
956 |
assert(os::vm_page_size() > 0xfff, "page size too small - change the constant"); |
35085 | 957 |
load_const_optimized(tmp, ~(os::vm_page_size()-1) | markOopDesc::lock_mask_in_place); |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
958 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
959 |
and_(R0/*==0?*/, current_header, tmp); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
960 |
// If condition is true we are done and hence we can store 0 in the displaced |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
961 |
// header indicating it is a recursive lock. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
962 |
bne(CCR0, slow_case); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
963 |
std(R0/*==0!*/, BasicObjectLock::lock_offset_in_bytes() + |
22861 | 964 |
BasicLock::displaced_header_offset_in_bytes(), monitor); |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
965 |
b(done); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
966 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
967 |
// } else { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
968 |
// // Slow path. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
969 |
// InterpreterRuntime::monitorenter(THREAD, monitor); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
970 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
971 |
// None of the above fast optimizations worked so we have to get into the |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
972 |
// slow case of monitor enter. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
973 |
bind(slow_case); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
974 |
call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorenter), |
35166
23125410af16
8145117: PPC64: Remove cpp interpreter implementation
goetz
parents:
33083
diff
changeset
|
975 |
monitor, /*check_for_exceptions=*/true); |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
976 |
// } |
23221 | 977 |
align(32, 12); |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
978 |
bind(done); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
979 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
980 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
981 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
982 |
// Unlocks an object. Used in monitorexit bytecode and remove_activation. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
983 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
984 |
// Registers alive |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
985 |
// monitor - Address of the BasicObjectLock to be used for locking, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
986 |
// which must be initialized with the object to lock. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
987 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
988 |
// Throw IllegalMonitorException if object is not locked by current thread. |
22861 | 989 |
void InterpreterMacroAssembler::unlock_object(Register monitor, bool check_for_exceptions) { |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
990 |
if (UseHeavyMonitors) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
991 |
call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorexit), |
35166
23125410af16
8145117: PPC64: Remove cpp interpreter implementation
goetz
parents:
33083
diff
changeset
|
992 |
monitor, check_for_exceptions); |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
993 |
} else { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
994 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
995 |
// template code: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
996 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
997 |
// if ((displaced_header = monitor->displaced_header()) == NULL) { |
23221 | 998 |
// // Recursive unlock. Mark the monitor unlocked by setting the object field to NULL. |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
999 |
// monitor->set_obj(NULL); |
47634
6a0c42c40cd1
8188220: Remove Atomic::*_ptr() uses and overloads from hotspot
coleenp
parents:
47216
diff
changeset
|
1000 |
// } else if (Atomic::cmpxchg(displaced_header, obj->mark_addr(), monitor) == monitor) { |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1001 |
// // We swapped the unlocked mark in displaced_header into the object's mark word. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1002 |
// monitor->set_obj(NULL); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1003 |
// } else { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1004 |
// // Slow path. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1005 |
// InterpreterRuntime::monitorexit(THREAD, monitor); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1006 |
// } |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1007 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1008 |
const Register object = R7_ARG5; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1009 |
const Register displaced_header = R8_ARG6; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1010 |
const Register object_mark_addr = R9_ARG7; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1011 |
const Register current_header = R10_ARG8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1012 |
|
22861 | 1013 |
Label free_slot; |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1014 |
Label slow_case; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1015 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1016 |
assert_different_registers(object, displaced_header, object_mark_addr, current_header); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1017 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1018 |
if (UseBiasedLocking) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1019 |
// The object address from the monitor is in object. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1020 |
ld(object, BasicObjectLock::obj_offset_in_bytes(), monitor); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1021 |
assert(oopDesc::mark_offset_in_bytes() == 0, "offset of _mark is not 0"); |
22861 | 1022 |
biased_locking_exit(CCR0, object, displaced_header, free_slot); |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1023 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1024 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1025 |
// Test first if we are in the fast recursive case. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1026 |
ld(displaced_header, BasicObjectLock::lock_offset_in_bytes() + |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1027 |
BasicLock::displaced_header_offset_in_bytes(), monitor); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1028 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1029 |
// If the displaced header is zero, we have a recursive unlock. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1030 |
cmpdi(CCR0, displaced_header, 0); |
22861 | 1031 |
beq(CCR0, free_slot); // recursive unlock |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1032 |
|
47634
6a0c42c40cd1
8188220: Remove Atomic::*_ptr() uses and overloads from hotspot
coleenp
parents:
47216
diff
changeset
|
1033 |
// } else if (Atomic::cmpxchg(displaced_header, obj->mark_addr(), monitor) == monitor) { |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1034 |
// // We swapped the unlocked mark in displaced_header into the object's mark word. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1035 |
// monitor->set_obj(NULL); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1036 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1037 |
// If we still have a lightweight lock, unlock the object and be done. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1038 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1039 |
// The object address from the monitor is in object. |
23221 | 1040 |
if (!UseBiasedLocking) { ld(object, BasicObjectLock::obj_offset_in_bytes(), monitor); } |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1041 |
addi(object_mark_addr, object, oopDesc::mark_offset_in_bytes()); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1042 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1043 |
// We have the displaced header in displaced_header. If the lock is still |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1044 |
// lightweight, it will contain the monitor address and we'll store the |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1045 |
// displaced header back into the object's mark word. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1046 |
// CmpxchgX sets CCR0 to cmpX(current, monitor). |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1047 |
cmpxchgd(/*flag=*/CCR0, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1048 |
/*current_value=*/current_header, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1049 |
/*compare_value=*/monitor, /*exchange_value=*/displaced_header, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1050 |
/*where=*/object_mark_addr, |
22861 | 1051 |
MacroAssembler::MemBarRel, |
1052 |
MacroAssembler::cmpxchgx_hint_release_lock(), |
|
1053 |
noreg, |
|
1054 |
&slow_case); |
|
1055 |
b(free_slot); |
|
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1056 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1057 |
// } else { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1058 |
// // Slow path. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1059 |
// InterpreterRuntime::monitorexit(THREAD, monitor); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1060 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1061 |
// The lock has been converted into a heavy lock and hence |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1062 |
// we need to get into the slow case. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1063 |
bind(slow_case); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1064 |
call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorexit), |
35166
23125410af16
8145117: PPC64: Remove cpp interpreter implementation
goetz
parents:
33083
diff
changeset
|
1065 |
monitor, check_for_exceptions); |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1066 |
// } |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1067 |
|
22861 | 1068 |
Label done; |
1069 |
b(done); // Monitor register may be overwritten! Runtime has already freed the slot. |
|
1070 |
||
1071 |
// Exchange worked, do monitor->set_obj(NULL); |
|
1072 |
align(32, 12); |
|
1073 |
bind(free_slot); |
|
1074 |
li(R0, 0); |
|
1075 |
std(R0, BasicObjectLock::obj_offset_in_bytes(), monitor); |
|
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1076 |
bind(done); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1077 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1078 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1079 |
|
23221 | 1080 |
// Load compiled (i2c) or interpreter entry when calling from interpreted and |
1081 |
// do the call. Centralized so that all interpreter calls will do the same actions. |
|
1082 |
// If jvmti single stepping is on for a thread we must not call compiled code. |
|
1083 |
// |
|
1084 |
// Input: |
|
1085 |
// - Rtarget_method: method to call |
|
1086 |
// - Rret_addr: return address |
|
1087 |
// - 2 scratch regs |
|
1088 |
// |
|
35166
23125410af16
8145117: PPC64: Remove cpp interpreter implementation
goetz
parents:
33083
diff
changeset
|
1089 |
void InterpreterMacroAssembler::call_from_interpreter(Register Rtarget_method, Register Rret_addr, |
23125410af16
8145117: PPC64: Remove cpp interpreter implementation
goetz
parents:
33083
diff
changeset
|
1090 |
Register Rscratch1, Register Rscratch2) { |
23221 | 1091 |
assert_different_registers(Rscratch1, Rscratch2, Rtarget_method, Rret_addr); |
1092 |
// Assume we want to go compiled if available. |
|
1093 |
const Register Rtarget_addr = Rscratch1; |
|
1094 |
const Register Rinterp_only = Rscratch2; |
|
1095 |
||
1096 |
ld(Rtarget_addr, in_bytes(Method::from_interpreted_offset()), Rtarget_method); |
|
1097 |
||
1098 |
if (JvmtiExport::can_post_interpreter_events()) { |
|
1099 |
lwz(Rinterp_only, in_bytes(JavaThread::interp_only_mode_offset()), R16_thread); |
|
1100 |
||
1101 |
// JVMTI events, such as single-stepping, are implemented partly by avoiding running |
|
1102 |
// compiled code in threads for which the event is enabled. Check here for |
|
1103 |
// interp_only_mode if these events CAN be enabled. |
|
1104 |
Label done; |
|
1105 |
verify_thread(); |
|
1106 |
cmpwi(CCR0, Rinterp_only, 0); |
|
1107 |
beq(CCR0, done); |
|
1108 |
ld(Rtarget_addr, in_bytes(Method::interpreter_entry_offset()), Rtarget_method); |
|
1109 |
align(32, 12); |
|
1110 |
bind(done); |
|
1111 |
} |
|
1112 |
||
1113 |
#ifdef ASSERT |
|
1114 |
{ |
|
1115 |
Label Lok; |
|
1116 |
cmpdi(CCR0, Rtarget_addr, 0); |
|
1117 |
bne(CCR0, Lok); |
|
1118 |
stop("null entry point"); |
|
1119 |
bind(Lok); |
|
1120 |
} |
|
1121 |
#endif // ASSERT |
|
1122 |
||
1123 |
mr(R21_sender_SP, R1_SP); |
|
1124 |
||
1125 |
// Calc a precise SP for the call. The SP value we calculated in |
|
1126 |
// generate_fixed_frame() is based on the max_stack() value, so we would waste stack space |
|
1127 |
// if esp is not max. Also, the i2c adapter extends the stack space without restoring |
|
1128 |
// our pre-calced value, so repeating calls via i2c would result in stack overflow. |
|
1129 |
// Since esp already points to an empty slot, we just have to sub 1 additional slot |
|
1130 |
// to meet the abi scratch requirements. |
|
1131 |
// The max_stack pointer will get restored by means of the GR_Lmax_stack local in |
|
1132 |
// the return entry of the interpreter. |
|
1133 |
addi(Rscratch2, R15_esp, Interpreter::stackElementSize - frame::abi_reg_args_size); |
|
1134 |
clrrdi(Rscratch2, Rscratch2, exact_log2(frame::alignment_in_bytes)); // round towards smaller address |
|
1135 |
resize_frame_absolute(Rscratch2, Rscratch2, R0); |
|
1136 |
||
1137 |
mr_if_needed(R19_method, Rtarget_method); |
|
1138 |
mtctr(Rtarget_addr); |
|
1139 |
mtlr(Rret_addr); |
|
1140 |
||
1141 |
save_interpreter_state(Rscratch2); |
|
1142 |
#ifdef ASSERT |
|
1143 |
ld(Rscratch1, _ijava_state_neg(top_frame_sp), Rscratch2); // Rscratch2 contains fp |
|
1144 |
cmpd(CCR0, R21_sender_SP, Rscratch1); |
|
1145 |
asm_assert_eq("top_frame_sp incorrect", 0x951); |
|
1146 |
#endif |
|
1147 |
||
1148 |
bctr(); |
|
1149 |
} |
|
1150 |
||
1151 |
// Set the method data pointer for the current bcp. |
|
1152 |
void InterpreterMacroAssembler::set_method_data_pointer_for_bcp() { |
|
1153 |
assert(ProfileInterpreter, "must be profiling interpreter"); |
|
1154 |
Label get_continue; |
|
1155 |
ld(R28_mdx, in_bytes(Method::method_data_offset()), R19_method); |
|
1156 |
test_method_data_pointer(get_continue); |
|
1157 |
call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::bcp_to_di), R19_method, R14_bcp); |
|
1158 |
||
1159 |
addi(R28_mdx, R28_mdx, in_bytes(MethodData::data_offset())); |
|
1160 |
add(R28_mdx, R28_mdx, R3_RET); |
|
1161 |
bind(get_continue); |
|
1162 |
} |
|
1163 |
||
1164 |
// Test ImethodDataPtr. If it is null, continue at the specified label. |
|
1165 |
void InterpreterMacroAssembler::test_method_data_pointer(Label& zero_continue) { |
|
1166 |
assert(ProfileInterpreter, "must be profiling interpreter"); |
|
1167 |
cmpdi(CCR0, R28_mdx, 0); |
|
1168 |
beq(CCR0, zero_continue); |
|
1169 |
} |
|
1170 |
||
1171 |
void InterpreterMacroAssembler::verify_method_data_pointer() { |
|
1172 |
assert(ProfileInterpreter, "must be profiling interpreter"); |
|
1173 |
#ifdef ASSERT |
|
1174 |
Label verify_continue; |
|
1175 |
test_method_data_pointer(verify_continue); |
|
1176 |
||
1177 |
// If the mdp is valid, it will point to a DataLayout header which is |
|
1178 |
// consistent with the bcp. The converse is highly probable also. |
|
1179 |
lhz(R11_scratch1, in_bytes(DataLayout::bci_offset()), R28_mdx); |
|
1180 |
ld(R12_scratch2, in_bytes(Method::const_offset()), R19_method); |
|
1181 |
addi(R11_scratch1, R11_scratch1, in_bytes(ConstMethod::codes_offset())); |
|
1182 |
add(R11_scratch1, R12_scratch2, R12_scratch2); |
|
1183 |
cmpd(CCR0, R11_scratch1, R14_bcp); |
|
1184 |
beq(CCR0, verify_continue); |
|
1185 |
||
1186 |
call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::verify_mdp ), R19_method, R14_bcp, R28_mdx); |
|
1187 |
||
1188 |
bind(verify_continue); |
|
1189 |
#endif |
|
1190 |
} |
|
1191 |
||
1192 |
void InterpreterMacroAssembler::test_invocation_counter_for_mdp(Register invocation_count, |
|
35085 | 1193 |
Register method_counters, |
23221 | 1194 |
Register Rscratch, |
1195 |
Label &profile_continue) { |
|
1196 |
assert(ProfileInterpreter, "must be profiling interpreter"); |
|
1197 |
// Control will flow to "profile_continue" if the counter is less than the |
|
1198 |
// limit or if we call profile_method(). |
|
1199 |
Label done; |
|
1200 |
||
1201 |
// If no method data exists, and the counter is high enough, make one. |
|
35085 | 1202 |
lwz(Rscratch, in_bytes(MethodCounters::interpreter_profile_limit_offset()), method_counters); |
23221 | 1203 |
|
1204 |
cmpdi(CCR0, R28_mdx, 0); |
|
1205 |
// Test to see if we should create a method data oop. |
|
35085 | 1206 |
cmpd(CCR1, Rscratch, invocation_count); |
23221 | 1207 |
bne(CCR0, done); |
1208 |
bge(CCR1, profile_continue); |
|
1209 |
||
1210 |
// Build it now. |
|
1211 |
call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::profile_method)); |
|
1212 |
set_method_data_pointer_for_bcp(); |
|
1213 |
b(profile_continue); |
|
1214 |
||
1215 |
align(32, 12); |
|
1216 |
bind(done); |
|
1217 |
} |
|
1218 |
||
35085 | 1219 |
void InterpreterMacroAssembler::test_backedge_count_for_osr(Register backedge_count, Register method_counters, |
1220 |
Register target_bcp, Register disp, Register Rtmp) { |
|
1221 |
assert_different_registers(backedge_count, target_bcp, disp, Rtmp, R4_ARG2); |
|
23221 | 1222 |
assert(UseOnStackReplacement,"Must UseOnStackReplacement to test_backedge_count_for_osr"); |
1223 |
||
1224 |
Label did_not_overflow; |
|
1225 |
Label overflow_with_error; |
|
1226 |
||
35085 | 1227 |
lwz(Rtmp, in_bytes(MethodCounters::interpreter_backward_branch_limit_offset()), method_counters); |
23221 | 1228 |
cmpw(CCR0, backedge_count, Rtmp); |
1229 |
||
1230 |
blt(CCR0, did_not_overflow); |
|
1231 |
||
1232 |
// When ProfileInterpreter is on, the backedge_count comes from the |
|
1233 |
// methodDataOop, which value does not get reset on the call to |
|
1234 |
// frequency_counter_overflow(). To avoid excessive calls to the overflow |
|
1235 |
// routine while the method is being compiled, add a second test to make sure |
|
1236 |
// the overflow function is called only once every overflow_frequency. |
|
1237 |
if (ProfileInterpreter) { |
|
1238 |
const int overflow_frequency = 1024; |
|
35085 | 1239 |
andi_(Rtmp, backedge_count, overflow_frequency-1); |
23221 | 1240 |
bne(CCR0, did_not_overflow); |
1241 |
} |
|
1242 |
||
1243 |
// Overflow in loop, pass branch bytecode. |
|
35085 | 1244 |
subf(R4_ARG2, disp, target_bcp); // Compute branch bytecode (previous bcp). |
1245 |
call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::frequency_counter_overflow), R4_ARG2, true); |
|
23221 | 1246 |
|
1247 |
// Was an OSR adapter generated? |
|
1248 |
cmpdi(CCR0, R3_RET, 0); |
|
1249 |
beq(CCR0, overflow_with_error); |
|
1250 |
||
1251 |
// Has the nmethod been invalidated already? |
|
26705
fca1785e7084
8048721: -XX:+PrintCompilation prints negative bci for non entrant OSR methods
thartmann
parents:
25916
diff
changeset
|
1252 |
lbz(Rtmp, nmethod::state_offset(), R3_RET); |
fca1785e7084
8048721: -XX:+PrintCompilation prints negative bci for non entrant OSR methods
thartmann
parents:
25916
diff
changeset
|
1253 |
cmpwi(CCR0, Rtmp, nmethod::in_use); |
fca1785e7084
8048721: -XX:+PrintCompilation prints negative bci for non entrant OSR methods
thartmann
parents:
25916
diff
changeset
|
1254 |
bne(CCR0, overflow_with_error); |
23221 | 1255 |
|
1256 |
// Migrate the interpreter frame off of the stack. |
|
1257 |
// We can use all registers because we will not return to interpreter from this point. |
|
1258 |
||
1259 |
// Save nmethod. |
|
1260 |
const Register osr_nmethod = R31; |
|
1261 |
mr(osr_nmethod, R3_RET); |
|
1262 |
set_top_ijava_frame_at_SP_as_last_Java_frame(R1_SP, R11_scratch1); |
|
1263 |
call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::OSR_migration_begin), R16_thread); |
|
1264 |
reset_last_Java_frame(); |
|
1265 |
// OSR buffer is in ARG1 |
|
1266 |
||
1267 |
// Remove the interpreter frame. |
|
1268 |
merge_frames(/*top_frame_sp*/ R21_sender_SP, /*return_pc*/ R0, R11_scratch1, R12_scratch2); |
|
1269 |
||
1270 |
// Jump to the osr code. |
|
1271 |
ld(R11_scratch1, nmethod::osr_entry_point_offset(), osr_nmethod); |
|
1272 |
mtlr(R0); |
|
1273 |
mtctr(R11_scratch1); |
|
1274 |
bctr(); |
|
1275 |
||
1276 |
align(32, 12); |
|
1277 |
bind(overflow_with_error); |
|
1278 |
bind(did_not_overflow); |
|
1279 |
} |
|
1280 |
||
1281 |
// Store a value at some constant offset from the method data pointer. |
|
1282 |
void InterpreterMacroAssembler::set_mdp_data_at(int constant, Register value) { |
|
1283 |
assert(ProfileInterpreter, "must be profiling interpreter"); |
|
1284 |
||
1285 |
std(value, constant, R28_mdx); |
|
1286 |
} |
|
1287 |
||
1288 |
// Increment the value at some constant offset from the method data pointer. |
|
1289 |
void InterpreterMacroAssembler::increment_mdp_data_at(int constant, |
|
1290 |
Register counter_addr, |
|
1291 |
Register Rbumped_count, |
|
1292 |
bool decrement) { |
|
1293 |
// Locate the counter at a fixed offset from the mdp: |
|
1294 |
addi(counter_addr, R28_mdx, constant); |
|
1295 |
increment_mdp_data_at(counter_addr, Rbumped_count, decrement); |
|
1296 |
} |
|
1297 |
||
1298 |
// Increment the value at some non-fixed (reg + constant) offset from |
|
1299 |
// the method data pointer. |
|
1300 |
void InterpreterMacroAssembler::increment_mdp_data_at(Register reg, |
|
1301 |
int constant, |
|
1302 |
Register scratch, |
|
1303 |
Register Rbumped_count, |
|
1304 |
bool decrement) { |
|
1305 |
// Add the constant to reg to get the offset. |
|
1306 |
add(scratch, R28_mdx, reg); |
|
1307 |
// Then calculate the counter address. |
|
1308 |
addi(scratch, scratch, constant); |
|
1309 |
increment_mdp_data_at(scratch, Rbumped_count, decrement); |
|
1310 |
} |
|
1311 |
||
1312 |
void InterpreterMacroAssembler::increment_mdp_data_at(Register counter_addr, |
|
1313 |
Register Rbumped_count, |
|
1314 |
bool decrement) { |
|
1315 |
assert(ProfileInterpreter, "must be profiling interpreter"); |
|
1316 |
||
1317 |
// Load the counter. |
|
1318 |
ld(Rbumped_count, 0, counter_addr); |
|
1319 |
||
1320 |
if (decrement) { |
|
1321 |
// Decrement the register. Set condition codes. |
|
1322 |
addi(Rbumped_count, Rbumped_count, - DataLayout::counter_increment); |
|
1323 |
// Store the decremented counter, if it is still negative. |
|
1324 |
std(Rbumped_count, 0, counter_addr); |
|
1325 |
// Note: add/sub overflow check are not ported, since 64 bit |
|
1326 |
// calculation should never overflow. |
|
1327 |
} else { |
|
1328 |
// Increment the register. Set carry flag. |
|
1329 |
addi(Rbumped_count, Rbumped_count, DataLayout::counter_increment); |
|
1330 |
// Store the incremented counter. |
|
1331 |
std(Rbumped_count, 0, counter_addr); |
|
1332 |
} |
|
1333 |
} |
|
1334 |
||
1335 |
// Set a flag value at the current method data pointer position. |
|
1336 |
void InterpreterMacroAssembler::set_mdp_flag_at(int flag_constant, |
|
1337 |
Register scratch) { |
|
1338 |
assert(ProfileInterpreter, "must be profiling interpreter"); |
|
1339 |
// Load the data header. |
|
1340 |
lbz(scratch, in_bytes(DataLayout::flags_offset()), R28_mdx); |
|
1341 |
// Set the flag. |
|
1342 |
ori(scratch, scratch, flag_constant); |
|
1343 |
// Store the modified header. |
|
1344 |
stb(scratch, in_bytes(DataLayout::flags_offset()), R28_mdx); |
|
1345 |
} |
|
1346 |
||
1347 |
// Test the location at some offset from the method data pointer. |
|
1348 |
// If it is not equal to value, branch to the not_equal_continue Label. |
|
1349 |
void InterpreterMacroAssembler::test_mdp_data_at(int offset, |
|
1350 |
Register value, |
|
1351 |
Label& not_equal_continue, |
|
1352 |
Register test_out) { |
|
1353 |
assert(ProfileInterpreter, "must be profiling interpreter"); |
|
1354 |
||
1355 |
ld(test_out, offset, R28_mdx); |
|
1356 |
cmpd(CCR0, value, test_out); |
|
1357 |
bne(CCR0, not_equal_continue); |
|
1358 |
} |
|
1359 |
||
1360 |
// Update the method data pointer by the displacement located at some fixed |
|
1361 |
// offset from the method data pointer. |
|
1362 |
void InterpreterMacroAssembler::update_mdp_by_offset(int offset_of_disp, |
|
1363 |
Register scratch) { |
|
1364 |
assert(ProfileInterpreter, "must be profiling interpreter"); |
|
1365 |
||
1366 |
ld(scratch, offset_of_disp, R28_mdx); |
|
1367 |
add(R28_mdx, scratch, R28_mdx); |
|
1368 |
} |
|
1369 |
||
1370 |
// Update the method data pointer by the displacement located at the |
|
1371 |
// offset (reg + offset_of_disp). |
|
1372 |
void InterpreterMacroAssembler::update_mdp_by_offset(Register reg, |
|
1373 |
int offset_of_disp, |
|
1374 |
Register scratch) { |
|
1375 |
assert(ProfileInterpreter, "must be profiling interpreter"); |
|
1376 |
||
1377 |
add(scratch, reg, R28_mdx); |
|
1378 |
ld(scratch, offset_of_disp, scratch); |
|
1379 |
add(R28_mdx, scratch, R28_mdx); |
|
1380 |
} |
|
1381 |
||
1382 |
// Update the method data pointer by a simple constant displacement. |
|
1383 |
void InterpreterMacroAssembler::update_mdp_by_constant(int constant) { |
|
1384 |
assert(ProfileInterpreter, "must be profiling interpreter"); |
|
1385 |
addi(R28_mdx, R28_mdx, constant); |
|
1386 |
} |
|
1387 |
||
1388 |
// Update the method data pointer for a _ret bytecode whose target |
|
1389 |
// was not among our cached targets. |
|
1390 |
void InterpreterMacroAssembler::update_mdp_for_ret(TosState state, |
|
1391 |
Register return_bci) { |
|
1392 |
assert(ProfileInterpreter, "must be profiling interpreter"); |
|
1393 |
||
1394 |
push(state); |
|
1395 |
assert(return_bci->is_nonvolatile(), "need to protect return_bci"); |
|
1396 |
call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::update_mdp_for_ret), return_bci); |
|
1397 |
pop(state); |
|
1398 |
} |
|
1399 |
||
1400 |
// Increments the backedge counter. |
|
1401 |
// Returns backedge counter + invocation counter in Rdst. |
|
1402 |
void InterpreterMacroAssembler::increment_backedge_counter(const Register Rcounters, const Register Rdst, |
|
1403 |
const Register Rtmp1, Register Rscratch) { |
|
1404 |
assert(UseCompiler, "incrementing must be useful"); |
|
1405 |
assert_different_registers(Rdst, Rtmp1); |
|
1406 |
const Register invocation_counter = Rtmp1; |
|
1407 |
const Register counter = Rdst; |
|
35085 | 1408 |
// TODO: PPC port: assert(4 == InvocationCounter::sz_counter(), "unexpected field size."); |
23221 | 1409 |
|
1410 |
// Load backedge counter. |
|
1411 |
lwz(counter, in_bytes(MethodCounters::backedge_counter_offset()) + |
|
1412 |
in_bytes(InvocationCounter::counter_offset()), Rcounters); |
|
1413 |
// Load invocation counter. |
|
1414 |
lwz(invocation_counter, in_bytes(MethodCounters::invocation_counter_offset()) + |
|
1415 |
in_bytes(InvocationCounter::counter_offset()), Rcounters); |
|
1416 |
||
1417 |
// Add the delta to the backedge counter. |
|
1418 |
addi(counter, counter, InvocationCounter::count_increment); |
|
1419 |
||
1420 |
// Mask the invocation counter. |
|
35085 | 1421 |
andi(invocation_counter, invocation_counter, InvocationCounter::count_mask_value); |
23221 | 1422 |
|
1423 |
// Store new counter value. |
|
1424 |
stw(counter, in_bytes(MethodCounters::backedge_counter_offset()) + |
|
1425 |
in_bytes(InvocationCounter::counter_offset()), Rcounters); |
|
1426 |
// Return invocation counter + backedge counter. |
|
1427 |
add(counter, counter, invocation_counter); |
|
1428 |
} |
|
1429 |
||
1430 |
// Count a taken branch in the bytecodes. |
|
1431 |
void InterpreterMacroAssembler::profile_taken_branch(Register scratch, Register bumped_count) { |
|
1432 |
if (ProfileInterpreter) { |
|
1433 |
Label profile_continue; |
|
1434 |
||
1435 |
// If no method data exists, go to profile_continue. |
|
1436 |
test_method_data_pointer(profile_continue); |
|
1437 |
||
1438 |
// We are taking a branch. Increment the taken count. |
|
1439 |
increment_mdp_data_at(in_bytes(JumpData::taken_offset()), scratch, bumped_count); |
|
1440 |
||
1441 |
// The method data pointer needs to be updated to reflect the new target. |
|
1442 |
update_mdp_by_offset(in_bytes(JumpData::displacement_offset()), scratch); |
|
1443 |
bind (profile_continue); |
|
1444 |
} |
|
1445 |
} |
|
1446 |
||
1447 |
// Count a not-taken branch in the bytecodes. |
|
1448 |
void InterpreterMacroAssembler::profile_not_taken_branch(Register scratch1, Register scratch2) { |
|
1449 |
if (ProfileInterpreter) { |
|
1450 |
Label profile_continue; |
|
1451 |
||
1452 |
// If no method data exists, go to profile_continue. |
|
1453 |
test_method_data_pointer(profile_continue); |
|
1454 |
||
1455 |
// We are taking a branch. Increment the not taken count. |
|
1456 |
increment_mdp_data_at(in_bytes(BranchData::not_taken_offset()), scratch1, scratch2); |
|
1457 |
||
1458 |
// The method data pointer needs to be updated to correspond to the |
|
1459 |
// next bytecode. |
|
1460 |
update_mdp_by_constant(in_bytes(BranchData::branch_data_size())); |
|
1461 |
bind (profile_continue); |
|
1462 |
} |
|
1463 |
} |
|
1464 |
||
1465 |
// Count a non-virtual call in the bytecodes. |
|
1466 |
void InterpreterMacroAssembler::profile_call(Register scratch1, Register scratch2) { |
|
1467 |
if (ProfileInterpreter) { |
|
1468 |
Label profile_continue; |
|
1469 |
||
1470 |
// If no method data exists, go to profile_continue. |
|
1471 |
test_method_data_pointer(profile_continue); |
|
1472 |
||
1473 |
// We are making a call. Increment the count. |
|
1474 |
increment_mdp_data_at(in_bytes(CounterData::count_offset()), scratch1, scratch2); |
|
1475 |
||
1476 |
// The method data pointer needs to be updated to reflect the new target. |
|
1477 |
update_mdp_by_constant(in_bytes(CounterData::counter_data_size())); |
|
1478 |
bind (profile_continue); |
|
1479 |
} |
|
1480 |
} |
|
1481 |
||
1482 |
// Count a final call in the bytecodes. |
|
1483 |
void InterpreterMacroAssembler::profile_final_call(Register scratch1, Register scratch2) { |
|
1484 |
if (ProfileInterpreter) { |
|
1485 |
Label profile_continue; |
|
1486 |
||
1487 |
// If no method data exists, go to profile_continue. |
|
1488 |
test_method_data_pointer(profile_continue); |
|
1489 |
||
1490 |
// We are making a call. Increment the count. |
|
1491 |
increment_mdp_data_at(in_bytes(CounterData::count_offset()), scratch1, scratch2); |
|
1492 |
||
1493 |
// The method data pointer needs to be updated to reflect the new target. |
|
1494 |
update_mdp_by_constant(in_bytes(VirtualCallData::virtual_call_data_size())); |
|
1495 |
bind (profile_continue); |
|
1496 |
} |
|
1497 |
} |
|
1498 |
||
1499 |
// Count a virtual call in the bytecodes. |
|
1500 |
void InterpreterMacroAssembler::profile_virtual_call(Register Rreceiver, |
|
1501 |
Register Rscratch1, |
|
1502 |
Register Rscratch2, |
|
1503 |
bool receiver_can_be_null) { |
|
1504 |
if (!ProfileInterpreter) { return; } |
|
1505 |
Label profile_continue; |
|
1506 |
||
1507 |
// If no method data exists, go to profile_continue. |
|
1508 |
test_method_data_pointer(profile_continue); |
|
1509 |
||
1510 |
Label skip_receiver_profile; |
|
1511 |
if (receiver_can_be_null) { |
|
1512 |
Label not_null; |
|
1513 |
cmpdi(CCR0, Rreceiver, 0); |
|
1514 |
bne(CCR0, not_null); |
|
1515 |
// We are making a call. Increment the count for null receiver. |
|
1516 |
increment_mdp_data_at(in_bytes(CounterData::count_offset()), Rscratch1, Rscratch2); |
|
1517 |
b(skip_receiver_profile); |
|
1518 |
bind(not_null); |
|
1519 |
} |
|
1520 |
||
1521 |
// Record the receiver type. |
|
1522 |
record_klass_in_profile(Rreceiver, Rscratch1, Rscratch2, true); |
|
1523 |
bind(skip_receiver_profile); |
|
1524 |
||
1525 |
// The method data pointer needs to be updated to reflect the new target. |
|
1526 |
update_mdp_by_constant(in_bytes(VirtualCallData::virtual_call_data_size())); |
|
1527 |
bind (profile_continue); |
|
1528 |
} |
|
1529 |
||
1530 |
void InterpreterMacroAssembler::profile_typecheck(Register Rklass, Register Rscratch1, Register Rscratch2) { |
|
1531 |
if (ProfileInterpreter) { |
|
1532 |
Label profile_continue; |
|
1533 |
||
1534 |
// If no method data exists, go to profile_continue. |
|
1535 |
test_method_data_pointer(profile_continue); |
|
1536 |
||
1537 |
int mdp_delta = in_bytes(BitData::bit_data_size()); |
|
1538 |
if (TypeProfileCasts) { |
|
1539 |
mdp_delta = in_bytes(VirtualCallData::virtual_call_data_size()); |
|
1540 |
||
1541 |
// Record the object type. |
|
1542 |
record_klass_in_profile(Rklass, Rscratch1, Rscratch2, false); |
|
1543 |
} |
|
1544 |
||
1545 |
// The method data pointer needs to be updated. |
|
1546 |
update_mdp_by_constant(mdp_delta); |
|
1547 |
||
1548 |
bind (profile_continue); |
|
1549 |
} |
|
1550 |
} |
|
1551 |
||
1552 |
void InterpreterMacroAssembler::profile_typecheck_failed(Register Rscratch1, Register Rscratch2) { |
|
1553 |
if (ProfileInterpreter && TypeProfileCasts) { |
|
1554 |
Label profile_continue; |
|
1555 |
||
1556 |
// If no method data exists, go to profile_continue. |
|
1557 |
test_method_data_pointer(profile_continue); |
|
1558 |
||
1559 |
int count_offset = in_bytes(CounterData::count_offset()); |
|
1560 |
// Back up the address, since we have already bumped the mdp. |
|
1561 |
count_offset -= in_bytes(VirtualCallData::virtual_call_data_size()); |
|
1562 |
||
1563 |
// *Decrement* the counter. We expect to see zero or small negatives. |
|
1564 |
increment_mdp_data_at(count_offset, Rscratch1, Rscratch2, true); |
|
1565 |
||
1566 |
bind (profile_continue); |
|
1567 |
} |
|
1568 |
} |
|
1569 |
||
1570 |
// Count a ret in the bytecodes. |
|
35166
23125410af16
8145117: PPC64: Remove cpp interpreter implementation
goetz
parents:
33083
diff
changeset
|
1571 |
void InterpreterMacroAssembler::profile_ret(TosState state, Register return_bci, |
23125410af16
8145117: PPC64: Remove cpp interpreter implementation
goetz
parents:
33083
diff
changeset
|
1572 |
Register scratch1, Register scratch2) { |
23221 | 1573 |
if (ProfileInterpreter) { |
1574 |
Label profile_continue; |
|
1575 |
uint row; |
|
1576 |
||
1577 |
// If no method data exists, go to profile_continue. |
|
1578 |
test_method_data_pointer(profile_continue); |
|
1579 |
||
1580 |
// Update the total ret count. |
|
1581 |
increment_mdp_data_at(in_bytes(CounterData::count_offset()), scratch1, scratch2 ); |
|
1582 |
||
1583 |
for (row = 0; row < RetData::row_limit(); row++) { |
|
1584 |
Label next_test; |
|
1585 |
||
1586 |
// See if return_bci is equal to bci[n]: |
|
1587 |
test_mdp_data_at(in_bytes(RetData::bci_offset(row)), return_bci, next_test, scratch1); |
|
1588 |
||
1589 |
// return_bci is equal to bci[n]. Increment the count. |
|
1590 |
increment_mdp_data_at(in_bytes(RetData::bci_count_offset(row)), scratch1, scratch2); |
|
1591 |
||
1592 |
// The method data pointer needs to be updated to reflect the new target. |
|
1593 |
update_mdp_by_offset(in_bytes(RetData::bci_displacement_offset(row)), scratch1); |
|
1594 |
b(profile_continue); |
|
1595 |
bind(next_test); |
|
1596 |
} |
|
1597 |
||
1598 |
update_mdp_for_ret(state, return_bci); |
|
1599 |
||
1600 |
bind (profile_continue); |
|
1601 |
} |
|
1602 |
} |
|
1603 |
||
1604 |
// Count the default case of a switch construct. |
|
1605 |
void InterpreterMacroAssembler::profile_switch_default(Register scratch1, Register scratch2) { |
|
1606 |
if (ProfileInterpreter) { |
|
1607 |
Label profile_continue; |
|
1608 |
||
1609 |
// If no method data exists, go to profile_continue. |
|
1610 |
test_method_data_pointer(profile_continue); |
|
1611 |
||
1612 |
// Update the default case count |
|
1613 |
increment_mdp_data_at(in_bytes(MultiBranchData::default_count_offset()), |
|
1614 |
scratch1, scratch2); |
|
1615 |
||
1616 |
// The method data pointer needs to be updated. |
|
1617 |
update_mdp_by_offset(in_bytes(MultiBranchData::default_displacement_offset()), |
|
1618 |
scratch1); |
|
1619 |
||
1620 |
bind (profile_continue); |
|
1621 |
} |
|
1622 |
} |
|
1623 |
||
1624 |
// Count the index'th case of a switch construct. |
|
1625 |
void InterpreterMacroAssembler::profile_switch_case(Register index, |
|
1626 |
Register scratch1, |
|
1627 |
Register scratch2, |
|
1628 |
Register scratch3) { |
|
1629 |
if (ProfileInterpreter) { |
|
1630 |
assert_different_registers(index, scratch1, scratch2, scratch3); |
|
1631 |
Label profile_continue; |
|
1632 |
||
1633 |
// If no method data exists, go to profile_continue. |
|
1634 |
test_method_data_pointer(profile_continue); |
|
1635 |
||
1636 |
// Build the base (index * per_case_size_in_bytes()) + case_array_offset_in_bytes(). |
|
1637 |
li(scratch3, in_bytes(MultiBranchData::case_array_offset())); |
|
1638 |
||
1639 |
assert (in_bytes(MultiBranchData::per_case_size()) == 16, "so that shladd works"); |
|
1640 |
sldi(scratch1, index, exact_log2(in_bytes(MultiBranchData::per_case_size()))); |
|
1641 |
add(scratch1, scratch1, scratch3); |
|
1642 |
||
1643 |
// Update the case count. |
|
1644 |
increment_mdp_data_at(scratch1, in_bytes(MultiBranchData::relative_count_offset()), scratch2, scratch3); |
|
1645 |
||
1646 |
// The method data pointer needs to be updated. |
|
1647 |
update_mdp_by_offset(scratch1, in_bytes(MultiBranchData::relative_displacement_offset()), scratch2); |
|
1648 |
||
1649 |
bind (profile_continue); |
|
1650 |
} |
|
1651 |
} |
|
1652 |
||
1653 |
void InterpreterMacroAssembler::profile_null_seen(Register Rscratch1, Register Rscratch2) { |
|
1654 |
if (ProfileInterpreter) { |
|
1655 |
assert_different_registers(Rscratch1, Rscratch2); |
|
1656 |
Label profile_continue; |
|
1657 |
||
1658 |
// If no method data exists, go to profile_continue. |
|
1659 |
test_method_data_pointer(profile_continue); |
|
1660 |
||
1661 |
set_mdp_flag_at(BitData::null_seen_byte_constant(), Rscratch1); |
|
1662 |
||
1663 |
// The method data pointer needs to be updated. |
|
1664 |
int mdp_delta = in_bytes(BitData::bit_data_size()); |
|
1665 |
if (TypeProfileCasts) { |
|
1666 |
mdp_delta = in_bytes(VirtualCallData::virtual_call_data_size()); |
|
1667 |
} |
|
1668 |
update_mdp_by_constant(mdp_delta); |
|
1669 |
||
1670 |
bind (profile_continue); |
|
1671 |
} |
|
1672 |
} |
|
1673 |
||
1674 |
void InterpreterMacroAssembler::record_klass_in_profile(Register Rreceiver, |
|
1675 |
Register Rscratch1, Register Rscratch2, |
|
1676 |
bool is_virtual_call) { |
|
1677 |
assert(ProfileInterpreter, "must be profiling"); |
|
1678 |
assert_different_registers(Rreceiver, Rscratch1, Rscratch2); |
|
1679 |
||
1680 |
Label done; |
|
1681 |
record_klass_in_profile_helper(Rreceiver, Rscratch1, Rscratch2, 0, done, is_virtual_call); |
|
1682 |
bind (done); |
|
1683 |
} |
|
1684 |
||
1685 |
void InterpreterMacroAssembler::record_klass_in_profile_helper( |
|
1686 |
Register receiver, Register scratch1, Register scratch2, |
|
1687 |
int start_row, Label& done, bool is_virtual_call) { |
|
1688 |
if (TypeProfileWidth == 0) { |
|
1689 |
if (is_virtual_call) { |
|
1690 |
increment_mdp_data_at(in_bytes(CounterData::count_offset()), scratch1, scratch2); |
|
1691 |
} |
|
1692 |
return; |
|
1693 |
} |
|
1694 |
||
1695 |
int last_row = VirtualCallData::row_limit() - 1; |
|
1696 |
assert(start_row <= last_row, "must be work left to do"); |
|
1697 |
// Test this row for both the receiver and for null. |
|
1698 |
// Take any of three different outcomes: |
|
1699 |
// 1. found receiver => increment count and goto done |
|
1700 |
// 2. found null => keep looking for case 1, maybe allocate this cell |
|
1701 |
// 3. found something else => keep looking for cases 1 and 2 |
|
1702 |
// Case 3 is handled by a recursive call. |
|
1703 |
for (int row = start_row; row <= last_row; row++) { |
|
1704 |
Label next_test; |
|
1705 |
bool test_for_null_also = (row == start_row); |
|
1706 |
||
1707 |
// See if the receiver is receiver[n]. |
|
1708 |
int recvr_offset = in_bytes(VirtualCallData::receiver_offset(row)); |
|
1709 |
test_mdp_data_at(recvr_offset, receiver, next_test, scratch1); |
|
1710 |
// delayed()->tst(scratch); |
|
1711 |
||
1712 |
// The receiver is receiver[n]. Increment count[n]. |
|
1713 |
int count_offset = in_bytes(VirtualCallData::receiver_count_offset(row)); |
|
1714 |
increment_mdp_data_at(count_offset, scratch1, scratch2); |
|
1715 |
b(done); |
|
1716 |
bind(next_test); |
|
1717 |
||
1718 |
if (test_for_null_also) { |
|
1719 |
Label found_null; |
|
1720 |
// Failed the equality check on receiver[n]... Test for null. |
|
1721 |
if (start_row == last_row) { |
|
1722 |
// The only thing left to do is handle the null case. |
|
1723 |
if (is_virtual_call) { |
|
1724 |
// Scratch1 contains test_out from test_mdp_data_at. |
|
1725 |
cmpdi(CCR0, scratch1, 0); |
|
1726 |
beq(CCR0, found_null); |
|
1727 |
// Receiver did not match any saved receiver and there is no empty row for it. |
|
1728 |
// Increment total counter to indicate polymorphic case. |
|
1729 |
increment_mdp_data_at(in_bytes(CounterData::count_offset()), scratch1, scratch2); |
|
1730 |
b(done); |
|
1731 |
bind(found_null); |
|
1732 |
} else { |
|
1733 |
cmpdi(CCR0, scratch1, 0); |
|
1734 |
bne(CCR0, done); |
|
1735 |
} |
|
1736 |
break; |
|
1737 |
} |
|
1738 |
// Since null is rare, make it be the branch-taken case. |
|
1739 |
cmpdi(CCR0, scratch1, 0); |
|
1740 |
beq(CCR0, found_null); |
|
1741 |
||
1742 |
// Put all the "Case 3" tests here. |
|
1743 |
record_klass_in_profile_helper(receiver, scratch1, scratch2, start_row + 1, done, is_virtual_call); |
|
1744 |
||
1745 |
// Found a null. Keep searching for a matching receiver, |
|
1746 |
// but remember that this is an empty (unused) slot. |
|
1747 |
bind(found_null); |
|
1748 |
} |
|
1749 |
} |
|
1750 |
||
1751 |
// In the fall-through case, we found no matching receiver, but we |
|
1752 |
// observed the receiver[start_row] is NULL. |
|
1753 |
||
1754 |
// Fill in the receiver field and increment the count. |
|
1755 |
int recvr_offset = in_bytes(VirtualCallData::receiver_offset(start_row)); |
|
1756 |
set_mdp_data_at(recvr_offset, receiver); |
|
1757 |
int count_offset = in_bytes(VirtualCallData::receiver_count_offset(start_row)); |
|
1758 |
li(scratch1, DataLayout::counter_increment); |
|
1759 |
set_mdp_data_at(count_offset, scratch1); |
|
1760 |
if (start_row > 0) { |
|
1761 |
b(done); |
|
1762 |
} |
|
1763 |
} |
|
1764 |
||
28187
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1765 |
// Argument and return type profilig. |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1766 |
// kills: tmp, tmp2, R0, CR0, CR1 |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1767 |
void InterpreterMacroAssembler::profile_obj_type(Register obj, Register mdo_addr_base, |
35166
23125410af16
8145117: PPC64: Remove cpp interpreter implementation
goetz
parents:
33083
diff
changeset
|
1768 |
RegisterOrConstant mdo_addr_offs, |
23125410af16
8145117: PPC64: Remove cpp interpreter implementation
goetz
parents:
33083
diff
changeset
|
1769 |
Register tmp, Register tmp2) { |
28187
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1770 |
Label do_nothing, do_update; |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1771 |
|
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1772 |
// tmp2 = obj is allowed |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1773 |
assert_different_registers(obj, mdo_addr_base, tmp, R0); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1774 |
assert_different_registers(tmp2, mdo_addr_base, tmp, R0); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1775 |
const Register klass = tmp2; |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1776 |
|
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1777 |
verify_oop(obj); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1778 |
|
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1779 |
ld(tmp, mdo_addr_offs, mdo_addr_base); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1780 |
|
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1781 |
// Set null_seen if obj is 0. |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1782 |
cmpdi(CCR0, obj, 0); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1783 |
ori(R0, tmp, TypeEntries::null_seen); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1784 |
beq(CCR0, do_update); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1785 |
|
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1786 |
load_klass(klass, obj); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1787 |
|
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1788 |
clrrdi(R0, tmp, exact_log2(-TypeEntries::type_klass_mask)); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1789 |
// Basically same as andi(R0, tmp, TypeEntries::type_klass_mask); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1790 |
cmpd(CCR1, R0, klass); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1791 |
// Klass seen before, nothing to do (regardless of unknown bit). |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1792 |
//beq(CCR1, do_nothing); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1793 |
|
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1794 |
andi_(R0, klass, TypeEntries::type_unknown); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1795 |
// Already unknown. Nothing to do anymore. |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1796 |
//bne(CCR0, do_nothing); |
28492
57fecf138f7b
8068724: ppc64: update assembler: SPR access, CR logic, HTM
mdoerr
parents:
28187
diff
changeset
|
1797 |
crorc(CCR0, Assembler::equal, CCR1, Assembler::equal); // cr0 eq = cr1 eq or cr0 ne |
28187
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1798 |
beq(CCR0, do_nothing); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1799 |
|
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1800 |
clrrdi_(R0, tmp, exact_log2(-TypeEntries::type_mask)); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1801 |
orr(R0, klass, tmp); // Combine klass and null_seen bit (only used if (tmp & type_mask)==0). |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1802 |
beq(CCR0, do_update); // First time here. Set profile type. |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1803 |
|
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1804 |
// Different than before. Cannot keep accurate profile. |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1805 |
ori(R0, tmp, TypeEntries::type_unknown); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1806 |
|
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1807 |
bind(do_update); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1808 |
// update profile |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1809 |
std(R0, mdo_addr_offs, mdo_addr_base); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1810 |
|
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1811 |
align(32, 12); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1812 |
bind(do_nothing); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1813 |
} |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1814 |
|
35166
23125410af16
8145117: PPC64: Remove cpp interpreter implementation
goetz
parents:
33083
diff
changeset
|
1815 |
void InterpreterMacroAssembler::profile_arguments_type(Register callee, |
23125410af16
8145117: PPC64: Remove cpp interpreter implementation
goetz
parents:
33083
diff
changeset
|
1816 |
Register tmp1, Register tmp2, |
23125410af16
8145117: PPC64: Remove cpp interpreter implementation
goetz
parents:
33083
diff
changeset
|
1817 |
bool is_virtual) { |
28187
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1818 |
if (!ProfileInterpreter) { |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1819 |
return; |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1820 |
} |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1821 |
|
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1822 |
assert_different_registers(callee, tmp1, tmp2, R28_mdx); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1823 |
|
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1824 |
if (MethodData::profile_arguments() || MethodData::profile_return()) { |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1825 |
Label profile_continue; |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1826 |
|
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1827 |
test_method_data_pointer(profile_continue); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1828 |
|
35166
23125410af16
8145117: PPC64: Remove cpp interpreter implementation
goetz
parents:
33083
diff
changeset
|
1829 |
int off_to_start = is_virtual ? |
23125410af16
8145117: PPC64: Remove cpp interpreter implementation
goetz
parents:
33083
diff
changeset
|
1830 |
in_bytes(VirtualCallData::virtual_call_data_size()) : in_bytes(CounterData::counter_data_size()); |
28187
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1831 |
|
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1832 |
lbz(tmp1, in_bytes(DataLayout::tag_offset()) - off_to_start, R28_mdx); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1833 |
cmpwi(CCR0, tmp1, is_virtual ? DataLayout::virtual_call_type_data_tag : DataLayout::call_type_data_tag); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1834 |
bne(CCR0, profile_continue); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1835 |
|
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1836 |
if (MethodData::profile_arguments()) { |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1837 |
Label done; |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1838 |
int off_to_args = in_bytes(TypeEntriesAtCall::args_data_offset()); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1839 |
add(R28_mdx, off_to_args, R28_mdx); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1840 |
|
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1841 |
for (int i = 0; i < TypeProfileArgsLimit; i++) { |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1842 |
if (i > 0 || MethodData::profile_return()) { |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1843 |
// If return value type is profiled we may have no argument to profile. |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1844 |
ld(tmp1, in_bytes(TypeEntriesAtCall::cell_count_offset())-off_to_args, R28_mdx); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1845 |
cmpdi(CCR0, tmp1, (i+1)*TypeStackSlotEntries::per_arg_count()); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1846 |
addi(tmp1, tmp1, -i*TypeStackSlotEntries::per_arg_count()); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1847 |
blt(CCR0, done); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1848 |
} |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1849 |
ld(tmp1, in_bytes(Method::const_offset()), callee); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1850 |
lhz(tmp1, in_bytes(ConstMethod::size_of_parameters_offset()), tmp1); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1851 |
// Stack offset o (zero based) from the start of the argument |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1852 |
// list, for n arguments translates into offset n - o - 1 from |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1853 |
// the end of the argument list. But there's an extra slot at |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1854 |
// the top of the stack. So the offset is n - o from Lesp. |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1855 |
ld(tmp2, in_bytes(TypeEntriesAtCall::stack_slot_offset(i))-off_to_args, R28_mdx); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1856 |
subf(tmp1, tmp2, tmp1); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1857 |
|
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1858 |
sldi(tmp1, tmp1, Interpreter::logStackElementSize); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1859 |
ldx(tmp1, tmp1, R15_esp); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1860 |
|
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1861 |
profile_obj_type(tmp1, R28_mdx, in_bytes(TypeEntriesAtCall::argument_type_offset(i))-off_to_args, tmp2, tmp1); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1862 |
|
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1863 |
int to_add = in_bytes(TypeStackSlotEntries::per_arg_size()); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1864 |
addi(R28_mdx, R28_mdx, to_add); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1865 |
off_to_args += to_add; |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1866 |
} |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1867 |
|
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1868 |
if (MethodData::profile_return()) { |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1869 |
ld(tmp1, in_bytes(TypeEntriesAtCall::cell_count_offset())-off_to_args, R28_mdx); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1870 |
addi(tmp1, tmp1, -TypeProfileArgsLimit*TypeStackSlotEntries::per_arg_count()); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1871 |
} |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1872 |
|
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1873 |
bind(done); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1874 |
|
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1875 |
if (MethodData::profile_return()) { |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1876 |
// We're right after the type profile for the last |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1877 |
// argument. tmp1 is the number of cells left in the |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1878 |
// CallTypeData/VirtualCallTypeData to reach its end. Non null |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1879 |
// if there's a return to profile. |
35166
23125410af16
8145117: PPC64: Remove cpp interpreter implementation
goetz
parents:
33083
diff
changeset
|
1880 |
assert(ReturnTypeEntry::static_cell_count() < TypeStackSlotEntries::per_arg_count(), |
23125410af16
8145117: PPC64: Remove cpp interpreter implementation
goetz
parents:
33083
diff
changeset
|
1881 |
"can't move past ret type"); |
28187
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1882 |
sldi(tmp1, tmp1, exact_log2(DataLayout::cell_size)); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1883 |
add(R28_mdx, tmp1, R28_mdx); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1884 |
} |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1885 |
} else { |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1886 |
assert(MethodData::profile_return(), "either profile call args or call ret"); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1887 |
update_mdp_by_constant(in_bytes(TypeEntriesAtCall::return_only_size())); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1888 |
} |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1889 |
|
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1890 |
// Mdp points right after the end of the |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1891 |
// CallTypeData/VirtualCallTypeData, right after the cells for the |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1892 |
// return value type if there's one. |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1893 |
align(32, 12); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1894 |
bind(profile_continue); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1895 |
} |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1896 |
} |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1897 |
|
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1898 |
void InterpreterMacroAssembler::profile_return_type(Register ret, Register tmp1, Register tmp2) { |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1899 |
assert_different_registers(ret, tmp1, tmp2); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1900 |
if (ProfileInterpreter && MethodData::profile_return()) { |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1901 |
Label profile_continue; |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1902 |
|
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1903 |
test_method_data_pointer(profile_continue); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1904 |
|
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1905 |
if (MethodData::profile_return_jsr292_only()) { |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1906 |
// If we don't profile all invoke bytecodes we must make sure |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1907 |
// it's a bytecode we indeed profile. We can't go back to the |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1908 |
// begining of the ProfileData we intend to update to check its |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1909 |
// type because we're right after it and we don't known its |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1910 |
// length. |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1911 |
lbz(tmp1, 0, R14_bcp); |
35085 | 1912 |
lbz(tmp2, Method::intrinsic_id_offset_in_bytes(), R19_method); |
28187
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1913 |
cmpwi(CCR0, tmp1, Bytecodes::_invokedynamic); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1914 |
cmpwi(CCR1, tmp1, Bytecodes::_invokehandle); |
28492
57fecf138f7b
8068724: ppc64: update assembler: SPR access, CR logic, HTM
mdoerr
parents:
28187
diff
changeset
|
1915 |
cror(CCR0, Assembler::equal, CCR1, Assembler::equal); |
28187
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1916 |
cmpwi(CCR1, tmp2, vmIntrinsics::_compiledLambdaForm); |
28492
57fecf138f7b
8068724: ppc64: update assembler: SPR access, CR logic, HTM
mdoerr
parents:
28187
diff
changeset
|
1917 |
cror(CCR0, Assembler::equal, CCR1, Assembler::equal); |
28187
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1918 |
bne(CCR0, profile_continue); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1919 |
} |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1920 |
|
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1921 |
profile_obj_type(ret, R28_mdx, -in_bytes(ReturnTypeEntry::size()), tmp1, tmp2); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1922 |
|
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1923 |
align(32, 12); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1924 |
bind(profile_continue); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1925 |
} |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1926 |
} |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1927 |
|
35166
23125410af16
8145117: PPC64: Remove cpp interpreter implementation
goetz
parents:
33083
diff
changeset
|
1928 |
void InterpreterMacroAssembler::profile_parameters_type(Register tmp1, Register tmp2, |
23125410af16
8145117: PPC64: Remove cpp interpreter implementation
goetz
parents:
33083
diff
changeset
|
1929 |
Register tmp3, Register tmp4) { |
28187
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1930 |
if (ProfileInterpreter && MethodData::profile_parameters()) { |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1931 |
Label profile_continue, done; |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1932 |
|
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1933 |
test_method_data_pointer(profile_continue); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1934 |
|
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1935 |
// Load the offset of the area within the MDO used for |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1936 |
// parameters. If it's negative we're not profiling any parameters. |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1937 |
lwz(tmp1, in_bytes(MethodData::parameters_type_data_di_offset()) - in_bytes(MethodData::data_offset()), R28_mdx); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1938 |
cmpwi(CCR0, tmp1, 0); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1939 |
blt(CCR0, profile_continue); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1940 |
|
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1941 |
// Compute a pointer to the area for parameters from the offset |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1942 |
// and move the pointer to the slot for the last |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1943 |
// parameters. Collect profiling from last parameter down. |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1944 |
// mdo start + parameters offset + array length - 1 |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1945 |
|
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1946 |
// Pointer to the parameter area in the MDO. |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1947 |
const Register mdp = tmp1; |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1948 |
add(mdp, tmp1, R28_mdx); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1949 |
|
30303 | 1950 |
// Offset of the current profile entry to update. |
28187
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1951 |
const Register entry_offset = tmp2; |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1952 |
// entry_offset = array len in number of cells |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1953 |
ld(entry_offset, in_bytes(ArrayData::array_len_offset()), mdp); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1954 |
|
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1955 |
int off_base = in_bytes(ParametersTypeData::stack_slot_offset(0)); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1956 |
assert(off_base % DataLayout::cell_size == 0, "should be a number of cells"); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1957 |
|
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1958 |
// entry_offset (number of cells) = array len - size of 1 entry + offset of the stack slot field |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1959 |
addi(entry_offset, entry_offset, -TypeStackSlotEntries::per_arg_count() + (off_base / DataLayout::cell_size)); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1960 |
// entry_offset in bytes |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1961 |
sldi(entry_offset, entry_offset, exact_log2(DataLayout::cell_size)); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1962 |
|
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1963 |
Label loop; |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1964 |
align(32, 12); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1965 |
bind(loop); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1966 |
|
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1967 |
// Load offset on the stack from the slot for this parameter. |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1968 |
ld(tmp3, entry_offset, mdp); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1969 |
sldi(tmp3, tmp3, Interpreter::logStackElementSize); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1970 |
neg(tmp3, tmp3); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1971 |
// Read the parameter from the local area. |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1972 |
ldx(tmp3, tmp3, R18_locals); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1973 |
|
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1974 |
// Make entry_offset now point to the type field for this parameter. |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1975 |
int type_base = in_bytes(ParametersTypeData::type_offset(0)); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1976 |
assert(type_base > off_base, "unexpected"); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1977 |
addi(entry_offset, entry_offset, type_base - off_base); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1978 |
|
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1979 |
// Profile the parameter. |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1980 |
profile_obj_type(tmp3, mdp, entry_offset, tmp4, tmp3); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1981 |
|
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1982 |
// Go to next parameter. |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1983 |
int delta = TypeStackSlotEntries::per_arg_count() * DataLayout::cell_size + (type_base - off_base); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1984 |
cmpdi(CCR0, entry_offset, off_base + delta); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1985 |
addi(entry_offset, entry_offset, -delta); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1986 |
bge(CCR0, loop); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1987 |
|
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1988 |
align(32, 12); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1989 |
bind(profile_continue); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1990 |
} |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1991 |
} |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
1992 |
|
23221 | 1993 |
// Add a InterpMonitorElem to stack (see frame_sparc.hpp). |
1994 |
void InterpreterMacroAssembler::add_monitor_to_stack(bool stack_is_empty, Register Rtemp1, Register Rtemp2) { |
|
1995 |
||
1996 |
// Very-local scratch registers. |
|
1997 |
const Register esp = Rtemp1; |
|
1998 |
const Register slot = Rtemp2; |
|
1999 |
||
2000 |
// Extracted monitor_size. |
|
2001 |
int monitor_size = frame::interpreter_frame_monitor_size_in_bytes(); |
|
2002 |
assert(Assembler::is_aligned((unsigned int)monitor_size, |
|
2003 |
(unsigned int)frame::alignment_in_bytes), |
|
2004 |
"size of a monitor must respect alignment of SP"); |
|
2005 |
||
2006 |
resize_frame(-monitor_size, /*temp*/esp); // Allocate space for new monitor |
|
2007 |
std(R1_SP, _ijava_state_neg(top_frame_sp), esp); // esp contains fp |
|
2008 |
||
2009 |
// Shuffle expression stack down. Recall that stack_base points |
|
2010 |
// just above the new expression stack bottom. Old_tos and new_tos |
|
2011 |
// are used to scan thru the old and new expression stacks. |
|
2012 |
if (!stack_is_empty) { |
|
2013 |
Label copy_slot, copy_slot_finished; |
|
2014 |
const Register n_slots = slot; |
|
2015 |
||
2016 |
addi(esp, R15_esp, Interpreter::stackElementSize); // Point to first element (pre-pushed stack). |
|
2017 |
subf(n_slots, esp, R26_monitor); |
|
2018 |
srdi_(n_slots, n_slots, LogBytesPerWord); // Compute number of slots to copy. |
|
2019 |
assert(LogBytesPerWord == 3, "conflicts assembler instructions"); |
|
2020 |
beq(CCR0, copy_slot_finished); // Nothing to copy. |
|
2021 |
||
2022 |
mtctr(n_slots); |
|
2023 |
||
2024 |
// loop |
|
2025 |
bind(copy_slot); |
|
2026 |
ld(slot, 0, esp); // Move expression stack down. |
|
2027 |
std(slot, -monitor_size, esp); // distance = monitor_size |
|
2028 |
addi(esp, esp, BytesPerWord); |
|
2029 |
bdnz(copy_slot); |
|
2030 |
||
2031 |
bind(copy_slot_finished); |
|
2032 |
} |
|
2033 |
||
2034 |
addi(R15_esp, R15_esp, -monitor_size); |
|
2035 |
addi(R26_monitor, R26_monitor, -monitor_size); |
|
2036 |
||
2037 |
// Restart interpreter |
|
2038 |
} |
|
2039 |
||
2040 |
// ============================================================================ |
|
2041 |
// Java locals access |
|
2042 |
||
2043 |
// Load a local variable at index in Rindex into register Rdst_value. |
|
2044 |
// Also puts address of local into Rdst_address as a service. |
|
2045 |
// Kills: |
|
2046 |
// - Rdst_value |
|
2047 |
// - Rdst_address |
|
2048 |
void InterpreterMacroAssembler::load_local_int(Register Rdst_value, Register Rdst_address, Register Rindex) { |
|
2049 |
sldi(Rdst_address, Rindex, Interpreter::logStackElementSize); |
|
2050 |
subf(Rdst_address, Rdst_address, R18_locals); |
|
2051 |
lwz(Rdst_value, 0, Rdst_address); |
|
2052 |
} |
|
2053 |
||
2054 |
// Load a local variable at index in Rindex into register Rdst_value. |
|
2055 |
// Also puts address of local into Rdst_address as a service. |
|
2056 |
// Kills: |
|
2057 |
// - Rdst_value |
|
2058 |
// - Rdst_address |
|
2059 |
void InterpreterMacroAssembler::load_local_long(Register Rdst_value, Register Rdst_address, Register Rindex) { |
|
2060 |
sldi(Rdst_address, Rindex, Interpreter::logStackElementSize); |
|
2061 |
subf(Rdst_address, Rdst_address, R18_locals); |
|
2062 |
ld(Rdst_value, -8, Rdst_address); |
|
2063 |
} |
|
2064 |
||
2065 |
// Load a local variable at index in Rindex into register Rdst_value. |
|
2066 |
// Also puts address of local into Rdst_address as a service. |
|
2067 |
// Input: |
|
2068 |
// - Rindex: slot nr of local variable |
|
2069 |
// Kills: |
|
2070 |
// - Rdst_value |
|
2071 |
// - Rdst_address |
|
35166
23125410af16
8145117: PPC64: Remove cpp interpreter implementation
goetz
parents:
33083
diff
changeset
|
2072 |
void InterpreterMacroAssembler::load_local_ptr(Register Rdst_value, |
23125410af16
8145117: PPC64: Remove cpp interpreter implementation
goetz
parents:
33083
diff
changeset
|
2073 |
Register Rdst_address, |
23125410af16
8145117: PPC64: Remove cpp interpreter implementation
goetz
parents:
33083
diff
changeset
|
2074 |
Register Rindex) { |
23221 | 2075 |
sldi(Rdst_address, Rindex, Interpreter::logStackElementSize); |
2076 |
subf(Rdst_address, Rdst_address, R18_locals); |
|
2077 |
ld(Rdst_value, 0, Rdst_address); |
|
2078 |
} |
|
2079 |
||
2080 |
// Load a local variable at index in Rindex into register Rdst_value. |
|
2081 |
// Also puts address of local into Rdst_address as a service. |
|
2082 |
// Kills: |
|
2083 |
// - Rdst_value |
|
2084 |
// - Rdst_address |
|
35166
23125410af16
8145117: PPC64: Remove cpp interpreter implementation
goetz
parents:
33083
diff
changeset
|
2085 |
void InterpreterMacroAssembler::load_local_float(FloatRegister Rdst_value, |
23125410af16
8145117: PPC64: Remove cpp interpreter implementation
goetz
parents:
33083
diff
changeset
|
2086 |
Register Rdst_address, |
23125410af16
8145117: PPC64: Remove cpp interpreter implementation
goetz
parents:
33083
diff
changeset
|
2087 |
Register Rindex) { |
23221 | 2088 |
sldi(Rdst_address, Rindex, Interpreter::logStackElementSize); |
2089 |
subf(Rdst_address, Rdst_address, R18_locals); |
|
2090 |
lfs(Rdst_value, 0, Rdst_address); |
|
2091 |
} |
|
2092 |
||
2093 |
// Load a local variable at index in Rindex into register Rdst_value. |
|
2094 |
// Also puts address of local into Rdst_address as a service. |
|
2095 |
// Kills: |
|
2096 |
// - Rdst_value |
|
2097 |
// - Rdst_address |
|
35166
23125410af16
8145117: PPC64: Remove cpp interpreter implementation
goetz
parents:
33083
diff
changeset
|
2098 |
void InterpreterMacroAssembler::load_local_double(FloatRegister Rdst_value, |
23125410af16
8145117: PPC64: Remove cpp interpreter implementation
goetz
parents:
33083
diff
changeset
|
2099 |
Register Rdst_address, |
23125410af16
8145117: PPC64: Remove cpp interpreter implementation
goetz
parents:
33083
diff
changeset
|
2100 |
Register Rindex) { |
23221 | 2101 |
sldi(Rdst_address, Rindex, Interpreter::logStackElementSize); |
2102 |
subf(Rdst_address, Rdst_address, R18_locals); |
|
2103 |
lfd(Rdst_value, -8, Rdst_address); |
|
2104 |
} |
|
2105 |
||
2106 |
// Store an int value at local variable slot Rindex. |
|
2107 |
// Kills: |
|
2108 |
// - Rindex |
|
2109 |
void InterpreterMacroAssembler::store_local_int(Register Rvalue, Register Rindex) { |
|
2110 |
sldi(Rindex, Rindex, Interpreter::logStackElementSize); |
|
2111 |
subf(Rindex, Rindex, R18_locals); |
|
2112 |
stw(Rvalue, 0, Rindex); |
|
2113 |
} |
|
2114 |
||
2115 |
// Store a long value at local variable slot Rindex. |
|
2116 |
// Kills: |
|
2117 |
// - Rindex |
|
2118 |
void InterpreterMacroAssembler::store_local_long(Register Rvalue, Register Rindex) { |
|
2119 |
sldi(Rindex, Rindex, Interpreter::logStackElementSize); |
|
2120 |
subf(Rindex, Rindex, R18_locals); |
|
2121 |
std(Rvalue, -8, Rindex); |
|
2122 |
} |
|
2123 |
||
2124 |
// Store an oop value at local variable slot Rindex. |
|
2125 |
// Kills: |
|
2126 |
// - Rindex |
|
2127 |
void InterpreterMacroAssembler::store_local_ptr(Register Rvalue, Register Rindex) { |
|
2128 |
sldi(Rindex, Rindex, Interpreter::logStackElementSize); |
|
2129 |
subf(Rindex, Rindex, R18_locals); |
|
2130 |
std(Rvalue, 0, Rindex); |
|
2131 |
} |
|
2132 |
||
2133 |
// Store an int value at local variable slot Rindex. |
|
2134 |
// Kills: |
|
2135 |
// - Rindex |
|
2136 |
void InterpreterMacroAssembler::store_local_float(FloatRegister Rvalue, Register Rindex) { |
|
2137 |
sldi(Rindex, Rindex, Interpreter::logStackElementSize); |
|
2138 |
subf(Rindex, Rindex, R18_locals); |
|
2139 |
stfs(Rvalue, 0, Rindex); |
|
2140 |
} |
|
2141 |
||
2142 |
// Store an int value at local variable slot Rindex. |
|
2143 |
// Kills: |
|
2144 |
// - Rindex |
|
2145 |
void InterpreterMacroAssembler::store_local_double(FloatRegister Rvalue, Register Rindex) { |
|
2146 |
sldi(Rindex, Rindex, Interpreter::logStackElementSize); |
|
2147 |
subf(Rindex, Rindex, R18_locals); |
|
2148 |
stfd(Rvalue, -8, Rindex); |
|
2149 |
} |
|
2150 |
||
2151 |
// Read pending exception from thread and jump to interpreter. |
|
2152 |
// Throw exception entry if one if pending. Fall through otherwise. |
|
2153 |
void InterpreterMacroAssembler::check_and_forward_exception(Register Rscratch1, Register Rscratch2) { |
|
2154 |
assert_different_registers(Rscratch1, Rscratch2, R3); |
|
2155 |
Register Rexception = Rscratch1; |
|
2156 |
Register Rtmp = Rscratch2; |
|
2157 |
Label Ldone; |
|
2158 |
// Get pending exception oop. |
|
2159 |
ld(Rexception, thread_(pending_exception)); |
|
2160 |
cmpdi(CCR0, Rexception, 0); |
|
2161 |
beq(CCR0, Ldone); |
|
2162 |
li(Rtmp, 0); |
|
2163 |
mr_if_needed(R3, Rexception); |
|
2164 |
std(Rtmp, thread_(pending_exception)); // Clear exception in thread |
|
2165 |
if (Interpreter::rethrow_exception_entry() != NULL) { |
|
2166 |
// Already got entry address. |
|
2167 |
load_dispatch_table(Rtmp, (address*)Interpreter::rethrow_exception_entry()); |
|
2168 |
} else { |
|
2169 |
// Dynamically load entry address. |
|
2170 |
int simm16_rest = load_const_optimized(Rtmp, &Interpreter::_rethrow_exception_entry, R0, true); |
|
2171 |
ld(Rtmp, simm16_rest, Rtmp); |
|
2172 |
} |
|
2173 |
mtctr(Rtmp); |
|
2174 |
save_interpreter_state(Rtmp); |
|
2175 |
bctr(); |
|
2176 |
||
2177 |
align(32, 12); |
|
2178 |
bind(Ldone); |
|
2179 |
} |
|
2180 |
||
2181 |
void InterpreterMacroAssembler::call_VM(Register oop_result, address entry_point, bool check_exceptions) { |
|
2182 |
save_interpreter_state(R11_scratch1); |
|
2183 |
||
2184 |
MacroAssembler::call_VM(oop_result, entry_point, false); |
|
2185 |
||
2186 |
restore_interpreter_state(R11_scratch1, /*bcp_and_mdx_only*/ true); |
|
2187 |
||
2188 |
check_and_handle_popframe(R11_scratch1); |
|
2189 |
check_and_handle_earlyret(R11_scratch1); |
|
2190 |
// Now check exceptions manually. |
|
2191 |
if (check_exceptions) { |
|
2192 |
check_and_forward_exception(R11_scratch1, R12_scratch2); |
|
2193 |
} |
|
2194 |
} |
|
2195 |
||
35166
23125410af16
8145117: PPC64: Remove cpp interpreter implementation
goetz
parents:
33083
diff
changeset
|
2196 |
void InterpreterMacroAssembler::call_VM(Register oop_result, address entry_point, |
23125410af16
8145117: PPC64: Remove cpp interpreter implementation
goetz
parents:
33083
diff
changeset
|
2197 |
Register arg_1, bool check_exceptions) { |
23221 | 2198 |
// ARG1 is reserved for the thread. |
2199 |
mr_if_needed(R4_ARG2, arg_1); |
|
2200 |
call_VM(oop_result, entry_point, check_exceptions); |
|
2201 |
} |
|
2202 |
||
35166
23125410af16
8145117: PPC64: Remove cpp interpreter implementation
goetz
parents:
33083
diff
changeset
|
2203 |
void InterpreterMacroAssembler::call_VM(Register oop_result, address entry_point, |
23125410af16
8145117: PPC64: Remove cpp interpreter implementation
goetz
parents:
33083
diff
changeset
|
2204 |
Register arg_1, Register arg_2, |
23125410af16
8145117: PPC64: Remove cpp interpreter implementation
goetz
parents:
33083
diff
changeset
|
2205 |
bool check_exceptions) { |
23221 | 2206 |
// ARG1 is reserved for the thread. |
2207 |
mr_if_needed(R4_ARG2, arg_1); |
|
2208 |
assert(arg_2 != R4_ARG2, "smashed argument"); |
|
2209 |
mr_if_needed(R5_ARG3, arg_2); |
|
2210 |
call_VM(oop_result, entry_point, check_exceptions); |
|
2211 |
} |
|
2212 |
||
35166
23125410af16
8145117: PPC64: Remove cpp interpreter implementation
goetz
parents:
33083
diff
changeset
|
2213 |
void InterpreterMacroAssembler::call_VM(Register oop_result, address entry_point, |
23125410af16
8145117: PPC64: Remove cpp interpreter implementation
goetz
parents:
33083
diff
changeset
|
2214 |
Register arg_1, Register arg_2, Register arg_3, |
23125410af16
8145117: PPC64: Remove cpp interpreter implementation
goetz
parents:
33083
diff
changeset
|
2215 |
bool check_exceptions) { |
23221 | 2216 |
// ARG1 is reserved for the thread. |
2217 |
mr_if_needed(R4_ARG2, arg_1); |
|
2218 |
assert(arg_2 != R4_ARG2, "smashed argument"); |
|
2219 |
mr_if_needed(R5_ARG3, arg_2); |
|
2220 |
assert(arg_3 != R4_ARG2 && arg_3 != R5_ARG3, "smashed argument"); |
|
2221 |
mr_if_needed(R6_ARG4, arg_3); |
|
2222 |
call_VM(oop_result, entry_point, check_exceptions); |
|
2223 |
} |
|
2224 |
||
2225 |
void InterpreterMacroAssembler::save_interpreter_state(Register scratch) { |
|
2226 |
ld(scratch, 0, R1_SP); |
|
2227 |
std(R15_esp, _ijava_state_neg(esp), scratch); |
|
2228 |
std(R14_bcp, _ijava_state_neg(bcp), scratch); |
|
2229 |
std(R26_monitor, _ijava_state_neg(monitors), scratch); |
|
2230 |
if (ProfileInterpreter) { std(R28_mdx, _ijava_state_neg(mdx), scratch); } |
|
2231 |
// Other entries should be unchanged. |
|
2232 |
} |
|
2233 |
||
2234 |
void InterpreterMacroAssembler::restore_interpreter_state(Register scratch, bool bcp_and_mdx_only) { |
|
2235 |
ld(scratch, 0, R1_SP); |
|
2236 |
ld(R14_bcp, _ijava_state_neg(bcp), scratch); // Changed by VM code (exception). |
|
2237 |
if (ProfileInterpreter) { ld(R28_mdx, _ijava_state_neg(mdx), scratch); } // Changed by VM code. |
|
2238 |
if (!bcp_and_mdx_only) { |
|
2239 |
// Following ones are Metadata. |
|
2240 |
ld(R19_method, _ijava_state_neg(method), scratch); |
|
2241 |
ld(R27_constPoolCache, _ijava_state_neg(cpoolCache), scratch); |
|
2242 |
// Following ones are stack addresses and don't require reload. |
|
2243 |
ld(R15_esp, _ijava_state_neg(esp), scratch); |
|
2244 |
ld(R18_locals, _ijava_state_neg(locals), scratch); |
|
2245 |
ld(R26_monitor, _ijava_state_neg(monitors), scratch); |
|
2246 |
} |
|
2247 |
#ifdef ASSERT |
|
2248 |
{ |
|
2249 |
Label Lok; |
|
2250 |
subf(R0, R1_SP, scratch); |
|
2251 |
cmpdi(CCR0, R0, frame::abi_reg_args_size + frame::ijava_state_size); |
|
2252 |
bge(CCR0, Lok); |
|
2253 |
stop("frame too small (restore istate)", 0x5432); |
|
2254 |
bind(Lok); |
|
2255 |
} |
|
2256 |
#endif |
|
2257 |
} |
|
2258 |
||
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2259 |
void InterpreterMacroAssembler::get_method_counters(Register method, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2260 |
Register Rcounters, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2261 |
Label& skip) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2262 |
BLOCK_COMMENT("Load and ev. allocate counter object {"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2263 |
Label has_counters; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2264 |
ld(Rcounters, in_bytes(Method::method_counters_offset()), method); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2265 |
cmpdi(CCR0, Rcounters, 0); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2266 |
bne(CCR0, has_counters); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2267 |
call_VM(noreg, CAST_FROM_FN_PTR(address, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2268 |
InterpreterRuntime::build_method_counters), method, false); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2269 |
ld(Rcounters, in_bytes(Method::method_counters_offset()), method); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2270 |
cmpdi(CCR0, Rcounters, 0); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2271 |
beq(CCR0, skip); // No MethodCounters, OutOfMemory. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2272 |
BLOCK_COMMENT("} Load and ev. allocate counter object"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2273 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2274 |
bind(has_counters); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2275 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2276 |
|
35166
23125410af16
8145117: PPC64: Remove cpp interpreter implementation
goetz
parents:
33083
diff
changeset
|
2277 |
void InterpreterMacroAssembler::increment_invocation_counter(Register Rcounters, |
23125410af16
8145117: PPC64: Remove cpp interpreter implementation
goetz
parents:
33083
diff
changeset
|
2278 |
Register iv_be_count, |
23125410af16
8145117: PPC64: Remove cpp interpreter implementation
goetz
parents:
33083
diff
changeset
|
2279 |
Register Rtmp_r0) { |
32074
54b9558a71a2
8132242: LogTouchedMethods (8025692) asserts if TieredCompilation is off.
minqi
parents:
30303
diff
changeset
|
2280 |
assert(UseCompiler || LogTouchedMethods, "incrementing must be useful"); |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2281 |
Register invocation_count = iv_be_count; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2282 |
Register backedge_count = Rtmp_r0; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2283 |
int delta = InvocationCounter::count_increment; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2284 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2285 |
// Load each counter in a register. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2286 |
// ld(inv_counter, Rtmp); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2287 |
// ld(be_counter, Rtmp2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2288 |
int inv_counter_offset = in_bytes(MethodCounters::invocation_counter_offset() + |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2289 |
InvocationCounter::counter_offset()); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2290 |
int be_counter_offset = in_bytes(MethodCounters::backedge_counter_offset() + |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2291 |
InvocationCounter::counter_offset()); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2292 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2293 |
BLOCK_COMMENT("Increment profiling counters {"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2294 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2295 |
// Load the backedge counter. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2296 |
lwz(backedge_count, be_counter_offset, Rcounters); // is unsigned int |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2297 |
// Mask the backedge counter. |
35085 | 2298 |
andi(backedge_count, backedge_count, InvocationCounter::count_mask_value); |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2299 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2300 |
// Load the invocation counter. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2301 |
lwz(invocation_count, inv_counter_offset, Rcounters); // is unsigned int |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2302 |
// Add the delta to the invocation counter and store the result. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2303 |
addi(invocation_count, invocation_count, delta); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2304 |
// Store value. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2305 |
stw(invocation_count, inv_counter_offset, Rcounters); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2306 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2307 |
// Add invocation counter + backedge counter. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2308 |
add(iv_be_count, backedge_count, invocation_count); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2309 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2310 |
// Note that this macro must leave the backedge_count + invocation_count in |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2311 |
// register iv_be_count! |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2312 |
BLOCK_COMMENT("} Increment profiling counters"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2313 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2314 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2315 |
void InterpreterMacroAssembler::verify_oop(Register reg, TosState state) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2316 |
if (state == atos) { MacroAssembler::verify_oop(reg); } |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2317 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2318 |
|
23221 | 2319 |
// Local helper function for the verify_oop_or_return_address macro. |
2320 |
static bool verify_return_address(Method* m, int bci) { |
|
2321 |
#ifndef PRODUCT |
|
2322 |
address pc = (address)(m->constMethod()) + in_bytes(ConstMethod::codes_offset()) + bci; |
|
2323 |
// Assume it is a valid return address if it is inside m and is preceded by a jsr. |
|
2324 |
if (!m->contains(pc)) return false; |
|
2325 |
address jsr_pc; |
|
2326 |
jsr_pc = pc - Bytecodes::length_for(Bytecodes::_jsr); |
|
2327 |
if (*jsr_pc == Bytecodes::_jsr && jsr_pc >= m->code_base()) return true; |
|
2328 |
jsr_pc = pc - Bytecodes::length_for(Bytecodes::_jsr_w); |
|
2329 |
if (*jsr_pc == Bytecodes::_jsr_w && jsr_pc >= m->code_base()) return true; |
|
2330 |
#endif // PRODUCT |
|
2331 |
return false; |
|
2332 |
} |
|
2333 |
||
2334 |
void InterpreterMacroAssembler::verify_FPU(int stack_depth, TosState state) { |
|
2335 |
if (VerifyFPU) { |
|
2336 |
unimplemented("verfiyFPU"); |
|
2337 |
} |
|
2338 |
} |
|
2339 |
||
2340 |
void InterpreterMacroAssembler::verify_oop_or_return_address(Register reg, Register Rtmp) { |
|
2341 |
if (!VerifyOops) return; |
|
2342 |
||
2343 |
// The VM documentation for the astore[_wide] bytecode allows |
|
2344 |
// the TOS to be not only an oop but also a return address. |
|
2345 |
Label test; |
|
2346 |
Label skip; |
|
2347 |
// See if it is an address (in the current method): |
|
2348 |
||
2349 |
const int log2_bytecode_size_limit = 16; |
|
2350 |
srdi_(Rtmp, reg, log2_bytecode_size_limit); |
|
2351 |
bne(CCR0, test); |
|
2352 |
||
2353 |
address fd = CAST_FROM_FN_PTR(address, verify_return_address); |
|
35085 | 2354 |
const int nbytes_save = MacroAssembler::num_volatile_regs * 8; |
28187
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
2355 |
save_volatile_gprs(R1_SP, -nbytes_save); // except R0 |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
2356 |
save_LR_CR(Rtmp); // Save in old frame. |
23221 | 2357 |
push_frame_reg_args(nbytes_save, Rtmp); |
2358 |
||
2359 |
load_const_optimized(Rtmp, fd, R0); |
|
2360 |
mr_if_needed(R4_ARG2, reg); |
|
2361 |
mr(R3_ARG1, R19_method); |
|
2362 |
call_c(Rtmp); // call C |
|
2363 |
||
2364 |
pop_frame(); |
|
2365 |
restore_LR_CR(Rtmp); |
|
28187
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
27012
diff
changeset
|
2366 |
restore_volatile_gprs(R1_SP, -nbytes_save); // except R0 |
23221 | 2367 |
b(skip); |
2368 |
||
2369 |
// Perform a more elaborate out-of-line call. |
|
2370 |
// Not an address; verify it: |
|
2371 |
bind(test); |
|
2372 |
verify_oop(reg); |
|
2373 |
bind(skip); |
|
2374 |
} |
|
2375 |
||
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2376 |
// Inline assembly for: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2377 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2378 |
// if (thread is in interp_only_mode) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2379 |
// InterpreterRuntime::post_method_entry(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2380 |
// } |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2381 |
// if (*jvmpi::event_flags_array_at_addr(JVMPI_EVENT_METHOD_ENTRY ) || |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2382 |
// *jvmpi::event_flags_array_at_addr(JVMPI_EVENT_METHOD_ENTRY2) ) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2383 |
// SharedRuntime::jvmpi_method_entry(method, receiver); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2384 |
// } |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2385 |
void InterpreterMacroAssembler::notify_method_entry() { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2386 |
// JVMTI |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2387 |
// Whenever JVMTI puts a thread in interp_only_mode, method |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2388 |
// entry/exit events are sent for that thread to track stack |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2389 |
// depth. If it is possible to enter interp_only_mode we add |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2390 |
// the code to check if the event should be sent. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2391 |
if (JvmtiExport::can_post_interpreter_events()) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2392 |
Label jvmti_post_done; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2393 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2394 |
lwz(R0, in_bytes(JavaThread::interp_only_mode_offset()), R16_thread); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2395 |
cmpwi(CCR0, R0, 0); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2396 |
beq(CCR0, jvmti_post_done); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2397 |
call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::post_method_entry), |
35166
23125410af16
8145117: PPC64: Remove cpp interpreter implementation
goetz
parents:
33083
diff
changeset
|
2398 |
/*check_exceptions=*/true); |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2399 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2400 |
bind(jvmti_post_done); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2401 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2402 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2403 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2404 |
// Inline assembly for: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2405 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2406 |
// if (thread is in interp_only_mode) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2407 |
// // save result |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2408 |
// InterpreterRuntime::post_method_exit(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2409 |
// // restore result |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2410 |
// } |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2411 |
// if (*jvmpi::event_flags_array_at_addr(JVMPI_EVENT_METHOD_EXIT)) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2412 |
// // save result |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2413 |
// SharedRuntime::jvmpi_method_exit(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2414 |
// // restore result |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2415 |
// } |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2416 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2417 |
// Native methods have their result stored in d_tmp and l_tmp. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2418 |
// Java methods have their result stored in the expression stack. |
23221 | 2419 |
void InterpreterMacroAssembler::notify_method_exit(bool is_native_method, TosState state, |
2420 |
NotifyMethodExitMode mode, bool check_exceptions) { |
|
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2421 |
// JVMTI |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2422 |
// Whenever JVMTI puts a thread in interp_only_mode, method |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2423 |
// entry/exit events are sent for that thread to track stack |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2424 |
// depth. If it is possible to enter interp_only_mode we add |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2425 |
// the code to check if the event should be sent. |
23221 | 2426 |
if (mode == NotifyJVMTI && JvmtiExport::can_post_interpreter_events()) { |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2427 |
Label jvmti_post_done; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2428 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2429 |
lwz(R0, in_bytes(JavaThread::interp_only_mode_offset()), R16_thread); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2430 |
cmpwi(CCR0, R0, 0); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2431 |
beq(CCR0, jvmti_post_done); |
35166
23125410af16
8145117: PPC64: Remove cpp interpreter implementation
goetz
parents:
33083
diff
changeset
|
2432 |
if (!is_native_method) { push(state); } // Expose tos to GC. |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2433 |
call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::post_method_exit), |
23221 | 2434 |
/*check_exceptions=*/check_exceptions); |
35166
23125410af16
8145117: PPC64: Remove cpp interpreter implementation
goetz
parents:
33083
diff
changeset
|
2435 |
if (!is_native_method) { pop(state); } |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2436 |
|
22861 | 2437 |
align(32, 12); |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2438 |
bind(jvmti_post_done); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2439 |
} |
23221 | 2440 |
|
2441 |
// Dtrace support not implemented. |
|
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2442 |
} |