Fix incorrect readbehind and try to make readahead clearer and easier. (#8691)
commit0e30bebf4c05fe8375e55e16e4b49be049cef98b
authorJay Krell <jay.krell@cornell.edu>
Tue, 15 May 2018 01:48:18 +0000 (14 18:48 -0700)
committerGitHub <noreply@github.com>
Tue, 15 May 2018 01:48:18 +0000 (14 18:48 -0700)
tree7b5bf6b171b35ff88d362bfe02158b3758556e9a
parentd32424632ceeff6a6c3413d3cb9a4f3ac5b6b2cb
Fix incorrect readbehind and try to make readahead clearer and easier. (#8691)

* Use MonoOpcodeEnum instead of int. Provide MonoOpcodeEnum_Invalid = -1.

* Fix and cleanup bounds checks.
Some were off by one, some could be clearer.
This pattern will go away anyway and is partly gone below.

* Prepare to fix incorrect read behind.

* Add test to hit assert in incorrect readbehind in ldvirtftn.

* Confuse the JIT (or runtime) into crashing.

* Fix parens.

* Move some macros from verify.c to verify-internals.h.

* Attempt to make IL readahead easier to understand, by having
less spread out instruction sizing and decoding.

This converts several readaheads but not all.

It is possible we should just convert to a large array of pointers,
and then do these optimizations.

This also fixes the incorrect readbehind.

* Disable new test. Fixing the readbehind fixes the assertion failure but still sigsegvs later in trampoline.

* More use of common code. More to do here.
mono/metadata/metadata.h
mono/metadata/mono-basic-block.c
mono/metadata/mono-basic-block.h
mono/metadata/opcodes.h
mono/metadata/verify-internals.h
mono/metadata/verify.c
mono/mini/method-to-ir.c
mono/tests/Makefile.am
mono/tests/incorrect-ldvirtftn-read-behind-for-dup.il [new file with mode: 0644]