Skip to content

Commit

Permalink
- Fix some issues by not adding aliased functions to the cache
Browse files Browse the repository at this point in the history
  • Loading branch information
sjoelund committed Oct 8, 2010
1 parent 09af3e7 commit 4e21b07
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions Compiler/Env.mo
Expand Up @@ -2297,27 +2297,29 @@ end getFunctionTree;
public function addCachedInstFuncGuard
"adds the FQ path to the set of instantiated functions as NONE().
This guards against recursive functions."
input Cache inCache;
input Cache cache;
input Absyn.Path func "fully qualified function name";
output Cache outCache;
algorithm
outCache := matchcontinue(inCache,func)
outCache := matchcontinue(cache,func)
local
Option<EnvCache>[:] envCache;
DAE.FunctionTree[:] ef;
Absyn.ComponentRef cr;
Option<Env> ienv;

/* Don't overwrite SOME() with NONE() */
case (inCache, func)
case (cache, func)
equation
checkCachedInstFuncGuard(inCache, func);
then inCache;
checkCachedInstFuncGuard(cache, func);
then cache;

case (CACHE(envCache,ienv,ef),func)
case (CACHE(envCache,ienv,ef),func as Absyn.FULLYQUALIFIED(_))
equation
ef = arrayUpdate(ef,1,DAEUtil.avlTreeAdd(arrayGet(ef, 1),func,NONE()));
then CACHE(envCache,ienv,ef);
// Non-FQ paths mean aliased functions; do not add these to the cache
case (cache,_) then (cache);
end matchcontinue;
end addCachedInstFuncGuard;

Expand Down

0 comments on commit 4e21b07

Please sign in to comment.