This is a temporary staging ground for work on the Firefox ppc64 JIT. Once the MVP has been completed, the intention is to add it to the Firefox tree for maintenance as part of Firefox and this repo will eventually be removed.
The Minimum Viable Product is a POWER9 little-endian JIT with Wasm and without SIMD running with the 64-bit ELFv2 ABI and a 64K page size. There is certainly interest and value in big-endian and additional 64-bit PowerPC support (potentially all the way down to the 970/G5), but these can be grafted on after the fact and the SpiderMonkey JIT core is known to have endian problems which need fixing separately (see TenFourFox for more on that). Additionally, POWER9 is a viable desktop system thanks to the Raptor Talos family which developers are likely to already be using, and the new instructions in ISA 3.0 make initial porting substantially simpler on POWER9.
SIMD is a separate issue which will not be addressed during the MVP period, and isn't necessary to get the JIT off the ground on any platform.
Required For MVP
- Create a first draft JIT using the existing MIPS64 LE sources from Fx62 as a scaffold. Fx62 was chosen simply because it was the version when the port was originally commenced; there's nothing special about it otherwise other than to eliminate churn with constantly integrating new changes. This step is already in progress.
- Ensure the first draft JIT compiles. A temporary Fx62 tree will probably be uploaded to facilitate this.
- Ensure the first draft JIT links (add any missing functions).
- Ensure the first draft JIT passes all tests in Fx62 (all tests in
- Forward port the first draft JIT to
mozilla-centralas the second draft JIT.
- Ensure the second draft JIT compiles.
- Ensure the second draft JIT links.
- Repair any new test failures.
- Submit to Bugzilla in separate patch sets (patches needed against the JIT core, and new files).
In Scope But Not Required For MVP
- Simulator support to allow automated testing.
Not In Scope For MVP (but desirable)
Roughly in order of priority:
- Support for POWER8 and earlier.
- BE support.
- Support for non-64K page sizes.
- SIMD with VMX/VSX.
Please don't submit pull requests for these yet unless they are trivial.
Phase 1: What's Done So Far (And Might Even Work)
Some of this code originates from TenFourFox's IonPower JIT.
- Ion code generator (
- Baseline code generator (
- Baseline and shared inline cache code generators (
- LIR (intermediate representation) design (
- Basic lowering/strength reduction (
- Bailouts (
- Move code generator (
- Trampoline code generator (
What's remaining to do:
- Check my work, because I'm an idiot
Architectureand exact interal JIT ABI usage, including temporary registers; see the ABI documentation
- Current plan is to use
r12as temporary registers (regenerating
r12when making PLT-like calls back to PPC64 ABI-compliant code through
r12or some other non-
r0register needed as an "address" holder
- Try to enable use of as many GPRs and FPRs as possible
- Don't define SPRs other than
lroutside of our JIT backend since SpiderMonkey doesn't understand the concept
- No vector registers for the MVP
- Current plan is to use
ma_*functions) based on those used by the code generators
as_*[native instructions] and
xs_*[commonly accepted alternative mnemonics] functions) based on instructions issued by the code generators and the macro assembler
Feel free to start on what you like
The original MIPS code from which the new source was cribbed and rewritten is provided. Don't remove these just in case we need to refer back to them for the original semantics.
All code is MPL 2.0 and you agree that by submitting a pull request, you automatically grant use of your work under that license.