[PATCH] maybe fix GNU Smalltalk 3.0c build on alpha

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] maybe fix GNU Smalltalk 3.0c build on alpha

Paolo Bonzini-2
Build log at

http://experimental.debian.net/fetch.php?&pkg=gnu-smalltalk&ver=3.1~rc3-2&arch=alpha&stamp=1220876485&file=log&as=raw

The bug looks like a GC problem.  The result of the SQLite call is zero,
but the descriptor has moved, the return type is not anymore #int, and
so nil is returned instead of zero.  I'm not sure, but it looks like a
plausible explanation and if this is the case, this patch would fix it.

The bug is present on all platforms, but just shows up on alpha for some
weird reason (and also not so weird reasons: 64-bit = more memory = more
GCs).

The only thing blocking 3.1 is the Windows port (if this is actually a
fix for the alpha build).

If anyone can connect to IRC and run a couple of tests, including
running a (safe! :-) executable, please drop me a line by e-mail.

Paolo

2008-09-14  Paolo Bonzini  <[hidden email]>

        * cint.c: Fix possible GC bugs.

diff --git a/libgst/cint.c b/libgst/cint.c
index 2bcb2c7..4f34c27 100644
--- a/libgst/cint.c
+++ b/libgst/cint.c
@@ -719,6 +719,10 @@ _gst_invoke_croutine (OOP cFuncOOP,

   incPtr = INC_SAVE_POINTER ();

+  /* Make sure the parameters do not die.  */
+  INC_ADD_OOP (cFuncOOP);
+  INC_ADD_OOP (receiver);
+
   funcAddr = cobject_value (cFuncOOP);
   if (!funcAddr)
     return (NULL);
@@ -815,7 +819,9 @@ _gst_invoke_croutine (OOP cFuncOOP,
   ffi_call (&c_func_cur->cacheCif, FFI_FN (funcAddr), &result.u,
ffi_arg_vec);

   _gst_set_errno (errno);
+  desc = (gst_c_callable) OOP_TO_OBJ (cFuncOOP);
   oop = c_to_smalltalk (&result, receiver, desc->returnTypeOOP);
+  INC_ADD_OOP (oop);

   /* Fixup all returned string variables */
   if (needPostprocessing)
@@ -1142,6 +1148,8 @@ push_smalltalk_obj (OOP oop,
     {
       cparam *cp = &c_func_cur->args[c_func_cur->arg_idx];
       ffi_type *type = smalltalk_to_c (oop, cp, cType);
+      if (cp->oop && !IS_NIL (cp->oop))
+       INC_ADD_OOP (cp->oop);
       if (type)
        c_func_cur->types[c_func_cur->arg_idx++] = type;
     }



_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] maybe fix GNU Smalltalk 3.0c build on alpha

Paolo Bonzini-2

> The only thing blocking 3.1 is the Windows port (if this is actually a
> fix for the alpha build).

Thomas confirmed it is.

Paolo


_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk