Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 219df3a

Browse files
author
Dart CI
committed
Version 2.19.0-327.0.dev
Merge b03b9c3 into dev
2 parents f1d4c7c + b03b9c3 commit 219df3a

26 files changed

+10521
-9747
lines changed

benchmarks/TypedDataPoly/dart/TypedDataPoly.dart

Lines changed: 461 additions & 0 deletions
Large diffs are not rendered by default.

pkg/kernel/lib/binary/ast_from_binary.dart

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,18 @@ class BinaryBuilder {
244244
return readBytes(readUInt30());
245245
}
246246

247+
Uint8List readOrViewByteList() {
248+
int length = readUInt30();
249+
List<int> source = _bytes;
250+
if (source is Uint8List) {
251+
Uint8List view =
252+
source.buffer.asUint8List(source.offsetInBytes + _byteOffset, length);
253+
_byteOffset += length;
254+
return view;
255+
}
256+
return readBytes(length);
257+
}
258+
247259
String readString() {
248260
return readStringEntry(readUInt30());
249261
}
@@ -927,7 +939,7 @@ class BinaryBuilder {
927939
String uriString = readString();
928940
Uri uri = Uri.parse(uriString);
929941
_sourceUriTable[i] = uri;
930-
Uint8List sourceCode = readByteList();
942+
Uint8List sourceCode = readOrViewByteList();
931943
int lineCount = readUInt30();
932944
List<int> lineStarts = new List<int>.filled(
933945
lineCount,

runtime/tests/vm/dart/splay_ephemeron_test.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
// VMOptions=--verify_after_gc
2828
// VMOptions=--verify_before_gc --verify_after_gc
2929
// VMOptions=--verify_store_buffer
30+
// VMOptions=--verify_after_marking
3031
// VMOptions=--stress_write_barrier_elimination
3132
// VMOptions=--old_gen_heap_size=150
3233

runtime/tests/vm/dart/splay_test.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
// VMOptions=--verify_after_gc
2626
// VMOptions=--verify_before_gc --verify_after_gc
2727
// VMOptions=--verify_store_buffer
28+
// VMOptions=--verify_after_marking
2829
// VMOptions=--stress_write_barrier_elimination
2930
// VMOptions=--old_gen_heap_size=100
3031
// VMOptions=--mark_when_idle

runtime/tests/vm/dart_2/splay_ephemeron_test.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
// VMOptions=--verify_after_gc
3232
// VMOptions=--verify_before_gc --verify_after_gc
3333
// VMOptions=--verify_store_buffer
34+
// VMOptions=--verify_after_marking
3435
// VMOptions=--stress_write_barrier_elimination
3536
// VMOptions=--old_gen_heap_size=150
3637

runtime/tests/vm/dart_2/splay_test.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
// VMOptions=--verify_after_gc
3030
// VMOptions=--verify_before_gc --verify_after_gc
3131
// VMOptions=--verify_store_buffer
32+
// VMOptions=--verify_after_marking
3233
// VMOptions=--stress_write_barrier_elimination
3334
// VMOptions=--old_gen_heap_size=100
3435
// VMOptions=--mark_when_idle

runtime/vm/flag_list.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,8 @@ constexpr bool FLAG_support_il_printer = false;
241241
"Enables heap verification before GC.") \
242242
R(verify_store_buffer, false, bool, false, \
243243
"Enables store buffer verification before and after scavenges.") \
244+
R(verify_after_marking, false, bool, false, \
245+
"Enables heap verification after marking.") \
244246
P(enable_slow_path_sharing, bool, true, "Enable sharing of slow-path code.") \
245247
P(shared_slow_path_triggers_gc, bool, false, \
246248
"TESTING: slow-path triggers a GC.") \

runtime/vm/heap/heap.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,7 @@ class Heap {
390390
friend class ProgramReloadContext; // VisitObjects
391391
friend class ClassFinalizer; // VisitObjects
392392
friend class HeapIterationScope; // VisitObjects
393+
friend class GCMarker; // VisitObjects
393394
friend class ProgramVisitor; // VisitObjectsImagePages
394395
friend class Serializer; // VisitObjectsImagePages
395396
friend class HeapTestHelper;

runtime/vm/heap/marker.cc

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -988,6 +988,43 @@ void GCMarker::IncrementalMarkWithTimeBudget(PageSpace* page_space,
988988
}
989989
}
990990

991+
class VerifyAfterMarkingVisitor : public ObjectVisitor,
992+
public ObjectPointerVisitor {
993+
public:
994+
VerifyAfterMarkingVisitor()
995+
: ObjectVisitor(), ObjectPointerVisitor(IsolateGroup::Current()) {}
996+
997+
void VisitObject(ObjectPtr obj) {
998+
if (obj->IsNewObject() || obj->untag()->IsMarked()) {
999+
obj->untag()->VisitPointers(this);
1000+
}
1001+
}
1002+
1003+
void VisitPointers(ObjectPtr* from, ObjectPtr* to) {
1004+
for (ObjectPtr* ptr = from; ptr <= to; ptr++) {
1005+
ObjectPtr obj = *ptr;
1006+
if (obj->IsHeapObject() && obj->IsOldObject() &&
1007+
!obj->untag()->IsMarked()) {
1008+
FATAL("Not marked: *0x%" Px " = 0x%" Px "\n",
1009+
reinterpret_cast<uword>(ptr), static_cast<uword>(obj));
1010+
}
1011+
}
1012+
}
1013+
1014+
void VisitCompressedPointers(uword heap_base,
1015+
CompressedObjectPtr* from,
1016+
CompressedObjectPtr* to) {
1017+
for (CompressedObjectPtr* ptr = from; ptr <= to; ptr++) {
1018+
ObjectPtr obj = ptr->Decompress(heap_base);
1019+
if (obj->IsHeapObject() && obj->IsOldObject() &&
1020+
!obj->untag()->IsMarked()) {
1021+
FATAL("Not marked: *0x%" Px " = 0x%" Px "\n",
1022+
reinterpret_cast<uword>(ptr), static_cast<uword>(obj));
1023+
}
1024+
}
1025+
}
1026+
};
1027+
9911028
void GCMarker::MarkObjects(PageSpace* page_space) {
9921029
if (isolate_group_->marking_stack() != NULL) {
9931030
isolate_group_->DisableIncrementalBarrier();
@@ -1073,6 +1110,16 @@ void GCMarker::MarkObjects(PageSpace* page_space) {
10731110
ASSERT(global_list_.IsEmpty());
10741111
}
10751112
}
1113+
1114+
// Separate from verify_after_gc because that verification interferes with
1115+
// concurrent marking.
1116+
if (FLAG_verify_after_marking) {
1117+
OS::PrintErr("Verifying after marking...");
1118+
VerifyAfterMarkingVisitor visitor;
1119+
heap_->VisitObjects(&visitor);
1120+
OS::PrintErr(" done.\n");
1121+
}
1122+
10761123
Epilogue();
10771124
}
10781125

runtime/vm/heap/verifier.cc

Lines changed: 42 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -16,63 +16,62 @@
1616

1717
namespace dart {
1818

19-
void VerifyObjectVisitor::VisitObject(ObjectPtr raw_obj) {
20-
if (raw_obj->IsHeapObject()) {
21-
uword raw_addr = UntaggedObject::ToAddr(raw_obj);
22-
if (raw_obj->IsFreeListElement() || raw_obj->IsForwardingCorpse()) {
23-
if (raw_obj->IsOldObject() && raw_obj->untag()->IsMarked()) {
24-
FATAL1("Marked free list element encountered %#" Px "\n", raw_addr);
25-
}
26-
} else {
27-
switch (mark_expectation_) {
28-
case kForbidMarked:
29-
if (raw_obj->IsOldObject() && raw_obj->untag()->IsMarked()) {
30-
FATAL1("Marked object encountered %#" Px "\n", raw_addr);
31-
}
32-
break;
33-
case kAllowMarked:
34-
break;
35-
case kRequireMarked:
36-
if (raw_obj->IsOldObject() && !raw_obj->untag()->IsMarked()) {
37-
FATAL1("Unmarked object encountered %#" Px "\n", raw_addr);
38-
}
39-
break;
40-
}
19+
void VerifyObjectVisitor::VisitObject(ObjectPtr obj) {
20+
ASSERT(obj->IsHeapObject());
21+
uword addr = UntaggedObject::ToAddr(obj);
22+
if (obj->IsFreeListElement() || obj->IsForwardingCorpse()) {
23+
if (obj->IsOldObject() && obj->untag()->IsMarked()) {
24+
FATAL("Marked free list element encountered %#" Px "\n", addr);
25+
}
26+
} else {
27+
switch (mark_expectation_) {
28+
case kForbidMarked:
29+
if (obj->IsOldObject() && obj->untag()->IsMarked()) {
30+
FATAL("Marked object encountered %#" Px "\n", addr);
31+
}
32+
break;
33+
case kAllowMarked:
34+
break;
35+
case kRequireMarked:
36+
if (obj->IsOldObject() && !obj->untag()->IsMarked()) {
37+
FATAL("Unmarked object encountered %#" Px "\n", addr);
38+
}
39+
break;
4140
}
41+
allocated_set_->Add(obj);
4242
}
43-
allocated_set_->Add(raw_obj);
44-
raw_obj->Validate(isolate_group_);
43+
obj->Validate(isolate_group_);
4544
}
4645

47-
void VerifyPointersVisitor::VisitPointers(ObjectPtr* first, ObjectPtr* last) {
48-
for (ObjectPtr* current = first; current <= last; current++) {
49-
ObjectPtr raw_obj = *current;
50-
if (raw_obj->IsHeapObject()) {
51-
if (!allocated_set_->Contains(raw_obj)) {
52-
if (raw_obj->IsInstructions() &&
53-
allocated_set_->Contains(Page::ToWritable(raw_obj))) {
46+
void VerifyPointersVisitor::VisitPointers(ObjectPtr* from, ObjectPtr* to) {
47+
for (ObjectPtr* ptr = from; ptr <= to; ptr++) {
48+
ObjectPtr obj = *ptr;
49+
if (obj->IsHeapObject()) {
50+
if (!allocated_set_->Contains(obj)) {
51+
if (obj->IsInstructions() &&
52+
allocated_set_->Contains(Page::ToWritable(obj))) {
5453
continue;
5554
}
56-
uword raw_addr = UntaggedObject::ToAddr(raw_obj);
57-
FATAL1("Invalid object pointer encountered %#" Px "\n", raw_addr);
55+
uword addr = UntaggedObject::ToAddr(obj);
56+
FATAL("Invalid object pointer encountered %#" Px "\n", addr);
5857
}
5958
}
6059
}
6160
}
6261

6362
void VerifyPointersVisitor::VisitCompressedPointers(uword heap_base,
64-
CompressedObjectPtr* first,
65-
CompressedObjectPtr* last) {
66-
for (CompressedObjectPtr* current = first; current <= last; current++) {
67-
ObjectPtr raw_obj = current->Decompress(heap_base);
68-
if (raw_obj->IsHeapObject()) {
69-
if (!allocated_set_->Contains(raw_obj)) {
70-
if (raw_obj->IsInstructions() &&
71-
allocated_set_->Contains(Page::ToWritable(raw_obj))) {
63+
CompressedObjectPtr* from,
64+
CompressedObjectPtr* to) {
65+
for (CompressedObjectPtr* ptr = from; ptr <= to; ptr++) {
66+
ObjectPtr obj = ptr->Decompress(heap_base);
67+
if (obj->IsHeapObject()) {
68+
if (!allocated_set_->Contains(obj)) {
69+
if (obj->IsInstructions() &&
70+
allocated_set_->Contains(Page::ToWritable(obj))) {
7271
continue;
7372
}
74-
uword raw_addr = UntaggedObject::ToAddr(raw_obj);
75-
FATAL1("Invalid object pointer encountered %#" Px "\n", raw_addr);
73+
uword addr = UntaggedObject::ToAddr(obj);
74+
FATAL("Invalid object pointer encountered %#" Px "\n", addr);
7675
}
7776
}
7877
}

0 commit comments

Comments
 (0)