Skip to content

Commit 1e997ee

Browse files
committed
Revert "Reland "[VM] Introduction of type testing stubs - Part 1-4""
This reverts commit 8054409. Reason for revert: Potential cause of flakes, not entirely clear yet if it was caused by this CL. Change-Id: Icb119a107f22245ba2f303c7f2ae11f061f605f5 Reviewed-on: https://dart-review.googlesource.com/50261 Reviewed-by: Martin Kustermann <[email protected]> Commit-Queue: Martin Kustermann <[email protected]>
1 parent 00097ad commit 1e997ee

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

+234
-3370
lines changed

runtime/vm/class_finalizer.cc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#include "vm/symbols.h"
1919
#include "vm/timeline.h"
2020
#include "vm/type_table.h"
21-
#include "vm/type_testing_stubs.h"
2221

2322
namespace dart {
2423

@@ -590,10 +589,6 @@ void ClassFinalizer::ResolveType(const Class& cls, const AbstractType& type) {
590589
}
591590
}
592591
}
593-
594-
// After resolving, we re-initialize the type testing stub.
595-
type.SetTypeTestingStub(
596-
Instructions::Handle(TypeTestingStubGenerator::DefaultCodeForType(type)));
597592
}
598593

599594
void ClassFinalizer::FinalizeTypeParameters(const Class& cls,

runtime/vm/clustered_snapshot.cc

Lines changed: 17 additions & 138 deletions
Original file line numberDiff line numberDiff line change
@@ -3014,8 +3014,7 @@ class LibraryPrefixDeserializationCluster : public DeserializationCluster {
30143014
#if !defined(DART_PRECOMPILED_RUNTIME)
30153015
class TypeSerializationCluster : public SerializationCluster {
30163016
public:
3017-
explicit TypeSerializationCluster(const TypeTestingStubFinder& ttsf)
3018-
: SerializationCluster("Type"), type_testing_stubs_(ttsf) {}
3017+
TypeSerializationCluster() : SerializationCluster("Type") {}
30193018
virtual ~TypeSerializationCluster() {}
30203019

30213020
void Trace(Serializer* s, RawObject* object) {
@@ -3070,12 +3069,6 @@ class TypeSerializationCluster : public SerializationCluster {
30703069
}
30713070
s->WriteTokenPosition(type->ptr()->token_pos_);
30723071
s->Write<int8_t>(type->ptr()->type_state_);
3073-
if (s->kind() == Snapshot::kFullAOT) {
3074-
RawInstructions* instr = type_testing_stubs_.LookupByAddresss(
3075-
type->ptr()->type_test_stub_entry_point_);
3076-
const int32_t text_offset = s->GetTextOffset(instr, Code::null());
3077-
s->Write<int32_t>(text_offset);
3078-
}
30793072
}
30803073
count = objects_.length();
30813074
for (intptr_t i = 0; i < count; i++) {
@@ -3087,35 +3080,18 @@ class TypeSerializationCluster : public SerializationCluster {
30873080
}
30883081
s->WriteTokenPosition(type->ptr()->token_pos_);
30893082
s->Write<int8_t>(type->ptr()->type_state_);
3090-
if (s->kind() == Snapshot::kFullAOT) {
3091-
RawInstructions* instr = type_testing_stubs_.LookupByAddresss(
3092-
type->ptr()->type_test_stub_entry_point_);
3093-
const int32_t text_offset = s->GetTextOffset(instr, Code::null());
3094-
s->Write<int32_t>(text_offset);
3095-
}
3096-
}
3097-
3098-
// The [Type::dynamic_type()] object is not serialized, so we manually send
3099-
// the type testing stub for it.
3100-
if (s->kind() == Snapshot::kFullAOT && s->for_vm_isolate()) {
3101-
RawInstructions* instr = type_testing_stubs_.LookupByAddresss(
3102-
Type::dynamic_type().type_test_stub_entry_point());
3103-
const int32_t text_offset = s->GetTextOffset(instr, Code::null());
3104-
s->Write<int32_t>(text_offset);
31053083
}
31063084
}
31073085

31083086
private:
31093087
GrowableArray<RawType*> canonical_objects_;
31103088
GrowableArray<RawType*> objects_;
3111-
const TypeTestingStubFinder& type_testing_stubs_;
31123089
};
31133090
#endif // !DART_PRECOMPILED_RUNTIME
31143091

31153092
class TypeDeserializationCluster : public DeserializationCluster {
31163093
public:
3117-
TypeDeserializationCluster()
3118-
: type_(AbstractType::Handle()), instr_(Instructions::Handle()) {}
3094+
TypeDeserializationCluster() {}
31193095
virtual ~TypeDeserializationCluster() {}
31203096

31213097
void ReadAlloc(Deserializer* d) {
@@ -3150,12 +3126,6 @@ class TypeDeserializationCluster : public DeserializationCluster {
31503126
}
31513127
type->ptr()->token_pos_ = d->ReadTokenPosition();
31523128
type->ptr()->type_state_ = d->Read<int8_t>();
3153-
if (d->kind() == Snapshot::kFullAOT) {
3154-
const int32_t text_offset = d->Read<int32_t>();
3155-
instr_ = d->GetInstructionsAt(text_offset);
3156-
type_ = type;
3157-
type_.SetTypeTestingStub(instr_);
3158-
}
31593129
}
31603130

31613131
for (intptr_t id = start_index_; id < stop_index_; id++) {
@@ -3169,53 +3139,18 @@ class TypeDeserializationCluster : public DeserializationCluster {
31693139
}
31703140
type->ptr()->token_pos_ = d->ReadTokenPosition();
31713141
type->ptr()->type_state_ = d->Read<int8_t>();
3172-
if (d->kind() == Snapshot::kFullAOT) {
3173-
const int32_t text_offset = d->Read<int32_t>();
3174-
instr_ = d->GetInstructionsAt(text_offset);
3175-
type_ = type;
3176-
type_.SetTypeTestingStub(instr_);
3177-
}
3178-
}
3179-
3180-
// The [Type::dynamic_type()] object is not serialized, so we manually send
3181-
// the type testing stub for it.
3182-
if (d->kind() == Snapshot::kFullAOT && d->for_vm_isolate()) {
3183-
const int32_t text_offset = d->Read<int32_t>();
3184-
Dart::vm_isolate()->heap()->WriteProtect(false);
3185-
instr_ = d->GetInstructionsAt(text_offset);
3186-
Type::dynamic_type().SetTypeTestingStub(instr_);
3187-
Dart::vm_isolate()->heap()->WriteProtect(true);
3188-
}
3189-
}
3190-
3191-
void PostLoad(const Array& refs, Snapshot::Kind kind, Zone* zone) {
3192-
if (kind != Snapshot::kFullAOT) {
3193-
for (intptr_t id = canonical_start_index_; id < canonical_stop_index_;
3194-
id++) {
3195-
type_ ^= refs.At(id);
3196-
instr_ = TypeTestingStubGenerator::DefaultCodeForType(type_);
3197-
type_.SetTypeTestingStub(instr_);
3198-
}
3199-
for (intptr_t id = start_index_; id < stop_index_; id++) {
3200-
type_ ^= refs.At(id);
3201-
instr_ = TypeTestingStubGenerator::DefaultCodeForType(type_);
3202-
type_.SetTypeTestingStub(instr_);
3203-
}
32043142
}
32053143
}
32063144

32073145
private:
32083146
intptr_t canonical_start_index_;
32093147
intptr_t canonical_stop_index_;
3210-
AbstractType& type_;
3211-
Instructions& instr_;
32123148
};
32133149

