[Mono-dev] field pointer and garbage collection
fabian.nagel at gmail.com
Wed Jun 11 10:08:34 UTC 2014
I would appreciate if someone could make sense out of the following:
When a field of an object is accessed in C#, the IL code is LDFLD.
Intuitively, I would assume that the JIT compiler would transform LDFLD into
the assembler version of the following C code:
int A = *(int*)(ptr + 24); // ptr is pointer to object, accessed field is
int and 24 is offset of field in object
Now assuming this was true, at some point (ptr + 24) would reside in a CPU
register, if execution is intercepted by garbage collection and the object
moved somewhere, this pointer would have to be updated as well, which sounds
impossible as the forward pointer is installed at the beginning of the
object and the pointer points to somewhere inside the object.
What part of my assumption is wrong? How is this solved?
View this message in context: http://mono.1490590.n4.nabble.com/field-pointer-and-garbage-collection-tp4663040.html
Sent from the Mono - Dev mailing list archive at Nabble.com.
More information about the Mono-devel-list