Skip to content

Commit

Permalink
- SimCode.mo
Browse files Browse the repository at this point in the history
  do not use DAELow.getAllExps. This is a realy bad function for large models. It needs too much memory. Use DAELow.traverseDAELowExps instead.

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@6634 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Jens Frenkel committed Oct 26, 2010
1 parent 323bdfe commit a5de90b
Show file tree
Hide file tree
Showing 2 changed files with 798 additions and 33 deletions.
40 changes: 34 additions & 6 deletions Compiler/SimCode.mo
Expand Up @@ -1151,11 +1151,14 @@ in a list. Removes duplicates."
list<Exp.Exp> explist,fcallexps,fcallexps_1,fcallexps_2;
list<Absyn.Path> calledfuncs;
algorithm
explist := DAELow.getAllExps(dlow);
fcallexps := getMatchingExpsList(explist, matchCalls);
fcallexps_1 := Util.listSelect(fcallexps, isNotBuiltinCall);
fcallexps_2 := getMatchingExpsList(explist, matchFnRefs);
calledfuncs := Util.listMap(listAppend(fcallexps_1,fcallexps_2), getCallPath);
//explist := DAELow.getAllExps(dlow);
//fcallexps := getMatchingExpsList(explist, matchCalls);
fcallexps := DAELow.traverseDAELowExps(dlow,true,getMatchingExps,matchCallsAndFnRefs);
//fcallexps_1 := Util.listSelect(fcallexps, isNotBuiltinCall);
//fcallexps_2 := getMatchingExpsList(explist, matchFnRefs);
//fcallexps_2 := DAELow.traverseDAELowExps(dlow,true,getMatchingExps,matchFnRefs);
//calledfuncs := Util.listMap(listAppend(fcallexps_1,fcallexps_2), getCallPath);
calledfuncs := Util.listMap(fcallexps, getCallPath);
res := removeDuplicatePaths(calledfuncs);
end getCalledFunctions;

Expand All @@ -1177,7 +1180,8 @@ algorithm
equation
true = RTOpts.acceptMetaModelicaGrammar();
explist = DAELow.getAllExps(dlow);
fcallexps = getMatchingExpsList(explist, matchFnRefs);
//fcallexps = getMatchingExpsList(explist, matchFnRefs);
fcallexps = DAELow.traverseDAELowExps(dlow,true,getMatchingExps,matchFnRefs);
calledfuncs = Util.listMap(fcallexps, getCallPath);
res = removeDuplicatePaths(calledfuncs);
then res;
Expand Down Expand Up @@ -7792,6 +7796,30 @@ algorithm
end matchcontinue;
end getMatchingExps;

protected function matchCallsAndFnRefs
"calls matchCalls and matchFnRefs"
input DAE.Exp inExpr;
output list<DAE.Exp> outExprLst;
algorithm
outExprLst := matchcontinue (inExpr)
local list<DAE.Exp> explst,explst1,explst_1,explst2;
case (inExpr)
equation
explst = matchCalls(inExpr);
explst_1 = Util.listSelect(explst, isNotBuiltinCall);
explst1 = matchFnRefs(inExpr);
explst2 = listAppend(explst,explst_1);
then
explst2;
case (inExpr)
equation
failure(explst = matchCalls(inExpr));
explst1 = matchFnRefs(inExpr);
then
explst1;
end matchcontinue;
end matchCallsAndFnRefs;

protected function matchCalls
"Used together with getMatchingExps"
input DAE.Exp inExpr;
Expand Down

0 comments on commit a5de90b

Please sign in to comment.