|
[kernel] Support for top-level generic functions.
Summary:
Previously, there was no support for generic methods in kernel. This prevented
us from being able to pass captured type arguments to the target top-level
function in converted closures, so these type arguments were always instantiated
to 'dynamic'.
Now, we save the type arguments to the closure creation operation in the
context, and read them out and forward them appropriately in closure wrapper
function. Since fasta doesn't currently support generic methods (their type
parameters are replaced by 'dynamic'), only top-level generic functions can
surface in kernel, as they are generated by closure conversion of closures that
capture type parameters of a class.
My focus here is enabling closure conversion to work in only these cases, and as
such, the code has some temporary "hacks" in the VM that may not work for
generic member functions or generic closures when they are enabled in fasta.
Test Plan:
I ran all the tests in closures/, and those which were previously expected to
crash due to missing VM support now pass and produce correct results.
Further testing is paused until we understand why the recent commit "[kernel]
Insert kernel bodies into VM heap" has broken all these tests.
Reviewers: regis@google.com, jensj@google.com, dmitryas@google.com
BUG=
R=dmitryas@google.com, jensj@google.com
Committed: https://github.com/dart-lang/sdk/commit/6c5d1fba95de0e903eccbf6230f7f637f93eaf51
Total comments: 27
Total comments: 2
Total comments: 4
|
Unified diffs |
Side-by-side diffs |
Delta from patch set |
Stats (+235 lines, -136 lines) |
Patch |
|
M |
pkg/kernel/lib/transformations/closure/context.dart
|
View
|
|
4 chunks |
+24 lines, -19 lines |
0 comments
|
Download
|
|
M |
pkg/kernel/lib/transformations/closure/converter.dart
|
View
|
1
2
3
|
3 chunks |
+9 lines, -3 lines |
0 comments
|
Download
|
|
M |
pkg/kernel/lib/transformations/closure/rewriter.dart
|
View
|
1
2
3
|
2 chunks |
+6 lines, -5 lines |
0 comments
|
Download
|
|
M |
pkg/kernel/test/closures/closures.status
|
View
|
|
1 chunk |
+0 lines, -3 lines |
0 comments
|
Download
|
|
M |
pkg/kernel/test/closures/suite.dart
|
View
|
|
1 chunk |
+6 lines, -2 lines |
0 comments
|
Download
|
|
M |
pkg/kernel/test/closures_type_vars/closures_type_vars.status
|
View
|
|
1 chunk |
+0 lines, -2 lines |
0 comments
|
Download
|
|
M |
pkg/kernel/testcases/closures/capture_closure.dart.expect
|
View
|
|
2 chunks |
+3 lines, -3 lines |
0 comments
|
Download
|
|
M |
pkg/kernel/testcases/closures/capture_closure_parameter.dart.expect
|
View
|
|
1 chunk |
+4 lines, -4 lines |
0 comments
|
Download
|
|
M |
pkg/kernel/testcases/closures/capture_this.dart.expect
|
View
|
|
2 chunks |
+6 lines, -6 lines |
0 comments
|
Download
|
|
A |
pkg/kernel/testcases/closures/captured_class_type_vars.dart
|
View
|
1
2
3
4
5
|
1 chunk |
+16 lines, -0 lines |
0 comments
|
Download
|
|
A |
pkg/kernel/testcases/closures/captured_class_type_vars.dart.expect
|
View
|
1
2
|
1 chunk |
+21 lines, -0 lines |
0 comments
|
Download
|
|
M |
pkg/kernel/testcases/closures/catch.dart.expect
|
View
|
|
1 chunk |
+6 lines, -6 lines |
0 comments
|
Download
|
|
M |
pkg/kernel/testcases/closures/closure_in_constructor.dart.expect
|
View
|
|
2 chunks |
+5 lines, -5 lines |
0 comments
|
Download
|
|
M |
pkg/kernel/testcases/closures/closure_in_initializer.dart.expect
|
View
|
|
2 chunks |
+5 lines, -5 lines |
0 comments
|
Download
|
|
M |
pkg/kernel/testcases/closures/closure_in_initializer_closure.dart.expect
|
View
|
|
2 chunks |
+6 lines, -6 lines |
0 comments
|
Download
|
|
M |
pkg/kernel/testcases/closures/closures.dart.expect
|
View
|
|
1 chunk |
+3 lines, -3 lines |
0 comments
|
Download
|
|
M |
pkg/kernel/testcases/closures/field.dart.expect
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
pkg/kernel/testcases/closures/for_in_closure.dart.expect
|
View
|
|
2 chunks |
+3 lines, -3 lines |
0 comments
|
Download
|
|
M |
pkg/kernel/testcases/closures/for_loop.dart.expect
|
View
|
|
2 chunks |
+9 lines, -9 lines |
0 comments
|
Download
|
|
M |
pkg/kernel/testcases/closures/for_variable_capture_test.dart.expect
|
View
|
|
2 chunks |
+5 lines, -5 lines |
0 comments
|
Download
|
|
M |
pkg/kernel/testcases/closures/instance_tear_off.dart.expect
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
pkg/kernel/testcases/closures/named_closure.dart.expect
|
View
|
|
1 chunk |
+3 lines, -3 lines |
0 comments
|
Download
|
|
M |
pkg/kernel/testcases/closures/non_void_context.dart.expect
|
View
|
|
1 chunk |
+8 lines, -8 lines |
0 comments
|
Download
|
|
M |
pkg/kernel/testcases/closures/uncaptured_for_in_loop.dart.expect
|
View
|
|
2 chunks |
+3 lines, -3 lines |
0 comments
|
Download
|
|
M |
pkg/kernel/testcases/closures_type_vars/type_variables.dart.expect
|
View
|
|
2 chunks |
+6 lines, -6 lines |
0 comments
|
Download
|
|
M |
runtime/vm/kernel_binary_flowgraph.h
|
View
|
1
2
3
4
5
|
1 chunk |
+2 lines, -1 line |
0 comments
|
Download
|
|
M |
runtime/vm/kernel_binary_flowgraph.cc
|
View
|
1
2
3
4
5
|
8 chunks |
+62 lines, -18 lines |
0 comments
|
Download
|
|
M |
runtime/vm/kernel_to_il.h
|
View
|
1
2
3
4
|
1 chunk |
+2 lines, -1 line |
0 comments
|
Download
|
|
M |
runtime/vm/kernel_to_il.cc
|
View
|
1
2
3
4
5
|
2 chunks |
+10 lines, -5 lines |
0 comments
|
Download
|
Total messages: 11 (2 generated)
|