Attached is a patch which fixes most of the "make testj" failures on Mac OS X (ie, ppc jit). Essentially all of the tests were failing; after the patch, these still fail:
Failed Test Stat Wstat Total Fail Failed List of Failed
------------------------------------------------------------------------ -------
t/op/arithmetics.t 1 256 18 1 5.56% 7
t/op/interp.t 5 1280 16 5 31.25% 2 8-11
t/pmc/exception.t 4 1024 22 4 18.18% 15-16 18 20
t/pmc/io.t 1 256 21 1 4.76% 6
t/pmc/pmc.t 1 256 92 1 1.09% 62
t/pmc/sub.t 4 1024 47 4 8.51% 42-45
t/pmc/tqueue.t 1 256 2 1 50.00% 2
33 subtests skipped.
Failed 7/61 test scripts, 88.52% okay. 17/1017 subtests failed, 98.33% okay.
(The arithmetics.t failure is due to "-0.0"; I have a fix for that as well, which I'll submit separately, assuming we want to suppress negative zero.)
Notes:
1) Now using the bctrl instruction instead of the bl instruction in Parrot_jit_normal_op, to branch to the op function using an absolute address rather than a relative address. This fixes the bulk of the failures. It's not completely clear why the previous implementation was failing; the generated code looked correct when disassembled in the debugger, but then again it also worked when running in the debugger (but not when run outside of the debugger). I suspect that the issue may have been problems with large branch offsets. The new implementation also has the nice side effects that it avoids the need for a jit_fixup here, and also matches the code which gcc generates in the case of a branch to a literal address.
2) Changed the frame entry and exit code to save the nonvolatile registers that we are modifying.
3) Fixed typo in Parrot_if_n_ic and Parrot_unless_n_ic.
4) Fixed typo in jit_emit_bcctrx.
5) Changed add_disp to handle large offsets. This was causing failures in t/op/stacks.t which had nothing to do with stacks, but rather were problems with large bytecode. Added a test to t/op/jit.t to explicitly test behavior with large bytecode, and modified the output of a test in stacks.t to make it easier to determine the point of failure.
6) Changed dumpcore() to be raise(SIGQUIT) instead of kill(0, SIGQUIT) for the Unix platforms. This is because the latter actually sends the signal to the entire current process group (not just the current process), so a failing test was taking down t/harness.
7) I don't expect anything here to break AIX users--the Mac OS X and AIX calling conventions differ somewhat, but I don't think anything here should run into those differences. But I'd like to hear the test results on AIX after application of the patch, and also I'd like to know if most tests were failing before its application.
ppc-jit.patch
Description: Binary data
JEff