[Mono-dev] Big Arrays, Many Changes --- Request for Advice

Jeroen Frijters jeroen at sumatra.nl
Wed Sep 5 01:12:03 EDT 2007


Luis F. Ortiz wrote:
> On Sep 4, 2007, at 6:51 AM, Marek Safar wrote:
> > Hi Luis,
> >> 1)  MCS assumed that the arguments to NEWARR were always U4 or I4,
> >> which does not seem
> >>      to be the case as far as ECMA-335v4.
> >> ...
> >> A)  Fix mcs/expression.cs to emit OpCodes.Conv_Ovf_U/I instead of
> >> OpCodes.Conv_Ovf_U4/I4
> >>      for array size arguments,
> > Any mcs patches with self contained tests are welcome. However, I
> > think I fix this issue 2-3 weeks ago. Please use SVN version instead.
>
> I see you did do serious surgery to the code in question in revision
> 84357.
> I have a question: ¿How literally should ECMA-335 be taken?
> If one were to take section 4.20 (newarr - create a zero-based, one-
> dimensional array)
> literally:
>
>      Valid array indexes are 0 <= index < numElems. ...
>      Verifiability:  .numElems shall be of type native int or int32.
>
> then I would be inclined to say some work might still be necessary.
> The implication would be that unsigned arguments are not proper and
> that a 32 bit implementation should be limited to 2^32 - 1 elements.

No. The verifier doesn't care about signed vs. unsigned. So the above quote really means "native [u]int or [u]int32". For details see the section "Verification Types" in the ECMA CLI spec.

Regards,
Jeroen




More information about the Mono-devel-list mailing list