[Commit] nickle execute.c,1.77,1.78 sched.c,1.47,1.48

Keith Packard commit@keithp.com
Fri May 30 07:18:54 PDT 2003


Committed by: keithp

Update of /local/src/CVS/nickle
In directory home.keithp.com:/tmp/cvs-serv31862

Modified Files:
	execute.c sched.c 
Log Message:
Make sure twixt exit blocks are run on unhandled exceptions

Index: execute.c
===================================================================
RCS file: /local/src/CVS/nickle/execute.c,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -d -r1.77 -r1.78
--- execute.c	16 Mar 2003 22:49:26 -0000	1.77
+++ execute.c	30 May 2003 06:18:51 -0000	1.78
@@ -1270,7 +1270,8 @@
 			if (aborting)
 			    break;
 			value = JumpContinue (thread, &next);
-			complete = True;
+			if (next)
+			    complete = True;
 		    }
 		    break;
 		case OpLeaveDone:
@@ -1279,7 +1280,8 @@
 			if (aborting)
 			    break;
 			value = JumpContinue (thread, &next);
-			complete = True;
+			if (next)
+			    complete = True;
 		    }
 		    break;
 		case OpFarJump:

Index: sched.c
===================================================================
RCS file: /local/src/CVS/nickle/sched.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -d -r1.47 -r1.48
--- sched.c	29 May 2003 18:36:35 -0000	1.47
+++ sched.c	30 May 2003 06:18:51 -0000	1.48
@@ -642,6 +642,17 @@
     RETURN (ret);
 }
 
+static ContinuationPtr
+EmptyContinuation (void)
+{
+    ENTER ();
+    Value   ret;
+
+    ret = ALLOCATE (&ContinuationRep.data, sizeof (Continuation));
+    ContinuationInit (&ret->continuation);
+    RETURN (&ret->continuation);
+}
+
 #ifdef DEBUG_JUMP
 
 void
@@ -789,6 +800,8 @@
 	running->thread.jump = 0;
 	*next = ContinuationSet (&thread->thread.continuation, jump->continuation);
     }
+    if (!*next)
+	SetSignalError ();
     RETURN (jump->ret);
 }
 
@@ -859,6 +872,8 @@
 	*next = JumpStart (thread, continuation, ret);
     else
 	*next = ContinuationSet (&thread->thread.continuation, continuation);
+    if (!*next)
+        SetSignalError ();
     RETURN (ret);
 }
 
@@ -980,8 +995,8 @@
 RaiseException (Value thread, SymbolPtr except, Value args, InstPtr *next)
 {
     ENTER ();
-    Bool	caught = False;
-    CatchPtr	catch;
+    CatchPtr	    catch;
+    ContinuationPtr continuation = 0;
     
     for (catch = thread->thread.continuation.catches; 
 	 catch; 
@@ -989,12 +1004,12 @@
     {
 	if (catch->exception == except)
 	{
-	    ContinuationJump (thread, &catch->continuation, args, next);
-	    caught = True;
+	    continuation = &catch->continuation;
 	    break;
 	}
     }
-    if (!caught)
+    /* unhandled exception -- build an empty continuation and jump to it */
+    if (!continuation)
     {
 	int	i;
 	ObjPtr	obj = thread->thread.continuation.obj;
@@ -1012,8 +1027,9 @@
 	    for (i = 0; i < args->array.ents; i++)
 		PrintError ("\t%v\n", BoxValueGet (args->array.values, i));
 	}
-	SetSignalError ();
+	continuation = EmptyContinuation();
     }
+    ContinuationJump (thread, continuation, args, next);
     EXIT ();
 }
 





More information about the Commit mailing list