guile-commits
[Top][All Lists]
Advanced

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

[Guile-commits] GNU Guile branch, master, updated. release_1-9-12-94-g99


From: Ludovic Courtès
Subject: [Guile-commits] GNU Guile branch, master, updated. release_1-9-12-94-g99765ed
Date: Sun, 26 Sep 2010 23:30:49 +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".

http://git.savannah.gnu.org/cgit/guile.git/commit/?id=99765ed17245b7c54789c01702806bf27b161cb7

The branch, master has been updated
       via  99765ed17245b7c54789c01702806bf27b161cb7 (commit)
       via  8e4c60ff2902363b41f4c23e686ad65c17e90196 (commit)
       via  8684029d210be37775e32f7f4b4ca499bb1f1c56 (commit)
      from  c03ef352bcdfcc4f00a943477f4a6eaa7499f5eb (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 99765ed17245b7c54789c01702806bf27b161cb7
Author: Ludovic Courtès <address@hidden>
Date:   Mon Sep 27 01:28:49 2010 +0200

    Remove `scm_t_aligned_cell'.
    
    * libguile/_scm.h (scm_aligned_cell, scm_t_aligned_cell): Remove.  The
      whole approach was misguided as the compiler can't guarantee absolute
      alignment on the stack.

commit 8e4c60ff2902363b41f4c23e686ad65c17e90196
Author: Ludovic Courtès <address@hidden>
Date:   Sun Sep 26 16:24:35 2010 +0200

    Fix argument passing in VM hooks.
    
    * libguile/vm.c (vm_dispatch_hook): Take care of FRAME's alignment
      explicitly so that it's correct even if the current stack frame isn't
      8-byte aligned (as can be the case on i686--the SysV i386 ABI just
      says that the stack is word-aligned.)

commit 8684029d210be37775e32f7f4b4ca499bb1f1c56
Author: Ludovic Courtès <address@hidden>
Date:   Sun Sep 26 16:23:53 2010 +0200

    Have address@hidden' honor VM changes by winds.
    
    * libguile/control.c (scm_c_abort): Update VM after the `scm_dowinds'
      call.
    
    * test-suite/tests/control.test ("the-vm"): New test prefix.

-----------------------------------------------------------------------

Summary of changes:
 libguile/_scm.h               |   30 ------------------------------
 libguile/control.c            |    6 +++++-
 libguile/vm.c                 |   13 +++++++++----
 test-suite/tests/control.test |   26 ++++++++++++++++++++++++++
 4 files changed, 40 insertions(+), 35 deletions(-)

diff --git a/libguile/_scm.h b/libguile/_scm.h
index b04752c..0d86fe1 100644
--- a/libguile/_scm.h
+++ b/libguile/_scm.h
@@ -197,36 +197,6 @@
 #define SCM_OBJCODE_COOKIE                              \
   "GOOF-" SCM_OBJCODE_MACHINE_VERSION_STRING "---"
 
-
-/* Cells have to be 8-byte aligned.  Use `scm_t_aligned_cell' when not
-   allocating on the heap to have this guarantee.  This is similar to the
-   `SCM_ALIGNED' macro but provides an option likely to work with compilers
-   other than GCC.  */
-
-#ifdef __GNUC__
-
-struct scm_aligned_cell
-{
-  scm_t_cell cell __attribute__ ((__aligned__ (8)));
-};
-
-typedef struct scm_aligned_cell scm_t_aligned_cell;
-
-#else /* !__GNUC__ */
-
-union scm_aligned_cell
-{
-  double alignment;
-  scm_t_cell cell;
-};
-
-typedef union scm_aligned_cell scm_t_aligned_cell;
-
-#endif /* !__GNUC__ */
-
-/* Make sure we get the right alignment.  */
-verify (alignof (scm_t_aligned_cell) >= 8);
-
 #endif  /* SCM__SCM_H */
 
 /*
diff --git a/libguile/control.c b/libguile/control.c
index 99bc846..a696895 100644
--- a/libguile/control.c
+++ b/libguile/control.c
@@ -211,10 +211,14 @@ scm_c_abort (SCM vm, SCM tag, size_t n, SCM *argv, 
scm_t_int64 cookie)
 
   /* Unwind once more, beyond the prompt. */
   winds = SCM_CDR (winds), delta++;
-  
+
   /* Unwind */
   scm_dowinds (winds, delta);
 
+  /* Unwinding may have changed the current thread's VM, so use the
+     new one.  */
+  vm = scm_the_vm ();
+
   /* Restore VM regs */
   SCM_VM_DATA (vm)->fp = SCM_PROMPT_REGISTERS (prompt)->fp;
   SCM_VM_DATA (vm)->sp = SCM_PROMPT_REGISTERS (prompt)->sp;
diff --git a/libguile/vm.c b/libguile/vm.c
index 7512d10..17ad96d 100644
--- a/libguile/vm.c
+++ b/libguile/vm.c
@@ -191,7 +191,7 @@ vm_dispatch_hook (SCM vm, int hook_num)
   struct scm_vm *vp;
   SCM hook;
   struct scm_frame c_frame;
-  scm_t_aligned_cell frame;
+  scm_t_cell *frame;
   SCM args[1];
   int saved_trace_level;
 
@@ -218,9 +218,14 @@ vm_dispatch_hook (SCM vm, int hook_num)
   c_frame.sp = vp->sp;
   c_frame.ip = vp->ip;
   c_frame.offset = 0;
-  frame.cell.word_0 = SCM_PACK (scm_tc7_frame);
-  frame.cell.word_1 = PTR2SCM (&c_frame);
-  args[0] = PTR2SCM (&frame);
+
+  /* Arrange for FRAME to be 8-byte aligned, like any other cell.  */
+  frame = alloca (sizeof (*frame) + 8);
+  frame = (scm_t_cell *) ROUND_UP ((scm_t_uintptr) frame, 8UL);
+
+  frame->word_0 = SCM_PACK (scm_tc7_frame);
+  frame->word_1 = PTR2SCM (&c_frame);
+  args[0] = PTR2SCM (frame);
 
   scm_c_run_hookn (hook, args, 1);
 
diff --git a/test-suite/tests/control.test b/test-suite/tests/control.test
index b3ab707..a4173ff 100644
--- a/test-suite/tests/control.test
+++ b/test-suite/tests/control.test
@@ -19,6 +19,7 @@
 
 (define-module (test-suite test-control)
   #:use-module (ice-9 control)
+  #:use-module (system vm vm)
   #:use-module (srfi srfi-11)
   #:use-module (test-suite lib))
 
@@ -225,3 +226,28 @@
 (with-test-prefix "abort to unknown prompt"
   (pass-if-exception "foo" '(misc-error . "^Abort to unknown prompt")
                      (abort-to-prompt 'does-not-exist)))
+
+(with-test-prefix "the-vm"
+
+  (pass-if "unwind changes VMs"
+    (let ((new-vm  (make-vm))
+          (prev-vm (the-vm))
+          (proc    (lambda (x y)
+                     (expt x y)))
+          (call    (lambda (p x y)
+                     (p x y))))
+      (catch 'foo
+        (lambda ()
+          (dynamic-wind
+            (lambda ()
+              (set-thread-vm! (current-thread) new-vm))
+            (lambda ()
+              (vm-apply new-vm
+                        (lambda () (throw 'foo (the-vm)))
+                        '()))
+            (lambda ()
+              (set-thread-vm! (current-thread) prev-vm))))
+        (lambda (key vm)
+          (and (eq? key 'foo)
+               (eq? vm new-vm)
+               (eq? (the-vm) prev-vm)))))))


hooks/post-receive
-- 
GNU Guile



reply via email to

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