[interp] Defer local offset allocation to compacted emit phase (#16714)
commitb9dbd2ff91c1ae9dbd5e1651cb239ca741406a43
authorVlad Brezae <brezaevlad@gmail.com>
Mon, 9 Sep 2019 14:10:50 +0000 (9 17:10 +0300)
committerGitHub <noreply@github.com>
Mon, 9 Sep 2019 14:10:50 +0000 (9 17:10 +0300)
treed0d4c3dc781a52e650ae1be490ebb6dc47d85f90
parent320f91129dbc839ccd19154ea687945aa0ce2a77
[interp] Defer local offset allocation to compacted emit phase (#16714)

Before this commit, the only information associated with a local was just the offset at which it resides and instructions had this offset embedded from the start. This makes it awkward to have data structures indexed on the local, or have additional information per local, which we might care at some point (for example if it is multi basic block local, if the address of the local was taken etc). In addition to this, if we will want to remove some instructions that make some locals dead, it means that we will have to compact the whole locals space and update all the offsets referenced by all instructions. We solve all these problems by resolving (and allocating) the local offset at the latest time, while emitting the instruction in the compacted byte stream. At this point dead locals will remain dead, with no additional work needed to handle them.

For now, IL locals of the current method that we are compiling are immortal. We can address that later if needed.
mono/mini/interp/mintops.h
mono/mini/interp/transform.c