Skip to content

Commit

Permalink
[vm/patch_class] Remove obsolete "patch" bit from Class object.
Browse files Browse the repository at this point in the history
This bit was made redundant when parsing was moved out of vm into
frontend.

Change-Id: Ia0c40e2420e58caffa3ad7ed390b9189706b6acb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153385
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
  • Loading branch information
aam authored and commit-bot@chromium.org committed Jul 7, 2020
1 parent b8a6e77 commit a199791
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 29 deletions.
10 changes: 1 addition & 9 deletions runtime/vm/class_finalizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1151,14 +1151,6 @@ void ClassFinalizer::FinalizeClass(const Class& cls) {
}
#endif // !defined(DART_PRECOMPILED_RUNTIME)

if (cls.is_patch()) {
// The fields and functions of a patch class are copied to the
// patched class after parsing. There is nothing to finalize.
ASSERT(Array::Handle(cls.functions()).Length() == 0);
ASSERT(Array::Handle(cls.fields()).Length() == 0);
cls.set_is_finalized();
return;
}
// Ensure super class is finalized.
const Class& super = Class::Handle(cls.SuperClass());
if (!super.IsNull()) {
Expand Down Expand Up @@ -1426,7 +1418,7 @@ void ClassFinalizer::SortClasses() {
continue;
}
cls = table->At(cid);
if (cls.is_patch() || !cls.is_declaration_loaded()) {
if (!cls.is_declaration_loaded()) {
continue;
}
if (cls.SuperClass() == I->object_store()->object_class()) {
Expand Down
3 changes: 1 addition & 2 deletions runtime/vm/compiler/backend/il.cc
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ void HierarchyInfo::BuildRangesFor(ClassTable* table,
if (cid == kNullCid && !exclude_null) continue;
cls = table->At(cid);
if (!include_abstract && cls.is_abstract()) continue;
if (cls.is_patch()) continue;
if (cls.IsTopLevel()) continue;

// We are either interested in [CidRange]es of subclasses or subtypes.
Expand Down Expand Up @@ -310,7 +309,7 @@ void HierarchyInfo::BuildRangesForJIT(ClassTable* table,
for (; j < current_cid; ++j) {
if (table->HasValidClassAt(j)) {
klass = table->At(j);
if (!klass.is_patch() && !klass.IsTopLevel()) {
if (!klass.IsTopLevel()) {
// If we care about abstract classes also, we cannot skip over any
// arbitrary abstract class, only those which are subtypes.
if (include_abstract) {
Expand Down
5 changes: 0 additions & 5 deletions runtime/vm/isolate_reload.cc
Original file line number Diff line number Diff line change
Expand Up @@ -404,11 +404,6 @@ class BecomeMapTraits {
};

bool IsolateReloadContext::IsSameClass(const Class& a, const Class& b) {
if (a.is_patch() != b.is_patch()) {
// TODO(johnmccutchan): Should we just check the class kind bits?
return false;
}

// TODO(turnidge): We need to look at generic type arguments for
// synthetic mixin classes. Their names are not necessarily unique
// currently.
Expand Down
9 changes: 2 additions & 7 deletions runtime/vm/object.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4757,10 +4757,6 @@ void Class::set_is_type_finalized() const {
raw_ptr()->state_bits_));
}

void Class::set_is_patch() const {
set_state_bits(PatchBit::update(true, raw_ptr()->state_bits_));
}

void Class::set_is_synthesized_class() const {
set_state_bits(SynthesizedClassBit::update(true, raw_ptr()->state_bits_));
}
Expand Down Expand Up @@ -5440,10 +5436,9 @@ const char* Class::ToCString() const {
NoSafepointScope no_safepoint;
const Library& lib = Library::Handle(library());
const char* library_name = lib.IsNull() ? "" : lib.ToCString();
const char* patch_prefix = is_patch() ? "Patch " : "";
const char* class_name = String::Handle(Name()).ToCString();
return OS::SCreate(Thread::Current()->zone(), "%s %sClass: %s", library_name,
patch_prefix, class_name);
return OS::SCreate(Thread::Current()->zone(), "%s Class: %s", library_name,
class_name);
}

// Thomas Wang, Integer Hash Functions.
Expand Down
5 changes: 0 additions & 5 deletions runtime/vm/object.h
Original file line number Diff line number Diff line change
Expand Up @@ -1359,9 +1359,6 @@ class Class : public Object {
}
void set_is_type_finalized() const;

bool is_patch() const { return PatchBit::decode(raw_ptr()->state_bits_); }
void set_is_patch() const;

bool is_synthesized_class() const {
return SynthesizedClassBit::decode(raw_ptr()->state_bits_);
}
Expand Down Expand Up @@ -1666,7 +1663,6 @@ class Class : public Object {
kClassLoadingPos = kClassFinalizedPos + kClassFinalizedSize, // = 4
kClassLoadingSize = 2,
kAbstractBit = kClassLoadingPos + kClassLoadingSize, // = 6
kPatchBit,
kSynthesizedClassBit,
kMixinAppAliasBit,
kMixinTypeAppliedBit,
Expand All @@ -1688,7 +1684,6 @@ class Class : public Object {
kClassLoadingPos,
kClassLoadingSize> {};
class AbstractBit : public BitField<uint32_t, bool, kAbstractBit, 1> {};
class PatchBit : public BitField<uint32_t, bool, kPatchBit, 1> {};
class SynthesizedClassBit
: public BitField<uint32_t, bool, kSynthesizedClassBit, 1> {};
class FieldsMarkedNullableBit
Expand Down
2 changes: 1 addition & 1 deletion runtime/vm/object_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ void Class::PrintJSONImpl(JSONStream* stream, bool ref) const {
jsobj.AddProperty("const", is_const());
jsobj.AddProperty("_finalized", is_finalized());
jsobj.AddProperty("_implemented", is_implemented());
jsobj.AddProperty("_patch", is_patch());
jsobj.AddProperty("_patch", false);
jsobj.AddProperty("_traceAllocations", TraceAllocation(isolate));

const Class& superClass = Class::Handle(SuperClass());
Expand Down

0 comments on commit a199791

Please sign in to comment.