Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 45db297

Browse files
victoragnezcommit-bot@chromium.org
authored andcommitted
[vm/precomp] Reduce arm32 code size for BoxInt64Instr
Change-Id: I018ddd6add8b8ff447019cc61bff579104084f00 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128072 Commit-Queue: Victor Agnez Lima <victoragnez@google.com> Reviewed-by: Martin Kustermann <kustermann@google.com>
1 parent 4b8fd3c commit 45db297

File tree

5 files changed

+28
-13
lines changed

5 files changed

+28
-13
lines changed

runtime/vm/compiler/aot/precompiler.cc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,15 @@ void Precompiler::DoCompileAll() {
295295
global_object_pool_builder());
296296
I->object_store()->set_null_error_stub_without_fpu_regs_stub(stub_code);
297297

298+
stub_code = StubCode::BuildIsolateSpecificAllocateMintWithFPURegsStub(
299+
global_object_pool_builder());
300+
I->object_store()->set_allocate_mint_with_fpu_regs_stub(stub_code);
301+
302+
stub_code =
303+
StubCode::BuildIsolateSpecificAllocateMintWithoutFPURegsStub(
304+
global_object_pool_builder());
305+
I->object_store()->set_allocate_mint_without_fpu_regs_stub(stub_code);
306+
298307
stub_code =
299308
StubCode::BuildIsolateSpecificStackOverflowSharedWithFPURegsStub(
300309
global_object_pool_builder());

runtime/vm/compiler/backend/flow_graph_compiler.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -847,6 +847,7 @@ class FlowGraphCompiler : public ValueObject {
847847
bool IsEmptyBlock(BlockEntryInstr* block) const;
848848

849849
private:
850+
friend class BoxInt64Instr; // For AddPcRelativeCallStubTarget().
850851
friend class CheckNullInstr; // For AddPcRelativeCallStubTarget().
851852
friend class NullErrorSlowPath; // For AddPcRelativeCallStubTarget().
852853
friend class CheckStackOverflowInstr; // For AddPcRelativeCallStubTarget().

runtime/vm/compiler/backend/il_arm.cc

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4635,21 +4635,19 @@ void BoxInt64Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
46354635
__ TryAllocate(compiler->mint_class(),
46364636
compiler->intrinsic_slow_path_label(), out_reg, tmp);
46374637
} else {
4638-
if (locs()->call_on_shared_slow_path()) {
4639-
const bool live_fpu_regs =
4640-
locs()->live_registers()->FpuRegisterCount() > 0;
4641-
__ ldr(
4642-
TMP,
4643-
compiler::Address(
4644-
THR,
4645-
live_fpu_regs
4646-
? compiler::target::Thread::
4647-
allocate_mint_with_fpu_regs_entry_point_offset()
4648-
: compiler::target::Thread::
4649-
allocate_mint_without_fpu_regs_entry_point_offset()));
4650-
__ blx(TMP);
4638+
auto object_store = compiler->isolate()->object_store();
4639+
const bool live_fpu_regs = locs()->live_registers()->FpuRegisterCount() > 0;
4640+
const auto& stub = Code::ZoneHandle(
4641+
compiler->zone(),
4642+
live_fpu_regs ? object_store->allocate_mint_with_fpu_regs_stub()
4643+
: object_store->allocate_mint_without_fpu_regs_stub());
4644+
4645+
if (locs()->call_on_shared_slow_path() && !stub.InVMIsolateHeap()) {
4646+
compiler->AddPcRelativeCallStubTarget(stub);
4647+
__ GenerateUnRelocatedPcRelativeCall();
46514648

46524649
ASSERT(!locs()->live_registers()->ContainsRegister(R0));
4650+
46534651
auto extended_env = compiler->SlowPathEnvironmentFor(this, 0);
46544652
compiler->EmitCallsiteMetadata(token_pos(), DeoptId::kNone,
46554653
RawPcDescriptors::kOther, locs(),

runtime/vm/image_snapshot.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,11 @@ static const char* NameOfStubIsolateSpecificStub(ObjectStore* object_store,
478478
} else if (code.raw() ==
479479
object_store->null_error_stub_without_fpu_regs_stub()) {
480480
return "_iso_stub_NullErrorSharedWithoutFPURegsStub";
481+
} else if (code.raw() == object_store->allocate_mint_with_fpu_regs_stub()) {
482+
return "_iso_stub_AllocateMintWithFPURegsStub";
483+
} else if (code.raw() ==
484+
object_store->allocate_mint_without_fpu_regs_stub()) {
485+
return "_iso_stub_AllocateMintWithoutFPURegsStub";
481486
} else if (code.raw() ==
482487
object_store->stack_overflow_stub_with_fpu_regs_stub()) {
483488
return "_iso_stub_StackOverflowStubWithFPURegsStub";

runtime/vm/object_store.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ class ObjectPointerVisitor;
136136
RW(Code, build_method_extractor_code) \
137137
RW(Code, null_error_stub_with_fpu_regs_stub) \
138138
RW(Code, null_error_stub_without_fpu_regs_stub) \
139+
RW(Code, allocate_mint_with_fpu_regs_stub) \
140+
RW(Code, allocate_mint_without_fpu_regs_stub) \
139141
RW(Code, stack_overflow_stub_with_fpu_regs_stub) \
140142
RW(Code, stack_overflow_stub_without_fpu_regs_stub) \
141143
RW(Code, write_barrier_wrappers_stub) \

0 commit comments

Comments
 (0)