Skip to content

Commit

Permalink
- small performance improvements
Browse files Browse the repository at this point in the history
- cosmetic changes

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@2762 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adrpo committed Mar 31, 2007
1 parent ea77464 commit 1928d05
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 43 deletions.
18 changes: 3 additions & 15 deletions Compiler/DAE.mo
Expand Up @@ -3331,24 +3331,12 @@ algorithm
matchcontinue (inElementLst)
local
list<Element> res,lst;
Exp.ComponentRef a;
VarKind b;
VarDirection c;
VarProtection prot;
Type d;
Option<Exp.Exp> e,g;
InstDims f;
Flow h;
list<Absyn.Path> i;
Option<VariableAttributes> dae_var_attr;
Option<Absyn.Comment> comment;
Absyn.InnerOuter io;
Types.Type tp;
case (VAR(componentRef = a,varible = b,variable = c,protection = prot,input_ = d,one = e,binding = f,dimension = g,value = h,flow_ = i,variableAttributesOption = dae_var_attr,absynCommentOption = comment,innerOuter=io,fullType=tp) :: lst)
Element x;
case ((x as VAR(_,_,_,_,_,_,_,_,_,_,_,_,_,_)) :: lst)
equation
res = getVariableList(lst);
then
(VAR(a,b,c,prot,d,e,f,g,h,i,dae_var_attr,comment,io,tp) :: res);
(x :: res);
case (_ :: lst)
equation
res = getVariableList(lst);
Expand Down
25 changes: 9 additions & 16 deletions Compiler/DAELow.mo
Expand Up @@ -2070,8 +2070,8 @@ algorithm
Option<Absyn.Comment> s;
DAE.Flow t;
Boolean fixed;
case (VAR(varName = a,varKind = b,varDirection = c,varType = d,bindExp = e,bindValue = f,arryDim = g,startValue = h,index = i,origVarName = j,className = k,values = SOME(DAE.VAR_ATTR_REAL(l,m,n,o,p,_,q,r)),comment = s,flow_ = t),fixed) then VAR(a,b,c,d,e,f,g,h,i,j,k,
SOME(DAE.VAR_ATTR_REAL(l,m,n,o,p,SOME(fixed),q,r)),s,t);
case (VAR(varName = a,varKind = b,varDirection = c,varType = d,bindExp = e,bindValue = f,arryDim = g,startValue = h,index = i,origVarName = j,className = k,values = SOME(DAE.VAR_ATTR_REAL(l,m,n,o,p,_,q,r)),comment = s,flow_ = t),fixed)
then VAR(a,b,c,d,e,f,g,h,i,j,k,SOME(DAE.VAR_ATTR_REAL(l,m,n,o,p,SOME(fixed),q,r)),s,t);
case (VAR(varName = a,varKind = b,varDirection = c,varType = d,bindExp = e,bindValue = f,arryDim = g,startValue = h,index = i,origVarName = j,className = k,values = SOME(DAE.VAR_ATTR_INT(l,m,n,_)),comment = o,flow_ = p),fixed)
local
tuple<Option<Value>, Option<Value>> m;
Expand Down Expand Up @@ -6181,8 +6181,9 @@ algorithm
Option<DAE.VariableAttributes> attr;
Option<Absyn.Comment> comment;
DAE.Flow flow_;
case (VAR(varName = cr,varKind = kind,varDirection = dir,varType = tp,bindExp = bind,bindValue = v,arryDim = dim,startValue = st,index = i,origVarName = origname,className = classes,values = attr,comment = comment,flow_ = flow_),new_kind) then VAR(cr,new_kind,dir,tp,bind,v,dim,st,i,origname,classes,attr,
comment,flow_);
case (VAR(varName = cr,varKind = kind,varDirection = dir,varType = tp,bindExp = bind,bindValue = v,arryDim = dim,startValue = st,
index = i,origVarName = origname,className = classes,values = attr,comment = comment,flow_ = flow_),new_kind)
then VAR(cr,new_kind,dir,tp,bind,v,dim,st,i,origname,classes,attr,comment,flow_);
end matchcontinue;
end setVarKind;

Expand Down Expand Up @@ -11971,20 +11972,11 @@ end calculateIndexes;

protected function transformVariables "function: transformVariables
author: PA
Helper function to translate_dae
inputs: (Var list,
Exp.Exp list,
Exp.Exp list,
string /* varible prefix, \"$\" or \"\" */)
outputs: (Var list)
"
Helper function to translateDae"
input list<Var> inVarLst1;
input list<Exp.Exp> inExpExpLst2;
input list<Exp.Exp> inExpExpLst3;
input String inString4;
input String inString4 "variable prefix, '$' or ''";
output list<Var> outVarLst;
algorithm
outVarLst:=
Expand Down Expand Up @@ -12152,7 +12144,8 @@ algorithm
Option<DAE.VariableAttributes> dae_var_attr;
Option<Absyn.Comment> comment;
DAE.Flow flow_;
case ({},x,xd,y,p,dummy,ext,x_strType,xd_strType,y_strType,p_strType,dummy_strType) then ({},x,xd,y,p,dummy,ext,x_strType,xd_strType,y_strType,p_strType,dummy_strType);
case ({},x,xd,y,p,dummy,ext,x_strType,xd_strType,y_strType,p_strType,dummy_strType)
then ({},x,xd,y,p,dummy,ext,x_strType,xd_strType,y_strType,p_strType,dummy_strType);