32143150
#if !defined(DART_PRECOMPILED_RUNTIME)
32153151
class TypeRefSerializationCluster : public SerializationCluster {
32163152
public:
3217-
explicit TypeRefSerializationCluster(const TypeTestingStubFinder& ttsf)
3218-
: SerializationCluster("TypeRef"), type_testing_stubs_(ttsf) {}
3153+
TypeRefSerializationCluster() : SerializationCluster("TypeRef") {}
32193154
virtual ~TypeRefSerializationCluster() {}
32203155

32213156
void Trace(Serializer* s, RawObject* object) {
@@ -3248,25 +3183,17 @@ class TypeRefSerializationCluster : public SerializationCluster {
32483183
for (RawObject** p = from; p <= to; p++) {
32493184
s->WriteRef(*p);
32503185
}
3251-
if (s->kind() == Snapshot::kFullAOT) {
3252-
RawInstructions* instr = type_testing_stubs_.LookupByAddresss(
3253-
type->ptr()->type_test_stub_entry_point_);
3254-
const int32_t text_offset = s->GetTextOffset(instr, Code::null());
3255-
s->Write<int32_t>(text_offset);
3256-
}
32573186
}
32583187
}
32593188

32603189
private:
32613190
GrowableArray<RawTypeRef*> objects_;
3262-
const TypeTestingStubFinder& type_testing_stubs_;
32633191
};
32643192
#endif // !DART_PRECOMPILED_RUNTIME
32653193

