diff --git a/src/funcs.c b/src/funcs.c index 9868d90277..9a00f97dc7 100644 --- a/src/funcs.c +++ b/src/funcs.c @@ -93,7 +93,6 @@ static UInt ExecProccallOpts(Stat call) { Obj opts; - SET_BRK_CURR_STAT( call ); opts = EVAL_EXPR(READ_STAT(call, 0)); CALL_1ARGS(PushOptions, opts); @@ -131,8 +130,6 @@ static ALWAYS_INLINE Obj EvalOrExecCall(Int ignoreResult, UInt nr, Stat call) Obj result; // evaluate the function - if (ignoreResult) - SET_BRK_CURR_STAT( call ); func = EVAL_EXPR( FUNC_CALL( call ) ); // evaluate the arguments @@ -426,16 +423,6 @@ void RecursionDepthTrap( void ) #endif -static void ExecFuncHelper(void) -{ - OLD_BRK_CURR_STAT // old executing statement - - // execute the statement sequence - REM_BRK_CURR_STAT(); - EXEC_STAT( OFFSET_FIRST_STAT ); - RES_BRK_CURR_STAT(); -} - static Obj PopReturnObjStat(void) { Obj returnObjStat = STATE(ReturnObjStat); @@ -500,7 +487,7 @@ static ALWAYS_INLINE Obj DoExecFunc(Obj func, Int narg, const Obj *arg) ASS_LVAR( i+1, arg[i] ); /* execute the statement sequence */ - ExecFuncHelper(); + EXEC_STAT( OFFSET_FIRST_STAT ); #ifdef HPCGAP CLEAR_LOCK_STACK(); #endif @@ -588,7 +575,7 @@ static Obj DoExecFuncXargs(Obj func, Obj args) } /* execute the statement sequence */ - ExecFuncHelper(); + EXEC_STAT( OFFSET_FIRST_STAT ); #ifdef HPCGAP CLEAR_LOCK_STACK(); #endif @@ -641,7 +628,7 @@ static Obj DoPartialUnWrapFunc(Obj func, Obj args) ASS_LVAR(named+1, args); /* execute the statement sequence */ - ExecFuncHelper(); + EXEC_STAT( OFFSET_FIRST_STAT ); #ifdef HPCGAP CLEAR_LOCK_STACK(); #endif diff --git a/src/stats.c b/src/stats.c index b43643b5b8..fa44ed743a 100644 --- a/src/stats.c +++ b/src/stats.c @@ -211,7 +211,6 @@ UInt ExecIf ( Stat body; /* body */ /* if the condition evaluates to 'true', execute the if-branch body */ - SET_BRK_CURR_STAT( stat ); cond = READ_STAT(stat, 0); if ( EVAL_BOOL_EXPR( cond ) != False ) { @@ -232,7 +231,6 @@ UInt ExecIfElse ( Stat body; /* body */ /* if the condition evaluates to 'true', execute the if-branch body */ - SET_BRK_CURR_STAT( stat ); cond = READ_STAT(stat, 0); if ( EVAL_BOOL_EXPR( cond ) != False ) { @@ -262,7 +260,6 @@ UInt ExecIfElif ( for ( i = 1; i <= nr; i++ ) { /* if the condition evaluates to 'true', execute the branch body */ - SET_BRK_CURR_STAT( stat ); cond = READ_STAT(stat, 2 * (i - 1)); if ( EVAL_BOOL_EXPR( cond ) != False ) { @@ -293,7 +290,6 @@ UInt ExecIfElifElse ( for ( i = 1; i <= nr; i++ ) { /* if the condition evaluates to 'true', execute the branch body */ - SET_BRK_CURR_STAT( stat ); cond = READ_STAT(stat, 2 * (i - 1)); if ( EVAL_BOOL_EXPR( cond ) != False ) { @@ -371,7 +367,6 @@ static ALWAYS_INLINE UInt ExecForHelper(Stat stat, UInt nr) } /* evaluate the list */ - SET_BRK_CURR_STAT( stat ); list = EVAL_EXPR(READ_STAT(stat, 1)); /* get the body */ @@ -513,7 +508,6 @@ static ALWAYS_INLINE UInt ExecForRangeHelper(Stat stat, UInt nr) lvar = LVAR_REFLVAR(READ_STAT(stat, 0)); /* evaluate the range */ - SET_BRK_CURR_STAT( stat ); VisitStatIfHooked(READ_STAT(stat, 1)); elm = EVAL_EXPR(READ_EXPR(READ_STAT(stat, 1), 0)); while ( ! IS_INTOBJ(elm) ) { @@ -593,7 +587,6 @@ UInt ExecAtomic(Stat stat) UInt nrexprs,i,j,status; Obj o; - SET_BRK_CURR_STAT( stat ); nrexprs = ((SIZE_STAT(stat)/sizeof(Stat))-1)/2; j = 0; @@ -680,7 +673,6 @@ static ALWAYS_INLINE UInt ExecWhileHelper(Stat stat, UInt nr) body3 = (nr >= 3) ? READ_STAT(stat, 3) : 0; /* while the condition evaluates to 'true', execute the body */ - SET_BRK_CURR_STAT( stat ); while ( EVAL_BOOL_EXPR( cond ) != False ) { #if !defined(HAVE_SIGNAL) @@ -697,8 +689,6 @@ static ALWAYS_INLINE UInt ExecWhileHelper(Stat stat, UInt nr) if (nr >= 3) EXEC_STAT_IN_LOOP(body3); - SET_BRK_CURR_STAT( stat ); - } /* return 0 (to indicate that no leave-statement was executed) */ @@ -754,7 +744,6 @@ static ALWAYS_INLINE UInt ExecRepeatHelper(Stat stat, UInt nr) body3 = (nr >= 3) ? READ_STAT(stat, 3) : 0; /* execute the body until the condition evaluates to 'true' */ - SET_BRK_CURR_STAT( stat ); do { #if !defined(HAVE_SIGNAL) @@ -771,8 +760,6 @@ static ALWAYS_INLINE UInt ExecRepeatHelper(Stat stat, UInt nr) if (nr >= 3) EXEC_STAT_IN_LOOP(body3); - SET_BRK_CURR_STAT( stat ); - } while ( EVAL_BOOL_EXPR( cond ) == False ); /* return 0 (to indicate that no leave-statement was executed) */ @@ -872,9 +859,6 @@ UInt ExecInfo ( selectors = EVAL_EXPR( ARGI_INFO( stat, 1 ) ); level = EVAL_EXPR( ARGI_INFO( stat, 2) ); - SET_BRK_CALL_TO( stat ); - SET_BRK_CURR_STAT( stat ); - selected = InfoCheckLevel(selectors, level); if (selected == True) { @@ -919,9 +903,6 @@ UInt ExecAssert2Args ( Obj level; Obj decision; - SET_BRK_CURR_STAT( stat ); - SET_BRK_CALL_TO( stat ); - level = EVAL_EXPR(READ_STAT(stat, 0)); if ( ! LT(CurrentAssertionLevel, level) ) { decision = EVAL_EXPR(READ_STAT(stat, 1)); @@ -932,7 +913,6 @@ UInt ExecAssert2Args ( "you may 'return true;' or 'return false;'"); } if ( decision == False ) { - SET_BRK_CURR_STAT( stat ); ErrorReturnVoid( "Assertion failure", 0L, 0L, "you may 'return;'"); } } @@ -955,9 +935,6 @@ UInt ExecAssert3Args ( Obj decision; Obj message; - SET_BRK_CURR_STAT( stat ); - SET_BRK_CALL_TO( stat ); - level = EVAL_EXPR(READ_STAT(stat, 0)); if ( ! LT(CurrentAssertionLevel, level) ) { decision = EVAL_EXPR(READ_STAT(stat, 1)); @@ -970,6 +947,7 @@ UInt ExecAssert3Args ( if ( decision == False ) { message = EVAL_EXPR(READ_STAT(stat, 2)); if ( message != (Obj) 0 ) { + SET_BRK_CALL_TO( stat ); if (IS_STRING_REP( message )) PrintString1( message ); else @@ -1006,7 +984,6 @@ UInt ExecReturnObj ( #endif /* evaluate the expression */ - SET_BRK_CURR_STAT( stat ); STATE(ReturnObjStat) = EVAL_EXPR(READ_STAT(stat, 0)); /* return up to function interpreter */ @@ -1118,7 +1095,6 @@ UInt ExecIntrStat ( HaveInterrupt(); /* and now for something completely different */ - SET_BRK_CURR_STAT( stat ); if ( SyStorOverrun != 0 ) { SyStorOverrun = 0; /* reset */ ErrorReturnVoid( diff --git a/src/stats.h b/src/stats.h index a74991f45a..e0cb4fd3e1 100644 --- a/src/stats.h +++ b/src/stats.h @@ -62,19 +62,6 @@ extern UInt EXEC_STAT(Stat stat); extern UInt (* IntrExecStatFuncs[256]) ( Stat stat ); -/**************************************************************************** -** -*F SET_BRK_CURR_STAT() . . . . . . . set currently executing statement -*F OLD_BRK_CURR_STAT . . . . . . . . . define variable to remember CurrStat -*F REM_BRK_CURR_STAT() . . . . . . . remember currently executing statement -*F RES_BRK_CURR_STAT() . . . . . . . . restore currently executing statement -*/ -#define SET_BRK_CURR_STAT(stat) do {} while (0) /* do nothing */ -#define OLD_BRK_CURR_STAT do {} while (0) /* do nothing */ ; -#define REM_BRK_CURR_STAT() do {} while (0) /* do nothing */ -#define RES_BRK_CURR_STAT() do {} while (0) /* do nothing */ - - /**************************************************************************** ** *V ReturnObjStat . . . . . . . . . . . . . . . . result of return-statement diff --git a/src/vars.c b/src/vars.c index 0caa7b525c..a50e217d9d 100644 --- a/src/vars.c +++ b/src/vars.c @@ -163,7 +163,6 @@ UInt ExecAssLVar ( Obj rhs; /* value of right hand side */ /* assign the right hand side to the local variable */ - SET_BRK_CURR_STAT( stat ); rhs = EVAL_EXPR(READ_STAT(stat, 1)); ASS_LVAR(READ_STAT(stat, 0), rhs); @@ -320,7 +319,6 @@ UInt ExecAssHVar ( Obj rhs; /* value of right hand side */ /* assign the right hand side to the higher variable */ - SET_BRK_CURR_STAT( stat ); rhs = EVAL_EXPR(READ_STAT(stat, 1)); ASS_HVAR(READ_STAT(stat, 0), rhs); @@ -436,7 +434,6 @@ UInt ExecAssGVar ( Obj rhs; /* value of right hand side */ /* assign the right hand side to the global variable */ - SET_BRK_CURR_STAT( stat ); rhs = EVAL_EXPR(READ_STAT(stat, 1)); AssGVar(READ_STAT(stat, 0), rhs); @@ -554,7 +551,6 @@ UInt ExecAssList ( Obj rhs; /* right hand side, right operand */ /* evaluate the list (checking is done by 'ASS_LIST') */ - SET_BRK_CURR_STAT( stat ); list = EVAL_EXPR(READ_STAT(stat, 0)); /* evaluate the position */ @@ -603,7 +599,6 @@ UInt ExecAss2List ( Obj rhs; /* right hand side, right operand */ /* evaluate the list (checking is done by 'ASS_LIST') */ - SET_BRK_CURR_STAT( stat ); list = EVAL_EXPR(READ_STAT(stat, 0)); /* evaluate the position */ @@ -635,7 +630,6 @@ UInt ExecAsssList ( Obj rhss; /* right hand sides, right operand */ /* evaluate the list (checking is done by 'ASSS_LIST') */ - SET_BRK_CURR_STAT( stat ); list = EVAL_EXPR(READ_STAT(stat, 0)); /* evaluate and check the positions */ @@ -681,7 +675,6 @@ UInt ExecAssListLevel ( /* evaluate lists (if this works, then is nested deep, */ /* checking it is nested +1 deep is done by 'AssListLevel') */ - SET_BRK_CURR_STAT( stat ); lists = EVAL_EXPR(READ_STAT(stat, 0)); narg = SIZE_STAT(stat)/sizeof(Stat) -3; ixs = NEW_PLIST(T_PLIST, narg); @@ -730,7 +723,6 @@ UInt ExecAsssListLevel ( /* evaluate lists (if this works, then is nested deep, */ /* checking it is nested +1 deep is done by 'AsssListLevel') */ - SET_BRK_CURR_STAT( stat ); lists = EVAL_EXPR(READ_STAT(stat, 0)); /* evaluate and check the positions */ @@ -768,7 +760,6 @@ UInt ExecUnbList ( Int i; /* evaluate the list (checking is done by 'LEN_LIST') */ - SET_BRK_CURR_STAT( stat ); list = EVAL_EXPR(READ_STAT(stat, 0)); narg = SIZE_STAT(stat)/sizeof(Stat) - 1; if (narg == 1) { @@ -1207,7 +1198,6 @@ UInt ExecAssRecName ( Obj rhs; /* rhs, right operand */ /* evaluate the record (checking is done by 'ASS_REC') */ - SET_BRK_CURR_STAT( stat ); record = EVAL_EXPR(READ_STAT(stat, 0)); /* get the name (stored immediately in the statement) */ @@ -1239,7 +1229,6 @@ UInt ExecAssRecExpr ( Obj rhs; /* rhs, right operand */ /* evaluate the record (checking is done by 'ASS_REC') */ - SET_BRK_CURR_STAT( stat ); record = EVAL_EXPR(READ_STAT(stat, 0)); /* evaluate the name and convert it to a record name */ @@ -1270,7 +1259,6 @@ UInt ExecUnbRecName ( UInt rnam; /* name, left operand */ /* evaluate the record (checking is done by 'UNB_REC') */ - SET_BRK_CURR_STAT( stat ); record = EVAL_EXPR(READ_STAT(stat, 0)); /* get the name (stored immediately in the statement) */ @@ -1298,7 +1286,6 @@ UInt ExecUnbRecExpr ( UInt rnam; /* name, left operand */ /* evaluate the record (checking is done by 'UNB_REC') */ - SET_BRK_CURR_STAT( stat ); record = EVAL_EXPR(READ_STAT(stat, 0)); /* evaluate the name and convert it to a record name */ @@ -1558,7 +1545,6 @@ UInt ExecAssPosObj ( Obj rhs; /* right hand side, right operand */ /* evaluate the list (checking is done by 'ASS_LIST') */ - SET_BRK_CURR_STAT( stat ); list = EVAL_EXPR(READ_STAT(stat, 0)); /* evaluate and check the position */ @@ -1612,7 +1598,6 @@ UInt ExecUnbPosObj ( Int p; /* position, as a C integer */ /* evaluate the list (checking is done by 'LEN_LIST') */ - SET_BRK_CURR_STAT( stat ); list = EVAL_EXPR(READ_STAT(stat, 0)); /* evaluate and check the position */ @@ -1850,7 +1835,6 @@ UInt ExecAssComObjName ( Obj rhs; /* rhs, right operand */ /* evaluate the record (checking is done by 'ASS_REC') */ - SET_BRK_CURR_STAT( stat ); record = EVAL_EXPR(READ_STAT(stat, 0)); /* get the name (stored immediately in the statement) */ @@ -1906,7 +1890,6 @@ UInt ExecAssComObjExpr ( Obj rhs; /* rhs, right operand */ /* evaluate the record (checking is done by 'ASS_REC') */ - SET_BRK_CURR_STAT( stat ); record = EVAL_EXPR(READ_STAT(stat, 0)); /* evaluate the name and convert it to a record name */ @@ -1949,7 +1932,6 @@ UInt ExecUnbComObjName ( UInt rnam; /* name, left operand */ /* evaluate the record (checking is done by 'UNB_REC') */ - SET_BRK_CURR_STAT( stat ); record = EVAL_EXPR(READ_STAT(stat, 0)); /* get the name (stored immediately in the statement) */ @@ -1989,7 +1971,6 @@ UInt ExecUnbComObjExpr ( UInt rnam; /* name, left operand */ /* evaluate the record (checking is done by 'UNB_REC') */ - SET_BRK_CURR_STAT( stat ); record = EVAL_EXPR(READ_STAT(stat, 0)); /* evaluate the name and convert it to a record name */ diff --git a/tst/testspecial/bad-array-int-0.g.out b/tst/testspecial/bad-array-int-0.g.out index c5ca3fbd32..dba95bc6cf 100644 --- a/tst/testspecial/bad-array-int-0.g.out +++ b/tst/testspecial/bad-array-int-0.g.out @@ -7,7 +7,7 @@ function( ) ... end gap> f(); Error, no method found! For debugging hints type ?Recovery from NoMethodFound Error, no 1st choice method found for `[]' on 2 arguments at GAPROOT/lib/methsel2.g:250 called from -l[0] at *stdin*:5 called from +return l[0]; at *stdin*:5 called from ( ) called from read-eval loop at *stdin*:7 type 'quit;' to quit to outer loop diff --git a/tst/testspecial/bad-array-int-1.g.out b/tst/testspecial/bad-array-int-1.g.out index 78718c95cf..026a7cf242 100644 --- a/tst/testspecial/bad-array-int-1.g.out +++ b/tst/testspecial/bad-array-int-1.g.out @@ -4,7 +4,7 @@ gap> f := function() function( ) ... end gap> f(); Error, List Element: must be a list (not a integer) in - 1[1] at *stdin*:3 called from + return 1[1]; at *stdin*:3 called from ( ) called from read-eval loop at *stdin*:5 you can replace via 'return ;' diff --git a/tst/testspecial/bad-array-string.g.out b/tst/testspecial/bad-array-string.g.out index 77bd95cebc..18c1377a63 100644 --- a/tst/testspecial/bad-array-string.g.out +++ b/tst/testspecial/bad-array-string.g.out @@ -5,7 +5,7 @@ function( ) ... end gap> f(); Error, no method found! For debugging hints type ?Recovery from NoMethodFound Error, no 1st choice method found for `[]' on 2 arguments at GAPROOT/lib/methsel2.g:250 called from -1["abc"] at *stdin*:3 called from +return 1["abc"]; at *stdin*:3 called from ( ) called from read-eval loop at *stdin*:5 type 'quit;' to quit to outer loop