[Mono-devel-list] fixed statement

Eric Durand Tremblay eric.durand-tremblay.1 at ulaval.ca
Wed Mar 17 16:42:27 EST 2004


Can somebody tell me how mono handle fixed statement.

For something like this :

string bar = "something";

fixed ( char * foo = bar) {
    foo[0] = 'c';
}

MCS output :

        IL_0000:  ldstr "bar"
        IL_0005:  stloc.1
        IL_0006:  ldloc.1
        IL_0007:  stloc.2
        IL_0008:  ldloc.2
        IL_0009:  conv.i
        IL_000a:  call int32 class 
[mscorlib]'System.Runtime.CompilerServices.RuntimeHelpers'::'get_OffsetToStringData'()
        IL_000f:  add
        IL_0010:  stloc.0
        IL_0011:  ldloc.0
        IL_0012:  conv.i
        IL_0013:  ldc.i4.0
        IL_0014:  ldc.i4.2
        IL_0015:  mul
        IL_0016:  conv.i
        IL_0017:  add
        IL_0018:  ldc.i4.s 0x63
        IL_001a:  stind.i2
        IL_001b:  ldnull
        IL_001c:  stloc.2
        IL_001d:  ret

There is nothing in this that "lock" the garbage collector
(msdn define lock as: Prevents relocation of a variable by the garbage 
collector.)

Thanks

Eric Durand-Tremblay




More information about the Mono-devel-list mailing list