Skip to content

Commit

Permalink
- got rid of Debug traces to speed up the handling of expandable conn…
Browse files Browse the repository at this point in the history
…ectors.

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@6403 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adrpo committed Oct 18, 2010
1 parent 215ca20 commit e90cfad
Showing 1 changed file with 87 additions and 87 deletions.
174 changes: 87 additions & 87 deletions Compiler/InstSection.mo
Expand Up @@ -3503,50 +3503,50 @@ algorithm

// do the union of the connectors by adding the missing
// components from one to the other and vice-versa.
Debug.fprintln("expandable",
">>>> connect(expandable, expandable)(" +&
Dump.printComponentRefStr(c1) +& ", " +&
Dump.printComponentRefStr(c2) +& ")"
);
// Debug.fprintln("expandable",
// ">>>> connect(expandable, expandable)(" +&
// Dump.printComponentRefStr(c1) +& ", " +&
// Dump.printComponentRefStr(c2) +& ")"
// );

// get the environments of the expandable connectors
// which contain all the virtual components.
(_,_,_,_,_,_,_,env1,_) = Lookup.lookupVar(cache, env, c1_2);
(_,_,_,_,_,_,_,env2,_) = Lookup.lookupVar(cache, env, c2_2);

Debug.fprintln("expandable",
"1 connect(expandable, expandable)(" +&
Dump.printComponentRefStr(c1) +& ", " +&
Dump.printComponentRefStr(c2) +& ")"
);
// Debug.fprintln("expandable",
// "1 connect(expandable, expandable)(" +&
// Dump.printComponentRefStr(c1) +& ", " +&
// Dump.printComponentRefStr(c2) +& ")"
// );

//Debug.fprintln("expandable", "env ===>\n" +& Env.printEnvStr(env));
//Debug.fprintln("expandable", "env(c1) ===>\n" +& Env.printEnvStr(env1));
//Debug.fprintln("expandable", "env(c2) ===>\n" +& Env.printEnvStr(env2));

// get the virtual components
variables1 = Env.getVariablesFromEnv(env1);
Debug.fprintln("expandable", "Variables1: " +& Util.stringDelimitList(variables1, ", "));
// Debug.fprintln("expandable", "Variables1: " +& Util.stringDelimitList(variables1, ", "));
variables2 = Env.getVariablesFromEnv(env2);
Debug.fprintln("expandable", "Variables2: " +& Util.stringDelimitList(variables2, ", "));
// Debug.fprintln("expandable", "Variables2: " +& Util.stringDelimitList(variables2, ", "));
variablesUnion = Util.listUnion(variables1, variables2);
Debug.fprintln("expandable", "Union of expandable connector variables: " +& Util.stringDelimitList(variablesUnion, ", "));
// Debug.fprintln("expandable", "Union of expandable connector variables: " +& Util.stringDelimitList(variablesUnion, ", "));

Debug.fprintln("expandable",
"2 connect(expandable, expandable)(" +&
Dump.printComponentRefStr(c1) +& ", " +&
Dump.printComponentRefStr(c2) +& ")"
);
// Debug.fprintln("expandable",
// "2 connect(expandable, expandable)(" +&
// Dump.printComponentRefStr(c1) +& ", " +&
// Dump.printComponentRefStr(c2) +& ")"
// );

// then connect each of the components normally.
(cache,env,ih,sets,dae,graph) = connectExpandableVariables(cache,env,ih,sets,pre,c1,c2,variablesUnion,impl,graph,info);

Debug.fprintln("expandable",
"<<<< connect(expandable, expandable)(" +&
Dump.printComponentRefStr(c1) +& ", " +&
Dump.printComponentRefStr(c2) +& ")"
);
// Debug.fprintln("expandable",
// "<<<< connect(expandable, expandable)(" +&
// Dump.printComponentRefStr(c1) +& ", " +&
// Dump.printComponentRefStr(c2) +& ")"
// );

then
(cache,env,ih,sets,dae,graph);

