guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] 02/17: Move add/immediate, sub/immediate slow paths out


From: Andy Wingo
Subject: [Guile-commits] 02/17: Move add/immediate, sub/immediate 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 fafa50287562f4f26dc8cc15e8cc99a6cebaafd7
Author: Andy Wingo <address@hidden>
Date:   Fri Dec 6 22:52:24 2019 +0100

    Move add/immediate, sub/immediate slow paths out of line
    
    * libguile/jit.c (compile_call_scm_from_scm_uimm)
      (compile_call_scm_from_scm_uimm_slow): Move non-fixnum path out of
      line.
---
 libguile/jit.c | 63 +++++++++++++++++++++++++++++++---------------------------
 1 file changed, 34 insertions(+), 29 deletions(-)

diff --git a/libguile/jit.c b/libguile/jit.c
index e11acd6..26abafa 100644
--- a/libguile/jit.c
+++ b/libguile/jit.c
@@ -2603,57 +2603,62 @@ compile_call_scm_from_scm_scm_slow (scm_jit_state *j, 
uint8_t dst, uint8_t a, ui
 static void
 compile_call_scm_from_scm_uimm (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 = jit_operand_imm (JIT_OPERAND_ABI_UINT8, b);
-
   switch ((enum scm_vm_intrinsic) idx)
     {
     case SCM_VM_INTRINSIC_ADD_IMMEDIATE:
       {
         emit_sp_ref_scm (j, T0, a);
-        op_a = jit_operand_gpr (JIT_OPERAND_ABI_POINTER, T0);
         scm_t_bits addend = b << 2;
-        jit_reloc_t not_inum = jit_bmci (j->jit, T0, 2);
-        fast = jit_bxaddi (j->jit, T0, addend);
-        has_fast = 1;
-        /* Restore previous value before slow path.  */
-        jit_subi (j->jit, T0, T0, addend);
-        jit_patch_here (j->jit, not_inum);
+        add_slow_path_patch (j, jit_bmci (j->jit, T0, 2));
+        add_slow_path_patch (j, jit_boaddi (j->jit, T0, addend));
         break;
       }
     case SCM_VM_INTRINSIC_SUB_IMMEDIATE:
       {
         emit_sp_ref_scm (j, T0, a);
-        op_a = jit_operand_gpr (JIT_OPERAND_ABI_POINTER, T0);
         scm_t_bits subtrahend = b << 2;
-        jit_reloc_t not_inum = jit_bmci (j->jit, T0, 2);
-        fast = jit_bxsubi (j->jit, T0, subtrahend);
-        has_fast = 1;
-        /* Restore previous value before slow path.  */
-        jit_addi (j->jit, T0, T0, subtrahend);
-        jit_patch_here (j->jit, not_inum);
+        add_slow_path_patch (j, jit_bmci (j->jit, T0, 2));
+        add_slow_path_patch (j, jit_bosubi (j->jit, T0, subtrahend));
         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 = jit_operand_imm (JIT_OPERAND_ABI_UINT8, 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_store_current_ip (j, T1);
+        emit_call_2 (j, intrinsic, op_a, op_b);
+        emit_retval (j, T0);
+        emit_reload_sp (j);
+        break;
+      }
+    }
 
-  if (has_fast)
-    jit_patch_here (j->jit, fast);
   emit_sp_set_scm (j, dst, T0);
 }
 static void
 compile_call_scm_from_scm_uimm_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_IMMEDIATE:
+    case SCM_VM_INTRINSIC_SUB_IMMEDIATE:
+      {
+        void *intrinsic = ((void **) &scm_vm_intrinsics)[idx];
+        jit_operand_t op_a = sp_scm_operand (j, a);
+        jit_operand_t op_b = jit_operand_imm (JIT_OPERAND_ABI_UINT8, 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]