Skip to content

Commit

Permalink
- use setGlobalRoot/getGlobalRoot instead of System.addToRoots/getFro…
Browse files Browse the repository at this point in the history
…mRoots

- use Inst.instHashIndex instead of 0 in the set/getGlobalRoot
- you will need a new MetaModelica/RML (or OMDev) to be able to compile/run:
  OMDEV: http://www.ida.liu.se/~adrpo/omc/omdev/mingw/OMDev-mingw-msvc-2010-10-26-revision-181.zip
  MetaModelica/RML for Linux, revision 181.

git-svn-id: https://openmodelica.org/svn/OpenModelica/branches/sjoelund-functiontree@6638 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adrpo committed Oct 27, 2010
1 parent 89c0167 commit 08f1470
Show file tree
Hide file tree
Showing 6 changed files with 2,318 additions and 2,318 deletions.
6 changes: 3 additions & 3 deletions Compiler/Ceval.mo
Expand Up @@ -1431,7 +1431,7 @@ algorithm
false = RTOpts.debugFlag("nogen");
failure(cevalIsExternalObjectConstructor(cache,funcpath,env));
// we might actually have a function loaded here already!
cevalHashTable = System.getFromRoots(2);
cevalHashTable = getGlobalRoot(2);
// see if we have it in the ceval cache
Interactive.CFunction(funcHandle=funcHandle, buildTime=buildTime, loadedFromFile=fOld) = get(funcpath, cevalHashTable);
funcstr = ModUtil.pathStringReplaceDot(funcpath, "_");
Expand All @@ -1455,10 +1455,10 @@ algorithm
System.freeFunction(funcHandle);
System.freeLibrary(libHandle);
// add to cache!
//cevalHashTable = System.getFromRoots(2);
//cevalHashTable = getGlobalRoot(2);
//buildTime = System.getCurrentTime();
//cevalHashTable = add((funcpath,Interactive.CFunction(funcpath,(DAE.T_NOTYPE(),SOME(funcpath)),funcHandle,buildTime,"")), cevalHashTable);
//System.addToRoots(2, cevalHashTable);
//setGlobalRoot(2, cevalHashTable);
then
(cache,newval,NONE());

Expand Down
2 changes: 1 addition & 1 deletion Compiler/CevalScript.mo
Expand Up @@ -4144,7 +4144,7 @@ algorithm
case (cache,env,className,(st as Interactive.SYMBOLTABLE(ast = p,explodedAst = sp,instClsLst = ic,lstVarVal = iv,compiledFunctions = cf)),msg)
equation
allClassPaths = getAllClassPathsRecursive(className, p);
allClassPaths = Util.listSelect(allClassPaths, filterLib);
// allClassPaths = Util.listSelect(allClassPaths, filterLib);
// allClassPaths = listReverse(allClassPaths);
print("Number of classes to check: " +& intString(listLength(allClassPaths)) +& "\n");
// print ("All paths: \n" +& Util.stringDelimitList(Util.listMap(allClassPaths, Absyn.pathString), "\n") +& "\n");
Expand Down
26 changes: 13 additions & 13 deletions Compiler/Inst.mo
Expand Up @@ -1855,7 +1855,7 @@ algorithm
case (cache,env,ih,store,mods,pre,csets,ci_state,c as SCode.CLASS(name = className, restriction=r),prot,inst_dims,impl,_,graph,instSingleCref)
equation
false = RTOpts.debugFlag("noCache");
instHash = System.getFromRoots(0);
instHash = getGlobalRoot(instHashIndex);
envPathOpt = Env.getEnvPath(inEnv);
fullEnvPathPlusClass = Absyn.selectPathsOpt(envPathOpt, Absyn.IDENT(className));
{SOME(FUNC_instClassIn(inputs, outputs)),_} = get(fullEnvPathPlusClass, instHash);
Expand Down Expand Up @@ -2726,7 +2726,7 @@ algorithm
case (cache,env,ih,mods,pre,csets,ci_state,c as SCode.CLASS(name = className, restriction=r),prot,inst_dims)
equation
false = RTOpts.debugFlag("noCache");
instHash = System.getFromRoots(0);
instHash = getGlobalRoot(instHashIndex);
envPathOpt = Env.getEnvPath(inEnv);
className = SCode.className(c);
fullEnvPathPlusClass = Absyn.selectPathsOpt(envPathOpt, Absyn.IDENT(className));
Expand Down Expand Up @@ -2755,7 +2755,7 @@ algorithm
ConnectionGraph.ConnectionGraph> outputs;
equation
false = RTOpts.debugFlag("noCache");
instHash = System.getFromRoots(0);
instHash = getGlobalRoot(instHashIndex);
envPathOpt = Env.getEnvPath(inEnv);
fullEnvPathPlusClass = Absyn.selectPathsOpt(envPathOpt, Absyn.IDENT(className));
{SOME(FUNC_instClassIn(inputs, outputs)), _} = get(fullEnvPathPlusClass, instHash);
Expand Down Expand Up @@ -14123,53 +14123,53 @@ algorithm
// we have them both
case (fullEnvPathPlusClass, SOME(fullInst), SOME(partialInst))
equation
instHash = System.getFromRoots(0);
instHash = getGlobalRoot(instHashIndex);
instHash = add((fullEnvPathPlusClass,{fullInstOpt,partialInstOpt}),instHash);
System.addToRoots(0, instHash);
setGlobalRoot(instHashIndex, instHash);
then
();

