Skip to content

Commit

Permalink
Compile fewer packages when bootstrapping
Browse files Browse the repository at this point in the history
  • Loading branch information
sjoelund committed Jul 2, 2015
1 parent 452a7cc commit bcde872
Show file tree
Hide file tree
Showing 19 changed files with 382 additions and 257 deletions.
38 changes: 10 additions & 28 deletions Compiler/FFrontEnd/FGraphStream.mo
Expand Up @@ -70,38 +70,20 @@ type Visited = FCore.Visited;

public function start
algorithm
_ := matchcontinue()

case ()
equation
true = Flags.isSet(Flags.GRAPH_INST_SHOW_GRAPH);
_ = GraphStream.startExternalViewer("localhost", 2001);
GraphStream.newStream("default", "localhost", 2001, false);
GraphStream.addGraphAttribute("default", "omc", -1, "stylesheet", Values.STRING("node{fill-mode:plain;fill-color:#567;size:6px;}"));
// GraphStream.addGraphAttribute("default", "omc", -1, "ui.antialias", Values.BOOL(true));
// GraphStream.addGraphAttribute("default", "omc", -1, "layout.stabilization-limit", Values.INTEGER(0));
then
();
else ();
end matchcontinue;
if Flags.isSet(Flags.GRAPH_INST_SHOW_GRAPH) then
GraphStream.startExternalViewer("localhost", 2001);
GraphStream.newStream("default", "localhost", 2001, false);
GraphStream.addGraphAttribute("default", "omc", -1, "stylesheet", Values.STRING("node{fill-mode:plain;fill-color:#567;size:6px;}"));
// GraphStream.addGraphAttribute("default", "omc", -1, "ui.antialias", Values.BOOL(true));
// GraphStream.addGraphAttribute("default", "omc", -1, "layout.stabilization-limit", Values.INTEGER(0));
end if;
end start;
public function finish
algorithm
_ := matchcontinue()
case ()
equation
true = Flags.isSet(Flags.GRAPH_INST_SHOW_GRAPH);
GraphStream.cleanup();
then
();
else ();
end matchcontinue;
if Flags.isSet(Flags.GRAPH_INST_SHOW_GRAPH) then
GraphStream.cleanup();
end if;
end finish;
Expand Down
17 changes: 0 additions & 17 deletions Compiler/FrontEnd/ValuesUtil.mo
Expand Up @@ -55,7 +55,6 @@ protected import Print;
protected import System;
protected import ClassInf;
protected import Types;
protected import SimulationResults;

public function typeConvert "Apply type conversion on a list of Values"
input DAE.Type inType1;
Expand Down Expand Up @@ -2487,22 +2486,6 @@ algorithm
Absyn.C_TYPENAME(path) := code;
end getPath;

public function readDataset
input String filename;
input list<String> vars;
input Integer dimsize;
output Values.Value val;
protected
list<list<Real>> rvals;
list<list<Values.Value>> vals;
list<Values.Value> rows;
algorithm
rvals := SimulationResults.readDataset(filename,vars,dimsize);
vals := List.mapListReverse(rvals,makeReal);
rows := List.mapReverse(vals,makeArray);
val := makeArray(rows);
end readDataset;

public function printCodeVariableName
input Values.Value val;
output String str;
Expand Down
2 changes: 1 addition & 1 deletion Compiler/Script/CevalScriptBackend.mo
Expand Up @@ -1686,7 +1686,7 @@ algorithm
equation
vars_1 = List.map(cvars, ValuesUtil.printCodeVariableName);
filename_1 = Util.absoluteOrRelative(filename);
value = ValuesUtil.readDataset(filename_1, vars_1, size);
value = SimulationResults.readDataset(filename_1, vars_1, size);
then
(cache,value,st);

Expand Down
10 changes: 10 additions & 0 deletions Compiler/Stubs/DumpGraphviz.mo
@@ -0,0 +1,10 @@
encapsulated package DumpGraphviz

function dump<T>
input T p;
algorithm
assert(false, getInstanceName());
end dump;

