[interp] Defer local offset allocation to compacted emit phase (mono/mono#16714)
authorVlad Brezae <brezaevlad@gmail.com>
Mon, 9 Sep 2019 14:10:50 +0000 (17:10 +0300)
committerGitHub <noreply@github.com>
Mon, 9 Sep 2019 14:10:50 +0000 (17:10 +0300)
commit87ed9757bbaa87c508dc701de3f99609de7b462d
tree3930865e13899bc54b9db1284939e00e1caf9c36
parentc653a9d4c6762ae21719c30d5492fcb5dd9ac2cc
[interp] Defer local offset allocation to compacted emit phase (mono/mono#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.

Commit migrated from https://github.com/mono/mono/commit/b9dbd2ff91c1ae9dbd5e1651cb239ca741406a43
src/mono/mono/mini/interp/mintops.h
src/mono/mono/mini/interp/transform.c