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: [EMAIL PROTECTED]
ReportedBy: [EMAIL PROTECTED]
QAContact: [email protected]
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.
_______________________________________________
mono-bugs maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs