[Top][All Lists]

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

[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.2-1-g37a5970

From: Ludovic Courtès
Subject: [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.2-1-g37a5970
Date: Wed, 06 Jul 2011 10:50:59 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".

The branch, stable-2.0 has been updated
       via  37a5970c19ca7ad2b5de2f667748c840c199f878 (commit)
      from  c467c36374b7bdbdfe4c0dfccaa2fb4ebfb4d3a7 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 37a5970c19ca7ad2b5de2f667748c840c199f878
Author: Ludovic Courtès <address@hidden>
Date:   Mon Jul 4 23:56:16 2011 +0200

    VM: Keep jump table address in a register.
    * libguile/vm-engine.c (VM_NAME)[HAVE_LABELS_AS_VALUES]: Rename
      `jump_table' to `jump_table_pointer'.  Add `jump_table' as a local
      variable, initialize it.
    * libguile/vm-engine.h (JT_REG): New macro.


Summary of changes:
 libguile/vm-engine.c |   18 +++++++++++++-----
 libguile/vm-engine.h |    8 ++++++++
 2 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/libguile/vm-engine.c b/libguile/vm-engine.c
index 22bd39c..c90458d 100644
--- a/libguile/vm-engine.c
+++ b/libguile/vm-engine.c
@@ -61,23 +61,31 @@ VM_NAME (SCM vm, SCM program, SCM *argv, int nargs)
   SCM finish_args;                      /* used both for returns: both in error
                                            and normal situations */
-  static void **jump_table = NULL;
+  static const void **jump_table_pointer = NULL;
-  if (SCM_UNLIKELY (!jump_table))
+  register const void **jump_table JT_REG;
+  if (SCM_UNLIKELY (!jump_table_pointer))
       int i;
-      jump_table = malloc (SCM_VM_NUM_INSTRUCTIONS * sizeof(void*));
+      jump_table_pointer = malloc (SCM_VM_NUM_INSTRUCTIONS * sizeof (void*));
       for (i = 0; i < SCM_VM_NUM_INSTRUCTIONS; i++)
-        jump_table[i] = &&vm_error_bad_instruction;
+        jump_table_pointer[i] = &&vm_error_bad_instruction;
+#define jump_table jump_table_pointer
 #include <libguile/vm-expand.h>
 #include <libguile/vm-i-system.i>
 #include <libguile/vm-i-scheme.i>
 #include <libguile/vm-i-loader.i>
+#undef jump_table
+  /* Attempt to keep JUMP_TABLE_POINTER in a register.  This saves one
+     load instruction at each instruction dispatch.  */
+  jump_table = jump_table_pointer;
   /* Initialization */
diff --git a/libguile/vm-engine.h b/libguile/vm-engine.h
index 48ab09a..000397d 100644
--- a/libguile/vm-engine.h
+++ b/libguile/vm-engine.h
@@ -57,6 +57,11 @@
 /* too few registers! because of register allocation errors with various gcs,
    just punt on explicit assignments on i386, hoping that the "register"
    declaration will be sufficient. */
+#elif defined __x86_64__
+/* GCC 4.6 chooses %rbp for IP_REG and %rbx for SP_REG, which works
+   well.  Tell it to keep the jump table in a r12, which is
+   callee-saved.  */
+#define JT_REG asm ("r12")
 #if defined(PPC) || defined(_POWER) || defined(_IBMR2)
 #define IP_REG asm("26")
@@ -89,6 +94,9 @@
 #ifndef FP_REG
 #define FP_REG
+#ifndef JT_REG
+#define JT_REG

GNU Guile

reply via email to

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