-
Notifications
You must be signed in to change notification settings - Fork 14
Description
Every basic block, including the first block after a JIT entry, takes method parameters as basic block arguments. Therefore, the callee expects arguments in ALLOC_REGS registers. The first 6-8 of which agree with C_ARG_OPNDS.
The caller uses a CCall to jump to the callee block. At the moment, we pass method parameters using the arguments of the CCall. So the first 6-8 of them are stored in C_ARG_OPNDS. However, because the arguments of CCall are assigned to stack slots beyond C_ARG_OPNDS, they don't get stored in the rest of ALLOC_REGS registers.
So parameters read by JIT entry blocks and ones written by SendWithoutBlockDirect need to agree with each other. At the moment, the former reads from ALLOC_REGS because compile_jit_entry_state pushes hir::Insn::Param, and the latter writes to C_ARG_OPNDS because it uses the arguments of CCall.
We can either:
- Let the JIT entry blocks read parameters from C arguments, or:
- Implement a custom calling convention used only for JIT-to-JIT calls
- This option allows you to use more registers for passing method parameters, especially for arm64