After a day of running gdb in parallel on my MacOS X and Linux [quite annoying because of different keyboard layouts ;-) ], I've come to the following conclusion:

The entry code for BCOs expects all parameters to be on the stack, but on non-x86 machines, the stg_ap_*_ret pass parameters to it in registers (as for function objects). This leads to frequent crashes in GHCi on PowerPC, but not on Intel.

My first attempt at fixing this (by making stg_BCO_entry push the parameters onto the stack) is attached below, but I'm not committing it as I'm not sure it's the right way to do it. Are the stg_ap_*_ret functions the only places where a BCO is entered? It might be a nicer solution to modify GenApply to pass parameters to BCOs on the stack.

Cheers,

Wolfgang



Index: ghc/rts/StgMiscClosures.hc
===================================================================
RCS file: /home/cvs/root/fptools/ghc/rts/StgMiscClosures.hc,v
retrieving revision 1.82
diff -r1.82 StgMiscClosures.hc
240a241,262
>
> #ifndef NO_ARG_REGS
> {
> StgBCO *bco = (StgBCO*) R1.p;
> int size = BCO_BITMAP_SIZE(bco);
>
> if(size > MAX_REAL_VANILLA_REG-1)
> size = MAX_REAL_VANILLA_REG-1;
> Sp -= size;
>
> switch(size)
> {
> case 7: Sp[6] = R8.w;
> case 6: Sp[5] = R7.w;
> case 5: Sp[4] = R6.w;
> case 4: Sp[3] = R5.w;
> case 3: Sp[2] = R4.w;
> case 2: Sp[1] = R3.w;
> case 1: Sp[0] = R2.w;
> }
> }
> #endif

_______________________________________________
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to