// we have a partial inst result and the full in the cache
case (fullEnvPathPlusClass, NONE(), SOME(partialInst))
equation
instHash = System.getFromRoots(0);
instHash = getGlobalRoot(instHashIndex);
// see if we have a full inst here
{SOME(fullInst),_} = get(fullEnvPathPlusClass, instHash);
instHash = add((fullEnvPathPlusClass,{SOME(fullInst),partialInstOpt}),instHash);
System.addToRoots(0, instHash);
setGlobalRoot(instHashIndex, instHash);
then
();

// we have a partial inst result and the full is NOT in the cache
case (fullEnvPathPlusClass, NONE(), SOME(partialInst))
equation
instHash = System.getFromRoots(0);
instHash = getGlobalRoot(instHashIndex);
// see if we have a full inst here
// failed above {SOME(fullInst),_} = get(fullEnvPathPlusClass, instHash);
instHash = add((fullEnvPathPlusClass,{NONE(),partialInstOpt}),instHash);
System.addToRoots(0, instHash);
setGlobalRoot(instHashIndex, instHash);
then
();

// we have a full inst result and the partial in the cache
case (fullEnvPathPlusClass, SOME(fullInst), NONE())
equation
instHash = System.getFromRoots(0);
instHash = getGlobalRoot(instHashIndex);
// see if we have a partial inst here
{_,SOME(partialInst)} = get(fullEnvPathPlusClass, instHash);
instHash = add((fullEnvPathPlusClass,{fullInstOpt,SOME(partialInst)}),instHash);
System.addToRoots(0, instHash);
setGlobalRoot(instHashIndex, instHash);
then
();

// we have a full inst result and the partial is NOT in the cache
case (fullEnvPathPlusClass, SOME(fullInst), NONE())
equation
instHash = System.getFromRoots(0);
instHash = getGlobalRoot(instHashIndex);
// see if we have a partial inst here
// failed above {_,SOME(partialInst)} = get(fullEnvPathPlusClass, instHash);
instHash = add((fullEnvPathPlusClass,{fullInstOpt,NONE()}),instHash);
System.addToRoots(0, instHash);
setGlobalRoot(instHashIndex, instHash);
then
();

Expand Down
6 changes: 3 additions & 3 deletions Compiler/SCodeUtil.mo
Expand Up @@ -79,10 +79,10 @@ algorithm

case (inProgram)
equation
System.addToRoots(Inst.instHashIndex, Inst.emptyInstHashTable());
System.addToRoots(Types.memoryIndex, Types.createEmptyTypeMemory());
setGlobalRoot(Inst.instHashIndex, Inst.emptyInstHashTable());
setGlobalRoot(Types.memoryIndex, Types.createEmptyTypeMemory());
// adrpo: TODO! FIXME! disable function caching for now as some tests fail.
// System.addToRoots(Ceval.cevalHashIndex, Ceval.emptyCevalHashTable());
// setGlobalRoot(Ceval.cevalHashIndex, Ceval.emptyCevalHashTable());
inProgram = MetaUtil.createMetaClassesInProgram(inProgram);

// set the external flag that signals the presence of inner/outer components in the model
Expand Down

0 comments on commit 08f1470

Please sign in to comment.