[Mono-list] Jit Method Compilation

Paolo Molaro lupus@ximian.com
Thu, 8 Jan 2004 18:37:46 +0100


On 01/08/04 Marco Dubacher wrote:
> At the point of mono_jit_runtime_invoke the IL-method hasn't been compiled
> yet? Through some further calls the function mini_method_compile is called
> in which with the functions mono_method_to_ir, decompose_pass (and others)
> transform the IL-code stepwise into native code. Finally the method
> mono_codegen is executed. Up to now no IL-code has been actually executed, I
> think? Sorry if I should be completely wrong ...
> 
> My question is: We have now some native code in the cfg-structure. This code
> must be copied into an executable memory area and finally has somehow be
> executed. Where and how is this step done?

mono_jit_compile_method() returns a pointer to the native code and that
is cast to a function pointer and invoked directly.

        MonoObject *(*runtime_invoke) (MonoObject *this, void **params, MonoObject **exc);
	[...]
	runtime_invoke = mono_jit_compile_method (invoke);
	return runtime_invoke (obj, params, exc);

lupus

-- 
-----------------------------------------------------------------
lupus@debian.org                                     debian/rules
lupus@ximian.com                             Monkeys do it better