mirror of
https://github.com/dart-lang/sdk
synced 2024-09-15 22:19:49 +00:00
[vm, arm64] Combine BARRIER_MASK and HEAP_BASE into one register.
BARRIER_MASK requires 8 low bits and HEAP_BASE requires 32 high bits. Combine them into a single register HEAP_BITS, and use ARM's shifted operands to continue accessing the relevant bits in a single instruction. TEST=ci Change-Id: I5a4cd43fec2d19615239ec5cec2ac282d17c461c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/198100 Commit-Queue: Ryan Macnak <rmacnak@google.com> Reviewed-by: Liam Appelbe <liama@google.com>
This commit is contained in:
parent
46b3b6352d
commit
3fa5667c1a
|
@ -927,7 +927,7 @@ void Assembler::LoadCompressed(Register dest, const Address& slot) {
|
|||
ldr(dest, slot);
|
||||
#else
|
||||
ldr(dest, slot, kUnsignedFourBytes); // Zero-extension.
|
||||
add(dest, dest, Operand(HEAP_BASE));
|
||||
add(dest, dest, Operand(HEAP_BITS, LSL, 32));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1054,7 +1054,7 @@ void Assembler::StoreBarrier(Register object,
|
|||
kUnsignedByte);
|
||||
and_(TMP, TMP2,
|
||||
Operand(TMP, LSR, target::UntaggedObject::kBarrierOverlapShift));
|
||||
tst(TMP, Operand(BARRIER_MASK));
|
||||
tst(TMP, Operand(HEAP_BITS, LSR, 32));
|
||||
b(&done, ZERO);
|
||||
|
||||
if (spill_lr) {
|
||||
|
@ -1122,7 +1122,7 @@ void Assembler::StoreIntoArray(Register object,
|
|||
kUnsignedByte);
|
||||
and_(TMP, TMP2,
|
||||
Operand(TMP, LSR, target::UntaggedObject::kBarrierOverlapShift));
|
||||
tst(TMP, Operand(BARRIER_MASK));
|
||||
tst(TMP, Operand(HEAP_BITS, LSR, 32));
|
||||
b(&done, ZERO);
|
||||
if (spill_lr) {
|
||||
SPILLS_LR_TO_FRAME(Push(LR));
|
||||
|
@ -1374,11 +1374,13 @@ void Assembler::RestoreCodePointer() {
|
|||
}
|
||||
|
||||
void Assembler::RestorePinnedRegisters() {
|
||||
ldr(BARRIER_MASK,
|
||||
ldr(HEAP_BITS,
|
||||
compiler::Address(THR, target::Thread::write_barrier_mask_offset()));
|
||||
LslImmediate(HEAP_BITS, HEAP_BITS, 32);
|
||||
ldr(NULL_REG, compiler::Address(THR, target::Thread::object_null_offset()));
|
||||
#if defined(DART_COMPRESSED_POINTERS)
|
||||
ldr(HEAP_BASE, compiler::Address(THR, target::Thread::heap_base_offset()));
|
||||
ldr(TMP, compiler::Address(THR, target::Thread::heap_base_offset()));
|
||||
orr(HEAP_BITS, HEAP_BITS, Operand(TMP, LSR, 32));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -2597,23 +2597,19 @@ static void EnterTestFrame(Assembler* assembler) {
|
|||
__ EnterFrame(0);
|
||||
__ Push(CODE_REG);
|
||||
__ Push(THR);
|
||||
__ Push(BARRIER_MASK);
|
||||
__ Push(HEAP_BITS);
|
||||
__ Push(NULL_REG);
|
||||
__ Push(HEAP_BASE);
|
||||
__ TagAndPushPP();
|
||||
__ ldr(CODE_REG, Address(R0, VMHandles::kOffsetOfRawPtrInHandle));
|
||||
__ mov(THR, R1);
|
||||
__ ldr(BARRIER_MASK, Address(THR, Thread::write_barrier_mask_offset()));
|
||||
__ ldr(NULL_REG, Address(THR, Thread::object_null_offset()));
|
||||
__ ldr(HEAP_BASE, Address(THR, Thread::heap_base_offset()));
|
||||
__ RestorePinnedRegisters();
|
||||
__ LoadPoolPointer(PP);
|
||||
}
|
||||
|
||||
static void LeaveTestFrame(Assembler* assembler) {
|
||||
__ PopAndUntagPP();
|
||||
__ Pop(HEAP_BASE);
|
||||
__ Pop(NULL_REG);
|
||||
__ Pop(BARRIER_MASK);
|
||||
__ Pop(HEAP_BITS);
|
||||
__ Pop(THR);
|
||||
__ Pop(CODE_REG);
|
||||
__ LeaveFrame();
|
||||
|
@ -4736,14 +4732,15 @@ ASSEMBLER_TEST_GENERATE(StoreIntoObject, assembler) {
|
|||
__ SetupDartSP();
|
||||
__ Push(CODE_REG);
|
||||
__ Push(THR);
|
||||
__ Push(BARRIER_MASK);
|
||||
__ Push(HEAP_BITS);
|
||||
SPILLS_LR_TO_FRAME(__ Push(LR));
|
||||
__ mov(THR, R2);
|
||||
__ ldr(BARRIER_MASK, Address(THR, Thread::write_barrier_mask_offset()));
|
||||
__ ldr(HEAP_BITS, Address(THR, Thread::write_barrier_mask_offset()));
|
||||
__ LslImmediate(HEAP_BITS, HEAP_BITS, 32);
|
||||
__ StoreIntoObject(R1, FieldAddress(R1, GrowableObjectArray::data_offset()),
|
||||
R0);
|
||||
RESTORES_LR_FROM_FRAME(__ Pop(LR));
|
||||
__ Pop(BARRIER_MASK);
|
||||
__ Pop(HEAP_BITS);
|
||||
__ Pop(THR);
|
||||
__ Pop(CODE_REG);
|
||||
__ RestoreCSP();
|
||||
|
|
|
@ -2093,7 +2093,7 @@ static constexpr dart::compiler::target::word
|
|||
Thread_write_barrier_wrappers_thread_offset[] = {
|
||||
1376, 1384, 1392, 1400, 1408, 1416, 1424, 1432, 1440, 1448, 1456,
|
||||
1464, 1472, 1480, 1488, -1, -1, -1, -1, 1496, 1504, -1,
|
||||
-1, -1, 1512, 1520, -1, -1, -1, -1, -1, -1};
|
||||
-1, 1512, 1520, 1528, -1, -1, -1, -1, -1, -1};
|
||||
static constexpr dart::compiler::target::word AbstractType_InstanceSize = 24;
|
||||
static constexpr dart::compiler::target::word ApiError_InstanceSize = 16;
|
||||
static constexpr dart::compiler::target::word Array_header_size = 24;
|
||||
|
@ -3182,7 +3182,7 @@ static constexpr dart::compiler::target::word
|
|||
Thread_write_barrier_wrappers_thread_offset[] = {
|
||||
1376, 1384, 1392, 1400, 1408, 1416, 1424, 1432, 1440, 1448, 1456,
|
||||
1464, 1472, 1480, 1488, -1, -1, -1, -1, 1496, 1504, -1,
|
||||
-1, -1, 1512, 1520, -1, -1, -1, -1, -1, -1};
|
||||
-1, 1512, 1520, 1528, -1, -1, -1, -1, -1, -1};
|
||||
static constexpr dart::compiler::target::word AbstractType_InstanceSize = 24;
|
||||
static constexpr dart::compiler::target::word ApiError_InstanceSize = 16;
|
||||
static constexpr dart::compiler::target::word Array_header_size = 24;
|
||||
|
@ -5324,7 +5324,7 @@ static constexpr dart::compiler::target::word
|
|||
Thread_write_barrier_wrappers_thread_offset[] = {
|
||||
1376, 1384, 1392, 1400, 1408, 1416, 1424, 1432, 1440, 1448, 1456,
|
||||
1464, 1472, 1480, 1488, -1, -1, -1, -1, 1496, 1504, -1,
|
||||
-1, -1, 1512, 1520, -1, -1, -1, -1, -1, -1};
|
||||
-1, 1512, 1520, 1528, -1, -1, -1, -1, -1, -1};
|
||||
static constexpr dart::compiler::target::word AbstractType_InstanceSize = 24;
|
||||
static constexpr dart::compiler::target::word ApiError_InstanceSize = 16;
|
||||
static constexpr dart::compiler::target::word Array_header_size = 24;
|
||||
|
@ -6401,7 +6401,7 @@ static constexpr dart::compiler::target::word
|
|||
Thread_write_barrier_wrappers_thread_offset[] = {
|
||||
1376, 1384, 1392, 1400, 1408, 1416, 1424, 1432, 1440, 1448, 1456,
|
||||
1464, 1472, 1480, 1488, -1, -1, -1, -1, 1496, 1504, -1,
|
||||
-1, -1, 1512, 1520, -1, -1, -1, -1, -1, -1};
|
||||
-1, 1512, 1520, 1528, -1, -1, -1, -1, -1, -1};
|
||||
static constexpr dart::compiler::target::word AbstractType_InstanceSize = 24;
|
||||
static constexpr dart::compiler::target::word ApiError_InstanceSize = 16;
|
||||
static constexpr dart::compiler::target::word Array_header_size = 24;
|
||||
|
@ -8206,7 +8206,7 @@ static constexpr dart::compiler::target::word
|
|||
AOT_Thread_write_barrier_wrappers_thread_offset[] = {
|
||||
1376, 1384, 1392, 1400, 1408, 1416, 1424, 1432, 1440, 1448, 1456,
|
||||
1464, 1472, 1480, 1488, -1, -1, -1, -1, 1496, 1504, -1,
|
||||
-1, -1, 1512, 1520, -1, -1, -1, -1, -1, -1};
|
||||
-1, 1512, 1520, 1528, -1, -1, -1, -1, -1, -1};
|
||||
static constexpr dart::compiler::target::word AOT_AbstractType_InstanceSize =
|
||||
24;
|
||||
static constexpr dart::compiler::target::word AOT_ApiError_InstanceSize = 16;
|
||||
|
@ -9417,7 +9417,7 @@ static constexpr dart::compiler::target::word
|
|||
AOT_Thread_write_barrier_wrappers_thread_offset[] = {
|
||||
1376, 1384, 1392, 1400, 1408, 1416, 1424, 1432, 1440, 1448, 1456,
|
||||
1464, 1472, 1480, 1488, -1, -1, -1, -1, 1496, 1504, -1,
|
||||
-1, -1, 1512, 1520, -1, -1, -1, -1, -1, -1};
|
||||
-1, 1512, 1520, 1528, -1, -1, -1, -1, -1, -1};
|
||||
static constexpr dart::compiler::target::word AOT_AbstractType_InstanceSize =
|
||||
24;
|
||||
static constexpr dart::compiler::target::word AOT_ApiError_InstanceSize = 16;
|
||||
|
@ -11213,7 +11213,7 @@ static constexpr dart::compiler::target::word
|
|||
AOT_Thread_write_barrier_wrappers_thread_offset[] = {
|
||||
1376, 1384, 1392, 1400, 1408, 1416, 1424, 1432, 1440, 1448, 1456,
|
||||
1464, 1472, 1480, 1488, -1, -1, -1, -1, 1496, 1504, -1,
|
||||
-1, -1, 1512, 1520, -1, -1, -1, -1, -1, -1};
|
||||
-1, 1512, 1520, 1528, -1, -1, -1, -1, -1, -1};
|
||||
static constexpr dart::compiler::target::word AOT_AbstractType_InstanceSize =
|
||||
24;
|
||||
static constexpr dart::compiler::target::word AOT_ApiError_InstanceSize = 16;
|
||||
|
@ -12410,7 +12410,7 @@ static constexpr dart::compiler::target::word
|
|||
AOT_Thread_write_barrier_wrappers_thread_offset[] = {
|
||||
1376, 1384, 1392, 1400, 1408, 1416, 1424, 1432, 1440, 1448, 1456,
|
||||
1464, 1472, 1480, 1488, -1, -1, -1, -1, 1496, 1504, -1,
|
||||
-1, -1, 1512, 1520, -1, -1, -1, -1, -1, -1};
|
||||
-1, 1512, 1520, 1528, -1, -1, -1, -1, -1, -1};
|
||||
static constexpr dart::compiler::target::word AOT_AbstractType_InstanceSize =
|
||||
24;
|
||||
static constexpr dart::compiler::target::word AOT_ApiError_InstanceSize = 16;
|
||||
|
|
|
@ -54,12 +54,12 @@ enum Register {
|
|||
R20 = 20,
|
||||
R21 = 21, // DISPATCH_TABLE_REG
|
||||
R22 = 22, // NULL_REG
|
||||
R23 = 23, // HEAP_BASE
|
||||
R23 = 23,
|
||||
R24 = 24,
|
||||
R25 = 25,
|
||||
R26 = 26, // THR
|
||||
R27 = 27, // PP
|
||||
R28 = 28, // BARRIER_MASK
|
||||
R28 = 28, // HEAP_BITS
|
||||
R29 = 29, // FP
|
||||
R30 = 30, // LR
|
||||
R31 = 31, // ZR, CSP
|
||||
|
@ -141,9 +141,8 @@ const Register ARGS_DESC_REG = R4; // Arguments descriptor register.
|
|||
const Register THR = R26; // Caches current thread in generated code.
|
||||
const Register CALLEE_SAVED_TEMP = R19;
|
||||
const Register CALLEE_SAVED_TEMP2 = R20;
|
||||
const Register BARRIER_MASK = R28;
|
||||
const Register HEAP_BITS = R28; // write_barrier_mask << 32 | heap_base >> 32
|
||||
const Register NULL_REG = R22; // Caches NullObject() value.
|
||||
const Register HEAP_BASE = R23;
|
||||
|
||||
// ABI for catch-clause entry point.
|
||||
const Register kExceptionObjectReg = R0;
|
||||
|
@ -367,11 +366,11 @@ const VRegister kAbiFirstPreservedFpuReg = V8;
|
|||
const VRegister kAbiLastPreservedFpuReg = V15;
|
||||
const int kAbiPreservedFpuRegCount = 8;
|
||||
|
||||
const intptr_t kReservedCpuRegisters =
|
||||
R(SPREG) | // Dart SP
|
||||
R(FPREG) | R(TMP) | R(TMP2) | R(PP) | R(THR) | R(LR) | R(BARRIER_MASK) |
|
||||
R(NULL_REG) | R(HEAP_BASE) | R(R31) | // C++ SP
|
||||
R(R18) | R(DISPATCH_TABLE_REG);
|
||||
const intptr_t kReservedCpuRegisters = R(SPREG) | // Dart SP
|
||||
R(FPREG) | R(TMP) | R(TMP2) | R(PP) |
|
||||
R(THR) | R(LR) | R(HEAP_BITS) |
|
||||
R(NULL_REG) | R(R31) | // C++ SP
|
||||
R(R18) | R(DISPATCH_TABLE_REG);
|
||||
constexpr intptr_t kNumberOfReservedCpuRegisters = 13;
|
||||
// CPU registers available to Dart allocator.
|
||||
const RegList kDartAvailableCpuRegs =
|
||||
|
|
|
@ -76,8 +76,7 @@ void RuntimeEntry::CallInternal(const RuntimeEntry* runtime_entry,
|
|||
COMPILE_ASSERT(IsAbiPreservedRegister(THR));
|
||||
COMPILE_ASSERT(IsAbiPreservedRegister(PP));
|
||||
COMPILE_ASSERT(IsAbiPreservedRegister(NULL_REG));
|
||||
COMPILE_ASSERT(IsAbiPreservedRegister(BARRIER_MASK));
|
||||
COMPILE_ASSERT(IsAbiPreservedRegister(HEAP_BASE));
|
||||
COMPILE_ASSERT(IsAbiPreservedRegister(HEAP_BITS));
|
||||
COMPILE_ASSERT(IsAbiPreservedRegister(DISPATCH_TABLE_REG));
|
||||
// These registers must be preserved by the runtime functions, otherwise
|
||||
// we'd need to restore them here.
|
||||
|
|
|
@ -3735,11 +3735,10 @@ void Simulator::JumpToFrame(uword pc, uword sp, uword fp, Thread* thread) {
|
|||
pp -= kHeapObjectTag; // In the PP register, the pool pointer is untagged.
|
||||
set_register(NULL, CODE_REG, code);
|
||||
set_register(NULL, PP, pp);
|
||||
set_register(NULL, BARRIER_MASK, thread->write_barrier_mask());
|
||||
set_register(
|
||||
NULL, HEAP_BITS,
|
||||
(thread->write_barrier_mask() << 32) | (thread->heap_base() >> 32));
|
||||
set_register(NULL, NULL_REG, static_cast<int64_t>(Object::null()));
|
||||
#if defined(DART_COMPRESSED_POINTERS)
|
||||
set_register(NULL, HEAP_BASE, thread->heap_base());
|
||||
#endif
|
||||
if (FLAG_precompiled_mode && FLAG_use_bare_instructions) {
|
||||
set_register(NULL, DISPATCH_TABLE_REG,
|
||||
reinterpret_cast<int64_t>(thread->dispatch_table_array()));
|
||||
|
|
Loading…
Reference in a new issue