[interp] Fix GetFunctionPointer (mono/mono#13708)
authorVlad Brezae <brezaevlad@gmail.com>
Thu, 4 Apr 2019 20:19:50 +0000 (23:19 +0300)
committerBernhard Urban <bernhard.urban@xamarin.com>
Thu, 4 Apr 2019 20:19:50 +0000 (22:19 +0200)
commit324d4f94b953baec627a6cf0697a1faf8bd616e0
tree32d070bc276a2c2136188f2eaf9f3d401cad2cb7
parentb15cc2a82f91f67316f8b839b0613247b80df486
[interp] Fix GetFunctionPointer (mono/mono#13708)

This method returns a function pointer that can be called with a calli instruction. On interpreter we use a pointer to InterpMethod while on jit we use the native code address. Normally, GetFunctionPointer should return the InterpMethod pointer if called from interp or the native code address if called from jit. Since we don't have any information about the execution engine of the caller, we solve this by intrinsifying all these calls, that happen in the interpreter.

Passing such function pointers between jitted and interp code is probably still unreliable.

Fixes https://github.com/mono/mono/issues/13654

Commit migrated from https://github.com/mono/mono/commit/474305cbce2eaba12186d61583ab358bc5957abe
src/mono/mono/mini/interp/interp.c
src/mono/mono/mini/interp/mintops.def
src/mono/mono/mini/interp/transform.c