Skip to content

Commit

Permalink
optimize memory further for ticket:1451
Browse files Browse the repository at this point in the history
Belonging to [master]:
  - OpenModelica/OMCompiler#1902
  • Loading branch information
hkiel authored and OpenModelica-Hudson committed Oct 13, 2017
1 parent 84dc1d9 commit 2a43b90
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions Compiler/BackEnd/Sorting.mo
Expand Up @@ -179,16 +179,21 @@ algorithm
outStack := eqn::outStack;

// Consider successors of eqn
for eqn2 in Matching.reachableEquations(eqn, mT, ass2) loop
if number[eqn2] == -1 then
// Successor eqn2 has not yet been visited; recurse on it
(outStack, outIndex, outComponents) := StrongConnectTransposed(mT, ass2, eqn2, outStack, outIndex, number, lowlink, onStack, outComponents);
arrayUpdate(lowlink, eqn, intMin(lowlink[eqn], lowlink[eqn2]));
elseif onStack[eqn2] then
// Successor eqn2 is in the stack and hence in the current SCC
arrayUpdate(lowlink, eqn, intMin(lowlink[eqn], number[eqn2]));
end if;
end for;
var := ass2[eqn] "get the variable that is solved in given equation";
if var > 0 then
for eqn2 in mT[var] loop
if eqn2 > 0 and eqn2 <> eqn then
if number[eqn2] == -1 then
// Successor eqn2 has not yet been visited; recurse on it
(outStack, outIndex, outComponents) := StrongConnectTransposed(mT, ass2, eqn2, outStack, outIndex, number, lowlink, onStack, outComponents);
arrayUpdate(lowlink, eqn, intMin(lowlink[eqn], lowlink[eqn2]));
elseif onStack[eqn2] then
// Successor eqn2 is in the stack and hence in the current SCC
arrayUpdate(lowlink, eqn, intMin(lowlink[eqn], number[eqn2]));
end if;
end if;
end for;
end if;

// If eqn is a root node, pop the stack and generate an SCC
if lowlink[eqn] == number[eqn] then
Expand Down

0 comments on commit 2a43b90

Please sign in to comment.