Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

AIX PPC JIT warning

39 views
Skip to first unread message

Jeff Clites

unread,
Oct 29, 2004, 4:05:18 AM10/29/04
to Perl 6 Internals
Recently config/gen/platform/darwin/asm.s was added, containing
Parrot_ppc_jit_restore_nonvolatile_registers(). Corresponding code also
needs to be added to config/gen/platform/aix/asm.s -- Parrot should
fail to link on AIX currently, without this. I didn't try to update the
AIX asm.s myself, since I wasn't confident that I could do this
correctly without having a way to test.

So, someone with AIX asm expertise, please take a look.

Thanks,

JEff

Adam Thomason

unread,
Oct 29, 2004, 6:03:40 PM10/29/04
to Jeff Clites, Perl 6 Internals

Worry not, it's already broken.  I've been unable to test the AIX/PPC
JIT since ICU went in.  The configuration for ICU (at least as of 2.6)
supports only a 64-bit build, while aix/asm.s is 32-bit only (the
linker claims the .o is corrupt if assembled with OBJECT_MODE=64).

To get it working again, one of three things needs to happen:

1. ICU becomes optional again (please!).
2. PPC64 JIT code is written which can be morphed into POWER code.
Transforming PPC32->POWER was mostly straightforward, so hopefully
64-bit will be as well.
3. ICU's configure starts to support 32-bit compiles.  This might
happen with 3.0/CVS already, but I haven't checked.

1 is necessary anyway, but it doesn't seem like a high priority.  2 is
best in the long run, but requires somebody who knows more about PPC64
ASM than I do to get started.  I don't know if 3 has any chance of
happening upstream, but I doubt there's anybody working on Parrot who
wants to deal with it.

If somebody can help with one or more of these, I can try to get it
going on AIX 4.3.3 once again.

Adam

Adam Thomason

unread,
Nov 8, 2004, 4:41:18 AM11/8/04
to Perl 6 Internals
On Fri, 29 Oct 2004 15:03:40 -0700, Adam Thomason <atho...@gmail.com> wrote:
>
> Worry not, it's already broken. I've been unable to test the AIX/PPC
> JIT since ICU went in. The configuration for ICU (at least as of 2.6)
> supports only a 64-bit build, while aix/asm.s is 32-bit only (the
> linker claims the .o is corrupt if assembled with OBJECT_MODE=64).
>
> To get it working again, one of three things needs to happen:
>
> 1. ICU becomes optional again (please!).
> 2. PPC64 JIT code is written which can be morphed into POWER code.
> Transforming PPC32->POWER was mostly straightforward, so hopefully
> 64-bit will be as well.
> 3. ICU's configure starts to support 32-bit compiles. This might
> happen with 3.0/CVS already, but I haven't checked.
>
> 1 is necessary anyway, but it doesn't seem like a high priority. 2 is
> best in the long run, but requires somebody who knows more about PPC64
> ASM than I do to get started. I don't know if 3 has any chance of
> happening upstream, but I doubt there's anybody working on Parrot who
> wants to deal with it.
>
> If somebody can help with one or more of these, I can try to get it
> going on AIX 4.3.3 once again.
>
> Adam
>

It appears that (3) may work after all. ICU 3.0 will build static
32-bit libraries which seem to work with parrot. As Jeff suspected,
the missing Parrot_ppc_jit_restore_nonvolatile_registers caused
trouble, but adding it to aix/asm.s was simple. Patch below fixes
that and another pedantic build issue with xlc.

Now to figure out why the JIT code segfaults...

Index: config/gen/platform/aix/asm.s
===================================================================
RCS file: /cvs/public/parrot/config/gen/platform/aix/asm.s,v
retrieving revision 1.2
diff -u -r1.2 asm.s
--- config/gen/platform/aix/asm.s 21 Feb 2004 10:58:53 -0000 1.2
+++ config/gen/platform/aix/asm.s 3 Nov 2004 23:57:33 -0000
@@ -10,6 +10,7 @@
.globl .aix_get_toc
.globl .ppc_sync
.globl .ppc_flush_line
+.globl .Parrot_ppc_jit_restore_nonvolatile_registers

# Flushes the cache line whose address is passed in
.ppc_flush_line:
@@ -38,3 +39,25 @@
st 3,68(SP)
cal SP,80(SP)
bcr BO_ALWAYS,CR0_LT
+
+.Parrot_ppc_jit_restore_nonvolatile_registers:
+ .function .Parrot_ppc_jit_restore_nonvolatile_registers,.Parrot_ppc_jit_restore_nonvolatile_registers,2,0
+ lfd 14,-84(SP)
+ lfd 15,-92(SP)
+ lfd 16,-100(SP)
+ lfd 17,-108(SP)
+ lfd 18,-116(SP)
+ lfd 19,-124(SP)
+ lfd 20,-132(SP)
+ lfd 21,-140(SP)
+ lfd 22,-148(SP)
+ lfd 23,-156(SP)
+ lfd 24,-164(SP)
+ lfd 25,-172(SP)
+ lfd 26,-180(SP)
+ lfd 27,-188(SP)
+ lfd 28,-196(SP)
+ lfd 29,-204(SP)
+ lfd 30,-212(SP)
+ lfd 31,-220(SP)
+ bcr BO_ALWAYS,CR0_LT
Index: src/sub.c
===================================================================
RCS file: /cvs/public/parrot/src/sub.c,v
retrieving revision 1.76
diff -u -r1.76 sub.c
--- src/sub.c 3 Nov 2004 14:29:58 -0000 1.76
+++ src/sub.c 3 Nov 2004 23:57:33 -0000
@@ -338,8 +338,10 @@
*/
#if PMC_DATA_IN_EXT
# define PREV_RETC(p) (PMC*)((p)->pmc_ext)
+# define PREV_RETC_LVALUE(p) ((p)->pmc_ext)
#else
# define PREV_RETC(p) PMC_data(p)
+# define PREV_RETC_LVALUE(p) PMC_data(p)
#endif

