Am Samstag, 5. Mai 2007 10:00 schrieb chromatic:
> On Thursday 03 May 2007 18:04:48 chromatic wrote:
> > I'll debug the segfault and see if that reveals anything interesting.
> >
> > The shootout tests are dodgy anyway sometimes.
>
> In this case, sorting the vtable functions put the init vtable method
> pointer in the middle of the _vtable struct, not at the start. The i386
> and sun4 JIT operations looked for init as the first vtable method to use
> it as an offset into the struct. You can guess what happens when you not
> only get the wrong offset for the vtable method pointer you want but also
> dereference way past the end of the struct where you probably don't have a
> function pointer at all... KAPOW!
Indeed. I just wanted to post a mail re the problem. Good catch.
> Here's the fix (r18423), for fun:
>
> --- src/jit/sun4/jit_emit.h (revision 3381)
> +++ src/jit/sun4/jit_emit.h (local)
> @@ -849,7 +849,7 @@
> int idx, pi, i;
> size_t offset;
>
> - offset = offsetof(VTABLE, init);
> + offset = offsetof(VTABLE, absolute);
^^^^^^^^
This also looks a bit fragile, albeit 'absolute' has a good chance to sort
first alphabetically.
And from vtable.tbl:
# $Id: vtable.tbl 18274 2007-04-18 02:24:20Z chromatic $
# [MAIN] #default section name
# MMD_EQ ... MMD_STRCMP must be in one block
# see src/mmd.c
# INPLACE MMD variant must always be normal op + 1
void init()
# init must be first for JITed vtable meths
leo