Changeset c914d20 in OpenModelica


Ignore:
Timestamp:
2016-04-01T17:43:07+02:00 (8 years ago)
Author:
Martin Sjölund <martin.sjolund@…>
Branches:
Added-citation-metadata, maintenance/v1.14, maintenance/v1.15, maintenance/v1.16, maintenance/v1.17, maintenance/v1.18, maintenance/v1.19, maintenance/v1.20, maintenance/v1.21, maintenance/v1.22, master, omlib-staging
Children:
5ed2c5e
Parents:
d00a5127
git-author:
Martin Sjölund <martin.sjolund@…> (04/01/16 17:19:48)
git-committer:
Martin Sjölund <martin.sjolund@…> (04/01/16 17:43:07)
Message:

Reduce memory used by state machines

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Compiler/FrontEnd/InstStateMachineUtil.mo

    r91127f13 rc914d20  
    106106    smNodeToFlatSMGroup := HashTableCG.emptyHashTableSized(1);
    107107    return;
    108   else
    109     smNodeToFlatSMGroup := HashTableCG.emptyHashTable();
    110108  end if;
    111109
    112110  DAE.DAE(elementLst=elementLst) := inDae;
    113 
    114111  smNodeTable := getSMNodeTable(elementLst);
    115112  nStates := BaseHashTable.hashTableCurrentSize(smNodeTable);
    116113
    117114  if nStates > 0 then
     115    smNodeToFlatSMGroup := HashTableCG.emptyHashTable();
     116
    118117    if DEBUG_SMDUMP then print("***** InstStateMachineUtil.createSMNodeToFlatSMGroupTable: START ***** \n"); end if;
    119118    if DEBUG_SMDUMP then print("***** State machine node table: ***** \n"); end if;
     
    141140
    142141    if DEBUG_SMDUMP then print("***** InstStateMachineUtil.createSMNodeToFlatSMGroupTable: END ***** \n"); end if;
     142  else
     143    smNodeToFlatSMGroup := HashTableCG.emptyHashTableSized(1);
    143144  end if;
    144145
     
    423424    case DAE.SM_COMP(componentRef=componentRef, dAElist=dAElist)
    424425      algorithm
    425         outerOutputs := List.filterOnTrue(dAElist, isOuterOutput);
    426         outerOutputCrefs := List.map(outerOutputs, DAEUtil.varCref);
    427         outerOutputCrefToSMCompCref := List.map(outerOutputCrefs, function Util.makeTuple(inValue2=componentRef));
    428       then List.fold(outerOutputCrefToSMCompCref, BaseHashTable.addUnique, outOuterAcc);
     426        outerOutputs := List.filterOnTrue(dAElist, isOuterOutput);
     427        outerOutputCrefs := List.map(outerOutputs, DAEUtil.varCref);
     428        outerOutputCrefToSMCompCref := List.map(outerOutputCrefs, function Util.makeTuple(inValue2=componentRef));
     429      then List.fold(outerOutputCrefToSMCompCref, BaseHashTable.addUnique, outOuterAcc);
    429430    else then inOuterAcc;
    430431  end match;
     
    779780algorithm
    780781  elementLst2 := list(e for e guard isSMStatement2(e) in elementLst);
    781   smNodeTable := List.fold(elementLst2,  extractSMStates2, HashTableSM1.emptyHashTable());
     782  if not listEmpty(elementLst2) then
     783    smNodeTable := List.fold(elementLst2,  extractSMStates2, HashTableSM1.emptyHashTable());
     784  else
     785    smNodeTable := HashTableSM1.emptyHashTableSized(1);
     786  end if;
    782787end getSMNodeTable;
    783788
Note: See TracChangeset for help on using the changeset viewer.