Skip to content

Commit

Permalink
Make profiling correctly handle the same file being opened multiple t…
Browse files Browse the repository at this point in the history
…imes
  • Loading branch information
ChrisJefferson committed Jan 11, 2017
1 parent 8bfff63 commit 2f1c569
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/code.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@

#include "code.h" /* coder */

#include "bool.h" /* For fail */

#include "saveload.h" /* saving and loading */
#include "read.h" /* to access stack of for loop globals */
#include "gvars.h"
Expand Down Expand Up @@ -120,14 +122,21 @@ static inline void PopLoopNesting( void ) {
static inline void setup_gapname(TypInputFile* i)
{
UInt len;
Obj pos;
if(!i->gapname) {
C_NEW_STRING_DYN(i->gapname, i->name);
len = LEN_PLIST( FilenameCache );
GROW_PLIST( FilenameCache, len+1 );
SET_LEN_PLIST( FilenameCache, len+1 );
SET_ELM_PLIST( FilenameCache, len+1, i->gapname );
CHANGED_BAG( FilenameCache );
i->gapnameid = len+1;
pos = POS_LIST( FilenameCache, i->gapname, INTOBJ_INT(1) );
if(pos == Fail) {
len = LEN_PLIST( FilenameCache );
GROW_PLIST( FilenameCache, len+1 );
SET_LEN_PLIST( FilenameCache, len+1 );
SET_ELM_PLIST( FilenameCache, len+1, i->gapname );
CHANGED_BAG( FilenameCache );
i->gapnameid = len + 1;
}
else {
i->gapnameid = INT_INTOBJ(pos);
}
}
}

Expand Down

0 comments on commit 2f1c569

Please sign in to comment.