Expand All @@ -3556,11 +3556,11 @@ algorithm
// c2 is expandable
failure((_,_,_,_,_) = Static.elabCref(cache, env, c2, impl, false, pre));
(cache,DAE.CREF(c1_1,t1),prop1,acc,_) = Static.elabCref(cache, env, c1, impl, false, pre);
Debug.fprintln("expandable",
"connect(existing, expandable)(" +&
Dump.printComponentRefStr(c1) +& ", " +&
Dump.printComponentRefStr(c2) +& ")"
);
// Debug.fprintln("expandable",
// "connect(existing, expandable)(" +&
// Dump.printComponentRefStr(c1) +& ", " +&
// Dump.printComponentRefStr(c2) +& ")"
// );
(cache,env,ih,sets,dae,graph) = connectExpandableConnectors(cache,env,ih,sets,pre,c2,c1,impl,graph,info);
then
(cache,env,ih,sets,dae,graph);
Expand All @@ -3570,6 +3570,7 @@ algorithm
equation
// c1 is expandable
failure((_,_,_,_,_) = Static.elabCref(cache, env, c1, impl, false, pre));
// adrpo: TODO! FIXME! add this as an Error not as a print!
print("Error: The marked virtual expandable component reference in connect([" +&
Absyn.printComponentRefStr(c1) +& "], " +&
Absyn.printComponentRefStr(c2) +& "); should be qualified, i.e. expandableConnectorName.virtualName!\n");
Expand All @@ -3584,23 +3585,23 @@ algorithm
failure((_,_,_,_,_) = Static.elabCref(cache, env, c1, impl, false, pre));
(cache,DAE.CREF(c2_1,t2),prop2,acc2,_) = Static.elabCref(cache, env, c2, impl, false, pre);

Debug.fprintln("expandable",
">>>> connect(expandable, existing)(" +&
Dump.printComponentRefStr(c1) +& ", " +&
Dump.printComponentRefStr(c2) +& ")"
);

// Debug.fprintln("expandable",
// ">>>> connect(expandable, existing)(" +&
// Dump.printComponentRefStr(c1) +& ", " +&
// Dump.printComponentRefStr(c2) +& ")"
// );
// lookup the existing connector
(cache,c2_2) = Static.canonCref(cache,env, c2_1, impl);
(cache,attr2,ty2) = Lookup.lookupConnectorVar(cache,env,c2_2);
// bind the attributes
DAE.ATTR(flowPrefix2,streamPrefix2,acc2,vt2,dir2,io2) = attr2;

Debug.fprintln("expandable",
"1 connect(expandable, existing)(" +&
Dump.printComponentRefStr(c1) +& ", " +&
Dump.printComponentRefStr(c2) +& ")"
);
// Debug.fprintln("expandable",
// "1 connect(expandable, existing)(" +&
// Dump.printComponentRefStr(c1) +& ", " +&
// Dump.printComponentRefStr(c2) +& ")"
// );

// strip the last prefix!
c1_prefix = Absyn.crefStripLast(c1);
Expand All @@ -3621,11 +3622,11 @@ algorithm
// more than 1 variables
true = listLength(variablesUnion) > 1;

Debug.fprintln("expandable",
"2 connect(expandable, existing[MULTIPLE])(" +&
Dump.printComponentRefStr(c1) +& ", " +&
Dump.printComponentRefStr(c2) +& ")"
);
// Debug.fprintln("expandable",
// "2 connect(expandable, existing[MULTIPLE])(" +&
// Dump.printComponentRefStr(c1) +& ", " +&
// Dump.printComponentRefStr(c2) +& ")"
// );

// get the virtual component name
Absyn.CREF_IDENT(componentName, _) = Absyn.crefGetLastIdent(c1);
Expand Down Expand Up @@ -3668,25 +3669,25 @@ algorithm
// c1 is expandable
failure((_,_,_,_,_) = Static.elabCref(cache, env, c1, impl, false, pre));
(cache,DAE.CREF(c2_1,t2),prop2,acc2,_) = Static.elabCref(cache, env, c2, impl, false, pre);

Debug.fprintln("expandable",
">>>> connect(expandable, existing)(" +&
Dump.printComponentRefStr(c1) +& ", " +&
Dump.printComponentRefStr(c2) +& ")"
);

// Debug.fprintln("expandable",
// ">>>> connect(expandable, existing)(" +&
// Dump.printComponentRefStr(c1) +& ", " +&
// Dump.printComponentRefStr(c2) +& ")"
// );
// lookup the existing connector
(cache,c2_2) = Static.canonCref(cache,env, c2_1, impl);
(cache,attr2,ty2) = Lookup.lookupConnectorVar(cache,env,c2_2);
// bind the attributes
DAE.ATTR(flowPrefix2,streamPrefix2,acc2,vt2,dir2,io2) = attr2;

Debug.fprintln("expandable",
"1 connect(expandable, existing)(" +&
Dump.printComponentRefStr(c1) +& ", " +&
Dump.printComponentRefStr(c2) +& ")"
);

