[interp] Error handling refactor (optimize non-exception path) (helps clang save...
authorJay Krell <jaykrell@microsoft.com>
Tue, 27 Aug 2019 13:31:10 +0000 (06:31 -0700)
committerAlexander Köplinger <alex.koeplinger@outlook.com>
Tue, 27 Aug 2019 13:31:10 +0000 (15:31 +0200)
commit7fa08f2073d1952be98eaf6556f25128fde057cd
treeded04c4802cb94822e3d513f0d814065929092a2
parente351423f7850f382048e408ba81d58c901e9c6df
[interp] Error handling refactor (optimize non-exception path) (helps clang save stack) (mono/mono#16371)

While working on stack reduction, I believe I found that
the compiler could not tell how THROW_EX and/or NULL_CHECK terminate.

That is, essentially, the success paths preserve volatile registers.
They do not have to be spilled/filled.
This tweak should make it clearer to the compiler, optimized common paths, and not slow down uncommon paths.

This also cleans it up a little and reduces macro expansion, and then possibly should allow for reinlining what is now used only once.

Also add some const so it can be casted away less.

Believed to save 32 bytes of stack with Linux/amd64/clang, nothing for gcc.
And a nice cleanup.

Commit migrated from https://github.com/mono/mono/commit/00c1ec421a3d47931bd9ad719faec62e60277837
src/mono/mono/mini/interp/interp-internals.h
src/mono/mono/mini/interp/interp.c