annotate src/cpu/ppc/vm/interpreter_ppc.cpp @ 14726:92aa6797d639

Backed out merge changeset: b51e29501f30 Backed out merge revision to its first parent (8f483e200405)
author Doug Simon <doug.simon@oracle.com>
date Mon, 24 Mar 2014 21:30:43 +0100
parents 58cf34613a72
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1 /*
14726
92aa6797d639 Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents: 14694
diff changeset
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
92aa6797d639 Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents: 14694
diff changeset
3 * Copyright 2012, 2013 SAP AG. All rights reserved.
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
5 *
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
6 * This code is free software; you can redistribute it and/or modify it
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
7 * under the terms of the GNU General Public License version 2 only, as
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
8 * published by the Free Software Foundation.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
9 *
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
10 * This code is distributed in the hope that it will be useful, but WITHOUT
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
13 * version 2 for more details (a copy is included in the LICENSE file that
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
14 * accompanied this code).
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
15 *
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License version
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
17 * 2 along with this work; if not, write to the Free Software Foundation,
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
19 *
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
21 * or visit www.oracle.com if you need additional information or have any
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
22 * questions.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
23 *
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
24 */
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
25
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
26 #include "precompiled.hpp"
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
27 #include "asm/assembler.hpp"
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
28 #include "asm/macroAssembler.inline.hpp"
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
29 #include "interpreter/bytecodeHistogram.hpp"
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
30 #include "interpreter/interpreter.hpp"
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
31 #include "interpreter/interpreterGenerator.hpp"
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
32 #include "interpreter/interpreterRuntime.hpp"
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
33 #include "interpreter/templateTable.hpp"
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
34 #include "oops/arrayOop.hpp"
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
35 #include "oops/methodData.hpp"
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
36 #include "oops/method.hpp"
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
37 #include "oops/oop.inline.hpp"
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
38 #include "prims/jvmtiExport.hpp"
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
39 #include "prims/jvmtiThreadState.hpp"
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
40 #include "prims/methodHandles.hpp"
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
41 #include "runtime/arguments.hpp"
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
42 #include "runtime/deoptimization.hpp"
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
43 #include "runtime/frame.inline.hpp"
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
44 #include "runtime/sharedRuntime.hpp"
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
45 #include "runtime/stubRoutines.hpp"
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
46 #include "runtime/synchronizer.hpp"
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
47 #include "runtime/timer.hpp"
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
48 #include "runtime/vframeArray.hpp"
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
49 #include "utilities/debug.hpp"
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
50 #ifdef COMPILER1
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
51 #include "c1/c1_Runtime1.hpp"
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
52 #endif
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
53
14726
92aa6797d639 Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents: 14694
diff changeset
54 #ifndef CC_INTERP
92aa6797d639 Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents: 14694
diff changeset
55 #error "CC_INTERP must be defined on PPC"
92aa6797d639 Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents: 14694
diff changeset
56 #endif
92aa6797d639 Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents: 14694
diff changeset
57
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
58 #define __ _masm->
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
59
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
60 #ifdef PRODUCT
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
61 #define BLOCK_COMMENT(str) // nothing
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
62 #else
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
63 #define BLOCK_COMMENT(str) __ block_comment(str)
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
64 #endif
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
65
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
66 #define BIND(label) bind(label); BLOCK_COMMENT(#label ":")
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
67
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
68 int AbstractInterpreter::BasicType_as_index(BasicType type) {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
69 int i = 0;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
70 switch (type) {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
71 case T_BOOLEAN: i = 0; break;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
72 case T_CHAR : i = 1; break;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
73 case T_BYTE : i = 2; break;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
74 case T_SHORT : i = 3; break;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
75 case T_INT : i = 4; break;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
76 case T_LONG : i = 5; break;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
77 case T_VOID : i = 6; break;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
78 case T_FLOAT : i = 7; break;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
79 case T_DOUBLE : i = 8; break;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
80 case T_OBJECT : i = 9; break;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
81 case T_ARRAY : i = 9; break;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
82 default : ShouldNotReachHere();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
83 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
84 assert(0 <= i && i < AbstractInterpreter::number_of_result_handlers, "index out of bounds");
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
85 return i;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
86 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
87
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
88 address AbstractInterpreterGenerator::generate_slow_signature_handler() {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
89 // Slow_signature handler that respects the PPC C calling conventions.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
90 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
91 // We get called by the native entry code with our output register
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
92 // area == 8. First we call InterpreterRuntime::get_result_handler
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
93 // to copy the pointer to the signature string temporarily to the
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
94 // first C-argument and to return the result_handler in
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
95 // R3_RET. Since native_entry will copy the jni-pointer to the
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
96 // first C-argument slot later on, it is OK to occupy this slot
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
97 // temporarilly. Then we copy the argument list on the java
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
98 // expression stack into native varargs format on the native stack
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
99 // and load arguments into argument registers. Integer arguments in
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
100 // the varargs vector will be sign-extended to 8 bytes.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
101 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
102 // On entry:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
103 // R3_ARG1 - intptr_t* Address of java argument list in memory.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
104 // R15_prev_state - BytecodeInterpreter* Address of interpreter state for
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
105 // this method
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
106 // R19_method
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
107 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
108 // On exit (just before return instruction):
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
109 // R3_RET - contains the address of the result_handler.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
110 // R4_ARG2 - is not updated for static methods and contains "this" otherwise.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
111 // R5_ARG3-R10_ARG8: - When the (i-2)th Java argument is not of type float or double,
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
112 // ARGi contains this argument. Otherwise, ARGi is not updated.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
113 // F1_ARG1-F13_ARG13 - contain the first 13 arguments of type float or double.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
114
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
115 const int LogSizeOfTwoInstructions = 3;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
116
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
117 // FIXME: use Argument:: GL: Argument names different numbers!
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
118 const int max_fp_register_arguments = 13;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
119 const int max_int_register_arguments = 6; // first 2 are reserved
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
120
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
121 const Register arg_java = R21_tmp1;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
122 const Register arg_c = R22_tmp2;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
123 const Register signature = R23_tmp3; // is string
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
124 const Register sig_byte = R24_tmp4;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
125 const Register fpcnt = R25_tmp5;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
126 const Register argcnt = R26_tmp6;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
127 const Register intSlot = R27_tmp7;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
128 const Register target_sp = R28_tmp8;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
129 const FloatRegister floatSlot = F0;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
130
14726
92aa6797d639 Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents: 14694
diff changeset
131 address entry = __ emit_fd();
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
132
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
133 __ save_LR_CR(R0);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
134 __ save_nonvolatile_gprs(R1_SP, _spill_nonvolatiles_neg(r14));
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
135 // We use target_sp for storing arguments in the C frame.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
136 __ mr(target_sp, R1_SP);
14726
92aa6797d639 Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents: 14694
diff changeset
137 __ push_frame_abi112_nonvolatiles(0, R11_scratch1);
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
138
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
139 __ mr(arg_java, R3_ARG1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
140
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
141 __ call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::get_signature), R16_thread, R19_method);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
142
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
143 // Signature is in R3_RET. Signature is callee saved.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
144 __ mr(signature, R3_RET);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
145
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
146 // Reload method, it may have moved.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
147 #ifdef CC_INTERP
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
148 __ ld(R19_method, state_(_method));
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
149 #else
14726
92aa6797d639 Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents: 14694
diff changeset
150 __ unimplemented("slow signature handler 1");
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
151 #endif
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
152
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
153 // Get the result handler.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
154 __ call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::get_result_handler), R16_thread, R19_method);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
155
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
156 // Reload method, it may have moved.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
157 #ifdef CC_INTERP
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
158 __ ld(R19_method, state_(_method));
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
159 #else
14726
92aa6797d639 Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents: 14694
diff changeset
160 __ unimplemented("slow signature handler 2");
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
161 #endif
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
162
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
163 {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
164 Label L;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
165 // test if static
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
166 // _access_flags._flags must be at offset 0.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
167 // TODO PPC port: requires change in shared code.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
168 //assert(in_bytes(AccessFlags::flags_offset()) == 0,
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
169 // "MethodOopDesc._access_flags == MethodOopDesc._access_flags._flags");
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
170 // _access_flags must be a 32 bit value.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
171 assert(sizeof(AccessFlags) == 4, "wrong size");
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
172 __ lwa(R11_scratch1/*access_flags*/, method_(access_flags));
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
173 // testbit with condition register.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
174 __ testbitdi(CCR0, R0, R11_scratch1/*access_flags*/, JVM_ACC_STATIC_BIT);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
175 __ btrue(CCR0, L);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
176 // For non-static functions, pass "this" in R4_ARG2 and copy it
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
177 // to 2nd C-arg slot.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
178 // We need to box the Java object here, so we use arg_java
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
179 // (address of current Java stack slot) as argument and don't
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
180 // dereference it as in case of ints, floats, etc.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
181 __ mr(R4_ARG2, arg_java);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
182 __ addi(arg_java, arg_java, -BytesPerWord);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
183 __ std(R4_ARG2, _abi(carg_2), target_sp);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
184 __ bind(L);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
185 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
186
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
187 // Will be incremented directly after loop_start. argcnt=0
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
188 // corresponds to 3rd C argument.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
189 __ li(argcnt, -1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
190 // arg_c points to 3rd C argument
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
191 __ addi(arg_c, target_sp, _abi(carg_3));
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
192 // no floating-point args parsed so far
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
193 __ li(fpcnt, 0);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
194
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
195 Label move_intSlot_to_ARG, move_floatSlot_to_FARG;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
196 Label loop_start, loop_end;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
197 Label do_int, do_long, do_float, do_double, do_dontreachhere, do_object, do_array, do_boxed;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
198
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
199 // signature points to '(' at entry
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
200 #ifdef ASSERT
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
201 __ lbz(sig_byte, 0, signature);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
202 __ cmplwi(CCR0, sig_byte, '(');
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
203 __ bne(CCR0, do_dontreachhere);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
204 #endif
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
205
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
206 __ bind(loop_start);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
207
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
208 __ addi(argcnt, argcnt, 1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
209 __ lbzu(sig_byte, 1, signature);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
210
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
211 __ cmplwi(CCR0, sig_byte, ')'); // end of signature
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
212 __ beq(CCR0, loop_end);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
213
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
214 __ cmplwi(CCR0, sig_byte, 'B'); // byte
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
215 __ beq(CCR0, do_int);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
216
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
217 __ cmplwi(CCR0, sig_byte, 'C'); // char
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
218 __ beq(CCR0, do_int);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
219
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
220 __ cmplwi(CCR0, sig_byte, 'D'); // double
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
221 __ beq(CCR0, do_double);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
222
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
223 __ cmplwi(CCR0, sig_byte, 'F'); // float
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
224 __ beq(CCR0, do_float);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
225
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
226 __ cmplwi(CCR0, sig_byte, 'I'); // int
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
227 __ beq(CCR0, do_int);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
228
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
229 __ cmplwi(CCR0, sig_byte, 'J'); // long
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
230 __ beq(CCR0, do_long);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
231
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
232 __ cmplwi(CCR0, sig_byte, 'S'); // short
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
233 __ beq(CCR0, do_int);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
234
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
235 __ cmplwi(CCR0, sig_byte, 'Z'); // boolean
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
236 __ beq(CCR0, do_int);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
237
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
238 __ cmplwi(CCR0, sig_byte, 'L'); // object
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
239 __ beq(CCR0, do_object);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
240
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
241 __ cmplwi(CCR0, sig_byte, '['); // array
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
242 __ beq(CCR0, do_array);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
243
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
244 // __ cmplwi(CCR0, sig_byte, 'V'); // void cannot appear since we do not parse the return type
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
245 // __ beq(CCR0, do_void);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
246
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
247 __ bind(do_dontreachhere);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
248
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
249 __ unimplemented("ShouldNotReachHere in slow_signature_handler", 120);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
250
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
251 __ bind(do_array);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
252
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
253 {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
254 Label start_skip, end_skip;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
255
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
256 __ bind(start_skip);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
257 __ lbzu(sig_byte, 1, signature);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
258 __ cmplwi(CCR0, sig_byte, '[');
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
259 __ beq(CCR0, start_skip); // skip further brackets
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
260 __ cmplwi(CCR0, sig_byte, '9');
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
261 __ bgt(CCR0, end_skip); // no optional size
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
262 __ cmplwi(CCR0, sig_byte, '0');
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
263 __ bge(CCR0, start_skip); // skip optional size
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
264 __ bind(end_skip);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
265
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
266 __ cmplwi(CCR0, sig_byte, 'L');
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
267 __ beq(CCR0, do_object); // for arrays of objects, the name of the object must be skipped
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
268 __ b(do_boxed); // otherwise, go directly to do_boxed
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
269 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
270
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
271 __ bind(do_object);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
272 {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
273 Label L;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
274 __ bind(L);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
275 __ lbzu(sig_byte, 1, signature);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
276 __ cmplwi(CCR0, sig_byte, ';');
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
277 __ bne(CCR0, L);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
278 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
279 // Need to box the Java object here, so we use arg_java (address of
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
280 // current Java stack slot) as argument and don't dereference it as
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
281 // in case of ints, floats, etc.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
282 Label do_null;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
283 __ bind(do_boxed);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
284 __ ld(R0,0, arg_java);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
285 __ cmpdi(CCR0, R0, 0);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
286 __ li(intSlot,0);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
287 __ beq(CCR0, do_null);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
288 __ mr(intSlot, arg_java);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
289 __ bind(do_null);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
290 __ std(intSlot, 0, arg_c);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
291 __ addi(arg_java, arg_java, -BytesPerWord);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
292 __ addi(arg_c, arg_c, BytesPerWord);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
293 __ cmplwi(CCR0, argcnt, max_int_register_arguments);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
294 __ blt(CCR0, move_intSlot_to_ARG);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
295 __ b(loop_start);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
296
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
297 __ bind(do_int);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
298 __ lwa(intSlot, 0, arg_java);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
299 __ std(intSlot, 0, arg_c);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
300 __ addi(arg_java, arg_java, -BytesPerWord);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
301 __ addi(arg_c, arg_c, BytesPerWord);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
302 __ cmplwi(CCR0, argcnt, max_int_register_arguments);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
303 __ blt(CCR0, move_intSlot_to_ARG);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
304 __ b(loop_start);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
305
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
306 __ bind(do_long);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
307 __ ld(intSlot, -BytesPerWord, arg_java);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
308 __ std(intSlot, 0, arg_c);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
309 __ addi(arg_java, arg_java, - 2 * BytesPerWord);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
310 __ addi(arg_c, arg_c, BytesPerWord);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
311 __ cmplwi(CCR0, argcnt, max_int_register_arguments);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
312 __ blt(CCR0, move_intSlot_to_ARG);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
313 __ b(loop_start);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
314
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
315 __ bind(do_float);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
316 __ lfs(floatSlot, 0, arg_java);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
317 #if defined(LINUX)
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
318 __ stfs(floatSlot, 4, arg_c);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
319 #elif defined(AIX)
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
320 __ stfs(floatSlot, 0, arg_c);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
321 #else
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
322 #error "unknown OS"
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
323 #endif
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
324 __ addi(arg_java, arg_java, -BytesPerWord);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
325 __ addi(arg_c, arg_c, BytesPerWord);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
326 __ cmplwi(CCR0, fpcnt, max_fp_register_arguments);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
327 __ blt(CCR0, move_floatSlot_to_FARG);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
328 __ b(loop_start);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
329
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
330 __ bind(do_double);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
331 __ lfd(floatSlot, - BytesPerWord, arg_java);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
332 __ stfd(floatSlot, 0, arg_c);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
333 __ addi(arg_java, arg_java, - 2 * BytesPerWord);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
334 __ addi(arg_c, arg_c, BytesPerWord);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
335 __ cmplwi(CCR0, fpcnt, max_fp_register_arguments);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
336 __ blt(CCR0, move_floatSlot_to_FARG);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
337 __ b(loop_start);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
338
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
339 __ bind(loop_end);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
340
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
341 __ pop_frame();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
342 __ restore_nonvolatile_gprs(R1_SP, _spill_nonvolatiles_neg(r14));
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
343 __ restore_LR_CR(R0);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
344
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
345 __ blr();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
346
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
347 Label move_int_arg, move_float_arg;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
348 __ bind(move_int_arg); // each case must consist of 2 instructions (otherwise adapt LogSizeOfTwoInstructions)
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
349 __ mr(R5_ARG3, intSlot); __ b(loop_start);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
350 __ mr(R6_ARG4, intSlot); __ b(loop_start);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
351 __ mr(R7_ARG5, intSlot); __ b(loop_start);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
352 __ mr(R8_ARG6, intSlot); __ b(loop_start);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
353 __ mr(R9_ARG7, intSlot); __ b(loop_start);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
354 __ mr(R10_ARG8, intSlot); __ b(loop_start);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
355
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
356 __ bind(move_float_arg); // each case must consist of 2 instructions (otherwise adapt LogSizeOfTwoInstructions)
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
357 __ fmr(F1_ARG1, floatSlot); __ b(loop_start);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
358 __ fmr(F2_ARG2, floatSlot); __ b(loop_start);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
359 __ fmr(F3_ARG3, floatSlot); __ b(loop_start);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
360 __ fmr(F4_ARG4, floatSlot); __ b(loop_start);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
361 __ fmr(F5_ARG5, floatSlot); __ b(loop_start);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
362 __ fmr(F6_ARG6, floatSlot); __ b(loop_start);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
363 __ fmr(F7_ARG7, floatSlot); __ b(loop_start);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
364 __ fmr(F8_ARG8, floatSlot); __ b(loop_start);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
365 __ fmr(F9_ARG9, floatSlot); __ b(loop_start);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
366 __ fmr(F10_ARG10, floatSlot); __ b(loop_start);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
367 __ fmr(F11_ARG11, floatSlot); __ b(loop_start);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
368 __ fmr(F12_ARG12, floatSlot); __ b(loop_start);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
369 __ fmr(F13_ARG13, floatSlot); __ b(loop_start);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
370
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
371 __ bind(move_intSlot_to_ARG);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
372 __ sldi(R0, argcnt, LogSizeOfTwoInstructions);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
373 __ load_const(R11_scratch1, move_int_arg); // Label must be bound here.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
374 __ add(R11_scratch1, R0, R11_scratch1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
375 __ mtctr(R11_scratch1/*branch_target*/);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
376 __ bctr();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
377 __ bind(move_floatSlot_to_FARG);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
378 __ sldi(R0, fpcnt, LogSizeOfTwoInstructions);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
379 __ addi(fpcnt, fpcnt, 1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
380 __ load_const(R11_scratch1, move_float_arg); // Label must be bound here.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
381 __ add(R11_scratch1, R0, R11_scratch1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
382 __ mtctr(R11_scratch1/*branch_target*/);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
383 __ bctr();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
384
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
385 return entry;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
386 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
387
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
388 address AbstractInterpreterGenerator::generate_result_handler_for(BasicType type) {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
389 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
390 // Registers alive
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
391 // R3_RET
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
392 // LR
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
393 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
394 // Registers updated
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
395 // R3_RET
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
396 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
397
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
398 Label done;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
399 address entry = __ pc();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
400
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
401 switch (type) {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
402 case T_BOOLEAN:
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
403 // convert !=0 to 1
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
404 __ neg(R0, R3_RET);
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
405 __ orr(R0, R3_RET, R0);
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
406 __ srwi(R3_RET, R0, 31);
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
407 break;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
408 case T_BYTE:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
409 // sign extend 8 bits
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
410 __ extsb(R3_RET, R3_RET);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
411 break;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
412 case T_CHAR:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
413 // zero extend 16 bits
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
414 __ clrldi(R3_RET, R3_RET, 48);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
415 break;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
416 case T_SHORT:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
417 // sign extend 16 bits
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
418 __ extsh(R3_RET, R3_RET);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
419 break;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
420 case T_INT:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
421 // sign extend 32 bits
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
422 __ extsw(R3_RET, R3_RET);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
423 break;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
424 case T_LONG:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
425 break;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
426 case T_OBJECT:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
427 // unbox result if not null
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
428 __ cmpdi(CCR0, R3_RET, 0);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
429 __ beq(CCR0, done);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
430 __ ld(R3_RET, 0, R3_RET);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
431 __ verify_oop(R3_RET);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
432 break;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
433 case T_FLOAT:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
434 break;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
435 case T_DOUBLE:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
436 break;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
437 case T_VOID:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
438 break;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
439 default: ShouldNotReachHere();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
440 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
441
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
442 __ BIND(done);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
443 __ blr();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
444
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
445 return entry;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
446 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
447
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
448 // Abstract method entry.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
449 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
450 address InterpreterGenerator::generate_abstract_entry(void) {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
451 address entry = __ pc();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
452
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
453 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
454 // Registers alive
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
455 // R16_thread - JavaThread*
14726
92aa6797d639 Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents: 14694
diff changeset
456 // R19_method - callee's methodOop (method to be invoked)
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
457 // R1_SP - SP prepared such that caller's outgoing args are near top
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
458 // LR - return address to caller
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
459 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
460 // Stack layout at this point:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
461 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
462 // 0 [TOP_IJAVA_FRAME_ABI] <-- R1_SP
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
463 // alignment (optional)
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
464 // [outgoing Java arguments]
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
465 // ...
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
466 // PARENT [PARENT_IJAVA_FRAME_ABI]
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
467 // ...
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
468 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
469
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
470 // Can't use call_VM here because we have not set up a new
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
471 // interpreter state. Make the call to the vm and make it look like
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
472 // our caller set up the JavaFrameAnchor.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
473 __ set_top_ijava_frame_at_SP_as_last_Java_frame(R1_SP, R12_scratch2/*tmp*/);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
474
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
475 // Push a new C frame and save LR.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
476 __ save_LR_CR(R0);
14726
92aa6797d639 Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents: 14694
diff changeset
477 __ push_frame_abi112(0, R11_scratch1);
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
478
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
479 // This is not a leaf but we have a JavaFrameAnchor now and we will
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
480 // check (create) exceptions afterward so this is ok.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
481 __ call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_AbstractMethodError));
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
482
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
483 // Pop the C frame and restore LR.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
484 __ pop_frame();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
485 __ restore_LR_CR(R0);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
486
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
487 // Reset JavaFrameAnchor from call_VM_leaf above.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
488 __ reset_last_Java_frame();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
489
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
490 #ifdef CC_INTERP
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
491 // Return to frame manager, it will handle the pending exception.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
492 __ blr();
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
493 #else
14726
92aa6797d639 Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents: 14694
diff changeset
494 Unimplemented();
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
495 #endif
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
496
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
497 return entry;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
498 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
499
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
500 // Call an accessor method (assuming it is resolved, otherwise drop into
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
501 // vanilla (slow path) entry.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
502 address InterpreterGenerator::generate_accessor_entry(void) {
14726
92aa6797d639 Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents: 14694
diff changeset
503 if(!UseFastAccessorMethods && (!FLAG_IS_ERGO(UseFastAccessorMethods)))
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
504 return NULL;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
505
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
506 Label Lslow_path, Lacquire;
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
507
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
508 const Register
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
509 Rclass_or_obj = R3_ARG1,
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
510 Rconst_method = R4_ARG2,
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
511 Rcodes = Rconst_method,
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
512 Rcpool_cache = R5_ARG3,
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
513 Rscratch = R11_scratch1,
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
514 Rjvmti_mode = Rscratch,
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
515 Roffset = R12_scratch2,
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
516 Rflags = R6_ARG4,
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
517 Rbtable = R7_ARG5;
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
518
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
519 static address branch_table[number_of_states];
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
520
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
521 address entry = __ pc();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
522
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
523 // Check for safepoint:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
524 // Ditch this, real man don't need safepoint checks.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
525
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
526 // Also check for JVMTI mode
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
527 // Check for null obj, take slow path if so.
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
528 __ ld(Rclass_or_obj, Interpreter::stackElementSize, CC_INTERP_ONLY(R17_tos) NOT_CC_INTERP(R15_esp));
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
529 __ lwz(Rjvmti_mode, thread_(interp_only_mode));
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
530 __ cmpdi(CCR1, Rclass_or_obj, 0);
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
531 __ cmpwi(CCR0, Rjvmti_mode, 0);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
532 __ crorc(/*CCR0 eq*/2, /*CCR1 eq*/4+2, /*CCR0 eq*/2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
533 __ beq(CCR0, Lslow_path); // this==null or jvmti_mode!=0
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
534
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
535 // Do 2 things in parallel:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
536 // 1. Load the index out of the first instruction word, which looks like this:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
537 // <0x2a><0xb4><index (2 byte, native endianess)>.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
538 // 2. Load constant pool cache base.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
539 __ ld(Rconst_method, in_bytes(Method::const_offset()), R19_method);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
540 __ ld(Rcpool_cache, in_bytes(ConstMethod::constants_offset()), Rconst_method);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
541
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
542 __ lhz(Rcodes, in_bytes(ConstMethod::codes_offset()) + 2, Rconst_method); // Lower half of 32 bit field.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
543 __ ld(Rcpool_cache, ConstantPool::cache_offset_in_bytes(), Rcpool_cache);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
544
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
545 // Get the const pool entry by means of <index>.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
546 const int codes_shift = exact_log2(in_words(ConstantPoolCacheEntry::size()) * BytesPerWord);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
547 __ slwi(Rscratch, Rcodes, codes_shift); // (codes&0xFFFF)<<codes_shift
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
548 __ add(Rcpool_cache, Rscratch, Rcpool_cache);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
549
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
550 // Check if cpool cache entry is resolved.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
551 // We are resolved if the indices offset contains the current bytecode.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
552 ByteSize cp_base_offset = ConstantPoolCache::base_offset();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
553 // Big Endian:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
554 __ lbz(Rscratch, in_bytes(cp_base_offset) + in_bytes(ConstantPoolCacheEntry::indices_offset()) + 7 - 2, Rcpool_cache);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
555 __ cmpwi(CCR0, Rscratch, Bytecodes::_getfield);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
556 __ bne(CCR0, Lslow_path);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
557 __ isync(); // Order succeeding loads wrt. load of _indices field from cpool_cache.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
558
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
559 // Finally, start loading the value: Get cp cache entry into regs.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
560 __ ld(Rflags, in_bytes(cp_base_offset) + in_bytes(ConstantPoolCacheEntry::flags_offset()), Rcpool_cache);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
561 __ ld(Roffset, in_bytes(cp_base_offset) + in_bytes(ConstantPoolCacheEntry::f2_offset()), Rcpool_cache);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
562
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
563 // Following code is from templateTable::getfield_or_static
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
564 // Load pointer to branch table
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
565 __ load_const_optimized(Rbtable, (address)branch_table, Rscratch);
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
566
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
567 // Get volatile flag
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
568 __ rldicl(Rscratch, Rflags, 64-ConstantPoolCacheEntry::is_volatile_shift, 63); // extract volatile bit
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
569 // note: sync is needed before volatile load on PPC64
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
570
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
571 // Check field type
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
572 __ rldicl(Rflags, Rflags, 64-ConstantPoolCacheEntry::tos_state_shift, 64-ConstantPoolCacheEntry::tos_state_bits);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
573
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
574 #ifdef ASSERT
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
575 Label LFlagInvalid;
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
576 __ cmpldi(CCR0, Rflags, number_of_states);
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
577 __ bge(CCR0, LFlagInvalid);
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
578
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
579 __ ld(R9_ARG7, 0, R1_SP);
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
580 __ ld(R10_ARG8, 0, R21_sender_SP);
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
581 __ cmpd(CCR0, R9_ARG7, R10_ARG8);
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
582 __ asm_assert_eq("backlink", 0x543);
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
583 #endif // ASSERT
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
584 __ mr(R1_SP, R21_sender_SP); // Cut the stack back to where the caller started.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
585
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
586 // Load from branch table and dispatch (volatile case: one instruction ahead)
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
587 __ sldi(Rflags, Rflags, LogBytesPerWord);
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
588 __ cmpwi(CCR6, Rscratch, 1); // volatile?
14726
92aa6797d639 Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents: 14694
diff changeset
589 __ sldi(Rscratch, Rscratch, exact_log2(BytesPerInstWord)); // volatile ? size of 1 instruction : 0
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
590 __ ldx(Rbtable, Rbtable, Rflags);
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
591
14726
92aa6797d639 Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents: 14694
diff changeset
592 __ subf(Rbtable, Rscratch, Rbtable); // point to volatile/non-volatile entry point
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
593 __ mtctr(Rbtable);
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
594 __ bctr();
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
595
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
596 #ifdef ASSERT
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
597 __ bind(LFlagInvalid);
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
598 __ stop("got invalid flag", 0x6541);
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
599
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
600 bool all_uninitialized = true,
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
601 all_initialized = true;
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
602 for (int i = 0; i<number_of_states; ++i) {
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
603 all_uninitialized = all_uninitialized && (branch_table[i] == NULL);
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
604 all_initialized = all_initialized && (branch_table[i] != NULL);
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
605 }
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
606 assert(all_uninitialized != all_initialized, "consistency"); // either or
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
607
14726
92aa6797d639 Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents: 14694
diff changeset
608 __ sync(); // volatile entry point (one instruction before non-volatile_entry point)
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
609 if (branch_table[vtos] == 0) branch_table[vtos] = __ pc(); // non-volatile_entry point
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
610 if (branch_table[dtos] == 0) branch_table[dtos] = __ pc(); // non-volatile_entry point
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
611 if (branch_table[ftos] == 0) branch_table[ftos] = __ pc(); // non-volatile_entry point
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
612 __ stop("unexpected type", 0x6551);
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
613 #endif
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
614
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
615 if (branch_table[itos] == 0) { // generate only once
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
616 __ align(32, 28, 28); // align load
14726
92aa6797d639 Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents: 14694
diff changeset
617 __ sync(); // volatile entry point (one instruction before non-volatile_entry point)
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
618 branch_table[itos] = __ pc(); // non-volatile_entry point
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
619 __ lwax(R3_RET, Rclass_or_obj, Roffset);
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
620 __ beq(CCR6, Lacquire);
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
621 __ blr();
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
622 }
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
623
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
624 if (branch_table[ltos] == 0) { // generate only once
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
625 __ align(32, 28, 28); // align load
14726
92aa6797d639 Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents: 14694
diff changeset
626 __ sync(); // volatile entry point (one instruction before non-volatile_entry point)
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
627 branch_table[ltos] = __ pc(); // non-volatile_entry point
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
628 __ ldx(R3_RET, Rclass_or_obj, Roffset);
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
629 __ beq(CCR6, Lacquire);
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
630 __ blr();
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
631 }
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
632
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
633 if (branch_table[btos] == 0) { // generate only once
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
634 __ align(32, 28, 28); // align load
14726
92aa6797d639 Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents: 14694
diff changeset
635 __ sync(); // volatile entry point (one instruction before non-volatile_entry point)
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
636 branch_table[btos] = __ pc(); // non-volatile_entry point
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
637 __ lbzx(R3_RET, Rclass_or_obj, Roffset);
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
638 __ extsb(R3_RET, R3_RET);
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
639 __ beq(CCR6, Lacquire);
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
640 __ blr();
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
641 }
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
642
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
643 if (branch_table[ctos] == 0) { // generate only once
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
644 __ align(32, 28, 28); // align load
14726
92aa6797d639 Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents: 14694
diff changeset
645 __ sync(); // volatile entry point (one instruction before non-volatile_entry point)
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
646 branch_table[ctos] = __ pc(); // non-volatile_entry point
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
647 __ lhzx(R3_RET, Rclass_or_obj, Roffset);
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
648 __ beq(CCR6, Lacquire);
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
649 __ blr();
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
650 }
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
651
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
652 if (branch_table[stos] == 0) { // generate only once
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
653 __ align(32, 28, 28); // align load
14726
92aa6797d639 Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents: 14694
diff changeset
654 __ sync(); // volatile entry point (one instruction before non-volatile_entry point)
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
655 branch_table[stos] = __ pc(); // non-volatile_entry point
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
656 __ lhax(R3_RET, Rclass_or_obj, Roffset);
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
657 __ beq(CCR6, Lacquire);
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
658 __ blr();
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
659 }
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
660
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
661 if (branch_table[atos] == 0) { // generate only once
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
662 __ align(32, 28, 28); // align load
14726
92aa6797d639 Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents: 14694
diff changeset
663 __ sync(); // volatile entry point (one instruction before non-volatile_entry point)
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
664 branch_table[atos] = __ pc(); // non-volatile_entry point
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
665 __ load_heap_oop(R3_RET, (RegisterOrConstant)Roffset, Rclass_or_obj);
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
666 __ verify_oop(R3_RET);
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
667 //__ dcbt(R3_RET); // prefetch
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
668 __ beq(CCR6, Lacquire);
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
669 __ blr();
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
670 }
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
671
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
672 __ align(32, 12);
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
673 __ bind(Lacquire);
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
674 __ twi_0(R3_RET);
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
675 __ isync(); // acquire
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
676 __ blr();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
677
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
678 #ifdef ASSERT
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
679 for (int i = 0; i<number_of_states; ++i) {
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
680 assert(branch_table[i], "accessor_entry initialization");
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
681 //tty->print_cr("accessor_entry: branch_table[%d] = 0x%llx (opcode 0x%llx)", i, branch_table[i], *((unsigned int*)branch_table[i]));
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
682 }
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
683 #endif
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
684
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
685 __ bind(Lslow_path);
14726
92aa6797d639 Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents: 14694
diff changeset
686 assert(Interpreter::entry_for_kind(Interpreter::zerolocals), "Normal entry must have been generated by now");
92aa6797d639 Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents: 14694
diff changeset
687 __ load_const_optimized(Rscratch, Interpreter::entry_for_kind(Interpreter::zerolocals), R0);
92aa6797d639 Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents: 14694
diff changeset
688 __ mtctr(Rscratch);
92aa6797d639 Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents: 14694
diff changeset
689 __ bctr();
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
690 __ flush();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
691
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
692 return entry;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
693 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
694
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
695 // Interpreter intrinsic for WeakReference.get().
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
696 // 1. Don't push a full blown frame and go on dispatching, but fetch the value
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
697 // into R8 and return quickly
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
698 // 2. If G1 is active we *must* execute this intrinsic for corrrectness:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
699 // It contains a GC barrier which puts the reference into the satb buffer
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
700 // to indicate that someone holds a strong reference to the object the
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
701 // weak ref points to!
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
702 address InterpreterGenerator::generate_Reference_get_entry(void) {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
703 // Code: _aload_0, _getfield, _areturn
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
704 // parameter size = 1
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
705 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
706 // The code that gets generated by this routine is split into 2 parts:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
707 // 1. the "intrinsified" code for G1 (or any SATB based GC),
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
708 // 2. the slow path - which is an expansion of the regular method entry.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
709 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
710 // Notes:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
711 // * In the G1 code we do not check whether we need to block for
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
712 // a safepoint. If G1 is enabled then we must execute the specialized
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
713 // code for Reference.get (except when the Reference object is null)
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
714 // so that we can log the value in the referent field with an SATB
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
715 // update buffer.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
716 // If the code for the getfield template is modified so that the
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
717 // G1 pre-barrier code is executed when the current method is
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
718 // Reference.get() then going through the normal method entry
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
719 // will be fine.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
720 // * The G1 code can, however, check the receiver object (the instance
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
721 // of java.lang.Reference) and jump to the slow path if null. If the
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
722 // Reference object is null then we obviously cannot fetch the referent
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
723 // and so we don't need to call the G1 pre-barrier. Thus we can use the
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
724 // regular method entry code to generate the NPE.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
725 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
726 // This code is based on generate_accessor_enty.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
727
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
728 address entry = __ pc();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
729
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
730 const int referent_offset = java_lang_ref_Reference::referent_offset;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
731 guarantee(referent_offset > 0, "referent offset not initialized");
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
732
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
733 if (UseG1GC) {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
734 Label slow_path;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
735
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
736 // Debugging not possible, so can't use __ skip_if_jvmti_mode(slow_path, GR31_SCRATCH);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
737
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
738 // In the G1 code we don't check if we need to reach a safepoint. We
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
739 // continue and the thread will safepoint at the next bytecode dispatch.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
740
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
741 // If the receiver is null then it is OK to jump to the slow path.
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
742 __ ld(R3_RET, Interpreter::stackElementSize, CC_INTERP_ONLY(R17_tos) NOT_CC_INTERP(R15_esp)); // get receiver
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
743
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
744 // Check if receiver == NULL and go the slow path.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
745 __ cmpdi(CCR0, R3_RET, 0);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
746 __ beq(CCR0, slow_path);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
747
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
748 // Load the value of the referent field.
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
749 __ load_heap_oop(R3_RET, referent_offset, R3_RET);
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
750
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
751 // Generate the G1 pre-barrier code to log the value of
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
752 // the referent field in an SATB buffer. Note with
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
753 // these parameters the pre-barrier does not generate
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
754 // the load of the previous value.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
755
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
756 // Restore caller sp for c2i case.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
757 #ifdef ASSERT
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
758 __ ld(R9_ARG7, 0, R1_SP);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
759 __ ld(R10_ARG8, 0, R21_sender_SP);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
760 __ cmpd(CCR0, R9_ARG7, R10_ARG8);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
761 __ asm_assert_eq("backlink", 0x544);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
762 #endif // ASSERT
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
763 __ mr(R1_SP, R21_sender_SP); // Cut the stack back to where the caller started.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
764
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
765 __ g1_write_barrier_pre(noreg, // obj
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
766 noreg, // offset
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
767 R3_RET, // pre_val
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
768 R11_scratch1, // tmp
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
769 R12_scratch2, // tmp
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
770 true); // needs_frame
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
771
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
772 __ blr();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
773
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
774 // Generate regular method entry.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
775 __ bind(slow_path);
14726
92aa6797d639 Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents: 14694
diff changeset
776 assert(Interpreter::entry_for_kind(Interpreter::zerolocals), "Normal entry must have been generated by now");
92aa6797d639 Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents: 14694
diff changeset
777 __ load_const_optimized(R11_scratch1, Interpreter::entry_for_kind(Interpreter::zerolocals), R0);
92aa6797d639 Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents: 14694
diff changeset
778 __ mtctr(R11_scratch1);
92aa6797d639 Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents: 14694
diff changeset
779 __ bctr();
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
780 __ flush();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
781
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
782 return entry;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
783 } else {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
784 return generate_accessor_entry();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
785 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
786 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
787
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
788 void Deoptimization::unwind_callee_save_values(frame* f, vframeArray* vframe_array) {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
789 // This code is sort of the equivalent of C2IAdapter::setup_stack_frame back in
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
790 // the days we had adapter frames. When we deoptimize a situation where a
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
791 // compiled caller calls a compiled caller will have registers it expects
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
792 // to survive the call to the callee. If we deoptimize the callee the only
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
793 // way we can restore these registers is to have the oldest interpreter
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
794 // frame that we create restore these values. That is what this routine
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
795 // will accomplish.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
796
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
797 // At the moment we have modified c2 to not have any callee save registers
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
798 // so this problem does not exist and this routine is just a place holder.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
799
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
800 assert(f->is_interpreted_frame(), "must be interpreted");
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
801 }