Files
kotlin-fork/core/deserialization.common.jvm
Kristoffer Andersen 247cbffbac [EE-IR] Fragment Compiler Entrypoint in IR Backend
This commit introduces a new entrypoint for the IR backend, and starts
the work of accomodating the evaluator in psi2ir.

The evaluator expects a certain class and method structure of the
compiled fragment, but PSI is only supplied for the actual fragment.

So, to that end, this commit introduces a new "front end" of psi2ir
that "synthesizes" the module, class and method structure around the
fragment before calling into the existing psi2ir pipeline to obtain
the IR for the fragment.

The primary complication so far is handling the captured variables of
the fragment: they are mapped to parameters of the method surrounding
the fragment, and passed as arguments on evaluation. Hence, the IR
translation of the fragment needs to remap captured variables to the
appropriate parameter, in essentially all places they can be referred
to in the fragment (and hence in psi2ir). This commit introduces a
decorated symbol table that intercepts symbol look-ups and remaps as
appropriate.

Other cases that dispatches based on descriptor (see
`CallGenerator.kt`) needs other metadata to generate correct code.

It also introduces a shim in DeserializedContainerSource in the psi2ir
pipeline to facilitate facade class generation for the code that is
being debugged (which are generated as "external ir declarations").

Finally, in passing we resolve a small leftover from previous
refactoring that left an asssertion re. allowing IR to _assign_ to
parameters of methods.
2021-09-21 18:18:30 +02:00
..