[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 03/17: Move add, sub slow paths out of line
From: |
Andy Wingo |
Subject: |
[Guile-commits] 03/17: Move add, sub slow paths out of line |
Date: |
Wed, 11 Dec 2019 03:47:49 -0500 (EST) |
wingo pushed a commit to branch master
in repository guile.
commit 9c329776df1d032e34e224035a357fbbf18149d2
Author: Andy Wingo <address@hidden>
Date: Tue Dec 10 17:08:05 2019 +0100
Move add, sub slow paths out of line
* libguile/jit.c (compile_call_scm_from_scm_sc)
(compile_call_scm_from_scm_scm_slow): Move non-fixnum path out of
line.
---
libguile/jit.c | 71 ++++++++++++++++++++++++++++------------------------------
1 file changed, 34 insertions(+), 37 deletions(-)
diff --git a/libguile/jit.c b/libguile/jit.c
index 26abafa..1ed8f92 100644
--- a/libguile/jit.c
+++ b/libguile/jit.c
@@ -2537,67 +2537,64 @@ compile_long_fmov_slow (scm_jit_state *j, uint32_t dst,
uint32_t src)
static void
compile_call_scm_from_scm_scm (scm_jit_state *j, uint8_t dst, uint8_t a,
uint8_t b, uint32_t idx)
{
- void *intrinsic = ((void **) &scm_vm_intrinsics)[idx];
- int has_fast = 0;
- jit_reloc_t fast;
-
- jit_operand_t op_a = sp_scm_operand (j, a);
- jit_operand_t op_b = sp_scm_operand (j, b);
-
switch ((enum scm_vm_intrinsic) idx)
{
case SCM_VM_INTRINSIC_ADD:
{
emit_sp_ref_scm (j, T0, a);
emit_sp_ref_scm (j, T1, b);
- op_a = jit_operand_gpr (JIT_OPERAND_ABI_POINTER, T0);
- op_b = jit_operand_gpr (JIT_OPERAND_ABI_POINTER, T1);
- jit_reloc_t a_not_inum = jit_bmci (j->jit, T0, scm_tc2_int);
- jit_reloc_t b_not_inum = jit_bmci (j->jit, T1, scm_tc2_int);
+ add_slow_path_patch (j, jit_bmci (j->jit, T0, scm_tc2_int));
+ add_slow_path_patch (j, jit_bmci (j->jit, T1, scm_tc2_int));
jit_subi (j->jit, T0, T0, scm_tc2_int);
- fast = jit_bxaddr (j->jit, T0, T1);
- has_fast = 1;
- /* Restore previous value before slow path. */
- jit_subr (j->jit, T0, T0, T1);
- jit_addi (j->jit, T0, T0, scm_tc2_int);
- jit_patch_here (j->jit, a_not_inum);
- jit_patch_here (j->jit, b_not_inum);
+ add_slow_path_patch (j, jit_boaddr (j->jit, T0, T1));
break;
}
case SCM_VM_INTRINSIC_SUB:
{
emit_sp_ref_scm (j, T0, a);
emit_sp_ref_scm (j, T1, b);
- op_a = jit_operand_gpr (JIT_OPERAND_ABI_POINTER, T0);
- op_b = jit_operand_gpr (JIT_OPERAND_ABI_POINTER, T1);
- jit_reloc_t a_not_inum = jit_bmci (j->jit, T0, scm_tc2_int);
- jit_reloc_t b_not_inum = jit_bmci (j->jit, T1, scm_tc2_int);
+ add_slow_path_patch (j, jit_bmci (j->jit, T0, scm_tc2_int));
+ add_slow_path_patch (j, jit_bmci (j->jit, T1, scm_tc2_int));
jit_subi (j->jit, T1, T1, scm_tc2_int);
- fast = jit_bxsubr (j->jit, T0, T1);
- has_fast = 1;
- /* Restore previous values before slow path. */
- jit_addr (j->jit, T0, T0, T1);
- jit_addi (j->jit, T1, T1, scm_tc2_int);
- jit_patch_here (j->jit, a_not_inum);
- jit_patch_here (j->jit, b_not_inum);
+ add_slow_path_patch (j, jit_bosubr (j->jit, T0, T1));
break;
}
default:
- break;
+ {
+ void *intrinsic = ((void **) &scm_vm_intrinsics)[idx];
+ jit_operand_t op_a = sp_scm_operand (j, a);
+ jit_operand_t op_b = sp_scm_operand (j, b);
+ emit_store_current_ip (j, T2);
+ emit_call_2 (j, intrinsic, op_a, op_b);
+ emit_retval (j, T0);
+ emit_reload_sp (j);
+ }
}
- emit_store_current_ip (j, T2);
- emit_call_2 (j, intrinsic, op_a, op_b);
- emit_retval (j, T0);
- emit_reload_sp (j);
-
- if (has_fast)
- jit_patch_here (j->jit, fast);
emit_sp_set_scm (j, dst, T0);
}
static void
compile_call_scm_from_scm_scm_slow (scm_jit_state *j, uint8_t dst, uint8_t a,
uint8_t b, uint32_t idx)
{
+ switch ((enum scm_vm_intrinsic) idx)
+ {
+ case SCM_VM_INTRINSIC_ADD:
+ case SCM_VM_INTRINSIC_SUB:
+ {
+ void *intrinsic = ((void **) &scm_vm_intrinsics)[idx];
+ jit_operand_t op_a = sp_scm_operand (j, a);
+ jit_operand_t op_b = sp_scm_operand (j, b);
+ emit_store_current_ip (j, T1);
+ emit_call_2 (j, intrinsic, op_a, op_b);
+ emit_retval (j, T0);
+ emit_reload_sp (j);
+ emit_sp_set_scm (j, dst, T0);
+ continue_after_slow_path (j, j->next_ip);
+ break;
+ }
+ default:
+ break;
+ }
}
static void
- [Guile-commits] branch master updated (4a6a7e1 -> 114198d), Andy Wingo, 2019/12/11
- [Guile-commits] 02/17: Move add/immediate, sub/immediate slow paths out of line, Andy Wingo, 2019/12/11
- [Guile-commits] 03/17: Move add, sub slow paths out of line,
Andy Wingo <=
- [Guile-commits] 04/17: Move handle-interrupts slow path out of line, Andy Wingo, 2019/12/11
- [Guile-commits] 10/17: Add subr-call out-of-line slow path, Andy Wingo, 2019/12/11
- [Guile-commits] 09/17: Move alloc-frame slow path out of line, Andy Wingo, 2019/12/11
- [Guile-commits] 13/17: Move assert-nargs-le slow path out of line, Andy Wingo, 2019/12/11
- [Guile-commits] 14/17: Move allocate-words/immediate slow path out of line, Andy Wingo, 2019/12/11
- [Guile-commits] 05/17: Move receive slow path out of line, Andy Wingo, 2019/12/11
- [Guile-commits] 07/17: Move assert-nargs-ee slow path out of line, Andy Wingo, 2019/12/11
- [Guile-commits] 06/17: Move receive-values slow path out of line, Andy Wingo, 2019/12/11
- [Guile-commits] 08/17: Move assert-nargs-ge slow path out of line, Andy Wingo, 2019/12/11
- [Guile-commits] 11/17: Add out-of-line slow path for compose-continuation, Andy Wingo, 2019/12/11