unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* Can't make a stack from a continuation
@ 2004-11-22 18:52 Neil Jerram
  2004-11-25 19:43 ` Neil Jerram
  0 siblings, 1 reply; 12+ messages in thread
From: Neil Jerram @ 2004-11-22 18:52 UTC (permalink / raw)


neil@laruns:~$ guile -q
guile> (version)
"1.6.4"
guile> (call-with-current-continuation make-stack)
Segmentation fault

This has been reported before, but it's still there.  I think it's 
something wrong with these lines from stacks.c, but I haven't 
investigated further yet.

   else if (SCM_CONTINUATIONP (obj))
     {
       offset = ((SCM_STACKITEM *) ((char *) SCM_CONTREGS (obj) + sizeof 
(scm_t_contregs))
		- SCM_BASE (obj));
#if SCM_STACK_GROWS_UP
       offset += SCM_CONTINUATION_LENGTH (obj);
#endif
       dframe = RELOC_FRAME (SCM_DFRAME (obj), offset);
     }

Regards,
	Neil



_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-guile


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Can't make a stack from a continuation
  2004-11-22 18:52 Can't make a stack from a continuation Neil Jerram
@ 2004-11-25 19:43 ` Neil Jerram
  2004-12-17  1:42   ` Neil Jerram
  0 siblings, 1 reply; 12+ messages in thread
From: Neil Jerram @ 2004-11-25 19:43 UTC (permalink / raw)
  Cc: bug-guile

[-- Attachment #1: Type: text/plain, Size: 294 bytes --]

Neil Jerram wrote:
> neil@laruns:~$ guile -q
> guile> (version)
> "1.6.4"
> guile> (call-with-current-continuation make-stack)
> Segmentation fault

I believe I have the fix for this (diffs attached for 1.6.x).  Would 
anyone who feels half-confident in this area please review?

Thanks,
	Neil

[-- Attachment #2: stacks.c.diff --]
[-- Type: text/x-patch, Size: 4239 bytes --]

Index: libguile/stacks.c
===================================================================
RCS file: /cvsroot/guile/guile/guile-core/libguile/stacks.c,v
retrieving revision 1.64.2.4
diff -u -u -r1.64.2.4 stacks.c
--- libguile/stacks.c	15 Mar 2002 10:33:37 -0000	1.64.2.4
+++ libguile/stacks.c	25 Nov 2004 19:43:20 -0000
@@ -162,10 +162,11 @@
       if (SCM_EVALFRAMEP (*dframe))
 	{
 	  scm_t_debug_info * info = RELOC_INFO (dframe->info, offset);
-	  n += (info - dframe->vect) / 2 + 1;
+	  scm_t_debug_info * vect = RELOC_INFO (dframe->vect, offset);
+	  n += (info - vect) / 2 + 1;
 	  /* Data in the apply part of an eval info frame comes from previous
 	     stack frame if the scm_t_debug_info vector is overflowed. */
-	  if ((((info - dframe->vect) & 1) == 0)
+	  if ((((info - vect) & 1) == 0)
 	      && SCM_OVERFLOWP (*dframe)
 	      && !SCM_UNBNDP (info[1].a.proc))
 	    ++n;
@@ -174,7 +175,7 @@
 	++n;
     }
   if (dframe && SCM_VOIDFRAMEP (*dframe))
-    *id = dframe->vect[0].id;
+    *id = RELOC_INFO (dframe->vect, offset) -> id;
   else if (dframe)
     *maxp = 1;
   return n;
@@ -189,7 +190,8 @@
   if (SCM_EVALFRAMEP (*dframe))
     {
       scm_t_debug_info * info = RELOC_INFO (dframe->info, offset);
-      if ((info - dframe->vect) & 1)
+      scm_t_debug_info * vect = RELOC_INFO (dframe->vect, offset);
+      if ((info - vect) & 1)
 	{
 	  /* Debug.vect ends with apply info. */
 	  --info;
@@ -206,9 +208,10 @@
     }
   else
     {
+      scm_t_debug_info * vect = RELOC_INFO (dframe->vect, offset);
       flags |= SCM_FRAMEF_PROC;
-      iframe->proc = dframe->vect[0].a.proc;
-      iframe->args = dframe->vect[0].a.args;
+      iframe->proc = vect[0].a.proc;
+      iframe->args = vect[0].a.args;
     }
   iframe->flags = flags;
 }
@@ -254,6 +257,7 @@
 {
   scm_t_info_frame *iframe = iframes;
   scm_t_debug_info *info;
+  scm_t_debug_info *vect;
   static SCM applybody = SCM_UNDEFINED;
   
   /* The value of applybody has to be setup after r4rs.scm has executed. */
@@ -275,7 +279,8 @@
 	      --iframe;
 	    }
 	  info =  RELOC_INFO (dframe->info, offset);
-	  if ((info - dframe->vect) & 1)
+	  vect =  RELOC_INFO (dframe->vect, offset);
+	  if ((info - vect) & 1)
 	    --info;
 	  /* Data in the apply part of an eval info frame comes from
 	     previous stack frame if the scm_t_debug_info vector is
@@ -292,7 +297,7 @@
 	    iframe->flags |= SCM_FRAMEF_OVERFLOW;
 	  info -= 2;
 	  NEXT_FRAME (iframe, n, quit);
-	  while (info >= dframe->vect)
+	  while (info >= vect)
 	    {
 	      if (!SCM_UNBNDP (info[1].a.proc))
 		{
@@ -462,8 +467,7 @@
     }
   else if (SCM_CONTINUATIONP (obj))
     {
-      offset = ((SCM_STACKITEM *) ((char *) SCM_CONTREGS (obj) + sizeof (scm_t_contregs))
-		- SCM_BASE (obj));
+      offset = (SCM_CONTREGS (obj) -> stack) - SCM_BASE (obj);
 #ifndef STACK_GROWS_UP
       offset += SCM_CONTINUATION_LENGTH (obj);
 #endif
@@ -490,7 +494,7 @@
   SCM_STACK (stack) -> frames = iframe;
 
   /* Translate the current chain of stack frames into debugging information. */
-  n = read_frames (RELOC_FRAME (dframe, offset), offset, n, iframe);
+  n = read_frames (dframe, offset, n, iframe);
   SCM_STACK (stack) -> length = n;
 
   /* Narrow the stack according to the arguments given to scm_make_stack. */
@@ -546,8 +550,7 @@
     }
   else if (SCM_CONTINUATIONP (stack))
     {
-      offset = ((SCM_STACKITEM *) ((char *) SCM_CONTREGS (stack) + sizeof (scm_t_contregs))
-		- SCM_BASE (stack));
+      offset = (SCM_CONTREGS (stack) -> stack) - SCM_BASE (stack);
 #ifndef STACK_GROWS_UP
       offset += SCM_CONTINUATION_LENGTH (stack);
 #endif
@@ -565,7 +568,7 @@
   while (dframe && !SCM_VOIDFRAMEP (*dframe))
     dframe = RELOC_FRAME (dframe->prev, offset);
   if (dframe && SCM_VOIDFRAMEP (*dframe))
-    return dframe->vect[0].id;
+    return RELOC_INFO (dframe->vect, offset) -> id;
   return SCM_BOOL_F;
 }
 #undef FUNC_NAME
@@ -625,8 +628,7 @@
     }
   else if (SCM_CONTINUATIONP (obj))
     {
-      offset = ((SCM_STACKITEM *) ((char *) SCM_CONTREGS (obj) + sizeof (scm_t_contregs))
-		- SCM_BASE (obj));
+      offset = (SCM_CONTREGS (obj) -> stack) - SCM_BASE (obj);
 #ifndef STACK_GROWS_UP
       offset += SCM_CONTINUATION_LENGTH (obj);
 #endif

[-- Attachment #3: eval.test.diff --]
[-- Type: text/x-patch, Size: 899 bytes --]

Index: test-suite/tests/eval.test
===================================================================
RCS file: /cvsroot/guile/guile/guile-core/test-suite/tests/eval.test,v
retrieving revision 1.6.2.1
diff -u -u -r1.6.2.1 eval.test
--- test-suite/tests/eval.test	19 Jul 2001 20:49:34 -0000	1.6.2.1
+++ test-suite/tests/eval.test	25 Nov 2004 19:43:20 -0000
@@ -177,4 +177,26 @@
 	(map + '(1 2) '(3)))
     )))
 
+;;;
+;;; continuations
+;;;
+
+(with-test-prefix "continuation"
+
+  (with-test-prefix "stacks/debugging"
+
+    (debug-enable 'debug)
+
+    (pass-if "make-stack"
+      (stack? (call-with-current-continuation make-stack)))
+
+    (pass-if "stack-id"
+      (let ((id (call-with-current-continuation stack-id)))
+	(or (boolean? id) (symbol? id))))
+
+    (pass-if "last-stack-frame"
+      (pair? (call-with-current-continuation last-stack-frame)))
+
+    ))
+
 ;;; eval.test ends here

[-- Attachment #4: Type: text/plain, Size: 137 bytes --]

_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-guile

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Can't make a stack from a continuation
  2004-11-25 19:43 ` Neil Jerram
