Skip to content

Commit 0ab5545

Browse files
rmacnak-googleCommit Queue
authored andcommitted
[vm] Cleanup reload debugging code.
TEST=ci Change-Id: I840fc1a614186e0f330f4b2313a6706452af6998 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/388665 Reviewed-by: Alexander Aprelev <[email protected]> Commit-Queue: Ryan Macnak <[email protected]>
1 parent fa75e88 commit 0ab5545

File tree

7 files changed

+22
-79
lines changed

7 files changed

+22
-79
lines changed

runtime/vm/heap/become.cc

Lines changed: 1 addition & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -228,12 +228,9 @@ Become::~Become() {
228228
Thread::Current()->isolate_group()->set_become(nullptr);
229229
}
230230

231-
void Become::Add(const Object& before,
232-
const Object& after,
233-
const char* whence) {
231+
void Become::Add(const Object& before, const Object& after) {
234232
pointers_.Add(before.ptr());
235233
pointers_.Add(after.ptr());
236-
whence_.Add(whence);
237234
}
238235

239236
void Become::VisitObjectPointers(ObjectPointerVisitor* visitor) {
@@ -296,56 +293,6 @@ void Become::Forward() {
296293
return;
297294
}
298295

299-
{
300-
intptr_t conflicts = 0;
301-
MallocDirectChainedHashMap<PtrIntTrait> map(pointers_.length() / 2);
302-
for (intptr_t i = 0; i < pointers_.length(); i += 2) {
303-
ObjectPtr before = pointers_[i];
304-
auto* pair = map.Lookup(before);
305-
if (pair == nullptr) {
306-
map.Insert({before, i + 1}); // 0 value is sentinel.
307-
} else {
308-
intptr_t j = pair->value - 1; // 0 value is sentinel.
309-
ObjectPtr before1 = pointers_[j];
310-
ObjectPtr after1 = pointers_[j + 1];
311-
ObjectPtr before2 = pointers_[i];
312-
ObjectPtr after2 = pointers_[i + 1];
313-
const char* whence1 = whence_[j / 2];
314-
const char* whence2 = whence_[i / 2];
315-
316-
OS::PrintErr("become conflict:\n");
317-
OS::PrintErr("whence1 = %s\n", whence1);
318-
OS::PrintErr("whence2 = %s\n", whence2);
319-
320-
OS::PrintErr("before1 cid = %" Pd "\n", before1.GetClassId());
321-
OS::PrintErr(" after1 cid = %" Pd "\n", after1.GetClassId());
322-
OS::PrintErr("before2 cid = %" Pd "\n", before2.GetClassId());
323-
OS::PrintErr(" after2 cid = %" Pd "\n", after2.GetClassId());
324-
325-
OS::PrintErr("before1 size = %" Pd "\n", before1.untag()->HeapSize());
326-
OS::PrintErr(" after1 size = %" Pd "\n", after1.untag()->HeapSize());
327-
OS::PrintErr("before2 size = %" Pd "\n", before2.untag()->HeapSize());
328-
OS::PrintErr(" after2 size = %" Pd "\n", after2.untag()->HeapSize());
329-
330-
#ifndef PRODUCT
331-
ClassTable* class_table = IsolateGroup::Current()->class_table();
332-
OS::PrintErr("before1 cls = %s\n",
333-
class_table->UserVisibleNameFor(before1.GetClassId()));
334-
OS::PrintErr(" after1 cls = %s\n",
335-
class_table->UserVisibleNameFor(after1.GetClassId()));
336-
OS::PrintErr("before2 cls = %s\n",
337-
class_table->UserVisibleNameFor(before2.GetClassId()));
338-
OS::PrintErr(" after2 cls = %s\n",
339-
class_table->UserVisibleNameFor(after2.GetClassId()));
340-
#endif
341-
conflicts++;
342-
}
343-
}
344-
if (conflicts != 0) {
345-
FATAL("%" Pd " become conflicts", conflicts);
346-
}
347-
}
348-
349296
Thread* thread = Thread::Current();
350297
auto heap = thread->isolate_group()->heap();
351298

@@ -394,7 +341,6 @@ void Become::Forward() {
394341
}
395342
#endif
396343
pointers_.Clear();
397-
whence_.Clear();
398344
}
399345

400346
void Become::FollowForwardingPointers(Thread* thread) {

runtime/vm/heap/become.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ class Become {
9898
Become();
9999
~Become();
100100

101-
void Add(const Object& before, const Object& after, const char* whence);
101+
void Add(const Object& before, const Object& after);
102+
102103
void Forward();
103104
void Exchange() { UNIMPLEMENTED(); }
104105

@@ -115,7 +116,6 @@ class Become {
115116

116117
private:
117118
MallocGrowableArray<ObjectPtr> pointers_;
118-
MallocGrowableArray<const char*> whence_;
119119
DISALLOW_COPY_AND_ASSIGN(Become);
120120
};
121121

runtime/vm/heap/become_test.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ void TestBecomeForward(Heap::Space before_space, Heap::Space after_space) {
2222
EXPECT(before_obj.ptr() != after_obj.ptr());
2323

2424
Become become;
25-
become.Add(before_obj, after_obj, "test");
25+
become.Add(before_obj, after_obj);
2626
become.Forward();
2727

2828
EXPECT(before_obj.ptr() == after_obj.ptr());
@@ -64,7 +64,7 @@ ISOLATE_UNIT_TEST_CASE(BecomeForwardPeer) {
6464
EXPECT_EQ(no_peer, heap->GetPeer(after_obj.ptr()));
6565

6666
Become become;
67-
become.Add(before_obj, after_obj, "test");
67+
become.Add(before_obj, after_obj);
6868
become.Forward();
6969

7070
EXPECT(before_obj.ptr() == after_obj.ptr());
@@ -86,7 +86,7 @@ ISOLATE_UNIT_TEST_CASE(BecomeForwardObjectId) {
8686
EXPECT_EQ(no_id, heap->GetObjectId(after_obj.ptr()));
8787

8888
Become become;
89-
become.Add(before_obj, after_obj, "test");
89+
become.Add(before_obj, after_obj);
9090
become.Forward();
9191

9292
EXPECT(before_obj.ptr() == after_obj.ptr());
@@ -112,7 +112,7 @@ ISOLATE_UNIT_TEST_CASE(BecomeForwardMessageId) {
112112
isolate->forward_table_old()->GetValueExclusive(after_obj.ptr()));
113113

114114
Become become;
115-
become.Add(before_obj, after_obj, "test");
115+
become.Add(before_obj, after_obj);
116116
become.Forward();
117117

118118
EXPECT(before_obj.ptr() == after_obj.ptr());
@@ -138,7 +138,7 @@ ISOLATE_UNIT_TEST_CASE(BecomeForwardRememberedObject) {
138138
EXPECT(before_obj.ptr() != after_obj.ptr());
139139

140140
Become become;
141-
become.Add(before_obj, after_obj, "test");
141+
become.Add(before_obj, after_obj);
142142
become.Forward();
143143

144144
EXPECT(before_obj.ptr() == after_obj.ptr());
@@ -167,7 +167,7 @@ ISOLATE_UNIT_TEST_CASE(BecomeForwardRememberedCards) {
167167
}
168168

169169
Become become;
170-
become.Add(old_element, new_element, "test");
170+
become.Add(old_element, new_element);
171171
become.Forward();
172172

173173
EXPECT(old_element.ptr() == new_element.ptr());

runtime/vm/isolate.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -992,7 +992,7 @@ void IsolateGroup::RehashConstants(Become* become) {
992992
}
993993

994994
if (old_value.ptr() != new_value.ptr()) {
995-
become->Add(old_value, new_value, "enum forwarding");
995+
become->Add(old_value, new_value);
996996
}
997997
if (new_value.IsCanonical()) {
998998
cls.InsertCanonicalConstant(zone, new_value);
@@ -1013,7 +1013,7 @@ void IsolateGroup::RehashConstants(Become* become) {
10131013
} else {
10141014
new_value = old_value.Canonicalize(thread);
10151015
if (old_value.ptr() != new_value.ptr()) {
1016-
become->Add(old_value, new_value, "constant forwarding");
1016+
become->Add(old_value, new_value);
10171017
}
10181018
}
10191019
}

runtime/vm/isolate_reload.cc

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -357,9 +357,7 @@ void InstanceMorpher::CreateMorphedCopies(Become* become) {
357357
// instances of any class with the old size.
358358
Become::MakeDummyObject(before);
359359

360-
become->Add(
361-
before, after,
362-
is_canonical ? "instance morphing canonical" : "instance morphing");
360+
become->Add(before, after);
363361
}
364362
}
365363

@@ -1281,7 +1279,7 @@ void ProgramReloadContext::RegisterClass(const Class& new_cls) {
12811279
IG->class_table()->SetAt(old_cls.id(), new_cls.ptr());
12821280
new_cls.CopyCanonicalConstants(old_cls);
12831281
new_cls.CopyDeclarationType(old_cls);
1284-
AddBecomeMapping(old_cls, new_cls, "class forwarding");
1282+
AddBecomeMapping(old_cls, new_cls);
12851283
AddClassMapping(new_cls, old_cls);
12861284
}
12871285

@@ -1627,6 +1625,7 @@ void ProgramReloadContext::RollbackLibraries() {
16271625
}
16281626

16291627
void ProgramReloadContext::VerifyMaps() {
1628+
#if defined(DEBUG)
16301629
TIMELINE_SCOPE(VerifyMaps);
16311630

16321631
// Verify that two old classes aren't both mapped to the same new
@@ -1686,6 +1685,7 @@ void ProgramReloadContext::VerifyMaps() {
16861685
}
16871686
library_map.Release();
16881687
reverse_library_map.Release();
1688+
#endif // defined(DEBUG)
16891689
}
16901690

16911691
void ProgramReloadContext::CommitBeforeInstanceMorphing() {
@@ -2589,7 +2589,7 @@ void ProgramReloadContext::BuildLibraryMapping() {
25892589
// Replaced class.
25902590
AddLibraryMapping(replacement_or_new, old);
25912591

2592-
AddBecomeMapping(old, replacement_or_new, "library forwarding");
2592+
AddBecomeMapping(old, replacement_or_new);
25932593
}
25942594
}
25952595
}
@@ -2698,13 +2698,12 @@ void ProgramReloadContext::AddStaticFieldMapping(const Field& old_field,
26982698
const Field& new_field) {
26992699
ASSERT(old_field.is_static());
27002700
ASSERT(new_field.is_static());
2701-
AddBecomeMapping(old_field, new_field, "static field");
2701+
AddBecomeMapping(old_field, new_field);
27022702
}
27032703

27042704
void ProgramReloadContext::AddBecomeMapping(const Object& old,
2705-
const Object& neu,
2706-
const char* whence) {
2707-
become_.Add(old, neu, whence);
2705+
const Object& neu) {
2706+
become_.Add(old, neu);
27082707
}
27092708

27102709
void ProgramReloadContext::RestoreClassHierarchyInvariants() {

runtime/vm/isolate_reload.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -379,9 +379,7 @@ class ProgramReloadContext {
379379
void AddLibraryMapping(const Library& replacement_or_new,
380380
const Library& original);
381381
void AddStaticFieldMapping(const Field& old_field, const Field& new_field);
382-
void AddBecomeMapping(const Object& old,
383-
const Object& neu,
384-
const char* whence);
382+
void AddBecomeMapping(const Object& old, const Object& neu);
385383
void RestoreClassHierarchyInvariants();
386384

387385
Become become_;

runtime/vm/object_reload.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ void Class::MigrateImplicitStaticClosures(ProgramReloadContext* irc,
338338
if (old_closure.IsCanonical()) {
339339
new_closure.SetCanonical();
340340
}
341-
irc->AddBecomeMapping(old_closure, new_closure, "static tear-off");
341+
irc->AddBecomeMapping(old_closure, new_closure);
342342
}
343343
}
344344
}
@@ -758,7 +758,7 @@ void Library::CheckReload(const Library& replacement,
758758
// The replacement of the old prefix with the new prefix
759759
// in Isolate::loaded_prefixes_set_ implicitly carried
760760
// the loaded state over to the new prefix.
761-
context->AddBecomeMapping(original_prefix, prefix, "library prefix");
761+
context->AddBecomeMapping(original_prefix, prefix);
762762
}
763763
}
764764
}

0 commit comments

Comments
 (0)