-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[vm, gc] Add flag to disable write barrier elimination.
TEST=ci Change-Id: Ibf1c8afc21c695c1e959ee7463110dd2c37ed846 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311822 Reviewed-by: Siva Annamalai <asiva@google.com> Commit-Queue: Ryan Macnak <rmacnak@google.com>
- Loading branch information
1 parent
d718ab5
commit d486c52
Showing
15 changed files
with
253 additions
and
1 deletion.
There are no files selected for viewing
121 changes: 121 additions & 0 deletions
121
runtime/tests/vm/dart/gc/chunked_binary_trees_array_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
// VMOptions= | ||
// VMOptions=--verify_store_buffer | ||
// VMOptions=--verify_after_marking | ||
// VMOptions=--stress_write_barrier_elimination | ||
// VMOptions=--no_eliminate_write_barriers | ||
// VMOptions=--no_inline_alloc | ||
|
||
buildTopDown(List n, int depth) { | ||
if (depth == 0) return; | ||
|
||
List l = new List<dynamic>.filled(3, null); | ||
l[2] = depth; // no-barrier | ||
List ll = new List<dynamic>.filled(3, null); | ||
ll[2] = depth; // no-barrier | ||
List lr = new List<dynamic>.filled(3, null); | ||
lr[2] = depth; // no-barrier | ||
List r = new List<dynamic>.filled(3, null); | ||
r[2] = depth; // no-barrier | ||
List rl = new List<dynamic>.filled(3, null); | ||
rl[2] = depth; // no-barrier | ||
List rr = new List<dynamic>.filled(3, null); | ||
rr[2] = depth; // no-barrier | ||
|
||
n[0] = l; // barrier | ||
n[1] = r; // barrier | ||
l[0] = ll; // no-barrier | ||
l[1] = lr; // no-barrier | ||
r[0] = rl; // no-barrier | ||
r[1] = rr; // no-barrier | ||
|
||
buildTopDown(ll, depth - 1); | ||
buildTopDown(lr, depth - 1); | ||
buildTopDown(rl, depth - 1); | ||
buildTopDown(rr, depth - 1); | ||
} | ||
|
||
checkTopDown(List n, int depth) { | ||
if (depth == 0) { | ||
if (n[0] != null) throw "Bad"; | ||
if (n[1] != null) throw "Bad"; | ||
return; | ||
} | ||
|
||
if (n[0][2] != depth) throw "Bad"; | ||
if (n[0][0][2] != depth) throw "Bad"; | ||
if (n[0][1][2] != depth) throw "Bad"; | ||
if (n[1][2] != depth) throw "Bad"; | ||
if (n[1][1][2] != depth) throw "Bad"; | ||
checkTopDown(n[0][0]!, depth - 1); | ||
checkTopDown(n[0][1]!, depth - 1); | ||
checkTopDown(n[1][0]!, depth - 1); | ||
checkTopDown(n[1][1]!, depth - 1); | ||
} | ||
|
||
runTopDown() { | ||
List n = new List<dynamic>.filled(3, null); | ||
n[2] = 10; | ||
buildTopDown(n, 10); | ||
checkTopDown(n, 10); | ||
} | ||
|
||
List buildBottomUp(int depth) { | ||
if (depth == 0) { | ||
var n = new List<dynamic>.filled(3, null); | ||
n[2] = depth; | ||
return n; | ||
} | ||
|
||
List ll = buildBottomUp(depth - 1); | ||
List lr = buildBottomUp(depth - 1); | ||
List rl = buildBottomUp(depth - 1); | ||
List rr = buildBottomUp(depth - 1); | ||
|
||
List l = new List<dynamic>.filled(3, null); | ||
l[2] = depth; // no-barrier | ||
List r = new List<dynamic>.filled(3, null); | ||
r[2] = depth; // no-barrier | ||
List n = new List<dynamic>.filled(3, null); | ||
n[2] = depth; // no-barrier | ||
|
||
n[0] = l; // no-barrier | ||
n[1] = r; // no-barrier | ||
l[0] = ll; // no-barrier | ||
l[1] = lr; // no-barrier | ||
r[0] = rl; // no-barrier | ||
r[1] = rr; // no-barrier | ||
|
||
return n; | ||
} | ||
|
||
checkButtomUp(List n, int depth) { | ||
if (depth == 0) { | ||
if (n[0] != null) throw "Bad"; | ||
if (n[1] != null) throw "Bad"; | ||
return; | ||
} | ||
|
||
if (n[2] != depth) throw "Bad"; | ||
if (n[0][2] != depth) throw "Bad"; | ||
if (n[1][2] != depth) throw "Bad"; | ||
checkButtomUp(n[0][0]!, depth - 1); | ||
checkButtomUp(n[0][1]!, depth - 1); | ||
checkButtomUp(n[1][0]!, depth - 1); | ||
checkButtomUp(n[1][1]!, depth - 1); | ||
} | ||
|
||
runBottomUp() { | ||
List n = buildBottomUp(10); | ||
checkButtomUp(n, 10); | ||
} | ||
|
||
main() { | ||
for (var i = 0; i < 10; i++) { | ||
runTopDown(); | ||
runBottomUp(); | ||
} | ||
} |
114 changes: 114 additions & 0 deletions
114
runtime/tests/vm/dart/gc/chunked_binary_trees_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
// VMOptions= | ||
// VMOptions=--verify_store_buffer | ||
// VMOptions=--verify_after_marking | ||
// VMOptions=--stress_write_barrier_elimination | ||
// VMOptions=--no_eliminate_write_barriers | ||
// VMOptions=--no_inline_alloc | ||
|
||
class Node { | ||
Node? left, right; | ||
int depth; | ||
Node(this.depth); | ||
} | ||
|
||
buildTopDown(Node n, int depth) { | ||
if (depth == 0) return; | ||
|
||
Node l = new Node(depth); | ||
Node ll = new Node(depth); | ||
Node lr = new Node(depth); | ||
Node r = new Node(depth); | ||
Node rl = new Node(depth); | ||
Node rr = new Node(depth); | ||
n.left = l; // barrier | ||
n.right = r; // barrier | ||
l.left = ll; // no-barrier | ||
l.right = lr; // no-barrier | ||
r.left = rl; // no-barrier | ||
r.right = rr; // no-barrier | ||
|
||
buildTopDown(ll, depth - 1); | ||
buildTopDown(lr, depth - 1); | ||
buildTopDown(rl, depth - 1); | ||
buildTopDown(rr, depth - 1); | ||
} | ||
|
||
checkTopDown(Node n, int depth) { | ||
if (depth == 0) { | ||
if (n.left != null) throw "Bad"; | ||
if (n.right != null) throw "Bad"; | ||
return; | ||
} | ||
|
||
if (n.left!.depth != depth) throw "Bad"; | ||
if (n.left!.left!.depth != depth) throw "Bad"; | ||
if (n.left!.right!.depth != depth) throw "Bad"; | ||
if (n.right!.depth != depth) throw "Bad"; | ||
if (n.right!.right!.depth != depth) throw "Bad"; | ||
checkTopDown(n.left!.left!, depth - 1); | ||
checkTopDown(n.left!.right!, depth - 1); | ||
checkTopDown(n.right!.left!, depth - 1); | ||
checkTopDown(n.right!.right!, depth - 1); | ||
} | ||
|
||
runTopDown() { | ||
Node n = new Node(10); | ||
buildTopDown(n, 10); | ||
checkTopDown(n, 10); | ||
} | ||
|
||
Node buildBottomUp(int depth) { | ||
if (depth == 0) { | ||
return new Node(depth); | ||
} | ||
|
||
Node ll = buildBottomUp(depth - 1); | ||
Node lr = buildBottomUp(depth - 1); | ||
Node rl = buildBottomUp(depth - 1); | ||
Node rr = buildBottomUp(depth - 1); | ||
|
||
Node l = new Node(depth); | ||
Node r = new Node(depth); | ||
Node n = new Node(depth); | ||
|
||
n.left = l; // no-barrier | ||
n.right = r; // no-barrier | ||
l.left = ll; // no-barrier | ||
l.right = lr; // no-barrier | ||
r.left = rl; // no-barrier | ||
r.right = rr; // no-barrier | ||
|
||
return n; | ||
} | ||
|
||
checkButtomUp(Node n, int depth) { | ||
if (depth == 0) { | ||
if (n.left != null) throw "Bad"; | ||
if (n.right != null) throw "Bad"; | ||
return; | ||
} | ||
|
||
if (n.depth != depth) throw "Bad"; | ||
if (n.left!.depth != depth) throw "Bad"; | ||
if (n.right!.depth != depth) throw "Bad"; | ||
checkButtomUp(n.left!.left!, depth - 1); | ||
checkButtomUp(n.left!.right!, depth - 1); | ||
checkButtomUp(n.right!.left!, depth - 1); | ||
checkButtomUp(n.right!.right!, depth - 1); | ||
} | ||
|
||
runBottomUp() { | ||
Node n = buildBottomUp(10); | ||
checkButtomUp(n, 10); | ||
} | ||
|
||
main() { | ||
for (var i = 0; i < 10; i++) { | ||
runTopDown(); | ||
runBottomUp(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters