-
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] Account for unbounded number of images pages in the compactor.
Bug: #41974 Change-Id: I23201f28e5d1e2ba298611206fc3eb0a9a989c2b Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155241 Reviewed-by: Alexander Markov <[email protected]> Commit-Queue: Ryan Macnak <[email protected]>
- Loading branch information
1 parent
9b04db0
commit d68d2e9
Showing
10 changed files
with
161 additions
and
24 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// Copyright (c) 2020, 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. | ||
|
||
foo() { | ||
return "one!"; | ||
} |
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,7 @@ | ||
// Copyright (c) 2020, 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. | ||
|
||
foo() { | ||
return "two!"; | ||
} |
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,7 @@ | ||
// Copyright (c) 2020, 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. | ||
|
||
foo() { | ||
return "three!"; | ||
} |
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,40 @@ | ||
// Copyright (c) 2020, 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=--use_compactor | ||
|
||
// Each loading unit creates more image pages in the heap, which unfortunately | ||
// cannot be aligned stronger than virtual memory page alignment, so the | ||
// compactor must detect references to these image pages separately. Before | ||
// these loading units were implemented, the compactor could assume a small | ||
// upper bound on the number of image pages. | ||
|
||
import "package:expect/expect.dart"; | ||
import "fragmentation_deferred_load_lib1.dart" deferred as lib1; | ||
import "fragmentation_deferred_load_lib2.dart" deferred as lib2; | ||
import "fragmentation_deferred_load_lib3.dart" deferred as lib3; | ||
|
||
main() async { | ||
await lib1.loadLibrary(); | ||
Expect.equals("one!", lib1.foo()); | ||
await lib2.loadLibrary(); | ||
Expect.equals("two!", lib2.foo()); | ||
await lib3.loadLibrary(); | ||
Expect.equals("three!", lib3.foo()); | ||
|
||
final List<List?> arrays = []; | ||
// Fill up heap with alternate large-small items. | ||
for (int i = 0; i < 500000; i++) { | ||
arrays.add(new List<dynamic>.filled(260, null)); | ||
arrays.add(new List<dynamic>.filled(1, null)); | ||
} | ||
// Clear the large items so that the heap is full of 260-word gaps. | ||
for (int i = 0; i < arrays.length; i += 2) { | ||
arrays[i] = null; | ||
} | ||
// Allocate a lot of 300-word objects that don't fit in the gaps. | ||
for (int i = 0; i < 600000; i++) { | ||
arrays.add(new List<dynamic>.filled(300, null)); | ||
} | ||
} |
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,7 @@ | ||
// Copyright (c) 2020, 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. | ||
|
||
foo() { | ||
return "one!"; | ||
} |
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,7 @@ | ||
// Copyright (c) 2020, 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. | ||
|
||
foo() { | ||
return "two!"; | ||
} |
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,7 @@ | ||
// Copyright (c) 2020, 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. | ||
|
||
foo() { | ||
return "three!"; | ||
} |
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,40 @@ | ||
// Copyright (c) 2020, 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=--use_compactor | ||
|
||
// Each loading unit creates more image pages in the heap, which unfortunately | ||
// cannot be aligned stronger than virtual memory page alignment, so the | ||
// compactor must detect references to these image pages separately. Before | ||
// these loading units were implemented, the compactor could assume a small | ||
// upper bound on the number of image pages. | ||
|
||
import "package:expect/expect.dart"; | ||
import "fragmentation_deferred_load_lib1.dart" deferred as lib1; | ||
import "fragmentation_deferred_load_lib2.dart" deferred as lib2; | ||
import "fragmentation_deferred_load_lib3.dart" deferred as lib3; | ||
|
||
main() async { | ||
await lib1.loadLibrary(); | ||
Expect.equals("one!", lib1.foo()); | ||
await lib2.loadLibrary(); | ||
Expect.equals("two!", lib2.foo()); | ||
await lib3.loadLibrary(); | ||
Expect.equals("three!", lib3.foo()); | ||
|
||
final List<List> arrays = []; | ||
// Fill up heap with alternate large-small items. | ||
for (int i = 0; i < 500000; i++) { | ||
arrays.add(new List(260)); | ||
arrays.add(new List(1)); | ||
} | ||
// Clear the large items so that the heap is full of 260-word gaps. | ||
for (int i = 0; i < arrays.length; i += 2) { | ||
arrays[i] = null; | ||
} | ||
// Allocate a lot of 300-word objects that don't fit in the gaps. | ||
for (int i = 0; i < 600000; i++) { | ||
arrays.add(new List(300)); | ||
} | ||
} |