8271128: InlineIntrinsics support for 32-bit ARM

Reviewed-by: shade
This commit is contained in:
Christoph Göttschkes 2021-08-06 10:23:18 +00:00 committed by Aleksey Shipilev
parent c2b7facea4
commit b6a19f173b
4 changed files with 110 additions and 6 deletions

View file

@ -124,14 +124,114 @@ address TemplateInterpreterGenerator::generate_abstract_entry(void) {
address TemplateInterpreterGenerator::generate_math_entry(AbstractInterpreter::MethodKind kind) {
if (!InlineIntrinsics) return NULL; // Generate a vanilla entry
// TODO: ARM
return NULL;
address entry_point = NULL;
Register continuation = LR;
bool use_runtime_call = false;
switch (kind) {
case Interpreter::java_lang_math_abs:
entry_point = __ pc();
#ifdef __SOFTFP__
use_runtime_call = true;
__ ldrd(R0, Address(SP));
#else // !__SOFTFP__
__ ldr_double(D0, Address(SP));
__ abs_double(D0, D0);
#endif // __SOFTFP__
break;
case Interpreter::java_lang_math_sqrt:
entry_point = __ pc();
#ifdef __SOFTFP__
use_runtime_call = true;
__ ldrd(R0, Address(SP));
#else // !__SOFTFP__
__ ldr_double(D0, Address(SP));
__ sqrt_double(D0, D0);
#endif // __SOFTFP__
break;
case Interpreter::java_lang_math_sin:
case Interpreter::java_lang_math_cos:
case Interpreter::java_lang_math_tan:
case Interpreter::java_lang_math_log:
case Interpreter::java_lang_math_log10:
case Interpreter::java_lang_math_exp:
entry_point = __ pc();
use_runtime_call = true;
#ifdef __SOFTFP__
__ ldrd(R0, Address(SP));
#else // !__SOFTFP__
__ ldr_double(D0, Address(SP));
#endif // __SOFTFP__
break;
case Interpreter::java_lang_math_pow:
entry_point = __ pc();
use_runtime_call = true;
#ifdef __SOFTFP__
__ ldrd(R0, Address(SP, 2 * Interpreter::stackElementSize));
__ ldrd(R2, Address(SP));
#else // !__SOFTFP__
__ ldr_double(D0, Address(SP, 2 * Interpreter::stackElementSize));
__ ldr_double(D1, Address(SP));
#endif // __SOFTFP__
break;
case Interpreter::java_lang_math_fmaD:
case Interpreter::java_lang_math_fmaF:
// TODO: Implement intrinsic
break;
default:
ShouldNotReachHere();
}
address entry_point = __ pc();
STOP("generate_math_entry");
if (entry_point != NULL) {
__ mov(SP, Rsender_sp);
if (use_runtime_call) {
__ mov(Rtmp_save0, LR);
continuation = Rtmp_save0;
generate_math_runtime_call(kind);
}
__ ret(continuation);
}
return entry_point;
}
void TemplateInterpreterGenerator::generate_math_runtime_call(AbstractInterpreter::MethodKind kind) {
address fn;
switch (kind) {
#ifdef __SOFTFP__
case Interpreter::java_lang_math_abs:
fn = CAST_FROM_FN_PTR(address, SharedRuntime::dabs);
break;
case Interpreter::java_lang_math_sqrt:
fn = CAST_FROM_FN_PTR(address, SharedRuntime::dsqrt);
break;
#endif // __SOFTFP__
case Interpreter::java_lang_math_sin:
fn = CAST_FROM_FN_PTR(address, SharedRuntime::dsin);
break;
case Interpreter::java_lang_math_cos:
fn = CAST_FROM_FN_PTR(address, SharedRuntime::dcos);
break;
case Interpreter::java_lang_math_tan:
fn = CAST_FROM_FN_PTR(address, SharedRuntime::dtan);
break;
case Interpreter::java_lang_math_log:
fn = CAST_FROM_FN_PTR(address, SharedRuntime::dlog);
break;
case Interpreter::java_lang_math_log10:
fn = CAST_FROM_FN_PTR(address, SharedRuntime::dlog10);
break;
case Interpreter::java_lang_math_exp:
fn = CAST_FROM_FN_PTR(address, SharedRuntime::dexp);
break;
case Interpreter::java_lang_math_pow:
fn = CAST_FROM_FN_PTR(address, SharedRuntime::dpow);
break;
default:
ShouldNotReachHere();
fn = NULL; // silence "maybe uninitialized" compiler warnings
}
__ call_VM_leaf(fn);
}
address TemplateInterpreterGenerator::generate_StackOverflowError_handler() {
address entry = __ pc();