static constexpr size_t NterpGetFrameEntrySize(InstructionSet isa) {
uint32_t core_spills = 0;
uint32_t fp_spills = 0; // Note: the return address is considered part of the callee saves. switch (isa) { case InstructionSet::kX86:
core_spills = x86::X86CalleeSaveFrame::GetCoreSpills(CalleeSaveType::kSaveAllCalleeSaves);
fp_spills = x86::X86CalleeSaveFrame::GetFpSpills(CalleeSaveType::kSaveAllCalleeSaves); // x86 also saves registers used for argument passing.
core_spills |= x86::kX86CalleeSaveEverythingSpills; break; case InstructionSet::kX86_64:
core_spills =
x86_64::X86_64CalleeSaveFrame::GetCoreSpills(CalleeSaveType::kSaveAllCalleeSaves);
fp_spills = x86_64::X86_64CalleeSaveFrame::GetFpSpills(CalleeSaveType::kSaveAllCalleeSaves); break; case InstructionSet::kArm: case InstructionSet::kThumb2:
core_spills = arm::ArmCalleeSaveFrame::GetCoreSpills(CalleeSaveType::kSaveAllCalleeSaves);
fp_spills = arm::ArmCalleeSaveFrame::GetFpSpills(CalleeSaveType::kSaveAllCalleeSaves); break; case InstructionSet::kArm64:
core_spills = arm64::Arm64CalleeSaveFrame::GetCoreSpills(CalleeSaveType::kSaveAllCalleeSaves);
fp_spills = arm64::Arm64CalleeSaveFrame::GetFpSpills(CalleeSaveType::kSaveAllCalleeSaves); break; case InstructionSet::kRiscv64:
core_spills =
riscv64::Riscv64CalleeSaveFrame::GetCoreSpills(CalleeSaveType::kSaveAllCalleeSaves);
fp_spills = riscv64::Riscv64CalleeSaveFrame::GetFpSpills(CalleeSaveType::kSaveAllCalleeSaves); break; default:
InstructionSetAbort(isa);
} // Note: the return address is considered part of the callee saves. return (POPCOUNT(core_spills) + POPCOUNT(fp_spills)) * static_cast<size_t>(InstructionSetPointerSize(isa));
}
static uint16_t GetNumberOfOutRegs(const CodeItemDataAccessor& accessor, InstructionSet isa) {
uint16_t out_regs = accessor.OutsSize(); switch (isa) { case InstructionSet::kX86: { // On x86, we use three slots for temporaries.
out_regs = std::max(out_regs, static_cast<uint16_t>(3u)); break;
} default: break;
} return out_regs;
}
// Note: There may be two pieces of alignment but there is no need to align // out args to `kPointerSize` separately before aligning to kStackAlignment. // This allows using the size without padding for the maximum frame size check // in `CanMethodUseNterp()`. static size_t NterpGetFrameSizeWithoutPadding(ArtMethod* method, InstructionSet isa)
REQUIRES_SHARED(Locks::mutator_lock_) {
CodeItemDataAccessor accessor(method->DexInstructionData()); const uint16_t num_regs = accessor.RegistersSize(); const uint16_t out_regs = GetNumberOfOutRegs(accessor, isa);
size_t pointer_size = static_cast<size_t>(InstructionSetPointerSize(isa));
// The frame size nterp will use for the given method. staticinline size_t NterpGetFrameSize(ArtMethod* method, InstructionSet isa)
REQUIRES_SHARED(Locks::mutator_lock_) { return RoundUp(NterpGetFrameSizeWithoutPadding(method, isa), kStackAlignment);
}
uintptr_t NterpGetCatchHandler() { // Nterp uses the same landing pad for all exceptions. The dex_pc_ptr set before // longjmp will actually be used to jmp to the catch handler. returnreinterpret_cast<uintptr_t>(artNterpAsmInstructionEnd);
}
bool CanMethodUseNterp(ArtMethod* method, InstructionSet isa) {
uint32_t access_flags = method->GetAccessFlags(); if (ArtMethod::IsNative(access_flags) ||
!ArtMethod::IsInvokable(access_flags) ||
ArtMethod::MustCountLocks(access_flags) || // Proxy methods do not go through the JIT like other methods, so we don't // run them with nterp.
method->IsProxyMethod()) { returnfalse;
} // There is no need to add the alignment padding size for comparison with aligned limit.
size_t frame_size_without_padding = NterpGetFrameSizeWithoutPadding(method, isa);
DCHECK_EQ(NterpGetFrameSize(method, isa), RoundUp(frame_size_without_padding, kStackAlignment));
static_assert(IsAligned<kStackAlignment>(interpreter::kNterpMaxFrame)); return frame_size_without_padding <= interpreter::kNterpMaxFrame;
}
} // namespace art
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.16 Sekunden
(vorverarbeitet am 2026-06-29)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.