/*
@@ -374,7 +376,7 @@
Caches *mc = interpreter->caches;

if (mc->retc_cache)
- PREV_RETC(mc->retc_cache) = mc->retc_cache;
+ PREV_RETC_LVALUE(mc->retc_cache) = (PMC_EXT*) mc->retc_cache;
mc->retc_cache = pmc;
/* XXX expensive w. ARENA_DOD_FLAGS */
PObj_custom_mark_CLEAR(pmc);

Leopold Toetsch

unread,
Nov 8, 2004, 5:38:11 AM11/8/04
to Adam Thomason, perl6-i...@perl.org
Adam Thomason <atho...@gmail.com> wrote:

> It appears that (3) may work after all. ICU 3.0 will build static
> 32-bit libraries which seem to work with parrot. As Jeff suspected,
> the missing Parrot_ppc_jit_restore_nonvolatile_registers caused
> trouble, but adding it to aix/asm.s was simple. Patch below fixes
> that and another pedantic build issue with xlc.

> Now to figure out why the JIT code segfaults...

Broken ABI WRT r2 (whatever that does on AIX)?

Thanks, applied:

> Index: config/gen/platform/aix/asm.s

That part is already changed:

> Index: src/sub.c

leo

Adam Thomason

unread,
Nov 9, 2004, 8:53:54 PM11/9/04
to l...@toetsch.at, perl6-i...@perl.org
On Mon, 8 Nov 2004 11:38:11 +0100, Leopold Toetsch <l...@toetsch.at> wrote:
> Adam Thomason <atho...@gmail.com> wrote:
>
> > It appears that (3) may work after all. ICU 3.0 will build static
> > 32-bit libraries which seem to work with parrot. As Jeff suspected,
> > the missing Parrot_ppc_jit_restore_nonvolatile_registers caused
> > trouble, but adding it to aix/asm.s was simple. Patch below fixes
> > that and another pedantic build issue with xlc.
>
> > Now to figure out why the JIT code segfaults...
>
> Broken ABI WRT r2 (whatever that does on AIX)?
>

The AIX calling convention preserves the "Table of Contents" (TOC)
address in r2, which must be preserved across function calls. What's
stomping on this that wasn't a few months ago?

Adam

Leopold Toetsch

unread,
Nov 10, 2004, 2:34:26 AM11/10/04
to Adam Thomason, perl6-i...@perl.org
Adam Thomason <atho...@gmail.com> wrote:
> On Mon, 8 Nov 2004 11:38:11 +0100, Leopold Toetsch <l...@toetsch.at> wrote:
>> Adam Thomason <atho...@gmail.com> wrote:
>>
>> > Now to figure out why the JIT code segfaults...

When does it segfault: always? during begin or end of JIT code?

>> Broken ABI WRT r2 (whatever that does on AIX)?

> The AIX calling convention preserves the "Table of Contents" (TOC)
> address in r2, which must be preserved across function calls.

Yes, but C<r2> is not used at all.

> ... What's


> stomping on this that wasn't a few months ago?

Register usage was changed, now non-volatiles are used only (and
preserved over jit_func), and of course this asm function for restoring
floats was added.

> Adam

leo

Adam Thomason

unread,
Nov 13, 2004, 2:02:15 AM11/13/04
to l...@toetsch.at, perl6-i...@perl.org
On Wed, 10 Nov 2004 08:34:26 +0100, Leopold Toetsch <l...@toetsch.at> wrote:
> Adam Thomason <atho...@gmail.com > wrote:
> > On Mon, 8 Nov 2004 11:38:11 +0100, Leopold Toetsch <l...@toetsch.at > wrote:
> >> Adam Thomason <atho...@gmail.com > wrote:
> >>
> >> > Now to figure out why the JIT code segfaults...
>
> When does it segfault: always? during begin or end of JIT code?
>

I just cvs up'ed and upgraded to perl 5.8.5, and now parrot's make
testj matches make test (some unimplemented PMC method errors in
both... is this expected?). I'm not sure what's responsible, but the
segfaults have gone away. For once the gnomes work for the better...

Adam

Leopold Toetsch

unread,
Nov 16, 2004, 11:51:57 AM11/16/04
to Adam Thomason, perl6-i...@perl.org
Adam Thomason <atho...@gmail.com> wrote:

> I just cvs up'ed and upgraded to perl 5.8.5, and now parrot's make
> testj matches make test (some unimplemented PMC method errors in
> both... is this expected?).

I don't know, which errors you got ;) Anyway, as of now JIT/PPC on OS X
is passing all tests.

> ... I'm not sure what's responsible, but the
> segfaults have gone away.

Which perl version did you replace? Can you reproduce the failures with
the old perl? If yes, we should drop a note somewhere about this
incompatibility.

> Adam

Thanks,
leo

0 new messages