case ((VAR(varName = cr,varKind = VARIABLE(),varDirection = d,varType = DAE.STRING(),bindExp = b,bindValue = value,arryDim = dim,startValue = start,origVarName = name,className = cl,values = dae_var_attr,comment = comment,flow_ = flow_) :: vs),x,xd,y,p,dummy,ext,x_strType,xd_strType,y_strType,p_strType,dummy_strType)
equation
Expand Down
11 changes: 7 additions & 4 deletions Compiler/Env.mo
Expand Up @@ -385,7 +385,7 @@ algorithm
BinTree ht_1,ht,httypes;
Option<Ident> id;
list<Value> imps;
Env bcframes,fs,env;
Env bcframes,fs,env,remember;
tuple<list<Exp.ComponentRef>,Exp.ComponentRef> crs;
Boolean encflag;
InstStatus i;
Expand All @@ -400,11 +400,12 @@ algorithm
(FRAME(id,ht_1,httypes,imps,bcframes,crs,encflag) :: fs);

// Variable already added, perhaps from baseclass
case ((FRAME(class_1 = id,list_2 = ht,list_3 = httypes,list_4 = imps,list_5 = bcframes,current6 = crs,encapsulated_7 = encflag) :: fs),(v as Types.VAR(name = n)),c,i,env) /* environment of component */
case (remember as (FRAME(class_1 = id,list_2 = ht,list_3 = httypes,list_4 = imps,list_5 = bcframes,current6 = crs,encapsulated_7 = encflag) :: fs),
(v as Types.VAR(name = n)),c,i,env) /* environment of component */
equation
(_)= treeGet(ht, n, System.hash);
then
(FRAME(id,ht,httypes,imps,bcframes,crs,encflag) :: fs);
(remember);
end matchcontinue;
end extendFrameV;

Expand Down Expand Up @@ -574,7 +575,8 @@ algorithm
tuple<list<Exp.ComponentRef>,Exp.ComponentRef> crefs;
Boolean enc;
Frame f;
case ((FRAME(class_1 = sid,list_2 = cls,list_3 = tps,list_4 = imps,list_5 = bc,current6 = crefs,encapsulated_7 = enc) :: fs),(f :: _)) then (FRAME(sid,cls,tps,imps,(f :: bc),crefs,enc) :: fs); /* env bc env */
case ((FRAME(class_1 = sid,list_2 = cls,list_3 = tps,list_4 = imps,list_5 = bc,current6 = crefs,encapsulated_7 = enc) :: fs),(f :: _))
then (FRAME(sid,cls,tps,imps,(f :: bc),crefs,enc) :: fs); /* env bc env */
end matchcontinue;
end addBcFrame;

Expand Down Expand Up @@ -1539,6 +1541,7 @@ algorithm
then str;
end matchcontinue;
end printCacheTreeStr;

public function localOutsideConnectorFlowvars "function: localOutsideConnectorFlowvars
Return the outside connector variables that are flow in the local scope.
Expand Down
14 changes: 6 additions & 8 deletions Compiler/Inst.mo
Expand Up @@ -3039,15 +3039,13 @@ algorithm
case (env,_,_,_,_,{},_,_,_,_) then env; /* implicit inst. */

/* A component */
case (env,mod,pre,csets,cistate,(((comp as SCode.COMPONENT(component = n,innerOuter=io,final_ = final_,replaceable_ = repl,protected_ = prot,attributes = (attr as SCode.ATTR(arrayDim = ad,flow_ = flow_,RW = acc,parameter_ = param,input_ = dir)),typeSpec = t,mod = m,baseclass = bc,this = comment)),cmod) :: xs),allcomps,eqns,instdims,impl)
case (env,mod,pre,csets,cistate,
(((comp as SCode.COMPONENT(component = n,innerOuter=io,final_ = final_,replaceable_ = repl,protected_ = prot,attributes =
(attr as SCode.ATTR(arrayDim = ad,flow_ = flow_,RW = acc,parameter_ = param,input_ = dir)),typeSpec = t,mod = m,baseclass = bc,this = comment)),cmod) :: xs),
allcomps,eqns,instdims,impl)
equation
env_1 = addComponentsToEnv2(env, mod, pre, csets, cistate,
{
(
SCode.COMPONENT(n,io,final_,repl,prot,SCode.ATTR(ad,flow_,acc,param,dir),t,m,
bc,comment),cmod)}, instdims, impl);
env_2 = addComponentsToEnv(env_1, mod, pre, csets, cistate, xs, allcomps, eqns,
instdims, impl);
env_1 = addComponentsToEnv2(env, mod, pre, csets, cistate, {(comp,cmod)}, instdims, impl);
env_2 = addComponentsToEnv(env_1, mod, pre, csets, cistate, xs, allcomps, eqns, instdims, impl);
then
env_2;

Expand Down

0 comments on commit 1928d05

Please sign in to comment.