// Debug.fprintln("expandable",
// "1 connect(expandable, existing)(" +&
// Dump.printComponentRefStr(c1) +& ", " +&
// Dump.printComponentRefStr(c2) +& ")"
// );
// strip the last prefix!
c1_prefix = Absyn.crefStripLast(c1);
// elab expandable connector
Expand All @@ -3706,11 +3707,11 @@ algorithm
// max 1 variable, should check for empty!
false = listLength(variablesUnion) > 1;

Debug.fprintln("expandable",
"2 connect(expandable, existing[SINGLE])(" +&
Dump.printComponentRefStr(c1) +& ", " +&
Dump.printComponentRefStr(c2) +& ")"
);
// Debug.fprintln("expandable",
// "2 connect(expandable, existing[SINGLE])(" +&
// Dump.printComponentRefStr(c1) +& ", " +&
// Dump.printComponentRefStr(c2) +& ")"
// );

// get the virtual component name
Absyn.CREF_IDENT(componentName, _) = Absyn.crefGetLastIdent(c1);
Expand Down Expand Up @@ -3738,12 +3739,12 @@ algorithm
cnstForRange,
envExpandable);
// ******************************************************************************

Debug.fprintln("expandable",
"3 connect(expandable, existing[SINGLE])(" +&
Dump.printComponentRefStr(c1) +& ", " +&
Dump.printComponentRefStr(c2) +& ")"
);
// Debug.fprintln("expandable",
// "3 connect(expandable, existing[SINGLE])(" +&
// Dump.printComponentRefStr(c1) +& ", " +&
// Dump.printComponentRefStr(c2) +& ")"
// );

//Debug.fprintln("expandable", "env expandable: " +& Env.printEnvStr(envExpandable));
//Debug.fprintln("expandable", "env component: " +& Env.printEnvStr(envComponent));
Expand Down Expand Up @@ -3772,12 +3773,12 @@ algorithm

dae = DAEUtil.joinDaes(dae, daeExpandable);

Debug.fprintln("expandable",
"<<<< connect(expandable, existing)(" +&
Dump.printComponentRefStr(c1) +& ", " +&
Dump.printComponentRefStr(c2) +& ")\nDAE:\n" +&
DAEDump.dump2str(daeExpandable)
);
// Debug.fprintln("expandable",
// "<<<< connect(expandable, existing)(" +&
// Dump.printComponentRefStr(c1) +& ", " +&
// Dump.printComponentRefStr(c2) +& ")\nDAE:\n" +&
// DAEDump.dump2str(daeExpandable)
// );
then
(cache,env,ih,sets,dae,graph);

Expand All @@ -3797,12 +3798,11 @@ algorithm
false = isExpandableConnectorType(ty1);
false = isExpandableConnectorType(ty2);

Debug.fprintln("expandable",
"connect(non-expandable, non-expandable)(" +&
Dump.printComponentRefStr(c1) +& ", " +&
Dump.printComponentRefStr(c2) +& ")"
);

// Debug.fprintln("expandable",
// "connect(non-expandable, non-expandable)(" +&
// Dump.printComponentRefStr(c1) +& ", " +&
// Dump.printComponentRefStr(c2) +& ")"
// );
// then connect the components normally.
then
fail(); // fail to enter connect normally
Expand Down Expand Up @@ -3952,10 +3952,10 @@ algorithm
// add name to both c1 and c2, then connect normally
c1_full = Absyn.joinCrefs(c1, Absyn.CREF_IDENT(name, {}));
c2_full = Absyn.joinCrefs(c2, Absyn.CREF_IDENT(name, {}));
Debug.fprintln("expandable",
"connect(full_expandable, full_expandable)(" +&
Dump.printComponentRefStr(c1_full) +& ", " +&
Dump.printComponentRefStr(c2_full) +& ")");
// Debug.fprintln("expandable",
// "connect(full_expandable, full_expandable)(" +&
// Dump.printComponentRefStr(c1_full) +& ", " +&
// Dump.printComponentRefStr(c2_full) +& ")");
(cache,env,ih,sets,dae1,graph) = instConnect(cache,env,ih,sets,pre,c1_full,c2_full,impl,graph,info);

(cache,env,ih,sets,dae2,graph) = connectExpandableVariables(cache,env,ih,sets,pre,c1,c2,names,impl,graph,info);
Expand Down

0 comments on commit e90cfad

Please sign in to comment.