Skip to content

Commit 922ea3e

Browse files
committed
Revert "Reland "[vm/isolates] Introduce fast isolate spawn in AOT.""
This reverts commit fdd7a2c as there seem to be sporadic dartkp crashes like https://ci.chromium.org/p/dart/builders/ci.sandbox/vm-kernel-precomp-linux-product-x64/7454 Change-Id: I4218b8ff629630991ad1ff94f217489bb16228d3 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143383 Reviewed-by: Alexander Aprelev <aam@google.com>
1 parent aa63628 commit 922ea3e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+555
-1210
lines changed

runtime/lib/isolate.cc

-4
Original file line numberDiff line numberDiff line change
@@ -167,11 +167,7 @@ class SpawnIsolateTask : public ThreadPool::Task {
167167
return;
168168
}
169169

170-
#if defined(DART_PRECOMPILED_RUNTIME)
171-
isolate = CreateWithinExistingIsolateGroupAOT(group, name, &error);
172-
#else
173170
isolate = CreateWithinExistingIsolateGroup(group, name, &error);
174-
#endif
175171
parent_isolate_->DecrementSpawnCount();
176172
parent_isolate_ = nullptr;
177173
if (isolate == nullptr) {

runtime/observatory/tests/service/get_retaining_path_rpc_test.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ var tests = <IsolateTest>[
193193
'limit': 100,
194194
};
195195
var result = await isolate.invokeRpcNoUpgrade('getRetainingPath', params);
196-
expect(result['gcRootType'], 'isolate_object store');
196+
expect(result['gcRootType'], 'object store');
197197
expect(result['elements'].length, 0);
198198
},
199199
];

runtime/vm/class_finalizer.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1519,7 +1519,7 @@ void ClassFinalizer::RemapClassIds(intptr_t* old_to_new_cid) {
15191519
// The [HeapIterationScope] also safepoints all threads.
15201520
HeapIterationScope his(T);
15211521

1522-
IG->shared_class_table()->Remap(old_to_new_cid);
1522+
IG->class_table()->Remap(old_to_new_cid);
15231523
IG->ForEachIsolate(
15241524
[&](Isolate* I) {
15251525
I->set_remapping_cids(true);

runtime/vm/class_table.cc

+2-16
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ SharedClassTable::SharedClassTable()
3131
calloc(capacity_, sizeof(RelaxedAtomic<intptr_t>))));
3232
} else {
3333
// Duplicate the class table from the VM isolate.
34-
auto vm_shared_class_table =
35-
Dart::vm_isolate()->group()->shared_class_table();
34+
auto vm_shared_class_table = Dart::vm_isolate()->group()->class_table();
3635
capacity_ = vm_shared_class_table->capacity_;
3736
// Note that [calloc] will zero-initialize the memory.
3837
RelaxedAtomic<intptr_t>* table = reinterpret_cast<RelaxedAtomic<intptr_t>*>(
@@ -72,13 +71,6 @@ SharedClassTable::~SharedClassTable() {
7271
NOT_IN_PRODUCT(free(trace_allocation_table_.load()));
7372
}
7473

75-
void ClassTable::set_table(RawClass** table) {
76-
Isolate* isolate = Isolate::Current();
77-
ASSERT(isolate != nullptr);
78-
table_.store(table);
79-
isolate->set_cached_class_table_table(table);
80-
}
81-
8274
ClassTable::ClassTable(SharedClassTable* shared_class_table)
8375
: top_(kNumPredefinedCids),
8476
capacity_(0),
@@ -89,9 +81,6 @@ ClassTable::ClassTable(SharedClassTable* shared_class_table)
8981
ASSERT(kInitialCapacity >= kNumPredefinedCids);
9082
capacity_ = kInitialCapacity;
9183
// Note that [calloc] will zero-initialize the memory.
92-
// Don't use set_table because caller is supposed to set up isolates
93-
// cached copy when constructing ClassTable. Isolate::Current might not
94-
// be available at this point yet.
9584
table_.store(static_cast<RawClass**>(calloc(capacity_, sizeof(RawClass*))));
9685
} else {
9786
// Duplicate the class table from the VM isolate.
@@ -111,9 +100,6 @@ ClassTable::ClassTable(SharedClassTable* shared_class_table)
111100
table[kDynamicCid] = vm_class_table->At(kDynamicCid);
112101
table[kVoidCid] = vm_class_table->At(kVoidCid);
113102
table[kNeverCid] = vm_class_table->At(kNeverCid);
114-
// Don't use set_table because caller is supposed to set up isolates
115-
// cached copy when constructing ClassTable. Isolate::Current might not
116-
// be available at this point yet.
117103
table_.store(table);
118104
}
119105
}
@@ -240,7 +226,7 @@ void ClassTable::Grow(intptr_t new_capacity) {
240226
new_table[i] = 0;
241227
}
242228
old_class_tables_->Add(old_table);
243-
set_table(new_table);
229+
table_.store(new_table);
244230

