annotate src/cpu/sparc/vm/interpreter_sparc.cpp @ 6812:988bf00cc564

7200261: G1: Liveness counting inconsistencies during marking verification Summary: The clipping code in the routine that sets the bits for a range of cards, in the liveness accounting verification code was incorrect. It set all the bits in the card bitmap from the given starting index which would lead to spurious marking verification failures. Reviewed-by: brutisso, jwilhelm, jmasa
author johnc
date Thu, 27 Sep 2012 15:44:01 -0700
parents da91efe96a93
children f0c2369fda5a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6266
diff changeset
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1503
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1503
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1503
diff changeset
21 * questions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
25 #include "precompiled.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
26 #include "asm/assembler.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
27 #include "interpreter/bytecodeHistogram.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
28 #include "interpreter/interpreter.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
29 #include "interpreter/interpreterGenerator.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
30 #include "interpreter/interpreterRuntime.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
31 #include "interpreter/templateTable.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
32 #include "oops/arrayOop.hpp"
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6266
diff changeset
33 #include "oops/methodData.hpp"
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6266
diff changeset
34 #include "oops/method.hpp"
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
35 #include "oops/oop.inline.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
36 #include "prims/jvmtiExport.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
37 #include "prims/jvmtiThreadState.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
38 #include "prims/methodHandles.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
39 #include "runtime/arguments.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
40 #include "runtime/deoptimization.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
41 #include "runtime/frame.inline.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
42 #include "runtime/sharedRuntime.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
43 #include "runtime/stubRoutines.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
44 #include "runtime/synchronizer.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
45 #include "runtime/timer.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
46 #include "runtime/vframeArray.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
47 #include "utilities/debug.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
48 #ifdef COMPILER1
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
49 #include "c1/c1_Runtime1.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
50 #endif
0
a61af66fc99e Initial load
duke
parents:
diff changeset
51
a61af66fc99e Initial load
duke
parents:
diff changeset
52
a61af66fc99e Initial load
duke
parents:
diff changeset
53
a61af66fc99e Initial load
duke
parents:
diff changeset
54 // Generation of Interpreter
a61af66fc99e Initial load
duke
parents:
diff changeset
55 //
a61af66fc99e Initial load
duke
parents:
diff changeset
56 // The InterpreterGenerator generates the interpreter into Interpreter::_code.
a61af66fc99e Initial load
duke
parents:
diff changeset
57
a61af66fc99e Initial load
duke
parents:
diff changeset
58
a61af66fc99e Initial load
duke
parents:
diff changeset
59 #define __ _masm->
a61af66fc99e Initial load
duke
parents:
diff changeset
60
a61af66fc99e Initial load
duke
parents:
diff changeset
61
a61af66fc99e Initial load
duke
parents:
diff changeset
62 //----------------------------------------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
63
a61af66fc99e Initial load
duke
parents:
diff changeset
64
a61af66fc99e Initial load
duke
parents:
diff changeset
65
a61af66fc99e Initial load
duke
parents:
diff changeset
66
a61af66fc99e Initial load
duke
parents:
diff changeset
67 int AbstractInterpreter::BasicType_as_index(BasicType type) {
a61af66fc99e Initial load
duke
parents:
diff changeset
68 int i = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
69 switch (type) {
a61af66fc99e Initial load
duke
parents:
diff changeset
70 case T_BOOLEAN: i = 0; break;
a61af66fc99e Initial load
duke
parents:
diff changeset
71 case T_CHAR : i = 1; break;
a61af66fc99e Initial load
duke
parents:
diff changeset
72 case T_BYTE : i = 2; break;
a61af66fc99e Initial load
duke
parents:
diff changeset
73 case T_SHORT : i = 3; break;
a61af66fc99e Initial load
duke
parents:
diff changeset
74 case T_INT : i = 4; break;
a61af66fc99e Initial load
duke
parents:
diff changeset
75 case T_LONG : i = 5; break;
a61af66fc99e Initial load
duke
parents:
diff changeset
76 case T_VOID : i = 6; break;
a61af66fc99e Initial load
duke
parents:
diff changeset
77 case T_FLOAT : i = 7; break;
a61af66fc99e Initial load
duke
parents:
diff changeset
78 case T_DOUBLE : i = 8; break;
a61af66fc99e Initial load
duke
parents:
diff changeset
79 case T_OBJECT : i = 9; break;
a61af66fc99e Initial load
duke
parents:
diff changeset
80 case T_ARRAY : i = 9; break;
a61af66fc99e Initial load
duke
parents:
diff changeset
81 default : ShouldNotReachHere();
a61af66fc99e Initial load
duke
parents:
diff changeset
82 }
a61af66fc99e Initial load
duke
parents:
diff changeset
83 assert(0 <= i && i < AbstractInterpreter::number_of_result_handlers, "index out of bounds");
a61af66fc99e Initial load
duke
parents:
diff changeset
84 return i;
a61af66fc99e Initial load
duke
parents:
diff changeset
85 }
a61af66fc99e Initial load
duke
parents:
diff changeset
86
a61af66fc99e Initial load
duke
parents:
diff changeset
87
a61af66fc99e Initial load
duke
parents:
diff changeset
88 #ifndef _LP64
a61af66fc99e Initial load
duke
parents:
diff changeset
89 address AbstractInterpreterGenerator::generate_slow_signature_handler() {
a61af66fc99e Initial load
duke
parents:
diff changeset
90 address entry = __ pc();
a61af66fc99e Initial load
duke
parents:
diff changeset
91 Argument argv(0, true);
a61af66fc99e Initial load
duke
parents:
diff changeset
92
a61af66fc99e Initial load
duke
parents:
diff changeset
93 // We are in the jni transition frame. Save the last_java_frame corresponding to the
a61af66fc99e Initial load
duke
parents:
diff changeset
94 // outer interpreter frame
a61af66fc99e Initial load
duke
parents:
diff changeset
95 //
a61af66fc99e Initial load
duke
parents:
diff changeset
96 __ set_last_Java_frame(FP, noreg);
a61af66fc99e Initial load
duke
parents:
diff changeset
97 // make sure the interpreter frame we've pushed has a valid return pc
a61af66fc99e Initial load
duke
parents:
diff changeset
98 __ mov(O7, I7);
a61af66fc99e Initial load
duke
parents:
diff changeset
99 __ mov(Lmethod, G3_scratch);
a61af66fc99e Initial load
duke
parents:
diff changeset
100 __ mov(Llocals, G4_scratch);
a61af66fc99e Initial load
duke
parents:
diff changeset
101 __ save_frame(0);
a61af66fc99e Initial load
duke
parents:
diff changeset
102 __ mov(G2_thread, L7_thread_cache);
a61af66fc99e Initial load
duke
parents:
diff changeset
103 __ add(argv.address_in_frame(), O3);
a61af66fc99e Initial load
duke
parents:
diff changeset
104 __ mov(G2_thread, O0);
a61af66fc99e Initial load
duke
parents:
diff changeset
105 __ mov(G3_scratch, O1);
a61af66fc99e Initial load
duke
parents:
diff changeset
106 __ call(CAST_FROM_FN_PTR(address, InterpreterRuntime::slow_signature_handler), relocInfo::runtime_call_type);
a61af66fc99e Initial load
duke
parents:
diff changeset
107 __ delayed()->mov(G4_scratch, O2);
a61af66fc99e Initial load
duke
parents:
diff changeset
108 __ mov(L7_thread_cache, G2_thread);
a61af66fc99e Initial load
duke
parents:
diff changeset
109 __ reset_last_Java_frame();
a61af66fc99e Initial load
duke
parents:
diff changeset
110
a61af66fc99e Initial load
duke
parents:
diff changeset
111 // load the register arguments (the C code packed them as varargs)
a61af66fc99e Initial load
duke
parents:
diff changeset
112 for (Argument ldarg = argv.successor(); ldarg.is_register(); ldarg = ldarg.successor()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
113 __ ld_ptr(ldarg.address_in_frame(), ldarg.as_register());
a61af66fc99e Initial load
duke
parents:
diff changeset
114 }
a61af66fc99e Initial load
duke
parents:
diff changeset
115 __ ret();
a61af66fc99e Initial load
duke
parents:
diff changeset
116 __ delayed()->
a61af66fc99e Initial load
duke
parents:
diff changeset
117 restore(O0, 0, Lscratch); // caller's Lscratch gets the result handler
a61af66fc99e Initial load
duke
parents:
diff changeset
118 return entry;
a61af66fc99e Initial load
duke
parents:
diff changeset
119 }
a61af66fc99e Initial load
duke
parents:
diff changeset
120
a61af66fc99e Initial load
duke
parents:
diff changeset
121
a61af66fc99e Initial load
duke
parents:
diff changeset
122 #else
a61af66fc99e Initial load
duke
parents:
diff changeset
123 // LP64 passes floating point arguments in F1, F3, F5, etc. instead of
a61af66fc99e Initial load
duke
parents:
diff changeset
124 // O0, O1, O2 etc..
a61af66fc99e Initial load
duke
parents:
diff changeset
125 // Doubles are passed in D0, D2, D4
a61af66fc99e Initial load
duke
parents:
diff changeset
126 // We store the signature of the first 16 arguments in the first argument
a61af66fc99e Initial load
duke
parents:
diff changeset
127 // slot because it will be overwritten prior to calling the native
a61af66fc99e Initial load
duke
parents:
diff changeset
128 // function, with the pointer to the JNIEnv.
a61af66fc99e Initial load
duke
parents:
diff changeset
129 // If LP64 there can be up to 16 floating point arguments in registers
a61af66fc99e Initial load
duke
parents:
diff changeset
130 // or 6 integer registers.
a61af66fc99e Initial load
duke
parents:
diff changeset
131 address AbstractInterpreterGenerator::generate_slow_signature_handler() {
a61af66fc99e Initial load
duke
parents:
diff changeset
132
a61af66fc99e Initial load
duke
parents:
diff changeset
133 enum {
a61af66fc99e Initial load
duke
parents:
diff changeset
134 non_float = 0,
a61af66fc99e Initial load
duke
parents:
diff changeset
135 float_sig = 1,
a61af66fc99e Initial load
duke
parents:
diff changeset
136 double_sig = 2,
a61af66fc99e Initial load
duke
parents:
diff changeset
137 sig_mask = 3
a61af66fc99e Initial load
duke
parents:
diff changeset
138 };
a61af66fc99e Initial load
duke
parents:
diff changeset
139
a61af66fc99e Initial load
duke
parents:
diff changeset
140 address entry = __ pc();
a61af66fc99e Initial load
duke
parents:
diff changeset
141 Argument argv(0, true);
a61af66fc99e Initial load
duke
parents:
diff changeset
142
a61af66fc99e Initial load
duke
parents:
diff changeset
143 // We are in the jni transition frame. Save the last_java_frame corresponding to the
a61af66fc99e Initial load
duke
parents:
diff changeset
144 // outer interpreter frame
a61af66fc99e Initial load
duke
parents:
diff changeset
145 //
a61af66fc99e Initial load
duke
parents:
diff changeset
146 __ set_last_Java_frame(FP, noreg);
a61af66fc99e Initial load
duke
parents:
diff changeset
147 // make sure the interpreter frame we've pushed has a valid return pc
a61af66fc99e Initial load
duke
parents:
diff changeset
148 __ mov(O7, I7);
a61af66fc99e Initial load
duke
parents:
diff changeset
149 __ mov(Lmethod, G3_scratch);
a61af66fc99e Initial load
duke
parents:
diff changeset
150 __ mov(Llocals, G4_scratch);
a61af66fc99e Initial load
duke
parents:
diff changeset
151 __ save_frame(0);
a61af66fc99e Initial load
duke
parents:
diff changeset
152 __ mov(G2_thread, L7_thread_cache);
a61af66fc99e Initial load
duke
parents:
diff changeset
153 __ add(argv.address_in_frame(), O3);
a61af66fc99e Initial load
duke
parents:
diff changeset
154 __ mov(G2_thread, O0);
a61af66fc99e Initial load
duke
parents:
diff changeset
155 __ mov(G3_scratch, O1);
a61af66fc99e Initial load
duke
parents:
diff changeset
156 __ call(CAST_FROM_FN_PTR(address, InterpreterRuntime::slow_signature_handler), relocInfo::runtime_call_type);
a61af66fc99e Initial load
duke
parents:
diff changeset
157 __ delayed()->mov(G4_scratch, O2);
a61af66fc99e Initial load
duke
parents:
diff changeset
158 __ mov(L7_thread_cache, G2_thread);
a61af66fc99e Initial load
duke
parents:
diff changeset
159 __ reset_last_Java_frame();
a61af66fc99e Initial load
duke
parents:
diff changeset
160
a61af66fc99e Initial load
duke
parents:
diff changeset
161
a61af66fc99e Initial load
duke
parents:
diff changeset
162 // load the register arguments (the C code packed them as varargs)
a61af66fc99e Initial load
duke
parents:
diff changeset
163 Address Sig = argv.address_in_frame(); // Argument 0 holds the signature
a61af66fc99e Initial load
duke
parents:
diff changeset
164 __ ld_ptr( Sig, G3_scratch ); // Get register argument signature word into G3_scratch
a61af66fc99e Initial load
duke
parents:
diff changeset
165 __ mov( G3_scratch, G4_scratch);
a61af66fc99e Initial load
duke
parents:
diff changeset
166 __ srl( G4_scratch, 2, G4_scratch); // Skip Arg 0
a61af66fc99e Initial load
duke
parents:
diff changeset
167 Label done;
a61af66fc99e Initial load
duke
parents:
diff changeset
168 for (Argument ldarg = argv.successor(); ldarg.is_float_register(); ldarg = ldarg.successor()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
169 Label NonFloatArg;
a61af66fc99e Initial load
duke
parents:
diff changeset
170 Label LoadFloatArg;
a61af66fc99e Initial load
duke
parents:
diff changeset
171 Label LoadDoubleArg;
a61af66fc99e Initial load
duke
parents:
diff changeset
172 Label NextArg;
a61af66fc99e Initial load
duke
parents:
diff changeset
173 Address a = ldarg.address_in_frame();
a61af66fc99e Initial load
duke
parents:
diff changeset
174 __ andcc(G4_scratch, sig_mask, G3_scratch);
a61af66fc99e Initial load
duke
parents:
diff changeset
175 __ br(Assembler::zero, false, Assembler::pt, NonFloatArg);
a61af66fc99e Initial load
duke
parents:
diff changeset
176 __ delayed()->nop();
a61af66fc99e Initial load
duke
parents:
diff changeset
177
a61af66fc99e Initial load
duke
parents:
diff changeset
178 __ cmp(G3_scratch, float_sig );
a61af66fc99e Initial load
duke
parents:
diff changeset
179 __ br(Assembler::equal, false, Assembler::pt, LoadFloatArg);
a61af66fc99e Initial load
duke
parents:
diff changeset
180 __ delayed()->nop();
a61af66fc99e Initial load
duke
parents:
diff changeset
181
a61af66fc99e Initial load
duke
parents:
diff changeset
182 __ cmp(G3_scratch, double_sig );
a61af66fc99e Initial load
duke
parents:
diff changeset
183 __ br(Assembler::equal, false, Assembler::pt, LoadDoubleArg);
a61af66fc99e Initial load
duke
parents:
diff changeset
184 __ delayed()->nop();
a61af66fc99e Initial load
duke
parents:
diff changeset
185
a61af66fc99e Initial load
duke
parents:
diff changeset
186 __ bind(NonFloatArg);
a61af66fc99e Initial load
duke
parents:
diff changeset
187 // There are only 6 integer register arguments!
a61af66fc99e Initial load
duke
parents:
diff changeset
188 if ( ldarg.is_register() )
a61af66fc99e Initial load
duke
parents:
diff changeset
189 __ ld_ptr(ldarg.address_in_frame(), ldarg.as_register());
a61af66fc99e Initial load
duke
parents:
diff changeset
190 else {
a61af66fc99e Initial load
duke
parents:
diff changeset
191 // Optimization, see if there are any more args and get out prior to checking
a61af66fc99e Initial load
duke
parents:
diff changeset
192 // all 16 float registers. My guess is that this is rare.
a61af66fc99e Initial load
duke
parents:
diff changeset
193 // If is_register is false, then we are done the first six integer args.
3839
3d42f82cd811 7063628: Use cbcond on T4
kvn
parents: 3369
diff changeset
194 __ br_null_short(G4_scratch, Assembler::pt, done);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
195 }
3839
3d42f82cd811 7063628: Use cbcond on T4
kvn
parents: 3369
diff changeset
196 __ ba(NextArg);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
197 __ delayed()->srl( G4_scratch, 2, G4_scratch );
a61af66fc99e Initial load
duke
parents:
diff changeset
198
a61af66fc99e Initial load
duke
parents:
diff changeset
199 __ bind(LoadFloatArg);
a61af66fc99e Initial load
duke
parents:
diff changeset
200 __ ldf( FloatRegisterImpl::S, a, ldarg.as_float_register(), 4);
3839
3d42f82cd811 7063628: Use cbcond on T4
kvn
parents: 3369
diff changeset
201 __ ba(NextArg);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
202 __ delayed()->srl( G4_scratch, 2, G4_scratch );
a61af66fc99e Initial load
duke
parents:
diff changeset
203
a61af66fc99e Initial load
duke
parents:
diff changeset
204 __ bind(LoadDoubleArg);
a61af66fc99e Initial load
duke
parents:
diff changeset
205 __ ldf( FloatRegisterImpl::D, a, ldarg.as_double_register() );
3839
3d42f82cd811 7063628: Use cbcond on T4
kvn
parents: 3369
diff changeset
206 __ ba(NextArg);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
207 __ delayed()->srl( G4_scratch, 2, G4_scratch );
a61af66fc99e Initial load
duke
parents:
diff changeset
208
a61af66fc99e Initial load
duke
parents:
diff changeset
209 __ bind(NextArg);
a61af66fc99e Initial load
duke
parents:
diff changeset
210
a61af66fc99e Initial load
duke
parents:
diff changeset
211 }
a61af66fc99e Initial load
duke
parents:
diff changeset
212
a61af66fc99e Initial load
duke
parents:
diff changeset
213 __ bind(done);
a61af66fc99e Initial load
duke
parents:
diff changeset
214 __ ret();
a61af66fc99e Initial load
duke
parents:
diff changeset
215 __ delayed()->
a61af66fc99e Initial load
duke
parents:
diff changeset
216 restore(O0, 0, Lscratch); // caller's Lscratch gets the result handler
a61af66fc99e Initial load
duke
parents:
diff changeset
217 return entry;
a61af66fc99e Initial load
duke
parents:
diff changeset
218 }
a61af66fc99e Initial load
duke
parents:
diff changeset
219 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
220
a61af66fc99e Initial load
duke
parents:
diff changeset
221 void InterpreterGenerator::generate_counter_overflow(Label& Lcontinue) {
a61af66fc99e Initial load
duke
parents:
diff changeset
222
a61af66fc99e Initial load
duke
parents:
diff changeset
223 // Generate code to initiate compilation on the counter overflow.
a61af66fc99e Initial load
duke
parents:
diff changeset
224
a61af66fc99e Initial load
duke
parents:
diff changeset
225 // InterpreterRuntime::frequency_counter_overflow takes two arguments,
a61af66fc99e Initial load
duke
parents:
diff changeset
226 // the first indicates if the counter overflow occurs at a backwards branch (NULL bcp)
a61af66fc99e Initial load
duke
parents:
diff changeset
227 // and the second is only used when the first is true. We pass zero for both.
a61af66fc99e Initial load
duke
parents:
diff changeset
228 // The call returns the address of the verified entry point for the method or NULL
a61af66fc99e Initial load
duke
parents:
diff changeset
229 // if the compilation did not complete (either went background or bailed out).
a61af66fc99e Initial load
duke
parents:
diff changeset
230 __ set((int)false, O2);
a61af66fc99e Initial load
duke
parents:
diff changeset
231 __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::frequency_counter_overflow), O2, O2, true);
a61af66fc99e Initial load
duke
parents:
diff changeset
232 // returns verified_entry_point or NULL
a61af66fc99e Initial load
duke
parents:
diff changeset
233 // we ignore it in any case
3839
3d42f82cd811 7063628: Use cbcond on T4
kvn
parents: 3369
diff changeset
234 __ ba_short(Lcontinue);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
235
a61af66fc99e Initial load
duke
parents:
diff changeset
236 }
a61af66fc99e Initial load
duke
parents:
diff changeset
237
a61af66fc99e Initial load
duke
parents:
diff changeset
238
a61af66fc99e Initial load
duke
parents:
diff changeset
239 // End of helpers
a61af66fc99e Initial load
duke
parents:
diff changeset
240
a61af66fc99e Initial load
duke
parents:
diff changeset
241 // Various method entries
a61af66fc99e Initial load
duke
parents:
diff changeset
242
a61af66fc99e Initial load
duke
parents:
diff changeset
243 // Abstract method entry
a61af66fc99e Initial load
duke
parents:
diff changeset
244 // Attempt to execute abstract method. Throw exception
a61af66fc99e Initial load
duke
parents:
diff changeset
245 //
a61af66fc99e Initial load
duke
parents:
diff changeset
246 address InterpreterGenerator::generate_abstract_entry(void) {
a61af66fc99e Initial load
duke
parents:
diff changeset
247 address entry = __ pc();
a61af66fc99e Initial load
duke
parents:
diff changeset
248 // abstract method entry
a61af66fc99e Initial load
duke
parents:
diff changeset
249 // throw exception
a61af66fc99e Initial load
duke
parents:
diff changeset
250 __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_AbstractMethodError));
a61af66fc99e Initial load
duke
parents:
diff changeset
251 // the call_VM checks for exception, so we should never return here.
a61af66fc99e Initial load
duke
parents:
diff changeset
252 __ should_not_reach_here();
a61af66fc99e Initial load
duke
parents:
diff changeset
253 return entry;
a61af66fc99e Initial load
duke
parents:
diff changeset
254
a61af66fc99e Initial load
duke
parents:
diff changeset
255 }
a61af66fc99e Initial load
duke
parents:
diff changeset
256
a61af66fc99e Initial load
duke
parents:
diff changeset
257
a61af66fc99e Initial load
duke
parents:
diff changeset
258 //----------------------------------------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
259 // Entry points & stack frame layout
a61af66fc99e Initial load
duke
parents:
diff changeset
260 //
a61af66fc99e Initial load
duke
parents:
diff changeset
261 // Here we generate the various kind of entries into the interpreter.
a61af66fc99e Initial load
duke
parents:
diff changeset
262 // The two main entry type are generic bytecode methods and native call method.
a61af66fc99e Initial load
duke
parents:
diff changeset
263 // These both come in synchronized and non-synchronized versions but the
a61af66fc99e Initial load
duke
parents:
diff changeset
264 // frame layout they create is very similar. The other method entry
a61af66fc99e Initial load
duke
parents:
diff changeset
265 // types are really just special purpose entries that are really entry
a61af66fc99e Initial load
duke
parents:
diff changeset
266 // and interpretation all in one. These are for trivial methods like
a61af66fc99e Initial load
duke
parents:
diff changeset
267 // accessor, empty, or special math methods.
a61af66fc99e Initial load
duke
parents:
diff changeset
268 //
a61af66fc99e Initial load
duke
parents:
diff changeset
269 // When control flow reaches any of the entry types for the interpreter
a61af66fc99e Initial load
duke
parents:
diff changeset
270 // the following holds ->
a61af66fc99e Initial load
duke
parents:
diff changeset
271 //
a61af66fc99e Initial load
duke
parents:
diff changeset
272 // C2 Calling Conventions:
a61af66fc99e Initial load
duke
parents:
diff changeset
273 //
a61af66fc99e Initial load
duke
parents:
diff changeset
274 // The entry code below assumes that the following registers are set
a61af66fc99e Initial load
duke
parents:
diff changeset
275 // when coming in:
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6266
diff changeset
276 // G5_method: holds the Method* of the method to call
0
a61af66fc99e Initial load
duke
parents:
diff changeset
277 // Lesp: points to the TOS of the callers expression stack
a61af66fc99e Initial load
duke
parents:
diff changeset
278 // after having pushed all the parameters
a61af66fc99e Initial load
duke
parents:
diff changeset
279 //
a61af66fc99e Initial load
duke
parents:
diff changeset
280 // The entry code does the following to setup an interpreter frame
a61af66fc99e Initial load
duke
parents:
diff changeset
281 // pop parameters from the callers stack by adjusting Lesp
a61af66fc99e Initial load
duke
parents:
diff changeset
282 // set O0 to Lesp
a61af66fc99e Initial load
duke
parents:
diff changeset
283 // compute X = (max_locals - num_parameters)
a61af66fc99e Initial load
duke
parents:
diff changeset
284 // bump SP up by X to accomadate the extra locals
a61af66fc99e Initial load
duke
parents:
diff changeset
285 // compute X = max_expression_stack
a61af66fc99e Initial load
duke
parents:
diff changeset
286 // + vm_local_words
a61af66fc99e Initial load
duke
parents:
diff changeset
287 // + 16 words of register save area
a61af66fc99e Initial load
duke
parents:
diff changeset
288 // save frame doing a save sp, -X, sp growing towards lower addresses
a61af66fc99e Initial load
duke
parents:
diff changeset
289 // set Lbcp, Lmethod, LcpoolCache
a61af66fc99e Initial load
duke
parents:
diff changeset
290 // set Llocals to i0
a61af66fc99e Initial load
duke
parents:
diff changeset
291 // set Lmonitors to FP - rounded_vm_local_words
a61af66fc99e Initial load
duke
parents:
diff changeset
292 // set Lesp to Lmonitors - 4
a61af66fc99e Initial load
duke
parents:
diff changeset
293 //
a61af66fc99e Initial load
duke
parents:
diff changeset
294 // The frame has now been setup to do the rest of the entry code
a61af66fc99e Initial load
duke
parents:
diff changeset
295
a61af66fc99e Initial load
duke
parents:
diff changeset
296 // Try this optimization: Most method entries could live in a
a61af66fc99e Initial load
duke
parents:
diff changeset
297 // "one size fits all" stack frame without all the dynamic size
a61af66fc99e Initial load
duke
parents:
diff changeset
298 // calculations. It might be profitable to do all this calculation
a61af66fc99e Initial load
duke
parents:
diff changeset
299 // statically and approximately for "small enough" methods.
a61af66fc99e Initial load
duke
parents:
diff changeset
300
a61af66fc99e Initial load
duke
parents:
diff changeset
301 //-----------------------------------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
302
a61af66fc99e Initial load
duke
parents:
diff changeset
303 // C1 Calling conventions
a61af66fc99e Initial load
duke
parents:
diff changeset
304 //
a61af66fc99e Initial load
duke
parents:
diff changeset
305 // Upon method entry, the following registers are setup:
a61af66fc99e Initial load
duke
parents:
diff changeset
306 //
a61af66fc99e Initial load
duke
parents:
diff changeset
307 // g2 G2_thread: current thread
a61af66fc99e Initial load
duke
parents:
diff changeset
308 // g5 G5_method: method to activate
a61af66fc99e Initial load
duke
parents:
diff changeset
309 // g4 Gargs : pointer to last argument
a61af66fc99e Initial load
duke
parents:
diff changeset
310 //
a61af66fc99e Initial load
duke
parents:
diff changeset
311 //
a61af66fc99e Initial load
duke
parents:
diff changeset
312 // Stack:
a61af66fc99e Initial load
duke
parents:
diff changeset
313 //
a61af66fc99e Initial load
duke
parents:
diff changeset
314 // +---------------+ <--- sp
a61af66fc99e Initial load
duke
parents:
diff changeset
315 // | |
a61af66fc99e Initial load
duke
parents:
diff changeset
316 // : reg save area :
a61af66fc99e Initial load
duke
parents:
diff changeset
317 // | |
a61af66fc99e Initial load
duke
parents:
diff changeset
318 // +---------------+ <--- sp + 0x40
a61af66fc99e Initial load
duke
parents:
diff changeset
319 // | |
a61af66fc99e Initial load
duke
parents:
diff changeset
320 // : extra 7 slots : note: these slots are not really needed for the interpreter (fix later)
a61af66fc99e Initial load
duke
parents:
diff changeset
321 // | |
a61af66fc99e Initial load
duke
parents:
diff changeset
322 // +---------------+ <--- sp + 0x5c
a61af66fc99e Initial load
duke
parents:
diff changeset
323 // | |
a61af66fc99e Initial load
duke
parents:
diff changeset
324 // : free :
a61af66fc99e Initial load
duke
parents:
diff changeset
325 // | |
a61af66fc99e Initial load
duke
parents:
diff changeset
326 // +---------------+ <--- Gargs
a61af66fc99e Initial load
duke
parents:
diff changeset
327 // | |
a61af66fc99e Initial load
duke
parents:
diff changeset
328 // : arguments :
a61af66fc99e Initial load
duke
parents:
diff changeset
329 // | |
a61af66fc99e Initial load
duke
parents:
diff changeset
330 // +---------------+
a61af66fc99e Initial load
duke
parents:
diff changeset
331 // | |
a61af66fc99e Initial load
duke
parents:
diff changeset
332 //
a61af66fc99e Initial load
duke
parents:
diff changeset
333 //
a61af66fc99e Initial load
duke
parents:
diff changeset
334 //
a61af66fc99e Initial load
duke
parents:
diff changeset
335 // AFTER FRAME HAS BEEN SETUP for method interpretation the stack looks like:
a61af66fc99e Initial load
duke
parents:
diff changeset
336 //
a61af66fc99e Initial load
duke
parents:
diff changeset
337 // +---------------+ <--- sp
a61af66fc99e Initial load
duke
parents:
diff changeset
338 // | |
a61af66fc99e Initial load
duke
parents:
diff changeset
339 // : reg save area :
a61af66fc99e Initial load
duke
parents:
diff changeset
340 // | |
a61af66fc99e Initial load
duke
parents:
diff changeset
341 // +---------------+ <--- sp + 0x40
a61af66fc99e Initial load
duke
parents:
diff changeset
342 // | |
a61af66fc99e Initial load
duke
parents:
diff changeset
343 // : extra 7 slots : note: these slots are not really needed for the interpreter (fix later)
a61af66fc99e Initial load
duke
parents:
diff changeset
344 // | |
a61af66fc99e Initial load
duke
parents:
diff changeset
345 // +---------------+ <--- sp + 0x5c
a61af66fc99e Initial load
duke
parents:
diff changeset
346 // | |
a61af66fc99e Initial load
duke
parents:
diff changeset
347 // : :
a61af66fc99e Initial load
duke
parents:
diff changeset
348 // | | <--- Lesp
a61af66fc99e Initial load
duke
parents:
diff changeset
349 // +---------------+ <--- Lmonitors (fp - 0x18)
a61af66fc99e Initial load
duke
parents:
diff changeset
350 // | VM locals |
a61af66fc99e Initial load
duke
parents:
diff changeset
351 // +---------------+ <--- fp
a61af66fc99e Initial load
duke
parents:
diff changeset
352 // | |
a61af66fc99e Initial load
duke
parents:
diff changeset
353 // : reg save area :
a61af66fc99e Initial load
duke
parents:
diff changeset
354 // | |
a61af66fc99e Initial load
duke
parents:
diff changeset
355 // +---------------+ <--- fp + 0x40
a61af66fc99e Initial load
duke
parents:
diff changeset
356 // | |
a61af66fc99e Initial load
duke
parents:
diff changeset
357 // : extra 7 slots : note: these slots are not really needed for the interpreter (fix later)
a61af66fc99e Initial load
duke
parents:
diff changeset
358 // | |
a61af66fc99e Initial load
duke
parents:
diff changeset
359 // +---------------+ <--- fp + 0x5c
a61af66fc99e Initial load
duke
parents:
diff changeset
360 // | |
a61af66fc99e Initial load
duke
parents:
diff changeset
361 // : free :
a61af66fc99e Initial load
duke
parents:
diff changeset
362 // | |
a61af66fc99e Initial load
duke
parents:
diff changeset
363 // +---------------+
a61af66fc99e Initial load
duke
parents:
diff changeset
364 // | |
a61af66fc99e Initial load
duke
parents:
diff changeset
365 // : nonarg locals :
a61af66fc99e Initial load
duke
parents:
diff changeset
366 // | |
a61af66fc99e Initial load
duke
parents:
diff changeset
367 // +---------------+
a61af66fc99e Initial load
duke
parents:
diff changeset
368 // | |
a61af66fc99e Initial load
duke
parents:
diff changeset
369 // : arguments :
a61af66fc99e Initial load
duke
parents:
diff changeset
370 // | | <--- Llocals
a61af66fc99e Initial load
duke
parents:
diff changeset
371 // +---------------+ <--- Gargs
a61af66fc99e Initial load
duke
parents:
diff changeset
372 // | |
a61af66fc99e Initial load
duke
parents:
diff changeset
373
a61af66fc99e Initial load
duke
parents:
diff changeset
374 address AbstractInterpreterGenerator::generate_method_entry(AbstractInterpreter::MethodKind kind) {
a61af66fc99e Initial load
duke
parents:
diff changeset
375 // determine code generation flags
a61af66fc99e Initial load
duke
parents:
diff changeset
376 bool synchronized = false;
a61af66fc99e Initial load
duke
parents:
diff changeset
377 address entry_point = NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
378
a61af66fc99e Initial load
duke
parents:
diff changeset
379 switch (kind) {
a61af66fc99e Initial load
duke
parents:
diff changeset
380 case Interpreter::zerolocals : break;
a61af66fc99e Initial load
duke
parents:
diff changeset
381 case Interpreter::zerolocals_synchronized: synchronized = true; break;
a61af66fc99e Initial load
duke
parents:
diff changeset
382 case Interpreter::native : entry_point = ((InterpreterGenerator*)this)->generate_native_entry(false); break;
a61af66fc99e Initial load
duke
parents:
diff changeset
383 case Interpreter::native_synchronized : entry_point = ((InterpreterGenerator*)this)->generate_native_entry(true); break;
a61af66fc99e Initial load
duke
parents:
diff changeset
384 case Interpreter::empty : entry_point = ((InterpreterGenerator*)this)->generate_empty_entry(); break;
a61af66fc99e Initial load
duke
parents:
diff changeset
385 case Interpreter::accessor : entry_point = ((InterpreterGenerator*)this)->generate_accessor_entry(); break;
a61af66fc99e Initial load
duke
parents:
diff changeset
386 case Interpreter::abstract : entry_point = ((InterpreterGenerator*)this)->generate_abstract_entry(); break;
6266
1d7922586cf6 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 6084
diff changeset
387
0
a61af66fc99e Initial load
duke
parents:
diff changeset
388 case Interpreter::java_lang_math_sin : break;
a61af66fc99e Initial load
duke
parents:
diff changeset
389 case Interpreter::java_lang_math_cos : break;
a61af66fc99e Initial load
duke
parents:
diff changeset
390 case Interpreter::java_lang_math_tan : break;
a61af66fc99e Initial load
duke
parents:
diff changeset
391 case Interpreter::java_lang_math_sqrt : break;
a61af66fc99e Initial load
duke
parents:
diff changeset
392 case Interpreter::java_lang_math_abs : break;
a61af66fc99e Initial load
duke
parents:
diff changeset
393 case Interpreter::java_lang_math_log : break;
a61af66fc99e Initial load
duke
parents:
diff changeset
394 case Interpreter::java_lang_math_log10 : break;
6084
6759698e3140 7133857: exp() and pow() should use the x87 ISA on x86
roland
parents: 3839
diff changeset
395 case Interpreter::java_lang_math_pow : break;
6759698e3140 7133857: exp() and pow() should use the x87 ISA on x86
roland
parents: 3839
diff changeset
396 case Interpreter::java_lang_math_exp : break;
3249
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2357
diff changeset
397 case Interpreter::java_lang_ref_reference_get
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2357
diff changeset
398 : entry_point = ((InterpreterGenerator*)this)->generate_Reference_get_entry(); break;
6266
1d7922586cf6 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 6084
diff changeset
399 default:
1d7922586cf6 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 6084
diff changeset
400 fatal(err_msg("unexpected method kind: %d", kind));
1d7922586cf6 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 6084
diff changeset
401 break;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
402 }
a61af66fc99e Initial load
duke
parents:
diff changeset
403
a61af66fc99e Initial load
duke
parents:
diff changeset
404 if (entry_point) return entry_point;
a61af66fc99e Initial load
duke
parents:
diff changeset
405
a61af66fc99e Initial load
duke
parents:
diff changeset
406 return ((InterpreterGenerator*)this)->generate_normal_entry(synchronized);
a61af66fc99e Initial load
duke
parents:
diff changeset
407 }
a61af66fc99e Initial load
duke
parents:
diff changeset
408
a61af66fc99e Initial load
duke
parents:
diff changeset
409
1174
ddb7834449d0 6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents: 710
diff changeset
410 bool AbstractInterpreter::can_be_compiled(methodHandle m) {
ddb7834449d0 6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents: 710
diff changeset
411 // No special entry points that preclude compilation
ddb7834449d0 6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents: 710
diff changeset
412 return true;
ddb7834449d0 6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents: 710
diff changeset
413 }
ddb7834449d0 6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents: 710
diff changeset
414
0
a61af66fc99e Initial load
duke
parents:
diff changeset
415 void Deoptimization::unwind_callee_save_values(frame* f, vframeArray* vframe_array) {
a61af66fc99e Initial load
duke
parents:
diff changeset
416
a61af66fc99e Initial load
duke
parents:
diff changeset
417 // This code is sort of the equivalent of C2IAdapter::setup_stack_frame back in
a61af66fc99e Initial load
duke
parents:
diff changeset
418 // the days we had adapter frames. When we deoptimize a situation where a
a61af66fc99e Initial load
duke
parents:
diff changeset
419 // compiled caller calls a compiled caller will have registers it expects
a61af66fc99e Initial load
duke
parents:
diff changeset
420 // to survive the call to the callee. If we deoptimize the callee the only
a61af66fc99e Initial load
duke
parents:
diff changeset
421 // way we can restore these registers is to have the oldest interpreter
a61af66fc99e Initial load
duke
parents:
diff changeset
422 // frame that we create restore these values. That is what this routine
a61af66fc99e Initial load
duke
parents:
diff changeset
423 // will accomplish.
a61af66fc99e Initial load
duke
parents:
diff changeset
424
a61af66fc99e Initial load
duke
parents:
diff changeset
425 // At the moment we have modified c2 to not have any callee save registers
a61af66fc99e Initial load
duke
parents:
diff changeset
426 // so this problem does not exist and this routine is just a place holder.
a61af66fc99e Initial load
duke
parents:
diff changeset
427
a61af66fc99e Initial load
duke
parents:
diff changeset
428 assert(f->is_interpreted_frame(), "must be interpreted");
a61af66fc99e Initial load
duke
parents:
diff changeset
429 }
a61af66fc99e Initial load
duke
parents:
diff changeset
430
a61af66fc99e Initial load
duke
parents:
diff changeset
431
a61af66fc99e Initial load
duke
parents:
diff changeset
432 //----------------------------------------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
433 // Exceptions