[interp] Add more super instructions and other small optimizations (#51273)
authorVlad Brezae <brezaevlad@gmail.com>
Fri, 16 Apr 2021 14:49:12 +0000 (17:49 +0300)
committerGitHub <noreply@github.com>
Fri, 16 Apr 2021 14:49:12 +0000 (17:49 +0300)
commit797b106be18c5f0a6d7d16ef563a5fe498e980a2
treef26556a2423fec4fe7a0316e8e3d4ac18e468b2d
parentbbe669c1ff1f0b8129838d76bdaedf8044c1a7f6
[interp] Add more super instructions and other small optimizations (#51273)

* [interp] Replace ldloca + initobj pair with initlocal

We do it in the cprop pass because ldloca removal can enable additional copy propagations.

* [interp] Replace ldloca + ldobj.vt with mov.vt

* [interp] Add superinstructions for multiplication with constant

* [interp] Remove redundant opcode

* [interp] Update indirects count if removing bblock with ldloca

If the var no longer has indirects, we might be able to do cprop through it

* [interp] Refactor ldind/stind opcodes

Remove some unnecessary opcodes. Always do a null check when dereferencing pointers with ldind. Having an unsafe version of this is really useless performance wise and can only be used in very few cases.

* [interp] Add super instructions for ldind/stind with offset

* [interp] Remove opcode for conversion from i8 to i4

It is redundant, we replace it with a MOV_8 which will end up being removed by the cprop pass.
src/mono/mono/mini/interp/interp.c
src/mono/mono/mini/interp/mintops.def
src/mono/mono/mini/interp/mintops.h
src/mono/mono/mini/interp/transform.c