Skip to content

Commit

Permalink
Avoid some memory allocations
Browse files Browse the repository at this point in the history
  • Loading branch information
sjoelund committed Apr 11, 2016
1 parent a42d916 commit 8dbf39e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Compiler/FrontEnd/Inst.mo
Expand Up @@ -5147,6 +5147,8 @@ algorithm
local
CachedInstItem fullInst, partialInst;
InstHashTable instHash;
Option<CachedInstItem> opt;
list<Option<CachedInstItem>> lst;

// nothing is we have +d=noCache
case (_, _, _)
Expand All @@ -5169,8 +5171,8 @@ algorithm
equation
instHash = getGlobalRoot(Global.instHashIndex);
// see if we have a full inst here
{SOME(fullInst),_} = BaseHashTable.get(fullEnvPathPlusClass, instHash);
instHash = BaseHashTable.add((fullEnvPathPlusClass,{SOME(fullInst),partialInstOpt}),instHash);
{opt,_} = BaseHashTable.get(fullEnvPathPlusClass, instHash);
instHash = BaseHashTable.add((fullEnvPathPlusClass,{opt,partialInstOpt}),instHash);
setGlobalRoot(Global.instHashIndex, instHash);
then
();
Expand All @@ -5191,8 +5193,8 @@ algorithm
equation
instHash = getGlobalRoot(Global.instHashIndex);
// see if we have a partial inst here
{_,SOME(partialInst)} = BaseHashTable.get(fullEnvPathPlusClass, instHash);
instHash = BaseHashTable.add((fullEnvPathPlusClass,{fullInstOpt,SOME(partialInst)}),instHash);
(_::(lst as {SOME(partialInst)})) = BaseHashTable.get(fullEnvPathPlusClass, instHash);
instHash = BaseHashTable.add((fullEnvPathPlusClass,fullInstOpt::lst),instHash);
setGlobalRoot(Global.instHashIndex, instHash);
then
();
Expand Down

0 comments on commit 8dbf39e

Please sign in to comment.