revert part of 7ff017002ddc980 that caused missed references
authorAndy Wingo <wingo@pobox.com>
Sun, 28 Sep 2008 21:08:14 +0000 (23:08 +0200)
committerAndy Wingo <wingo@pobox.com>
Sun, 28 Sep 2008 21:08:14 +0000 (23:08 +0200)
* libguile/programs.c (scm_c_make_closure): If the program is actually
  not a program, abort. This can happen if GC misses a reference, as
  currently seems to happen.

* libguile/vm.c (vm_mark): Revert part of
  7ff017002ddc980f684120653549a10c6c7cde5c, which changed the call to
  scm_mark_locations. I'm 99% *sure* this is wrong, but it seems to
  prevent missed references when recompiling the .go files in guile
  itself. Needs revisiting soon, but for the time being we can go back to
  where we were a couple of days ago.

* libguile/vm-i-system.c (halt, vector, vector-mark): Sync the registers
  before calling into C, as it may GC.

libguile/programs.c
libguile/vm-i-system.c
libguile/vm.c

index 666b94f..122c1b7 100644 (file)
@@ -90,6 +90,8 @@ SCM
 scm_c_make_closure (SCM program, SCM external)
 {
   SCM prog = scm_c_make_program (0, 0, program);
+  if (!SCM_PROGRAM_P (program))
+    abort ();
   *SCM_PROGRAM_DATA (prog) = *SCM_PROGRAM_DATA (program);
   SCM_PROGRAM_DATA (prog)->external = external;
   return prog;
index 20a0b98..16899cc 100644 (file)
@@ -64,6 +64,7 @@ VM_DEFINE_INSTRUCTION (halt, "halt", 0, 0, 0)
     {
       POP_LIST (nvalues);
       POP (ret);
+      SYNC_REGISTER ();
       ret = scm_values (ret);
     }
     
@@ -186,6 +187,7 @@ VM_DEFINE_INSTRUCTION (vector, "vector", 2, -1, 1)
   unsigned l = FETCH ();
   unsigned len = ((h << 8) + l);
   POP_LIST (len);
+  SYNC_REGISTER ();
   *sp = scm_vector (*sp);
   NEXT;
 }
@@ -199,6 +201,7 @@ VM_DEFINE_INSTRUCTION (list_mark, "list-mark", 0, 0, 0)
 VM_DEFINE_INSTRUCTION (vector_mark, "vector-mark", 0, 0, 0)
 {
   POP_LIST_MARK ();
+  SYNC_REGISTER ();
   *sp = scm_vector (*sp);
   NEXT;
 }
index c14fb3b..b93d712 100644 (file)
@@ -331,7 +331,7 @@ vm_mark (SCM obj)
 
   /* mark the stack conservatively */
   scm_mark_locations ((SCM_STACKITEM *) vp->stack_base,
-                      vp->sp - vp->stack_base + 1);
+                      sizeof (SCM)*(vp->sp + 1 - vp->stack_base));
 
   /* mark other objects  */
   for (i = 0; i < SCM_VM_NUM_HOOKS; i++)