[interp] Improve boxing/unboxing (#14048)
commit183de1c3022f5b6f409349c05a1b405f9c79c2bf
authorVlad Brezae <brezaevlad@gmail.com>
Wed, 17 Apr 2019 18:38:19 +0000 (17 21:38 +0300)
committerGitHub <noreply@github.com>
Wed, 17 Apr 2019 18:38:19 +0000 (17 21:38 +0300)
tree7f6bfffcfff5a79b3babec7df43d447b67d67e71
parentafcd30d8c28f5eaa00f6e5ef46f0b1ae1fbc87b6
[interp] Improve boxing/unboxing (#14048)

* [interp] Remove redundant check

It can't be an enum if it is stored on the vtstack

* [interp] Optimize boxing

Makes boxing of primitives 4x faster and boxing of vt 3x faster.

* [interp] Remove unneccessary check in unbox

We do the same check as jit. Makes unboxing 10x faster.

* [interp] Extract some duplicate code for boxing

* [interp] Fix boxing of nullable with constrained calls

Before the box opcode optimization, it was handling nullable. When normally boxing a nullable we call the Box method, but this is awkward when doing a constrained call, so we just add a separate opcode. This is slightly slower than calling Box, but much faster than the old code using the generic mono_value_box_checked.
mono/mini/interp/interp.c
mono/mini/interp/mintops.def
mono/mini/interp/transform.c