guile-commits
[Top][All Lists]
Advanced

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

[Guile-commits] 05/05: Inline handling of non-program apply


From: Andy Wingo
Subject: [Guile-commits] 05/05: Inline handling of non-program apply
Date: Wed, 27 Jun 2018 08:03:23 -0400 (EDT)

wingo pushed a commit to branch master
in repository guile.

commit 7883290d884d3e2e83d293a4d35ce4ab335a9948
Author: Andy Wingo <address@hidden>
Date:   Wed Jun 27 13:54:45 2018 +0200

    Inline handling of non-program apply
    
    * libguile/vm.c (vm_apply_non_program_code): Remove, now unneeded.
    * libguile/vm-engine.c (vm_engine, call, tail-call, tail-call/shuffle)
      (tail-apply, call/cc): Inline handling of non-programs, as will be the
      case with JIT code.
---
 libguile/vm-engine.c | 46 ++++++++++++++++++++++++++++------------------
 libguile/vm.c        |  4 ----
 2 files changed, 28 insertions(+), 22 deletions(-)

diff --git a/libguile/vm-engine.c b/libguile/vm-engine.c
index 0236329..88cfb61 100644
--- a/libguile/vm-engine.c
+++ b/libguile/vm-engine.c
@@ -311,7 +311,10 @@ VM_NAME (scm_thread *thread, jmp_buf *registers, int 
resume)
   if (SCM_LIKELY (SCM_PROGRAM_P (FP_REF (0))))
     ip = SCM_PROGRAM_CODE (FP_REF (0));
   else
-    ip = (uint32_t *) vm_apply_non_program_code;
+    {
+      scm_vm_intrinsics.apply_non_program (thread);
+      CACHE_REGISTER ();
+    }
 
   APPLY_HOOK ();
 
@@ -389,7 +392,11 @@ VM_NAME (scm_thread *thread, jmp_buf *registers, int 
resume)
       if (SCM_LIKELY (SCM_PROGRAM_P (FP_REF (0))))
         ip = SCM_PROGRAM_CODE (FP_REF (0));
       else
-        ip = (uint32_t *) vm_apply_non_program_code;
+        {
+          SYNC_IP ();
+          scm_vm_intrinsics.apply_non_program (thread);
+          CACHE_REGISTER ();
+        }
 
       APPLY_HOOK ();
 
@@ -449,7 +456,11 @@ VM_NAME (scm_thread *thread, jmp_buf *registers, int 
resume)
       if (SCM_LIKELY (SCM_PROGRAM_P (FP_REF (0))))
         ip = SCM_PROGRAM_CODE (FP_REF (0));
       else
-        ip = (uint32_t *) vm_apply_non_program_code;
+        {
+          SYNC_IP ();
+          scm_vm_intrinsics.apply_non_program (thread);
+          CACHE_REGISTER ();
+        }
 
       APPLY_HOOK ();
 
@@ -502,7 +513,11 @@ VM_NAME (scm_thread *thread, jmp_buf *registers, int 
resume)
       if (SCM_LIKELY (SCM_PROGRAM_P (FP_REF (0))))
         ip = SCM_PROGRAM_CODE (FP_REF (0));
       else
-        ip = (uint32_t *) vm_apply_non_program_code;
+        {
+          SYNC_IP ();
+          scm_vm_intrinsics.apply_non_program (thread);
+          CACHE_REGISTER ();
+        }
 
       APPLY_HOOK ();
 
@@ -739,7 +754,10 @@ VM_NAME (scm_thread *thread, jmp_buf *registers, int 
resume)
       if (SCM_LIKELY (SCM_PROGRAM_P (FP_REF (0))))
         ip = SCM_PROGRAM_CODE (FP_REF (0));
       else
-        ip = (uint32_t *) vm_apply_non_program_code;
+        {
+          scm_vm_intrinsics.apply_non_program (thread);
+          CACHE_REGISTER ();
+        }
 
       APPLY_HOOK ();
 
@@ -767,7 +785,10 @@ VM_NAME (scm_thread *thread, jmp_buf *registers, int 
resume)
       if (SCM_LIKELY (SCM_PROGRAM_P (SP_REF (1))))
         ip = SCM_PROGRAM_CODE (SP_REF (1));
       else
-        ip = (uint32_t *) vm_apply_non_program_code;
+        {
+          scm_vm_intrinsics.apply_non_program (thread);
+          CACHE_REGISTER ();
+        }
 
       APPLY_HOOK ();
 
@@ -2027,18 +2048,7 @@ VM_NAME (scm_thread *thread, jmp_buf *registers, int 
resume)
       NEXT (1);
     }
 
-  /* apply-non-program _:24
-   *
-   * Used by the VM as a trampoline to apply non-programs.
-   */
-  VM_DEFINE_OP (142, apply_non_program, "apply-non-program", OP1 (X32))
-    {
-      SYNC_IP ();
-      scm_vm_intrinsics.apply_non_program (thread);
-      CACHE_REGISTER ();
-      NEXT (0);
-    }
-
+  VM_DEFINE_OP (142, unused_142, NULL, NOP)
   VM_DEFINE_OP (143, unused_143, NULL, NOP)
   VM_DEFINE_OP (144, unused_144, NULL, NOP)
   VM_DEFINE_OP (145, unused_145, NULL, NOP)
diff --git a/libguile/vm.c b/libguile/vm.c
index 1b224d4..3a603e4 100644
--- a/libguile/vm.c
+++ b/libguile/vm.c
@@ -330,10 +330,6 @@ static const uint32_t vm_boot_continuation_code[] = {
   SCM_PACK_OP_24 (halt, 0)
 };
 
-static const uint32_t vm_apply_non_program_code[] = {
-  SCM_PACK_OP_24 (apply_non_program, 0)
-};
-
 static const uint32_t vm_builtin_apply_code[] = {
   SCM_PACK_OP_24 (assert_nargs_ge, 3),
   SCM_PACK_OP_24 (tail_apply, 0), /* proc in r1, args from r2 */



reply via email to

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