Skip to content

Fibers 1.0 #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 427 commits into
base: version-3.5.1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
427 commits
Select commit Hold shift + click to select a range
f1f471d
fibers
antonbashir Aug 30, 2024
3c0707d
fibers
antonbashir Aug 30, 2024
d6c2800
fiber
antonbashir Aug 30, 2024
dbe2694
fiber
antonbashir Aug 30, 2024
e7a4642
fiber
antonbashir Aug 30, 2024
03bcf7c
fibes
antonbashir Aug 30, 2024
a50fee3
fibers
antonbashir Sep 1, 2024
c411c46
fibers
antonbashir Sep 1, 2024
a7b7002
fibers
antonbashir Sep 1, 2024
7dc1247
fibers
antonbashir Sep 1, 2024
e51cee9
fibers
antonbashir Sep 1, 2024
a3cc4e0
fibers
antonbashir Sep 1, 2024
9db235e
fibers
antonbashir Sep 1, 2024
f6a9755
fibers
antonbashir Sep 1, 2024
0833734
fibers
antonbashir Sep 1, 2024
f269c2b
fibers
antonbashir Sep 1, 2024
e2da16c
fibers
antonbashir Sep 1, 2024
773d061
fibers
antonbashir Sep 1, 2024
71eae98
fibers
antonbashir Sep 1, 2024
1bc3e7a
fibers
antonbashir Sep 1, 2024
194390d
fibers
antonbashir Sep 1, 2024
dd3438b
fibers
antonbashir Sep 1, 2024
3fba8d0
fibers
antonbashir Sep 1, 2024
64fd60f
fibers
antonbashir Sep 1, 2024
7b19ae5
fibers
antonbashir Sep 1, 2024
c4b3af8
fibers
antonbashir Sep 1, 2024
6aea018
fibers
antonbashir Sep 1, 2024
1df4d62
fiber
antonbashir Sep 1, 2024
fe97c48
fibers
antonbashir Sep 1, 2024
b2af980
fibers
antonbashir Sep 2, 2024
52eeab5
fibers
antonbashir Sep 2, 2024
e3846a2
fibers
antonbashir Sep 2, 2024
88681a4
fibers
antonbashir Sep 2, 2024
9160f9e
fibers
antonbashir Sep 2, 2024
24841b5
fibers
antonbashir Sep 3, 2024
20b8682
fibers
antonbashir Sep 3, 2024
7ad21e0
fibers
antonbashir Sep 3, 2024
db844ef
fiber
antonbashir Sep 3, 2024
a69401c
fibers
antonbashir Sep 3, 2024
ef5daae
fibers
antonbashir Sep 3, 2024
8496644
fibers
antonbashir Sep 4, 2024
9cb8912
fibers
antonbashir Sep 4, 2024
b4ac853
fibers
antonbashir Sep 4, 2024
9806396
fibers
antonbashir Sep 4, 2024
4c1455a
fibers
antonbashir Sep 4, 2024
921787e
fibers
antonbashir Sep 4, 2024
fa9fa85
fibers
antonbashir Sep 4, 2024
fadb936
fibers
antonbashir Sep 5, 2024
2dd2edf
fibers
antonbashir Sep 5, 2024
b45012a
fibers
antonbashir Sep 5, 2024
98257c7
fibers
antonbashir Sep 5, 2024
d2b8fb5
fibers
antonbashir Sep 5, 2024
422a3c8
fibers
antonbashir Sep 6, 2024
c64e9ba
fibers
antonbashir Sep 6, 2024
c99e8c5
fibers
antonbashir Sep 6, 2024
92a99d3
fibers
antonbashir Sep 6, 2024
106c64e
fibers
antonbashir Sep 6, 2024
db41a11
fiber
antonbashir Sep 7, 2024
c063aae
fibers
antonbashir Sep 7, 2024
383b321
fibers
antonbashir Sep 7, 2024
ae69d68
fibers
antonbashir Sep 7, 2024
5576395
fibers
antonbashir Sep 8, 2024
4140330
fibers
antonbashir Sep 8, 2024
4b66d13
fibers
antonbashir Sep 8, 2024
6a87e2f
fiber
antonbashir Sep 8, 2024
967d08e
fibers
antonbashir Sep 8, 2024
1be9e66
fibers
antonbashir Sep 8, 2024
f594a65
fibers
antonbashir Sep 8, 2024
74ee78b
fibers
antonbashir Sep 8, 2024
6c5fbe2
fibers
antonbashir Sep 8, 2024
8707beb
fibers
antonbashir Sep 8, 2024
df5615e
fibers
antonbashir Sep 8, 2024
f0cb133
fibers
antonbashir Sep 8, 2024
d557f30
fiber
antonbashir Sep 8, 2024
c54f272
fibers
antonbashir Sep 9, 2024
58f6795
fibers
antonbashir Sep 9, 2024
a402b3e
fiber
antonbashir Sep 9, 2024
dc69528
fibers
antonbashir Sep 11, 2024
79f03c4
fibers
antonbashir Sep 11, 2024
4c56060
fiber
antonbashir Sep 11, 2024
3c6ef38
fibers
antonbashir Sep 11, 2024
00cb59b
fibers
antonbashir Sep 11, 2024
c6ff451
fibers
antonbashir Sep 11, 2024
7bf17bb
fibers
antonbashir Sep 11, 2024
26fac70
fibers
antonbashir Sep 11, 2024
8f35b4b
fibers
antonbashir Sep 11, 2024
c377963
fibers
antonbashir Sep 11, 2024
1304a58
fiber
antonbashir Sep 11, 2024
97aa1b6
fibers
antonbashir Sep 12, 2024
bc7ff6e
fiber
antonbashir Sep 12, 2024
c2dc159
fibers
antonbashir Sep 12, 2024
85dcb42
fiber
antonbashir Sep 12, 2024
365b578
fibers
antonbashir Sep 12, 2024
cf57399
fibers
antonbashir Sep 12, 2024
4c26b0a
fibers
antonbashir Sep 12, 2024
48d1cdb
fibers
antonbashir Sep 13, 2024
fa7040e
fibers
antonbashir Sep 14, 2024
b488a2e
fibers
antonbashir Sep 14, 2024
6a93c61
fibers
antonbashir Sep 14, 2024
02eda0d
fibers
antonbashir Sep 14, 2024
9ca0350
fibers
antonbashir Sep 14, 2024
60a82bf
fibers
antonbashir Sep 14, 2024
93168bd
fibers
antonbashir Sep 14, 2024
f0fa291
fibers
antonbashir Sep 14, 2024
46c2f38
fibers
antonbashir Sep 14, 2024
45e8625
fibers
antonbashir Sep 14, 2024
8021590
fibers
antonbashir Sep 15, 2024
d3cdc67
fibers
antonbashir Sep 15, 2024
ccd8898
fibers
antonbashir Sep 15, 2024
a84dbf8
fibers
antonbashir Sep 15, 2024
297ff20
fibers
antonbashir Sep 15, 2024
0e0d275
fibers
antonbashir Sep 15, 2024
2220167
fibers
antonbashir Sep 15, 2024
04e32d7
fibers
antonbashir Sep 15, 2024
59ec86d
fiber
antonbashir Sep 15, 2024
48398ca
fibers
antonbashir Sep 16, 2024
07db43e
WIP on fibers: 53ad223cf57 remove formatting
antonbashir Sep 19, 2024
96c2944
fibers
antonbashir Sep 19, 2024
05fedfe
fibers
antonbashir Sep 19, 2024
249ab27
fibers
antonbashir Sep 19, 2024
fa97a44
fibers
antonbashir Sep 19, 2024
783e840
fibers
antonbashir Sep 22, 2024
87557f0
fibers
antonbashir Sep 22, 2024
40507c3
fibers
antonbashir Sep 22, 2024
fd80628
fibers
antonbashir Sep 22, 2024
5b8cbeb
fibers
antonbashir Sep 22, 2024
7a2f826
fibers
antonbashir Sep 22, 2024
6c28224
fibers
antonbashir Sep 22, 2024
2ef2189
fibers
antonbashir Sep 22, 2024
e0ac44e
fibers
antonbashir Sep 22, 2024
aa396c3
fibers
antonbashir Sep 22, 2024
6a4e66f
fibers
antonbashir Sep 22, 2024
2d6be30
fibers
antonbashir Sep 22, 2024
7cf7a7f
fibers
antonbashir Sep 22, 2024
ff0fd83
fibers
antonbashir Sep 22, 2024
86843ce
fibers
antonbashir Sep 22, 2024
9637dd3
fibers
antonbashir Sep 22, 2024
ffcf86d
fibers
antonbashir Sep 22, 2024
5c20f15
fibers
antonbashir Sep 22, 2024
8b8b6fe
fibers
antonbashir Sep 22, 2024
459f6ff
fixes
antonbashir Sep 22, 2024
11da9a5
fibers
antonbashir Sep 22, 2024
786ec23
fibers
antonbashir Sep 22, 2024
466209b
fibers
antonbashir Sep 22, 2024
bcfd360
fibers
antonbashir Sep 22, 2024
d065d4c
fibers
antonbashir Sep 22, 2024
3070397
fibers
antonbashir Sep 23, 2024
4978a95
fibers
antonbashir Sep 23, 2024
0476858
fibers
antonbashir Sep 23, 2024
908c40f
fibers
antonbashir Sep 23, 2024
5dcfa47
fibers
antonbashir Sep 23, 2024
c2bdaf7
fibers
antonbashir Sep 23, 2024
2096bc1
fibers
antonbashir Sep 23, 2024
27047b1
fibers
antonbashir Sep 23, 2024
e1ba626
fibers
antonbashir Sep 23, 2024
e01f5af
fibers
antonbashir Sep 23, 2024
cdc54b2
fibers
antonbashir Sep 23, 2024
7224ed2
fibers
antonbashir Sep 23, 2024
3e6af68
fibers
antonbashir Sep 23, 2024
d2e759f
fibers
antonbashir Sep 23, 2024
c8b1f07
fibers
antonbashir Sep 23, 2024
777f945
fixes
antonbashir Sep 25, 2024
0127072
fixes
antonbashir Sep 26, 2024
8bd9446
fixes
antonbashir Sep 26, 2024
a83264b
fibers
antonbashir Sep 26, 2024
dcb672e
fibers
antonbashir Sep 26, 2024
4304b5e
fixes
antonbashir Sep 26, 2024
cf5399d
fibers
antonbashir Sep 26, 2024
7a67d14
fibers
antonbashir Sep 26, 2024
36c5baa
fibers
antonbashir Sep 26, 2024
be7a7e2
fibers
antonbashir Sep 26, 2024
b82842e
fibers
antonbashir Sep 26, 2024
8bfe76d
fibers
antonbashir Sep 27, 2024
74abdf2
fibers
antonbashir Sep 27, 2024
1de937d
fixes
antonbashir Sep 27, 2024
4c057ae
fibers
antonbashir Sep 30, 2024
a666dd0
here we go again
antonbashir Oct 28, 2024
b7ae8ad
fibers
antonbashir Oct 28, 2024
a655c40
enable debug for sdk
antonbashir Oct 29, 2024
8eed1e1
fixes
antonbashir Oct 29, 2024
cf42a2a
fixes
antonbashir Oct 29, 2024
e1d34a5
fixes
antonbashir Oct 30, 2024
05987dd
visit coroutines
antonbashir Oct 30, 2024
4c60a76
fixes
antonbashir Oct 30, 2024
35e230f
fibers
antonbashir Oct 30, 2024
c597f98
fixes
antonbashir Oct 30, 2024
30746b5
fixes
antonbashir Oct 30, 2024
006949d
refactoring
antonbashir Nov 1, 2024
ba9d30e
refactoring
antonbashir Nov 1, 2024
635d5bc
refactoring
antonbashir Nov 1, 2024
cbcfaa4
refactoring
antonbashir Nov 1, 2024
e45d45d
fixes
antonbashir Nov 1, 2024
93dc7d9
fixes
antonbashir Nov 2, 2024
d43414e
fixes
antonbashir Nov 2, 2024
fdcaffe
fixes
antonbashir Nov 2, 2024
45213a9
fixes
antonbashir Nov 2, 2024
d1e7a66
fixes
antonbashir Nov 2, 2024
82d0256
fixes
antonbashir Nov 5, 2024
c20e364
fixes
antonbashir Nov 5, 2024
a546cd0
tests
antonbashir Nov 5, 2024
7bf3d50
tests
antonbashir Nov 5, 2024
08d9d06
tests
antonbashir Nov 5, 2024
8011517
tests
antonbashir Nov 5, 2024
e1a94d1
fixes
antonbashir Nov 9, 2024
e2da7d6
fix highlights
antonbashir Nov 9, 2024
da65eb7
fix JumpToFrame
antonbashir Nov 9, 2024
5be633e
optimization
antonbashir Nov 10, 2024
06ae05a
tests
antonbashir Nov 10, 2024
2d93e87
tests
antonbashir Nov 10, 2024
a50af07
tests
antonbashir Nov 10, 2024
fa175b6
tests
antonbashir Nov 10, 2024
4fe0a93
refactoring
antonbashir Nov 10, 2024
846f368
optimization
antonbashir Nov 10, 2024
42f8e45
tests
antonbashir Nov 10, 2024
aeb1a7d
tests
antonbashir Nov 11, 2024
df648e7
tests
antonbashir Nov 11, 2024
a42ab78
tests
antonbashir Nov 11, 2024
7802121
tests
antonbashir Nov 11, 2024
981b5a7
fixes
antonbashir Nov 16, 2024
2a14664
more tests
antonbashir Nov 16, 2024
817dc26
fixes
antonbashir Nov 17, 2024
a8895be
...
antonbashir Nov 17, 2024
d806d97
fix coros
antonbashir Nov 18, 2024
555efb2
fixes
antonbashir Nov 18, 2024
63dd258
fixes...
antonbashir Nov 19, 2024
98ab2c5
fixes
antonbashir Nov 19, 2024
212fc69
fixes
antonbashir Nov 19, 2024
7a95c54
fixes
antonbashir Nov 19, 2024
2f1a71e
fixes
antonbashir Nov 19, 2024
95c359c
fixes
antonbashir Nov 19, 2024
60e9dd5
fixes
antonbashir Nov 19, 2024
17b8e0a
fixes
antonbashir Nov 19, 2024
5066dc7
fibers
antonbashir Nov 19, 2024
56eb5e5
refactoring
antonbashir Nov 20, 2024
93d764a
fixes
antonbashir Nov 20, 2024
b3fe48d
fixes
antonbashir Nov 20, 2024
9625322
fixes
antonbashir Nov 20, 2024
46436fa
fixes
antonbashir Nov 20, 2024
82a0b53
fixes
antonbashir Nov 20, 2024
f9eff94
fixes
antonbashir Nov 20, 2024
7f155f9
fixes
antonbashir Nov 20, 2024
aaaa04e
fixes
antonbashir Nov 20, 2024
1b69fa8
fixes
antonbashir Nov 20, 2024
443e3ad
fixes
antonbashir Nov 20, 2024
f40264b
fixes
antonbashir Nov 20, 2024
72bd2b9
fixes
antonbashir Nov 21, 2024
91a8a3b
fixes\
antonbashir Nov 21, 2024
8d9e6ff
fixes
antonbashir Nov 21, 2024
eb43bf4
fixes
antonbashir Nov 21, 2024
268daed
fixes
antonbashir Nov 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ AllowShortIfStatementsOnASingleLine: 'true'

