Skip to content

Commit 63b500b

Browse files
aamcommit-bot@chromium.org
authored and
commit-bot@chromium.org
committed
[vm/isolates] Introduce fast isolate spawn in AOT.
Speed up is achieved by sharing most of the dart code, object store and class table between isolates in single isolate group. So instead of bootstrapping isolate from the snapshot, isolate is initialized by setting pointers to existing data structures already set up for first isolate, and only few isolate-specific structures (moved to newly introducted isolate_object_store) are created. To allow for safe cross-isolate switchable call site, type test cache mutations additional synchronization via RunWithStoppedMutators(that relies on safepoints) was added. Besides switchable call sites, no other mutation to the dart code is done in AOT, which allows such sharing. Bug: dart-lang#37835 Bug: dart-lang#36097 Change-Id: I64c86525f4ef9cb30567a49a106bfe700355942b Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136780 Commit-Queue: Alexander Aprelev <aam@google.com> Reviewed-by: Ryan Macnak <rmacnak@google.com>
1 parent 5d93de3 commit 63b500b

4 files changed

+8
-16
lines changed

assembler_arm.cc

+2-4
Original file line numberDiff line numberDiff line change
@@ -2004,8 +2004,7 @@ void Assembler::LoadClassId(Register result, Register object, Condition cond) {
20042004
void Assembler::LoadClassById(Register result, Register class_id) {
20052005
ASSERT(result != class_id);
20062006

2007-
const intptr_t table_offset = target::Isolate::class_table_offset() +
2008-
target::ClassTable::table_offset();
2007+
const intptr_t table_offset = target::Isolate::class_table_table_offset();
20092008

20102009
LoadIsolate(result);
20112010
LoadFromOffset(kWord, result, result, table_offset);
@@ -3529,8 +3528,7 @@ void Assembler::LoadAllocationStatsAddress(Register dest, intptr_t cid) {
35293528
ASSERT(cid > 0);
35303529

35313530
const intptr_t shared_table_offset =
3532-
target::Isolate::class_table_offset() +
3533-
target::ClassTable::shared_class_table_offset();
3531+
target::Isolate::shared_class_table_offset();
35343532
const intptr_t table_offset =
35353533
target::SharedClassTable::class_heap_stats_table_offset();
35363534
const intptr_t class_offset = target::ClassTable::ClassOffsetFor(cid);

assembler_arm64.cc

+2-4
Original file line numberDiff line numberDiff line change
@@ -1155,8 +1155,7 @@ void Assembler::LoadClassId(Register result, Register object) {
11551155
void Assembler::LoadClassById(Register result, Register class_id) {
11561156
ASSERT(result != class_id);
11571157

1158-
const intptr_t table_offset = target::Isolate::class_table_offset() +
1159-
target::ClassTable::table_offset();
1158+
const intptr_t table_offset = target::Isolate::class_table_table_offset();
11601159

11611160
LoadIsolate(result);
11621161
LoadFromOffset(result, result, table_offset);
@@ -1631,8 +1630,7 @@ void Assembler::MaybeTraceAllocation(intptr_t cid,
16311630
ASSERT(cid > 0);
16321631

16331632
const intptr_t shared_table_offset =
1634-
target::Isolate::class_table_offset() +
1635-
target::ClassTable::shared_class_table_offset();
1633+
target::Isolate::shared_class_table_offset();
16361634
const intptr_t table_offset =
16371635
target::SharedClassTable::class_heap_stats_table_offset();
16381636
const intptr_t class_offset = target::ClassTable::ClassOffsetFor(cid);

assembler_ia32.cc

+2-4
Original file line numberDiff line numberDiff line change
@@ -2409,8 +2409,7 @@ void Assembler::MaybeTraceAllocation(intptr_t cid,
24092409
Address state_address(kNoRegister, 0);
24102410

24112411
const intptr_t shared_table_offset =
2412-
target::Isolate::class_table_offset() +
2413-
target::ClassTable::shared_class_table_offset();
2412+
target::Isolate::shared_class_table_offset();
24142413
const intptr_t table_offset =
24152414
target::SharedClassTable::class_heap_stats_table_offset();
24162415
const intptr_t class_offset = target::ClassTable::ClassOffsetFor(cid);
@@ -2638,8 +2637,7 @@ void Assembler::LoadClassId(Register result, Register object) {
26382637
void Assembler::LoadClassById(Register result, Register class_id) {
26392638
ASSERT(result != class_id);
26402639

2641-
const intptr_t table_offset = target::Isolate::class_table_offset() +
2642-
target::ClassTable::table_offset();
2640+
const intptr_t table_offset = target::Isolate::class_table_table_offset();
26432641
LoadIsolate(result);
26442642
movl(result, Address(result, table_offset));
26452643
movl(result, Address(result, class_id, TIMES_4, 0));

assembler_x64.cc

+2-4
Original file line numberDiff line numberDiff line change
@@ -1864,8 +1864,7 @@ void Assembler::MaybeTraceAllocation(intptr_t cid,
18641864
bool near_jump) {
18651865
ASSERT(cid > 0);
18661866
const intptr_t shared_table_offset =
1867-
target::Isolate::class_table_offset() +
1868-
target::ClassTable::shared_class_table_offset();
1867+
target::Isolate::shared_class_table_offset();
18691868
const intptr_t table_offset =
18701869
target::SharedClassTable::class_heap_stats_table_offset();
18711870
const intptr_t class_offset = target::ClassTable::ClassOffsetFor(cid);
@@ -2128,8 +2127,7 @@ void Assembler::LoadClassId(Register result, Register object) {
21282127

21292128
void Assembler::LoadClassById(Register result, Register class_id) {
21302129
ASSERT(result != class_id);
2131-
const intptr_t table_offset = target::Isolate::class_table_offset() +
2132-
target::ClassTable::table_offset();
2130+
const intptr_t table_offset = target::Isolate::class_table_table_offset();
21332131

21342132
LoadIsolate(result);
21352133
movq(result, Address(result, table_offset));

0 commit comments

Comments
 (0)