Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8271128: InlineIntrinsics support for 32-bit ARM #4927

Closed
Closed
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -35,7 +35,7 @@

#ifndef COMPILER2 // avoid duplicated definitions, favoring C2 version
define_pd_global(bool, BackgroundCompilation, true );
define_pd_global(bool, InlineIntrinsics, false); // TODO: ARM
define_pd_global(bool, InlineIntrinsics, true );
define_pd_global(bool, PreferInterpreterNativeStubs, false);
define_pd_global(bool, ProfileTraps, false);
define_pd_global(bool, UseOnStackReplacement, true );
@@ -34,7 +34,7 @@

define_pd_global(bool, BackgroundCompilation, true);
define_pd_global(bool, CICompileOSR, true);
define_pd_global(bool, InlineIntrinsics, false);
define_pd_global(bool, InlineIntrinsics, true);
define_pd_global(bool, PreferInterpreterNativeStubs, false);
define_pd_global(bool, ProfileTraps, true);
define_pd_global(bool, UseOnStackReplacement, true);
@@ -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_function = false;
switch (kind) {
case Interpreter::java_lang_math_abs:
entry_point = __ pc();
#ifdef __SOFTFP__
use_runtime_function = 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_function = 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_function = 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_function = 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_function) {
__ 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();

@@ -114,6 +114,10 @@ class TemplateInterpreterGenerator: public AbstractInterpreterGenerator {
void generate_transcendental_entry(AbstractInterpreter::MethodKind kind, int fpargs);
#endif // AARCH64

#ifdef ARM32
void generate_math_runtime_call(AbstractInterpreter::MethodKind kind);
#endif // ARM32

#ifdef PPC
void lock_method(Register Rflags, Register Rscratch1, Register Rscratch2, bool flags_preloaded=false);
void generate_fixed_frame(bool native_call, Register Rsize_of_parameters, Register Rsize_of_locals);