Skip to content

Commit

Permalink
kernel: replace SET_CURR_LVARS by SWITCH_TO_OLD_LVARS
Browse files Browse the repository at this point in the history
The only difference was a CHANGED_BAG call
  • Loading branch information
fingolfin committed Aug 23, 2018
1 parent b0e7c27 commit 941efa6
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 26 deletions.
3 changes: 0 additions & 3 deletions src/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@ VoidFunc debug_func_pointers[] = {
(VoidFunc)SET_PTR_BAG,
(VoidFunc)SET_RNAM_PREC,
(VoidFunc)SET_VAL_MACFLOAT,
(VoidFunc)SetBrkCallTo,
(VoidFunc)SHRINK_PLIST,
(VoidFunc)SHRINK_STRING,
(VoidFunc)SIZE_BAG,
Expand All @@ -236,8 +235,6 @@ VoidFunc debug_func_pointers[] = {
(VoidFunc)SIZE_PLEN_BLIST,
(VoidFunc)SIZEBAG_STRINGLEN,
(VoidFunc)SwitchToNewLvars,
(VoidFunc)SwitchToOldLVars,
(VoidFunc)SwitchToOldLVarsAndFree,
(VoidFunc)TEST_OBJ_FLAG,
(VoidFunc)TNAM_OBJ,
(VoidFunc)TNUM_BAG,
Expand Down
2 changes: 1 addition & 1 deletion src/error.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ Obj FuncCALL_WITH_CATCH(Obj self, Obj func, volatile Obj args)
SET_ELM_PLIST(res, 2, STATE(ThrownObject));
CHANGED_BAG(res);
STATE(ThrownObject) = 0;
SET_CURR_LVARS(currLVars);
SWITCH_TO_OLD_LVARS(currLVars);
STATE(CurrStat) = currStat;
SetRecursionDepth(recursionDepth);
#ifdef HPCGAP
Expand Down
10 changes: 5 additions & 5 deletions src/read.c
Original file line number Diff line number Diff line change
Expand Up @@ -1272,7 +1272,7 @@ static void ReadFuncExprBody(
if (nrError == 0 && STATE(IntrCoding)) {
CodeEnd(1);
STATE(IntrCoding)--;
SET_CURR_LVARS(currLVars);
SWITCH_TO_OLD_LVARS(currLVars);
}
}

Expand Down Expand Up @@ -2078,7 +2078,7 @@ static void ReadFor (
if ( nrError == 0 && STATE(IntrCoding) ) {
CodeEnd(1);
STATE(IntrCoding)--;
SET_CURR_LVARS(currLVars);
SWITCH_TO_OLD_LVARS(currLVars);
}
}
}
Expand Down Expand Up @@ -2132,7 +2132,7 @@ static void ReadWhile (
if ( nrError == 0 && STATE(IntrCoding) ) {
CodeEnd(1);
STATE(IntrCoding)--;
SET_CURR_LVARS(currLVars);
SWITCH_TO_OLD_LVARS(currLVars);
}
}
}
Expand Down Expand Up @@ -2210,7 +2210,7 @@ static void ReadAtomic (
if ( nrError == 0 && STATE(IntrCoding) ) {
CodeEnd(1);
STATE(IntrCoding)--;
SET_CURR_LVARS(currLVars);
SWITCH_TO_OLD_LVARS(currLVars);
}
}
#ifdef HPCGAP
Expand Down Expand Up @@ -2268,7 +2268,7 @@ static void ReadRepeat (
if ( nrError == 0 && STATE(IntrCoding) ) {
CodeEnd(1);
STATE(IntrCoding)--;
SET_CURR_LVARS(currLVars);
SWITCH_TO_OLD_LVARS(currLVars);
}
}
}
Expand Down
1 change: 0 additions & 1 deletion src/stats.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#ifndef GAP_STATS_H
#define GAP_STATS_H

#include "code.h"
#include "gapstate.h"

/****************************************************************************
Expand Down
26 changes: 10 additions & 16 deletions src/vars.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,19 +185,6 @@ static inline void MakeHighVars( Bag bag ) {
}


/****************************************************************************
**
*F SET_CURR_LVARS
*/
static void SET_CURR_LVARS(Obj lvars)
{
GAP_ASSERT(IS_LVARS_OR_HVARS(lvars));
STATE(CurrLVars) = lvars;
STATE(PtrLVars) = PTR_BAG(lvars);
STATE(PtrBody) = (Stat *)PTR_BAG(BODY_FUNC(CURR_FUNC()));
}


/****************************************************************************
**
*F SWITCH_TO_NEW_LVARS( <func>, <narg>, <nloc>, <old> ) . . . . . new local
Expand All @@ -220,7 +207,9 @@ static inline Obj SwitchToNewLvars(Obj func, UInt narg, UInt nloc)
hdr->parent = old;

// switch to new lvars
SET_CURR_LVARS(new_lvars);
STATE(CurrLVars) = new_lvars;
STATE(PtrLVars) = (Obj *)hdr;
STATE(PtrBody) = (Stat *)ADDR_OBJ(BODY_FUNC(func));

return old;
}
Expand All @@ -236,8 +225,13 @@ static inline Obj SwitchToNewLvars(Obj func, UInt narg, UInt nloc)
*/
static inline void SWITCH_TO_OLD_LVARS(Obj old)
{
CHANGED_BAG( STATE(CurrLVars) );
SET_CURR_LVARS(old);
CHANGED_BAG(STATE(CurrLVars));

GAP_ASSERT(IS_LVARS_OR_HVARS(old));
LVarsHeader * hdr = (LVarsHeader *)ADDR_OBJ(old);
STATE(CurrLVars) = old;
STATE(PtrLVars) = (Obj *)hdr;
STATE(PtrBody) = (Stat *)ADDR_OBJ(BODY_FUNC(hdr->func));
}

static inline void SWITCH_TO_OLD_LVARS_AND_FREE(Obj old)
Expand Down

0 comments on commit 941efa6

Please sign in to comment.