annotate src/cpu/sparc/vm/interpreterRT_sparc.cpp @ 1552:c18cbe5936b8

6941466: Oracle rebranding changes for Hotspot repositories Summary: Change all the Sun copyrights to Oracle copyright Reviewed-by: ohair
author trims
date Thu, 27 May 2010 19:08:38 -0700
parents 2338d41fbd81
children 126ea7725993
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1506
diff changeset
2 * Copyright (c) 1998, 2010, 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: 1506
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1506
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: 1506
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
a61af66fc99e Initial load
duke
parents:
diff changeset
25 #include "incls/_precompiled.incl"
a61af66fc99e Initial load
duke
parents:
diff changeset
26 #include "incls/_interpreterRT_sparc.cpp.incl"
a61af66fc99e Initial load
duke
parents:
diff changeset
27
a61af66fc99e Initial load
duke
parents:
diff changeset
28
a61af66fc99e Initial load
duke
parents:
diff changeset
29 #define __ _masm->
a61af66fc99e Initial load
duke
parents:
diff changeset
30
a61af66fc99e Initial load
duke
parents:
diff changeset
31
a61af66fc99e Initial load
duke
parents:
diff changeset
32 // Implementation of SignatureHandlerGenerator
a61af66fc99e Initial load
duke
parents:
diff changeset
33
a61af66fc99e Initial load
duke
parents:
diff changeset
34 void InterpreterRuntime::SignatureHandlerGenerator::pass_word(int size_of_arg, int offset_in_arg) {
a61af66fc99e Initial load
duke
parents:
diff changeset
35 Argument jni_arg(jni_offset() + offset_in_arg, false);
a61af66fc99e Initial load
duke
parents:
diff changeset
36 Register Rtmp = O0;
a61af66fc99e Initial load
duke
parents:
diff changeset
37 __ ld(Llocals, Interpreter::local_offset_in_bytes(offset()), Rtmp);
a61af66fc99e Initial load
duke
parents:
diff changeset
38
a61af66fc99e Initial load
duke
parents:
diff changeset
39 __ store_argument(Rtmp, jni_arg);
a61af66fc99e Initial load
duke
parents:
diff changeset
40 }
a61af66fc99e Initial load
duke
parents:
diff changeset
41
a61af66fc99e Initial load
duke
parents:
diff changeset
42 void InterpreterRuntime::SignatureHandlerGenerator::pass_long() {
a61af66fc99e Initial load
duke
parents:
diff changeset
43 Argument jni_arg(jni_offset(), false);
a61af66fc99e Initial load
duke
parents:
diff changeset
44 Register Rtmp = O0;
a61af66fc99e Initial load
duke
parents:
diff changeset
45
a61af66fc99e Initial load
duke
parents:
diff changeset
46 #ifdef _LP64
a61af66fc99e Initial load
duke
parents:
diff changeset
47 __ ldx(Llocals, Interpreter::local_offset_in_bytes(offset() + 1), Rtmp);
a61af66fc99e Initial load
duke
parents:
diff changeset
48 __ store_long_argument(Rtmp, jni_arg);
a61af66fc99e Initial load
duke
parents:
diff changeset
49 #else
a61af66fc99e Initial load
duke
parents:
diff changeset
50 __ ld(Llocals, Interpreter::local_offset_in_bytes(offset() + 1), Rtmp);
a61af66fc99e Initial load
duke
parents:
diff changeset
51 __ store_argument(Rtmp, jni_arg);
a61af66fc99e Initial load
duke
parents:
diff changeset
52 __ ld(Llocals, Interpreter::local_offset_in_bytes(offset() + 0), Rtmp);
a61af66fc99e Initial load
duke
parents:
diff changeset
53 Argument successor(jni_arg.successor());
a61af66fc99e Initial load
duke
parents:
diff changeset
54 __ store_argument(Rtmp, successor);
a61af66fc99e Initial load
duke
parents:
diff changeset
55 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
56 }
a61af66fc99e Initial load
duke
parents:
diff changeset
57
a61af66fc99e Initial load
duke
parents:
diff changeset
58
a61af66fc99e Initial load
duke
parents:
diff changeset
59 #ifdef _LP64
a61af66fc99e Initial load
duke
parents:
diff changeset
60 void InterpreterRuntime::SignatureHandlerGenerator::pass_float() {
a61af66fc99e Initial load
duke
parents:
diff changeset
61 Argument jni_arg(jni_offset(), false);
a61af66fc99e Initial load
duke
parents:
diff changeset
62 FloatRegister Rtmp = F0;
a61af66fc99e Initial load
duke
parents:
diff changeset
63 __ ldf(FloatRegisterImpl::S, Llocals, Interpreter::local_offset_in_bytes(offset()), Rtmp);
a61af66fc99e Initial load
duke
parents:
diff changeset
64 __ store_float_argument(Rtmp, jni_arg);
a61af66fc99e Initial load
duke
parents:
diff changeset
65 }
a61af66fc99e Initial load
duke
parents:
diff changeset
66 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
67
a61af66fc99e Initial load
duke
parents:
diff changeset
68
a61af66fc99e Initial load
duke
parents:
diff changeset
69 void InterpreterRuntime::SignatureHandlerGenerator::pass_double() {
a61af66fc99e Initial load
duke
parents:
diff changeset
70 Argument jni_arg(jni_offset(), false);
a61af66fc99e Initial load
duke
parents:
diff changeset
71 #ifdef _LP64
a61af66fc99e Initial load
duke
parents:
diff changeset
72 FloatRegister Rtmp = F0;
a61af66fc99e Initial load
duke
parents:
diff changeset
73 __ ldf(FloatRegisterImpl::D, Llocals, Interpreter::local_offset_in_bytes(offset() + 1), Rtmp);
a61af66fc99e Initial load
duke
parents:
diff changeset
74 __ store_double_argument(Rtmp, jni_arg);
a61af66fc99e Initial load
duke
parents:
diff changeset
75 #else
a61af66fc99e Initial load
duke
parents:
diff changeset
76 Register Rtmp = O0;
a61af66fc99e Initial load
duke
parents:
diff changeset
77 __ ld(Llocals, Interpreter::local_offset_in_bytes(offset() + 1), Rtmp);
a61af66fc99e Initial load
duke
parents:
diff changeset
78 __ store_argument(Rtmp, jni_arg);
a61af66fc99e Initial load
duke
parents:
diff changeset
79 __ ld(Llocals, Interpreter::local_offset_in_bytes(offset()), Rtmp);
a61af66fc99e Initial load
duke
parents:
diff changeset
80 Argument successor(jni_arg.successor());
a61af66fc99e Initial load
duke
parents:
diff changeset
81 __ store_argument(Rtmp, successor);
a61af66fc99e Initial load
duke
parents:
diff changeset
82 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
83 }
a61af66fc99e Initial load
duke
parents:
diff changeset
84
a61af66fc99e Initial load
duke
parents:
diff changeset
85 void InterpreterRuntime::SignatureHandlerGenerator::pass_object() {
a61af66fc99e Initial load
duke
parents:
diff changeset
86 Argument jni_arg(jni_offset(), false);
a61af66fc99e Initial load
duke
parents:
diff changeset
87 Argument java_arg( offset(), true);
a61af66fc99e Initial load
duke
parents:
diff changeset
88 Register Rtmp1 = O0;
a61af66fc99e Initial load
duke
parents:
diff changeset
89 Register Rtmp2 = jni_arg.is_register() ? jni_arg.as_register() : O0;
a61af66fc99e Initial load
duke
parents:
diff changeset
90 Register Rtmp3 = G3_scratch;
a61af66fc99e Initial load
duke
parents:
diff changeset
91
a61af66fc99e Initial load
duke
parents:
diff changeset
92 // the handle for a receiver will never be null
a61af66fc99e Initial load
duke
parents:
diff changeset
93 bool do_NULL_check = offset() != 0 || is_static();
a61af66fc99e Initial load
duke
parents:
diff changeset
94
727
6b2273dd6fa9 6822110: Add AddressLiteral class on SPARC
twisti
parents: 0
diff changeset
95 Address h_arg = Address(Llocals, Interpreter::local_offset_in_bytes(offset()));
0
a61af66fc99e Initial load
duke
parents:
diff changeset
96 __ ld_ptr(h_arg, Rtmp1);
a61af66fc99e Initial load
duke
parents:
diff changeset
97 if (!do_NULL_check) {
727
6b2273dd6fa9 6822110: Add AddressLiteral class on SPARC
twisti
parents: 0
diff changeset
98 __ add(h_arg.base(), h_arg.disp(), Rtmp2);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
99 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
100 if (Rtmp1 == Rtmp2)
a61af66fc99e Initial load
duke
parents:
diff changeset
101 __ tst(Rtmp1);
a61af66fc99e Initial load
duke
parents:
diff changeset
102 else __ addcc(G0, Rtmp1, Rtmp2); // optimize mov/test pair
a61af66fc99e Initial load
duke
parents:
diff changeset
103 Label L;
a61af66fc99e Initial load
duke
parents:
diff changeset
104 __ brx(Assembler::notZero, true, Assembler::pt, L);
727
6b2273dd6fa9 6822110: Add AddressLiteral class on SPARC
twisti
parents: 0
diff changeset
105 __ delayed()->add(h_arg.base(), h_arg.disp(), Rtmp2);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
106 __ bind(L);
a61af66fc99e Initial load
duke
parents:
diff changeset
107 }
a61af66fc99e Initial load
duke
parents:
diff changeset
108 __ store_ptr_argument(Rtmp2, jni_arg); // this is often a no-op
a61af66fc99e Initial load
duke
parents:
diff changeset
109 }
a61af66fc99e Initial load
duke
parents:
diff changeset
110
a61af66fc99e Initial load
duke
parents:
diff changeset
111
a61af66fc99e Initial load
duke
parents:
diff changeset
112 void InterpreterRuntime::SignatureHandlerGenerator::generate(uint64_t fingerprint) {
a61af66fc99e Initial load
duke
parents:
diff changeset
113
a61af66fc99e Initial load
duke
parents:
diff changeset
114 // generate code to handle arguments
a61af66fc99e Initial load
duke
parents:
diff changeset
115 iterate(fingerprint);
a61af66fc99e Initial load
duke
parents:
diff changeset
116
a61af66fc99e Initial load
duke
parents:
diff changeset
117 // return result handler
727
6b2273dd6fa9 6822110: Add AddressLiteral class on SPARC
twisti
parents: 0
diff changeset
118 AddressLiteral result_handler(Interpreter::result_handler(method()->result_type()));
6b2273dd6fa9 6822110: Add AddressLiteral class on SPARC
twisti
parents: 0
diff changeset
119 __ sethi(result_handler, Lscratch);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
120 __ retl();
727
6b2273dd6fa9 6822110: Add AddressLiteral class on SPARC
twisti
parents: 0
diff changeset
121 __ delayed()->add(Lscratch, result_handler.low10(), Lscratch);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
122
a61af66fc99e Initial load
duke
parents:
diff changeset
123 __ flush();
a61af66fc99e Initial load
duke
parents:
diff changeset
124 }
a61af66fc99e Initial load
duke
parents:
diff changeset
125
a61af66fc99e Initial load
duke
parents:
diff changeset
126
a61af66fc99e Initial load
duke
parents:
diff changeset
127 // Implementation of SignatureHandlerLibrary
a61af66fc99e Initial load
duke
parents:
diff changeset
128
a61af66fc99e Initial load
duke
parents:
diff changeset
129 void SignatureHandlerLibrary::pd_set_handler(address handler) {}
a61af66fc99e Initial load
duke
parents:
diff changeset
130
a61af66fc99e Initial load
duke
parents:
diff changeset
131
a61af66fc99e Initial load
duke
parents:
diff changeset
132 class SlowSignatureHandler: public NativeSignatureIterator {
a61af66fc99e Initial load
duke
parents:
diff changeset
133 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
134 address _from;
a61af66fc99e Initial load
duke
parents:
diff changeset
135 intptr_t* _to;
a61af66fc99e Initial load
duke
parents:
diff changeset
136 intptr_t* _RegArgSignature; // Signature of first Arguments to be passed in Registers
a61af66fc99e Initial load
duke
parents:
diff changeset
137 uint _argcount;
a61af66fc99e Initial load
duke
parents:
diff changeset
138
a61af66fc99e Initial load
duke
parents:
diff changeset
139 enum { // We need to differenciate float from non floats in reg args
a61af66fc99e Initial load
duke
parents:
diff changeset
140 non_float = 0,
a61af66fc99e Initial load
duke
parents:
diff changeset
141 float_sig = 1,
a61af66fc99e Initial load
duke
parents:
diff changeset
142 double_sig = 2,
a61af66fc99e Initial load
duke
parents:
diff changeset
143 long_sig = 3
a61af66fc99e Initial load
duke
parents:
diff changeset
144 };
a61af66fc99e Initial load
duke
parents:
diff changeset
145
a61af66fc99e Initial load
duke
parents:
diff changeset
146 virtual void pass_int() {
a61af66fc99e Initial load
duke
parents:
diff changeset
147 *_to++ = *(jint *)(_from+Interpreter::local_offset_in_bytes(0));
1506
2338d41fbd81 6943304: remove tagged stack interpreter
twisti
parents: 727
diff changeset
148 _from -= Interpreter::stackElementSize;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
149 add_signature( non_float );
a61af66fc99e Initial load
duke
parents:
diff changeset
150 }
a61af66fc99e Initial load
duke
parents:
diff changeset
151
a61af66fc99e Initial load
duke
parents:
diff changeset
152 virtual void pass_object() {
a61af66fc99e Initial load
duke
parents:
diff changeset
153 // pass address of from
a61af66fc99e Initial load
duke
parents:
diff changeset
154 intptr_t *from_addr = (intptr_t*)(_from + Interpreter::local_offset_in_bytes(0));
a61af66fc99e Initial load
duke
parents:
diff changeset
155 *_to++ = (*from_addr == 0) ? NULL : (intptr_t) from_addr;
1506
2338d41fbd81 6943304: remove tagged stack interpreter
twisti
parents: 727
diff changeset
156 _from -= Interpreter::stackElementSize;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
157 add_signature( non_float );
a61af66fc99e Initial load
duke
parents:
diff changeset
158 }
a61af66fc99e Initial load
duke
parents:
diff changeset
159
a61af66fc99e Initial load
duke
parents:
diff changeset
160 #ifdef _LP64
a61af66fc99e Initial load
duke
parents:
diff changeset
161 virtual void pass_float() {
a61af66fc99e Initial load
duke
parents:
diff changeset
162 *_to++ = *(jint *)(_from+Interpreter::local_offset_in_bytes(0));
1506
2338d41fbd81 6943304: remove tagged stack interpreter
twisti
parents: 727
diff changeset
163 _from -= Interpreter::stackElementSize;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
164 add_signature( float_sig );
a61af66fc99e Initial load
duke
parents:
diff changeset
165 }
a61af66fc99e Initial load
duke
parents:
diff changeset
166
a61af66fc99e Initial load
duke
parents:
diff changeset
167 virtual void pass_double() {
a61af66fc99e Initial load
duke
parents:
diff changeset
168 *_to++ = *(intptr_t*)(_from+Interpreter::local_offset_in_bytes(1));
1506
2338d41fbd81 6943304: remove tagged stack interpreter
twisti
parents: 727
diff changeset
169 _from -= 2*Interpreter::stackElementSize;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
170 add_signature( double_sig );
a61af66fc99e Initial load
duke
parents:
diff changeset
171 }
a61af66fc99e Initial load
duke
parents:
diff changeset
172
a61af66fc99e Initial load
duke
parents:
diff changeset
173 virtual void pass_long() {
a61af66fc99e Initial load
duke
parents:
diff changeset
174 _to[0] = *(intptr_t*)(_from+Interpreter::local_offset_in_bytes(1));
a61af66fc99e Initial load
duke
parents:
diff changeset
175 _to += 1;
1506
2338d41fbd81 6943304: remove tagged stack interpreter
twisti
parents: 727
diff changeset
176 _from -= 2*Interpreter::stackElementSize;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
177 add_signature( long_sig );
a61af66fc99e Initial load
duke
parents:
diff changeset
178 }
a61af66fc99e Initial load
duke
parents:
diff changeset
179 #else
a61af66fc99e Initial load
duke
parents:
diff changeset
180 // pass_double() is pass_long() and pass_float() only _LP64
a61af66fc99e Initial load
duke
parents:
diff changeset
181 virtual void pass_long() {
a61af66fc99e Initial load
duke
parents:
diff changeset
182 _to[0] = *(intptr_t*)(_from+Interpreter::local_offset_in_bytes(1));
a61af66fc99e Initial load
duke
parents:
diff changeset
183 _to[1] = *(intptr_t*)(_from+Interpreter::local_offset_in_bytes(0));
a61af66fc99e Initial load
duke
parents:
diff changeset
184 _to += 2;
1506
2338d41fbd81 6943304: remove tagged stack interpreter
twisti
parents: 727
diff changeset
185 _from -= 2*Interpreter::stackElementSize;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
186 add_signature( non_float );
a61af66fc99e Initial load
duke
parents:
diff changeset
187 }
a61af66fc99e Initial load
duke
parents:
diff changeset
188 #endif // _LP64
a61af66fc99e Initial load
duke
parents:
diff changeset
189
a61af66fc99e Initial load
duke
parents:
diff changeset
190 virtual void add_signature( intptr_t sig_type ) {
a61af66fc99e Initial load
duke
parents:
diff changeset
191 if ( _argcount < (sizeof (intptr_t))*4 ) {
a61af66fc99e Initial load
duke
parents:
diff changeset
192 *_RegArgSignature |= (sig_type << (_argcount*2) );
a61af66fc99e Initial load
duke
parents:
diff changeset
193 _argcount++;
a61af66fc99e Initial load
duke
parents:
diff changeset
194 }
a61af66fc99e Initial load
duke
parents:
diff changeset
195 }
a61af66fc99e Initial load
duke
parents:
diff changeset
196
a61af66fc99e Initial load
duke
parents:
diff changeset
197
a61af66fc99e Initial load
duke
parents:
diff changeset
198 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
199 SlowSignatureHandler(methodHandle method, address from, intptr_t* to, intptr_t *RegArgSig) : NativeSignatureIterator(method) {
a61af66fc99e Initial load
duke
parents:
diff changeset
200 _from = from;
a61af66fc99e Initial load
duke
parents:
diff changeset
201 _to = to;
a61af66fc99e Initial load
duke
parents:
diff changeset
202 _RegArgSignature = RegArgSig;
a61af66fc99e Initial load
duke
parents:
diff changeset
203 *_RegArgSignature = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
204 _argcount = method->is_static() ? 2 : 1;
a61af66fc99e Initial load
duke
parents:
diff changeset
205 }
a61af66fc99e Initial load
duke
parents:
diff changeset
206 };
a61af66fc99e Initial load
duke
parents:
diff changeset
207
a61af66fc99e Initial load
duke
parents:
diff changeset
208
a61af66fc99e Initial load
duke
parents:
diff changeset
209 IRT_ENTRY(address, InterpreterRuntime::slow_signature_handler(
a61af66fc99e Initial load
duke
parents:
diff changeset
210 JavaThread* thread,
a61af66fc99e Initial load
duke
parents:
diff changeset
211 methodOopDesc* method,
a61af66fc99e Initial load
duke
parents:
diff changeset
212 intptr_t* from,
a61af66fc99e Initial load
duke
parents:
diff changeset
213 intptr_t* to ))
a61af66fc99e Initial load
duke
parents:
diff changeset
214 methodHandle m(thread, method);
a61af66fc99e Initial load
duke
parents:
diff changeset
215 assert(m->is_native(), "sanity check");
a61af66fc99e Initial load
duke
parents:
diff changeset
216 // handle arguments
a61af66fc99e Initial load
duke
parents:
diff changeset
217 // Warning: We use reg arg slot 00 temporarily to return the RegArgSignature
a61af66fc99e Initial load
duke
parents:
diff changeset
218 // back to the code that pops the arguments into the CPU registers
a61af66fc99e Initial load
duke
parents:
diff changeset
219 SlowSignatureHandler(m, (address)from, m->is_static() ? to+2 : to+1, to).iterate(UCONST64(-1));
a61af66fc99e Initial load
duke
parents:
diff changeset
220 // return result handler
a61af66fc99e Initial load
duke
parents:
diff changeset
221 return Interpreter::result_handler(m->result_type());
a61af66fc99e Initial load
duke
parents:
diff changeset
222 IRT_END