@@ -124,14 +124,114 @@ address TemplateInterpreterGenerator::generate_abstract_entry(void) {
124124address TemplateInterpreterGenerator::generate_math_entry (AbstractInterpreter::MethodKind kind) {
125125 if (!InlineIntrinsics) return NULL ; // Generate a vanilla entry
126126
127- // TODO: ARM
128- return NULL ;
127+ address entry_point = NULL ;
128+ Register continuation = LR;
129+ bool use_runtime_call = false ;
130+ switch (kind) {
131+ case Interpreter::java_lang_math_abs:
132+ entry_point = __ pc ();
133+ #ifdef __SOFTFP__
134+ use_runtime_call = true ;
135+ __ ldrd (R0, Address (SP));
136+ #else // !__SOFTFP__
137+ __ ldr_double (D0, Address (SP));
138+ __ abs_double (D0, D0);
139+ #endif // __SOFTFP__
140+ break ;
141+ case Interpreter::java_lang_math_sqrt:
142+ entry_point = __ pc ();
143+ #ifdef __SOFTFP__
144+ use_runtime_call = true ;
145+ __ ldrd (R0, Address (SP));
146+ #else // !__SOFTFP__
147+ __ ldr_double (D0, Address (SP));
148+ __ sqrt_double (D0, D0);
149+ #endif // __SOFTFP__
150+ break ;
151+ case Interpreter::java_lang_math_sin:
152+ case Interpreter::java_lang_math_cos:
153+ case Interpreter::java_lang_math_tan:
154+ case Interpreter::java_lang_math_log:
155+ case Interpreter::java_lang_math_log10:
156+ case Interpreter::java_lang_math_exp:
157+ entry_point = __ pc ();
158+ use_runtime_call = true ;
159+ #ifdef __SOFTFP__
160+ __ ldrd (R0, Address (SP));
161+ #else // !__SOFTFP__
162+ __ ldr_double (D0, Address (SP));
163+ #endif // __SOFTFP__
164+ break ;
165+ case Interpreter::java_lang_math_pow:
166+ entry_point = __ pc ();
167+ use_runtime_call = true ;
168+ #ifdef __SOFTFP__
169+ __ ldrd (R0, Address (SP, 2 * Interpreter::stackElementSize));
170+ __ ldrd (R2, Address (SP));
171+ #else // !__SOFTFP__
172+ __ ldr_double (D0, Address (SP, 2 * Interpreter::stackElementSize));
173+ __ ldr_double (D1, Address (SP));
174+ #endif // __SOFTFP__
175+ break ;
176+ case Interpreter::java_lang_math_fmaD:
177+ case Interpreter::java_lang_math_fmaF:
178+ // TODO: Implement intrinsic
179+ break ;
180+ default :
181+ ShouldNotReachHere ();
182+ }
129183
130- address entry_point = __ pc ();
131- STOP (" generate_math_entry" );
184+ if (entry_point != NULL ) {
185+ __ mov (SP, Rsender_sp);
186+ if (use_runtime_call) {
187+ __ mov (Rtmp_save0, LR);
188+ continuation = Rtmp_save0;
189+ generate_math_runtime_call (kind);
190+ }
191+ __ ret (continuation);
192+ }
132193 return entry_point;
133194}
134195
196+ void TemplateInterpreterGenerator::generate_math_runtime_call (AbstractInterpreter::MethodKind kind) {
197+ address fn;
198+ switch (kind) {
199+ #ifdef __SOFTFP__
200+ case Interpreter::java_lang_math_abs:
201+ fn = CAST_FROM_FN_PTR (address, SharedRuntime::dabs);
202+ break ;
203+ case Interpreter::java_lang_math_sqrt:
204+ fn = CAST_FROM_FN_PTR (address, SharedRuntime::dsqrt);
205+ break ;
206+ #endif // __SOFTFP__
207+ case Interpreter::java_lang_math_sin:
208+ fn = CAST_FROM_FN_PTR (address, SharedRuntime::dsin);
209+ break ;
210+ case Interpreter::java_lang_math_cos:
211+ fn = CAST_FROM_FN_PTR (address, SharedRuntime::dcos);
212+ break ;
213+ case Interpreter::java_lang_math_tan:
214+ fn = CAST_FROM_FN_PTR (address, SharedRuntime::dtan);
215+ break ;
216+ case Interpreter::java_lang_math_log:
217+ fn = CAST_FROM_FN_PTR (address, SharedRuntime::dlog);
218+ break ;
219+ case Interpreter::java_lang_math_log10:
220+ fn = CAST_FROM_FN_PTR (address, SharedRuntime::dlog10);
221+ break ;
222+ case Interpreter::java_lang_math_exp:
223+ fn = CAST_FROM_FN_PTR (address, SharedRuntime::dexp);
224+ break ;
225+ case Interpreter::java_lang_math_pow:
226+ fn = CAST_FROM_FN_PTR (address, SharedRuntime::dpow);
227+ break ;
228+ default :
229+ ShouldNotReachHere ();
230+ fn = NULL ; // silence "maybe uninitialized" compiler warnings
231+ }
232+ __ call_VM_leaf (fn);
233+ }
234+
135235address TemplateInterpreterGenerator::generate_StackOverflowError_handler () {
136236 address entry = __ pc ();
137237
0 commit comments