Skip to content

Commit 934cc98

Browse files
author
Dart CI
committed
Version 2.14.0-109.0.dev
Merge commit 'a22d5b98fde7e8cf548982a9d683e0ebf350d520' into 'dev'
2 parents d59cb89 + a22d5b9 commit 934cc98

File tree

6 files changed

+128
-42
lines changed

6 files changed

+128
-42
lines changed

runtime/vm/heap/pages.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,17 @@ class OldPage {
145145
ASSERT((index >= 0) && (index < card_table_size()));
146146
card_table_[index] = 1;
147147
}
148+
bool IsCardRemembered(ObjectPtr const* slot) {
149+
ASSERT(Contains(reinterpret_cast<uword>(slot)));
150+
if (card_table_ == NULL) {
151+
return false;
152+
}
153+
intptr_t offset =
154+
reinterpret_cast<uword>(slot) - reinterpret_cast<uword>(this);
155+
intptr_t index = offset >> kBytesPerCardLog2;
156+
ASSERT((index >= 0) && (index < card_table_size()));
157+
return card_table_[index] != 0;
158+
}
148159
#if defined(DART_COMPRESSED_POINTERS)
149160
void RememberCard(CompressedObjectPtr const* slot) {
150161
ASSERT(Contains(reinterpret_cast<uword>(slot)));
@@ -158,6 +169,17 @@ class OldPage {
158169
ASSERT((index >= 0) && (index < card_table_size()));
159170
card_table_[index] = 1;
160171
}
172+
bool IsCardRemembered(CompressedObjectPtr const* slot) {
173+
ASSERT(Contains(reinterpret_cast<uword>(slot)));
174+
if (card_table_ == NULL) {
175+
return false;
176+
}
177+
intptr_t offset =
178+
reinterpret_cast<uword>(slot) - reinterpret_cast<uword>(this);
179+
intptr_t index = offset >> kBytesPerCardLog2;
180+
ASSERT((index >= 0) && (index < card_table_size()));
181+
return card_table_[index] != 0;
182+
}
161183
#endif
162184
void VisitRememberedCards(ObjectPointerVisitor* visitor);
163185

runtime/vm/heap/scavenger.cc

Lines changed: 38 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "vm/dart_api_state.h"
1010
#include "vm/flag_list.h"
1111
#include "vm/heap/become.h"
12+
#include "vm/heap/pages.h"
1213
#include "vm/heap/pointer_block.h"
1314
#include "vm/heap/safepoint.h"
1415
#include "vm/heap/verifier.h"
@@ -867,30 +868,40 @@ class CheckStoreBufferVisitor : public ObjectVisitor,
867868
if (raw_obj->IsPseudoObject()) return;
868869
RELEASE_ASSERT(raw_obj->IsOldObject());
869870

870-
if (raw_obj->untag()->IsCardRemembered()) {
871-
RELEASE_ASSERT(!raw_obj->untag()->IsRemembered());
872-
// TODO(rmacnak): Verify card tables.
873-
return;
874-
}
875-
876871
RELEASE_ASSERT(raw_obj->untag()->IsRemembered() ==
877872
in_store_buffer_->Contains(raw_obj));
878873

879874
visiting_ = raw_obj;
880875
is_remembered_ = raw_obj->untag()->IsRemembered();
876+
is_card_remembered_ = raw_obj->untag()->IsCardRemembered();
877+
if (is_card_remembered_) {
878+
RELEASE_ASSERT(!is_remembered_);
879+
}
881880
raw_obj->untag()->VisitPointers(this);
882881
}
883882