@ 2004-12-17  1:42   ` Neil Jerram
  2004-12-23 14:24     ` Marius Vollmer
  0 siblings, 1 reply; 12+ messages in thread
From: Neil Jerram @ 2004-12-17  1:42 UTC (permalink / raw)
  Cc: bug-guile

Neil Jerram wrote:
> Neil Jerram wrote:
> 
>> neil@laruns:~$ guile -q
>> guile> (version)
>> "1.6.4"
>> guile> (call-with-current-continuation make-stack)
>> Segmentation fault
> 
> 
> I believe I have the fix for this (diffs attached for 1.6.x).  Would 
> anyone who feels half-confident in this area please review?

A further aspect of this that has been bothering me, is why it doesn't 
show up in all the occurrences of (make-stack *cont*) that my debugging 
code does when called from one of the eval trap handlers.  The answer (I 
believe) is that the eval trap handlers don't use real continuations; 
they use "debug objects" instead; this is controlled by the 'cheaptraps 
debug option, which defaults to "yes".

And one more problem ... the same problem exists in CVS head, but a 
similar patch doesn't fix it ... still investigating.

	Neil


_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-guile


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Can't make a stack from a continuation
  2004-12-17  1:42   ` Neil Jerram
@ 2004-12-23 14:24     ` Marius Vollmer
  2004-12-23 15:36       ` Marius Vollmer
  0 siblings, 1 reply; 12+ messages in thread
From: Marius Vollmer @ 2004-12-23 14:24 UTC (permalink / raw)
  Cc: bug-guile, guile-devel

Neil Jerram <neil@ossau.uklinux.net> writes:

> And one more problem ... the same problem exists in CVS head, but a
> similar patch doesn't fix it ... still investigating.

I'm looking into this as well, now.  The fix you did for 1.6 looks
good, although I don't understand it completely yet.  I will try to
come up with my own patch to CVS head.  One larger change I have in
mind is to move the offset calculation into the continuation code
itself, which is where it belongs.  Each continuation will get a new
"offset" field and the stack code will just use it.


_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-guile


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Can't make a stack from a continuation
  2004-12-23 14:24     ` Marius Vollmer
