Skip to content

Commit

Permalink
- Fixed type checking and boxing of simple types in partially evaluat…
Browse files Browse the repository at this point in the history
…ed functions

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@4559 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Stefan Brus committed Nov 23, 2009
1 parent 55011e0 commit 849f0f6
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion Compiler/PartFn.mo
Expand Up @@ -1598,14 +1598,15 @@ algorithm
list<DAE.Exp> args,args2,args_1;
list<DAE.ComponentRef> crefs;
String str;
// TEMPFIX REMOVE UNBOX CALLS
case((DAE.CALL(orig_p,args,tup,bui,ty,inl),(p,inputs,dae)))
equation
true = isSimpleArg(args);
str = Absyn.pathString(orig_p);
true = Util.strncmp(str,"mmc",3);
e = Util.listFirst(args);
then
((e,(p,inputs,dae)));
//case((DAE.CALL(orig_p,args,tup,bui,ty,inl),(p,inputs,dae)))
case((DAE.CALL(orig_p,args,tup,false,ty,inl),(p,inputs,dae)))
equation
tmp = DAEUtil.getNamedFunction(orig_p,dae); // if function exists, do not replace call
Expand All @@ -1619,6 +1620,33 @@ algorithm
end matchcontinue;
end fixCall;

protected function isSimpleArg
"function: isSimpleArg
checks if a funcarg list is simple or not"
input list<DAE.Exp> inArgs;
output Boolean outBoolean;
algorithm
outBoolean := matchcontinue(inArgs)
local
DAE.ExpType et;
case({DAE.ICONST(_)}) then true;
case({DAE.RCONST(_)}) then true;
case({DAE.BCONST(_)}) then true;
case({DAE.SCONST(_)}) then true;
case({DAE.CREF(ty = et)})
equation
true = Exp.typeBuiltin(et);
then
true;
case({DAE.CALL(ty = DAE.ET_BOXED(et))})
equation
true = Exp.typeBuiltin(et);
then
true;
case(_) then false;
end matchcontinue;
end isSimpleArg;

protected function getPartEvalFunction
"function: getPartEvalFunction
gets the exp and index of a partevalfunction from a list of exps
Expand Down

0 comments on commit 849f0f6

Please sign in to comment.