[Mono-list] ikvm and Mono 0.20
Varga Zoltan
vargaz@freemail.hu
Wed, 26 Feb 2003 15:00:01 +0100 (CET)
Paolo Molaro <lupus@ximian.com> =EDrta:
> 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)
>=20
> This issue will get fixed in the new JIT: we should be
able to not inline=20
> a method if the act of inlining causes the a type
constructor to be run=20
> 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.
>=20
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.=20
The --noinline flag
is only needed because of a bug at x86.brg:1699: this code
pushes the=20
currently compiling method's image to the stack, instead of
the method=20
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 {
=09static public int i =3D 0;
}
class Bar {
=09static public int j;
=09static Bar () {
=09=09j =3D Foo.i;
=09}
}
class Bug {
=09static public void Main () {
=09=09Foo.i =3D 5;
=09=09Console.WriteLine (Bar.j);
=09}
}
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
It prints 5 under MS.NET and 0 under mono.
bye
Zoltan