Skip to content

Commit

Permalink
[vm/compiler] Use isolate version of AllocateContext stub.
Browse files Browse the repository at this point in the history
When building method extractors in a given isolate group, the copy of
the AllocateContext stub in the isolate group should be used. Otherwise,
calls to that stub cannot be turned into PC relative calls when
appropriate.

Also retrieve the closure allocation stub from the object store directly
instead of going through GetAllocationStubForClass, now that closure
allocation is handled via a distinct stub.

Be more specific about the types of the stub objects passed to
GenerateBuildMethodExtractorStub, as they're guaranteed to be Code
objects.

TEST=Existing test cases.

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try
Change-Id: I05bc5e8a133834e66af3e1003d8a6597ee11c312
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200868
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
  • Loading branch information
sstrickl authored and commit-bot@chromium.org committed May 21, 2021
1 parent 915d0f4 commit 58b68c9
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 12 deletions.
4 changes: 2 additions & 2 deletions runtime/vm/compiler/stub_code_compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ class StubCodeCompiler : public AllStatic {
#if !defined(TARGET_ARCH_IA32)
static void GenerateBuildMethodExtractorStub(
Assembler* assembler,
const Object& closure_allocation_stub,
const Object& context_allocation_stub);
const Code& closure_allocation_stub,
const Code& context_allocation_stub);
#endif

static void EnsureIsNewOrRemembered(Assembler* assembler,
Expand Down
4 changes: 2 additions & 2 deletions runtime/vm/compiler/stub_code_compiler_arm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,8 @@ void StubCodeCompiler::GenerateSharedStub(
// SP+0: The object from which we are tearing a method off.
void StubCodeCompiler::GenerateBuildMethodExtractorStub(
Assembler* assembler,
const Object& closure_allocation_stub,
const Object& context_allocation_stub) {
const Code& closure_allocation_stub,
const Code& context_allocation_stub) {
const intptr_t kReceiverOffset = target::frame_layout.param_end_from_fp + 1;

__ EnterStubFrame();
Expand Down
4 changes: 2 additions & 2 deletions runtime/vm/compiler/stub_code_compiler_arm64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -457,8 +457,8 @@ void StubCodeCompiler::GenerateJITCallbackTrampolines(
// R4: The type_arguments_field_offset (or 0)
void StubCodeCompiler::GenerateBuildMethodExtractorStub(
Assembler* assembler,
const Object& closure_allocation_stub,
const Object& context_allocation_stub) {
const Code& closure_allocation_stub,
const Code& context_allocation_stub) {
const intptr_t kReceiverOffset = target::frame_layout.param_end_from_fp + 1;

__ EnterStubFrame();
Expand Down
4 changes: 2 additions & 2 deletions runtime/vm/compiler/stub_code_compiler_x64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -400,8 +400,8 @@ void StubCodeCompiler::GenerateJITCallbackTrampolines(
// RDX: The type_arguments_field_offset (or 0)
void StubCodeCompiler::GenerateBuildMethodExtractorStub(
Assembler* assembler,
const Object& closure_allocation_stub,
const Object& context_allocation_stub) {
const Code& closure_allocation_stub,
const Code& context_allocation_stub) {
const intptr_t kReceiverOffsetInWords =
target::frame_layout.param_end_from_fp + 1;

Expand Down
7 changes: 3 additions & 4 deletions runtime/vm/stub_code.cc
Original file line number Diff line number Diff line change
Expand Up @@ -306,11 +306,10 @@ CodePtr StubCode::GetBuildMethodExtractorStub(
auto Z = thread->zone();
auto object_store = thread->isolate_group()->object_store();

const auto& closure_class =
Class::ZoneHandle(Z, object_store->closure_class());
const auto& closure_allocation_stub =
Code::ZoneHandle(Z, StubCode::GetAllocationStubForClass(closure_class));
const auto& context_allocation_stub = StubCode::AllocateContext();
Code::ZoneHandle(Z, object_store->allocate_closure_stub());
const auto& context_allocation_stub =
Code::ZoneHandle(Z, object_store->allocate_context_stub());

compiler::ObjectPoolBuilder object_pool_builder;
compiler::Assembler assembler(pool != nullptr ? pool : &object_pool_builder);
Expand Down

0 comments on commit 58b68c9

Please sign in to comment.