@ 2004-12-23 15:36       ` Marius Vollmer
  2004-12-24 23:05         ` Neil Jerram
  0 siblings, 1 reply; 12+ messages in thread
From: Marius Vollmer @ 2004-12-23 15:36 UTC (permalink / raw)
  Cc: bug-guile, guile-devel

Marius Vollmer <marius.vollmer@uni-dortmund.de> writes:

> Neil Jerram <neil@ossau.uklinux.net> writes:
>
>> And one more problem ... the same problem exists in CVS head, but a
>> similar patch doesn't fix it ... still investigating.
>
> I'm looking into this as well, now.  The fix you did for 1.6 looks
> good, although I don't understand it completely yet.  I will try to
> come up with my own patch to CVS head.

Here it is.  I have already applied it to CVS.  I think a similar
scheme can be used for 1.6, too: i.e., move the offset calculation
into scm_make_continuation.

Neil, do you want to fix 1.6 yourself?

Index: continuations.c
===================================================================
RCS file: /cvsroot/guile/guile/guile-core/libguile/continuations.c,v
retrieving revision 1.54
diff -u -r1.54 continuations.c
--- continuations.c	22 Oct 2004 15:13:12 -0000	1.54
+++ continuations.c	23 Dec 2004 15:26:20 -0000
@@ -134,6 +134,7 @@
 #if ! SCM_STACK_GROWS_UP
   src -= stack_size;
 #endif
