diff options
author | Andreas Gampe <agampe@google.com> | 2015-01-05 19:26:08 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2015-01-05 19:26:09 +0000 |
commit | 3d5872eb090a04a9444b5621d381eec3846f47a3 (patch) | |
tree | 121bc995f1bb702cf1a01e7279dfeb46fda054ba | |
parent | b994c437ae8ec6b9d85ceb1fb11e4c97eace32ef (diff) | |
parent | 1cc7dbabd03e0a6c09d68161417a21bd6f9df371 (diff) | |
download | android_art-3d5872eb090a04a9444b5621d381eec3846f47a3.tar.gz android_art-3d5872eb090a04a9444b5621d381eec3846f47a3.tar.bz2 android_art-3d5872eb090a04a9444b5621d381eec3846f47a3.zip |
Merge "ART: Reorder entrypoint argument order"
24 files changed, 264 insertions, 284 deletions
diff --git a/compiler/dex/quick/gen_common.cc b/compiler/dex/quick/gen_common.cc index 50014b05b1..e8adffb4e5 100644 --- a/compiler/dex/quick/gen_common.cc +++ b/compiler/dex/quick/gen_common.cc @@ -371,19 +371,19 @@ void Mir2Lir::GenNewArray(uint32_t type_idx, RegLocation rl_dest, // The fast path. if (!use_direct_type_ptr) { LoadClassType(*dex_file, type_idx, kArg0); - CallRuntimeHelperRegMethodRegLocation(kQuickAllocArrayResolved, TargetReg(kArg0, kNotWide), + CallRuntimeHelperRegRegLocationMethod(kQuickAllocArrayResolved, TargetReg(kArg0, kNotWide), rl_src, true); } else { // Use the direct pointer. - CallRuntimeHelperImmMethodRegLocation(kQuickAllocArrayResolved, direct_type_ptr, rl_src, + CallRuntimeHelperImmRegLocationMethod(kQuickAllocArrayResolved, direct_type_ptr, rl_src, true); } } else { // The slow path. - CallRuntimeHelperImmMethodRegLocation(kQuickAllocArray, type_idx, rl_src, true); + CallRuntimeHelperImmRegLocationMethod(kQuickAllocArray, type_idx, rl_src, true); } } else { - CallRuntimeHelperImmMethodRegLocation(kQuickAllocArrayWithAccessCheck, type_idx, rl_src, true); + CallRuntimeHelperImmRegLocationMethod(kQuickAllocArrayWithAccessCheck, type_idx, rl_src, true); } StoreValue(rl_dest, GetReturn(kRefReg)); } @@ -405,7 +405,7 @@ void Mir2Lir::GenFilledNewArray(CallInfo* info) { } else { target = kQuickCheckAndAllocArrayWithAccessCheck; } - CallRuntimeHelperImmMethodImm(target, type_idx, elems, true); + CallRuntimeHelperImmImmMethod(target, type_idx, elems, true); FreeTemp(TargetReg(kArg2, kNotWide)); FreeTemp(TargetReg(kArg1, kNotWide)); /* @@ -1098,7 +1098,7 @@ void Mir2Lir::GenConstString(uint32_t string_idx, RegLocation rl_dest) { void Compile() { GenerateTargetLabel(); - m2l_->CallRuntimeHelperRegImm(kQuickResolveString, r_method_, string_idx_, true); + m2l_->CallRuntimeHelperImmReg(kQuickResolveString, string_idx_, r_method_, true); m2l_->OpUnconditionalBranch(cont_); } diff --git a/compiler/dex/quick/gen_invoke.cc b/compiler/dex/quick/gen_invoke.cc index eb206a68c6..c99be641a9 100755 --- a/compiler/dex/quick/gen_invoke.cc +++ b/compiler/dex/quick/gen_invoke.cc @@ -201,16 +201,16 @@ void Mir2Lir::CallRuntimeHelperRegMethod(QuickEntrypointEnum trampoline, RegStor CallHelper(r_tgt, trampoline, safepoint_pc); } -void Mir2Lir::CallRuntimeHelperRegMethodRegLocation(QuickEntrypointEnum trampoline, RegStorage arg0, - RegLocation arg2, bool safepoint_pc) { +void Mir2Lir::CallRuntimeHelperRegRegLocationMethod(QuickEntrypointEnum trampoline, RegStorage arg0, + RegLocation arg1, bool safepoint_pc) { RegStorage r_tgt = CallHelperSetup(trampoline); - DCHECK(!IsSameReg(TargetReg(kArg1, arg0.GetWideKind()), arg0)); + DCHECK(!IsSameReg(TargetReg(kArg2, arg0.GetWideKind()), arg0)); RegStorage r_tmp = TargetReg(kArg0, arg0.GetWideKind()); if (r_tmp.NotExactlyEquals(arg0)) { OpRegCopy(r_tmp, arg0); } - LoadCurrMethodDirect(TargetReg(kArg1, kRef)); - LoadValueDirectFixed(arg2, TargetReg(kArg2, arg2)); + LoadValueDirectFixed(arg1, TargetReg(kArg1, arg1)); + LoadCurrMethodDirect(TargetReg(kArg2, kRef)); ClobberCallerSave(); CallHelper(r_tgt, trampoline, safepoint_pc); } @@ -306,21 +306,21 @@ void Mir2Lir::CallRuntimeHelperRegRegImm(QuickEntrypointEnum trampoline, RegStor CallHelper(r_tgt, trampoline, safepoint_pc); } -void Mir2Lir::CallRuntimeHelperImmMethodRegLocation(QuickEntrypointEnum trampoline, int arg0, - RegLocation arg2, bool safepoint_pc) { +void Mir2Lir::CallRuntimeHelperImmRegLocationMethod(QuickEntrypointEnum trampoline, int arg0, + RegLocation arg1, bool safepoint_pc) { RegStorage r_tgt = CallHelperSetup(trampoline); - LoadValueDirectFixed(arg2, TargetReg(kArg2, arg2)); - LoadCurrMethodDirect(TargetReg(kArg1, kRef)); + LoadValueDirectFixed(arg1, TargetReg(kArg1, arg1)); + LoadCurrMethodDirect(TargetReg(kArg2, kRef)); LoadConstant(TargetReg(kArg0, kNotWide), arg0); ClobberCallerSave(); CallHelper(r_tgt, trampoline, safepoint_pc); } -void Mir2Lir::CallRuntimeHelperImmMethodImm(QuickEntrypointEnum trampoline, int arg0, int arg2, +void Mir2Lir::CallRuntimeHelperImmImmMethod(QuickEntrypointEnum trampoline, int arg0, int arg1, bool safepoint_pc) { RegStorage r_tgt = CallHelperSetup(trampoline); - LoadCurrMethodDirect(TargetReg(kArg1, kRef)); - LoadConstant(TargetReg(kArg2, kNotWide), arg2); + LoadCurrMethodDirect(TargetReg(kArg2, kRef)); + LoadConstant(TargetReg(kArg1, kNotWide), arg1); LoadConstant(TargetReg(kArg0, kNotWide), arg0); ClobberCallerSave(); CallHelper(r_tgt, trampoline, safepoint_pc); diff --git a/compiler/dex/quick/mir_to_lir.h b/compiler/dex/quick/mir_to_lir.h index 19e7bf3e43..f102881ce0 100644 --- a/compiler/dex/quick/mir_to_lir.h +++ b/compiler/dex/quick/mir_to_lir.h @@ -874,17 +874,17 @@ class Mir2Lir : public Backend { void CallRuntimeHelperImmMethod(QuickEntrypointEnum trampoline, int arg0, bool safepoint_pc); void CallRuntimeHelperRegMethod(QuickEntrypointEnum trampoline, RegStorage arg0, bool safepoint_pc); - void CallRuntimeHelperRegMethodRegLocation(QuickEntrypointEnum trampoline, RegStorage arg0, - RegLocation arg2, bool safepoint_pc); + void CallRuntimeHelperRegRegLocationMethod(QuickEntrypointEnum trampoline, RegStorage arg0, + RegLocation arg1, bool safepoint_pc); void CallRuntimeHelperRegLocationRegLocation(QuickEntrypointEnum trampoline, RegLocation arg0, RegLocation arg1, bool safepoint_pc); void CallRuntimeHelperRegReg(QuickEntrypointEnum trampoline, RegStorage arg0, RegStorage arg1, bool safepoint_pc); void CallRuntimeHelperRegRegImm(QuickEntrypointEnum trampoline, RegStorage arg0, RegStorage arg1, int arg2, bool safepoint_pc); - void CallRuntimeHelperImmMethodRegLocation(QuickEntrypointEnum trampoline, int arg0, - RegLocation arg2, bool safepoint_pc); - void CallRuntimeHelperImmMethodImm(QuickEntrypointEnum trampoline, int arg0, int arg2, + void CallRuntimeHelperImmRegLocationMethod(QuickEntrypointEnum trampoline, int arg0, + RegLocation arg1, bool safepoint_pc); + void CallRuntimeHelperImmImmMethod(QuickEntrypointEnum trampoline, int arg0, int arg1, bool safepoint_pc); void CallRuntimeHelperImmRegLocationRegLocation(QuickEntrypointEnum trampoline, int arg0, RegLocation arg1, RegLocation arg2, diff --git a/compiler/optimizing/code_generator_arm.cc b/compiler/optimizing/code_generator_arm.cc index 063dc7cafb..8c107f302e 100644 --- a/compiler/optimizing/code_generator_arm.cc +++ b/compiler/optimizing/code_generator_arm.cc @@ -255,8 +255,8 @@ class LoadStringSlowPathARM : public SlowPathCodeARM { codegen->SaveLiveRegisters(locations); InvokeRuntimeCallingConvention calling_convention; - arm_codegen->LoadCurrentMethod(calling_convention.GetRegisterAt(0)); - __ LoadImmediate(calling_convention.GetRegisterAt(1), instruction_->GetStringIndex()); + arm_codegen->LoadCurrentMethod(calling_convention.GetRegisterAt(1)); + __ LoadImmediate(calling_convention.GetRegisterAt(0), instruction_->GetStringIndex()); arm_codegen->InvokeRuntime( QUICK_ENTRY_POINT(pResolveString), instruction_, instruction_->GetDexPc()); arm_codegen->Move32(locations->Out(), Location::RegisterLocation(R0)); @@ -2409,14 +2409,14 @@ void LocationsBuilderARM::VisitNewArray(HNewArray* instruction) { new (GetGraph()->GetArena()) LocationSummary(instruction, LocationSummary::kCall); InvokeRuntimeCallingConvention calling_convention; locations->AddTemp(Location::RegisterLocation(calling_convention.GetRegisterAt(0))); - locations->AddTemp(Location::RegisterLocation(calling_convention.GetRegisterAt(1))); + locations->AddTemp(Location::RegisterLocation(calling_convention.GetRegisterAt(2))); locations->SetOut(Location::RegisterLocation(R0)); - locations->SetInAt(0, Location::RegisterLocation(calling_convention.GetRegisterAt(2))); + locations->SetInAt(0, Location::RegisterLocation(calling_convention.GetRegisterAt(1))); } void InstructionCodeGeneratorARM::VisitNewArray(HNewArray* instruction) { InvokeRuntimeCallingConvention calling_convention; - codegen_->LoadCurrentMethod(calling_convention.GetRegisterAt(1)); + codegen_->LoadCurrentMethod(calling_convention.GetRegisterAt(2)); __ LoadImmediate(calling_convention.GetRegisterAt(0), instruction->GetTypeIndex()); codegen_->InvokeRuntime( QUICK_ENTRY_POINT(pAllocArrayWithAccessCheck), instruction, instruction->GetDexPc()); diff --git a/compiler/optimizing/code_generator_arm64.cc b/compiler/optimizing/code_generator_arm64.cc index e10b47cde8..7b19f44e78 100644 --- a/compiler/optimizing/code_generator_arm64.cc +++ b/compiler/optimizing/code_generator_arm64.cc @@ -17,6 +17,7 @@ #include "code_generator_arm64.h" #include "entrypoints/quick/quick_entrypoints.h" +#include "entrypoints/quick/quick_entrypoints_enum.h" #include "gc/accounting/card_table.h" #include "mirror/array-inl.h" #include "mirror/art_method.h" @@ -298,6 +299,7 @@ class BoundsCheckSlowPathARM64 : public SlowPathCodeARM64 { length_location_, LocationFrom(calling_convention.GetRegisterAt(1))); arm64_codegen->InvokeRuntime( QUICK_ENTRY_POINT(pThrowArrayBounds), instruction_, instruction_->GetDexPc()); + CheckEntrypointTypes<kQuickThrowArrayBounds, void, int32_t, int32_t>(); } private: @@ -317,6 +319,7 @@ class DivZeroCheckSlowPathARM64 : public SlowPathCodeARM64 { __ Bind(GetEntryLabel()); arm64_codegen->InvokeRuntime( QUICK_ENTRY_POINT(pThrowDivZero), instruction_, instruction_->GetDexPc()); + CheckEntrypointTypes<kQuickThrowDivZero, void, void>(); } private: @@ -347,6 +350,11 @@ class LoadClassSlowPathARM64 : public SlowPathCodeARM64 { int32_t entry_point_offset = do_clinit_ ? QUICK_ENTRY_POINT(pInitializeStaticStorage) : QUICK_ENTRY_POINT(pInitializeType); arm64_codegen->InvokeRuntime(entry_point_offset, at_, dex_pc_); + if (do_clinit_) { + CheckEntrypointTypes<kQuickInitializeStaticStorage, void*, uint32_t, mirror::ArtMethod*>(); + } else { + CheckEntrypointTypes<kQuickInitializeType, void*, uint32_t, mirror::ArtMethod*>(); + } // Move the class to the desired location. Location out = locations->Out(); @@ -390,10 +398,11 @@ class LoadStringSlowPathARM64 : public SlowPathCodeARM64 { codegen->SaveLiveRegisters(locations); InvokeRuntimeCallingConvention calling_convention; - arm64_codegen->LoadCurrentMethod(calling_convention.GetRegisterAt(0).W()); - __ Mov(calling_convention.GetRegisterAt(1).W(), instruction_->GetStringIndex()); + arm64_codegen->LoadCurrentMethod(calling_convention.GetRegisterAt(1).W()); + __ Mov(calling_convention.GetRegisterAt(0).W(), instruction_->GetStringIndex()); arm64_codegen->InvokeRuntime( QUICK_ENTRY_POINT(pResolveString), instruction_, instruction_->GetDexPc()); + CheckEntrypointTypes<kQuickResolveString, void*, uint32_t, mirror::ArtMethod*>(); Primitive::Type type = instruction_->GetType(); arm64_codegen->MoveLocation(locations->Out(), calling_convention.GetReturnLocation(type), type); @@ -416,6 +425,7 @@ class NullCheckSlowPathARM64 : public SlowPathCodeARM64 { __ Bind(GetEntryLabel()); arm64_codegen->InvokeRuntime( QUICK_ENTRY_POINT(pThrowNullPointer), instruction_, instruction_->GetDexPc()); + CheckEntrypointTypes<kQuickThrowNullPointer, void, void>(); } private: @@ -432,6 +442,7 @@ class StackOverflowCheckSlowPathARM64 : public SlowPathCodeARM64 { CodeGeneratorARM64* arm64_codegen = down_cast<CodeGeneratorARM64*>(codegen); __ Bind(GetEntryLabel()); arm64_codegen->InvokeRuntime(QUICK_ENTRY_POINT(pThrowStackOverflow), nullptr, 0); + CheckEntrypointTypes<kQuickThrowStackOverflow, void, void>(); } private: @@ -450,6 +461,7 @@ class SuspendCheckSlowPathARM64 : public SlowPathCodeARM64 { codegen->SaveLiveRegisters(instruction_->GetLocations()); arm64_codegen->InvokeRuntime( QUICK_ENTRY_POINT(pTestSuspend), instruction_, instruction_->GetDexPc()); + CheckEntrypointTypes<kQuickTestSuspend, void, void>(); codegen->RestoreLiveRegisters(instruction_->GetLocations()); if (successor_ == nullptr) { __ B(GetReturnLabel()); @@ -506,9 +518,12 @@ class TypeCheckSlowPathARM64 : public SlowPathCodeARM64 { Primitive::Type ret_type = instruction_->GetType(); Location ret_loc = calling_convention.GetReturnLocation(ret_type); arm64_codegen->MoveLocation(locations->Out(), ret_loc, ret_type); + CheckEntrypointTypes<kQuickInstanceofNonTrivial, uint32_t, + const mirror::Class*, const mirror::Class*>(); } else { DCHECK(instruction_->IsCheckCast()); arm64_codegen->InvokeRuntime(QUICK_ENTRY_POINT(pCheckCast), instruction_, dex_pc_); + CheckEntrypointTypes<kQuickCheckCast, void, const mirror::Class*, const mirror::Class*>(); } codegen->RestoreLiveRegisters(locations); @@ -1417,7 +1432,7 @@ void InstructionCodeGeneratorARM64::VisitArraySet(HArraySet* instruction) { Primitive::Type value_type = instruction->GetComponentType(); if (value_type == Primitive::kPrimNot) { codegen_->InvokeRuntime(QUICK_ENTRY_POINT(pAputObject), instruction, instruction->GetDexPc()); - + CheckEntrypointTypes<kQuickAputObject, void, mirror::Array*, int32_t, mirror::Object*>(); } else { LocationSummary* locations = instruction->GetLocations(); Register obj = InputRegisterAt(instruction, 0); @@ -2114,6 +2129,7 @@ void InstructionCodeGeneratorARM64::VisitMonitorOperation(HMonitorOperation* ins ? QUICK_ENTRY_POINT(pLockObject) : QUICK_ENTRY_POINT(pUnlockObject), instruction, instruction->GetDexPc()); + CheckEntrypointTypes<kQuickLockObject, void, mirror::Object*>(); } void LocationsBuilderARM64::VisitMul(HMul* mul) { @@ -2199,9 +2215,11 @@ void LocationsBuilderARM64::VisitNewArray(HNewArray* instruction) { new (GetGraph()->GetArena()) LocationSummary(instruction, LocationSummary::kCall); InvokeRuntimeCallingConvention calling_convention; locations->AddTemp(LocationFrom(calling_convention.GetRegisterAt(0))); - locations->AddTemp(LocationFrom(calling_convention.GetRegisterAt(1))); + locations->AddTemp(LocationFrom(calling_convention.GetRegisterAt(2))); locations->SetOut(LocationFrom(x0)); - locations->SetInAt(0, LocationFrom(calling_convention.GetRegisterAt(2))); + locations->SetInAt(0, LocationFrom(calling_convention.GetRegisterAt(1))); + CheckEntrypointTypes<kQuickAllocArrayWithAccessCheck, + void*, uint32_t, int32_t, mirror::ArtMethod*>(); } void InstructionCodeGeneratorARM64::VisitNewArray(HNewArray* instruction) { @@ -2210,11 +2228,13 @@ void InstructionCodeGeneratorARM64::VisitNewArray(HNewArray* instruction) { Register type_index = RegisterFrom(locations->GetTemp(0), Primitive::kPrimInt); DCHECK(type_index.Is(w0)); Register current_method = RegisterFrom(locations->GetTemp(1), Primitive::kPrimNot); - DCHECK(current_method.Is(w1)); + DCHECK(current_method.Is(w2)); codegen_->LoadCurrentMethod(current_method); __ Mov(type_index, instruction->GetTypeIndex()); codegen_->InvokeRuntime( QUICK_ENTRY_POINT(pAllocArrayWithAccessCheck), instruction, instruction->GetDexPc()); + CheckEntrypointTypes<kQuickAllocArrayWithAccessCheck, + void*, uint32_t, int32_t, mirror::ArtMethod*>(); } void LocationsBuilderARM64::VisitNewInstance(HNewInstance* instruction) { @@ -2224,6 +2244,7 @@ void LocationsBuilderARM64::VisitNewInstance(HNewInstance* instruction) { locations->AddTemp(LocationFrom(calling_convention.GetRegisterAt(0))); locations->AddTemp(LocationFrom(calling_convention.GetRegisterAt(1))); locations->SetOut(calling_convention.GetReturnLocation(Primitive::kPrimNot)); + CheckEntrypointTypes<kQuickAllocObjectWithAccessCheck, void*, uint32_t, mirror::ArtMethod*>(); } void InstructionCodeGeneratorARM64::VisitNewInstance(HNewInstance* instruction) { @@ -2236,6 +2257,7 @@ void InstructionCodeGeneratorARM64::VisitNewInstance(HNewInstance* instruction) __ Mov(type_index, instruction->GetTypeIndex()); codegen_->InvokeRuntime( QUICK_ENTRY_POINT(pAllocObjectWithAccessCheck), instruction, instruction->GetDexPc()); + CheckEntrypointTypes<kQuickAllocObjectWithAccessCheck, void*, uint32_t, mirror::ArtMethod*>(); } void LocationsBuilderARM64::VisitNot(HNot* instruction) { @@ -2552,6 +2574,7 @@ void LocationsBuilderARM64::VisitThrow(HThrow* instruction) { void InstructionCodeGeneratorARM64::VisitThrow(HThrow* instruction) { codegen_->InvokeRuntime( QUICK_ENTRY_POINT(pDeliverException), instruction, instruction->GetDexPc()); + CheckEntrypointTypes<kQuickDeliverException, void, mirror::Object*>(); } void LocationsBuilderARM64::VisitTypeConversion(HTypeConversion* conversion) { diff --git a/compiler/optimizing/code_generator_x86.cc b/compiler/optimizing/code_generator_x86.cc index ddb0e82ec0..d377cb57c1 100644 --- a/compiler/optimizing/code_generator_x86.cc +++ b/compiler/optimizing/code_generator_x86.cc @@ -215,8 +215,8 @@ class LoadStringSlowPathX86 : public SlowPathCodeX86 { codegen->SaveLiveRegisters(locations); InvokeRuntimeCallingConvention calling_convention; - x86_codegen->LoadCurrentMethod(calling_convention.GetRegisterAt(0)); - __ movl(calling_convention.GetRegisterAt(1), Immediate(instruction_->GetStringIndex())); + x86_codegen->LoadCurrentMethod(calling_convention.GetRegisterAt(1)); + __ movl(calling_convention.GetRegisterAt(0), Immediate(instruction_->GetStringIndex())); __ fs()->call(Address::Absolute(QUICK_ENTRYPOINT_OFFSET(kX86WordSize, pResolveString))); codegen->RecordPcInfo(instruction_, instruction_->GetDexPc()); x86_codegen->Move32(locations->Out(), Location::RegisterLocation(EAX)); @@ -2503,13 +2503,13 @@ void LocationsBuilderX86::VisitNewArray(HNewArray* instruction) { locations->SetOut(Location::RegisterLocation(EAX)); InvokeRuntimeCallingConvention calling_convention; locations->AddTemp(Location::RegisterLocation(calling_convention.GetRegisterAt(0))); - locations->AddTemp(Location::RegisterLocation(calling_convention.GetRegisterAt(1))); - locations->SetInAt(0, Location::RegisterLocation(calling_convention.GetRegisterAt(2))); + locations->AddTemp(Location::RegisterLocation(calling_convention.GetRegisterAt(2))); + locations->SetInAt(0, Location::RegisterLocation(calling_convention.GetRegisterAt(1))); } void InstructionCodeGeneratorX86::VisitNewArray(HNewArray* instruction) { InvokeRuntimeCallingConvention calling_convention; - codegen_->LoadCurrentMethod(calling_convention.GetRegisterAt(1)); + codegen_->LoadCurrentMethod(calling_convention.GetRegisterAt(2)); __ movl(calling_convention.GetRegisterAt(0), Immediate(instruction->GetTypeIndex())); __ fs()->call( diff --git a/compiler/optimizing/code_generator_x86_64.cc b/compiler/optimizing/code_generator_x86_64.cc index 1bc3092d15..5fc24f71e6 100644 --- a/compiler/optimizing/code_generator_x86_64.cc +++ b/compiler/optimizing/code_generator_x86_64.cc @@ -285,8 +285,8 @@ class LoadStringSlowPathX86_64 : public SlowPathCodeX86_64 { codegen->SaveLiveRegisters(locations); InvokeRuntimeCallingConvention calling_convention; - x64_codegen->LoadCurrentMethod(CpuRegister(calling_convention.GetRegisterAt(0))); - __ movl(CpuRegister(calling_convention.GetRegisterAt(1)), + x64_codegen->LoadCurrentMethod(CpuRegister(calling_convention.GetRegisterAt(1))); + __ movl(CpuRegister(calling_convention.GetRegisterAt(0)), Immediate(instruction_->GetStringIndex())); __ gs()->call(Address::Absolute( QUICK_ENTRYPOINT_OFFSET(kX86_64WordSize, pResolveString), true)); @@ -2311,14 +2311,14 @@ void LocationsBuilderX86_64::VisitNewArray(HNewArray* instruction) { new (GetGraph()->GetArena()) LocationSummary(instruction, LocationSummary::kCall); InvokeRuntimeCallingConvention calling_convention; locations->AddTemp(Location::RegisterLocation(calling_convention.GetRegisterAt(0))); - locations->AddTemp(Location::RegisterLocation(calling_convention.GetRegisterAt(1))); + locations->AddTemp(Location::RegisterLocation(calling_convention.GetRegisterAt(2))); locations->SetOut(Location::RegisterLocation(RAX)); - locations->SetInAt(0, Location::RegisterLocation(calling_convention.GetRegisterAt(2))); + locations->SetInAt(0, Location::RegisterLocation(calling_convention.GetRegisterAt(1))); } void InstructionCodeGeneratorX86_64::VisitNewArray(HNewArray* instruction) { InvokeRuntimeCallingConvention calling_convention; - codegen_->LoadCurrentMethod(CpuRegister(calling_convention.GetRegisterAt(1))); + codegen_->LoadCurrentMethod(CpuRegister(calling_convention.GetRegisterAt(2))); __ movq(CpuRegister(calling_convention.GetRegisterAt(0)), Immediate(instruction->GetTypeIndex())); __ gs()->call(Address::Absolute( diff --git a/runtime/arch/arm/quick_entrypoints_arm.S b/runtime/arch/arm/quick_entrypoints_arm.S index 66ea3ce8e5..fec1ce59bf 100644 --- a/runtime/arch/arm/quick_entrypoints_arm.S +++ b/runtime/arch/arm/quick_entrypoints_arm.S @@ -233,6 +233,11 @@ END \c_name DELIVER_PENDING_EXCEPTION .endm +.macro RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER + RETURN_IF_RESULT_IS_NON_ZERO + DELIVER_PENDING_EXCEPTION +.endm + // Macros taking opportunity of code similarities for downcalls with referrer for non-wide fields. .macro ONE_ARG_REF_DOWNCALL name, entrypoint, return .extern \entrypoint @@ -258,7 +263,7 @@ ENTRY \name END \name .endm -.macro THREE_ARG_REF_DOWNCALL name, entrypoint, return +.macro THREE_ARG_REF_DOWNCALL name, entrypoint, return .extern \entrypoint ENTRY \name SETUP_REFS_ONLY_CALLEE_SAVE_FRAME r3, r12 @ save callee saves in case of GC @@ -633,50 +638,35 @@ ENTRY art_quick_aput_obj bkpt @ unreached END art_quick_aput_obj - /* - * Entry from managed code when uninitialized static storage, this stub will run the class - * initializer and deliver the exception on error. On success the static storage base is - * returned. - */ - .extern artInitializeStaticStorageFromCode -ENTRY art_quick_initialize_static_storage - SETUP_REFS_ONLY_CALLEE_SAVE_FRAME r2, r3 @ save callee saves in case of GC - mov r2, r9 @ pass Thread::Current - @ artInitializeStaticStorageFromCode(uint32_t type_idx, Method* referrer, Thread*) - bl artInitializeStaticStorageFromCode +// Macro to facilitate adding new allocation entrypoints. +.macro TWO_ARG_DOWNCALL name, entrypoint, return + .extern \entrypoint +ENTRY \name + SETUP_REFS_ONLY_CALLEE_SAVE_FRAME r2, r3 @ save callee saves in case of GC + mov r2, r9 @ pass Thread::Current + bl \entrypoint @ (uint32_t type_idx, Method* method, Thread*) RESTORE_REFS_ONLY_CALLEE_SAVE_FRAME - RETURN_IF_RESULT_IS_NON_ZERO - DELIVER_PENDING_EXCEPTION -END art_quick_initialize_static_storage + \return +END \name +.endm - /* - * Entry from managed code when dex cache misses for a type_idx - */ - .extern artInitializeTypeFromCode -ENTRY art_quick_initialize_type - SETUP_REFS_ONLY_CALLEE_SAVE_FRAME r2, r3 @ save callee saves in case of GC - mov r2, r9 @ pass Thread::Current - @ artInitializeTypeFromCode(uint32_t type_idx, Method* referrer, Thread*) - bl artInitializeTypeFromCode +// Macro to facilitate adding new array allocation entrypoints. +.macro THREE_ARG_DOWNCALL name, entrypoint, return + .extern \entrypoint +ENTRY \name + SETUP_REFS_ONLY_CALLEE_SAVE_FRAME r3, r12 @ save callee saves in case of GC + mov r3, r9 @ pass Thread::Current + @ (uint32_t type_idx, Method* method, int32_t component_count, Thread*) + bl \entrypoint RESTORE_REFS_ONLY_CALLEE_SAVE_FRAME - RETURN_IF_RESULT_IS_NON_ZERO - DELIVER_PENDING_EXCEPTION -END art_quick_initialize_type + \return +END \name +.endm - /* - * Entry from managed code when type_idx needs to be checked for access and dex cache may also - * miss. - */ - .extern artInitializeTypeAndVerifyAccessFromCode -ENTRY art_quick_initialize_type_and_verify_access - SETUP_REFS_ONLY_CALLEE_SAVE_FRAME r2, r3 @ save callee saves in case of GC - mov r2, r9 @ pass Thread::Current - @ artInitializeTypeAndVerifyAccessFromCode(uint32_t type_idx, Method* referrer, Thread*) - bl artInitializeTypeAndVerifyAccessFromCode - RESTORE_REFS_ONLY_CALLEE_SAVE_FRAME - RETURN_IF_RESULT_IS_NON_ZERO - DELIVER_PENDING_EXCEPTION -END art_quick_initialize_type_and_verify_access +TWO_ARG_DOWNCALL art_quick_initialize_static_storage, artInitializeStaticStorageFromCode, RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER + +TWO_ARG_DOWNCALL art_quick_initialize_type, artInitializeTypeFromCode, RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER +TWO_ARG_DOWNCALL art_quick_initialize_type_and_verify_access, artInitializeTypeAndVerifyAccessFromCode, RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER /* * Called by managed code to resolve a static field and load a non-wide value. @@ -789,43 +779,7 @@ END art_quick_set64_instance * R1 holds the string index. The fast path check for hit in strings cache has already been * performed. */ - .extern artResolveStringFromCode -ENTRY art_quick_resolve_string - SETUP_REFS_ONLY_CALLEE_SAVE_FRAME r2, r3 @ save callee saves in case of GC - mov r2, r9 @ pass Thread::Current - @ artResolveStringFromCode(Method* referrer, uint32_t string_idx, Thread*) - bl artResolveStringFromCode - RESTORE_REFS_ONLY_CALLEE_SAVE_FRAME - RETURN_IF_RESULT_IS_NON_ZERO - DELIVER_PENDING_EXCEPTION -END art_quick_resolve_string - -// Macro to facilitate adding new allocation entrypoints. -.macro TWO_ARG_DOWNCALL name, entrypoint, return - .extern \entrypoint -ENTRY \name - SETUP_REFS_ONLY_CALLEE_SAVE_FRAME r2, r3 @ save callee saves in case of GC - mov r2, r9 @ pass Thread::Current - bl \entrypoint @ (uint32_t type_idx, Method* method, Thread*) - RESTORE_REFS_ONLY_CALLEE_SAVE_FRAME - \return - DELIVER_PENDING_EXCEPTION -END \name -.endm - -// Macro to facilitate adding new array allocation entrypoints. -.macro THREE_ARG_DOWNCALL name, entrypoint, return - .extern \entrypoint -ENTRY \name - SETUP_REFS_ONLY_CALLEE_SAVE_FRAME r3, r12 @ save callee saves in case of GC - mov r3, r9 @ pass Thread::Current - @ (uint32_t type_idx, Method* method, int32_t component_count, Thread*) - bl \entrypoint - RESTORE_REFS_ONLY_CALLEE_SAVE_FRAME - \return - DELIVER_PENDING_EXCEPTION -END \name -.endm +TWO_ARG_DOWNCALL art_quick_resolve_string, artResolveStringFromCode, RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER // Generate the allocation entrypoints for each allocator. GENERATE_ALL_ALLOC_ENTRYPOINTS diff --git a/runtime/arch/arm64/quick_entrypoints_arm64.S b/runtime/arch/arm64/quick_entrypoints_arm64.S index 6047bb063f..770073b5ba 100644 --- a/runtime/arch/arm64/quick_entrypoints_arm64.S +++ b/runtime/arch/arm64/quick_entrypoints_arm64.S @@ -1229,7 +1229,6 @@ ENTRY \name bl \entrypoint // (uint32_t type_idx, Method* method, Thread*) RESTORE_REFS_ONLY_CALLEE_SAVE_FRAME \return - DELIVER_PENDING_EXCEPTION END \name .endm @@ -1242,7 +1241,6 @@ ENTRY \name bl \entrypoint RESTORE_REFS_ONLY_CALLEE_SAVE_FRAME \return - DELIVER_PENDING_EXCEPTION END \name .endm @@ -1283,6 +1281,13 @@ ENTRY \name END \name .endm +.macro RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER + cbz w0, 1f // result zero branch over + ret // return +1: + DELIVER_PENDING_EXCEPTION +.endm + /* * Entry from managed code that calls artHandleFillArrayDataFromCode and delivers exception on * failure. @@ -1294,10 +1299,10 @@ TWO_ARG_REF_DOWNCALL art_quick_handle_fill_data, artHandleFillArrayDataFromCode, * initializer and deliver the exception on error. On success the static storage base is * returned. */ -TWO_ARG_DOWNCALL art_quick_initialize_static_storage, artInitializeStaticStorageFromCode, RETURN_IF_RESULT_IS_NON_ZERO +TWO_ARG_DOWNCALL art_quick_initialize_static_storage, artInitializeStaticStorageFromCode, RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER -TWO_ARG_DOWNCALL art_quick_initialize_type, artInitializeTypeFromCode, RETURN_IF_RESULT_IS_NON_ZERO -TWO_ARG_DOWNCALL art_quick_initialize_type_and_verify_access, artInitializeTypeAndVerifyAccessFromCode, RETURN_IF_RESULT_IS_NON_ZERO +TWO_ARG_DOWNCALL art_quick_initialize_type, artInitializeTypeFromCode, RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER +TWO_ARG_DOWNCALL art_quick_initialize_type_and_verify_access, artInitializeTypeAndVerifyAccessFromCode, RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER ONE_ARG_REF_DOWNCALL art_quick_get_boolean_static, artGetBooleanStaticFromCode, RETURN_OR_DELIVER_PENDING_EXCEPTION_X1 ONE_ARG_REF_DOWNCALL art_quick_get_byte_static, artGetByteStaticFromCode, RETURN_OR_DELIVER_PENDING_EXCEPTION_X1 @@ -1345,7 +1350,7 @@ END art_quick_set64_static * w1 holds the string index. The fast path check for hit in strings cache has already been * performed. */ -TWO_ARG_DOWNCALL art_quick_resolve_string, artResolveStringFromCode, RETURN_IF_RESULT_IS_NON_ZERO +TWO_ARG_DOWNCALL art_quick_resolve_string, artResolveStringFromCode, RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER // Generate the allocation entrypoints for each allocator. GENERATE_ALL_ALLOC_ENTRYPOINTS diff --git a/runtime/arch/mips/quick_entrypoints_mips.S b/runtime/arch/mips/quick_entrypoints_mips.S index a0fc6d2f9c..509f9910a2 100644 --- a/runtime/arch/mips/quick_entrypoints_mips.S +++ b/runtime/arch/mips/quick_entrypoints_mips.S @@ -299,7 +299,7 @@ DELIVER_PENDING_EXCEPTION .endm -.macro RETURN_IF_RESULT_IS_NON_ZERO +.macro RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER RESTORE_REFS_ONLY_CALLEE_SAVE_FRAME beqz $v0, 1f # success? nop @@ -696,44 +696,6 @@ ENTRY art_quick_aput_obj END art_quick_aput_obj /* - * Entry from managed code when uninitialized static storage, this stub will run the class - * initializer and deliver the exception on error. On success the static storage base is - * returned. - */ - .extern artInitializeStaticStorageFromCode -ENTRY art_quick_initialize_static_storage - SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC - # artInitializeStaticStorageFromCode(uint32_t type_idx, Method* referrer, Thread*) - jal artInitializeStaticStorageFromCode - move $a2, rSELF # pass Thread::Current - RETURN_IF_RESULT_IS_NON_ZERO -END art_quick_initialize_static_storage - - /* - * Entry from managed code when dex cache misses for a type_idx. - */ - .extern artInitializeTypeFromCode -ENTRY art_quick_initialize_type - SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC - # artInitializeTypeFromCode(uint32_t type_idx, Method* referrer, Thread*) - jal artInitializeTypeFromCode - move $a2, rSELF # pass Thread::Current - RETURN_IF_RESULT_IS_NON_ZERO -END art_quick_initialize_type - - /* - * Entry from managed code when type_idx needs to be checked for access and dex cache may also - * miss. - */ - .extern artInitializeTypeAndVerifyAccessFromCode -ENTRY art_quick_initialize_type_and_verify_access - SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC - # artInitializeTypeFromCode(uint32_t type_idx, Method* referrer, Thread*) - jal artInitializeTypeAndVerifyAccessFromCode - move $a2, rSELF # pass Thread::Current - RETURN_IF_RESULT_IS_NON_ZERO -END art_quick_initialize_type_and_verify_access - /* * Called by managed code to resolve a static field and load a boolean primitive value. */ .extern artGetBooleanStaticFromCode @@ -1018,22 +980,6 @@ ENTRY art_quick_set_obj_instance RETURN_IF_ZERO END art_quick_set_obj_instance - /* - * Entry from managed code to resolve a string, this stub will allocate a String and deliver an - * exception on error. On success the String is returned. R0 holds the referring method, - * R1 holds the string index. The fast path check for hit in strings cache has already been - * performed. - */ - .extern artResolveStringFromCode -ENTRY art_quick_resolve_string - SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC - # artResolveStringFromCode(Method* referrer, uint32_t string_idx, Thread*) - jal artResolveStringFromCode - move $a2, rSELF # pass Thread::Current - RETURN_IF_RESULT_IS_NON_ZERO -END art_quick_resolve_string - - // Macro to facilitate adding new allocation entrypoints. .macro TWO_ARG_DOWNCALL name, entrypoint, return .extern \entrypoint @@ -1059,6 +1005,32 @@ END \name GENERATE_ALL_ALLOC_ENTRYPOINTS /* + * Entry from managed code to resolve a string, this stub will allocate a String and deliver an + * exception on error. On success the String is returned. R0 holds the referring method, + * R1 holds the string index. The fast path check for hit in strings cache has already been + * performed. + */ +TWO_ARG_DOWNCALL art_quick_resolve_string, artResolveStringFromCode, RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER + + /* + * Entry from managed code when uninitialized static storage, this stub will run the class + * initializer and deliver the exception on error. On success the static storage base is + * returned. + */ +TWO_ARG_DOWNCALL art_quick_initialize_static_storage, artInitializeStaticStorageFromCode, RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER + + /* + * Entry from managed code when dex cache misses for a type_idx. + */ +TWO_ARG_DOWNCALL art_quick_initialize_type, artInitializeTypeFromCode, RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER + + /* + * Entry from managed code when type_idx needs to be checked for access and dex cache may also + * miss. + */ +TWO_ARG_DOWNCALL art_quick_initialize_type_and_verify_access, artInitializeTypeAndVerifyAccessFromCode, RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER + + /* * Called by managed code when the value in rSUSPEND has been decremented to 0. */ .extern artTestSuspendFromCode diff --git a/runtime/arch/quick_alloc_entrypoints.S b/runtime/arch/quick_alloc_entrypoints.S index 632c5f372a..53b9f4e966 100644 --- a/runtime/arch/quick_alloc_entrypoints.S +++ b/runtime/arch/quick_alloc_entrypoints.S @@ -16,25 +16,25 @@ .macro GENERATE_ALLOC_ENTRYPOINTS c_suffix, cxx_suffix // Called by managed code to allocate an object. -TWO_ARG_DOWNCALL art_quick_alloc_object\c_suffix, artAllocObjectFromCode\cxx_suffix, RETURN_IF_RESULT_IS_NON_ZERO +TWO_ARG_DOWNCALL art_quick_alloc_object\c_suffix, artAllocObjectFromCode\cxx_suffix, RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER // Called by managed code to allocate an object of a resolved class. -TWO_ARG_DOWNCALL art_quick_alloc_object_resolved\c_suffix, artAllocObjectFromCodeResolved\cxx_suffix, RETURN_IF_RESULT_IS_NON_ZERO +TWO_ARG_DOWNCALL art_quick_alloc_object_resolved\c_suffix, artAllocObjectFromCodeResolved\cxx_suffix, RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER // Called by managed code to allocate an object of an initialized class. -TWO_ARG_DOWNCALL art_quick_alloc_object_initialized\c_suffix, artAllocObjectFromCodeInitialized\cxx_suffix, RETURN_IF_RESULT_IS_NON_ZERO +TWO_ARG_DOWNCALL art_quick_alloc_object_initialized\c_suffix, artAllocObjectFromCodeInitialized\cxx_suffix, RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER // Called by managed code to allocate an object when the caller doesn't know whether it has access // to the created type. -TWO_ARG_DOWNCALL art_quick_alloc_object_with_access_check\c_suffix, artAllocObjectFromCodeWithAccessCheck\cxx_suffix, RETURN_IF_RESULT_IS_NON_ZERO +TWO_ARG_DOWNCALL art_quick_alloc_object_with_access_check\c_suffix, artAllocObjectFromCodeWithAccessCheck\cxx_suffix, RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER // Called by managed code to allocate an array. -THREE_ARG_DOWNCALL art_quick_alloc_array\c_suffix, artAllocArrayFromCode\cxx_suffix, RETURN_IF_RESULT_IS_NON_ZERO +THREE_ARG_DOWNCALL art_quick_alloc_array\c_suffix, artAllocArrayFromCode\cxx_suffix, RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER // Called by managed code to allocate an array of a resolve class. -THREE_ARG_DOWNCALL art_quick_alloc_array_resolved\c_suffix, artAllocArrayFromCodeResolved\cxx_suffix, RETURN_IF_RESULT_IS_NON_ZERO +THREE_ARG_DOWNCALL art_quick_alloc_array_resolved\c_suffix, artAllocArrayFromCodeResolved\cxx_suffix, RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER // Called by managed code to allocate an array when the caller doesn't know whether it has access // to the created type. -THREE_ARG_DOWNCALL art_quick_alloc_array_with_access_check\c_suffix, artAllocArrayFromCodeWithAccessCheck\cxx_suffix, RETURN_IF_RESULT_IS_NON_ZERO +THREE_ARG_DOWNCALL art_quick_alloc_array_with_access_check\c_suffix, artAllocArrayFromCodeWithAccessCheck\cxx_suffix, RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER // Called by managed code to allocate an array in a special case for FILLED_NEW_ARRAY. -THREE_ARG_DOWNCALL art_quick_check_and_alloc_array\c_suffix, artCheckAndAllocArrayFromCode\cxx_suffix, RETURN_IF_RESULT_IS_NON_ZERO +THREE_ARG_DOWNCALL art_quick_check_and_alloc_array\c_suffix, artCheckAndAllocArrayFromCode\cxx_suffix, RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER // Called by managed code to allocate an array in a special case for FILLED_NEW_ARRAY. -THREE_ARG_DOWNCALL art_quick_check_and_alloc_array_with_access_check\c_suffix, artCheckAndAllocArrayFromCodeWithAccessCheck\cxx_suffix, RETURN_IF_RESULT_IS_NON_ZERO +THREE_ARG_DOWNCALL art_quick_check_and_alloc_array_with_access_check\c_suffix, artCheckAndAllocArrayFromCodeWithAccessCheck\cxx_suffix, RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER .endm .macro GENERATE_ALL_ALLOC_ENTRYPOINTS diff --git a/runtime/arch/stub_test.cc b/runtime/arch/stub_test.cc index 0fcd297497..285007c48d 100644 --- a/runtime/arch/stub_test.cc +++ b/runtime/arch/stub_test.cc @@ -1139,8 +1139,8 @@ TEST_F(StubTest, AllocObjectArray) { if ((false)) { // Use an arbitrary method from c to use as referrer size_t result = Invoke3(static_cast<size_t>(c->GetDexTypeIndex()), // type_idx - reinterpret_cast<size_t>(c_obj->GetVirtualMethod(0)), // arbitrary 10U, + reinterpret_cast<size_t>(c_obj->GetVirtualMethod(0)), // arbitrary StubTest::GetEntrypoint(self, kQuickAllocArray), self); @@ -1155,7 +1155,8 @@ TEST_F(StubTest, AllocObjectArray) { { // We can use nullptr in the second argument as we do not need a method here (not used in // resolved/initialized cases) - size_t result = Invoke3(reinterpret_cast<size_t>(c.Get()), reinterpret_cast<size_t>(nullptr), 10U, + size_t result = Invoke3(reinterpret_cast<size_t>(c.Get()), 10U, + reinterpret_cast<size_t>(nullptr), StubTest::GetEntrypoint(self, kQuickAllocArrayResolved), self); EXPECT_FALSE(self->IsExceptionPending()) << PrettyTypeOf(self->GetException(nullptr)); @@ -1173,8 +1174,9 @@ TEST_F(StubTest, AllocObjectArray) { // Out-of-memory. { - size_t result = Invoke3(reinterpret_cast<size_t>(c.Get()), reinterpret_cast<size_t>(nullptr), + size_t result = Invoke3(reinterpret_cast<size_t>(c.Get()), GB, // that should fail... + reinterpret_cast<size_t>(nullptr), StubTest::GetEntrypoint(self, kQuickAllocArrayResolved), self); diff --git a/runtime/entrypoints/entrypoint_utils-inl.h b/runtime/entrypoints/entrypoint_utils-inl.h index 67265a28ff..35579d66d4 100644 --- a/runtime/entrypoints/entrypoint_utils-inl.h +++ b/runtime/entrypoints/entrypoint_utils-inl.h @@ -172,8 +172,8 @@ inline mirror::Object* AllocObjectFromCodeInitialized(mirror::Class* klass, template <bool kAccessCheck> ALWAYS_INLINE inline mirror::Class* CheckArrayAlloc(uint32_t type_idx, - mirror::ArtMethod* method, int32_t component_count, + mirror::ArtMethod* method, bool* slow_path) { if (UNLIKELY(component_count < 0)) { ThrowNegativeArraySizeException(component_count); @@ -208,12 +208,12 @@ inline mirror::Class* CheckArrayAlloc(uint32_t type_idx, template <bool kAccessCheck, bool kInstrumented> ALWAYS_INLINE inline mirror::Array* AllocArrayFromCode(uint32_t type_idx, - mirror::ArtMethod* method, int32_t component_count, + mirror::ArtMethod* method, Thread* self, gc::AllocatorType allocator_type) { bool slow_path = false; - mirror::Class* klass = CheckArrayAlloc<kAccessCheck>(type_idx, method, component_count, + mirror::Class* klass = CheckArrayAlloc<kAccessCheck>(type_idx, component_count, method, &slow_path); if (UNLIKELY(slow_path)) { if (klass == nullptr) { @@ -231,8 +231,8 @@ inline mirror::Array* AllocArrayFromCode(uint32_t type_idx, template <bool kAccessCheck, bool kInstrumented> ALWAYS_INLINE inline mirror::Array* AllocArrayFromCodeResolved(mirror::Class* klass, - mirror::ArtMethod* method, int32_t component_count, + mirror::ArtMethod* method, Thread* self, gc::AllocatorType allocator_type) { DCHECK(klass != nullptr); diff --git a/runtime/entrypoints/entrypoint_utils.cc b/runtime/entrypoints/entrypoint_utils.cc index c329fe6920..e734d4512d 100644 --- a/runtime/entrypoints/entrypoint_utils.cc +++ b/runtime/entrypoints/entrypoint_utils.cc @@ -33,8 +33,8 @@ namespace art { static inline mirror::Class* CheckFilledNewArrayAlloc(uint32_t type_idx, - mirror::ArtMethod* referrer, int32_t component_count, + mirror::ArtMethod* referrer, Thread* self, bool access_check) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { @@ -76,11 +76,11 @@ static inline mirror::Class* CheckFilledNewArrayAlloc(uint32_t type_idx, } // Helper function to allocate array for FILLED_NEW_ARRAY. -mirror::Array* CheckAndAllocArrayFromCode(uint32_t type_idx, mirror::ArtMethod* referrer, - int32_t component_count, Thread* self, +mirror::Array* CheckAndAllocArrayFromCode(uint32_t type_idx, int32_t component_count, + mirror::ArtMethod* referrer, Thread* self, bool access_check, gc::AllocatorType /* allocator_type */) { - mirror::Class* klass = CheckFilledNewArrayAlloc(type_idx, referrer, component_count, self, + mirror::Class* klass = CheckFilledNewArrayAlloc(type_idx, component_count, referrer, self, access_check); if (UNLIKELY(klass == nullptr)) { return nullptr; @@ -96,12 +96,12 @@ mirror::Array* CheckAndAllocArrayFromCode(uint32_t type_idx, mirror::ArtMethod* // Helper function to allocate array for FILLED_NEW_ARRAY. mirror::Array* CheckAndAllocArrayFromCodeInstrumented(uint32_t type_idx, - mirror::ArtMethod* referrer, int32_t component_count, + mirror::ArtMethod* referrer, Thread* self, bool access_check, gc::AllocatorType /* allocator_type */) { - mirror::Class* klass = CheckFilledNewArrayAlloc(type_idx, referrer, component_count, self, + mirror::Class* klass = CheckFilledNewArrayAlloc(type_idx, component_count, referrer, self, access_check); if (UNLIKELY(klass == nullptr)) { return nullptr; diff --git a/runtime/entrypoints/entrypoint_utils.h b/runtime/entrypoints/entrypoint_utils.h index 0531122ed2..77eec46161 100644 --- a/runtime/entrypoints/entrypoint_utils.h +++ b/runtime/entrypoints/entrypoint_utils.h @@ -80,8 +80,8 @@ ALWAYS_INLINE inline mirror::Object* AllocObjectFromCodeInitialized(mirror::Clas template <bool kAccessCheck> ALWAYS_INLINE inline mirror::Class* CheckArrayAlloc(uint32_t type_idx, - mirror::ArtMethod* method, int32_t component_count, + mirror::ArtMethod* method, bool* slow_path) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); @@ -91,29 +91,30 @@ ALWAYS_INLINE inline mirror::Class* CheckArrayAlloc(uint32_t type_idx, // check. template <bool kAccessCheck, bool kInstrumented> ALWAYS_INLINE inline mirror::Array* AllocArrayFromCode(uint32_t type_idx, - mirror::ArtMethod* method, int32_t component_count, + mirror::ArtMethod* method, Thread* self, gc::AllocatorType allocator_type) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); template <bool kAccessCheck, bool kInstrumented> ALWAYS_INLINE inline mirror::Array* AllocArrayFromCodeResolved(mirror::Class* klass, - mirror::ArtMethod* method, int32_t component_count, + mirror::ArtMethod* method, Thread* self, gc::AllocatorType allocator_type) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); -extern mirror::Array* CheckAndAllocArrayFromCode(uint32_t type_idx, mirror::ArtMethod* method, - int32_t component_count, Thread* self, +extern mirror::Array* CheckAndAllocArrayFromCode(uint32_t type_idx, int32_t component_count, + mirror::ArtMethod* method, Thread* self, bool access_check, gc::AllocatorType allocator_type) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); extern mirror::Array* CheckAndAllocArrayFromCodeInstrumented(uint32_t type_idx, + int32_t component_count, mirror::ArtMethod* method, - int32_t component_count, Thread* self, + Thread* self, bool access_check, gc::AllocatorType allocator_type) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); diff --git a/runtime/entrypoints/quick/quick_alloc_entrypoints.cc b/runtime/entrypoints/quick/quick_alloc_entrypoints.cc index c0b79b2b6c..1fd1150e0d 100644 --- a/runtime/entrypoints/quick/quick_alloc_entrypoints.cc +++ b/runtime/entrypoints/quick/quick_alloc_entrypoints.cc @@ -114,44 +114,44 @@ extern "C" mirror::Object* artAllocObjectFromCodeWithAccessCheck##suffix##suffix return AllocObjectFromCode<true, instrumented_bool>(type_idx, method, self, allocator_type); \ } \ extern "C" mirror::Array* artAllocArrayFromCode##suffix##suffix2( \ - uint32_t type_idx, mirror::ArtMethod* method, int32_t component_count, Thread* self) \ + uint32_t type_idx, int32_t component_count, mirror::ArtMethod* method, Thread* self) \ SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { \ ScopedQuickEntrypointChecks sqec(self); \ - return AllocArrayFromCode<false, instrumented_bool>(type_idx, method, component_count, self, \ + return AllocArrayFromCode<false, instrumented_bool>(type_idx, component_count, method, self, \ allocator_type); \ } \ extern "C" mirror::Array* artAllocArrayFromCodeResolved##suffix##suffix2( \ - mirror::Class* klass, mirror::ArtMethod* method, int32_t component_count, Thread* self) \ + mirror::Class* klass, int32_t component_count, mirror::ArtMethod* method, Thread* self) \ SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { \ ScopedQuickEntrypointChecks sqec(self); \ - return AllocArrayFromCodeResolved<false, instrumented_bool>(klass, method, component_count, self, \ + return AllocArrayFromCodeResolved<false, instrumented_bool>(klass, component_count, method, self, \ allocator_type); \ } \ extern "C" mirror::Array* artAllocArrayFromCodeWithAccessCheck##suffix##suffix2( \ - uint32_t type_idx, mirror::ArtMethod* method, int32_t component_count, Thread* self) \ + uint32_t type_idx, int32_t component_count, mirror::ArtMethod* method, Thread* self) \ SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { \ ScopedQuickEntrypointChecks sqec(self); \ - return AllocArrayFromCode<true, instrumented_bool>(type_idx, method, component_count, self, \ + return AllocArrayFromCode<true, instrumented_bool>(type_idx, component_count, method, self, \ allocator_type); \ } \ extern "C" mirror::Array* artCheckAndAllocArrayFromCode##suffix##suffix2( \ - uint32_t type_idx, mirror::ArtMethod* method, int32_t component_count, Thread* self) \ + uint32_t type_idx, int32_t component_count, mirror::ArtMethod* method, Thread* self) \ SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { \ ScopedQuickEntrypointChecks sqec(self); \ if (!instrumented_bool) { \ - return CheckAndAllocArrayFromCode(type_idx, method, component_count, self, false, allocator_type); \ + return CheckAndAllocArrayFromCode(type_idx, component_count, method, self, false, allocator_type); \ } else { \ - return CheckAndAllocArrayFromCodeInstrumented(type_idx, method, component_count, self, false, allocator_type); \ + return CheckAndAllocArrayFromCodeInstrumented(type_idx, component_count, method, self, false, allocator_type); \ } \ } \ extern "C" mirror::Array* artCheckAndAllocArrayFromCodeWithAccessCheck##suffix##suffix2( \ - uint32_t type_idx, mirror::ArtMethod* method, int32_t component_count, Thread* self) \ + uint32_t type_idx, int32_t component_count, mirror::ArtMethod* method, Thread* self) \ SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { \ ScopedQuickEntrypointChecks sqec(self); \ if (!instrumented_bool) { \ - return CheckAndAllocArrayFromCode(type_idx, method, component_count, self, true, allocator_type); \ + return CheckAndAllocArrayFromCode(type_idx, component_count, method, self, true, allocator_type); \ } else { \ - return CheckAndAllocArrayFromCodeInstrumented(type_idx, method, component_count, self, true, allocator_type); \ + return CheckAndAllocArrayFromCodeInstrumented(type_idx, component_count, method, self, true, allocator_type); \ } \ } @@ -165,24 +165,24 @@ GENERATE_ENTRYPOINTS_FOR_ALLOCATOR(BumpPointer, gc::kAllocatorTypeBumpPointer) GENERATE_ENTRYPOINTS_FOR_ALLOCATOR(TLAB, gc::kAllocatorTypeTLAB) #define GENERATE_ENTRYPOINTS(suffix) \ -extern "C" void* art_quick_alloc_array##suffix(uint32_t, void*, int32_t); \ -extern "C" void* art_quick_alloc_array_resolved##suffix(void* klass, void*, int32_t); \ -extern "C" void* art_quick_alloc_array_with_access_check##suffix(uint32_t, void*, int32_t); \ -extern "C" void* art_quick_alloc_object##suffix(uint32_t type_idx, void* method); \ -extern "C" void* art_quick_alloc_object_resolved##suffix(void* klass, void* method); \ -extern "C" void* art_quick_alloc_object_initialized##suffix(void* klass, void* method); \ -extern "C" void* art_quick_alloc_object_with_access_check##suffix(uint32_t type_idx, void* method); \ -extern "C" void* art_quick_check_and_alloc_array##suffix(uint32_t, void*, int32_t); \ -extern "C" void* art_quick_check_and_alloc_array_with_access_check##suffix(uint32_t, void*, int32_t); \ -extern "C" void* art_quick_alloc_array##suffix##_instrumented(uint32_t, void*, int32_t); \ -extern "C" void* art_quick_alloc_array_resolved##suffix##_instrumented(void* klass, void*, int32_t); \ -extern "C" void* art_quick_alloc_array_with_access_check##suffix##_instrumented(uint32_t, void*, int32_t); \ -extern "C" void* art_quick_alloc_object##suffix##_instrumented(uint32_t type_idx, void* method); \ -extern "C" void* art_quick_alloc_object_resolved##suffix##_instrumented(void* klass, void* method); \ -extern "C" void* art_quick_alloc_object_initialized##suffix##_instrumented(void* klass, void* method); \ -extern "C" void* art_quick_alloc_object_with_access_check##suffix##_instrumented(uint32_t type_idx, void* method); \ -extern "C" void* art_quick_check_and_alloc_array##suffix##_instrumented(uint32_t, void*, int32_t); \ -extern "C" void* art_quick_check_and_alloc_array_with_access_check##suffix##_instrumented(uint32_t, void*, int32_t); \ +extern "C" void* art_quick_alloc_array##suffix(uint32_t, int32_t, mirror::ArtMethod* ref); \ +extern "C" void* art_quick_alloc_array_resolved##suffix(mirror::Class* klass, int32_t, mirror::ArtMethod* ref); \ +extern "C" void* art_quick_alloc_array_with_access_check##suffix(uint32_t, int32_t, mirror::ArtMethod* ref); \ +extern "C" void* art_quick_alloc_object##suffix(uint32_t type_idx, mirror::ArtMethod* ref); \ +extern "C" void* art_quick_alloc_object_resolved##suffix(mirror::Class* klass, mirror::ArtMethod* ref); \ +extern "C" void* art_quick_alloc_object_initialized##suffix(mirror::Class* klass, mirror::ArtMethod* ref); \ +extern "C" void* art_quick_alloc_object_with_access_check##suffix(uint32_t type_idx, mirror::ArtMethod* ref); \ +extern "C" void* art_quick_check_and_alloc_array##suffix(uint32_t, int32_t, mirror::ArtMethod* ref); \ +extern "C" void* art_quick_check_and_alloc_array_with_access_check##suffix(uint32_t, int32_t, mirror::ArtMethod* ref); \ +extern "C" void* art_quick_alloc_array##suffix##_instrumented(uint32_t, int32_t, mirror::ArtMethod* ref); \ +extern "C" void* art_quick_alloc_array_resolved##suffix##_instrumented(mirror::Class* klass, int32_t, mirror::ArtMethod* ref); \ +extern "C" void* art_quick_alloc_array_with_access_check##suffix##_instrumented(uint32_t, int32_t, mirror::ArtMethod* ref); \ +extern "C" void* art_quick_alloc_object##suffix##_instrumented(uint32_t type_idx, mirror::ArtMethod* ref); \ +extern "C" void* art_quick_alloc_object_resolved##suffix##_instrumented(mirror::Class* klass, mirror::ArtMethod* ref); \ +extern "C" void* art_quick_alloc_object_initialized##suffix##_instrumented(mirror::Class* klass, mirror::ArtMethod* ref); \ +extern "C" void* art_quick_alloc_object_with_access_check##suffix##_instrumented(uint32_t type_idx, mirror::ArtMethod* ref); \ +extern "C" void* art_quick_check_and_alloc_array##suffix##_instrumented(uint32_t, int32_t, mirror::ArtMethod* ref); \ +extern "C" void* art_quick_check_and_alloc_array_with_access_check##suffix##_instrumented(uint32_t, int32_t, mirror::ArtMethod* ref); \ void SetQuickAllocEntryPoints##suffix(QuickEntryPoints* qpoints, bool instrumented) { \ if (instrumented) { \ qpoints->pAllocArray = art_quick_alloc_array##suffix##_instrumented; \ diff --git a/runtime/entrypoints/quick/quick_default_externs.h b/runtime/entrypoints/quick/quick_default_externs.h index 7d77721f7b..b7e8d50790 100644 --- a/runtime/entrypoints/quick/quick_default_externs.h +++ b/runtime/entrypoints/quick/quick_default_externs.h @@ -19,16 +19,25 @@ #include <cstdint> +namespace art { +namespace mirror { +class Array; +class ArtMethod; +class Class; +class Object; +} // namespace mirror +} // namespace art + // These are extern declarations of assembly stubs with common names. // Cast entrypoints. -extern "C" void art_quick_check_cast(void*, void*); +extern "C" void art_quick_check_cast(const art::mirror::Class*, const art::mirror::Class*); // DexCache entrypoints. -extern "C" void* art_quick_initialize_static_storage(uint32_t, void*); -extern "C" void* art_quick_initialize_type(uint32_t, void*); -extern "C" void* art_quick_initialize_type_and_verify_access(uint32_t, void*); -extern "C" void* art_quick_resolve_string(void*, uint32_t); +extern "C" void* art_quick_initialize_static_storage(uint32_t, art::mirror::ArtMethod*); +extern "C" void* art_quick_initialize_type(uint32_t, art::mirror::ArtMethod*); +extern "C" void* art_quick_initialize_type_and_verify_access(uint32_t, art::mirror::ArtMethod*); +extern "C" void* art_quick_resolve_string(uint32_t, art::mirror::ArtMethod*); // Field entrypoints. extern "C" int art_quick_set8_instance(uint32_t, void*, int8_t); @@ -57,14 +66,16 @@ extern "C" void* art_quick_get_obj_instance(uint32_t, void*); extern "C" void* art_quick_get_obj_static(uint32_t); // Array entrypoints. -extern "C" void art_quick_aput_obj_with_null_and_bound_check(void*, uint32_t, void*); -extern "C" void art_quick_aput_obj_with_bound_check(void*, uint32_t, void*); -extern "C" void art_quick_aput_obj(void*, uint32_t, void*); +extern "C" void art_quick_aput_obj_with_null_and_bound_check(art::mirror::Array*, int32_t, + art::mirror::Object*); +extern "C" void art_quick_aput_obj_with_bound_check(art::mirror::Array*, int32_t, + art::mirror::Object*); +extern "C" void art_quick_aput_obj(art::mirror::Array*, int32_t, art::mirror::Object*); extern "C" void art_quick_handle_fill_data(void*, void*); // Lock entrypoints. -extern "C" void art_quick_lock_object(void*); -extern "C" void art_quick_unlock_object(void*); +extern "C" void art_quick_lock_object(art::mirror::Object*); +extern "C" void art_quick_unlock_object(art::mirror::Object*); // Math entrypoints. extern "C" int64_t art_quick_d2l(double); @@ -99,7 +110,7 @@ extern "C" void art_quick_invoke_virtual_trampoline_with_access_check(uint32_t, extern "C" void art_quick_test_suspend(); // Throw entrypoints. -extern "C" void art_quick_deliver_exception(void*); +extern "C" void art_quick_deliver_exception(art::mirror::Object*); extern "C" void art_quick_throw_array_bounds(int32_t index, int32_t limit); extern "C" void art_quick_throw_div_zero(); extern "C" void art_quick_throw_no_such_method(int32_t method_idx); diff --git a/runtime/entrypoints/quick/quick_dexcache_entrypoints.cc b/runtime/entrypoints/quick/quick_dexcache_entrypoints.cc index 2e7c8bab43..348495d354 100644 --- a/runtime/entrypoints/quick/quick_dexcache_entrypoints.cc +++ b/runtime/entrypoints/quick/quick_dexcache_entrypoints.cc @@ -55,8 +55,8 @@ extern "C" mirror::Class* artInitializeTypeAndVerifyAccessFromCode(uint32_t type return ResolveVerifyAndClinit(type_idx, referrer, self, false, true); } -extern "C" mirror::String* artResolveStringFromCode(mirror::ArtMethod* referrer, - int32_t string_idx, +extern "C" mirror::String* artResolveStringFromCode(int32_t string_idx, + mirror::ArtMethod* referrer, Thread* self) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { ScopedQuickEntrypointChecks sqec(self); diff --git a/runtime/entrypoints/quick/quick_entrypoints.h b/runtime/entrypoints/quick/quick_entrypoints.h index 8c108a816d..db8c0e3c58 100644 --- a/runtime/entrypoints/quick/quick_entrypoints.h +++ b/runtime/entrypoints/quick/quick_entrypoints.h @@ -28,6 +28,7 @@ namespace art { namespace mirror { +class Array; class ArtMethod; class Class; class Object; diff --git a/runtime/entrypoints/quick/quick_entrypoints_enum.h b/runtime/entrypoints/quick/quick_entrypoints_enum.h index 84158cd8b0..5a95491fbc 100644 --- a/runtime/entrypoints/quick/quick_entrypoints_enum.h +++ b/runtime/entrypoints/quick/quick_entrypoints_enum.h @@ -18,6 +18,7 @@ #define ART_RUNTIME_ENTRYPOINTS_QUICK_QUICK_ENTRYPOINTS_ENUM_H_ #include "quick_entrypoints.h" +#include "quick_entrypoints_enum.h" #include "thread.h" namespace art { @@ -47,10 +48,20 @@ static ThreadOffset<pointer_size> GetThreadOffset(QuickEntrypointEnum trampoline #undef ENTRYPOINT_ENUM }; LOG(FATAL) << "Unexpected trampoline " << static_cast<int>(trampoline); - return ThreadOffset<pointer_size>(-1); + UNREACHABLE(); } -} // namespace art +// Do a check functions to be able to test whether the right signature is used. +template <QuickEntrypointEnum entrypoint, typename... Types> +void CheckEntrypointTypes(); +#define ENTRYPOINT_ENUM(name, ...) \ +template <> inline void CheckEntrypointTypes<kQuick ## name, __VA_ARGS__>() {}; // NOLINT [readability/braces] [4] +#include "quick_entrypoints_list.h" + QUICK_ENTRYPOINT_LIST(ENTRYPOINT_ENUM) +#undef QUICK_ENTRYPOINT_LIST +#undef ENTRYPOINT_ENUM + +} // namespace art #endif // ART_RUNTIME_ENTRYPOINTS_QUICK_QUICK_ENTRYPOINTS_ENUM_H_ diff --git a/runtime/entrypoints/quick/quick_entrypoints_list.h b/runtime/entrypoints/quick/quick_entrypoints_list.h index fbc7913d06..da454f3110 100644 --- a/runtime/entrypoints/quick/quick_entrypoints_list.h +++ b/runtime/entrypoints/quick/quick_entrypoints_list.h @@ -20,23 +20,23 @@ // All quick entrypoints. Format is name, return type, argument types. #define QUICK_ENTRYPOINT_LIST(V) \ - V(AllocArray, void*, uint32_t, void*, int32_t) \ - V(AllocArrayResolved, void*, void*, void*, int32_t) \ - V(AllocArrayWithAccessCheck, void*, uint32_t, void*, int32_t) \ - V(AllocObject, void*, uint32_t, void*) \ - V(AllocObjectResolved, void*, void*, void*) \ - V(AllocObjectInitialized, void*, void*, void*) \ - V(AllocObjectWithAccessCheck, void*, uint32_t, void*) \ - V(CheckAndAllocArray, void*, uint32_t, void*, int32_t) \ - V(CheckAndAllocArrayWithAccessCheck, void*, uint32_t, void*, int32_t) \ + V(AllocArray, void*, uint32_t, int32_t, mirror::ArtMethod*) \ + V(AllocArrayResolved, void*, mirror::Class*, int32_t, mirror::ArtMethod*) \ + V(AllocArrayWithAccessCheck, void*, uint32_t, int32_t, mirror::ArtMethod*) \ + V(AllocObject, void*, uint32_t, mirror::ArtMethod*) \ + V(AllocObjectResolved, void*, mirror::Class*, mirror::ArtMethod*) \ + V(AllocObjectInitialized, void*, mirror::Class*, mirror::ArtMethod*) \ + V(AllocObjectWithAccessCheck, void*, uint32_t, mirror::ArtMethod*) \ + V(CheckAndAllocArray, void*, uint32_t, int32_t, mirror::ArtMethod*) \ + V(CheckAndAllocArrayWithAccessCheck, void*, uint32_t, int32_t, mirror::ArtMethod*) \ \ V(InstanceofNonTrivial, uint32_t, const mirror::Class*, const mirror::Class*) \ - V(CheckCast, void , void*, void*) \ + V(CheckCast, void, const mirror::Class*, const mirror::Class*) \ \ - V(InitializeStaticStorage, void*, uint32_t, void*) \ - V(InitializeTypeAndVerifyAccess, void*, uint32_t, void*) \ - V(InitializeType, void*, uint32_t, void*) \ - V(ResolveString, void*, void*, uint32_t) \ + V(InitializeStaticStorage, void*, uint32_t, mirror::ArtMethod*) \ + V(InitializeTypeAndVerifyAccess, void*, uint32_t, mirror::ArtMethod*) \ + V(InitializeType, void*, uint32_t, mirror::ArtMethod*) \ + V(ResolveString, void*, uint32_t, mirror::ArtMethod*) \ \ V(Set8Instance, int, uint32_t, void*, int8_t) \ V(Set8Static, int, uint32_t, int8_t) \ @@ -63,21 +63,21 @@ V(GetObjInstance, void*, uint32_t, void*) \ V(GetObjStatic, void*, uint32_t) \ \ - V(AputObjectWithNullAndBoundCheck, void, void*, uint32_t, void*) \ - V(AputObjectWithBoundCheck, void, void*, uint32_t, void*) \ - V(AputObject, void, void*, uint32_t, void*) \ + V(AputObjectWithNullAndBoundCheck, void, mirror::Array*, int32_t, mirror::Object*) \ + V(AputObjectWithBoundCheck, void, mirror::Array*, int32_t, mirror::Object*) \ + V(AputObject, void, mirror::Array*, int32_t, mirror::Object*) \ V(HandleFillArrayData, void, void*, void*) \ \ V(JniMethodStart, uint32_t, Thread*) \ - V(JniMethodStartSynchronized, uint32_t, jobject to_lock, Thread* self) \ - V(JniMethodEnd, void, uint32_t cookie, Thread* self) \ - V(JniMethodEndSynchronized, void, uint32_t cookie, jobject locked, Thread* self) \ - V(JniMethodEndWithReference, mirror::Object*, jobject result, uint32_t cookie, Thread* self) \ - V(JniMethodEndWithReferenceSynchronized, mirror::Object*, jobject result, uint32_t cookie, jobject locked, Thread* self) \ + V(JniMethodStartSynchronized, uint32_t, jobject, Thread*) \ + V(JniMethodEnd, void, uint32_t, Thread*) \ + V(JniMethodEndSynchronized, void, uint32_t, jobject, Thread*) \ + V(JniMethodEndWithReference, mirror::Object*, jobject, uint32_t, Thread*) \ + V(JniMethodEndWithReferenceSynchronized, mirror::Object*, jobject, uint32_t, jobject, Thread*) \ V(QuickGenericJniTrampoline, void, mirror::ArtMethod*) \ \ - V(LockObject, void, void*) \ - V(UnlockObject, void, void*) \ + V(LockObject, void, mirror::Object*) \ + V(UnlockObject, void, mirror::Object*) \ \ V(CmpgDouble, int32_t, double, double) \ V(CmpgFloat, int32_t, float, float) \ @@ -114,7 +114,7 @@ \ V(TestSuspend, void, void) \ \ - V(DeliverException, void, void*) \ + V(DeliverException, void, mirror::Object*) \ V(ThrowArrayBounds, void, int32_t, int32_t) \ V(ThrowDivZero, void, void) \ V(ThrowNoSuchMethod, void, int32_t) \ diff --git a/runtime/interpreter/interpreter_goto_table_impl.cc b/runtime/interpreter/interpreter_goto_table_impl.cc index c6102633be..8fcbf908a2 100644 --- a/runtime/interpreter/interpreter_goto_table_impl.cc +++ b/runtime/interpreter/interpreter_goto_table_impl.cc @@ -543,7 +543,7 @@ JValue ExecuteGotoImpl(Thread* self, const DexFile::CodeItem* code_item, ShadowF HANDLE_INSTRUCTION_START(NEW_ARRAY) { int32_t length = shadow_frame.GetVReg(inst->VRegB_22c(inst_data)); Object* obj = AllocArrayFromCode<do_access_check, true>( - inst->VRegC_22c(), shadow_frame.GetMethod(), length, self, + inst->VRegC_22c(), length, shadow_frame.GetMethod(), self, Runtime::Current()->GetHeap()->GetCurrentAllocator()); if (UNLIKELY(obj == NULL)) { HANDLE_PENDING_EXCEPTION(); diff --git a/runtime/interpreter/interpreter_switch_impl.cc b/runtime/interpreter/interpreter_switch_impl.cc index 8bbc69481a..38665c7e0b 100644 --- a/runtime/interpreter/interpreter_switch_impl.cc +++ b/runtime/interpreter/interpreter_switch_impl.cc @@ -455,7 +455,7 @@ JValue ExecuteSwitchImpl(Thread* self, const DexFile::CodeItem* code_item, PREAMBLE(); int32_t length = shadow_frame.GetVReg(inst->VRegB_22c(inst_data)); Object* obj = AllocArrayFromCode<do_access_check, true>( - inst->VRegC_22c(), shadow_frame.GetMethod(), length, self, + inst->VRegC_22c(), length, shadow_frame.GetMethod(), self, Runtime::Current()->GetHeap()->GetCurrentAllocator()); if (UNLIKELY(obj == NULL)) { HANDLE_PENDING_EXCEPTION(); diff --git a/runtime/mirror/object_test.cc b/runtime/mirror/object_test.cc index ae5f60acae..f9c00ce7e9 100644 --- a/runtime/mirror/object_test.cc +++ b/runtime/mirror/object_test.cc @@ -313,7 +313,7 @@ TEST_F(ObjectTest, CheckAndAllocArrayFromCode) { java_lang_dex_file_->GetIndexForStringId(*string_id)); ASSERT_TRUE(type_id != NULL); uint32_t type_idx = java_lang_dex_file_->GetIndexForTypeId(*type_id); - Object* array = CheckAndAllocArrayFromCodeInstrumented(type_idx, sort, 3, Thread::Current(), false, + Object* array = CheckAndAllocArrayFromCodeInstrumented(type_idx, 3, sort, Thread::Current(), false, Runtime::Current()->GetHeap()->GetCurrentAllocator()); EXPECT_TRUE(array->IsArrayInstance()); EXPECT_EQ(3, array->AsArray()->GetLength()); |