ART: refactor x86/x86-64 entrypoints
This patch:
- removes unused stubs in x86/64 runtimes (art_quick_l2d, art_quick_l2f
and art_quick_idivmod)
- replaces art_quick_fmod, art_quick_fmodf and art_quick_is_assignable
entrypoints in x86-64 to the direct calls
- removes art_quick_indexof stub in x86-64
Change-Id: I6141c5c73b0b449fa3b866068b101e0be211b93e
Signed-off-by: Alexei Zavjalov <alexei.zavjalov@intel.com>
diff --git a/runtime/arch/x86/entrypoints_init_x86.cc b/runtime/arch/x86/entrypoints_init_x86.cc
index c4a7b1b..8ad29dd 100644
--- a/runtime/arch/x86/entrypoints_init_x86.cc
+++ b/runtime/arch/x86/entrypoints_init_x86.cc
@@ -71,11 +71,8 @@
// Math entrypoints.
extern "C" double art_quick_fmod(double, double);
extern "C" float art_quick_fmodf(float, float);
-extern "C" double art_quick_l2d(int64_t);
-extern "C" float art_quick_l2f(int64_t);
extern "C" int64_t art_quick_d2l(double);
extern "C" int64_t art_quick_f2l(float);
-extern "C" int32_t art_quick_idivmod(int32_t, int32_t);
extern "C" int64_t art_quick_ldiv(int64_t, int64_t);
extern "C" int64_t art_quick_lmod(int64_t, int64_t);
extern "C" int64_t art_quick_lmul(int64_t, int64_t);
@@ -181,12 +178,12 @@
// points->pCmplFloat = NULL; // Not needed on x86.
qpoints->pFmod = art_quick_fmod;
// qpoints->pSqrt = NULL; // Not needed on x86.
- qpoints->pL2d = art_quick_l2d;
+ // qpoints->pL2d = NULL; // Not needed on x86.
qpoints->pFmodf = art_quick_fmodf;
- qpoints->pL2f = art_quick_l2f;
+ // qpoints->pL2f = NULL; // Not needed on x86.
// points->pD2iz = NULL; // Not needed on x86.
// points->pF2iz = NULL; // Not needed on x86.
- qpoints->pIdivmod = art_quick_idivmod;
+ // qpoints->pIdivmod = NULL; // Not needed on x86.
qpoints->pD2l = art_quick_d2l;
qpoints->pF2l = art_quick_f2l;
qpoints->pLdiv = art_quick_ldiv;
diff --git a/runtime/arch/x86/quick_entrypoints_x86.S b/runtime/arch/x86/quick_entrypoints_x86.S
index 339ed2e..b311ea5 100644
--- a/runtime/arch/x86/quick_entrypoints_x86.S
+++ b/runtime/arch/x86/quick_entrypoints_x86.S
@@ -763,28 +763,6 @@
ret
END_FUNCTION art_quick_fmodf
-DEFINE_FUNCTION art_quick_l2d
- PUSH ecx // push arg2 a.hi
- PUSH eax // push arg1 a.lo
- fildll (%esp) // load as integer and push into st0
- fstpl (%esp) // pop value off fp stack as double
- movsd (%esp), %xmm0 // place into %xmm0
- addl LITERAL(8), %esp // pop arguments
- CFI_ADJUST_CFA_OFFSET(-8)
- ret
-END_FUNCTION art_quick_l2d
-
-DEFINE_FUNCTION art_quick_l2f
- PUSH ecx // push arg2 a.hi
- PUSH eax // push arg1 a.lo
- fildll (%esp) // load as integer and push into st0
- fstps (%esp) // pop value off fp stack as a single
- movss (%esp), %xmm0 // place into %xmm0
- addl LITERAL(8), %esp // pop argument
- CFI_ADJUST_CFA_OFFSET(-8)
- ret
-END_FUNCTION art_quick_l2f
-
DEFINE_FUNCTION art_quick_d2l
PUSH eax // alignment padding
PUSH ecx // pass arg2 a.hi
@@ -807,20 +785,6 @@
ret
END_FUNCTION art_quick_f2l
-DEFINE_FUNCTION art_quick_idivmod
- cmpl LITERAL(0x80000000), %eax
- je .Lcheck_arg2 // special case
-.Largs_ok:
- cdq // edx:eax = sign extend eax
- idiv %ecx // (edx,eax) = (edx:eax % ecx, edx:eax / ecx)
- ret
-.Lcheck_arg2:
- cmpl LITERAL(-1), %ecx
- jne .Largs_ok
- xorl %edx, %edx
- ret // eax already holds min int
-END_FUNCTION art_quick_idivmod
-
DEFINE_FUNCTION art_quick_ldiv
subl LITERAL(12), %esp // alignment padding
CFI_ADJUST_CFA_OFFSET(12)
diff --git a/runtime/arch/x86_64/entrypoints_init_x86_64.cc b/runtime/arch/x86_64/entrypoints_init_x86_64.cc
index 30067cf..86dcf36 100644
--- a/runtime/arch/x86_64/entrypoints_init_x86_64.cc
+++ b/runtime/arch/x86_64/entrypoints_init_x86_64.cc
@@ -18,6 +18,7 @@
#include "entrypoints/quick/quick_alloc_entrypoints.h"
#include "entrypoints/quick/quick_entrypoints.h"
#include "entrypoints/entrypoint_utils.h"
+#include "entrypoints/math_entrypoints.h"
namespace art {
@@ -34,8 +35,8 @@
extern "C" void art_portable_to_interpreter_bridge(mirror::ArtMethod*);
// Cast entrypoints.
-extern "C" uint32_t art_quick_is_assignable(const mirror::Class* klass,
- const mirror::Class* ref_class);
+extern "C" uint32_t artIsAssignableFromCode(const mirror::Class* klass,
+ const mirror::Class* ref_class);
extern "C" void art_quick_check_cast(void*, void*);
// DexCache entrypoints.
@@ -69,13 +70,8 @@
extern "C" void art_quick_unlock_object(void*);
// Math entrypoints.
-extern "C" double art_quick_fmod(double, double);
-extern "C" float art_quick_fmodf(float, float);
-extern "C" double art_quick_l2d(int64_t);
-extern "C" float art_quick_l2f(int64_t);
extern "C" int64_t art_quick_d2l(double);
extern "C" int64_t art_quick_f2l(float);
-extern "C" int32_t art_quick_idivmod(int32_t, int32_t);
extern "C" int64_t art_quick_ldiv(int64_t, int64_t);
extern "C" int64_t art_quick_lmod(int64_t, int64_t);
extern "C" int64_t art_quick_lmul(int64_t, int64_t);
@@ -85,7 +81,6 @@
// Intrinsic entrypoints.
extern "C" int32_t art_quick_memcmp16(void*, void*, int32_t);
-extern "C" int32_t art_quick_indexof(void*, uint32_t, uint32_t, uint32_t);
extern "C" int32_t art_quick_string_compareto(void*, void*);
extern "C" void* art_quick_memcpy(void*, const void*, size_t);
@@ -133,7 +128,7 @@
ResetQuickAllocEntryPoints(qpoints);
// Cast
- qpoints->pInstanceofNonTrivial = art_quick_is_assignable;
+ qpoints->pInstanceofNonTrivial = artIsAssignableFromCode;
qpoints->pCheckCast = art_quick_check_cast;
// DexCache
@@ -180,16 +175,16 @@
// points->pCmpgFloat = NULL; // Not needed on x86.
// points->pCmplDouble = NULL; // Not needed on x86.
// points->pCmplFloat = NULL; // Not needed on x86.
- qpoints->pFmod = art_quick_fmod;
+ qpoints->pFmod = fmod;
// qpoints->pSqrt = NULL; // Not needed on x86.
- qpoints->pL2d = art_quick_l2d;
- qpoints->pFmodf = art_quick_fmodf;
- qpoints->pL2f = art_quick_l2f;
+ // qpoints->pL2d = NULL; // Not needed on x86.
+ qpoints->pFmodf = fmodf;
+ // qpoints->pL2f = NULL; // Not needed on x86.
// points->pD2iz = NULL; // Not needed on x86.
// points->pF2iz = NULL; // Not needed on x86.
- qpoints->pIdivmod = art_quick_idivmod;
- qpoints->pD2l = art_quick_d2l;
- qpoints->pF2l = art_quick_f2l;
+ // qpoints->pIdivmod = NULL; // Not needed on x86.
+ qpoints->pD2l = art_d2l;
+ qpoints->pF2l = art_f2l;
qpoints->pLdiv = art_quick_ldiv;
qpoints->pLmod = art_quick_lmod;
qpoints->pLmul = art_quick_lmul;
@@ -198,7 +193,7 @@
qpoints->pUshrLong = art_quick_lushr;
// Intrinsics
- qpoints->pIndexOf = art_quick_indexof;
+ // qpoints->pIndexOf = NULL; // Not needed on x86.
qpoints->pMemcmp16 = art_quick_memcmp16;
qpoints->pStringCompareTo = art_quick_string_compareto;
qpoints->pMemcpy = art_quick_memcpy;
diff --git a/runtime/arch/x86_64/quick_entrypoints_x86_64.S b/runtime/arch/x86_64/quick_entrypoints_x86_64.S
index ed7f246..971688d 100644
--- a/runtime/arch/x86_64/quick_entrypoints_x86_64.S
+++ b/runtime/arch/x86_64/quick_entrypoints_x86_64.S
@@ -737,11 +737,6 @@
RETURN_IF_EAX_ZERO
END_FUNCTION art_quick_unlock_object
-DEFINE_FUNCTION art_quick_is_assignable
- int3
- int3
-END_FUNCTION art_quick_is_assignable
-
DEFINE_FUNCTION art_quick_check_cast
PUSH rdi // Save args for exc
PUSH rsi
@@ -876,13 +871,6 @@
NO_ARG_DOWNCALL art_quick_test_suspend, artTestSuspendFromCode, ret
-UNIMPLEMENTED art_quick_fmod
-UNIMPLEMENTED art_quick_fmodf
-UNIMPLEMENTED art_quick_l2d
-UNIMPLEMENTED art_quick_l2f
-UNIMPLEMENTED art_quick_d2l
-UNIMPLEMENTED art_quick_f2l
-UNIMPLEMENTED art_quick_idivmod
UNIMPLEMENTED art_quick_ldiv
UNIMPLEMENTED art_quick_lmod
UNIMPLEMENTED art_quick_lmul
@@ -1301,8 +1289,6 @@
*/
UNIMPLEMENTED art_quick_deoptimize
-UNIMPLEMENTED art_quick_indexof
-
/*
* String's compareTo.
*