diff options
author | Andy Wingo <wingo@pobox.com> | 2019-12-10 23:03:19 +0100 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2019-12-10 23:03:19 +0100 |
commit | 114198d15fe13c2dced9675e252326de878ee772 (patch) | |
tree | 054a69b4dc2c8c487bcf69c028dfced55fbe2c68 /libguile/jit.c | |
parent | 5e41d58ab93d07505dded3bf7b4e068b6d8120a9 (diff) | |
download | guile-114198d15fe13c2dced9675e252326de878ee772.tar.gz |
Move less? slow path out of line
* libguile/jit.c (compile_less, compile_less_slow): Move slow path out
of line.
Diffstat (limited to 'libguile/jit.c')
-rw-r--r-- | libguile/jit.c | 63 |
1 files changed, 31 insertions, 32 deletions
diff --git a/libguile/jit.c b/libguile/jit.c index 06c1d2118..fb669b6ce 100644 --- a/libguile/jit.c +++ b/libguile/jit.c @@ -3969,65 +3969,64 @@ compile_numerically_equal_slow (scm_jit_state *j, uint16_t a, uint16_t b) static void compile_less (scm_jit_state *j, uint16_t a, uint16_t b) { - jit_reloc_t fast, k2, k3; - jit_reloc_t k1; + jit_reloc_t k; uint32_t *target; - enum scm_opcode op = fuse_conditional_branch (j, &target); emit_sp_ref_scm (j, T0, a); emit_sp_ref_scm (j, T1, b); emit_andr (j, T2, T0, T1); - fast = jit_bmsi (j->jit, T2, scm_tc2_int); + add_slow_path_patch (j, jit_bmci (j->jit, T2, scm_tc2_int)); - emit_store_current_ip (j, T2); - emit_call_2 (j, scm_vm_intrinsics.less_p, - jit_operand_gpr (JIT_OPERAND_ABI_POINTER, T0), - jit_operand_gpr (JIT_OPERAND_ABI_POINTER, T1)); - emit_retval (j, T0); - emit_reload_sp (j); - switch (op) + switch (fuse_conditional_branch (j, &target)) { case scm_op_jl: - k1 = jit_beqi (j->jit, T0, SCM_F_COMPARE_LESS_THAN); + case scm_op_jnge: + k = jit_bltr (j->jit, T0, T1); break; case scm_op_jnl: - k1 = jit_bnei (j->jit, T0, SCM_F_COMPARE_LESS_THAN); - break; case scm_op_jge: - k1 = jit_beqi (j->jit, T0, SCM_F_COMPARE_NONE); - break; - case scm_op_jnge: - k1 = jit_bnei (j->jit, T0, SCM_F_COMPARE_NONE); + k = jit_bger (j->jit, T0, T1); break; default: UNREACHABLE (); } - k2 = jit_jmp (j->jit); - jit_patch_here (j->jit, fast); - switch (op) + add_inter_instruction_patch (j, k, target); +} +static void +compile_less_slow (scm_jit_state *j, uint16_t a, uint16_t b) +{ + jit_reloc_t k; + uint32_t *target; + + emit_store_current_ip (j, T2); + emit_call_2 (j, scm_vm_intrinsics.less_p, + jit_operand_gpr (JIT_OPERAND_ABI_POINTER, T0), + jit_operand_gpr (JIT_OPERAND_ABI_POINTER, T1)); + emit_retval (j, T0); + emit_reload_sp (j); + + switch (fuse_conditional_branch (j, &target)) { case scm_op_jl: - case scm_op_jnge: - k3 = jit_bltr (j->jit, T0, T1); + k = jit_beqi (j->jit, T0, SCM_F_COMPARE_LESS_THAN); break; case scm_op_jnl: + k = jit_bnei (j->jit, T0, SCM_F_COMPARE_LESS_THAN); + break; case scm_op_jge: - k3 = jit_bger (j->jit, T0, T1); + k = jit_beqi (j->jit, T0, SCM_F_COMPARE_NONE); + break; + case scm_op_jnge: + k = jit_bnei (j->jit, T0, SCM_F_COMPARE_NONE); break; default: UNREACHABLE (); } - jit_patch_here (j->jit, k2); - - add_inter_instruction_patch (j, k1, target); - add_inter_instruction_patch (j, k3, target); -} -static void -compile_less_slow (scm_jit_state *j, uint16_t a, uint16_t b) -{ + add_inter_instruction_patch (j, k, target); + continue_after_slow_path (j, j->next_ip); } static void |