[Mono-devel-list] fixed statement

Bernie Solomon bernard at ugsolutions.com
Wed Mar 17 16:58:05 EST 2004


This should be a property of the local variable - it should be
flagged as pinned but mcs doesn't appear to do this.

However since mono doesn't currently using a compacting
garbage collector it doesn't matter if compiling and running
with mono alone as data won't move anyway.

Of course different runtimes do compact and mcs compiled
code could then fail so mcs does need to be fixed ;-) too.

Bernie Solomon

----- Original Message ----- 
From: "Eric Durand Tremblay" <eric.durand-tremblay.1 at ulaval.ca>
To: "Mono Development" <mono-devel-list at lists.ximian.com>
Sent: Wednesday, March 17, 2004 1:42 PM
Subject: [Mono-devel-list] fixed statement


> 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_OffsetToStr
ingData'()
>         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
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>




More information about the Mono-devel-list mailing list