245231
capacity_ = new_capacity;
246232
}

runtime/vm/class_table.h

+8-5
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,14 @@ class ClassTable {
355355

356356
void Print();
357357

358+
// Used by the generated code.
359+
static intptr_t table_offset() { return OFFSET_OF(ClassTable, table_); }
360+
361+
// Used by the generated code.
362+
static intptr_t shared_class_table_offset() {
363+
return OFFSET_OF(ClassTable, shared_class_table_);
364+
}
365+
358366
#ifndef PRODUCT
359367
// Describes layout of heap stats for code generation. See offset_extractor.cc
360368
struct ArrayLayout {
@@ -379,21 +387,16 @@ class ClassTable {
379387
friend class MarkingWeakVisitor;
380388
friend class Scavenger;
381389
friend class ScavengerWeakVisitor;
382-
friend class Dart;
383390
friend Isolate* CreateWithinExistingIsolateGroup(IsolateGroup* group,
384391
const char* name,
385392
char** error);
386-
friend class Isolate; // for table()
387393
static const int kInitialCapacity = SharedClassTable::kInitialCapacity;
388394
static const int kCapacityIncrement = SharedClassTable::kCapacityIncrement;
389395

390396
void AddOldTable(RawClass** old_table);
391397

392398
void Grow(intptr_t index);
393399

394-
RawClass** table() { return table_.load(); }
395-
void set_table(RawClass** table);
396-
397400
intptr_t top_;
398401
intptr_t capacity_;
399402

runtime/vm/clustered_snapshot.cc

+18-27
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
#include <memory>
6-
75
#include "vm/clustered_snapshot.h"
86

97
#include "platform/assert.h"
@@ -233,8 +231,7 @@ class ClassSerializationCluster : public SerializationCluster {
233231
UnboxedFieldBitmap CalculateTargetUnboxedFieldsBitmap(Serializer* s,
234232
intptr_t class_id) {
235233
const auto unboxed_fields_bitmap_host =
236-
s->isolate()->group()->shared_class_table()->GetUnboxedFieldsMapAt(
237-
class_id);
234+
s->isolate()->group()->class_table()->GetUnboxedFieldsMapAt(class_id);
238235

239236
UnboxedFieldBitmap unboxed_fields_bitmap;
240237
if (unboxed_fields_bitmap_host.IsEmpty() ||
@@ -352,7 +349,7 @@ class ClassDeserializationCluster : public DeserializationCluster {
352349
}
353350
}
354351

355-
auto shared_class_table = d->isolate()->group()->shared_class_table();
352+
auto shared_class_table = d->isolate()->group()->class_table();
356353
for (intptr_t id = start_index_; id < stop_index_; id++) {
357354
RawClass* cls = reinterpret_cast<RawClass*>(d->Ref(id));
358355
Deserializer::InitializeHeader(cls, kClassCid, Class::InstanceSize());
@@ -1204,10 +1201,6 @@ class FieldDeserializationCluster : public DeserializationCluster {
12041201
field.InitializeGuardedListLengthInObjectOffset();
12051202
}
12061203
}
1207-
1208-
Isolate* isolate = Isolate::Current();
1209-
isolate->set_saved_initial_field_table(
1210-
std::shared_ptr<FieldTable>(isolate->field_table()->Clone()));
12111204
}
12121205
};
12131206

@@ -3029,8 +3022,7 @@ class InstanceSerializationCluster : public SerializationCluster {
30293022
const intptr_t next_field_offset = host_next_field_offset_in_words_
30303023
<< kWordSizeLog2;
30313024
const auto unboxed_fields_bitmap =
3032-
s->isolate()->group()->shared_class_table()->GetUnboxedFieldsMapAt(
3033-
cid_);
3025+
s->isolate()->group()->class_table()->GetUnboxedFieldsMapAt(cid_);
30343026
intptr_t offset = Instance::NextFieldOffset();
30353027
while (offset < next_field_offset) {
30363028
// Skips unboxed fields
@@ -3066,8 +3058,7 @@ class InstanceSerializationCluster : public SerializationCluster {
30663058
<< kWordSizeLog2;
30673059
const intptr_t count = objects_.length();
30683060
const auto unboxed_fields_bitmap =
3069-
s->isolate()->group()->shared_class_table()->GetUnboxedFieldsMapAt(
3070-
cid_);
3061+
s->isolate()->group()->class_table()->GetUnboxedFieldsMapAt(cid_);
30713062
for (intptr_t i = 0; i < count; i++) {
30723063
RawInstance* instance = objects_[i];
30733064
AutoTraceObject(instance);
@@ -3125,8 +3116,7 @@ class InstanceDeserializationCluster : public DeserializationCluster {
31253116
Object::RoundedAllocationSize(instance_size_in_words_ * kWordSize);
31263117

31273118
const auto unboxed_fields_bitmap =
3128-
d->isolate()->group()->shared_class_table()->GetUnboxedFieldsMapAt(
3129-
cid_);
3119+
d->isolate()->group()->class_table()->GetUnboxedFieldsMapAt(cid_);
31303120
for (intptr_t id = start_index_; id < stop_index_; id++) {
31313121
RawInstance* instance = reinterpret_cast<RawInstance*>(d->Ref(id));
31323122
bool is_canonical = d->Read<bool>();
@@ -5531,7 +5521,7 @@ static const char* kObjectStoreFieldNames[] = {
55315521
#undef DECLARE_OBJECT_STORE_FIELD
55325522
};
55335523

5534-
void Serializer::WriteProgramSnapshot(intptr_t num_base_objects,
5524+
void Serializer::WriteIsolateSnapshot(intptr_t num_base_objects,
55355525
ObjectStore* object_store) {
55365526
NoSafepointScope no_safepoint;
55375527

@@ -5542,7 +5532,7 @@ void Serializer::WriteProgramSnapshot(intptr_t num_base_objects,
55425532
AddBaseObject(base_objects.At(i));
55435533
}
55445534
} else {
5545-
// Base objects carried over from WriteVMSnapshot.
5535+
// Base objects carried over from WriteVMIsolateSnapshot.
55465536
num_base_objects_ += num_base_objects;
55475537
next_ref_index_ += num_base_objects;
55485538
}
@@ -5823,7 +5813,7 @@ void Deserializer::ReadDispatchTable() {
58235813
}
58245814
ASSERT(repeat_count == 0);
58255815

5826-
I->group()->set_dispatch_table(table);
5816+
I->set_dispatch_table(table);
58275817
#endif
58285818
}
58295819

@@ -6206,7 +6196,7 @@ void Deserializer::ReadVMSnapshot() {
62066196
}
62076197
}
62086198

6209-
void Deserializer::ReadProgramSnapshot(ObjectStore* object_store) {
6199+
void Deserializer::ReadIsolateSnapshot(ObjectStore* object_store) {
62106200
Array& refs = Array::Handle();
62116201
Prepare();
62126202

@@ -6244,21 +6234,22 @@ void Deserializer::ReadProgramSnapshot(ObjectStore* object_store) {
62446234
thread()->isolate()->class_table()->CopySizesFromClassObjects();
62456235
heap_->old_space()->EvaluateAfterLoading();
62466236

6247-
Isolate* isolate = thread()->isolate();
62486237
#if defined(DEBUG)
6238+
Isolate* isolate = thread()->isolate();
62496239
isolate->ValidateClassTable();
62506240
isolate->heap()->Verify();
62516241
#endif
62526242

62536243
for (intptr_t i = 0; i < num_clusters_; i++) {
62546244
clusters_[i]->PostLoad(refs, kind_, zone_);
62556245
}
6256-
isolate->isolate_object_store()->PreallocateObjects();
6246+
object_store->PostLoad();
62576247

62586248
// Setup native resolver for bootstrap impl.
62596249
Bootstrap::SetupNativeResolver();
62606250
}
62616251

6252+
62626253
#if !defined(DART_PRECOMPILED_RUNTIME)
62636254
FullSnapshotWriter::FullSnapshotWriter(Snapshot::Kind kind,
62646255
uint8_t** vm_snapshot_data_buffer,
@@ -6333,8 +6324,8 @@ intptr_t FullSnapshotWriter::WriteVMSnapshot() {
63336324
return num_objects;
63346325
}
63356326

6336-
void FullSnapshotWriter::WriteProgramSnapshot(intptr_t num_base_objects) {
6337-
TIMELINE_DURATION(thread(), Isolate, "WriteProgramSnapshot");
6327+
void FullSnapshotWriter::WriteIsolateSnapshot(intptr_t num_base_objects) {
6328+
TIMELINE_DURATION(thread(), Isolate, "WriteIsolateSnapshot");
63386329

63396330
Serializer serializer(thread(), kind_, isolate_snapshot_data_buffer_, alloc_,
63406331
kInitialSize, isolate_image_writer_, /*vm=*/false,
@@ -6353,7 +6344,7 @@ void FullSnapshotWriter::WriteProgramSnapshot(intptr_t num_base_objects) {
63536344
serializer.WriteVersionAndFeatures(false);
63546345
// Isolate snapshot roots are:
63556346
// - the object store
6356-
serializer.WriteProgramSnapshot(num_base_objects, object_store);
6347+
serializer.WriteIsolateSnapshot(num_base_objects, object_store);
63576348
serializer.FillHeader(serializer.kind());
63586349
clustered_isolate_size_ = serializer.bytes_written();
63596350

@@ -6384,7 +6375,7 @@ void FullSnapshotWriter::WriteFullSnapshot() {
63846375
}
63856376

63866377
if (isolate_snapshot_data_buffer() != NULL) {
6387-
WriteProgramSnapshot(num_base_objects);
6378+
WriteIsolateSnapshot(num_base_objects);
63886379
}
63896380

63906381
if (FLAG_print_snapshot_sizes) {
@@ -6547,7 +6538,7 @@ RawApiError* FullSnapshotReader::ReadVMSnapshot() {
65476538
return ApiError::null();
65486539
}
65496540

6550-
RawApiError* FullSnapshotReader::ReadProgramSnapshot() {
6541+
RawApiError* FullSnapshotReader::ReadIsolateSnapshot() {
65516542
SnapshotHeaderReader header_reader(kind_, buffer_, size_);
65526543
intptr_t offset = 0;
65536544
char* error =
@@ -6573,7 +6564,7 @@ RawApiError* FullSnapshotReader::ReadProgramSnapshot() {
65736564
}
65746565

65756566
auto object_store = thread_->isolate()->object_store();
6576-
deserializer.ReadProgramSnapshot(object_store);
6567+
deserializer.ReadIsolateSnapshot(object_store);
65776568

65786569
#if defined(DART_PRECOMPILED_RUNTIME)
65796570
if (FLAG_use_bare_instructions) {

runtime/vm/clustered_snapshot.h

+6-6
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ class Serializer : public ThreadStackResource {
157157
}
158158

159159
intptr_t WriteVMSnapshot(const Array& symbols);
160-
void WriteProgramSnapshot(intptr_t num_base_objects,
160+
void WriteIsolateSnapshot(intptr_t num_base_objects,
161161
ObjectStore* object_store);
162162

163163
void AddVMIsolateBaseObjects();
@@ -539,7 +539,7 @@ class Deserializer : public ThreadStackResource {
539539
// message otherwise.
540540
RawApiError* VerifyImageAlignment();
541541

542-
void ReadProgramSnapshot(ObjectStore* object_store);
542+
void ReadIsolateSnapshot(ObjectStore* object_store);
543543
void ReadVMSnapshot();
544544

545545
void AddVMIsolateBaseObjects();
@@ -682,7 +682,7 @@ class FullSnapshotWriter {
682682
Isolate* isolate() const { return thread_->isolate(); }
683683
Heap* heap() const { return isolate()->heap(); }
684684

685-
// Writes a full snapshot of the program(VM isolate, regular isolate group).
685+
// Writes a full snapshot of the Isolate.
686686
void WriteFullSnapshot();
687687

688688
intptr_t VmIsolateSnapshotSize() const { return vm_isolate_snapshot_size_; }
@@ -692,8 +692,8 @@ class FullSnapshotWriter {
692692
// Writes a snapshot of the VM Isolate.
693693
intptr_t WriteVMSnapshot();
694694

695-
// Writes a full snapshot of regular Dart isolate group.
696-
void WriteProgramSnapshot(intptr_t num_base_objects);
695+
// Writes a full snapshot of a regular Dart Isolate.
696+
void WriteIsolateSnapshot(intptr_t num_base_objects);
697697

698698
Thread* thread_;
699699
Snapshot::Kind kind_;
@@ -724,7 +724,7 @@ class FullSnapshotReader {
724724
~FullSnapshotReader() {}
725725

726726
RawApiError* ReadVMSnapshot();
727-
RawApiError* ReadProgramSnapshot();
727+
RawApiError* ReadIsolateSnapshot();
728728

729729
private:
730730
RawApiError* ConvertToApiError(char* message);

runtime/vm/code_patcher.h

-10
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,6 @@ class CodePatcher : public AllStatic {
6161
const Code& caller_code,
6262
const Object& data,
6363
const Code& target);
64-
static void PatchInstanceCallAtWithMutatorsStopped(Thread* thread,
65-
uword return_address,
66-
const Code& caller_code,
67-
const Object& data,
68-
const Code& target);
6964

7065
// Return target of an unoptimized static call and its ICData object
7166
// (calls target via a stub).
@@ -83,11 +78,6 @@ class CodePatcher : public AllStatic {
8378
const Code& caller_code,
8479
const Object& data,
8580
const Code& target);
86-
static void PatchSwitchableCallAtWithMutatorsStopped(Thread* thread,
87-
uword return_address,
88-
const Code& caller_code,
89-
const Object& data,
90-
const Code& target);
9181
static RawObject* GetSwitchableCallDataAt(uword return_address,
9282
const Code& caller_code);
9383
static RawCode* GetSwitchableCallTargetAt(uword return_address,

0 commit comments

Comments
 (0)