Code manager

mono_code_manager_commit
void mono_code_manager_commit (MonoCodeManager *cman, void *data, int size, int newsize)

Parameters

cman:
a code manager
data:
the pointer returned by mono_code_manager_reserve ()
size:
the size requested in the call to mono_code_manager_reserve ()
newsize:
the new size to reserve
Remarks

If we reserved too much room for a method and we didn't allocate already from the code manager, we can get back the excess allocation for later use in the code manager.

mono_code_manager_destroy
void mono_code_manager_destroy (MonoCodeManager *cman)

Parameters

cman:
a code manager
Remarks

Free all the memory associated with the code manager cman.

mono_code_manager_foreach
void mono_code_manager_foreach (MonoCodeManager *cman, MonoCodeManagerFunc func, void *user_data)

Parameters

cman:
a code manager
func:
a callback function pointer
user_data:
additional data to pass to func
Remarks

Invokes the callback func for each different chunk of memory allocated in the code manager cman.

mono_code_manager_invalidate
void mono_code_manager_invalidate (MonoCodeManager *cman)

Parameters

cman:
a code manager
Remarks

Fill all the memory with an invalid native code value so that any attempt to execute code allocated in the code manager cman will fail. This is used for debugging purposes.

mono_code_manager_new_dynamic
MonoCodeManager* mono_code_manager_new_dynamic (void)

Returns

the new code manager
Remarks

Creates a new code manager suitable for holding native code that can be used for single or small methods that need to be deallocated independently of other native code.

mono_code_manager_new
MonoCodeManager* mono_code_manager_new (void)

Returns

the new code manager
Remarks

Creates a new code manager. A code manager can be used to allocate memory suitable for storing native code that can be later executed. A code manager allocates memory from the operating system in large chunks (typically 64KB in size) so that many methods can be allocated inside them close together, improving cache locality.

mono_code_manager_reserve
void* mono_code_manager_reserve (MonoCodeManager *cman, int size)

Parameters

cman:
a code manager
size:
size of memory to allocate
Returns
the pointer to the allocated memory or NULL on failure
Remarks

Allocates at least size bytes of memory inside the code manager cman.

Registration services

The core services of Mono are independent of the execution system. The interpreter and the native code generator both use the functions in the following section to register handlers to execute code with the execution system.

These APIs would allow a different execution engine (code generator or interpreter) to be hooked to the rest of the Mono VM.

mono_install_assembly_load_hook
Prototype: mono_install_assembly_load_hook

mono_install_assembly_preload_hook
Prototype: mono_install_assembly_preload_hook

mono_install_assembly_search_hook
Prototype: mono_install_assembly_search_hook

mono_install_compile_method
void mono_install_compile_method (MonoCompileFunc func)

Parameters

func:
function to install
Remarks

This is a VM internal routine

mono_install_free_method
void mono_install_free_method (MonoFreeMethodFunc func)

Parameters

func:
pointer to the MonoFreeMethodFunc used to release a method
Remarks

This is an internal VM routine, it is used for the engines to register a handler to release the resources associated with a method. Methods are freed when no more references to the delegate that holds them are left.

mono_install_handler
void mono_install_handler (MonoExceptionFunc func)

Parameters

func:
exception handler
Remarks

This is an internal JIT routine used to install the handler for exceptions being throwh.

mono_install_lookup_dynamic_token
Prototype: mono_install_lookup_dynamic_token

mono_install_remoting_trampoline
Prototype: mono_install_remoting_trampoline

mono_install_runtime_invoke
void mono_install_runtime_invoke (MonoInvokeFunc func)

Parameters

func:
Function to install
Remarks

This is a VM internal routine

mono_install_stack_walk
Prototype: mono_install_stack_walk

mono_install_thread_callbacks
Prototype: mono_install_thread_callbacks

mono_install_trampoline
Prototype: mono_install_trampoline

mono_install_runtime_cleanup
Prototype: mono_install_runtime_cleanup

mono_install_assembly_postload_refonly_search_hook
Prototype: mono_install_assembly_postload_refonly_search_hook

mono_install_assembly_postload_search_hook
Prototype: mono_install_assembly_postload_search_hook

mono_install_assembly_refonly_preload_hook
Prototype: mono_install_assembly_refonly_preload_hook

mono_install_assembly_refonly_search_hook
Prototype: mono_install_assembly_refonly_search_hook