+  continuation->offset = continuation->stack - src;
   memcpy (continuation->stack, src, sizeof (SCM_STACKITEM) * stack_size);
 
 #ifdef __ia64__
Index: continuations.h
===================================================================
RCS file: /cvsroot/guile/guile/guile-core/libguile/continuations.h,v
retrieving revision 1.31
diff -u -r1.31 continuations.h
--- continuations.h	25 Jun 2003 18:12:35 -0000	1.31
+++ continuations.h	23 Dec 2004 15:26:20 -0000
@@ -55,8 +55,19 @@
   size_t num_stack_items;   /* size of the saved stack.  */
   unsigned long seq;        /* dynamic root identifier.  */
 
-  /* the most recently created debug frame on the live stack, before
-     it was saved.  */
+  /* The offset from the live stack location and this copy.  This is
+     used to adjust pointers from within the copied stack to the stack
+     itself.
+
+     Thus, when you read a pointer from the copied stack that points
+     into the live stack, you need to add OFFSET so that it points
+     into the copy.
+  */
+  scm_t_ptrdiff offset;
+
+  /* The most recently created debug frame on the live stack, before
+     it was saved.  This need to be adjusted with OFFSET, above.
+  */
   struct scm_t_debug_frame *dframe;
 
   SCM_STACKITEM stack[1];    /* copied stack of size num_stack_items.  */ 
Index: stacks.c
===================================================================
RCS file: /cvsroot/guile/guile/guile-core/libguile/stacks.c,v
retrieving revision 1.80
diff -u -r1.80 stacks.c
--- stacks.c	22 Sep 2004 17:41:37 -0000	1.80
+++ stacks.c	23 Dec 2004 15:26:20 -0000
@@ -124,7 +124,8 @@
  * is read from a continuation.
  */
 static scm_t_bits
