Remove obsolete code (following handle scope removal in generic JNI).
On arm64, the code that saved FP in generic JNI trampoline is no longer
necessary since https://r.android.com/98108 (note that the frame pointer
is already saved in X28, and FP was previously needed in addition to
X28).
The `BuildGenericJniFrameVisitor::FillJniCall` class is obsolete since
https://r.android.com/1582970 that removed handle scope and can be
replaced with its superclass `FillNativeCall`.
Test: treehugger
Change-Id: I83ba57795a088d32d2b14dd9d2e00f1755f26c35
diff --git a/runtime/arch/arm64/quick_entrypoints_arm64.S b/runtime/arch/arm64/quick_entrypoints_arm64.S
index fafa6f3..6cf42e8 100644
--- a/runtime/arch/arm64/quick_entrypoints_arm64.S
+++ b/runtime/arch/arm64/quick_entrypoints_arm64.S
@@ -1713,8 +1713,7 @@
* | Method* | <- X0 (Managed frame similar to SaveRefsAndArgs.)
* #-------------------#
* | local ref cookie | // 4B
- * | padding | // 0B or 4B to align handle scope on 8B address
- * | handle scope | // Size depends on number of references; multiple of 4B.
+ * | padding | // 0B or 4B to align stack args on 8B address
* #-------------------#
* | JNI Stack Args | // Empty if all args fit into registers x0-x7, d0-d7.
* #-------------------# <--- SP on native call (1)
@@ -1736,24 +1735,20 @@
ENTRY art_quick_generic_jni_trampoline
SETUP_SAVE_REFS_AND_ARGS_FRAME_WITH_METHOD_IN_X0
- // Save SP , so we can have static CFI info.
+ // Save SP, so we can have static CFI info.
mov x28, sp
.cfi_def_cfa_register x28
- // This looks the same, but is different: this will be updated to point to the bottom
- // of the frame when the handle scope is inserted.
- mov xFP, sp
-
mov xIP0, #GENERIC_JNI_TRAMPOLINE_RESERVED_AREA
sub sp, sp, xIP0
// prepare for artQuickGenericJniTrampoline call
// (Thread*, managed_sp, reserved_area)
// x0 x1 x2 <= C calling convention
- // xSELF xFP sp <= where they are
+ // xSELF x28 sp <= where they are
mov x0, xSELF // Thread*
- mov x1, xFP // SP for the managed frame.
+ mov x1, x28 // SP for the managed frame.
mov x2, sp // reserved area for arguments and other saved data (up to managed frame)
bl artQuickGenericJniTrampoline // (Thread*, sp)
diff --git a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
index c860809..a405ab3 100644
--- a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
+++ b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
@@ -1834,10 +1834,10 @@
uint32_t shorty_len,
ArtMethod** managed_sp,
uintptr_t* reserved_area)
- : QuickArgumentVisitor(managed_sp, is_static, shorty, shorty_len),
- jni_call_(nullptr, nullptr, nullptr, critical_native),
- sm_(&jni_call_),
- current_vreg_(nullptr) {
+ : QuickArgumentVisitor(managed_sp, is_static, shorty, shorty_len),
+ jni_call_(nullptr, nullptr, nullptr),
+ sm_(&jni_call_),
+ current_vreg_(nullptr) {
DCHECK_ALIGNED(managed_sp, kStackAlignment);
DCHECK_ALIGNED(reserved_area, sizeof(uintptr_t));
@@ -1886,33 +1886,8 @@
void Visit() REQUIRES_SHARED(Locks::mutator_lock_) override;
private:
- // A class to fill a JNI call. Adds reference/handle-scope management to FillNativeCall.
- class FillJniCall final : public FillNativeCall {
- public:
- FillJniCall(uintptr_t* gpr_regs,
- uint32_t* fpr_regs,
- uintptr_t* stack_args,
- bool critical_native)
- : FillNativeCall(gpr_regs, fpr_regs, stack_args),
- cur_entry_(0),
- critical_native_(critical_native) {}
-
- void Reset(uintptr_t* gpr_regs, uint32_t* fpr_regs, uintptr_t* stack_args) {
- FillNativeCall::Reset(gpr_regs, fpr_regs, stack_args);
- cur_entry_ = 0U;
- }
-
- bool CriticalNative() const {
- return critical_native_;
- }
-
- private:
- size_t cur_entry_;
- const bool critical_native_;
- };
-
- FillJniCall jni_call_;
- BuildNativeCallFrameStateMachine<FillJniCall> sm_;
+ FillNativeCall jni_call_;
+ BuildNativeCallFrameStateMachine<FillNativeCall> sm_;
// Pointer to the current vreg in caller's reserved out vreg area.
// Used for spilling reference arguments.