Skip to content

Commit

Permalink
- Changed Env.Cache to use array<>-notation instead of [:]
Browse files Browse the repository at this point in the history
  • Loading branch information
sjoelund committed Oct 14, 2010
1 parent 8628d90 commit 7cafae4
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 22 deletions.
44 changes: 23 additions & 21 deletions Compiler/Env.mo
Expand Up @@ -91,9 +91,9 @@ public type Env = list<Frame> "an environment is a list of frames";

public uniontype Cache
record CACHE
Option<EnvCache>[:] envCache "The cache contains of environments from which classes can be found";
array<Option<EnvCache>> envCache "The cache contains of environments from which classes can be found";
Option<Env> initialEnv "and the initial environment";
DAE.FunctionTree[:] functions "set of Option<DAE.Function>; NONE() means instantiation started; SOME() means it's finished";
array<DAE.FunctionTree> functions "set of Option<DAE.Function>; NONE() means instantiation started; SOME() means it's finished";
end CACHE;
end Cache;

Expand Down Expand Up @@ -193,8 +193,8 @@ public function emptyCache
"returns an empty cache"
output Cache cache;
protected
Option<EnvCache>[:] arr;
DAE.FunctionTree[:] instFuncs;
array<Option<EnvCache>> arr;
array<DAE.FunctionTree> instFuncs;
algorithm
//print("EMPTYCACHE\n");
arr := listArray({NONE});
Expand Down Expand Up @@ -1195,8 +1195,8 @@ public function setCachedInitialEnv "set the initial environment in the cache"
algorithm
outCache := matchcontinue(inCache,env)
local
Option<EnvCache>[:] envCache;
DAE.FunctionTree[:] ef;
array<Option<EnvCache>> envCache;
array<DAE.FunctionTree> ef;

case (CACHE(envCache,_,ef),env) equation
// print("setCachedInitialEnv\n");
Expand All @@ -1211,8 +1211,10 @@ public function cacheGet "Get an environment from the cache."
output Env env;
algorithm
env:= matchcontinue(scope,path,cache)
local CacheTree tree; Option<EnvCache>[:] arr;
DAE.FunctionTree[:] ef;
local
CacheTree tree;
array<Option<EnvCache>> arr;
array<DAE.FunctionTree> ef;
case (scope,path,CACHE(arr ,_,ef))
equation
true = OptManager.getOption("envCache");
Expand All @@ -1233,8 +1235,8 @@ algorithm
outCache := matchcontinue(fullpath,inCache,env)
local CacheTree tree;
Option<Env> ie;
Option<EnvCache>[:] arr;
DAE.FunctionTree[:] ef;
array<Option<EnvCache>> arr;
array<DAE.FunctionTree> ef;
case(_,inCache,env) equation
false = OptManager.getOption("envCache");
then inCache;
Expand Down Expand Up @@ -1509,8 +1511,8 @@ algorithm
str := matchcontinue(cache)
local
CacheTree tree;
Option<EnvCache>[:] arr;
DAE.FunctionTree[:] ef;
array<Option<EnvCache>> arr;
array<DAE.FunctionTree> ef;
String s,s2;

// some cache present
Expand Down Expand Up @@ -2318,7 +2320,7 @@ public function getFunctionTree
"Selector function"
input Cache cache;
output DAE.FunctionTree ft;
DAE.FunctionTree[:] ef;
array<DAE.FunctionTree> ef;
algorithm
CACHE(functions = ef) := cache;
ft := arrayGet(ef, 1);
Expand All @@ -2333,8 +2335,8 @@ This guards against recursive functions."
algorithm
outCache := matchcontinue(cache,func)
local
Option<EnvCache>[:] envCache;
DAE.FunctionTree[:] ef;
array<Option<EnvCache>> envCache;
array<DAE.FunctionTree> ef;
Absyn.ComponentRef cr;
Option<Env> ienv;

Expand All @@ -2361,8 +2363,8 @@ public function addDaeFunction
algorithm
outCache := matchcontinue(inCache,funcs)
local
Option<EnvCache>[:] envCache;
DAE.FunctionTree[:] ef;
array<Option<EnvCache>> envCache;
array<DAE.FunctionTree> ef;
Option<Env> ienv;
case (CACHE(envCache,ienv,ef),funcs)
equation
Expand All @@ -2379,8 +2381,8 @@ public function addDaeExtFunction
algorithm
outCache := matchcontinue(inCache,funcs)
local
Option<EnvCache>[:] envCache;
DAE.FunctionTree[:] ef;
array<Option<EnvCache>> envCache;
array<DAE.FunctionTree> ef;
Option<Env> ienv;
case (CACHE(envCache,ienv,ef),funcs)
equation
Expand All @@ -2397,7 +2399,7 @@ public function getCachedInstFunc
algorithm
func := matchcontinue(inCache,path)
local
DAE.FunctionTree[:] ef;
array<DAE.FunctionTree> ef;
case(CACHE(functions=ef),path)
equation
SOME(func) = DAEUtil.avlTreeGet(arrayGet(ef,1),path);
Expand All @@ -2412,7 +2414,7 @@ public function checkCachedInstFuncGuard
algorithm
_ := matchcontinue(inCache,path)
local
DAE.FunctionTree[:] ef;
array<DAE.FunctionTree> ef;
case(CACHE(functions=ef),path) equation
_ = DAEUtil.avlTreeGet(arrayGet(ef,1),path);
then ();
Expand Down
2 changes: 1 addition & 1 deletion Compiler/Main.mo
Expand Up @@ -735,7 +735,7 @@ protected function runBackendQ
It should be run if either \"blt\" flag is set or if
parallelization is enabled by giving flag -n=<no proc.>"
output Boolean res_1;
Boolean bltflag,sim_cg,par,res,res_1;
Boolean bltflag,sim_cg,par,res;
Integer n;
algorithm
bltflag := RTOpts.debugFlag("blt");
Expand Down

0 comments on commit 7cafae4

Please sign in to comment.