Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Issue 2998803002: [kernel] Support for top-level generic functions. (Closed)

Created:
3 years, 4 months ago by sjindel
Modified:
3 years, 4 months ago
CC:
reviews_dartlang.org, vm-dev_dartlang.org
Target Ref:
refs/heads/master
Visibility:
Public.

Description

[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

Patch Set 1 #

Patch Set 2 : Cleanup #

Patch Set 3 : Fix test. #

Total comments: 27

Patch Set 4 : Review comments. #

Total comments: 2

Patch Set 5 : Review comments. #

Total comments: 4

Patch Set 6 : Review comments. #

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

Messages

Total messages: 11 (2 generated)
sjindel
3 years, 4 months ago (2017-08-10 18:18:06 UTC) #2
regis
I will let people more familiar with kernel code give you approval. The runtime/vm files ...
3 years, 4 months ago (2017-08-10 23:16:56 UTC) #3
jensj
lgtm with comments, but to be honest I don't know a lot about the closure ...
3 years, 4 months ago (2017-08-11 06:24:55 UTC) #4
sjindel
https://codereview.chromium.org/2998803002/diff/40001/pkg/kernel/lib/transformations/closure/converter.dart File pkg/kernel/lib/transformations/closure/converter.dart (right): https://codereview.chromium.org/2998803002/diff/40001/pkg/kernel/lib/transformations/closure/converter.dart#newcode451 pkg/kernel/lib/transformations/closure/converter.dart:451: if (capturedTypeVariables[function] != null && accessContext is NullLiteral) On ...
3 years, 4 months ago (2017-08-11 09:21:07 UTC) #5
jensj
https://codereview.chromium.org/2998803002/diff/40001/runtime/vm/kernel_binary_flowgraph.cc File runtime/vm/kernel_binary_flowgraph.cc (right): https://codereview.chromium.org/2998803002/diff/40001/runtime/vm/kernel_binary_flowgraph.cc#newcode1097 runtime/vm/kernel_binary_flowgraph.cc:1097: // KERNEL_GENERIC_METHODS_UNDONE(sjindel): On 2017/08/11 09:21:06, sjindel wrote: > On ...
3 years, 4 months ago (2017-08-14 06:47:13 UTC) #6
sjindel
https://codereview.chromium.org/2998803002/diff/40001/runtime/vm/kernel_binary_flowgraph.cc File runtime/vm/kernel_binary_flowgraph.cc (right): https://codereview.chromium.org/2998803002/diff/40001/runtime/vm/kernel_binary_flowgraph.cc#newcode1097 runtime/vm/kernel_binary_flowgraph.cc:1097: // KERNEL_GENERIC_METHODS_UNDONE(sjindel): On 2017/08/14 06:47:12, jensj wrote: > On ...
3 years, 4 months ago (2017-08-14 11:05:50 UTC) #7
Dmitry Stefantsov
LGTM if you respond to the comments. https://codereview.chromium.org/2998803002/diff/80001/pkg/kernel/testcases/closures/captured_class_type_vars.dart File pkg/kernel/testcases/closures/captured_class_type_vars.dart (right): https://codereview.chromium.org/2998803002/diff/80001/pkg/kernel/testcases/closures/captured_class_type_vars.dart#newcode1 pkg/kernel/testcases/closures/captured_class_type_vars.dart:1: // Copyright ...
3 years, 4 months ago (2017-08-16 11:44:39 UTC) #8
sjindel
https://codereview.chromium.org/2998803002/diff/80001/pkg/kernel/testcases/closures/captured_class_type_vars.dart File pkg/kernel/testcases/closures/captured_class_type_vars.dart (right): https://codereview.chromium.org/2998803002/diff/80001/pkg/kernel/testcases/closures/captured_class_type_vars.dart#newcode1 pkg/kernel/testcases/closures/captured_class_type_vars.dart:1: // Copyright (c) 2016, the Dart project authors. Please ...
3 years, 4 months ago (2017-08-16 12:57:12 UTC) #9
sjindel
3 years, 4 months ago (2017-08-16 13:24:32 UTC) #11
Message was sent while issue was closed.
Committed patchset #6 (id:100001) manually as
6c5d1fba95de0e903eccbf6230f7f637f93eaf51 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698