[m-rev.] for review: comment out castclass System.Type[]
Peter Ross
peter.ross at miscrit.be
Mon Dec 17 22:07:08 AEDT 2001
On Sun, Dec 16, 2001 at 05:32:35PM +1100, Fergus Henderson wrote:
> On 14-Dec-2001, Peter Ross <peter.ross at miscrit.be> wrote:
> > Peter wrote:
> > > ===================================================================
> > >
> > >
> > > Estimated hours taken: 8
> > > Branches: main
> > >
> > > System.Reflection.Assembly.GetExportedTypes returns an array of
> > > System.Type however in Beta 2 of the CLR, when you try and do a
> > > castclass to System.Type[] it fails. The fix is not to do the
> > > castclass.
> > >
> > > compiler/ilasm.m:
> > > Disable castclasses where the type is System.Type[], by commenting
> > > the line out.
> > >
> >
> > I have submitted this change, because on further investigation it appears to
> > be a bug.
>
> What do you mean by "submitted"?
> Do you mean "committed"?
>
Yes, I meant committed.
> And when you say "it appears to be a bug", do you mean that it appears
> to be a bug in the CLR, or a bug in the Mercury compiler?
>
A bug in the CLR.
I tried the following
// Create an array of System.Type
ldc.i4.1
newarr class [mscorlib]System.Type
// Cast it to an object
castclass object
// Cast it back to the array
castclass class [mscorlib]System.Type[]
This ran correctly, but the following code doesn't
// Get an array of System.Type which are exported from an Assembly.
callvirt class [mscorlib]System.Type[]
[mscorlib]System.Reflection.Assembly::GetExportedTypes()
// Do a redundant castclass to System.Type[]
castclass class [mscorlib]System.Type[]
Why does the first work and the second not? I believe it is because
there is a bug in the CLR, where GetExportedTypes is returning the wrong
type information.
I believe that the System.Reflection stuff is implemented as unsafe code
so it would make sense that someone constructed the wrong type info
somewhere.
> I think it is a bug in the Mercury compiler,
> because `castclass' should not be used with array types,
> but I think your change does not properly fix the bug.
>
What is the best way to get a definite answer on this? Who should we
mail?
Pete
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list