32663194
class TypeRefDeserializationCluster : public DeserializationCluster {
32673195
public:
3268-
TypeRefDeserializationCluster()
3269-
: type_(AbstractType::Handle()), instr_(Instructions::Handle()) {}
3196+
TypeRefDeserializationCluster() {}
32703197
virtual ~TypeRefDeserializationCluster() {}
32713198

32723199
void ReadAlloc(Deserializer* d) {
@@ -3291,26 +3218,14 @@ class TypeRefDeserializationCluster : public DeserializationCluster {
32913218
for (RawObject** p = from; p <= to; p++) {
32923219
*p = d->ReadRef();
32933220
}
3294-
if (d->kind() == Snapshot::kFullAOT) {
3295-
const int32_t text_offset = d->Read<int32_t>();
3296-
instr_ = d->GetInstructionsAt(text_offset);
3297-
type_ = type;
3298-
type_.SetTypeTestingStub(instr_);
3299-
}
33003221
}
33013222
}
3302-
3303-
private:
3304-
AbstractType& type_;
3305-
Instructions& instr_;
33063223
};
33073224

33083225
#if !defined(DART_PRECOMPILED_RUNTIME)
33093226
class TypeParameterSerializationCluster : public SerializationCluster {
33103227
public:
3311-
explicit TypeParameterSerializationCluster(const TypeTestingStubFinder& ttsf)
3312-
: SerializationCluster("TypeParameter"), type_testing_stubs_(ttsf) {}
3313-
3228+
TypeParameterSerializationCluster() : SerializationCluster("TypeParameter") {}
33143229
virtual ~TypeParameterSerializationCluster() {}
33153230

33163231
void Trace(Serializer* s, RawObject* object) {
@@ -3348,25 +3263,17 @@ class TypeParameterSerializationCluster : public SerializationCluster {
33483263
s->WriteTokenPosition(type->ptr()->token_pos_);
33493264
s->Write<int16_t>(type->ptr()->index_);
33503265
s->Write<int8_t>(type->ptr()->type_state_);
3351-
if (s->kind() == Snapshot::kFullAOT) {
3352-
RawInstructions* instr = type_testing_stubs_.LookupByAddresss(
3353-
type->ptr()->type_test_stub_entry_point_);
3354-
const int32_t text_offset = s->GetTextOffset(instr, Code::null());
3355-
s->Write<int32_t>(text_offset);
3356-
}
33573266
}
33583267
}
33593268

33603269
private:
33613270
GrowableArray<RawTypeParameter*> objects_;
3362-
const TypeTestingStubFinder& type_testing_stubs_;
33633271
};
33643272
#endif // !DART_PRECOMPILED_RUNTIME
33653273

33663274
class TypeParameterDeserializationCluster : public DeserializationCluster {
33673275
public:
3368-
TypeParameterDeserializationCluster()
3369-
: type_(AbstractType::Handle()), instr_(Instructions::Handle()) {}
3276+
TypeParameterDeserializationCluster() {}
33703277
virtual ~TypeParameterDeserializationCluster() {}
33713278

33723279
void ReadAlloc(Deserializer* d) {
@@ -3396,28 +3303,8 @@ class TypeParameterDeserializationCluster : public DeserializationCluster {
33963303
type->ptr()->token_pos_ = d->ReadTokenPosition();
33973304
type->ptr()->index_ = d->Read<int16_t>();
33983305
type->ptr()->type_state_ = d->Read<int8_t>();
3399-
if (d->kind() == Snapshot::kFullAOT) {
3400-
const int32_t text_offset = d->Read<int32_t>();
3401-
instr_ = d->GetInstructionsAt(text_offset);
3402-
type_ = type;
3403-
type_.SetTypeTestingStub(instr_);
3404-
}
3405-
}
3406-
}
3407-
3408-
void PostLoad(const Array& refs, Snapshot::Kind kind, Zone* zone) {
3409-
if (kind != Snapshot::kFullAOT) {
3410-
for (intptr_t id = start_index_; id < stop_index_; id++) {
3411-
type_ ^= refs.At(id);
3412-
instr_ = TypeTestingStubGenerator::DefaultCodeForType(type_);
3413-
type_.SetTypeTestingStub(instr_);
3414-
}
34153306
}
34163307
}
3417-
3418-
private:
3419-
AbstractType& type_;
3420-
Instructions& instr_;
34213308
};
34223309

