author | jwilhelm |
Thu, 16 Mar 2017 16:40:41 -0700 | |
changeset 46338 | e84b501fa52e |
parent 46327 | 91576389a517 |
parent 44093 | e22e0d071bf9 |
child 46369 | 3bf4544bec14 |
permissions | -rw-r--r-- |
23221 | 1 |
/* |
46294
345a46524a19
8172020: Internal Error (cpu/arm/vm/frame_arm.cpp:571): assert(obj == __null || Universe::heap()->is_in(obj)) failed: sanity check #
cjplummer
parents:
46263
diff
changeset
|
2 |
* Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved. |
46317
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
3 |
* Copyright (c) 2015, 2017, SAP SE. All rights reserved. |
23221 | 4 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
5 |
* |
|
6 |
* This code is free software; you can redistribute it and/or modify it |
|
7 |
* under the terms of the GNU General Public License version 2 only, as |
|
8 |
* published by the Free Software Foundation. |
|
9 |
* |
|
10 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
11 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
12 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
13 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
14 |
* accompanied this code). |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License version |
|
17 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
18 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
19 |
* |
|
20 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
21 |
* or visit www.oracle.com if you need additional information or have any |
|
22 |
* questions. |
|
23 |
* |
|
24 |
*/ |
|
25 |
||
26 |
#include "precompiled.hpp" |
|
27 |
#include "asm/macroAssembler.inline.hpp" |
|
28 |
#include "interpreter/bytecodeHistogram.hpp" |
|
29 |
#include "interpreter/interpreter.hpp" |
|
30 |
#include "interpreter/interpreterRuntime.hpp" |
|
25715
d5a8dbdc5150
8049325: Introduce and clean up umbrella headers for the files in the cpu subdirectories.
goetz
parents:
24349
diff
changeset
|
31 |
#include "interpreter/interp_masm.hpp" |
35214 | 32 |
#include "interpreter/templateInterpreterGenerator.hpp" |
23221 | 33 |
#include "interpreter/templateTable.hpp" |
34 |
#include "oops/arrayOop.hpp" |
|
35 |
#include "oops/methodData.hpp" |
|
36 |
#include "oops/method.hpp" |
|
37 |
#include "oops/oop.inline.hpp" |
|
38 |
#include "prims/jvmtiExport.hpp" |
|
39 |
#include "prims/jvmtiThreadState.hpp" |
|
40 |
#include "runtime/arguments.hpp" |
|
41 |
#include "runtime/deoptimization.hpp" |
|
42 |
#include "runtime/frame.inline.hpp" |
|
43 |
#include "runtime/sharedRuntime.hpp" |
|
44 |
#include "runtime/stubRoutines.hpp" |
|
45 |
#include "runtime/synchronizer.hpp" |
|
46 |
#include "runtime/timer.hpp" |
|
47 |
#include "runtime/vframeArray.hpp" |
|
48 |
#include "utilities/debug.hpp" |
|
49 |
#include "utilities/macros.hpp" |
|
50 |
||
51 |
#undef __ |
|
52 |
#define __ _masm-> |
|
53 |
||
35479
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
54 |
// Size of interpreter code. Increase if too small. Interpreter will |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
55 |
// fail with a guarantee ("not enough space for interpreter generation"); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
56 |
// if too small. |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
57 |
// Run with +PrintInterpreter to get the VM to print out the size. |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
58 |
// Max size with JVMTI |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
59 |
int TemplateInterpreter::InterpreterCodeSize = 230*K; |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
60 |
|
23221 | 61 |
#ifdef PRODUCT |
62 |
#define BLOCK_COMMENT(str) /* nothing */ |
|
63 |
#else |
|
64 |
#define BLOCK_COMMENT(str) __ block_comment(str) |
|
65 |
#endif |
|
66 |
||
31861 | 67 |
#define BIND(label) __ bind(label); BLOCK_COMMENT(#label ":") |
23221 | 68 |
|
69 |
//----------------------------------------------------------------------------- |
|
70 |
||
35479
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
71 |
address TemplateInterpreterGenerator::generate_slow_signature_handler() { |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
72 |
// Slow_signature handler that respects the PPC C calling conventions. |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
73 |
// |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
74 |
// We get called by the native entry code with our output register |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
75 |
// area == 8. First we call InterpreterRuntime::get_result_handler |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
76 |
// to copy the pointer to the signature string temporarily to the |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
77 |
// first C-argument and to return the result_handler in |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
78 |
// R3_RET. Since native_entry will copy the jni-pointer to the |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
79 |
// first C-argument slot later on, it is OK to occupy this slot |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
80 |
// temporarilly. Then we copy the argument list on the java |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
81 |
// expression stack into native varargs format on the native stack |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
82 |
// and load arguments into argument registers. Integer arguments in |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
83 |
// the varargs vector will be sign-extended to 8 bytes. |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
84 |
// |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
85 |
// On entry: |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
86 |
// R3_ARG1 - intptr_t* Address of java argument list in memory. |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
87 |
// R15_prev_state - BytecodeInterpreter* Address of interpreter state for |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
88 |
// this method |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
89 |
// R19_method |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
90 |
// |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
91 |
// On exit (just before return instruction): |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
92 |
// R3_RET - contains the address of the result_handler. |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
93 |
// R4_ARG2 - is not updated for static methods and contains "this" otherwise. |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
94 |
// R5_ARG3-R10_ARG8: - When the (i-2)th Java argument is not of type float or double, |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
95 |
// ARGi contains this argument. Otherwise, ARGi is not updated. |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
96 |
// F1_ARG1-F13_ARG13 - contain the first 13 arguments of type float or double. |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
97 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
98 |
const int LogSizeOfTwoInstructions = 3; |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
99 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
100 |
// FIXME: use Argument:: GL: Argument names different numbers! |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
101 |
const int max_fp_register_arguments = 13; |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
102 |
const int max_int_register_arguments = 6; // first 2 are reserved |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
103 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
104 |
const Register arg_java = R21_tmp1; |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
105 |
const Register arg_c = R22_tmp2; |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
106 |
const Register signature = R23_tmp3; // is string |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
107 |
const Register sig_byte = R24_tmp4; |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
108 |
const Register fpcnt = R25_tmp5; |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
109 |
const Register argcnt = R26_tmp6; |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
110 |
const Register intSlot = R27_tmp7; |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
111 |
const Register target_sp = R28_tmp8; |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
112 |
const FloatRegister floatSlot = F0; |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
113 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
114 |
address entry = __ function_entry(); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
115 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
116 |
__ save_LR_CR(R0); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
117 |
__ save_nonvolatile_gprs(R1_SP, _spill_nonvolatiles_neg(r14)); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
118 |
// We use target_sp for storing arguments in the C frame. |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
119 |
__ mr(target_sp, R1_SP); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
120 |
__ push_frame_reg_args_nonvolatiles(0, R11_scratch1); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
121 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
122 |
__ mr(arg_java, R3_ARG1); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
123 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
124 |
__ call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::get_signature), R16_thread, R19_method); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
125 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
126 |
// Signature is in R3_RET. Signature is callee saved. |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
127 |
__ mr(signature, R3_RET); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
128 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
129 |
// Get the result handler. |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
130 |
__ call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::get_result_handler), R16_thread, R19_method); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
131 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
132 |
{ |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
133 |
Label L; |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
134 |
// test if static |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
135 |
// _access_flags._flags must be at offset 0. |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
136 |
// TODO PPC port: requires change in shared code. |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
137 |
//assert(in_bytes(AccessFlags::flags_offset()) == 0, |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
138 |
// "MethodDesc._access_flags == MethodDesc._access_flags._flags"); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
139 |
// _access_flags must be a 32 bit value. |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
140 |
assert(sizeof(AccessFlags) == 4, "wrong size"); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
141 |
__ lwa(R11_scratch1/*access_flags*/, method_(access_flags)); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
142 |
// testbit with condition register. |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
143 |
__ testbitdi(CCR0, R0, R11_scratch1/*access_flags*/, JVM_ACC_STATIC_BIT); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
144 |
__ btrue(CCR0, L); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
145 |
// For non-static functions, pass "this" in R4_ARG2 and copy it |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
146 |
// to 2nd C-arg slot. |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
147 |
// We need to box the Java object here, so we use arg_java |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
148 |
// (address of current Java stack slot) as argument and don't |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
149 |
// dereference it as in case of ints, floats, etc. |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
150 |
__ mr(R4_ARG2, arg_java); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
151 |
__ addi(arg_java, arg_java, -BytesPerWord); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
152 |
__ std(R4_ARG2, _abi(carg_2), target_sp); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
153 |
__ bind(L); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
154 |
} |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
155 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
156 |
// Will be incremented directly after loop_start. argcnt=0 |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
157 |
// corresponds to 3rd C argument. |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
158 |
__ li(argcnt, -1); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
159 |
// arg_c points to 3rd C argument |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
160 |
__ addi(arg_c, target_sp, _abi(carg_3)); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
161 |
// no floating-point args parsed so far |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
162 |
__ li(fpcnt, 0); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
163 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
164 |
Label move_intSlot_to_ARG, move_floatSlot_to_FARG; |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
165 |
Label loop_start, loop_end; |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
166 |
Label do_int, do_long, do_float, do_double, do_dontreachhere, do_object, do_array, do_boxed; |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
167 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
168 |
// signature points to '(' at entry |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
169 |
#ifdef ASSERT |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
170 |
__ lbz(sig_byte, 0, signature); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
171 |
__ cmplwi(CCR0, sig_byte, '('); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
172 |
__ bne(CCR0, do_dontreachhere); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
173 |
#endif |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
174 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
175 |
__ bind(loop_start); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
176 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
177 |
__ addi(argcnt, argcnt, 1); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
178 |
__ lbzu(sig_byte, 1, signature); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
179 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
180 |
__ cmplwi(CCR0, sig_byte, ')'); // end of signature |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
181 |
__ beq(CCR0, loop_end); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
182 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
183 |
__ cmplwi(CCR0, sig_byte, 'B'); // byte |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
184 |
__ beq(CCR0, do_int); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
185 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
186 |
__ cmplwi(CCR0, sig_byte, 'C'); // char |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
187 |
__ beq(CCR0, do_int); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
188 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
189 |
__ cmplwi(CCR0, sig_byte, 'D'); // double |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
190 |
__ beq(CCR0, do_double); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
191 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
192 |
__ cmplwi(CCR0, sig_byte, 'F'); // float |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
193 |
__ beq(CCR0, do_float); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
194 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
195 |
__ cmplwi(CCR0, sig_byte, 'I'); // int |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
196 |
__ beq(CCR0, do_int); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
197 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
198 |
__ cmplwi(CCR0, sig_byte, 'J'); // long |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
199 |
__ beq(CCR0, do_long); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
200 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
201 |
__ cmplwi(CCR0, sig_byte, 'S'); // short |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
202 |
__ beq(CCR0, do_int); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
203 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
204 |
__ cmplwi(CCR0, sig_byte, 'Z'); // boolean |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
205 |
__ beq(CCR0, do_int); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
206 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
207 |
__ cmplwi(CCR0, sig_byte, 'L'); // object |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
208 |
__ beq(CCR0, do_object); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
209 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
210 |
__ cmplwi(CCR0, sig_byte, '['); // array |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
211 |
__ beq(CCR0, do_array); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
212 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
213 |
// __ cmplwi(CCR0, sig_byte, 'V'); // void cannot appear since we do not parse the return type |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
214 |
// __ beq(CCR0, do_void); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
215 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
216 |
__ bind(do_dontreachhere); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
217 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
218 |
__ unimplemented("ShouldNotReachHere in slow_signature_handler", 120); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
219 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
220 |
__ bind(do_array); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
221 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
222 |
{ |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
223 |
Label start_skip, end_skip; |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
224 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
225 |
__ bind(start_skip); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
226 |
__ lbzu(sig_byte, 1, signature); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
227 |
__ cmplwi(CCR0, sig_byte, '['); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
228 |
__ beq(CCR0, start_skip); // skip further brackets |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
229 |
__ cmplwi(CCR0, sig_byte, '9'); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
230 |
__ bgt(CCR0, end_skip); // no optional size |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
231 |
__ cmplwi(CCR0, sig_byte, '0'); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
232 |
__ bge(CCR0, start_skip); // skip optional size |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
233 |
__ bind(end_skip); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
234 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
235 |
__ cmplwi(CCR0, sig_byte, 'L'); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
236 |
__ beq(CCR0, do_object); // for arrays of objects, the name of the object must be skipped |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
237 |
__ b(do_boxed); // otherwise, go directly to do_boxed |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
238 |
} |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
239 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
240 |
__ bind(do_object); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
241 |
{ |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
242 |
Label L; |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
243 |
__ bind(L); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
244 |
__ lbzu(sig_byte, 1, signature); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
245 |
__ cmplwi(CCR0, sig_byte, ';'); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
246 |
__ bne(CCR0, L); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
247 |
} |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
248 |
// Need to box the Java object here, so we use arg_java (address of |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
249 |
// current Java stack slot) as argument and don't dereference it as |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
250 |
// in case of ints, floats, etc. |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
251 |
Label do_null; |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
252 |
__ bind(do_boxed); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
253 |
__ ld(R0,0, arg_java); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
254 |
__ cmpdi(CCR0, R0, 0); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
255 |
__ li(intSlot,0); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
256 |
__ beq(CCR0, do_null); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
257 |
__ mr(intSlot, arg_java); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
258 |
__ bind(do_null); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
259 |
__ std(intSlot, 0, arg_c); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
260 |
__ addi(arg_java, arg_java, -BytesPerWord); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
261 |
__ addi(arg_c, arg_c, BytesPerWord); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
262 |
__ cmplwi(CCR0, argcnt, max_int_register_arguments); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
263 |
__ blt(CCR0, move_intSlot_to_ARG); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
264 |
__ b(loop_start); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
265 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
266 |
__ bind(do_int); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
267 |
__ lwa(intSlot, 0, arg_java); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
268 |
__ std(intSlot, 0, arg_c); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
269 |
__ addi(arg_java, arg_java, -BytesPerWord); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
270 |
__ addi(arg_c, arg_c, BytesPerWord); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
271 |
__ cmplwi(CCR0, argcnt, max_int_register_arguments); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
272 |
__ blt(CCR0, move_intSlot_to_ARG); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
273 |
__ b(loop_start); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
274 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
275 |
__ bind(do_long); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
276 |
__ ld(intSlot, -BytesPerWord, arg_java); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
277 |
__ std(intSlot, 0, arg_c); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
278 |
__ addi(arg_java, arg_java, - 2 * BytesPerWord); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
279 |
__ addi(arg_c, arg_c, BytesPerWord); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
280 |
__ cmplwi(CCR0, argcnt, max_int_register_arguments); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
281 |
__ blt(CCR0, move_intSlot_to_ARG); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
282 |
__ b(loop_start); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
283 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
284 |
__ bind(do_float); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
285 |
__ lfs(floatSlot, 0, arg_java); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
286 |
#if defined(LINUX) |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
287 |
// Linux uses ELF ABI. Both original ELF and ELFv2 ABIs have float |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
288 |
// in the least significant word of an argument slot. |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
289 |
#if defined(VM_LITTLE_ENDIAN) |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
290 |
__ stfs(floatSlot, 0, arg_c); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
291 |
#else |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
292 |
__ stfs(floatSlot, 4, arg_c); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
293 |
#endif |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
294 |
#elif defined(AIX) |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
295 |
// Although AIX runs on big endian CPU, float is in most significant |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
296 |
// word of an argument slot. |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
297 |
__ stfs(floatSlot, 0, arg_c); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
298 |
#else |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
299 |
#error "unknown OS" |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
300 |
#endif |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
301 |
__ addi(arg_java, arg_java, -BytesPerWord); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
302 |
__ addi(arg_c, arg_c, BytesPerWord); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
303 |
__ cmplwi(CCR0, fpcnt, max_fp_register_arguments); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
304 |
__ blt(CCR0, move_floatSlot_to_FARG); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
305 |
__ b(loop_start); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
306 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
307 |
__ bind(do_double); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
308 |
__ lfd(floatSlot, - BytesPerWord, arg_java); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
309 |
__ stfd(floatSlot, 0, arg_c); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
310 |
__ addi(arg_java, arg_java, - 2 * BytesPerWord); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
311 |
__ addi(arg_c, arg_c, BytesPerWord); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
312 |
__ cmplwi(CCR0, fpcnt, max_fp_register_arguments); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
313 |
__ blt(CCR0, move_floatSlot_to_FARG); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
314 |
__ b(loop_start); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
315 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
316 |
__ bind(loop_end); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
317 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
318 |
__ pop_frame(); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
319 |
__ restore_nonvolatile_gprs(R1_SP, _spill_nonvolatiles_neg(r14)); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
320 |
__ restore_LR_CR(R0); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
321 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
322 |
__ blr(); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
323 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
324 |
Label move_int_arg, move_float_arg; |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
325 |
__ bind(move_int_arg); // each case must consist of 2 instructions (otherwise adapt LogSizeOfTwoInstructions) |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
326 |
__ mr(R5_ARG3, intSlot); __ b(loop_start); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
327 |
__ mr(R6_ARG4, intSlot); __ b(loop_start); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
328 |
__ mr(R7_ARG5, intSlot); __ b(loop_start); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
329 |
__ mr(R8_ARG6, intSlot); __ b(loop_start); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
330 |
__ mr(R9_ARG7, intSlot); __ b(loop_start); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
331 |
__ mr(R10_ARG8, intSlot); __ b(loop_start); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
332 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
333 |
__ bind(move_float_arg); // each case must consist of 2 instructions (otherwise adapt LogSizeOfTwoInstructions) |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
334 |
__ fmr(F1_ARG1, floatSlot); __ b(loop_start); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
335 |
__ fmr(F2_ARG2, floatSlot); __ b(loop_start); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
336 |
__ fmr(F3_ARG3, floatSlot); __ b(loop_start); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
337 |
__ fmr(F4_ARG4, floatSlot); __ b(loop_start); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
338 |
__ fmr(F5_ARG5, floatSlot); __ b(loop_start); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
339 |
__ fmr(F6_ARG6, floatSlot); __ b(loop_start); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
340 |
__ fmr(F7_ARG7, floatSlot); __ b(loop_start); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
341 |
__ fmr(F8_ARG8, floatSlot); __ b(loop_start); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
342 |
__ fmr(F9_ARG9, floatSlot); __ b(loop_start); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
343 |
__ fmr(F10_ARG10, floatSlot); __ b(loop_start); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
344 |
__ fmr(F11_ARG11, floatSlot); __ b(loop_start); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
345 |
__ fmr(F12_ARG12, floatSlot); __ b(loop_start); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
346 |
__ fmr(F13_ARG13, floatSlot); __ b(loop_start); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
347 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
348 |
__ bind(move_intSlot_to_ARG); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
349 |
__ sldi(R0, argcnt, LogSizeOfTwoInstructions); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
350 |
__ load_const(R11_scratch1, move_int_arg); // Label must be bound here. |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
351 |
__ add(R11_scratch1, R0, R11_scratch1); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
352 |
__ mtctr(R11_scratch1/*branch_target*/); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
353 |
__ bctr(); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
354 |
__ bind(move_floatSlot_to_FARG); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
355 |
__ sldi(R0, fpcnt, LogSizeOfTwoInstructions); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
356 |
__ addi(fpcnt, fpcnt, 1); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
357 |
__ load_const(R11_scratch1, move_float_arg); // Label must be bound here. |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
358 |
__ add(R11_scratch1, R0, R11_scratch1); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
359 |
__ mtctr(R11_scratch1/*branch_target*/); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
360 |
__ bctr(); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
361 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
362 |
return entry; |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
363 |
} |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
364 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
365 |
address TemplateInterpreterGenerator::generate_result_handler_for(BasicType type) { |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
366 |
// |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
367 |
// Registers alive |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
368 |
// R3_RET |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
369 |
// LR |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
370 |
// |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
371 |
// Registers updated |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
372 |
// R3_RET |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
373 |
// |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
374 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
375 |
Label done; |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
376 |
address entry = __ pc(); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
377 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
378 |
switch (type) { |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
379 |
case T_BOOLEAN: |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
380 |
// convert !=0 to 1 |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
381 |
__ neg(R0, R3_RET); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
382 |
__ orr(R0, R3_RET, R0); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
383 |
__ srwi(R3_RET, R0, 31); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
384 |
break; |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
385 |
case T_BYTE: |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
386 |
// sign extend 8 bits |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
387 |
__ extsb(R3_RET, R3_RET); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
388 |
break; |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
389 |
case T_CHAR: |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
390 |
// zero extend 16 bits |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
391 |
__ clrldi(R3_RET, R3_RET, 48); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
392 |
break; |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
393 |
case T_SHORT: |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
394 |
// sign extend 16 bits |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
395 |
__ extsh(R3_RET, R3_RET); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
396 |
break; |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
397 |
case T_INT: |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
398 |
// sign extend 32 bits |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
399 |
__ extsw(R3_RET, R3_RET); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
400 |
break; |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
401 |
case T_LONG: |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
402 |
break; |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
403 |
case T_OBJECT: |
44093
e22e0d071bf9
8176054: [BACKOUT][REDO] G1 Needs pre barrier on dereference of weak JNI handles
jwilhelm
parents:
44088
diff
changeset
|
404 |
// unbox result if not null |
e22e0d071bf9
8176054: [BACKOUT][REDO] G1 Needs pre barrier on dereference of weak JNI handles
jwilhelm
parents:
44088
diff
changeset
|
405 |
__ cmpdi(CCR0, R3_RET, 0); |
e22e0d071bf9
8176054: [BACKOUT][REDO] G1 Needs pre barrier on dereference of weak JNI handles
jwilhelm
parents:
44088
diff
changeset
|
406 |
__ beq(CCR0, done); |
e22e0d071bf9
8176054: [BACKOUT][REDO] G1 Needs pre barrier on dereference of weak JNI handles
jwilhelm
parents:
44088
diff
changeset
|
407 |
__ ld(R3_RET, 0, R3_RET); |
e22e0d071bf9
8176054: [BACKOUT][REDO] G1 Needs pre barrier on dereference of weak JNI handles
jwilhelm
parents:
44088
diff
changeset
|
408 |
__ verify_oop(R3_RET); |
35479
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
409 |
break; |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
410 |
case T_FLOAT: |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
411 |
break; |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
412 |
case T_DOUBLE: |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
413 |
break; |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
414 |
case T_VOID: |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
415 |
break; |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
416 |
default: ShouldNotReachHere(); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
417 |
} |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
418 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
419 |
BIND(done); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
420 |
__ blr(); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
421 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
422 |
return entry; |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
423 |
} |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
424 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
425 |
// Abstract method entry. |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
426 |
// |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
427 |
address TemplateInterpreterGenerator::generate_abstract_entry(void) { |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
428 |
address entry = __ pc(); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
429 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
430 |
// |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
431 |
// Registers alive |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
432 |
// R16_thread - JavaThread* |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
433 |
// R19_method - callee's method (method to be invoked) |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
434 |
// R1_SP - SP prepared such that caller's outgoing args are near top |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
435 |
// LR - return address to caller |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
436 |
// |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
437 |
// Stack layout at this point: |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
438 |
// |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
439 |
// 0 [TOP_IJAVA_FRAME_ABI] <-- R1_SP |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
440 |
// alignment (optional) |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
441 |
// [outgoing Java arguments] |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
442 |
// ... |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
443 |
// PARENT [PARENT_IJAVA_FRAME_ABI] |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
444 |
// ... |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
445 |
// |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
446 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
447 |
// Can't use call_VM here because we have not set up a new |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
448 |
// interpreter state. Make the call to the vm and make it look like |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
449 |
// our caller set up the JavaFrameAnchor. |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
450 |
__ set_top_ijava_frame_at_SP_as_last_Java_frame(R1_SP, R12_scratch2/*tmp*/); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
451 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
452 |
// Push a new C frame and save LR. |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
453 |
__ save_LR_CR(R0); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
454 |
__ push_frame_reg_args(0, R11_scratch1); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
455 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
456 |
// This is not a leaf but we have a JavaFrameAnchor now and we will |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
457 |
// check (create) exceptions afterward so this is ok. |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
458 |
__ call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_AbstractMethodError), |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
459 |
R16_thread); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
460 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
461 |
// Pop the C frame and restore LR. |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
462 |
__ pop_frame(); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
463 |
__ restore_LR_CR(R0); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
464 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
465 |
// Reset JavaFrameAnchor from call_VM_leaf above. |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
466 |
__ reset_last_Java_frame(); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
467 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
468 |
// We don't know our caller, so jump to the general forward exception stub, |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
469 |
// which will also pop our full frame off. Satisfy the interface of |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
470 |
// SharedRuntime::generate_forward_exception() |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
471 |
__ load_const_optimized(R11_scratch1, StubRoutines::forward_exception_entry(), R0); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
472 |
__ mtctr(R11_scratch1); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
473 |
__ bctr(); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
474 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
475 |
return entry; |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
476 |
} |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
477 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
478 |
// Interpreter intrinsic for WeakReference.get(). |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
479 |
// 1. Don't push a full blown frame and go on dispatching, but fetch the value |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
480 |
// into R8 and return quickly |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
481 |
// 2. If G1 is active we *must* execute this intrinsic for corrrectness: |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
482 |
// It contains a GC barrier which puts the reference into the satb buffer |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
483 |
// to indicate that someone holds a strong reference to the object the |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
484 |
// weak ref points to! |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
485 |
address TemplateInterpreterGenerator::generate_Reference_get_entry(void) { |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
486 |
// Code: _aload_0, _getfield, _areturn |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
487 |
// parameter size = 1 |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
488 |
// |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
489 |
// The code that gets generated by this routine is split into 2 parts: |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
490 |
// 1. the "intrinsified" code for G1 (or any SATB based GC), |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
491 |
// 2. the slow path - which is an expansion of the regular method entry. |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
492 |
// |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
493 |
// Notes: |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
494 |
// * In the G1 code we do not check whether we need to block for |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
495 |
// a safepoint. If G1 is enabled then we must execute the specialized |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
496 |
// code for Reference.get (except when the Reference object is null) |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
497 |
// so that we can log the value in the referent field with an SATB |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
498 |
// update buffer. |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
499 |
// If the code for the getfield template is modified so that the |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
500 |
// G1 pre-barrier code is executed when the current method is |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
501 |
// Reference.get() then going through the normal method entry |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
502 |
// will be fine. |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
503 |
// * The G1 code can, however, check the receiver object (the instance |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
504 |
// of java.lang.Reference) and jump to the slow path if null. If the |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
505 |
// Reference object is null then we obviously cannot fetch the referent |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
506 |
// and so we don't need to call the G1 pre-barrier. Thus we can use the |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
507 |
// regular method entry code to generate the NPE. |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
508 |
// |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
509 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
510 |
if (UseG1GC) { |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
511 |
address entry = __ pc(); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
512 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
513 |
const int referent_offset = java_lang_ref_Reference::referent_offset; |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
514 |
guarantee(referent_offset > 0, "referent offset not initialized"); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
515 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
516 |
Label slow_path; |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
517 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
518 |
// Debugging not possible, so can't use __ skip_if_jvmti_mode(slow_path, GR31_SCRATCH); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
519 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
520 |
// In the G1 code we don't check if we need to reach a safepoint. We |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
521 |
// continue and the thread will safepoint at the next bytecode dispatch. |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
522 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
523 |
// If the receiver is null then it is OK to jump to the slow path. |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
524 |
__ ld(R3_RET, Interpreter::stackElementSize, R15_esp); // get receiver |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
525 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
526 |
// Check if receiver == NULL and go the slow path. |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
527 |
__ cmpdi(CCR0, R3_RET, 0); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
528 |
__ beq(CCR0, slow_path); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
529 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
530 |
// Load the value of the referent field. |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
531 |
__ load_heap_oop(R3_RET, referent_offset, R3_RET); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
532 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
533 |
// Generate the G1 pre-barrier code to log the value of |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
534 |
// the referent field in an SATB buffer. Note with |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
535 |
// these parameters the pre-barrier does not generate |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
536 |
// the load of the previous value. |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
537 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
538 |
// Restore caller sp for c2i case. |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
539 |
#ifdef ASSERT |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
540 |
__ ld(R9_ARG7, 0, R1_SP); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
541 |
__ ld(R10_ARG8, 0, R21_sender_SP); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
542 |
__ cmpd(CCR0, R9_ARG7, R10_ARG8); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
543 |
__ asm_assert_eq("backlink", 0x544); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
544 |
#endif // ASSERT |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
545 |
__ mr(R1_SP, R21_sender_SP); // Cut the stack back to where the caller started. |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
546 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
547 |
__ g1_write_barrier_pre(noreg, // obj |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
548 |
noreg, // offset |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
549 |
R3_RET, // pre_val |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
550 |
R11_scratch1, // tmp |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
551 |
R12_scratch2, // tmp |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
552 |
true); // needs_frame |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
553 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
554 |
__ blr(); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
555 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
556 |
// Generate regular method entry. |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
557 |
__ bind(slow_path); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
558 |
__ jump_to_entry(Interpreter::entry_for_kind(Interpreter::zerolocals), R11_scratch1); |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
559 |
return entry; |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
560 |
} |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
561 |
|
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
562 |
return NULL; |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
563 |
} |
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
564 |
|
23221 | 565 |
address TemplateInterpreterGenerator::generate_StackOverflowError_handler() { |
566 |
address entry = __ pc(); |
|
38734
69ced2325f58
8156922: [ppc] Implement template interpreter stack overflow checks as on x86/sparc.
goetz
parents:
38127
diff
changeset
|
567 |
|
69ced2325f58
8156922: [ppc] Implement template interpreter stack overflow checks as on x86/sparc.
goetz
parents:
38127
diff
changeset
|
568 |
// Expression stack must be empty before entering the VM if an |
69ced2325f58
8156922: [ppc] Implement template interpreter stack overflow checks as on x86/sparc.
goetz
parents:
38127
diff
changeset
|
569 |
// exception happened. |
69ced2325f58
8156922: [ppc] Implement template interpreter stack overflow checks as on x86/sparc.
goetz
parents:
38127
diff
changeset
|
570 |
__ empty_expression_stack(); |
69ced2325f58
8156922: [ppc] Implement template interpreter stack overflow checks as on x86/sparc.
goetz
parents:
38127
diff
changeset
|
571 |
// Throw exception. |
69ced2325f58
8156922: [ppc] Implement template interpreter stack overflow checks as on x86/sparc.
goetz
parents:
38127
diff
changeset
|
572 |
__ call_VM(noreg, |
69ced2325f58
8156922: [ppc] Implement template interpreter stack overflow checks as on x86/sparc.
goetz
parents:
38127
diff
changeset
|
573 |
CAST_FROM_FN_PTR(address, |
69ced2325f58
8156922: [ppc] Implement template interpreter stack overflow checks as on x86/sparc.
goetz
parents:
38127
diff
changeset
|
574 |
InterpreterRuntime::throw_StackOverflowError)); |
23221 | 575 |
return entry; |
576 |
} |
|
577 |
||
578 |
address TemplateInterpreterGenerator::generate_ArrayIndexOutOfBounds_handler(const char* name) { |
|
579 |
address entry = __ pc(); |
|
580 |
__ empty_expression_stack(); |
|
581 |
__ load_const_optimized(R4_ARG2, (address) name); |
|
582 |
// Index is in R17_tos. |
|
583 |
__ mr(R5_ARG3, R17_tos); |
|
584 |
__ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_ArrayIndexOutOfBoundsException)); |
|
585 |
return entry; |
|
586 |
} |
|
587 |
||
588 |
#if 0 |
|
589 |
// Call special ClassCastException constructor taking object to cast |
|
590 |
// and target class as arguments. |
|
24349 | 591 |
address TemplateInterpreterGenerator::generate_ClassCastException_verbose_handler() { |
23221 | 592 |
address entry = __ pc(); |
593 |
||
594 |
// Expression stack must be empty before entering the VM if an |
|
595 |
// exception happened. |
|
596 |
__ empty_expression_stack(); |
|
24349 | 597 |
|
23221 | 598 |
// Thread will be loaded to R3_ARG1. |
24349 | 599 |
// Target class oop is in register R5_ARG3 by convention! |
28187
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
25950
diff
changeset
|
600 |
__ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_ClassCastException_verbose), R17_tos, R5_ARG3); |
23221 | 601 |
// Above call must not return here since exception pending. |
24349 | 602 |
DEBUG_ONLY(__ should_not_reach_here();) |
23221 | 603 |
return entry; |
604 |
} |
|
605 |
#endif |
|
606 |
||
607 |
address TemplateInterpreterGenerator::generate_ClassCastException_handler() { |
|
608 |
address entry = __ pc(); |
|
609 |
// Expression stack must be empty before entering the VM if an |
|
610 |
// exception happened. |
|
611 |
__ empty_expression_stack(); |
|
612 |
||
613 |
// Load exception object. |
|
614 |
// Thread will be loaded to R3_ARG1. |
|
615 |
__ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_ClassCastException), R17_tos); |
|
616 |
#ifdef ASSERT |
|
617 |
// Above call must not return here since exception pending. |
|
618 |
__ should_not_reach_here(); |
|
619 |
#endif |
|
620 |
return entry; |
|
621 |
} |
|
622 |
||
623 |
address TemplateInterpreterGenerator::generate_exception_handler_common(const char* name, const char* message, bool pass_oop) { |
|
624 |
address entry = __ pc(); |
|
625 |
//__ untested("generate_exception_handler_common"); |
|
626 |
Register Rexception = R17_tos; |
|
627 |
||
628 |
// Expression stack must be empty before entering the VM if an exception happened. |
|
629 |
__ empty_expression_stack(); |
|
630 |
||
631 |
__ load_const_optimized(R4_ARG2, (address) name, R11_scratch1); |
|
632 |
if (pass_oop) { |
|
633 |
__ mr(R5_ARG3, Rexception); |
|
634 |
__ call_VM(Rexception, CAST_FROM_FN_PTR(address, InterpreterRuntime::create_klass_exception), false); |
|
635 |
} else { |
|
636 |
__ load_const_optimized(R5_ARG3, (address) message, R11_scratch1); |
|
637 |
__ call_VM(Rexception, CAST_FROM_FN_PTR(address, InterpreterRuntime::create_exception), false); |
|
638 |
} |
|
639 |
||
640 |
// Throw exception. |
|
641 |
__ mr(R3_ARG1, Rexception); |
|
642 |
__ load_const_optimized(R11_scratch1, Interpreter::throw_exception_entry(), R12_scratch2); |
|
643 |
__ mtctr(R11_scratch1); |
|
644 |
__ bctr(); |
|
645 |
||
646 |
return entry; |
|
647 |
} |
|
648 |
||
649 |
// This entry is returned to when a call returns to the interpreter. |
|
650 |
// When we arrive here, we expect that the callee stack frame is already popped. |
|
651 |
address TemplateInterpreterGenerator::generate_return_entry_for(TosState state, int step, size_t index_size) { |
|
652 |
address entry = __ pc(); |
|
653 |
||
654 |
// Move the value out of the return register back to the TOS cache of current frame. |
|
655 |
switch (state) { |
|
656 |
case ltos: |
|
657 |
case btos: |
|
37488 | 658 |
case ztos: |
23221 | 659 |
case ctos: |
660 |
case stos: |
|
661 |
case atos: |
|
662 |
case itos: __ mr(R17_tos, R3_RET); break; // RET -> TOS cache |
|
663 |
case ftos: |
|
664 |
case dtos: __ fmr(F15_ftos, F1_RET); break; // TOS cache -> GR_FRET |
|
665 |
case vtos: break; // Nothing to do, this was a void return. |
|
666 |
default : ShouldNotReachHere(); |
|
667 |
} |
|
668 |
||
669 |
__ restore_interpreter_state(R11_scratch1); // Sets R11_scratch1 = fp. |
|
670 |
__ ld(R12_scratch2, _ijava_state_neg(top_frame_sp), R11_scratch1); |
|
671 |
__ resize_frame_absolute(R12_scratch2, R11_scratch1, R0); |
|
672 |
||
673 |
// Compiled code destroys templateTableBase, reload. |
|
674 |
__ load_const_optimized(R25_templateTableBase, (address)Interpreter::dispatch_table((TosState)0), R12_scratch2); |
|
675 |
||
28187
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
25950
diff
changeset
|
676 |
if (state == atos) { |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
25950
diff
changeset
|
677 |
__ profile_return_type(R3_RET, R11_scratch1, R12_scratch2); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
25950
diff
changeset
|
678 |
} |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
25950
diff
changeset
|
679 |
|
23221 | 680 |
const Register cache = R11_scratch1; |
681 |
const Register size = R12_scratch2; |
|
682 |
__ get_cache_and_index_at_bcp(cache, 1, index_size); |
|
683 |
||
25916
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
25715
diff
changeset
|
684 |
// Get least significant byte of 64 bit value: |
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
25715
diff
changeset
|
685 |
#if defined(VM_LITTLE_ENDIAN) |
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
25715
diff
changeset
|
686 |
__ lbz(size, in_bytes(ConstantPoolCache::base_offset() + ConstantPoolCacheEntry::flags_offset()), cache); |
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
25715
diff
changeset
|
687 |
#else |
23221 | 688 |
__ lbz(size, in_bytes(ConstantPoolCache::base_offset() + ConstantPoolCacheEntry::flags_offset()) + 7, cache); |
25916
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
25715
diff
changeset
|
689 |
#endif |
23221 | 690 |
__ sldi(size, size, Interpreter::logStackElementSize); |
691 |
__ add(R15_esp, R15_esp, size); |
|
46294
345a46524a19
8172020: Internal Error (cpu/arm/vm/frame_arm.cpp:571): assert(obj == __null || Universe::heap()->is_in(obj)) failed: sanity check #
cjplummer
parents:
46263
diff
changeset
|
692 |
|
345a46524a19
8172020: Internal Error (cpu/arm/vm/frame_arm.cpp:571): assert(obj == __null || Universe::heap()->is_in(obj)) failed: sanity check #
cjplummer
parents:
46263
diff
changeset
|
693 |
__ check_and_handle_popframe(R11_scratch1); |
345a46524a19
8172020: Internal Error (cpu/arm/vm/frame_arm.cpp:571): assert(obj == __null || Universe::heap()->is_in(obj)) failed: sanity check #
cjplummer
parents:
46263
diff
changeset
|
694 |
__ check_and_handle_earlyret(R11_scratch1); |
345a46524a19
8172020: Internal Error (cpu/arm/vm/frame_arm.cpp:571): assert(obj == __null || Universe::heap()->is_in(obj)) failed: sanity check #
cjplummer
parents:
46263
diff
changeset
|
695 |
|
23221 | 696 |
__ dispatch_next(state, step); |
697 |
return entry; |
|
698 |
} |
|
699 |
||
700 |
address TemplateInterpreterGenerator::generate_deopt_entry_for(TosState state, int step) { |
|
701 |
address entry = __ pc(); |
|
702 |
// If state != vtos, we're returning from a native method, which put it's result |
|
703 |
// into the result register. So move the value out of the return register back |
|
704 |
// to the TOS cache of current frame. |
|
705 |
||
706 |
switch (state) { |
|
707 |
case ltos: |
|
708 |
case btos: |
|
37488 | 709 |
case ztos: |
23221 | 710 |
case ctos: |
711 |
case stos: |
|
712 |
case atos: |
|
713 |
case itos: __ mr(R17_tos, R3_RET); break; // GR_RET -> TOS cache |
|
714 |
case ftos: |
|
715 |
case dtos: __ fmr(F15_ftos, F1_RET); break; // TOS cache -> GR_FRET |
|
716 |
case vtos: break; // Nothing to do, this was a void return. |
|
717 |
default : ShouldNotReachHere(); |
|
718 |
} |
|
719 |
||
720 |
// Load LcpoolCache @@@ should be already set! |
|
721 |
__ get_constant_pool_cache(R27_constPoolCache); |
|
722 |
||
723 |
// Handle a pending exception, fall through if none. |
|
724 |
__ check_and_forward_exception(R11_scratch1, R12_scratch2); |
|
725 |
||
726 |
// Start executing bytecodes. |
|
727 |
__ dispatch_next(state, step); |
|
728 |
||
729 |
return entry; |
|
730 |
} |
|
731 |
||
732 |
address TemplateInterpreterGenerator::generate_safept_entry_for(TosState state, address runtime_entry) { |
|
733 |
address entry = __ pc(); |
|
734 |
||
735 |
__ push(state); |
|
736 |
__ call_VM(noreg, runtime_entry); |
|
737 |
__ dispatch_via(vtos, Interpreter::_normal_table.table_for(vtos)); |
|
738 |
||
739 |
return entry; |
|
740 |
} |
|
741 |
||
742 |
// Helpers for commoning out cases in the various type of method entries. |
|
743 |
||
744 |
// Increment invocation count & check for overflow. |
|
745 |
// |
|
746 |
// Note: checking for negative value instead of overflow |
|
747 |
// so we have a 'sticky' overflow test. |
|
748 |
// |
|
749 |
void TemplateInterpreterGenerator::generate_counter_incr(Label* overflow, Label* profile_method, Label* profile_method_continue) { |
|
750 |
// Note: In tiered we increment either counters in method or in MDO depending if we're profiling or not. |
|
751 |
Register Rscratch1 = R11_scratch1; |
|
752 |
Register Rscratch2 = R12_scratch2; |
|
753 |
Register R3_counters = R3_ARG1; |
|
754 |
Label done; |
|
755 |
||
756 |
if (TieredCompilation) { |
|
757 |
const int increment = InvocationCounter::count_increment; |
|
758 |
Label no_mdo; |
|
759 |
if (ProfileInterpreter) { |
|
35085 | 760 |
const Register Rmdo = R3_counters; |
23221 | 761 |
// If no method data exists, go to profile_continue. |
762 |
__ ld(Rmdo, in_bytes(Method::method_data_offset()), R19_method); |
|
763 |
__ cmpdi(CCR0, Rmdo, 0); |
|
764 |
__ beq(CCR0, no_mdo); |
|
765 |
||
35156 | 766 |
// Increment invocation counter in the MDO. |
35085 | 767 |
const int mdo_ic_offs = in_bytes(MethodData::invocation_counter_offset()) + in_bytes(InvocationCounter::counter_offset()); |
768 |
__ lwz(Rscratch2, mdo_ic_offs, Rmdo); |
|
769 |
__ lwz(Rscratch1, in_bytes(MethodData::invoke_mask_offset()), Rmdo); |
|
23221 | 770 |
__ addi(Rscratch2, Rscratch2, increment); |
35085 | 771 |
__ stw(Rscratch2, mdo_ic_offs, Rmdo); |
23221 | 772 |
__ and_(Rscratch1, Rscratch2, Rscratch1); |
773 |
__ bne(CCR0, done); |
|
774 |
__ b(*overflow); |
|
775 |
} |
|
776 |
||
777 |
// Increment counter in MethodCounters*. |
|
35156 | 778 |
const int mo_ic_offs = in_bytes(MethodCounters::invocation_counter_offset()) + in_bytes(InvocationCounter::counter_offset()); |
23221 | 779 |
__ bind(no_mdo); |
780 |
__ get_method_counters(R19_method, R3_counters, done); |
|
35156 | 781 |
__ lwz(Rscratch2, mo_ic_offs, R3_counters); |
35085 | 782 |
__ lwz(Rscratch1, in_bytes(MethodCounters::invoke_mask_offset()), R3_counters); |
23221 | 783 |
__ addi(Rscratch2, Rscratch2, increment); |
35156 | 784 |
__ stw(Rscratch2, mo_ic_offs, R3_counters); |
23221 | 785 |
__ and_(Rscratch1, Rscratch2, Rscratch1); |
786 |
__ beq(CCR0, *overflow); |
|
787 |
||
788 |
__ bind(done); |
|
789 |
||
790 |
} else { |
|
791 |
||
792 |
// Update standard invocation counters. |
|
793 |
Register Rsum_ivc_bec = R4_ARG2; |
|
794 |
__ get_method_counters(R19_method, R3_counters, done); |
|
795 |
__ increment_invocation_counter(R3_counters, Rsum_ivc_bec, R12_scratch2); |
|
796 |
// Increment interpreter invocation counter. |
|
797 |
if (ProfileInterpreter) { // %%% Merge this into methodDataOop. |
|
798 |
__ lwz(R12_scratch2, in_bytes(MethodCounters::interpreter_invocation_counter_offset()), R3_counters); |
|
799 |
__ addi(R12_scratch2, R12_scratch2, 1); |
|
800 |
__ stw(R12_scratch2, in_bytes(MethodCounters::interpreter_invocation_counter_offset()), R3_counters); |
|
801 |
} |
|
802 |
// Check if we must create a method data obj. |
|
803 |
if (ProfileInterpreter && profile_method != NULL) { |
|
804 |
const Register profile_limit = Rscratch1; |
|
35085 | 805 |
__ lwz(profile_limit, in_bytes(MethodCounters::interpreter_profile_limit_offset()), R3_counters); |
23221 | 806 |
// Test to see if we should create a method data oop. |
807 |
__ cmpw(CCR0, Rsum_ivc_bec, profile_limit); |
|
808 |
__ blt(CCR0, *profile_method_continue); |
|
809 |
// If no method data exists, go to profile_method. |
|
810 |
__ test_method_data_pointer(*profile_method); |
|
811 |
} |
|
812 |
// Finally check for counter overflow. |
|
813 |
if (overflow) { |
|
814 |
const Register invocation_limit = Rscratch1; |
|
35085 | 815 |
__ lwz(invocation_limit, in_bytes(MethodCounters::interpreter_invocation_limit_offset()), R3_counters); |
23221 | 816 |
__ cmpw(CCR0, Rsum_ivc_bec, invocation_limit); |
817 |
__ bge(CCR0, *overflow); |
|
818 |
} |
|
819 |
||
820 |
__ bind(done); |
|
821 |
} |
|
822 |
} |
|
823 |
||
824 |
// Generate code to initiate compilation on invocation counter overflow. |
|
825 |
void TemplateInterpreterGenerator::generate_counter_overflow(Label& continue_entry) { |
|
826 |
// Generate code to initiate compilation on the counter overflow. |
|
827 |
||
828 |
// InterpreterRuntime::frequency_counter_overflow takes one arguments, |
|
829 |
// which indicates if the counter overflow occurs at a backwards branch (NULL bcp) |
|
830 |
// We pass zero in. |
|
831 |
// The call returns the address of the verified entry point for the method or NULL |
|
832 |
// if the compilation did not complete (either went background or bailed out). |
|
833 |
// |
|
834 |
// Unlike the C++ interpreter above: Check exceptions! |
|
835 |
// Assumption: Caller must set the flag "do_not_unlock_if_sychronized" if the monitor of a sync'ed |
|
836 |
// method has not yet been created. Thus, no unlocking of a non-existing monitor can occur. |
|
837 |
||
838 |
__ li(R4_ARG2, 0); |
|
839 |
__ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::frequency_counter_overflow), R4_ARG2, true); |
|
840 |
||
841 |
// Returns verified_entry_point or NULL. |
|
842 |
// We ignore it in any case. |
|
843 |
__ b(continue_entry); |
|
844 |
} |
|
845 |
||
39390
edf6a424a8b7
8159335: Fix problems with stack overflow handling.
goetz
parents:
38734
diff
changeset
|
846 |
// See if we've got enough room on the stack for locals plus overhead below |
edf6a424a8b7
8159335: Fix problems with stack overflow handling.
goetz
parents:
38734
diff
changeset
|
847 |
// JavaThread::stack_overflow_limit(). If not, throw a StackOverflowError |
edf6a424a8b7
8159335: Fix problems with stack overflow handling.
goetz
parents:
38734
diff
changeset
|
848 |
// without going through the signal handler, i.e., reserved and yellow zones |
edf6a424a8b7
8159335: Fix problems with stack overflow handling.
goetz
parents:
38734
diff
changeset
|
849 |
// will not be made usable. The shadow zone must suffice to handle the |
edf6a424a8b7
8159335: Fix problems with stack overflow handling.
goetz
parents:
38734
diff
changeset
|
850 |
// overflow. |
edf6a424a8b7
8159335: Fix problems with stack overflow handling.
goetz
parents:
38734
diff
changeset
|
851 |
// |
edf6a424a8b7
8159335: Fix problems with stack overflow handling.
goetz
parents:
38734
diff
changeset
|
852 |
// Kills Rmem_frame_size, Rscratch1. |
23221 | 853 |
void TemplateInterpreterGenerator::generate_stack_overflow_check(Register Rmem_frame_size, Register Rscratch1) { |
39390
edf6a424a8b7
8159335: Fix problems with stack overflow handling.
goetz
parents:
38734
diff
changeset
|
854 |
Label done; |
23221 | 855 |
assert_different_registers(Rmem_frame_size, Rscratch1); |
39390
edf6a424a8b7
8159335: Fix problems with stack overflow handling.
goetz
parents:
38734
diff
changeset
|
856 |
|
edf6a424a8b7
8159335: Fix problems with stack overflow handling.
goetz
parents:
38734
diff
changeset
|
857 |
BLOCK_COMMENT("stack_overflow_check_with_compare {"); |
edf6a424a8b7
8159335: Fix problems with stack overflow handling.
goetz
parents:
38734
diff
changeset
|
858 |
__ sub(Rmem_frame_size, R1_SP, Rmem_frame_size); |
edf6a424a8b7
8159335: Fix problems with stack overflow handling.
goetz
parents:
38734
diff
changeset
|
859 |
__ ld(Rscratch1, thread_(stack_overflow_limit)); |
edf6a424a8b7
8159335: Fix problems with stack overflow handling.
goetz
parents:
38734
diff
changeset
|
860 |
__ cmpld(CCR0/*is_stack_overflow*/, Rmem_frame_size, Rscratch1); |
edf6a424a8b7
8159335: Fix problems with stack overflow handling.
goetz
parents:
38734
diff
changeset
|
861 |
__ bgt(CCR0/*is_stack_overflow*/, done); |
edf6a424a8b7
8159335: Fix problems with stack overflow handling.
goetz
parents:
38734
diff
changeset
|
862 |
|
edf6a424a8b7
8159335: Fix problems with stack overflow handling.
goetz
parents:
38734
diff
changeset
|
863 |
// The stack overflows. Load target address of the runtime stub and call it. |
edf6a424a8b7
8159335: Fix problems with stack overflow handling.
goetz
parents:
38734
diff
changeset
|
864 |
assert(StubRoutines::throw_StackOverflowError_entry() != NULL, "generated in wrong order"); |
edf6a424a8b7
8159335: Fix problems with stack overflow handling.
goetz
parents:
38734
diff
changeset
|
865 |
__ load_const_optimized(Rscratch1, (StubRoutines::throw_StackOverflowError_entry()), R0); |
edf6a424a8b7
8159335: Fix problems with stack overflow handling.
goetz
parents:
38734
diff
changeset
|
866 |
__ mtctr(Rscratch1); |
edf6a424a8b7
8159335: Fix problems with stack overflow handling.
goetz
parents:
38734
diff
changeset
|
867 |
// Restore caller_sp. |
edf6a424a8b7
8159335: Fix problems with stack overflow handling.
goetz
parents:
38734
diff
changeset
|
868 |
#ifdef ASSERT |
edf6a424a8b7
8159335: Fix problems with stack overflow handling.
goetz
parents:
38734
diff
changeset
|
869 |
__ ld(Rscratch1, 0, R1_SP); |
edf6a424a8b7
8159335: Fix problems with stack overflow handling.
goetz
parents:
38734
diff
changeset
|
870 |
__ ld(R0, 0, R21_sender_SP); |
edf6a424a8b7
8159335: Fix problems with stack overflow handling.
goetz
parents:
38734
diff
changeset
|
871 |
__ cmpd(CCR0, R0, Rscratch1); |
edf6a424a8b7
8159335: Fix problems with stack overflow handling.
goetz
parents:
38734
diff
changeset
|
872 |
__ asm_assert_eq("backlink", 0x547); |
edf6a424a8b7
8159335: Fix problems with stack overflow handling.
goetz
parents:
38734
diff
changeset
|
873 |
#endif // ASSERT |
edf6a424a8b7
8159335: Fix problems with stack overflow handling.
goetz
parents:
38734
diff
changeset
|
874 |
__ mr(R1_SP, R21_sender_SP); |
edf6a424a8b7
8159335: Fix problems with stack overflow handling.
goetz
parents:
38734
diff
changeset
|
875 |
__ bctr(); |
edf6a424a8b7
8159335: Fix problems with stack overflow handling.
goetz
parents:
38734
diff
changeset
|
876 |
|
edf6a424a8b7
8159335: Fix problems with stack overflow handling.
goetz
parents:
38734
diff
changeset
|
877 |
__ align(32, 12); |
edf6a424a8b7
8159335: Fix problems with stack overflow handling.
goetz
parents:
38734
diff
changeset
|
878 |
__ bind(done); |
edf6a424a8b7
8159335: Fix problems with stack overflow handling.
goetz
parents:
38734
diff
changeset
|
879 |
BLOCK_COMMENT("} stack_overflow_check_with_compare"); |
23221 | 880 |
} |
881 |
||
882 |
// Lock the current method, interpreter register window must be set up! |
|
883 |
void TemplateInterpreterGenerator::lock_method(Register Rflags, Register Rscratch1, Register Rscratch2, bool flags_preloaded) { |
|
884 |
const Register Robj_to_lock = Rscratch2; |
|
885 |
||
886 |
{ |
|
887 |
if (!flags_preloaded) { |
|
888 |
__ lwz(Rflags, method_(access_flags)); |
|
889 |
} |
|
890 |
||
891 |
#ifdef ASSERT |
|
892 |
// Check if methods needs synchronization. |
|
893 |
{ |
|
894 |
Label Lok; |
|
895 |
__ testbitdi(CCR0, R0, Rflags, JVM_ACC_SYNCHRONIZED_BIT); |
|
896 |
__ btrue(CCR0,Lok); |
|
897 |
__ stop("method doesn't need synchronization"); |
|
898 |
__ bind(Lok); |
|
899 |
} |
|
900 |
#endif // ASSERT |
|
901 |
} |
|
902 |
||
903 |
// Get synchronization object to Rscratch2. |
|
904 |
{ |
|
905 |
Label Lstatic; |
|
906 |
Label Ldone; |
|
907 |
||
908 |
__ testbitdi(CCR0, R0, Rflags, JVM_ACC_STATIC_BIT); |
|
909 |
__ btrue(CCR0, Lstatic); |
|
910 |
||
911 |
// Non-static case: load receiver obj from stack and we're done. |
|
912 |
__ ld(Robj_to_lock, R18_locals); |
|
913 |
__ b(Ldone); |
|
914 |
||
915 |
__ bind(Lstatic); // Static case: Lock the java mirror |
|
42068
18c8a4d5998e
8168083: PPC64: Cleanup template interpreter after 8154580 and 8154867
mdoerr
parents:
41341
diff
changeset
|
916 |
// Load mirror from interpreter frame. |
18c8a4d5998e
8168083: PPC64: Cleanup template interpreter after 8154580 and 8154867
mdoerr
parents:
41341
diff
changeset
|
917 |
__ ld(Robj_to_lock, _abi(callers_sp), R1_SP); |
18c8a4d5998e
8168083: PPC64: Cleanup template interpreter after 8154580 and 8154867
mdoerr
parents:
41341
diff
changeset
|
918 |
__ ld(Robj_to_lock, _ijava_state_neg(mirror), Robj_to_lock); |
23221 | 919 |
|
920 |
__ bind(Ldone); |
|
921 |
__ verify_oop(Robj_to_lock); |
|
922 |
} |
|
923 |
||
924 |
// Got the oop to lock => execute! |
|
925 |
__ add_monitor_to_stack(true, Rscratch1, R0); |
|
926 |
||
927 |
__ std(Robj_to_lock, BasicObjectLock::obj_offset_in_bytes(), R26_monitor); |
|
928 |
__ lock_object(R26_monitor, Robj_to_lock); |
|
929 |
} |
|
930 |
||
931 |
// Generate a fixed interpreter frame for pure interpreter |
|
932 |
// and I2N native transition frames. |
|
933 |
// |
|
934 |
// Before (stack grows downwards): |
|
935 |
// |
|
936 |
// | ... | |
|
937 |
// |------------- | |
|
938 |
// | java arg0 | |
|
939 |
// | ... | |
|
940 |
// | java argn | |
|
941 |
// | | <- R15_esp |
|
942 |
// | | |
|
943 |
// |--------------| |
|
944 |
// | abi_112 | |
|
945 |
// | | <- R1_SP |
|
946 |
// |==============| |
|
947 |
// |
|
948 |
// |
|
949 |
// After: |
|
950 |
// |
|
951 |
// | ... | |
|
952 |
// | java arg0 |<- R18_locals |
|
953 |
// | ... | |
|
954 |
// | java argn | |
|
955 |
// |--------------| |
|
956 |
// | | |
|
957 |
// | java locals | |
|
958 |
// | | |
|
959 |
// |--------------| |
|
960 |
// | abi_48 | |
|
961 |
// |==============| |
|
962 |
// | | |
|
963 |
// | istate | |
|
964 |
// | | |
|
965 |
// |--------------| |
|
966 |
// | monitor |<- R26_monitor |
|
967 |
// |--------------| |
|
968 |
// | |<- R15_esp |
|
969 |
// | expression | |
|
970 |
// | stack | |
|
971 |
// | | |
|
972 |
// |--------------| |
|
973 |
// | | |
|
974 |
// | abi_112 |<- R1_SP |
|
975 |
// |==============| |
|
976 |
// |
|
977 |
// The top most frame needs an abi space of 112 bytes. This space is needed, |
|
978 |
// since we call to c. The c function may spill their arguments to the caller |
|
979 |
// frame. When we call to java, we don't need these spill slots. In order to save |
|
38734
69ced2325f58
8156922: [ppc] Implement template interpreter stack overflow checks as on x86/sparc.
goetz
parents:
38127
diff
changeset
|
980 |
// space on the stack, we resize the caller. However, java locals reside in |
23221 | 981 |
// the caller frame and the frame has to be increased. The frame_size for the |
982 |
// current frame was calculated based on max_stack as size for the expression |
|
983 |
// stack. At the call, just a part of the expression stack might be used. |
|
984 |
// We don't want to waste this space and cut the frame back accordingly. |
|
985 |
// The resulting amount for resizing is calculated as follows: |
|
986 |
// resize = (number_of_locals - number_of_arguments) * slot_size |
|
987 |
// + (R1_SP - R15_esp) + 48 |
|
988 |
// |
|
989 |
// The size for the callee frame is calculated: |
|
990 |
// framesize = 112 + max_stack + monitor + state_size |
|
991 |
// |
|
992 |
// maxstack: Max number of slots on the expression stack, loaded from the method. |
|
993 |
// monitor: We statically reserve room for one monitor object. |
|
994 |
// state_size: We save the current state of the interpreter to this area. |
|
995 |
// |
|
996 |
void TemplateInterpreterGenerator::generate_fixed_frame(bool native_call, Register Rsize_of_parameters, Register Rsize_of_locals) { |
|
997 |
Register parent_frame_resize = R6_ARG4, // Frame will grow by this number of bytes. |
|
998 |
top_frame_size = R7_ARG5, |
|
999 |
Rconst_method = R8_ARG6; |
|
1000 |
||
1001 |
assert_different_registers(Rsize_of_parameters, Rsize_of_locals, parent_frame_resize, top_frame_size); |
|
1002 |
||
1003 |
__ ld(Rconst_method, method_(const)); |
|
1004 |
__ lhz(Rsize_of_parameters /* number of params */, |
|
1005 |
in_bytes(ConstMethod::size_of_parameters_offset()), Rconst_method); |
|
1006 |
if (native_call) { |
|
1007 |
// If we're calling a native method, we reserve space for the worst-case signature |
|
1008 |
// handler varargs vector, which is max(Argument::n_register_parameters, parameter_count+2). |
|
1009 |
// We add two slots to the parameter_count, one for the jni |
|
1010 |
// environment and one for a possible native mirror. |
|
1011 |
Label skip_native_calculate_max_stack; |
|
1012 |
__ addi(top_frame_size, Rsize_of_parameters, 2); |
|
1013 |
__ cmpwi(CCR0, top_frame_size, Argument::n_register_parameters); |
|
1014 |
__ bge(CCR0, skip_native_calculate_max_stack); |
|
1015 |
__ li(top_frame_size, Argument::n_register_parameters); |
|
1016 |
__ bind(skip_native_calculate_max_stack); |
|
1017 |
__ sldi(Rsize_of_parameters, Rsize_of_parameters, Interpreter::logStackElementSize); |
|
1018 |
__ sldi(top_frame_size, top_frame_size, Interpreter::logStackElementSize); |
|
1019 |
__ sub(parent_frame_resize, R1_SP, R15_esp); // <0, off by Interpreter::stackElementSize! |
|
1020 |
assert(Rsize_of_locals == noreg, "Rsize_of_locals not initialized"); // Only relevant value is Rsize_of_parameters. |
|
1021 |
} else { |
|
1022 |
__ lhz(Rsize_of_locals /* number of params */, in_bytes(ConstMethod::size_of_locals_offset()), Rconst_method); |
|
1023 |
__ sldi(Rsize_of_parameters, Rsize_of_parameters, Interpreter::logStackElementSize); |
|
1024 |
__ sldi(Rsize_of_locals, Rsize_of_locals, Interpreter::logStackElementSize); |
|
1025 |
__ lhz(top_frame_size, in_bytes(ConstMethod::max_stack_offset()), Rconst_method); |
|
1026 |
__ sub(R11_scratch1, Rsize_of_locals, Rsize_of_parameters); // >=0 |
|
1027 |
__ sub(parent_frame_resize, R1_SP, R15_esp); // <0, off by Interpreter::stackElementSize! |
|
1028 |
__ sldi(top_frame_size, top_frame_size, Interpreter::logStackElementSize); |
|
1029 |
__ add(parent_frame_resize, parent_frame_resize, R11_scratch1); |
|
1030 |
} |
|
1031 |
||
1032 |
// Compute top frame size. |
|
1033 |
__ addi(top_frame_size, top_frame_size, frame::abi_reg_args_size + frame::ijava_state_size); |
|
1034 |
||
1035 |
// Cut back area between esp and max_stack. |
|
1036 |
__ addi(parent_frame_resize, parent_frame_resize, frame::abi_minframe_size - Interpreter::stackElementSize); |
|
1037 |
||
1038 |
__ round_to(top_frame_size, frame::alignment_in_bytes); |
|
1039 |
__ round_to(parent_frame_resize, frame::alignment_in_bytes); |
|
1040 |
// parent_frame_resize = (locals-parameters) - (ESP-SP-ABI48) Rounded to frame alignment size. |
|
1041 |
// Enlarge by locals-parameters (not in case of native_call), shrink by ESP-SP-ABI48. |
|
1042 |
||
38734
69ced2325f58
8156922: [ppc] Implement template interpreter stack overflow checks as on x86/sparc.
goetz
parents:
38127
diff
changeset
|
1043 |
if (!native_call) { |
39390
edf6a424a8b7
8159335: Fix problems with stack overflow handling.
goetz
parents:
38734
diff
changeset
|
1044 |
// Stack overflow check. |
edf6a424a8b7
8159335: Fix problems with stack overflow handling.
goetz
parents:
38734
diff
changeset
|
1045 |
// Native calls don't need the stack size check since they have no |
edf6a424a8b7
8159335: Fix problems with stack overflow handling.
goetz
parents:
38734
diff
changeset
|
1046 |
// expression stack and the arguments are already on the stack and |
edf6a424a8b7
8159335: Fix problems with stack overflow handling.
goetz
parents:
38734
diff
changeset
|
1047 |
// we only add a handful of words to the stack. |
23221 | 1048 |
__ add(R11_scratch1, parent_frame_resize, top_frame_size); |
1049 |
generate_stack_overflow_check(R11_scratch1, R12_scratch2); |
|
1050 |
} |
|
1051 |
||
1052 |
// Set up interpreter state registers. |
|
1053 |
||
1054 |
__ add(R18_locals, R15_esp, Rsize_of_parameters); |
|
1055 |
__ ld(R27_constPoolCache, in_bytes(ConstMethod::constants_offset()), Rconst_method); |
|
1056 |
__ ld(R27_constPoolCache, ConstantPool::cache_offset_in_bytes(), R27_constPoolCache); |
|
1057 |
||
1058 |
// Set method data pointer. |
|
1059 |
if (ProfileInterpreter) { |
|
1060 |
Label zero_continue; |
|
1061 |
__ ld(R28_mdx, method_(method_data)); |
|
1062 |
__ cmpdi(CCR0, R28_mdx, 0); |
|
1063 |
__ beq(CCR0, zero_continue); |
|
1064 |
__ addi(R28_mdx, R28_mdx, in_bytes(MethodData::data_offset())); |
|
1065 |
__ bind(zero_continue); |
|
1066 |
} |
|
1067 |
||
1068 |
if (native_call) { |
|
1069 |
__ li(R14_bcp, 0); // Must initialize. |
|
1070 |
} else { |
|
1071 |
__ add(R14_bcp, in_bytes(ConstMethod::codes_offset()), Rconst_method); |
|
1072 |
} |
|
1073 |
||
1074 |
// Resize parent frame. |
|
1075 |
__ mflr(R12_scratch2); |
|
1076 |
__ neg(parent_frame_resize, parent_frame_resize); |
|
1077 |
__ resize_frame(parent_frame_resize, R11_scratch1); |
|
1078 |
__ std(R12_scratch2, _abi(lr), R1_SP); |
|
1079 |
||
42068
18c8a4d5998e
8168083: PPC64: Cleanup template interpreter after 8154580 and 8154867
mdoerr
parents:
41341
diff
changeset
|
1080 |
// Get mirror and store it in the frame as GC root for this Method*. |
18c8a4d5998e
8168083: PPC64: Cleanup template interpreter after 8154580 and 8154867
mdoerr
parents:
41341
diff
changeset
|
1081 |
__ load_mirror_from_const_method(R12_scratch2, Rconst_method); |
18c8a4d5998e
8168083: PPC64: Cleanup template interpreter after 8154580 and 8154867
mdoerr
parents:
41341
diff
changeset
|
1082 |
|
23221 | 1083 |
__ addi(R26_monitor, R1_SP, - frame::ijava_state_size); |
1084 |
__ addi(R15_esp, R26_monitor, - Interpreter::stackElementSize); |
|
1085 |
||
1086 |
// Store values. |
|
1087 |
// R15_esp, R14_bcp, R26_monitor, R28_mdx are saved at java calls |
|
1088 |
// in InterpreterMacroAssembler::call_from_interpreter. |
|
1089 |
__ std(R19_method, _ijava_state_neg(method), R1_SP); |
|
38074
8475fdc6dcc3
8154580: Save mirror in interpreter frame to enable cleanups of CLDClosure
coleenp
parents:
37152
diff
changeset
|
1090 |
__ std(R12_scratch2, _ijava_state_neg(mirror), R1_SP); |
23221 | 1091 |
__ std(R21_sender_SP, _ijava_state_neg(sender_sp), R1_SP); |
1092 |
__ std(R27_constPoolCache, _ijava_state_neg(cpoolCache), R1_SP); |
|
1093 |
__ std(R18_locals, _ijava_state_neg(locals), R1_SP); |
|
1094 |
||
1095 |
// Note: esp, bcp, monitor, mdx live in registers. Hence, the correct version can only |
|
1096 |
// be found in the frame after save_interpreter_state is done. This is always true |
|
1097 |
// for non-top frames. But when a signal occurs, dumping the top frame can go wrong, |
|
1098 |
// because e.g. frame::interpreter_frame_bcp() will not access the correct value |
|
1099 |
// (Enhanced Stack Trace). |
|
1100 |
// The signal handler does not save the interpreter state into the frame. |
|
1101 |
__ li(R0, 0); |
|
1102 |
#ifdef ASSERT |
|
1103 |
// Fill remaining slots with constants. |
|
1104 |
__ load_const_optimized(R11_scratch1, 0x5afe); |
|
1105 |
__ load_const_optimized(R12_scratch2, 0xdead); |
|
1106 |
#endif |
|
1107 |
// We have to initialize some frame slots for native calls (accessed by GC). |
|
1108 |
if (native_call) { |
|
1109 |
__ std(R26_monitor, _ijava_state_neg(monitors), R1_SP); |
|
1110 |
__ std(R14_bcp, _ijava_state_neg(bcp), R1_SP); |
|
1111 |
if (ProfileInterpreter) { __ std(R28_mdx, _ijava_state_neg(mdx), R1_SP); } |
|
1112 |
} |
|
1113 |
#ifdef ASSERT |
|
1114 |
else { |
|
1115 |
__ std(R12_scratch2, _ijava_state_neg(monitors), R1_SP); |
|
1116 |
__ std(R12_scratch2, _ijava_state_neg(bcp), R1_SP); |
|
1117 |
__ std(R12_scratch2, _ijava_state_neg(mdx), R1_SP); |
|
1118 |
} |
|
1119 |
__ std(R11_scratch1, _ijava_state_neg(ijava_reserved), R1_SP); |
|
1120 |
__ std(R12_scratch2, _ijava_state_neg(esp), R1_SP); |
|
1121 |
__ std(R12_scratch2, _ijava_state_neg(lresult), R1_SP); |
|
1122 |
__ std(R12_scratch2, _ijava_state_neg(fresult), R1_SP); |
|
1123 |
#endif |
|
1124 |
__ subf(R12_scratch2, top_frame_size, R1_SP); |
|
1125 |
__ std(R0, _ijava_state_neg(oop_tmp), R1_SP); |
|
1126 |
__ std(R12_scratch2, _ijava_state_neg(top_frame_sp), R1_SP); |
|
1127 |
||
1128 |
// Push top frame. |
|
1129 |
__ push_frame(top_frame_size, R11_scratch1); |
|
1130 |
} |
|
1131 |
||
1132 |
// End of helpers |
|
1133 |
||
1134 |
address TemplateInterpreterGenerator::generate_math_entry(AbstractInterpreter::MethodKind kind) { |
|
42884
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1135 |
|
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1136 |
// Decide what to do: Use same platform specific instructions and runtime calls as compilers. |
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1137 |
bool use_instruction = false; |
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1138 |
address runtime_entry = NULL; |
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1139 |
int num_args = 1; |
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1140 |
bool double_precision = true; |
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1141 |
|
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1142 |
// PPC64 specific: |
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1143 |
switch (kind) { |
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1144 |
case Interpreter::java_lang_math_sqrt: use_instruction = VM_Version::has_fsqrt(); break; |
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1145 |
case Interpreter::java_lang_math_abs: use_instruction = true; break; |
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1146 |
case Interpreter::java_lang_math_fmaF: |
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1147 |
case Interpreter::java_lang_math_fmaD: use_instruction = UseFMA; break; |
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1148 |
default: break; // Fall back to runtime call. |
23221 | 1149 |
} |
1150 |
||
42884
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1151 |
switch (kind) { |
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1152 |
case Interpreter::java_lang_math_sin : runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dsin); break; |
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1153 |
case Interpreter::java_lang_math_cos : runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dcos); break; |
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1154 |
case Interpreter::java_lang_math_tan : runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dtan); break; |
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1155 |
case Interpreter::java_lang_math_abs : /* run interpreted */ break; |
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1156 |
case Interpreter::java_lang_math_sqrt : runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dsqrt); break; |
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1157 |
case Interpreter::java_lang_math_log : runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dlog); break; |
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1158 |
case Interpreter::java_lang_math_log10: runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dlog10); break; |
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1159 |
case Interpreter::java_lang_math_pow : runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dpow); num_args = 2; break; |
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1160 |
case Interpreter::java_lang_math_exp : runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dexp); break; |
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1161 |
case Interpreter::java_lang_math_fmaF : /* run interpreted */ num_args = 3; double_precision = false; break; |
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1162 |
case Interpreter::java_lang_math_fmaD : /* run interpreted */ num_args = 3; break; |
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1163 |
default: ShouldNotReachHere(); |
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1164 |
} |
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1165 |
|
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1166 |
// Use normal entry if neither instruction nor runtime call is used. |
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1167 |
if (!use_instruction && runtime_entry == NULL) return NULL; |
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1168 |
|
23221 | 1169 |
address entry = __ pc(); |
1170 |
||
42884
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1171 |
// Load arguments |
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1172 |
assert(num_args <= 13, "passed in registers"); |
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1173 |
if (double_precision) { |
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1174 |
int offset = (2 * num_args - 1) * Interpreter::stackElementSize; |
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1175 |
for (int i = 0; i < num_args; ++i) { |
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1176 |
__ lfd(as_FloatRegister(F1_ARG1->encoding() + i), offset, R15_esp); |
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1177 |
offset -= 2 * Interpreter::stackElementSize; |
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1178 |
} |
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1179 |
} else { |
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1180 |
int offset = num_args * Interpreter::stackElementSize; |
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1181 |
for (int i = 0; i < num_args; ++i) { |
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1182 |
__ lfs(as_FloatRegister(F1_ARG1->encoding() + i), offset, R15_esp); |
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1183 |
offset -= Interpreter::stackElementSize; |
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1184 |
} |
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1185 |
} |
23221 | 1186 |
|
1187 |
// Pop c2i arguments (if any) off when we return. |
|
1188 |
#ifdef ASSERT |
|
1189 |
__ ld(R9_ARG7, 0, R1_SP); |
|
1190 |
__ ld(R10_ARG8, 0, R21_sender_SP); |
|
1191 |
__ cmpd(CCR0, R9_ARG7, R10_ARG8); |
|
1192 |
__ asm_assert_eq("backlink", 0x545); |
|
1193 |
#endif // ASSERT |
|
1194 |
__ mr(R1_SP, R21_sender_SP); // Cut the stack back to where the caller started. |
|
1195 |
||
42884
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1196 |
if (use_instruction) { |
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1197 |
switch (kind) { |
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1198 |
case Interpreter::java_lang_math_sqrt: __ fsqrt(F1_RET, F1); break; |
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1199 |
case Interpreter::java_lang_math_abs: __ fabs(F1_RET, F1); break; |
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1200 |
case Interpreter::java_lang_math_fmaF: __ fmadds(F1_RET, F1, F2, F3); break; |
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1201 |
case Interpreter::java_lang_math_fmaD: __ fmadd(F1_RET, F1, F2, F3); break; |
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1202 |
default: ShouldNotReachHere(); |
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1203 |
} |
23221 | 1204 |
} else { |
42884
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1205 |
// Comment: Can use tail call if the unextended frame is always C ABI compliant: |
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1206 |
//__ load_const_optimized(R12_scratch2, runtime_entry, R0); |
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1207 |
//__ call_c_and_return_to_caller(R12_scratch2); |
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1208 |
|
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1209 |
// Push a new C frame and save LR. |
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1210 |
__ save_LR_CR(R0); |
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1211 |
__ push_frame_reg_args(0, R11_scratch1); |
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1212 |
|
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1213 |
__ call_VM_leaf(runtime_entry); |
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1214 |
|
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1215 |
// Pop the C frame and restore LR. |
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1216 |
__ pop_frame(); |
05815125c157
8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents:
42068
diff
changeset
|
1217 |
__ restore_LR_CR(R0); |
23221 | 1218 |
} |
1219 |
||
1220 |
__ blr(); |
|
1221 |
||
1222 |
__ flush(); |
|
1223 |
||
1224 |
return entry; |
|
1225 |
} |
|
1226 |
||
38734
69ced2325f58
8156922: [ppc] Implement template interpreter stack overflow checks as on x86/sparc.
goetz
parents:
38127
diff
changeset
|
1227 |
void TemplateInterpreterGenerator::bang_stack_shadow_pages(bool native_call) { |
69ced2325f58
8156922: [ppc] Implement template interpreter stack overflow checks as on x86/sparc.
goetz
parents:
38127
diff
changeset
|
1228 |
// Quick & dirty stack overflow checking: bang the stack & handle trap. |
69ced2325f58
8156922: [ppc] Implement template interpreter stack overflow checks as on x86/sparc.
goetz
parents:
38127
diff
changeset
|
1229 |
// Note that we do the banging after the frame is setup, since the exception |
69ced2325f58
8156922: [ppc] Implement template interpreter stack overflow checks as on x86/sparc.
goetz
parents:
38127
diff
changeset
|
1230 |
// handling code expects to find a valid interpreter frame on the stack. |
69ced2325f58
8156922: [ppc] Implement template interpreter stack overflow checks as on x86/sparc.
goetz
parents:
38127
diff
changeset
|
1231 |
// Doing the banging earlier fails if the caller frame is not an interpreter |
69ced2325f58
8156922: [ppc] Implement template interpreter stack overflow checks as on x86/sparc.
goetz
parents:
38127
diff
changeset
|
1232 |
// frame. |
69ced2325f58
8156922: [ppc] Implement template interpreter stack overflow checks as on x86/sparc.
goetz
parents:
38127
diff
changeset
|
1233 |
// (Also, the exception throwing code expects to unlock any synchronized |
69ced2325f58
8156922: [ppc] Implement template interpreter stack overflow checks as on x86/sparc.
goetz
parents:
38127
diff
changeset
|
1234 |
// method receiever, so do the banging after locking the receiver.) |
69ced2325f58
8156922: [ppc] Implement template interpreter stack overflow checks as on x86/sparc.
goetz
parents:
38127
diff
changeset
|
1235 |
|
69ced2325f58
8156922: [ppc] Implement template interpreter stack overflow checks as on x86/sparc.
goetz
parents:
38127
diff
changeset
|
1236 |
// Bang each page in the shadow zone. We can't assume it's been done for |
69ced2325f58
8156922: [ppc] Implement template interpreter stack overflow checks as on x86/sparc.
goetz
parents:
38127
diff
changeset
|
1237 |
// an interpreter frame with greater than a page of locals, so each page |
69ced2325f58
8156922: [ppc] Implement template interpreter stack overflow checks as on x86/sparc.
goetz
parents:
38127
diff
changeset
|
1238 |
// needs to be checked. Only true for non-native. |
69ced2325f58
8156922: [ppc] Implement template interpreter stack overflow checks as on x86/sparc.
goetz
parents:
38127
diff
changeset
|
1239 |
if (UseStackBanging) { |
69ced2325f58
8156922: [ppc] Implement template interpreter stack overflow checks as on x86/sparc.
goetz
parents:
38127
diff
changeset
|
1240 |
const int page_size = os::vm_page_size(); |
69ced2325f58
8156922: [ppc] Implement template interpreter stack overflow checks as on x86/sparc.
goetz
parents:
38127
diff
changeset
|
1241 |
const int n_shadow_pages = ((int)JavaThread::stack_shadow_zone_size()) / page_size; |
69ced2325f58
8156922: [ppc] Implement template interpreter stack overflow checks as on x86/sparc.
goetz
parents:
38127
diff
changeset
|
1242 |
const int start_page = native_call ? n_shadow_pages : 1; |
69ced2325f58
8156922: [ppc] Implement template interpreter stack overflow checks as on x86/sparc.
goetz
parents:
38127
diff
changeset
|
1243 |
BLOCK_COMMENT("bang_stack_shadow_pages:"); |
69ced2325f58
8156922: [ppc] Implement template interpreter stack overflow checks as on x86/sparc.
goetz
parents:
38127
diff
changeset
|
1244 |
for (int pages = start_page; pages <= n_shadow_pages; pages++) { |
69ced2325f58
8156922: [ppc] Implement template interpreter stack overflow checks as on x86/sparc.
goetz
parents:
38127
diff
changeset
|
1245 |
__ bang_stack_with_offset(pages*page_size); |
69ced2325f58
8156922: [ppc] Implement template interpreter stack overflow checks as on x86/sparc.
goetz
parents:
38127
diff
changeset
|
1246 |
} |
69ced2325f58
8156922: [ppc] Implement template interpreter stack overflow checks as on x86/sparc.
goetz
parents:
38127
diff
changeset
|
1247 |
} |
69ced2325f58
8156922: [ppc] Implement template interpreter stack overflow checks as on x86/sparc.
goetz
parents:
38127
diff
changeset
|
1248 |
} |
69ced2325f58
8156922: [ppc] Implement template interpreter stack overflow checks as on x86/sparc.
goetz
parents:
38127
diff
changeset
|
1249 |
|
23221 | 1250 |
// Interpreter stub for calling a native method. (asm interpreter) |
1251 |
// This sets up a somewhat different looking stack for calling the |
|
1252 |
// native method than the typical interpreter frame setup. |
|
1253 |
// |
|
1254 |
// On entry: |
|
1255 |
// R19_method - method |
|
1256 |
// R16_thread - JavaThread* |
|
1257 |
// R15_esp - intptr_t* sender tos |
|
1258 |
// |
|
1259 |
// abstract stack (grows up) |
|
1260 |
// [ IJava (caller of JNI callee) ] <-- ASP |
|
1261 |
// ... |
|
1262 |
address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) { |
|
1263 |
||
1264 |
address entry = __ pc(); |
|
1265 |
||
31790 | 1266 |
const bool inc_counter = UseCompiler || CountCompiledCalls || LogTouchedMethods; |
23221 | 1267 |
|
1268 |
// ----------------------------------------------------------------------------- |
|
1269 |
// Allocate a new frame that represents the native callee (i2n frame). |
|
1270 |
// This is not a full-blown interpreter frame, but in particular, the |
|
1271 |
// following registers are valid after this: |
|
1272 |
// - R19_method |
|
38734
69ced2325f58
8156922: [ppc] Implement template interpreter stack overflow checks as on x86/sparc.
goetz
parents:
38127
diff
changeset
|
1273 |
// - R18_local (points to start of arguments to native function) |
23221 | 1274 |
// |
1275 |
// abstract stack (grows up) |
|
1276 |
// [ IJava (caller of JNI callee) ] <-- ASP |
|
1277 |
// ... |
|
1278 |
||
1279 |
const Register signature_handler_fd = R11_scratch1; |
|
1280 |
const Register pending_exception = R0; |
|
1281 |
const Register result_handler_addr = R31; |
|
1282 |
const Register native_method_fd = R11_scratch1; |
|
1283 |
const Register access_flags = R22_tmp2; |
|
1284 |
const Register active_handles = R11_scratch1; // R26_monitor saved to state. |
|
1285 |
const Register sync_state = R12_scratch2; |
|
1286 |
const Register sync_state_addr = sync_state; // Address is dead after use. |
|
1287 |
const Register suspend_flags = R11_scratch1; |
|
1288 |
||
1289 |
//============================================================================= |
|
1290 |
// Allocate new frame and initialize interpreter state. |
|
1291 |
||
1292 |
Label exception_return; |
|
1293 |
Label exception_return_sync_check; |
|
1294 |
Label stack_overflow_return; |
|
1295 |
||
1296 |
// Generate new interpreter state and jump to stack_overflow_return in case of |
|
1297 |
// a stack overflow. |
|
1298 |
//generate_compute_interpreter_state(stack_overflow_return); |
|
1299 |
||
1300 |
Register size_of_parameters = R22_tmp2; |
|
1301 |
||
1302 |
generate_fixed_frame(true, size_of_parameters, noreg /* unused */); |
|
1303 |
||
1304 |
//============================================================================= |
|
1305 |
// Increment invocation counter. On overflow, entry to JNI method |
|
1306 |
// will be compiled. |
|
1307 |
Label invocation_counter_overflow, continue_after_compile; |
|
1308 |
if (inc_counter) { |
|
1309 |
if (synchronized) { |
|
1310 |
// Since at this point in the method invocation the exception handler |
|
1311 |
// would try to exit the monitor of synchronized methods which hasn't |
|
1312 |
// been entered yet, we set the thread local variable |
|
1313 |
// _do_not_unlock_if_synchronized to true. If any exception was thrown by |
|
1314 |
// runtime, exception handling i.e. unlock_if_synchronized_method will |
|
1315 |
// check this thread local flag. |
|
1316 |
// This flag has two effects, one is to force an unwind in the topmost |
|
1317 |
// interpreter frame and not perform an unlock while doing so. |
|
1318 |
__ li(R0, 1); |
|
1319 |
__ stb(R0, in_bytes(JavaThread::do_not_unlock_if_synchronized_offset()), R16_thread); |
|
1320 |
} |
|
1321 |
generate_counter_incr(&invocation_counter_overflow, NULL, NULL); |
|
1322 |
||
31861 | 1323 |
BIND(continue_after_compile); |
38734
69ced2325f58
8156922: [ppc] Implement template interpreter stack overflow checks as on x86/sparc.
goetz
parents:
38127
diff
changeset
|
1324 |
} |
69ced2325f58
8156922: [ppc] Implement template interpreter stack overflow checks as on x86/sparc.
goetz
parents:
38127
diff
changeset
|
1325 |
|
69ced2325f58
8156922: [ppc] Implement template interpreter stack overflow checks as on x86/sparc.
goetz
parents:
38127
diff
changeset
|
1326 |
bang_stack_shadow_pages(true); |
69ced2325f58
8156922: [ppc] Implement template interpreter stack overflow checks as on x86/sparc.
goetz
parents:
38127
diff
changeset
|
1327 |
|
69ced2325f58
8156922: [ppc] Implement template interpreter stack overflow checks as on x86/sparc.
goetz
parents:
38127
diff
changeset
|
1328 |
if (inc_counter) { |
23221 | 1329 |
// Reset the _do_not_unlock_if_synchronized flag. |
1330 |
if (synchronized) { |
|
1331 |
__ li(R0, 0); |
|
1332 |
__ stb(R0, in_bytes(JavaThread::do_not_unlock_if_synchronized_offset()), R16_thread); |
|
1333 |
} |
|
1334 |
} |
|
1335 |
||
1336 |
// access_flags = method->access_flags(); |
|
1337 |
// Load access flags. |
|
1338 |
assert(access_flags->is_nonvolatile(), |
|
1339 |
"access_flags must be in a non-volatile register"); |
|
1340 |
// Type check. |
|
1341 |
assert(4 == sizeof(AccessFlags), "unexpected field size"); |
|
1342 |
__ lwz(access_flags, method_(access_flags)); |
|
1343 |
||
1344 |
// We don't want to reload R19_method and access_flags after calls |
|
1345 |
// to some helper functions. |
|
1346 |
assert(R19_method->is_nonvolatile(), |
|
1347 |
"R19_method must be a non-volatile register"); |
|
1348 |
||
1349 |
// Check for synchronized methods. Must happen AFTER invocation counter |
|
1350 |
// check, so method is not locked if counter overflows. |
|
1351 |
||
1352 |
if (synchronized) { |
|
1353 |
lock_method(access_flags, R11_scratch1, R12_scratch2, true); |
|
1354 |
||
1355 |
// Update monitor in state. |
|
1356 |
__ ld(R11_scratch1, 0, R1_SP); |
|
1357 |
__ std(R26_monitor, _ijava_state_neg(monitors), R11_scratch1); |
|
1358 |
} |
|
1359 |
||
1360 |
// jvmti/jvmpi support |
|
1361 |
__ notify_method_entry(); |
|
1362 |
||
1363 |
//============================================================================= |
|
1364 |
// Get and call the signature handler. |
|
1365 |
||
1366 |
__ ld(signature_handler_fd, method_(signature_handler)); |
|
1367 |
Label call_signature_handler; |
|
1368 |
||
1369 |
__ cmpdi(CCR0, signature_handler_fd, 0); |
|
1370 |
__ bne(CCR0, call_signature_handler); |
|
1371 |
||
1372 |
// Method has never been called. Either generate a specialized |
|
1373 |
// handler or point to the slow one. |
|
1374 |
// |
|
1375 |
// Pass parameter 'false' to avoid exception check in call_VM. |
|
1376 |
__ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::prepare_native_call), R19_method, false); |
|
1377 |
||
1378 |
// Check for an exception while looking up the target method. If we |
|
1379 |
// incurred one, bail. |
|
1380 |
__ ld(pending_exception, thread_(pending_exception)); |
|
1381 |
__ cmpdi(CCR0, pending_exception, 0); |
|
1382 |
__ bne(CCR0, exception_return_sync_check); // Has pending exception. |
|
1383 |
||
1384 |
// Reload signature handler, it may have been created/assigned in the meanwhile. |
|
1385 |
__ ld(signature_handler_fd, method_(signature_handler)); |
|
1386 |
__ twi_0(signature_handler_fd); // Order wrt. load of klass mirror and entry point (isync is below). |
|
1387 |
||
31861 | 1388 |
BIND(call_signature_handler); |
23221 | 1389 |
|
1390 |
// Before we call the signature handler we push a new frame to |
|
1391 |
// protect the interpreter frame volatile registers when we return |
|
1392 |
// from jni but before we can get back to Java. |
|
1393 |
||
1394 |
// First set the frame anchor while the SP/FP registers are |
|
1395 |
// convenient and the slow signature handler can use this same frame |
|
1396 |
// anchor. |
|
1397 |
||
1398 |
// We have a TOP_IJAVA_FRAME here, which belongs to us. |
|
1399 |
__ set_top_ijava_frame_at_SP_as_last_Java_frame(R1_SP, R12_scratch2/*tmp*/); |
|
1400 |
||
1401 |
// Now the interpreter frame (and its call chain) have been |
|
1402 |
// invalidated and flushed. We are now protected against eager |
|
1403 |
// being enabled in native code. Even if it goes eager the |
|
1404 |
// registers will be reloaded as clean and we will invalidate after |
|
1405 |
// the call so no spurious flush should be possible. |
|
1406 |
||
1407 |
// Call signature handler and pass locals address. |
|
1408 |
// |
|
1409 |
// Our signature handlers copy required arguments to the C stack |
|
1410 |
// (outgoing C args), R3_ARG1 to R10_ARG8, and FARG1 to FARG13. |
|
1411 |
__ mr(R3_ARG1, R18_locals); |
|
25916
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
25715
diff
changeset
|
1412 |
#if !defined(ABI_ELFv2) |
23221 | 1413 |
__ ld(signature_handler_fd, 0, signature_handler_fd); |
25916
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
25715
diff
changeset
|
1414 |
#endif |
23221 | 1415 |
|
1416 |
__ call_stub(signature_handler_fd); |
|
1417 |
||
1418 |
// Remove the register parameter varargs slots we allocated in |
|
1419 |
// compute_interpreter_state. SP+16 ends up pointing to the ABI |
|
1420 |
// outgoing argument area. |
|
1421 |
// |
|
1422 |
// Not needed on PPC64. |
|
1423 |
//__ add(SP, SP, Argument::n_register_parameters*BytesPerWord); |
|
1424 |
||
1425 |
assert(result_handler_addr->is_nonvolatile(), "result_handler_addr must be in a non-volatile register"); |
|
1426 |
// Save across call to native method. |
|
1427 |
__ mr(result_handler_addr, R3_RET); |
|
1428 |
||
1429 |
__ isync(); // Acquire signature handler before trying to fetch the native entry point and klass mirror. |
|
1430 |
||
1431 |
// Set up fixed parameters and call the native method. |
|
1432 |
// If the method is static, get mirror into R4_ARG2. |
|
1433 |
{ |
|
1434 |
Label method_is_not_static; |
|
1435 |
// Access_flags is non-volatile and still, no need to restore it. |
|
1436 |
||
1437 |
// Restore access flags. |
|
1438 |
__ testbitdi(CCR0, R0, access_flags, JVM_ACC_STATIC_BIT); |
|
1439 |
__ bfalse(CCR0, method_is_not_static); |
|
1440 |
||
42068
18c8a4d5998e
8168083: PPC64: Cleanup template interpreter after 8154580 and 8154867
mdoerr
parents:
41341
diff
changeset
|
1441 |
__ ld(R11_scratch1, _abi(callers_sp), R1_SP); |
18c8a4d5998e
8168083: PPC64: Cleanup template interpreter after 8154580 and 8154867
mdoerr
parents:
41341
diff
changeset
|
1442 |
// Load mirror from interpreter frame. |
18c8a4d5998e
8168083: PPC64: Cleanup template interpreter after 8154580 and 8154867
mdoerr
parents:
41341
diff
changeset
|
1443 |
__ ld(R12_scratch2, _ijava_state_neg(mirror), R11_scratch1); |
23221 | 1444 |
// R4_ARG2 = &state->_oop_temp; |
1445 |
__ addi(R4_ARG2, R11_scratch1, _ijava_state_neg(oop_tmp)); |
|
42068
18c8a4d5998e
8168083: PPC64: Cleanup template interpreter after 8154580 and 8154867
mdoerr
parents:
41341
diff
changeset
|
1446 |
__ std(R12_scratch2/*mirror*/, _ijava_state_neg(oop_tmp), R11_scratch1); |
31861 | 1447 |
BIND(method_is_not_static); |
23221 | 1448 |
} |
1449 |
||
1450 |
// At this point, arguments have been copied off the stack into |
|
1451 |
// their JNI positions. Oops are boxed in-place on the stack, with |
|
1452 |
// handles copied to arguments. The result handler address is in a |
|
1453 |
// register. |
|
1454 |
||
1455 |
// Pass JNIEnv address as first parameter. |
|
1456 |
__ addir(R3_ARG1, thread_(jni_environment)); |
|
1457 |
||
1458 |
// Load the native_method entry before we change the thread state. |
|
1459 |
__ ld(native_method_fd, method_(native_function)); |
|
1460 |
||
1461 |
//============================================================================= |
|
1462 |
// Transition from _thread_in_Java to _thread_in_native. As soon as |
|
1463 |
// we make this change the safepoint code needs to be certain that |
|
1464 |
// the last Java frame we established is good. The pc in that frame |
|
1465 |
// just needs to be near here not an actual return address. |
|
1466 |
||
1467 |
// We use release_store_fence to update values like the thread state, where |
|
1468 |
// we don't want the current thread to continue until all our prior memory |
|
1469 |
// accesses (including the new thread state) are visible to other threads. |
|
1470 |
__ li(R0, _thread_in_native); |
|
1471 |
__ release(); |
|
1472 |
||
1473 |
// TODO PPC port assert(4 == JavaThread::sz_thread_state(), "unexpected field size"); |
|
1474 |
__ stw(R0, thread_(thread_state)); |
|
1475 |
||
1476 |
if (UseMembar) { |
|
1477 |
__ fence(); |
|
1478 |
} |
|
1479 |
||
1480 |
//============================================================================= |
|
1481 |
// Call the native method. Argument registers must not have been |
|
1482 |
// overwritten since "__ call_stub(signature_handler);" (except for |
|
1483 |
// ARG1 and ARG2 for static methods). |
|
1484 |
__ call_c(native_method_fd); |
|
1485 |
||
1486 |
__ li(R0, 0); |
|
1487 |
__ ld(R11_scratch1, 0, R1_SP); |
|
1488 |
__ std(R3_RET, _ijava_state_neg(lresult), R11_scratch1); |
|
1489 |
__ stfd(F1_RET, _ijava_state_neg(fresult), R11_scratch1); |
|
1490 |
__ std(R0/*mirror*/, _ijava_state_neg(oop_tmp), R11_scratch1); // reset |
|
1491 |
||
1492 |
// Note: C++ interpreter needs the following here: |
|
1493 |
// The frame_manager_lr field, which we use for setting the last |
|
1494 |
// java frame, gets overwritten by the signature handler. Restore |
|
1495 |
// it now. |
|
1496 |
//__ get_PC_trash_LR(R11_scratch1); |
|
1497 |
//__ std(R11_scratch1, _top_ijava_frame_abi(frame_manager_lr), R1_SP); |
|
1498 |
||
1499 |
// Because of GC R19_method may no longer be valid. |
|
1500 |
||
1501 |
// Block, if necessary, before resuming in _thread_in_Java state. |
|
1502 |
// In order for GC to work, don't clear the last_Java_sp until after |
|
1503 |
// blocking. |
|
1504 |
||
1505 |
//============================================================================= |
|
1506 |
// Switch thread to "native transition" state before reading the |
|
1507 |
// synchronization state. This additional state is necessary |
|
1508 |
// because reading and testing the synchronization state is not |
|
1509 |
// atomic w.r.t. GC, as this scenario demonstrates: Java thread A, |
|
1510 |
// in _thread_in_native state, loads _not_synchronized and is |
|
1511 |
// preempted. VM thread changes sync state to synchronizing and |
|
1512 |
// suspends threads for GC. Thread A is resumed to finish this |
|
1513 |
// native method, but doesn't block here since it didn't see any |
|
1514 |
// synchronization in progress, and escapes. |
|
1515 |
||
1516 |
// We use release_store_fence to update values like the thread state, where |
|
1517 |
// we don't want the current thread to continue until all our prior memory |
|
1518 |
// accesses (including the new thread state) are visible to other threads. |
|
1519 |
__ li(R0/*thread_state*/, _thread_in_native_trans); |
|
1520 |
__ release(); |
|
1521 |
__ stw(R0/*thread_state*/, thread_(thread_state)); |
|
1522 |
if (UseMembar) { |
|
1523 |
__ fence(); |
|
1524 |
} |
|
1525 |
// Write serialization page so that the VM thread can do a pseudo remote |
|
1526 |
// membar. We use the current thread pointer to calculate a thread |
|
1527 |
// specific offset to write to within the page. This minimizes bus |
|
1528 |
// traffic due to cache line collision. |
|
1529 |
else { |
|
1530 |
__ serialize_memory(R16_thread, R11_scratch1, R12_scratch2); |
|
1531 |
} |
|
1532 |
||
1533 |
// Now before we return to java we must look for a current safepoint |
|
1534 |
// (a new safepoint can not start since we entered native_trans). |
|
1535 |
// We must check here because a current safepoint could be modifying |
|
1536 |
// the callers registers right this moment. |
|
1537 |
||
1538 |
// Acquire isn't strictly necessary here because of the fence, but |
|
1539 |
// sync_state is declared to be volatile, so we do it anyway |
|
1540 |
// (cmp-br-isync on one path, release (same as acquire on PPC64) on the other path). |
|
1541 |
int sync_state_offs = __ load_const_optimized(sync_state_addr, SafepointSynchronize::address_of_state(), /*temp*/R0, true); |
|
1542 |
||
1543 |
// TODO PPC port assert(4 == SafepointSynchronize::sz_state(), "unexpected field size"); |
|
1544 |
__ lwz(sync_state, sync_state_offs, sync_state_addr); |
|
1545 |
||
1546 |
// TODO PPC port assert(4 == Thread::sz_suspend_flags(), "unexpected field size"); |
|
1547 |
__ lwz(suspend_flags, thread_(suspend_flags)); |
|
1548 |
||
1549 |
Label sync_check_done; |
|
1550 |
Label do_safepoint; |
|
1551 |
// No synchronization in progress nor yet synchronized. |
|
1552 |
__ cmpwi(CCR0, sync_state, SafepointSynchronize::_not_synchronized); |
|
1553 |
// Not suspended. |
|
1554 |
__ cmpwi(CCR1, suspend_flags, 0); |
|
1555 |
||
1556 |
__ bne(CCR0, do_safepoint); |
|
1557 |
__ beq(CCR1, sync_check_done); |
|
1558 |
__ bind(do_safepoint); |
|
1559 |
__ isync(); |
|
1560 |
// Block. We do the call directly and leave the current |
|
1561 |
// last_Java_frame setup undisturbed. We must save any possible |
|
1562 |
// native result across the call. No oop is present. |
|
1563 |
||
1564 |
__ mr(R3_ARG1, R16_thread); |
|
25916
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
25715
diff
changeset
|
1565 |
#if defined(ABI_ELFv2) |
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
25715
diff
changeset
|
1566 |
__ call_c(CAST_FROM_FN_PTR(address, JavaThread::check_special_condition_for_native_trans), |
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
25715
diff
changeset
|
1567 |
relocInfo::none); |
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
25715
diff
changeset
|
1568 |
#else |
23221 | 1569 |
__ call_c(CAST_FROM_FN_PTR(FunctionDescriptor*, JavaThread::check_special_condition_for_native_trans), |
1570 |
relocInfo::none); |
|
25916
c5c22fab48fd
8050942: PPC64: implement template interpreter for ppc64le
kvn
parents:
25715
diff
changeset
|
1571 |
#endif |
23221 | 1572 |
|
1573 |
__ bind(sync_check_done); |
|
1574 |
||
1575 |
//============================================================================= |
|
1576 |
// <<<<<< Back in Interpreter Frame >>>>> |
|
1577 |
||
1578 |
// We are in thread_in_native_trans here and back in the normal |
|
1579 |
// interpreter frame. We don't have to do anything special about |
|
1580 |
// safepoints and we can switch to Java mode anytime we are ready. |
|
1581 |
||
1582 |
// Note: frame::interpreter_frame_result has a dependency on how the |
|
1583 |
// method result is saved across the call to post_method_exit. For |
|
1584 |
// native methods it assumes that the non-FPU/non-void result is |
|
1585 |
// saved in _native_lresult and a FPU result in _native_fresult. If |
|
1586 |
// this changes then the interpreter_frame_result implementation |
|
1587 |
// will need to be updated too. |
|
1588 |
||
1589 |
// On PPC64, we have stored the result directly after the native call. |
|
1590 |
||
1591 |
//============================================================================= |
|
1592 |
// Back in Java |
|
1593 |
||
1594 |
// We use release_store_fence to update values like the thread state, where |
|
1595 |
// we don't want the current thread to continue until all our prior memory |
|
1596 |
// accesses (including the new thread state) are visible to other threads. |
|
1597 |
__ li(R0/*thread_state*/, _thread_in_Java); |
|
1598 |
__ release(); |
|
1599 |
__ stw(R0/*thread_state*/, thread_(thread_state)); |
|
1600 |
if (UseMembar) { |
|
1601 |
__ fence(); |
|
1602 |
} |
|
1603 |
||
41341
9358c2e16446
8166777: [ppc] port "8164086: Checked JNI pending exception check should be cleared"
goetz
parents:
40071
diff
changeset
|
1604 |
if (CheckJNICalls) { |
9358c2e16446
8166777: [ppc] port "8164086: Checked JNI pending exception check should be cleared"
goetz
parents:
40071
diff
changeset
|
1605 |
// clear_pending_jni_exception_check |
9358c2e16446
8166777: [ppc] port "8164086: Checked JNI pending exception check should be cleared"
goetz
parents:
40071
diff
changeset
|
1606 |
__ load_const_optimized(R0, 0L); |
9358c2e16446
8166777: [ppc] port "8164086: Checked JNI pending exception check should be cleared"
goetz
parents:
40071
diff
changeset
|
1607 |
__ st_ptr(R0, JavaThread::pending_jni_exception_check_fn_offset(), R16_thread); |
9358c2e16446
8166777: [ppc] port "8164086: Checked JNI pending exception check should be cleared"
goetz
parents:
40071
diff
changeset
|
1608 |
} |
9358c2e16446
8166777: [ppc] port "8164086: Checked JNI pending exception check should be cleared"
goetz
parents:
40071
diff
changeset
|
1609 |
|
23221 | 1610 |
__ reset_last_Java_frame(); |
1611 |
||
1612 |
// Jvmdi/jvmpi support. Whether we've got an exception pending or |
|
1613 |
// not, and whether unlocking throws an exception or not, we notify |
|
1614 |
// on native method exit. If we do have an exception, we'll end up |
|
1615 |
// in the caller's context to handle it, so if we don't do the |
|
1616 |
// notify here, we'll drop it on the floor. |
|
1617 |
__ notify_method_exit(true/*native method*/, |
|
1618 |
ilgl /*illegal state (not used for native methods)*/, |
|
1619 |
InterpreterMacroAssembler::NotifyJVMTI, |
|
1620 |
false /*check_exceptions*/); |
|
1621 |
||
1622 |
//============================================================================= |
|
1623 |
// Handle exceptions |
|
1624 |
||
1625 |
if (synchronized) { |
|
1626 |
// Don't check for exceptions since we're still in the i2n frame. Do that |
|
1627 |
// manually afterwards. |
|
40071
53e12df44b7b
8160245: C1: Clean up platform #defines in c1_LIR.hpp.
goetz
parents:
39390
diff
changeset
|
1628 |
__ unlock_object(R26_monitor, false); // Can also unlock methods. |
23221 | 1629 |
} |
1630 |
||
1631 |
// Reset active handles after returning from native. |
|
1632 |
// thread->active_handles()->clear(); |
|
1633 |
__ ld(active_handles, thread_(active_handles)); |
|
1634 |
// TODO PPC port assert(4 == JNIHandleBlock::top_size_in_bytes(), "unexpected field size"); |
|
1635 |
__ li(R0, 0); |
|
1636 |
__ stw(R0, JNIHandleBlock::top_offset_in_bytes(), active_handles); |
|
1637 |
||
1638 |
Label exception_return_sync_check_already_unlocked; |
|
1639 |
__ ld(R0/*pending_exception*/, thread_(pending_exception)); |
|
1640 |
__ cmpdi(CCR0, R0/*pending_exception*/, 0); |
|
1641 |
__ bne(CCR0, exception_return_sync_check_already_unlocked); |
|
1642 |
||
1643 |
//----------------------------------------------------------------------------- |
|
1644 |
// No exception pending. |
|
1645 |
||
1646 |
// Move native method result back into proper registers and return. |
|
1647 |
// Invoke result handler (may unbox/promote). |
|
1648 |
__ ld(R11_scratch1, 0, R1_SP); |
|
1649 |
__ ld(R3_RET, _ijava_state_neg(lresult), R11_scratch1); |
|
1650 |
__ lfd(F1_RET, _ijava_state_neg(fresult), R11_scratch1); |
|
1651 |
__ call_stub(result_handler_addr); |
|
1652 |
||
1653 |
__ merge_frames(/*top_frame_sp*/ R21_sender_SP, /*return_pc*/ R0, R11_scratch1, R12_scratch2); |
|
1654 |
||
1655 |
// Must use the return pc which was loaded from the caller's frame |
|
1656 |
// as the VM uses return-pc-patching for deoptimization. |
|
1657 |
__ mtlr(R0); |
|
1658 |
__ blr(); |
|
1659 |
||
1660 |
//----------------------------------------------------------------------------- |
|
1661 |
// An exception is pending. We call into the runtime only if the |
|
1662 |
// caller was not interpreted. If it was interpreted the |
|
1663 |
// interpreter will do the correct thing. If it isn't interpreted |
|
1664 |
// (call stub/compiled code) we will change our return and continue. |
|
1665 |
||
31861 | 1666 |
BIND(exception_return_sync_check); |
23221 | 1667 |
|
1668 |
if (synchronized) { |
|
1669 |
// Don't check for exceptions since we're still in the i2n frame. Do that |
|
1670 |
// manually afterwards. |
|
40071
53e12df44b7b
8160245: C1: Clean up platform #defines in c1_LIR.hpp.
goetz
parents:
39390
diff
changeset
|
1671 |
__ unlock_object(R26_monitor, false); // Can also unlock methods. |
23221 | 1672 |
} |
31861 | 1673 |
BIND(exception_return_sync_check_already_unlocked); |
23221 | 1674 |
|
1675 |
const Register return_pc = R31; |
|
1676 |
||
1677 |
__ ld(return_pc, 0, R1_SP); |
|
1678 |
__ ld(return_pc, _abi(lr), return_pc); |
|
1679 |
||
1680 |
// Get the address of the exception handler. |
|
1681 |
__ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::exception_handler_for_return_address), |
|
1682 |
R16_thread, |
|
1683 |
return_pc /* return pc */); |
|
1684 |
__ merge_frames(/*top_frame_sp*/ R21_sender_SP, noreg, R11_scratch1, R12_scratch2); |
|
1685 |
||
1686 |
// Load the PC of the the exception handler into LR. |
|
1687 |
__ mtlr(R3_RET); |
|
1688 |
||
1689 |
// Load exception into R3_ARG1 and clear pending exception in thread. |
|
1690 |
__ ld(R3_ARG1/*exception*/, thread_(pending_exception)); |
|
1691 |
__ li(R4_ARG2, 0); |
|
1692 |
__ std(R4_ARG2, thread_(pending_exception)); |
|
1693 |
||
1694 |
// Load the original return pc into R4_ARG2. |
|
1695 |
__ mr(R4_ARG2/*issuing_pc*/, return_pc); |
|
1696 |
||
1697 |
// Return to exception handler. |
|
1698 |
__ blr(); |
|
1699 |
||
1700 |
//============================================================================= |
|
1701 |
// Counter overflow. |
|
1702 |
||
1703 |
if (inc_counter) { |
|
1704 |
// Handle invocation counter overflow. |
|
1705 |
__ bind(invocation_counter_overflow); |
|
1706 |
||
1707 |
generate_counter_overflow(continue_after_compile); |
|
1708 |
} |
|
1709 |
||
1710 |
return entry; |
|
1711 |
} |
|
1712 |
||
1713 |
// Generic interpreted method entry to (asm) interpreter. |
|
1714 |
// |
|
1715 |
address TemplateInterpreterGenerator::generate_normal_entry(bool synchronized) { |
|
31790 | 1716 |
bool inc_counter = UseCompiler || CountCompiledCalls || LogTouchedMethods; |
23221 | 1717 |
address entry = __ pc(); |
1718 |
// Generate the code to allocate the interpreter stack frame. |
|
1719 |
Register Rsize_of_parameters = R4_ARG2, // Written by generate_fixed_frame. |
|
1720 |
Rsize_of_locals = R5_ARG3; // Written by generate_fixed_frame. |
|
1721 |
||
38734
69ced2325f58
8156922: [ppc] Implement template interpreter stack overflow checks as on x86/sparc.
goetz
parents:
38127
diff
changeset
|
1722 |
// Does also a stack check to assure this frame fits on the stack. |
23221 | 1723 |
generate_fixed_frame(false, Rsize_of_parameters, Rsize_of_locals); |
1724 |
||
1725 |
// -------------------------------------------------------------------------- |
|
1726 |
// Zero out non-parameter locals. |
|
1727 |
// Note: *Always* zero out non-parameter locals as Sparc does. It's not |
|
1728 |
// worth to ask the flag, just do it. |
|
1729 |
Register Rslot_addr = R6_ARG4, |
|
1730 |
Rnum = R7_ARG5; |
|
1731 |
Label Lno_locals, Lzero_loop; |
|
1732 |
||
1733 |
// Set up the zeroing loop. |
|
1734 |
__ subf(Rnum, Rsize_of_parameters, Rsize_of_locals); |
|
1735 |
__ subf(Rslot_addr, Rsize_of_parameters, R18_locals); |
|
1736 |
__ srdi_(Rnum, Rnum, Interpreter::logStackElementSize); |
|
1737 |
__ beq(CCR0, Lno_locals); |
|
1738 |
__ li(R0, 0); |
|
1739 |
__ mtctr(Rnum); |
|
1740 |
||
1741 |
// The zero locals loop. |
|
1742 |
__ bind(Lzero_loop); |
|
1743 |
__ std(R0, 0, Rslot_addr); |
|
1744 |
__ addi(Rslot_addr, Rslot_addr, -Interpreter::stackElementSize); |
|
1745 |
__ bdnz(Lzero_loop); |
|
1746 |
||
1747 |
__ bind(Lno_locals); |
|
1748 |
||
1749 |
// -------------------------------------------------------------------------- |
|
1750 |
// Counter increment and overflow check. |
|
1751 |
Label invocation_counter_overflow, |
|
1752 |
profile_method, |
|
1753 |
profile_method_continue; |
|
1754 |
if (inc_counter || ProfileInterpreter) { |
|
1755 |
||
1756 |
Register Rdo_not_unlock_if_synchronized_addr = R11_scratch1; |
|
1757 |
if (synchronized) { |
|
1758 |
// Since at this point in the method invocation the exception handler |
|
1759 |
// would try to exit the monitor of synchronized methods which hasn't |
|
1760 |
// been entered yet, we set the thread local variable |
|
1761 |
// _do_not_unlock_if_synchronized to true. If any exception was thrown by |
|
1762 |
// runtime, exception handling i.e. unlock_if_synchronized_method will |
|
1763 |
// check this thread local flag. |
|
1764 |
// This flag has two effects, one is to force an unwind in the topmost |
|
1765 |
// interpreter frame and not perform an unlock while doing so. |
|
1766 |
__ li(R0, 1); |
|
1767 |
__ stb(R0, in_bytes(JavaThread::do_not_unlock_if_synchronized_offset()), R16_thread); |
|
1768 |
} |
|
28187
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
25950
diff
changeset
|
1769 |
|
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
25950
diff
changeset
|
1770 |
// Argument and return type profiling. |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
25950
diff
changeset
|
1771 |
__ profile_parameters_type(R3_ARG1, R4_ARG2, R5_ARG3, R6_ARG4); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
25950
diff
changeset
|
1772 |
|
23221 | 1773 |
// Increment invocation counter and check for overflow. |
1774 |
if (inc_counter) { |
|
1775 |
generate_counter_incr(&invocation_counter_overflow, &profile_method, &profile_method_continue); |
|
1776 |
} |
|
1777 |
||
1778 |
__ bind(profile_method_continue); |
|
38734
69ced2325f58
8156922: [ppc] Implement template interpreter stack overflow checks as on x86/sparc.
goetz
parents:
38127
diff
changeset
|
1779 |
} |
23221 | 1780 |
|
38734
69ced2325f58
8156922: [ppc] Implement template interpreter stack overflow checks as on x86/sparc.
goetz
parents:
38127
diff
changeset
|
1781 |
bang_stack_shadow_pages(false); |
69ced2325f58
8156922: [ppc] Implement template interpreter stack overflow checks as on x86/sparc.
goetz
parents:
38127
diff
changeset
|
1782 |
|
69ced2325f58
8156922: [ppc] Implement template interpreter stack overflow checks as on x86/sparc.
goetz
parents:
38127
diff
changeset
|
1783 |
if (inc_counter || ProfileInterpreter) { |
23221 | 1784 |
// Reset the _do_not_unlock_if_synchronized flag. |
1785 |
if (synchronized) { |
|
1786 |
__ li(R0, 0); |
|
1787 |
__ stb(R0, in_bytes(JavaThread::do_not_unlock_if_synchronized_offset()), R16_thread); |
|
1788 |
} |
|
1789 |
} |
|
1790 |
||
1791 |
// -------------------------------------------------------------------------- |
|
1792 |
// Locking of synchronized methods. Must happen AFTER invocation_counter |
|
1793 |
// check and stack overflow check, so method is not locked if overflows. |
|
1794 |
if (synchronized) { |
|
1795 |
lock_method(R3_ARG1, R4_ARG2, R5_ARG3); |
|
1796 |
} |
|
1797 |
#ifdef ASSERT |
|
1798 |
else { |
|
1799 |
Label Lok; |
|
1800 |
__ lwz(R0, in_bytes(Method::access_flags_offset()), R19_method); |
|
1801 |
__ andi_(R0, R0, JVM_ACC_SYNCHRONIZED); |
|
1802 |
__ asm_assert_eq("method needs synchronization", 0x8521); |
|
1803 |
__ bind(Lok); |
|
1804 |
} |
|
1805 |
#endif // ASSERT |
|
1806 |
||
1807 |
__ verify_thread(); |
|
1808 |
||
1809 |
// -------------------------------------------------------------------------- |
|
1810 |
// JVMTI support |
|
1811 |
__ notify_method_entry(); |
|
1812 |
||
1813 |
// -------------------------------------------------------------------------- |
|
1814 |
// Start executing instructions. |
|
1815 |
__ dispatch_next(vtos); |
|
1816 |
||
1817 |
// -------------------------------------------------------------------------- |
|
1818 |
// Out of line counter overflow and MDO creation code. |
|
1819 |
if (ProfileInterpreter) { |
|
1820 |
// We have decided to profile this method in the interpreter. |
|
1821 |
__ bind(profile_method); |
|
1822 |
__ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::profile_method)); |
|
1823 |
__ set_method_data_pointer_for_bcp(); |
|
1824 |
__ b(profile_method_continue); |
|
1825 |
} |
|
1826 |
||
1827 |
if (inc_counter) { |
|
1828 |
// Handle invocation counter overflow. |
|
1829 |
__ bind(invocation_counter_overflow); |
|
1830 |
generate_counter_overflow(profile_method_continue); |
|
1831 |
} |
|
1832 |
return entry; |
|
1833 |
} |
|
1834 |
||
31861 | 1835 |
// CRC32 Intrinsics. |
1836 |
// |
|
1837 |
// Contract on scratch and work registers. |
|
1838 |
// ======================================= |
|
1839 |
// |
|
1840 |
// On ppc, the register set {R2..R12} is available in the interpreter as scratch/work registers. |
|
1841 |
// You should, however, keep in mind that {R3_ARG1..R10_ARG8} is the C-ABI argument register set. |
|
1842 |
// You can't rely on these registers across calls. |
|
1843 |
// |
|
1844 |
// The generators for CRC32_update and for CRC32_updateBytes use the |
|
1845 |
// scratch/work register set internally, passing the work registers |
|
1846 |
// as arguments to the MacroAssembler emitters as required. |
|
1847 |
// |
|
1848 |
// R3_ARG1..R6_ARG4 are preset to hold the incoming java arguments. |
|
1849 |
// Their contents is not constant but may change according to the requirements |
|
1850 |
// of the emitted code. |
|
1851 |
// |
|
1852 |
// All other registers from the scratch/work register set are used "internally" |
|
1853 |
// and contain garbage (i.e. unpredictable values) once blr() is reached. |
|
1854 |
// Basically, only R3_RET contains a defined value which is the function result. |
|
1855 |
// |
|
1856 |
/** |
|
1857 |
* Method entry for static native methods: |
|
1858 |
* int java.util.zip.CRC32.update(int crc, int b) |
|
1859 |
*/ |
|
35214 | 1860 |
address TemplateInterpreterGenerator::generate_CRC32_update_entry() { |
31861 | 1861 |
if (UseCRC32Intrinsics) { |
33070
54f3f085b165
8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents:
31865
diff
changeset
|
1862 |
address start = __ pc(); // Remember stub start address (is rtn value). |
31861 | 1863 |
Label slow_path; |
1864 |
||
1865 |
// Safepoint check |
|
1866 |
const Register sync_state = R11_scratch1; |
|
1867 |
int sync_state_offs = __ load_const_optimized(sync_state, SafepointSynchronize::address_of_state(), /*temp*/R0, true); |
|
1868 |
__ lwz(sync_state, sync_state_offs, sync_state); |
|
1869 |
__ cmpwi(CCR0, sync_state, SafepointSynchronize::_not_synchronized); |
|
1870 |
__ bne(CCR0, slow_path); |
|
1871 |
||
1872 |
// We don't generate local frame and don't align stack because |
|
1873 |
// we not even call stub code (we generate the code inline) |
|
1874 |
// and there is no safepoint on this path. |
|
1875 |
||
1876 |
// Load java parameters. |
|
1877 |
// R15_esp is callers operand stack pointer, i.e. it points to the parameters. |
|
1878 |
const Register argP = R15_esp; |
|
1879 |
const Register crc = R3_ARG1; // crc value |
|
1880 |
const Register data = R4_ARG2; // address of java byte value (kernel_crc32 needs address) |
|
1881 |
const Register dataLen = R5_ARG3; // source data len (1 byte). Not used because calling the single-byte emitter. |
|
1882 |
const Register table = R6_ARG4; // address of crc32 table |
|
1883 |
const Register tmp = dataLen; // Reuse unused len register to show we don't actually need a separate tmp here. |
|
1884 |
||
1885 |
BLOCK_COMMENT("CRC32_update {"); |
|
1886 |
||
1887 |
// Arguments are reversed on java expression stack |
|
1888 |
#ifdef VM_LITTLE_ENDIAN |
|
1889 |
__ addi(data, argP, 0+1*wordSize); // (stack) address of byte value. Emitter expects address, not value. |
|
1890 |
// Being passed as an int, the single byte is at offset +0. |
|
1891 |
#else |
|
1892 |
__ addi(data, argP, 3+1*wordSize); // (stack) address of byte value. Emitter expects address, not value. |
|
1893 |
// Being passed from java as an int, the single byte is at offset +3. |
|
1894 |
#endif |
|
1895 |
__ lwz(crc, 2*wordSize, argP); // Current crc state, zero extend to 64 bit to have a clean register. |
|
1896 |
||
1897 |
StubRoutines::ppc64::generate_load_crc_table_addr(_masm, table); |
|
46317
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
1898 |
__ kernel_crc32_singleByte(crc, data, dataLen, table, tmp, true); |
31861 | 1899 |
|
1900 |
// Restore caller sp for c2i case and return. |
|
1901 |
__ mr(R1_SP, R21_sender_SP); // Cut the stack back to where the caller started. |
|
1902 |
__ blr(); |
|
1903 |
||
1904 |
// Generate a vanilla native entry as the slow path. |
|
1905 |
BLOCK_COMMENT("} CRC32_update"); |
|
1906 |
BIND(slow_path); |
|
33070
54f3f085b165
8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents:
31865
diff
changeset
|
1907 |
__ jump_to_entry(Interpreter::entry_for_kind(Interpreter::native), R11_scratch1); |
54f3f085b165
8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents:
31865
diff
changeset
|
1908 |
return start; |
31861 | 1909 |
} |
1910 |
||
33070
54f3f085b165
8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents:
31865
diff
changeset
|
1911 |
return NULL; |
31861 | 1912 |
} |
1913 |
||
46317
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
1914 |
// TODO: generate_CRC32_updateBytes_entry and generate_CRC32C_updateBytes_entry are identical |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
1915 |
// except for using different crc tables and some block comment strings. |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
1916 |
// We should provide a common implementation. |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
1917 |
|
31861 | 1918 |
// CRC32 Intrinsics. |
1919 |
/** |
|
1920 |
* Method entry for static native methods: |
|
1921 |
* int java.util.zip.CRC32.updateBytes( int crc, byte[] b, int off, int len) |
|
1922 |
* int java.util.zip.CRC32.updateByteBuffer(int crc, long* buf, int off, int len) |
|
1923 |
*/ |
|
35214 | 1924 |
address TemplateInterpreterGenerator::generate_CRC32_updateBytes_entry(AbstractInterpreter::MethodKind kind) { |
31861 | 1925 |
if (UseCRC32Intrinsics) { |
33070
54f3f085b165
8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents:
31865
diff
changeset
|
1926 |
address start = __ pc(); // Remember stub start address (is rtn value). |
31861 | 1927 |
Label slow_path; |
1928 |
||
1929 |
// Safepoint check |
|
1930 |
const Register sync_state = R11_scratch1; |
|
1931 |
int sync_state_offs = __ load_const_optimized(sync_state, SafepointSynchronize::address_of_state(), /*temp*/R0, true); |
|
1932 |
__ lwz(sync_state, sync_state_offs, sync_state); |
|
1933 |
__ cmpwi(CCR0, sync_state, SafepointSynchronize::_not_synchronized); |
|
1934 |
__ bne(CCR0, slow_path); |
|
1935 |
||
1936 |
// We don't generate local frame and don't align stack because |
|
1937 |
// we not even call stub code (we generate the code inline) |
|
1938 |
// and there is no safepoint on this path. |
|
1939 |
||
1940 |
// Load parameters. |
|
1941 |
// Z_esp is callers operand stack pointer, i.e. it points to the parameters. |
|
1942 |
const Register argP = R15_esp; |
|
1943 |
const Register crc = R3_ARG1; // crc value |
|
1944 |
const Register data = R4_ARG2; // address of java byte array |
|
1945 |
const Register dataLen = R5_ARG3; // source data len |
|
1946 |
const Register table = R6_ARG4; // address of crc32 table |
|
1947 |
||
1948 |
const Register t0 = R9; // scratch registers for crc calculation |
|
1949 |
const Register t1 = R10; |
|
1950 |
const Register t2 = R11; |
|
1951 |
const Register t3 = R12; |
|
1952 |
||
1953 |
const Register tc0 = R2; // registers to hold pre-calculated column addresses |
|
1954 |
const Register tc1 = R7; |
|
1955 |
const Register tc2 = R8; |
|
1956 |
const Register tc3 = table; // table address is reconstructed at the end of kernel_crc32_* emitters |
|
1957 |
||
1958 |
const Register tmp = t0; // Only used very locally to calculate byte buffer address. |
|
1959 |
||
1960 |
// Arguments are reversed on java expression stack. |
|
1961 |
// Calculate address of start element. |
|
1962 |
if (kind == Interpreter::java_util_zip_CRC32_updateByteBuffer) { // Used for "updateByteBuffer direct". |
|
1963 |
BLOCK_COMMENT("CRC32_updateByteBuffer {"); |
|
1964 |
// crc @ (SP + 5W) (32bit) |
|
1965 |
// buf @ (SP + 3W) (64bit ptr to long array) |
|
1966 |
// off @ (SP + 2W) (32bit) |
|
1967 |
// dataLen @ (SP + 1W) (32bit) |
|
1968 |
// data = buf + off |
|
1969 |
__ ld( data, 3*wordSize, argP); // start of byte buffer |
|
1970 |
__ lwa( tmp, 2*wordSize, argP); // byte buffer offset |
|
1971 |
__ lwa( dataLen, 1*wordSize, argP); // #bytes to process |
|
1972 |
__ lwz( crc, 5*wordSize, argP); // current crc state |
|
1973 |
__ add( data, data, tmp); // Add byte buffer offset. |
|
1974 |
} else { // Used for "updateBytes update". |
|
1975 |
BLOCK_COMMENT("CRC32_updateBytes {"); |
|
1976 |
// crc @ (SP + 4W) (32bit) |
|
1977 |
// buf @ (SP + 3W) (64bit ptr to byte array) |
|
1978 |
// off @ (SP + 2W) (32bit) |
|
1979 |
// dataLen @ (SP + 1W) (32bit) |
|
1980 |
// data = buf + off + base_offset |
|
1981 |
__ ld( data, 3*wordSize, argP); // start of byte buffer |
|
1982 |
__ lwa( tmp, 2*wordSize, argP); // byte buffer offset |
|
1983 |
__ lwa( dataLen, 1*wordSize, argP); // #bytes to process |
|
1984 |
__ add( data, data, tmp); // add byte buffer offset |
|
1985 |
__ lwz( crc, 4*wordSize, argP); // current crc state |
|
1986 |
__ addi(data, data, arrayOopDesc::base_offset_in_bytes(T_BYTE)); |
|
1987 |
} |
|
1988 |
||
1989 |
StubRoutines::ppc64::generate_load_crc_table_addr(_masm, table); |
|
1990 |
||
1991 |
// Performance measurements show the 1word and 2word variants to be almost equivalent, |
|
1992 |
// with very light advantages for the 1word variant. We chose the 1word variant for |
|
1993 |
// code compactness. |
|
46317
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
1994 |
__ kernel_crc32_1word(crc, data, dataLen, table, t0, t1, t2, t3, tc0, tc1, tc2, tc3, true); |
31861 | 1995 |
|
1996 |
// Restore caller sp for c2i case and return. |
|
1997 |
__ mr(R1_SP, R21_sender_SP); // Cut the stack back to where the caller started. |
|
1998 |
__ blr(); |
|
1999 |
||
2000 |
// Generate a vanilla native entry as the slow path. |
|
2001 |
BLOCK_COMMENT("} CRC32_updateBytes(Buffer)"); |
|
2002 |
BIND(slow_path); |
|
33070
54f3f085b165
8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents:
31865
diff
changeset
|
2003 |
__ jump_to_entry(Interpreter::entry_for_kind(Interpreter::native), R11_scratch1); |
54f3f085b165
8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents:
31865
diff
changeset
|
2004 |
return start; |
31861 | 2005 |
} |
2006 |
||
33070
54f3f085b165
8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents:
31865
diff
changeset
|
2007 |
return NULL; |
31861 | 2008 |
} |
2009 |
||
46317
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2010 |
// CRC32C Intrinsics. |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2011 |
/** |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2012 |
* Method entry for static native methods: |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2013 |
* int java.util.zip.CRC32C.updateBytes( int crc, byte[] b, int off, int len) |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2014 |
* int java.util.zip.CRC32C.updateDirectByteBuffer(int crc, long* buf, int off, int len) |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2015 |
**/ |
35214 | 2016 |
address TemplateInterpreterGenerator::generate_CRC32C_updateBytes_entry(AbstractInterpreter::MethodKind kind) { |
46317
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2017 |
if (UseCRC32CIntrinsics) { |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2018 |
address start = __ pc(); // Remember stub start address (is rtn value). |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2019 |
|
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2020 |
// We don't generate local frame and don't align stack because |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2021 |
// we not even call stub code (we generate the code inline) |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2022 |
// and there is no safepoint on this path. |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2023 |
|
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2024 |
// Load parameters. |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2025 |
// Z_esp is callers operand stack pointer, i.e. it points to the parameters. |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2026 |
const Register argP = R15_esp; |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2027 |
const Register crc = R3_ARG1; // crc value |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2028 |
const Register data = R4_ARG2; // address of java byte array |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2029 |
const Register dataLen = R5_ARG3; // source data len |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2030 |
const Register table = R6_ARG4; // address of crc32c table |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2031 |
|
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2032 |
const Register t0 = R9; // scratch registers for crc calculation |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2033 |
const Register t1 = R10; |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2034 |
const Register t2 = R11; |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2035 |
const Register t3 = R12; |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2036 |
|
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2037 |
const Register tc0 = R2; // registers to hold pre-calculated column addresses |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2038 |
const Register tc1 = R7; |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2039 |
const Register tc2 = R8; |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2040 |
const Register tc3 = table; // table address is reconstructed at the end of kernel_crc32_* emitters |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2041 |
|
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2042 |
const Register tmp = t0; // Only used very locally to calculate byte buffer address. |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2043 |
|
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2044 |
// Arguments are reversed on java expression stack. |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2045 |
// Calculate address of start element. |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2046 |
if (kind == Interpreter::java_util_zip_CRC32C_updateDirectByteBuffer) { // Used for "updateDirectByteBuffer". |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2047 |
BLOCK_COMMENT("CRC32C_updateDirectByteBuffer {"); |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2048 |
// crc @ (SP + 5W) (32bit) |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2049 |
// buf @ (SP + 3W) (64bit ptr to long array) |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2050 |
// off @ (SP + 2W) (32bit) |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2051 |
// dataLen @ (SP + 1W) (32bit) |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2052 |
// data = buf + off |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2053 |
__ ld( data, 3*wordSize, argP); // start of byte buffer |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2054 |
__ lwa( tmp, 2*wordSize, argP); // byte buffer offset |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2055 |
__ lwa( dataLen, 1*wordSize, argP); // #bytes to process |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2056 |
__ lwz( crc, 5*wordSize, argP); // current crc state |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2057 |
__ add( data, data, tmp); // Add byte buffer offset. |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2058 |
} else { // Used for "updateBytes update". |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2059 |
BLOCK_COMMENT("CRC32C_updateBytes {"); |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2060 |
// crc @ (SP + 4W) (32bit) |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2061 |
// buf @ (SP + 3W) (64bit ptr to byte array) |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2062 |
// off @ (SP + 2W) (32bit) |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2063 |
// dataLen @ (SP + 1W) (32bit) |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2064 |
// data = buf + off + base_offset |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2065 |
__ ld( data, 3*wordSize, argP); // start of byte buffer |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2066 |
__ lwa( tmp, 2*wordSize, argP); // byte buffer offset |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2067 |
__ lwa( dataLen, 1*wordSize, argP); // #bytes to process |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2068 |
__ add( data, data, tmp); // add byte buffer offset |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2069 |
__ lwz( crc, 4*wordSize, argP); // current crc state |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2070 |
__ addi(data, data, arrayOopDesc::base_offset_in_bytes(T_BYTE)); |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2071 |
} |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2072 |
|
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2073 |
StubRoutines::ppc64::generate_load_crc32c_table_addr(_masm, table); |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2074 |
|
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2075 |
// Performance measurements show the 1word and 2word variants to be almost equivalent, |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2076 |
// with very light advantages for the 1word variant. We chose the 1word variant for |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2077 |
// code compactness. |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2078 |
__ kernel_crc32_1word(crc, data, dataLen, table, t0, t1, t2, t3, tc0, tc1, tc2, tc3, false); |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2079 |
|
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2080 |
// Restore caller sp for c2i case and return. |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2081 |
__ mr(R1_SP, R21_sender_SP); // Cut the stack back to where the caller started. |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2082 |
__ blr(); |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2083 |
|
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2084 |
BLOCK_COMMENT("} CRC32C_update{Bytes|DirectByteBuffer}"); |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2085 |
return start; |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2086 |
} |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
46294
diff
changeset
|
2087 |
|
35214 | 2088 |
return NULL; |
2089 |
} |
|
2090 |
||
23221 | 2091 |
// ============================================================================= |
2092 |
// Exceptions |
|
2093 |
||
2094 |
void TemplateInterpreterGenerator::generate_throw_exception() { |
|
2095 |
Register Rexception = R17_tos, |
|
2096 |
Rcontinuation = R3_RET; |
|
2097 |
||
2098 |
// -------------------------------------------------------------------------- |
|
2099 |
// Entry point if an method returns with a pending exception (rethrow). |
|
2100 |
Interpreter::_rethrow_exception_entry = __ pc(); |
|
2101 |
{ |
|
2102 |
__ restore_interpreter_state(R11_scratch1); // Sets R11_scratch1 = fp. |
|
2103 |
__ ld(R12_scratch2, _ijava_state_neg(top_frame_sp), R11_scratch1); |
|
2104 |
__ resize_frame_absolute(R12_scratch2, R11_scratch1, R0); |
|
2105 |
||
2106 |
// Compiled code destroys templateTableBase, reload. |
|
2107 |
__ load_const_optimized(R25_templateTableBase, (address)Interpreter::dispatch_table((TosState)0), R11_scratch1); |
|
2108 |
} |
|
2109 |
||
2110 |
// Entry point if a interpreted method throws an exception (throw). |
|
2111 |
Interpreter::_throw_exception_entry = __ pc(); |
|
2112 |
{ |
|
2113 |
__ mr(Rexception, R3_RET); |
|
2114 |
||
2115 |
__ verify_thread(); |
|
2116 |
__ verify_oop(Rexception); |
|
2117 |
||
2118 |
// Expression stack must be empty before entering the VM in case of an exception. |
|
2119 |
__ empty_expression_stack(); |
|
2120 |
// Find exception handler address and preserve exception oop. |
|
2121 |
// Call C routine to find handler and jump to it. |
|
2122 |
__ call_VM(Rexception, CAST_FROM_FN_PTR(address, InterpreterRuntime::exception_handler_for_exception), Rexception); |
|
2123 |
__ mtctr(Rcontinuation); |
|
2124 |
// Push exception for exception handler bytecodes. |
|
2125 |
__ push_ptr(Rexception); |
|
2126 |
||
2127 |
// Jump to exception handler (may be remove activation entry!). |
|
2128 |
__ bctr(); |
|
2129 |
} |
|
2130 |
||
2131 |
// If the exception is not handled in the current frame the frame is |
|
2132 |
// removed and the exception is rethrown (i.e. exception |
|
2133 |
// continuation is _rethrow_exception). |
|
2134 |
// |
|
2135 |
// Note: At this point the bci is still the bxi for the instruction |
|
2136 |
// which caused the exception and the expression stack is |
|
2137 |
// empty. Thus, for any VM calls at this point, GC will find a legal |
|
2138 |
// oop map (with empty expression stack). |
|
2139 |
||
2140 |
// In current activation |
|
2141 |
// tos: exception |
|
2142 |
// bcp: exception bcp |
|
2143 |
||
2144 |
// -------------------------------------------------------------------------- |
|
2145 |
// JVMTI PopFrame support |
|
2146 |
||
2147 |
Interpreter::_remove_activation_preserving_args_entry = __ pc(); |
|
2148 |
{ |
|
2149 |
// Set the popframe_processing bit in popframe_condition indicating that we are |
|
2150 |
// currently handling popframe, so that call_VMs that may happen later do not |
|
2151 |
// trigger new popframe handling cycles. |
|
2152 |
__ lwz(R11_scratch1, in_bytes(JavaThread::popframe_condition_offset()), R16_thread); |
|
2153 |
__ ori(R11_scratch1, R11_scratch1, JavaThread::popframe_processing_bit); |
|
2154 |
__ stw(R11_scratch1, in_bytes(JavaThread::popframe_condition_offset()), R16_thread); |
|
2155 |
||
2156 |
// Empty the expression stack, as in normal exception handling. |
|
2157 |
__ empty_expression_stack(); |
|
2158 |
__ unlock_if_synchronized_method(vtos, /* throw_monitor_exception */ false, /* install_monitor_exception */ false); |
|
2159 |
||
2160 |
// Check to see whether we are returning to a deoptimized frame. |
|
2161 |
// (The PopFrame call ensures that the caller of the popped frame is |
|
2162 |
// either interpreted or compiled and deoptimizes it if compiled.) |
|
2163 |
// Note that we don't compare the return PC against the |
|
2164 |
// deoptimization blob's unpack entry because of the presence of |
|
2165 |
// adapter frames in C2. |
|
2166 |
Label Lcaller_not_deoptimized; |
|
2167 |
Register return_pc = R3_ARG1; |
|
2168 |
__ ld(return_pc, 0, R1_SP); |
|
2169 |
__ ld(return_pc, _abi(lr), return_pc); |
|
2170 |
__ call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::interpreter_contains), return_pc); |
|
2171 |
__ cmpdi(CCR0, R3_RET, 0); |
|
2172 |
__ bne(CCR0, Lcaller_not_deoptimized); |
|
2173 |
||
2174 |
// The deoptimized case. |
|
2175 |
// In this case, we can't call dispatch_next() after the frame is |
|
2176 |
// popped, but instead must save the incoming arguments and restore |
|
2177 |
// them after deoptimization has occurred. |
|
2178 |
__ ld(R4_ARG2, in_bytes(Method::const_offset()), R19_method); |
|
2179 |
__ lhz(R4_ARG2 /* number of params */, in_bytes(ConstMethod::size_of_parameters_offset()), R4_ARG2); |
|
2180 |
__ slwi(R4_ARG2, R4_ARG2, Interpreter::logStackElementSize); |
|
2181 |
__ addi(R5_ARG3, R18_locals, Interpreter::stackElementSize); |
|
2182 |
__ subf(R5_ARG3, R4_ARG2, R5_ARG3); |
|
2183 |
// Save these arguments. |
|
2184 |
__ call_VM_leaf(CAST_FROM_FN_PTR(address, Deoptimization::popframe_preserve_args), R16_thread, R4_ARG2, R5_ARG3); |
|
2185 |
||
2186 |
// Inform deoptimization that it is responsible for restoring these arguments. |
|
2187 |
__ load_const_optimized(R11_scratch1, JavaThread::popframe_force_deopt_reexecution_bit); |
|
2188 |
__ stw(R11_scratch1, in_bytes(JavaThread::popframe_condition_offset()), R16_thread); |
|
2189 |
||
2190 |
// Return from the current method into the deoptimization blob. Will eventually |
|
2191 |
// end up in the deopt interpeter entry, deoptimization prepared everything that |
|
2192 |
// we will reexecute the call that called us. |
|
2193 |
__ merge_frames(/*top_frame_sp*/ R21_sender_SP, /*reload return_pc*/ return_pc, R11_scratch1, R12_scratch2); |
|
2194 |
__ mtlr(return_pc); |
|
2195 |
__ blr(); |
|
2196 |
||
2197 |
// The non-deoptimized case. |
|
2198 |
__ bind(Lcaller_not_deoptimized); |
|
2199 |
||
2200 |
// Clear the popframe condition flag. |
|
2201 |
__ li(R0, 0); |
|
2202 |
__ stw(R0, in_bytes(JavaThread::popframe_condition_offset()), R16_thread); |
|
2203 |
||
2204 |
// Get out of the current method and re-execute the call that called us. |
|
24349 | 2205 |
__ merge_frames(/*top_frame_sp*/ R21_sender_SP, /*return_pc*/ noreg, R11_scratch1, R12_scratch2); |
23221 | 2206 |
__ restore_interpreter_state(R11_scratch1); |
2207 |
__ ld(R12_scratch2, _ijava_state_neg(top_frame_sp), R11_scratch1); |
|
2208 |
__ resize_frame_absolute(R12_scratch2, R11_scratch1, R0); |
|
2209 |
if (ProfileInterpreter) { |
|
2210 |
__ set_method_data_pointer_for_bcp(); |
|
28187
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
25950
diff
changeset
|
2211 |
__ ld(R11_scratch1, 0, R1_SP); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
25950
diff
changeset
|
2212 |
__ std(R28_mdx, _ijava_state_neg(mdx), R11_scratch1); |
23221 | 2213 |
} |
24349 | 2214 |
#if INCLUDE_JVMTI |
2215 |
Label L_done; |
|
2216 |
||
2217 |
__ lbz(R11_scratch1, 0, R14_bcp); |
|
2218 |
__ cmpwi(CCR0, R11_scratch1, Bytecodes::_invokestatic); |
|
2219 |
__ bne(CCR0, L_done); |
|
2220 |
||
2221 |
// The member name argument must be restored if _invokestatic is re-executed after a PopFrame call. |
|
2222 |
// Detect such a case in the InterpreterRuntime function and return the member name argument, or NULL. |
|
2223 |
__ ld(R4_ARG2, 0, R18_locals); |
|
28187
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
25950
diff
changeset
|
2224 |
__ MacroAssembler::call_VM(R4_ARG2, CAST_FROM_FN_PTR(address, InterpreterRuntime::member_name_arg_or_null), R4_ARG2, R19_method, R14_bcp, false); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
25950
diff
changeset
|
2225 |
__ restore_interpreter_state(R11_scratch1, /*bcp_and_mdx_only*/ true); |
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
25950
diff
changeset
|
2226 |
__ cmpdi(CCR0, R4_ARG2, 0); |
24349 | 2227 |
__ beq(CCR0, L_done); |
28187
fc19df82d6ee
8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents:
25950
diff
changeset
|
2228 |
__ std(R4_ARG2, wordSize, R15_esp); |
24349 | 2229 |
__ bind(L_done); |
2230 |
#endif // INCLUDE_JVMTI |
|
23221 | 2231 |
__ dispatch_next(vtos); |
2232 |
} |
|
2233 |
// end of JVMTI PopFrame support |
|
2234 |
||
2235 |
// -------------------------------------------------------------------------- |
|
2236 |
// Remove activation exception entry. |
|
2237 |
// This is jumped to if an interpreted method can't handle an exception itself |
|
2238 |
// (we come from the throw/rethrow exception entry above). We're going to call |
|
2239 |
// into the VM to find the exception handler in the caller, pop the current |
|
2240 |
// frame and return the handler we calculated. |
|
2241 |
Interpreter::_remove_activation_entry = __ pc(); |
|
2242 |
{ |
|
2243 |
__ pop_ptr(Rexception); |
|
2244 |
__ verify_thread(); |
|
2245 |
__ verify_oop(Rexception); |
|
2246 |
__ std(Rexception, in_bytes(JavaThread::vm_result_offset()), R16_thread); |
|
2247 |
||
2248 |
__ unlock_if_synchronized_method(vtos, /* throw_monitor_exception */ false, true); |
|
2249 |
__ notify_method_exit(false, vtos, InterpreterMacroAssembler::SkipNotifyJVMTI, false); |
|
2250 |
||
2251 |
__ get_vm_result(Rexception); |
|
2252 |
||
2253 |
// We are done with this activation frame; find out where to go next. |
|
2254 |
// The continuation point will be an exception handler, which expects |
|
2255 |
// the following registers set up: |
|
2256 |
// |
|
2257 |
// RET: exception oop |
|
2258 |
// ARG2: Issuing PC (see generate_exception_blob()), only used if the caller is compiled. |
|
2259 |
||
2260 |
Register return_pc = R31; // Needs to survive the runtime call. |
|
2261 |
__ ld(return_pc, 0, R1_SP); |
|
2262 |
__ ld(return_pc, _abi(lr), return_pc); |
|
2263 |
__ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::exception_handler_for_return_address), R16_thread, return_pc); |
|
2264 |
||
2265 |
// Remove the current activation. |
|
2266 |
__ merge_frames(/*top_frame_sp*/ R21_sender_SP, /*return_pc*/ noreg, R11_scratch1, R12_scratch2); |
|
2267 |
||
2268 |
__ mr(R4_ARG2, return_pc); |
|
2269 |
__ mtlr(R3_RET); |
|
2270 |
__ mr(R3_RET, Rexception); |
|
2271 |
__ blr(); |
|
2272 |
} |
|
2273 |
} |
|
2274 |
||
2275 |
// JVMTI ForceEarlyReturn support. |
|
2276 |
// Returns "in the middle" of a method with a "fake" return value. |
|
2277 |
address TemplateInterpreterGenerator::generate_earlyret_entry_for(TosState state) { |
|
2278 |
||
2279 |
Register Rscratch1 = R11_scratch1, |
|
2280 |
Rscratch2 = R12_scratch2; |
|
2281 |
||
2282 |
address entry = __ pc(); |
|
2283 |
__ empty_expression_stack(); |
|
2284 |
||
2285 |
__ load_earlyret_value(state, Rscratch1); |
|
2286 |
||
2287 |
__ ld(Rscratch1, in_bytes(JavaThread::jvmti_thread_state_offset()), R16_thread); |
|
2288 |
// Clear the earlyret state. |
|
2289 |
__ li(R0, 0); |
|
2290 |
__ stw(R0, in_bytes(JvmtiThreadState::earlyret_state_offset()), Rscratch1); |
|
2291 |
||
2292 |
__ remove_activation(state, false, false); |
|
2293 |
// Copied from TemplateTable::_return. |
|
2294 |
// Restoration of lr done by remove_activation. |
|
2295 |
switch (state) { |
|
37488 | 2296 |
// Narrow result if state is itos but result type is smaller. |
23221 | 2297 |
case btos: |
37488 | 2298 |
case ztos: |
23221 | 2299 |
case ctos: |
2300 |
case stos: |
|
42068
18c8a4d5998e
8168083: PPC64: Cleanup template interpreter after 8154580 and 8154867
mdoerr
parents:
41341
diff
changeset
|
2301 |
case itos: __ narrow(R17_tos); /* fall through */ |
18c8a4d5998e
8168083: PPC64: Cleanup template interpreter after 8154580 and 8154867
mdoerr
parents:
41341
diff
changeset
|
2302 |
case ltos: |
37488 | 2303 |
case atos: __ mr(R3_RET, R17_tos); break; |
23221 | 2304 |
case ftos: |
2305 |
case dtos: __ fmr(F1_RET, F15_ftos); break; |
|
2306 |
case vtos: // This might be a constructor. Final fields (and volatile fields on PPC64) need |
|
2307 |
// to get visible before the reference to the object gets stored anywhere. |
|
2308 |
__ membar(Assembler::StoreStore); break; |
|
2309 |
default : ShouldNotReachHere(); |
|
2310 |
} |
|
2311 |
__ blr(); |
|
2312 |
||
2313 |
return entry; |
|
2314 |
} // end of ForceEarlyReturn support |
|
2315 |
||
2316 |
//----------------------------------------------------------------------------- |
|
2317 |
// Helper for vtos entry point generation |
|
2318 |
||
2319 |
void TemplateInterpreterGenerator::set_vtos_entry_points(Template* t, |
|
2320 |
address& bep, |
|
2321 |
address& cep, |
|
2322 |
address& sep, |
|
2323 |
address& aep, |
|
2324 |
address& iep, |
|
2325 |
address& lep, |
|
2326 |
address& fep, |
|
2327 |
address& dep, |
|
2328 |
address& vep) { |
|
2329 |
assert(t->is_valid() && t->tos_in() == vtos, "illegal template"); |
|
2330 |
Label L; |
|
2331 |
||
2332 |
aep = __ pc(); __ push_ptr(); __ b(L); |
|
2333 |
fep = __ pc(); __ push_f(); __ b(L); |
|
2334 |
dep = __ pc(); __ push_d(); __ b(L); |
|
2335 |
lep = __ pc(); __ push_l(); __ b(L); |
|
2336 |
__ align(32, 12, 24); // align L |
|
2337 |
bep = cep = sep = |
|
2338 |
iep = __ pc(); __ push_i(); |
|
2339 |
vep = __ pc(); |
|
2340 |
__ bind(L); |
|
2341 |
generate_and_dispatch(t); |
|
2342 |
} |
|
2343 |
||
2344 |
//----------------------------------------------------------------------------- |
|
2345 |
||
2346 |
// Non-product code |
|
2347 |
#ifndef PRODUCT |
|
2348 |
address TemplateInterpreterGenerator::generate_trace_code(TosState state) { |
|
2349 |
//__ flush_bundle(); |
|
2350 |
address entry = __ pc(); |
|
2351 |
||
23522
217a6a90aad3
8038201: Clean up misleading usage of malloc() in init_system_properties_values()
goetz
parents:
23221
diff
changeset
|
2352 |
const char *bname = NULL; |
23221 | 2353 |
uint tsize = 0; |
2354 |
switch(state) { |
|
2355 |
case ftos: |
|
2356 |
bname = "trace_code_ftos {"; |
|
2357 |
tsize = 2; |
|
2358 |
break; |
|
2359 |
case btos: |
|
2360 |
bname = "trace_code_btos {"; |
|
2361 |
tsize = 2; |
|
2362 |
break; |
|
37488 | 2363 |
case ztos: |
2364 |
bname = "trace_code_ztos {"; |
|
2365 |
tsize = 2; |
|
2366 |
break; |
|
23221 | 2367 |
case ctos: |
2368 |
bname = "trace_code_ctos {"; |
|
2369 |
tsize = 2; |
|
2370 |
break; |
|
2371 |
case stos: |
|
2372 |
bname = "trace_code_stos {"; |
|
2373 |
tsize = 2; |
|
2374 |
break; |
|
2375 |
case itos: |
|
2376 |
bname = "trace_code_itos {"; |
|
2377 |
tsize = 2; |
|
2378 |
break; |
|
2379 |
case ltos: |
|
2380 |
bname = "trace_code_ltos {"; |
|
2381 |
tsize = 3; |
|
2382 |
break; |
|
2383 |
case atos: |
|
2384 |
bname = "trace_code_atos {"; |
|
2385 |
tsize = 2; |
|
2386 |
break; |
|
2387 |
case vtos: |
|
2388 |
// Note: In case of vtos, the topmost of stack value could be a int or doubl |
|
2389 |
// In case of a double (2 slots) we won't see the 2nd stack value. |
|
2390 |
// Maybe we simply should print the topmost 3 stack slots to cope with the problem. |
|
2391 |
bname = "trace_code_vtos {"; |
|
2392 |
tsize = 2; |
|
2393 |
||
2394 |
break; |
|
2395 |
case dtos: |
|
2396 |
bname = "trace_code_dtos {"; |
|
2397 |
tsize = 3; |
|
2398 |
break; |
|
2399 |
default: |
|
2400 |
ShouldNotReachHere(); |
|
2401 |
} |
|
2402 |
BLOCK_COMMENT(bname); |
|
2403 |
||
2404 |
// Support short-cut for TraceBytecodesAt. |
|
2405 |
// Don't call into the VM if we don't want to trace to speed up things. |
|
2406 |
Label Lskip_vm_call; |
|
2407 |
if (TraceBytecodesAt > 0 && TraceBytecodesAt < max_intx) { |
|
2408 |
int offs1 = __ load_const_optimized(R11_scratch1, (address) &TraceBytecodesAt, R0, true); |
|
2409 |
int offs2 = __ load_const_optimized(R12_scratch2, (address) &BytecodeCounter::_counter_value, R0, true); |
|
2410 |
__ ld(R11_scratch1, offs1, R11_scratch1); |
|
2411 |
__ lwa(R12_scratch2, offs2, R12_scratch2); |
|
2412 |
__ cmpd(CCR0, R12_scratch2, R11_scratch1); |
|
2413 |
__ blt(CCR0, Lskip_vm_call); |
|
2414 |
} |
|
2415 |
||
2416 |
__ push(state); |
|
2417 |
// Load 2 topmost expression stack values. |
|
2418 |
__ ld(R6_ARG4, tsize*Interpreter::stackElementSize, R15_esp); |
|
2419 |
__ ld(R5_ARG3, Interpreter::stackElementSize, R15_esp); |
|
2420 |
__ mflr(R31); |
|
37152
29e68f1d35bb
8152065: TraceBytecodes breaks the interpreter expression stack
coleenp
parents:
35606
diff
changeset
|
2421 |
__ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::trace_bytecode), /* unused */ R4_ARG2, R5_ARG3, R6_ARG4, false); |
23221 | 2422 |
__ mtlr(R31); |
2423 |
__ pop(state); |
|
2424 |
||
2425 |
if (TraceBytecodesAt > 0 && TraceBytecodesAt < max_intx) { |
|
2426 |
__ bind(Lskip_vm_call); |
|
2427 |
} |
|
2428 |
__ blr(); |
|
2429 |
BLOCK_COMMENT("} trace_code"); |
|
2430 |
return entry; |
|
2431 |
} |
|
2432 |
||
2433 |
void TemplateInterpreterGenerator::count_bytecode() { |
|
2434 |
int offs = __ load_const_optimized(R11_scratch1, (address) &BytecodeCounter::_counter_value, R12_scratch2, true); |
|
2435 |
__ lwz(R12_scratch2, offs, R11_scratch1); |
|
2436 |
__ addi(R12_scratch2, R12_scratch2, 1); |
|
2437 |
__ stw(R12_scratch2, offs, R11_scratch1); |
|
2438 |
} |
|
2439 |
||
2440 |
void TemplateInterpreterGenerator::histogram_bytecode(Template* t) { |
|
2441 |
int offs = __ load_const_optimized(R11_scratch1, (address) &BytecodeHistogram::_counters[t->bytecode()], R12_scratch2, true); |
|
2442 |
__ lwz(R12_scratch2, offs, R11_scratch1); |
|
2443 |
__ addi(R12_scratch2, R12_scratch2, 1); |
|
2444 |
__ stw(R12_scratch2, offs, R11_scratch1); |
|
2445 |
} |
|
2446 |
||
2447 |
void TemplateInterpreterGenerator::histogram_bytecode_pair(Template* t) { |
|
2448 |
const Register addr = R11_scratch1, |
|
2449 |
tmp = R12_scratch2; |
|
2450 |
// Get index, shift out old bytecode, bring in new bytecode, and store it. |
|
2451 |
// _index = (_index >> log2_number_of_codes) | |
|
2452 |
// (bytecode << log2_number_of_codes); |
|
2453 |
int offs1 = __ load_const_optimized(addr, (address)&BytecodePairHistogram::_index, tmp, true); |
|
2454 |
__ lwz(tmp, offs1, addr); |
|
2455 |
__ srwi(tmp, tmp, BytecodePairHistogram::log2_number_of_codes); |
|
2456 |
__ ori(tmp, tmp, ((int) t->bytecode()) << BytecodePairHistogram::log2_number_of_codes); |
|
2457 |
__ stw(tmp, offs1, addr); |
|
2458 |
||
2459 |
// Bump bucket contents. |
|
2460 |
// _counters[_index] ++; |
|
2461 |
int offs2 = __ load_const_optimized(addr, (address)&BytecodePairHistogram::_counters, R0, true); |
|
2462 |
__ sldi(tmp, tmp, LogBytesPerInt); |
|
2463 |
__ add(addr, tmp, addr); |
|
2464 |
__ lwz(tmp, offs2, addr); |
|
2465 |
__ addi(tmp, tmp, 1); |
|
2466 |
__ stw(tmp, offs2, addr); |
|
2467 |
} |
|
2468 |
||
2469 |
void TemplateInterpreterGenerator::trace_bytecode(Template* t) { |
|
2470 |
// Call a little run-time stub to avoid blow-up for each bytecode. |
|
2471 |
// The run-time runtime saves the right registers, depending on |
|
2472 |
// the tosca in-state for the given template. |
|
2473 |
||
2474 |
assert(Interpreter::trace_code(t->tos_in()) != NULL, |
|
2475 |
"entry must have been generated"); |
|
2476 |
||
2477 |
// Note: we destroy LR here. |
|
2478 |
__ bl(Interpreter::trace_code(t->tos_in())); |
|
2479 |
} |
|
2480 |
||
2481 |
void TemplateInterpreterGenerator::stop_interpreter_at() { |
|
2482 |
Label L; |
|
2483 |
int offs1 = __ load_const_optimized(R11_scratch1, (address) &StopInterpreterAt, R0, true); |
|
2484 |
int offs2 = __ load_const_optimized(R12_scratch2, (address) &BytecodeCounter::_counter_value, R0, true); |
|
2485 |
__ ld(R11_scratch1, offs1, R11_scratch1); |
|
2486 |
__ lwa(R12_scratch2, offs2, R12_scratch2); |
|
2487 |
__ cmpd(CCR0, R12_scratch2, R11_scratch1); |
|
2488 |
__ bne(CCR0, L); |
|
2489 |
__ illtrap(); |
|
2490 |
__ bind(L); |
|
2491 |
} |
|
2492 |
||
2493 |
#endif // !PRODUCT |