-stack_depth (scm_t_debug_frame *dframe, long offset, SCM *id, int *maxp)
+stack_depth (scm_t_debug_frame *dframe, scm_t_ptrdiff offset,
+	     SCM *id, int *maxp)
 {
   long n;
   long max_depth = SCM_BACKTRACE_MAXDEPTH;
@@ -134,11 +135,12 @@
     {
       if (SCM_EVALFRAMEP (*dframe))
 	{
-	  scm_t_debug_info * info = RELOC_INFO (dframe->info, offset);
-	  n += (info - dframe->vect) / 2 + 1;
+	  scm_t_debug_info *info = RELOC_INFO (dframe->info, offset);
+	  scm_t_debug_info *vect = RELOC_INFO (dframe->vect, offset);
+	  n += (info - vect) / 2 + 1;
 	  /* Data in the apply part of an eval info frame comes from previous
 	     stack frame if the scm_t_debug_info vector is overflowed. */
-	  if ((((info - dframe->vect) & 1) == 0)
+	  if ((((info - vect) & 1) == 0)
 	      && SCM_OVERFLOWP (*dframe)
 	      && !SCM_UNBNDP (info[1].a.proc))
 	    ++n;
@@ -147,7 +149,7 @@
 	++n;
     }
   if (dframe && SCM_VOIDFRAMEP (*dframe))
-    *id = dframe->vect[0].id;
+    *id = RELOC_INFO(dframe->vect, offset)[0].id;
   else if (dframe)
     *maxp = 1;
   return n;
@@ -156,13 +158,15 @@
 /* Read debug info from DFRAME into IFRAME.
  */
 static void
-read_frame (scm_t_debug_frame *dframe, long offset, scm_t_info_frame *iframe)
+read_frame (scm_t_debug_frame *dframe, scm_t_ptrdiff offset,
+	    scm_t_info_frame *iframe)
 {
   scm_t_bits flags = SCM_UNPACK (SCM_INUM0); /* UGh. */
   if (SCM_EVALFRAMEP (*dframe))
     {
-      scm_t_debug_info * info = RELOC_INFO (dframe->info, offset);
-      if ((info - dframe->vect) & 1)
+      scm_t_debug_info *info = RELOC_INFO (dframe->info, offset);
+      scm_t_debug_info *vect = RELOC_INFO (dframe->vect, offset);
+      if ((info - vect) & 1)
 	{
 	  /* Debug.vect ends with apply info. */
 	  --info;
@@ -179,9 +183,10 @@
     }
   else
     {
+      scm_t_debug_info *vect = RELOC_INFO (dframe->vect, offset);
       flags |= SCM_FRAMEF_PROC;
-      iframe->proc = dframe->vect[0].a.proc;
-      iframe->args = dframe->vect[0].a.args;
+      iframe->proc = vect[0].a.proc;
+      iframe->args = vect[0].a.args;
     }
   iframe->flags = flags;
 }
@@ -223,10 +228,11 @@
  */
 
 static scm_t_bits
-read_frames (scm_t_debug_frame *dframe, long offset, long n, scm_t_info_frame *iframes)
+read_frames (scm_t_debug_frame *dframe, scm_t_ptrdiff offset,
+	     long n, scm_t_info_frame *iframes)
 {
   scm_t_info_frame *iframe = iframes;
-  scm_t_debug_info *info;
+  scm_t_debug_info *info, *vect;
   static SCM applybody = SCM_UNDEFINED;
   
   /* The value of applybody has to be setup after r4rs.scm has executed. */
@@ -248,7 +254,8 @@
 	      --iframe;
 	    }
 	  info =  RELOC_INFO (dframe->info, offset);
-	  if ((info - dframe->vect) & 1)
+	  vect =  RELOC_INFO (dframe->vect, offset);
+	  if ((info - vect) & 1)
 	    --info;
 	  /* Data in the apply part of an eval info frame comes from
 	     previous stack frame if the scm_t_debug_info vector is
@@ -265,7 +272,7 @@
 	    iframe->flags |= SCM_FRAMEF_OVERFLOW;
 	  info -= 2;
 	  NEXT_FRAME (iframe, n, quit);
-	  while (info >= dframe->vect)
+	  while (info >= vect)
 	    {
 	      if (!SCM_UNBNDP (info[1].a.proc))
 		{
@@ -435,12 +442,9 @@
     }
   else if (SCM_CONTINUATIONP (obj))
     {
-      offset = ((SCM_STACKITEM *) ((char *) SCM_CONTREGS (obj) + sizeof (scm_t_contregs))
-		- SCM_BASE (obj));
-#if SCM_STACK_GROWS_UP
-      offset += SCM_CONTINUATION_LENGTH (obj);
-#endif
-      dframe = RELOC_FRAME (SCM_DFRAME (obj), offset);
+      scm_t_contregs *cont = SCM_CONTREGS (obj);
+      offset = cont->offset;
+      dframe = RELOC_FRAME (cont->dframe, offset);
     }
   else
     {
@@ -463,7 +467,7 @@
   SCM_STACK (stack) -> frames = iframe;
 
   /* Translate the current chain of stack frames into debugging information. */
-  n = read_frames (RELOC_FRAME (dframe, offset), offset, n, iframe);
+  n = read_frames (dframe, offset, n, iframe);
   SCM_STACK (stack) -> length = n;
 
   /* Narrow the stack according to the arguments given to scm_make_stack. */
@@ -519,12 +523,9 @@
     }
   else if (SCM_CONTINUATIONP (stack))
     {
-      offset = ((SCM_STACKITEM *) ((char *) SCM_CONTREGS (stack) + sizeof (scm_t_contregs))
-		- SCM_BASE (stack));
-#if SCM_STACK_GROWS_UP
-      offset += SCM_CONTINUATION_LENGTH (stack);
-#endif
-      dframe = RELOC_FRAME (SCM_DFRAME (stack), offset);
+      scm_t_contregs *cont = SCM_CONTREGS (stack);
+      offset = cont->offset;
+      dframe = RELOC_FRAME (cont->dframe, offset);
     }
   else if (SCM_STACKP (stack))
     {
@@ -538,7 +539,7 @@
   while (dframe && !SCM_VOIDFRAMEP (*dframe))
     dframe = RELOC_FRAME (dframe->prev, offset);
   if (dframe && SCM_VOIDFRAMEP (*dframe))
-    return dframe->vect[0].id;
+    return RELOC_INFO (dframe->vect, offset)[0].id;
   return SCM_BOOL_F;
 }
 #undef FUNC_NAME
@@ -595,12 +596,9 @@
     }
   else if (SCM_CONTINUATIONP (obj))
     {
-      offset = ((SCM_STACKITEM *) ((char *) SCM_CONTREGS (obj) + sizeof (scm_t_contregs))
-		- SCM_BASE (obj));
-#if SCM_STACK_GROWS_UP
-      offset += SCM_CONTINUATION_LENGTH (obj);
-#endif
-      dframe = RELOC_FRAME (SCM_DFRAME (obj), offset);
+      scm_t_contregs *cont = SCM_CONTREGS (obj);
+      offset = cont->offset;
+      dframe = RELOC_FRAME (cont->dframe, offset);
     }
   else
     {


_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-guile


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Can't make a stack from a continuation
  2004-12-23 15:36       ` Marius Vollmer
@ 2004-12-24 23:05         ` Neil Jerram
  2004-12-24 23:11           ` Neil Jerram
  2004-12-24 23:21           ` Marius Vollmer
  0 siblings, 2 replies; 12+ messages in thread
From: Neil Jerram @ 2004-12-24 23:05 UTC (permalink / raw)
  Cc: bug-guile, guile-devel

Marius Vollmer wrote:
> Marius Vollmer <marius.vollmer@uni-dortmund.de> writes:
> 
> 
>>Neil Jerram <neil@ossau.uklinux.net> writes:
>>
>>
>>>And one more problem ... the same problem exists in CVS head, but a
>>>similar patch doesn't fix it ... still investigating.
>>
>>I'm looking into this as well, now.  The fix you did for 1.6 looks
>>good, although I don't understand it completely yet.  I will try to
>>come up with my own patch to CVS head.
> 
> 
> Here it is.  I have already applied it to CVS.  I think a similar
> scheme can be used for 1.6, too: i.e., move the offset calculation
> into scm_make_continuation.
> 
> Neil, do you want to fix 1.6 yourself?
> 
> [patch]

This change (calculating and storing the offset in 
scm_make_continuation) makes sense, but I'd like also to understand 
where the bug was in my version (using offset = (SCM_CONTREGS (stack) -> 
stack) - SCM_BASE (stack);) and why my code worked in 1.6 but not in 
head.  Would you mind explaining?

Thanks,
	Neil

PS. Merry Christmas!


_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-guile


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Can't make a stack from a continuation
  2004-12-24 23:05         ` Neil Jerram
@ 2004-12-24 23:11           ` Neil Jerram
  2004-12-24 23:22             ` Marius Vollmer
  2004-12-24 23:21           ` Marius Vollmer
  1 sibling, 1 reply; 12+ messages in thread
From: Neil Jerram @ 2004-12-24 23:11 UTC (permalink / raw)
  Cc: bug-guile, guile-devel

Neil Jerram wrote:

> This change (calculating and storing the offset in 
> scm_make_continuation) makes sense [...]

One more thing - are you happy with the proposed new tests for 1.6 and 
head?  I think one change is needed, namely to save and restore 
(debug-options) so that the effect of (debug-enable 'debug) can't affect 
other tests.

	Neil


_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-guile


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Can't make a stack from a continuation
  2004-12-24 23:05         ` Neil Jerram
  2004-12-24 23:11           ` Neil Jerram
@ 2004-12-24 23:21           ` Marius Vollmer
  2004-12-25 10:50             ` Neil Jerram
  1 sibling, 1 reply; 12+ messages in thread
From: Marius Vollmer @ 2004-12-24 23:21 UTC (permalink / raw)
  Cc: bug-guile, guile-devel

Neil Jerram <neil@ossau.uklinux.net> writes:

> This change (calculating and storing the offset in
> scm_make_continuation) makes sense, but I'd like also to understand
> where the bug was in my version (using offset = (SCM_CONTREGS
> (stack) -> stack) - SCM_BASE (stack);) and why my code worked in 1.6
> but not in head.  Would you mind explaining?

Hmm, I didn't really try to debug your patch.  I followed its idea of
also relocating dframe->vect and made the changes that seemed right.

Using offset = SCM_CONTREGS (stack)->stack - SCM_BASE(stack) looks
right.  The bug is probably elsewhere...

> PS. Merry Christmas!

Thanks and Merry Christmas from me to everyone as well!

(I got a high-tech electric iron in transparent iMac design from my
mom! :-)

-- 
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3  331E FAF8 226A D5D4 E405


_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-guile


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Can't make a stack from a continuation
  2004-12-24 23:11           ` Neil Jerram
@ 2004-12-24 23:22             ` Marius Vollmer
  2004-12-25 10:51               ` Neil Jerram
  0 siblings, 1 reply; 12+ messages in thread
From: Marius Vollmer @ 2004-12-24 23:22 UTC (permalink / raw)
  Cc: bug-guile, guile-devel

Neil Jerram <neil@ossau.uklinux.net> writes:

> One more thing - are you happy with the proposed new tests for 1.6 and
> head?

Yes.

> I think one change is needed, namely to save and restore
> (debug-options) so that the effect of (debug-enable 'debug) can't
> affect other tests.

Sounds good to me, too.  Could you add this?

-- 
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3  331E FAF8 226A D5D4 E405


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Can't make a stack from a continuation
  2004-12-24 23:21           ` Marius Vollmer
@ 2004-12-25 10:50             ` Neil Jerram
  0 siblings, 0 replies; 12+ messages in thread
From: Neil Jerram @ 2004-12-25 10:50 UTC (permalink / raw)
  Cc: bug-guile, guile-devel

Marius Vollmer wrote:
> 
> Hmm, I didn't really try to debug your patch.  I followed its idea of
> also relocating dframe->vect and made the changes that seemed right.
> 
> Using offset = SCM_CONTREGS (stack)->stack - SCM_BASE(stack) looks
> right.  The bug is probably elsewhere...

Fair enough, but when I compared your and my patches, they were 
identical except for

- the offset calculation and storage
- two occurrences of x->id instead of x[0].id.

And I thought that mine didn't work ...  Anyway, as long as yours does 
work now, it's probably not worth worrying about this further; it may be 
that I had an inconsistent build, or LD_LIBRARY not set properly, or 
something.

	Neil



_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-guile


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Can't make a stack from a continuation
  2004-12-24 23:22             ` Marius Vollmer
@ 2004-12-25 10:51               ` Neil Jerram
  2004-12-27 23:23                 ` Neil Jerram
  0 siblings, 1 reply; 12+ messages in thread
From: Neil Jerram @ 2004-12-25 10:51 UTC (permalink / raw)
  Cc: bug-guile, guile-devel

Marius Vollmer wrote:
> Neil Jerram <neil@ossau.uklinux.net> writes:
> 
> 
>>One more thing - are you happy with the proposed new tests for 1.6 and
>>head?
> 
> 
> Yes.
> 
> 
>>I think one change is needed, namely to save and restore
>>(debug-options) so that the effect of (debug-enable 'debug) can't
>>affect other tests.
> 
> 
> Sounds good to me, too.  Could you add this?

Yes, will do.  Probably not today, though :-)

	Neil




_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-guile


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Can't make a stack from a continuation
  2004-12-25 10:51               ` Neil Jerram
@ 2004-12-27 23:23                 ` Neil Jerram
  0 siblings, 0 replies; 12+ messages in thread
From: Neil Jerram @ 2004-12-27 23:23 UTC (permalink / raw)
  Cc: bug-guile, guile-devel

Neil Jerram wrote:
> 
> Yes, will do.  Probably not today, though :-)

This is now complete.  Two notes:

- In HEAD, I moved the new tests from eval.test to continuations.test, 
as the latter seems more appropriate.  (I only used eval.test in 1.6 in 
order to avoid having to create a new file.)

- In 1.6, scm_t_ptrdiff is not available, so I used long instead.

Regards,
	Neil


_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-guile


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2004-12-27 23:23 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-11-22 18:52 Can't make a stack from a continuation Neil Jerram
2004-11-25 19:43 ` Neil Jerram
2004-12-17  1:42   ` Neil Jerram
2004-12-23 14:24     ` Marius Vollmer
2004-12-23 15:36       ` Marius Vollmer
2004-12-24 23:05         ` Neil Jerram
2004-12-24 23:11           ` Neil Jerram
2004-12-24 23:22             ` Marius Vollmer
2004-12-25 10:51               ` Neil Jerram
2004-12-27 23:23                 ` Neil Jerram
2004-12-24 23:21           ` Marius Vollmer
2004-12-25 10:50             ` Neil Jerram

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).