34233310
#if !defined(DART_PRECOMPILED_RUNTIME)
@@ -4669,8 +4556,7 @@ Serializer::Serializer(Thread* thread,
46694556
uint8_t** buffer,
46704557
ReAlloc alloc,
46714558
intptr_t initial_size,
4672-
ImageWriter* image_writer,
4673-
bool vm_isolate)
4559+
ImageWriter* image_writer)
46744560
: StackResource(thread),
46754561
heap_(thread->isolate()->heap()),
46764562
zone_(thread->zone()),
@@ -4682,8 +4568,7 @@ Serializer::Serializer(Thread* thread,
46824568
num_cids_(0),
46834569
num_base_objects_(0),
46844570
num_written_objects_(0),
4685-
next_ref_index_(1),
4686-
vm_isolate_(vm_isolate)
4571+
next_ref_index_(1)
46874572
#if defined(SNAPSHOT_BACKTRACE)
46884573
,
46894574
current_parent_(Object::null()),
@@ -4783,11 +4668,11 @@ SerializationCluster* Serializer::NewClusterForClass(intptr_t cid) {
47834668
case kLibraryPrefixCid:
47844669
return new (Z) LibraryPrefixSerializationCluster();
47854670
case kTypeCid:
4786-
return new (Z) TypeSerializationCluster(type_testing_stubs_);
4671+
return new (Z) TypeSerializationCluster();
47874672
case kTypeRefCid:
4788-
return new (Z) TypeRefSerializationCluster(type_testing_stubs_);
4673+
return new (Z) TypeRefSerializationCluster();
47894674
case kTypeParameterCid:
4790-
return new (Z) TypeParameterSerializationCluster(type_testing_stubs_);
4675+
return new (Z) TypeParameterSerializationCluster();
47914676
case kBoundedTypeCid:
47924677
return new (Z) BoundedTypeSerializationCluster();
47934678
case kClosureCid:
@@ -5235,8 +5120,7 @@ Deserializer::Deserializer(Thread* thread,
52355120
const uint8_t* buffer,
52365121
intptr_t size,
52375122
const uint8_t* instructions_buffer,
5238-
const uint8_t* data_buffer,
5239-
bool vm_isolate)
5123+
const uint8_t* data_buffer)
52405124
: StackResource(thread),
52415125
heap_(thread->isolate()->heap()),
52425126
zone_(thread->zone()),
@@ -5245,8 +5129,7 @@ Deserializer::Deserializer(Thread* thread,
52455129
image_reader_(NULL),
52465130
refs_(NULL),
52475131
next_ref_index_(1),
5248-
clusters_(NULL),
5249-
vm_isolate_(vm_isolate) {
5132+
clusters_(NULL) {
52505133
if (Snapshot::IncludesCode(kind)) {
52515134
ASSERT(instructions_buffer != NULL);
52525135
ASSERT(data_buffer != NULL);
@@ -5833,8 +5716,7 @@ intptr_t FullSnapshotWriter::WriteVMSnapshot() {
58335716

58345717
ASSERT(vm_snapshot_data_buffer_ != NULL);
58355718
Serializer serializer(thread(), kind_, vm_snapshot_data_buffer_, alloc_,
5836-
kInitialSize, vm_image_writer_,
5837-
/*vm_isolate=*/true);
5719+
kInitialSize, vm_image_writer_);
58385720

58395721
serializer.ReserveHeader();
58405722
serializer.WriteVersionAndFeatures(true);
@@ -5864,8 +5746,7 @@ void FullSnapshotWriter::WriteIsolateSnapshot(intptr_t num_base_objects) {
58645746
thread(), Timeline::GetIsolateStream(), "WriteIsolateSnapshot"));
58655747

58665748
Serializer serializer(thread(), kind_, isolate_snapshot_data_buffer_, alloc_,
5867-
kInitialSize, isolate_image_writer_,
5868-
/*vm_isolate=*/false);
5749+
kInitialSize, isolate_image_writer_);
58695750
ObjectStore* object_store = isolate()->object_store();
58705751
ASSERT(object_store != NULL);
58715752

@@ -5935,8 +5816,7 @@ FullSnapshotReader::FullSnapshotReader(const Snapshot* snapshot,
59355816

59365817
RawApiError* FullSnapshotReader::ReadVMSnapshot() {
59375818
Deserializer deserializer(thread_, kind_, buffer_, size_,
5938-
instructions_buffer_, data_buffer_,
5939-
/*vm_isolate=*/true);
5819+
instructions_buffer_, data_buffer_);
59405820

59415821
RawApiError* error = deserializer.VerifyVersionAndFeatures(/*isolate=*/NULL);
59425822
if (error != ApiError::null()) {
@@ -5960,8 +5840,7 @@ RawApiError* FullSnapshotReader::ReadVMSnapshot() {
59605840

59615841
RawApiError* FullSnapshotReader::ReadIsolateSnapshot() {
59625842
Deserializer deserializer(thread_, kind_, buffer_, size_,
5963-
instructions_buffer_, data_buffer_,
5964-
/*vm_isolate=*/false);
5843+
instructions_buffer_, data_buffer_);
59655844

59665845
RawApiError* error =
59675846
deserializer.VerifyVersionAndFeatures(thread_->isolate());

0 commit comments

Comments
 (0)