annotation(__OpenModelica_Interface="backend");
end DumpGraphviz;
19 changes: 19 additions & 0 deletions Compiler/Stubs/FGraphStream.mo
@@ -0,0 +1,19 @@
encapsulated package FGraphStream

function start
end start;

function finish = start;

function edge<A,B>
input A name;
input B source;
input B target;
end edge;

function node<N>
input N n;
end node;

annotation(__OpenModelica_Interface="frontend");
end FGraphStream;
11 changes: 11 additions & 0 deletions Compiler/Stubs/NFInstDump.mo
@@ -0,0 +1,11 @@
encapsulated package NFInstDump

function prefixStr<T>
input T inPrefix;
output String outString;
algorithm
assert(false, getInstanceName());
end prefixStr;

annotation(__OpenModelica_Interface="frontend");
end NFInstDump;
43 changes: 43 additions & 0 deletions Compiler/Stubs/UnitAbsynBuilder.mo
@@ -0,0 +1,43 @@
encapsulated package UnitAbsynBuilder

import UnitAbsyn;

function emptyInstStore
output UnitAbsyn.InstStore st = UnitAbsyn.noStore;
end emptyInstStore;

function instBuildUnitTerms<A,B>
input A env;
input B dae;
input B compDae;
input UnitAbsyn.InstStore store;
output UnitAbsyn.InstStore outStore;
output UnitAbsyn.UnitTerms terms;
algorithm
assert(false, getInstanceName());
end instBuildUnitTerms;

function registerUnitWeights<A,B,C>
input A cache;
input B env;
input C dae;
algorithm
assert(false, getInstanceName());
end registerUnitWeights;

function instAddStore<A,B>
input UnitAbsyn.InstStore istore;
input A itp;
input B cr;
output UnitAbsyn.InstStore outStore = istore;
end instAddStore;

function unit2str<A>
input A unit;
output String res;
algorithm
assert(false, getInstanceName());
end unit2str;

annotation(__OpenModelica_Interface="frontend");
end UnitAbsynBuilder;
20 changes: 20 additions & 0 deletions Compiler/Stubs/UnitChecker.mo
@@ -0,0 +1,20 @@
encapsulated package UnitChecker

function check<A,B>
input A tms;
input B ist;
output B outSt;
algorithm
assert(false, getInstanceName());
end check;

function isComplete<A>
input A st;
output Boolean complete;
output A stout;
algorithm
assert(false, getInstanceName());
end isComplete;

annotation(__OpenModelica_Interface="frontend");
end UnitChecker;
1 change: 1 addition & 0 deletions Compiler/Template/CodegenFMU.tpl
Expand Up @@ -46,6 +46,7 @@
package CodegenFMU

import interface SimCodeTV;
import interface SimCodeBackendTV;
import CodegenUtil.*;
import CodegenC.*; //unqualified import, no need the CodegenC is optional when calling a template; or mandatory when the same named template exists in this package (name hiding)
import CodegenCFunctions.*;
Expand Down
1 change: 1 addition & 0 deletions Compiler/Template/CodegenFMU1.tpl
Expand Up @@ -46,6 +46,7 @@
package CodegenFMU1

import interface SimCodeTV;
import interface SimCodeBackendTV;
import CodegenUtil.*;
import CodegenC.*; //unqualified import, no need the CodegenC is optional when calling a template; or mandatory when the same named template exists in this package (name hiding)
import CodegenFMUCommon.*;
Expand Down
1 change: 1 addition & 0 deletions Compiler/Template/CodegenFMU2.tpl
Expand Up @@ -46,6 +46,7 @@
package CodegenFMU2

import interface SimCodeTV;
import interface SimCodeBackendTV;
import CodegenUtil.*;
import CodegenC.*; //unqualified import, no need the CodegenC is optional when calling a template; or mandatory when the same named template exists in this package (name hiding)
import CodegenFMUCommon.*;
Expand Down
1 change: 1 addition & 0 deletions Compiler/Template/CodegenFMUCommon.tpl
Expand Up @@ -46,6 +46,7 @@
package CodegenFMUCommon