# Put escaped newlines into the rightmost column.
AlignEscapedNewlinesLeft: false

ColumnLimit: 0
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,9 @@ logs/logs.json
logs/results.json
.dart_tool/bisect_dart/
doc/api/

build/
*.exe
*.aot
*.S
*.s
5 changes: 5 additions & 0 deletions build-fiber-stress.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

set -e

dart compile aot-snapshot --enable-asserts runtime/tests/vm/dart/fiber/fiber_stress.dart
5 changes: 5 additions & 0 deletions build-fiber-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

set -e

dart compile aot-snapshot --enable-asserts runtime/tests/vm/dart/fiber/fiber_test.dart
3 changes: 3 additions & 0 deletions build-sdk-debug.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
export CPATH=""
./tools/build.py -m debug -a x64 runtime dart_precompiled_runtime ddc dartanalyzer analysis_server create_common_sdk create_platform_sdk
3 changes: 3 additions & 0 deletions build-sdk-product.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
export CPATH=""
./tools/build.py -m product -a x64 runtime dart_precompiled_runtime ddc dartanalyzer analysis_server create_common_sdk create_platform_sdk
3 changes: 3 additions & 0 deletions build-sdk-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
export CPATH=""
./tools/build.py -m release -a x64 runtime dart_precompiled_runtime ddc dartanalyzer analysis_server create_common_sdk create_platform_sdk
401 changes: 133 additions & 268 deletions pkg/analysis_server/lib/src/computer/computer_highlights.dart

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions pkg/analysis_server/lib/src/lsp/semantic_tokens/mapping.dart
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,13 @@ final highlightRegionTokenTypes = {
HighlightRegionType.IMPORT_PREFIX: SemanticTokenTypes.variable,
HighlightRegionType.INSTANCE_FIELD_DECLARATION: SemanticTokenTypes.property,
HighlightRegionType.INSTANCE_FIELD_REFERENCE: SemanticTokenTypes.property,
HighlightRegionType.INSTANCE_GETTER_DECLARATION: SemanticTokenTypes.property,
HighlightRegionType.INSTANCE_GETTER_REFERENCE: SemanticTokenTypes.property,
HighlightRegionType.INSTANCE_GETTER_DECLARATION: SemanticTokenTypes.function,
HighlightRegionType.INSTANCE_GETTER_REFERENCE: SemanticTokenTypes.function,
HighlightRegionType.INSTANCE_METHOD_DECLARATION: SemanticTokenTypes.method,
HighlightRegionType.INSTANCE_METHOD_REFERENCE: SemanticTokenTypes.method,
HighlightRegionType.INSTANCE_METHOD_TEAR_OFF: SemanticTokenTypes.method,
HighlightRegionType.INSTANCE_SETTER_DECLARATION: SemanticTokenTypes.property,
HighlightRegionType.INSTANCE_SETTER_REFERENCE: SemanticTokenTypes.property,
HighlightRegionType.INSTANCE_SETTER_DECLARATION: SemanticTokenTypes.function,
HighlightRegionType.INSTANCE_SETTER_REFERENCE: SemanticTokenTypes.function,
HighlightRegionType.KEYWORD: SemanticTokenTypes.keyword,
HighlightRegionType.LIBRARY_NAME: SemanticTokenTypes.namespace,
HighlightRegionType.LITERAL_BOOLEAN: CustomSemanticTokenTypes.boolean,
Expand All @@ -152,21 +152,21 @@ final highlightRegionTokenTypes = {
HighlightRegionType.PARAMETER_DECLARATION: SemanticTokenTypes.parameter,
HighlightRegionType.PARAMETER_REFERENCE: SemanticTokenTypes.parameter,
HighlightRegionType.STATIC_FIELD_DECLARATION: SemanticTokenTypes.property,
HighlightRegionType.STATIC_GETTER_DECLARATION: SemanticTokenTypes.property,
HighlightRegionType.STATIC_GETTER_REFERENCE: SemanticTokenTypes.property,
HighlightRegionType.STATIC_GETTER_DECLARATION: SemanticTokenTypes.function,
HighlightRegionType.STATIC_GETTER_REFERENCE: SemanticTokenTypes.function,
HighlightRegionType.STATIC_METHOD_DECLARATION: SemanticTokenTypes.method,
HighlightRegionType.STATIC_METHOD_REFERENCE: SemanticTokenTypes.method,
HighlightRegionType.STATIC_METHOD_TEAR_OFF: SemanticTokenTypes.method,
HighlightRegionType.STATIC_SETTER_DECLARATION: SemanticTokenTypes.property,
HighlightRegionType.STATIC_SETTER_REFERENCE: SemanticTokenTypes.property,
HighlightRegionType.STATIC_SETTER_DECLARATION: SemanticTokenTypes.function,
HighlightRegionType.STATIC_SETTER_REFERENCE: SemanticTokenTypes.function,
HighlightRegionType.TOP_LEVEL_FUNCTION_DECLARATION:
SemanticTokenTypes.function,
HighlightRegionType.TOP_LEVEL_FUNCTION_REFERENCE: SemanticTokenTypes.function,
HighlightRegionType.TOP_LEVEL_FUNCTION_TEAR_OFF: SemanticTokenTypes.function,
HighlightRegionType.TOP_LEVEL_GETTER_DECLARATION: SemanticTokenTypes.property,
HighlightRegionType.TOP_LEVEL_GETTER_REFERENCE: SemanticTokenTypes.property,
HighlightRegionType.TOP_LEVEL_SETTER_DECLARATION: SemanticTokenTypes.property,
HighlightRegionType.TOP_LEVEL_SETTER_REFERENCE: SemanticTokenTypes.property,
HighlightRegionType.TOP_LEVEL_GETTER_DECLARATION: SemanticTokenTypes.function,
HighlightRegionType.TOP_LEVEL_GETTER_REFERENCE: SemanticTokenTypes.function,
HighlightRegionType.TOP_LEVEL_SETTER_DECLARATION: SemanticTokenTypes.function,
HighlightRegionType.TOP_LEVEL_SETTER_REFERENCE: SemanticTokenTypes.function,
HighlightRegionType.TOP_LEVEL_VARIABLE: SemanticTokenTypes.property,
HighlightRegionType.TOP_LEVEL_VARIABLE_DECLARATION:
SemanticTokenTypes.property,
Expand Down
1 change: 1 addition & 0 deletions pkg/analyzer_cli/tool/perf.dart
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ Set<Source?> scanReachableFiles(Uri entryUri) {
'dart:convert',
'dart:core',
'dart:developer',
'dart:fiber',
'dart:_internal',
'dart:isolate',
'dart:math',
Expand Down
2 changes: 2 additions & 0 deletions pkg/dev_compiler/lib/src/kernel/target.dart
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class DevCompilerTarget extends Target {
'dart:collection',
'dart:convert',
'dart:developer',
'dart:fiber',
'dart:io',
'dart:isolate',
'dart:js',
Expand All @@ -97,6 +98,7 @@ class DevCompilerTarget extends Target {
@override
List<String> get extraIndexedLibraries => const [
'dart:async',
'dart:fiber',
'dart:collection',
'dart:html',
'dart:indexed_db',
Expand Down
1 change: 1 addition & 0 deletions pkg/front_end/tool/fasta_perf.dart
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ Map<Uri, Uint8List> scanReachableFiles(Uri entryUri) {
Uri.parse('dart:async'),
Uri.parse('dart:collection'),
Uri.parse('dart:convert'),
Uri.parse('dart:fiber'),
Uri.parse('dart:core'),
Uri.parse('dart:developer'),
Uri.parse('dart:_internal'),
Expand Down
1 change: 1 addition & 0 deletions pkg/front_end/tool/perf.dart
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ Set<Source> scanReachableFiles(Uri entryUri) {
'dart:async',
'dart:collection',
'dart:convert',
'dart:fiber',
'dart:core',
'dart:developer',
'dart:_internal',
Expand Down
1 change: 1 addition & 0 deletions pkg/vm/lib/modular/target/dart_runner.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class DartRunnerTarget extends VmTarget {
'dart:async',
'dart:collection',
'dart:convert',
'dart:fiber',
'dart:developer',
'dart:ffi',
'dart:_internal',
Expand Down
1 change: 1 addition & 0 deletions pkg/vm/lib/modular/target/flutter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class FlutterTarget extends VmTarget {
'dart:async',
'dart:collection',
'dart:convert',
'dart:fiber',
'dart:developer',
'dart:ffi',
'dart:_internal',
Expand Down
1 change: 1 addition & 0 deletions pkg/vm/lib/modular/target/flutter_runner.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class FlutterRunnerTarget extends VmTarget {
'dart:async',
'dart:collection',
'dart:convert',
'dart:fiber',
'dart:developer',
'dart:ffi',
'dart:_internal',
Expand Down
1 change: 1 addition & 0 deletions pkg/vm/lib/modular/target/vm.dart
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ class VmTarget extends Target {
'dart:async',
'dart:collection',
'dart:convert',
'dart:fiber',
'dart:developer',
'dart:ffi',
'dart:_internal',
Expand Down
9 changes: 9 additions & 0 deletions runtime/bin/dartutils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,10 @@ Dart_Handle DartUtils::PrepareCLILibrary(Dart_Handle cli_lib) {
return Dart_Null();
}

Dart_Handle DartUtils::PrepareFiberLibrary(Dart_Handle fiber_lib) {
return Dart_Null();
}

Dart_Handle DartUtils::SetupPackageConfig(const char* packages_config) {
Dart_Handle result = Dart_Null();

Expand All @@ -578,6 +582,10 @@ Dart_Handle DartUtils::PrepareForScriptLoading(bool is_service_isolate,
RETURN_IF_ERROR(url);
Dart_Handle async_lib = Dart_LookupLibrary(url);
RETURN_IF_ERROR(async_lib);
url = NewString(kFiberLibURL);
RETURN_IF_ERROR(url);
Dart_Handle fiber_lib = Dart_LookupLibrary(url);
RETURN_IF_ERROR(fiber_lib);
url = NewString(kIsolateLibURL);
RETURN_IF_ERROR(url);
Dart_Handle isolate_lib = Dart_LookupLibrary(url);
Expand Down Expand Up @@ -611,6 +619,7 @@ Dart_Handle DartUtils::PrepareForScriptLoading(bool is_service_isolate,
RETURN_IF_ERROR(PrepareIsolateLibrary(isolate_lib));
RETURN_IF_ERROR(PrepareIOLibrary(io_lib));
RETURN_IF_ERROR(PrepareCLILibrary(cli_lib));
RETURN_IF_ERROR(PrepareFiberLibrary(fiber_lib));
return result;
}

Expand Down
2 changes: 2 additions & 0 deletions runtime/bin/dartutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ class DartUtils {

static constexpr const char* kDartScheme = "dart:";
static constexpr const char* kAsyncLibURL = "dart:async";
static constexpr const char* kFiberLibURL = "dart:fiber";
static constexpr const char* kBuiltinLibURL = "dart:_builtin";
static constexpr const char* kCoreLibURL = "dart:core";
static constexpr const char* kInternalLibURL = "dart:_internal";
Expand Down Expand Up @@ -319,6 +320,7 @@ class DartUtils {
static Dart_Handle PrepareIOLibrary(Dart_Handle io_lib);
static Dart_Handle PrepareIsolateLibrary(Dart_Handle isolate_lib);
static Dart_Handle PrepareCLILibrary(Dart_Handle cli_lib);
static Dart_Handle PrepareFiberLibrary(Dart_Handle fiber_lib);

static dart::SimpleHashMap* environment_;

Expand Down
17 changes: 17 additions & 0 deletions runtime/lib/coroutine.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright (c) 2017, 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.

#include "vm/bootstrap_natives.h"

#include "vm/compiler/runtime_api.h"
#include "vm/native_entry.h"

namespace dart {
DEFINE_NATIVE_ENTRY(Coroutine_factory, 0, 3) {
GET_NON_NULL_NATIVE_ARGUMENT(Smi, size, arguments->NativeArgAt(1));
GET_NON_NULL_NATIVE_ARGUMENT(Closure, trampoline, arguments->NativeArgAt(2));
return Coroutine::New(size.Value(), trampoline.function());
}
} // namespace dart

1 change: 1 addition & 0 deletions runtime/lib/fiber_sources.gni
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fiber_runtime_cc_files = [ "coroutine.cc" ]
1 change: 1 addition & 0 deletions runtime/lib/isolate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@ class MessageValidator : private WorkSet {
MESSAGE_SNAPSHOT_ILLEGAL(ReceivePort)
MESSAGE_SNAPSHOT_ILLEGAL(UserTag)
MESSAGE_SNAPSHOT_ILLEGAL(SuspendState)
MESSAGE_SNAPSHOT_ILLEGAL(Coroutine)
default:
klass = class_table_->At(cid);
if (klass.is_isolate_unsendable()) {
Expand Down
2 changes: 1 addition & 1 deletion runtime/platform/globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <functional>
#include <sys/types.h>

#include <cassert> // For assert() in constant expressions.

#if defined(_WIN32)
Expand Down
38 changes: 38 additions & 0 deletions runtime/tests/vm/dart/fiber/fiber_benchmark.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import 'dart:fiber';

var iterations = 50000;
var fibers = 100;

var latency = 0.0;

void main() {
Fiber.launch(benchmark);
}

void benchmark() {
final jobs = <Fiber>[];
for (var i = 0; i < fibers; i++) {
Fiber.schedule(Fiber.current);
jobs.add(Fiber.spawn(scheduling));
}
for (var i = 0; i < fibers; i++) {
Fiber.schedule(jobs[i]);
}
for (var i = 0; i < fibers; i++) {
while (!jobs[i].state.disposed) {
Fiber.reschedule();
}
}
print("Latency per switch: ${latency / (fibers * iterations * 2)} [micros]");
}

void scheduling() {
Fiber.suspend();
final sw = Stopwatch();
sw.start();
for (var i = 0; i < iterations; i++) {
Fiber.reschedule();
}
sw.stop();
latency += sw.elapsedMicroseconds;
}
86 changes: 86 additions & 0 deletions runtime/tests/vm/dart/fiber/fiber_captures_suite.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import 'dart:fiber';
import 'dart:async';
import 'package:expect/expect.dart';

final tests = [
testGlobalState,
testClosureState,
];

var globalStateValue = "";
void testGlobalState() {
void child() {
globalStateValue += "child -> ";
Fiber.reschedule();
globalStateValue += "child";
}

void main() {
globalStateValue = "";
globalStateValue += "main -> ";
Fiber.schedule(Fiber.current);
Fiber.spawn(child);
globalStateValue += "main -> ";
Fiber.reschedule();
Expect.equals("main -> child -> main -> child", globalStateValue);
}

Fiber.launch(main);
}

void testClosureState() {
var localState = "localState";
Fiber.launch(
() {
Expect.equals("localState", localState);
localState = "after fiber";
},
);
Expect.equals("after fiber", localState);

localState = "localState";
Fiber.launch(
() {
Expect.equals("localState", localState);
localState = "after main fiber";
Fiber.schedule(Fiber.current);
Fiber.spawn(
() {
Expect.equals("after main fiber", localState);
localState = "after child fiber";
Fiber.reschedule();
Expect.equals("after child fiber after main fiber", localState);
localState = "finish";
},
name: "child",
);
Expect.equals("after child fiber", localState);
localState = "after child fiber after main fiber";
Fiber.suspend();
},
);
Expect.equals("finish", localState);

localState = "level 1";
Fiber.launch(
() {
Expect.equals("level 1", localState);
localState = "level 2";
Fiber.spawn(
() {
Expect.equals("level 2", localState);
localState = "level 3";
Fiber.spawn(
() {
Expect.equals("level 3", localState);
localState = "level 4";
},
name: "child",
);
},
name: "child",
);
},
);
Expect.equals("level 4", localState);
}
Loading
Loading