[Mono-bugs] [Bug 372410] New: mini ignores the readonly prefix

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Mar 19 12:08:05 EDT 2008


https://bugzilla.novell.com/show_bug.cgi?id=372410


           Summary: mini ignores the readonly prefix
           Product: Mono: Runtime
           Version: unspecified
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: JIT
        AssignedTo: lupus at novell.com
        ReportedBy: rkumpera at novell.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


Generics code require the use of the readonly prefix for handling of generic
arrays.

In order to have a transparent call sequence for virtual methods over generic
types, generic code uses constrained. callvirt, which requires a managed
pointer for the 'this' arg. Something like the following:

Non generic code:

locals init (object v_0)
..
ldloc.0
callvirt instance int32 object::GetHashCode()


Generic code:

locals init (!0 v_0)

ldloca 0
constrained. !0
callvirt instance int32 object::GetHashCode()


The use of a managed pointer is an issue when dealing with array objects. For
instance, compiling "arr[0].GetHashCode()" requires getting a managed reference
for "arr[0]". This is done like the following:

Non generic code:

locals init (object[] v_0)
..
ldloc.0
ldc.i4.0 
ldelem.ref 
callvirt instance int32 object::GetHashCode()


Generic code:

locals init (!0[] v_0)
ldc.i4.0 
readonly. 
ldelema !0
constrained. !0
callvirt instance int32 object::GetHashCode()


Here ldelam requires the readonly prefix since if performs a typecheck against
the element type of the array. This won't work if using an array of a subtype
of !0.

The readonly prefix disables the runtime typecheck of ldelema and correctness
is  guaranteed by the verifier.

The readonly prefix applies to ldelema and calls to Array::Address. I'll post
patches to fix both situations.


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list