1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-28 16:00:22 +02:00

Fix JIT register state tracking for use of SP or FP as temp

* 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.
This commit is contained in:
Andy Wingo 2018-10-09 08:51:41 +02:00 committed by Andy Wingo
parent 9feb3a633f
commit afced398d4

View file

@ -369,6 +369,11 @@ record_gpr_clobber (scm_jit_state *j, jit_gpr_t r)
{
if (j->sp_cache_gpr == r)
clear_register_state (j, SP_CACHE_GPR);
if (r == SP)
clear_register_state (j, SP_IN_REGISTER);
else if (r == FP)
clear_register_state (j, FP_IN_REGISTER);
}
static void
@ -756,6 +761,7 @@ emit_alloc_frame (scm_jit_state *j, jit_gpr_t t, uint32_t nlocals)
{
ASSERT_HAS_REGISTER_STATE (FP_IN_REGISTER);
emit_subtract_stack_slots (j, SP, FP, nlocals);
set_register_state (j, SP_IN_REGISTER);
emit_alloc_frame_for_sp (j, t);
}
@ -834,6 +840,7 @@ emit_push_frame (scm_jit_state *j, uint32_t proc_slot, uint32_t nlocals,
emit_reload_fp (j);
emit_subtract_stack_slots (j, FP, FP, proc_slot);
set_register_state (j, FP_IN_REGISTER);
continuation = emit_store_mra (j, FP, t);
emit_store_vra (j, FP, t, vra);
emit_store_prev_fp_offset (j, FP, t, proc_slot);
@ -2704,7 +2711,6 @@ compile_umul (scm_jit_state *j, uint8_t dst, uint8_t a, uint8_t b)
emit_addr (j, T1, T1, T3_OR_FP); /* Add high results, throw away overflow */
emit_qmulr_u (j, T0, T2, T0, T2); /* Low A times low B */
emit_addr (j, T1, T1, T2); /* Add high result of low product */
clear_register_state (j, SP_CACHE_FPR | SP_CACHE_GPR);
emit_sp_set_u64 (j, dst, T0, T1);
#endif
}