[pure-lang-svn] SF.net SVN: pure-lang:[478] pure/trunk/runtime.cc
Status: Beta
Brought to you by:
agraef
From: <ag...@us...> - 2008-08-12 23:58:26
|
Revision: 478 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=478&view=rev Author: agraef Date: 2008-08-12 23:58:36 +0000 (Tue, 12 Aug 2008) Log Message: ----------- Separate stack and other kinds of tests for asynchronous exceptions. Modified Paths: -------------- pure/trunk/runtime.cc Modified: pure/trunk/runtime.cc =================================================================== --- pure/trunk/runtime.cc 2008-08-12 23:49:27 UTC (rev 477) +++ pure/trunk/runtime.cc 2008-08-12 23:58:36 UTC (rev 478) @@ -33,8 +33,12 @@ #include "config.h" #include "funcall.h" -// Hook to report stack overflows and other kinds of hard errors. -#define checkstk(test) if (interpreter::brkflag) \ +// Hooks to report stack overflows and other kinds of hard errors. +#define checkstk(test) if (interpreter::stackmax > 0 && \ + interpreter::stackdir*(&test - interpreter::baseptr) \ + >= interpreter::stackmax) \ + pure_throw(stack_exception()) +#define checkall(test) if (interpreter::brkflag) \ pure_throw(signal_exception(interpreter::brkflag)); \ else if (interpreter::stackmax > 0 && \ interpreter::stackdir*(&test - interpreter::baseptr) \ @@ -1158,7 +1162,7 @@ #endif assert(x->tag > 0 && x->refc > 0 && !x->data.clos->local); // parameterless call - checkstk(test); + checkall(test); return ((pure_expr*(*)())fp)(); } else { #if DEBUG>2 @@ -1254,7 +1258,7 @@ for (size_t j = 0; j < m; j++) cerr << "env#" << j << " = " << f0->data.clos->env[j] << " -> " << (void*)f0->data.clos->env[j] << ", refc = " << f0->data.clos->env[j]->refc << endl; #endif - checkstk(test); + checkall(test); if (m>0) xfuncall(ret, fp, n, env, argv) else This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |