Paolo Molaro <[EMAIL PROTECTED]> írta:

> On 02/25/03 Jeroen Frijters wrote:
> > * The --noinline and --share-code switches are still
required, because
> > otherwise Mono will run the .cctor methods to early
(and, by my reading,
> > the Mono behavior is not allowed by the ECMA spec)
> 
> This issue will get fixed in the new JIT: we should be
able to not inline 
> a method if the act of inlining causes the a type
constructor to be run 
> that wasn't run already. But I'll need to review the issue
with the
> spec. If you can provide a test case, that would be
appreciated.
> 

Hi,

The problem is with the if (!cfg->share_code) statements in
the JIT,
which create some vtables at JIT compile time, instead of
creating it
the first time a static variable/method is accessed. 
The --noinline flag
is only needed because of a bug at x86.brg:1699: this code
pushes the 
currently compiling method's image to the stack, instead of
the method 
to which the LDSTR belongs (the two are not necessarily
equal due to inlining).

BTW, here is a testcase for the type initialization problem:

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
using System;

class Foo {

        static public int i = 0;
}

class Bar {

        static public int j;

        static Bar () {
                j = Foo.i;
        }
}

class Bug {

        static public void Main () {
                Foo.i = 5;
                Console.WriteLine (Bar.j);
        }
}
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

It prints 5 under MS.NET and 0 under mono.

              bye

                 Zoltan




_______________________________________________
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list

Reply via email to