import interface SimCodeTV;
import interface SimCodeBackendTV;
import CodegenUtil.*;
import CodegenC.*; //unqualified import, no need the CodegenC is optional when calling a template; or mandatory when the same named template exists in this package (name hiding)
import CodegenCFunctions.*;
Expand Down
1 change: 1 addition & 0 deletions Compiler/Template/CodegenFMUCpp.tpl
Expand Up @@ -48,6 +48,7 @@ package CodegenFMUCpp


import interface SimCodeTV;
import interface SimCodeBackendTV;
import CodegenUtil.*;
import CodegenCpp.*; //unqualified import, no need the CodegenC is optional when calling a template; or mandatory when the same named template exists in this package (name hiding)
import CodegenFMU.*;
Expand Down
10 changes: 5 additions & 5 deletions Compiler/Template/Makefile.common
Expand Up @@ -40,19 +40,19 @@ CodegenCSharp.mo : CodegenCSharp.tpl SimCodeTV.mo
@echo " "

# FMU
CodegenFMUCommon.mo : CodegenFMUCommon.tpl SimCodeTV.mo CodegenC.tpl CodegenCFunctions.tpl CodegenUtil.tpl
CodegenFMUCommon.mo : CodegenFMUCommon.tpl SimCodeTV.mo SimCodeBackendTV.mo CodegenC.tpl CodegenCFunctions.tpl CodegenUtil.tpl
@echo " ** CodegenFMUCommon template compilation ** "
$(OMC) $< > $@.log || (cat $@.log && false)
@echo " "
CodegenFMU.mo : CodegenFMU.tpl CodegenFMUCommon.tpl CodegenFMUCommon.mo SimCodeTV.mo CodegenC.tpl CodegenCFunctions.tpl CodegenUtil.tpl
CodegenFMU.mo : CodegenFMU.tpl CodegenFMUCommon.tpl CodegenFMUCommon.mo SimCodeTV.mo SimCodeBackendTV.mo CodegenC.tpl CodegenCFunctions.tpl CodegenUtil.tpl
@echo " ** CodegenFMU template compilation ** "
$(OMC) $< > $@.log || (cat $@.log && false)
@echo " "
CodegenFMU1.mo : CodegenFMU1.tpl CodegenFMUCommon.tpl CodegenFMUCommon.mo SimCodeTV.mo CodegenC.tpl CodegenUtil.tpl
CodegenFMU1.mo : CodegenFMU1.tpl CodegenFMUCommon.tpl CodegenFMUCommon.mo SimCodeTV.mo SimCodeBackendTV.mo CodegenC.tpl CodegenUtil.tpl
@echo " ** CodegenFMU1 template compilation ** "
$(OMC) $< > $@.log || (cat $@.log && false)
@echo " "
CodegenFMU2.mo : CodegenFMU2.tpl CodegenFMUCommon.tpl CodegenFMUCommon.mo SimCodeTV.mo CodegenC.tpl CodegenUtil.tpl
CodegenFMU2.mo : CodegenFMU2.tpl CodegenFMUCommon.tpl CodegenFMUCommon.mo SimCodeTV.mo SimCodeBackendTV.mo CodegenC.tpl CodegenUtil.tpl
@echo " ** CodegenFMU2 template compilation ** "
$(OMC) $< > $@.log || (cat $@.log && false)
@echo " "
Expand Down Expand Up @@ -97,7 +97,7 @@ CodegenCppHpcom.mo : CodegenCppHpcom.tpl SimCodeTV.mo SimCodeBackendTV.mo Codege
$(OMC) $< > $@.log || (cat $@.log && false)
@echo " "

CodegenFMUCpp.mo : CodegenFMUCpp.tpl SimCodeTV.mo CodegenC.tpl CodegenUtil.tpl CodegenCpp.tpl CodegenFMU.tpl
CodegenFMUCpp.mo : CodegenFMUCpp.tpl SimCodeTV.mo SimCodeBackendTV.mo CodegenC.tpl CodegenUtil.tpl CodegenCpp.tpl CodegenFMU.tpl
@echo " ** CodegenFMUCpp template compilation ** "
$(OMC) $< > $@.log || (cat $@.log && false)
@echo " "
Expand Down

0 comments on commit bcde872

Please sign in to comment.