[Mono-list] Reference runtime internal variable in managed code

Miguel de Icaza miguel@ximian.com
27 Aug 2003 18:05:01 -0400


Hello,

> I can certainly do the patching in "mono_method_to_ir()". But the problem is
> how I can enable such condition check from user code to internal data
> structure of the runtime. And do it quickly.

There are plenty of ways of doing this.

Look at how the marshal.c file generates on the flight IL code to do the
marshaling.  Accessing a runtime variable is simple: load the address of
the variable, and then do a dereference, something like:

	ldc.i PTR_TO_8BIT_BOOL
	ldind.u1
	ldc.i4.0
	be l1
...
	b l2
l1:
	...
l2:

Or you could generate the X86 code directly in the code emitter as well.

Miguel.