6c5d1fba95
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 Review-Url: https://codereview.chromium.org/2998803002 .