884883
void VisitPointers(ObjectPtr* from, ObjectPtr* to) {
885884
for (ObjectPtr* ptr = from; ptr <= to; ptr++) {
886885
ObjectPtr raw_obj = *ptr;
887886
if (raw_obj->IsHeapObject() && raw_obj->IsNewObject()) {
888-
if (!is_remembered_) {
887+
if (is_card_remembered_) {
888+
if (!OldPage::Of(visiting_)->IsCardRemembered(ptr)) {
889+
FATAL3(
890+
"Old object %#" Px " references new object %#" Px
891+
", but the "
892+
"slot's card is not remembered. Consider using rr to watch the "
893+
"slot %p and reverse-continue to find the store with a missing "
894+
"barrier.\n",
895+
static_cast<uword>(visiting_), static_cast<uword>(raw_obj),
896+
ptr);
897+
}
898+
} else if (!is_remembered_) {
889899
FATAL3(
890900
"Old object %#" Px " references new object %#" Px
891-
", but it is not"
892-
" in any store buffer. Consider using rr to watch the slot %p and"
893-
" reverse-continue to find the store with a missing barrier.\n",
901+
", but it is "
902+
"not in any store buffer. Consider using rr to watch the "
903+
"slot %p and reverse-continue to find the store with a missing "
904+
"barrier.\n",
894905
static_cast<uword>(visiting_), static_cast<uword>(raw_obj), ptr);
895906
}
896907
RELEASE_ASSERT(to_->Contains(UntaggedObject::ToAddr(raw_obj)));
@@ -904,12 +915,24 @@ class CheckStoreBufferVisitor : public ObjectVisitor,
904915
for (CompressedObjectPtr* ptr = from; ptr <= to; ptr++) {
905916
ObjectPtr raw_obj = ptr->Decompress(heap_base);
906917
if (raw_obj->IsHeapObject() && raw_obj->IsNewObject()) {
907-
if (!is_remembered_) {
918+
if (is_card_remembered_) {
919+
if (!OldPage::Of(visiting_)->IsCardRemembered(ptr)) {
920+
FATAL3(
921+
"Old object %#" Px " references new object %#" Px
922+
", but the "
923+
"slot's card is not remembered. Consider using rr to watch the "
924+
"slot %p and reverse-continue to find the store with a missing "
925+
"barrier.\n",
926+
static_cast<uword>(visiting_), static_cast<uword>(raw_obj),
927+
ptr);
928+
}
929+
} else if (!is_remembered_) {
908930
FATAL3(
909931
"Old object %#" Px " references new object %#" Px
910-
", but it is not"
911-
" in any store buffer. Consider using rr to watch the slot %p and"
912-
" reverse-continue to find the store with a missing barrier.\n",
932+
", but it is "
933+
"not in any store buffer. Consider using rr to watch the "
934+
"slot %p and reverse-continue to find the store with a missing "
935+
"barrier.\n",
913936
static_cast<uword>(visiting_), static_cast<uword>(raw_obj), ptr);
914937
}
915938
RELEASE_ASSERT(to_->Contains(UntaggedObject::ToAddr(raw_obj)));
@@ -922,6 +945,7 @@ class CheckStoreBufferVisitor : public ObjectVisitor,
922945
const SemiSpace* const to_;
923946
ObjectPtr visiting_;
924947
bool is_remembered_;
948+
bool is_card_remembered_;
925949
};
926950

927951
void Scavenger::VerifyStoreBuffers() {

tools/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ CHANNEL dev
2727
MAJOR 2
2828
MINOR 14
2929
PATCH 0
30-
PRERELEASE 108
30+
PRERELEASE 109
3131
PRERELEASE_PATCH 0

tools/create_timestamp_file.py

Lines changed: 0 additions & 19 deletions
This file was deleted.
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/usr/bin/env python3
2+
# Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
3+
# for details. All rights reserved. Use of this source code is governed by a
4+
# BSD-style license that can be found in the LICENSE file.
5+
"""Tool for listing Dart source files.
6+
7+
If the first argument is 'relative', the script produces paths relative to the
8+
current working directory. If the first argument is 'absolute', the script
9+
produces absolute paths.
10+
11+
Usage:
12+
python3 tools/list_dart_files_as_depfile.py <depfile> <directory> <pattern>
13+
"""
14+
15+
import os
16+
import re
17+
import sys
18+
19+
20+
def main(argv):
21+
depfile = argv[1]
22+
directory = argv[2]
23+
if not os.path.isabs(directory):
24+
directory = os.path.realpath(directory)
25+
26+
pattern = None
27+
if len(argv) > 3:
28+
pattern = re.compile(argv[3])
29+
30+
# Output a GN/Ninja depfile, whose format is a Makefile with one target.
31+
out = open(depfile, 'w')
32+
out.write(os.path.relpath(depfile))
33+
out.write(":")
34+
35+
for root, directories, files in os.walk(directory):
36+
# We only care about actual source files, not generated code or tests.
37+
for skip_dir in ['.git', 'gen', 'test']:
38+
if skip_dir in directories:
39+
directories.remove(skip_dir)
40+
41+
# If we are looking at the root directory, filter the immediate
42+
# subdirectories by the given pattern.
43+
if pattern and root == directory:
44+
directories[:] = filter(pattern.match, directories)
45+
46+
for filename in files:
47+
if filename.endswith(
48+
'.dart') and not filename.endswith('_test.dart'):
49+
fullname = os.path.join(directory, root, filename)
50+
fullname = fullname.replace(os.sep, '/')
51+
out.write(" \"")
52+
out.write(fullname)
53+
out.write("\"")
54+
55+
out.write("\n")
56+
out.close()
57+
58+
59+
if __name__ == '__main__':
60+
sys.exit(main(sys.argv))

utils/create_timestamp.gni

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,15 @@ template("create_timestamp_file") {
1010
path = invoker.path
1111
output = invoker.output
1212
action(target_name) {
13-
list_args = [ path ]
13+
script = "$_dart_root/tools/list_dart_files_as_depfile.py"
14+
args = [
15+
rebase_path(output),
16+
path,
17+
]
1418
if (defined(invoker.pattern)) {
15-
list_args += [ invoker.pattern ]
19+
args += [ invoker.pattern ]
1620
}
17-
files = exec_script("$_dart_root/tools/list_dart_files.py",
18-
[ "absolute" ] + list_args,
19-
"list lines")
20-
inputs = [ "$_dart_root/tools/list_dart_files.py" ] + files
21+
depfile = output
2122
outputs = [ output ]
22-
script = "$_dart_root/tools/create_timestamp_file.py"
23-
args = [ rebase_path(output) ]
2423
}
2524
}

0 commit comments

Comments
 (0)