* libguile/jit.c (jit_alloc_fn): On targets that need a dynamically
allocated literal pool, we will need to trace that pool, so pass a
pointerful malloc. Fixes JIT on AArch64.
* libguile/jit.c (compile_ursh_immediate):
(compile_ulsh_immediate): Fix immediate/register variant calling.
Happily a benefit of lightening, as type safety did this for us.
(DEFINE_CLOBBER_RECORDING_EMITTER_R_R_2): Pass JIT state.
* libguile/jit.c: Operands have their ABI in them. We can now have
addends on GPR and MEM operands, which can improve register
allocation. Use new jit_calli_3, etc helper APIs.
* libguile/jit.c (compute_mcode): Move analysis outside the code
emitter, as it doesn't need to re-run on overflow.
(compile): Clear labels before emitting, as they may have changed if we
overflowed.
* libguile/jit.c (fp_scm_operand): Fix assertion about register state.
(compile_call_scm_sz_u32): Fix ABI declaration for immediate.
Some whitespace cleanups as well.
* libguile/jit.c (prepare_jit_state): Remove unused function.
(initialize_thread_jit_state): Since the lightening state is allocated
using GC memory, trace the JIT state.
(compute_mcode): Avoid double-compile.
* libguile/jit.c (struct scm_jit_state): Remove entry_mcode member.
(add_inter_instruction_patch): Fix off-by-one.
(compile): Reset reloc_idx when restarting a compile. All instructions
record their addresses.
* libguile/jit.c (compile_u64_imm_less): Compare high word using
not-equal, to avoid a signedness compare.
(compile_s64_imm_less, compile_imm_s64_less): Fix the not-less cases.
* libguile/jit.c (record_gpr_clobber): If we clobber SP or FP, clear the
appropriate register state bits. Only exercised for 32-bit targets in
practice!
(emit_alloc_frame, emit_push_frame): Fix a couple places where we were
failing to track the register state correctly.
(compile_umul): Remove a needless register state flush, nowthat
qmulr_u has a wrapper that tracks this for us.
* libguile/jit.c (compile_s64_numerically_equal): Remove as this
instruction was removed in previous refactoring.
(compile_atomic_scm_set_immediate), compile_atomic_scm_ref_immediate):
Adapt to change in C name of these instructions.
* libguile/vm-engine.c: Add comments for all instructions.
* libguile/jit.c: Wrap the whole thing in ENABLE_JIT.
* libguile/threads.c (on_thread_exit):
* libguile/vm.c (scm_call_n):
* libguile/init.c (scm_i_init_guile):
* libguile/vm-engine.c (VM_NAME): Wrap calls into jit.c with ENABLE_JIT.
* configure.ac: Move up AC_CANONICAL_TARGET, as autoconf was complaining
about it coming after AC_ARG_PROGRAM.
* acinclude.m4 (GUILE_ENABLE_JIT): Fix to honor --enable-jit arg.
* libguile/intrinsics.h (SCM_FOR_ALL_VM_INTRINSICS): Remove VM hook
intrinsics, now that we're going to rely on the interpreter for
stepping and breakpoints.
* libguile/jit.c (struct scm_jit_state): Remove "hooks_enabled" member,
now that we won't JIT. Remove all code related to calling hooks.
* libguile/vm-engine.c (RUN_HOOK): Call hooks directly instead of
through intrinsics. Use precise per-hook enable flags.
* libguile/vm.c (DEFINE_INVOKE_HOOK): New helper. Use to define the
hook invokers.
* libguile/jit.c (struct code_arena): New data type.
(struct scm_jit_state): Add code arena member.
(allocate_code_arena): New helper.
(emit_code): New helper. Emits code into a thread-local code arena.
(compute_mcode): Allow for failure to JIT.
(scm_jit_compute_mcode): Stop automatic JIT compilation on resource
exhaustion.
* libguile/jit.c (compile_call_scm_from_scm_scm): Add fast paths for
inum add and sub.
(compile_call_scm_from_scm_uimm): Add fast paths for inum
add/immediate and sub/immediate.
(compile_less): Add fast path for inum compare.
* libguile/jit.c (compile_check_arguments)
(compile_check_positional_arguments): Fix these functions. The
compiler uses "jge" as a "compare result not NONE", but the VM
instructions set NONE on greater-than, not greater-than-or-equal.
Sad!