diff options
author | Stefan Radomski <sradomski@mintwerk.de> | 2016-01-20 23:27:47 (GMT) |
---|---|---|
committer | Stefan Radomski <sradomski@mintwerk.de> | 2016-01-20 23:27:47 (GMT) |
commit | 762eb95910cd4dfad6a84f97332b7549b2fdbd69 (patch) | |
tree | 81cd2bef6106f28fbd6289c85e8a2d779a4fb1e0 | |
parent | 29586fff4c6ea5ded7e787e30fceafda84db23d1 (diff) | |
download | uscxml-762eb95910cd4dfad6a84f97332b7549b2fdbd69.zip uscxml-762eb95910cd4dfad6a84f97332b7549b2fdbd69.tar.gz uscxml-762eb95910cd4dfad6a84f97332b7549b2fdbd69.tar.bz2 |
Reverted a erroneous bugfix
-rw-r--r-- | README.md | 14 | ||||
-rw-r--r-- | src/uscxml/transform/ChartToC.cpp | 3 | ||||
-rw-r--r-- | test/src/test-c-machine.machine.c | 10 |
3 files changed, 14 insertions, 13 deletions
@@ -109,12 +109,14 @@ upon](https://github.com/tklab-tud/uscxml/blob/master/docs/BUILDING.md#build-dep ## Performance -We did some performance measurements in the scope of the [C transformation](https://github.com/tklab-tud/uscxml/blob/master/test/src/test-c-machine.machine.c). As you can see in the -figure below, for most IRP tests we average to a duration of 5-20us per microstep in the case of -generated/compiled C. For interpretation at runtime, we average at around 70-130us per -microstep. The generated C is rather optimized while the focus of the interpreter is more on -correctness, feature completeness and extensibility. However, there are some lessons learned -that are yet to be applied for the interpreter. +We did some performance measurements in the scope of the C transformation. As +you can see in the figure below, for most IRP tests we average to a duration of +5-20us per microstep on an early 2015 MacBook Pro 13" with 3.1Ghz in the case +of [generated/compiled C](https://github.com/tklab-tud/uscxml/blob/master/test/src/test-c-machine.machine.c). For interpretation at runtime, we average at around 70-130us per +microstep. The generated C is rather optimized while the focus of the +interpreter is more on correctness, feature completeness and extensibility. +However, there are some lessons learned that are yet to be applied for the +interpreter. <img src="https://raw.github.com/tklab-tud/uscxml/master/docs/Performance_Microstep.png" width="500px" /> diff --git a/src/uscxml/transform/ChartToC.cpp b/src/uscxml/transform/ChartToC.cpp index cb54257..e726d7f 100644 --- a/src/uscxml/transform/ChartToC.cpp +++ b/src/uscxml/transform/ChartToC.cpp @@ -1615,8 +1615,7 @@ void ChartToC::writeFSM(std::ostream& stream) { stream << " bit_copy(history_targets, scxml_states[i].completion, " << _stateCharArraySize << ");" << std::endl; stream << " bit_and(history_targets, ctx->history, " << _stateCharArraySize << ");" << std::endl; stream << " bit_or(entry_set, history_targets, " << _stateCharArraySize << ");" << std::endl; - stream << " if (SCXML_STATE_MASK(scxml_states[i].type) == SCXML_STATE_HAS_HISTORY || " << std::endl; - stream << " SCXML_STATE_MASK(scxml_states[i].type) == SCXML_STATE_HISTORY_DEEP) {" << std::endl; + stream << " if (scxml_states[i].type == (SCXML_STATE_HAS_HISTORY | SCXML_STATE_HISTORY_DEEP)) {" << std::endl; stream << " // a deep history state with nested histories -> more completion" << std::endl; stream << " for (size_t j = i + 1; j < SCXML_NUMBER_STATES; j++) {" << std::endl; stream << " if (IS_SET(j, scxml_states[i].completion) &&" << std::endl; diff --git a/test/src/test-c-machine.machine.c b/test/src/test-c-machine.machine.c index d42d577..09e7703 100644 --- a/test/src/test-c-machine.machine.c +++ b/test/src/test-c-machine.machine.c @@ -635,8 +635,8 @@ ESTABLISH_ENTRY_SET: SET_BIT(j, trans_set); break; } + // Note: SCXML mandates every history to have a transition! } - // TODO: enter parents default completion here } else { bit_copy(history_targets, scxml_states[i].completion, 2); bit_and(history_targets, ctx->history, 2); @@ -649,8 +649,8 @@ ESTABLISH_ENTRY_SET: (scxml_states[j].type & SCXML_STATE_HAS_HISTORY)) { for (size_t k = j + 1; k < SCXML_NUMBER_STATES; k++) { // add nested history to entry_set - if ((scxml_states[k].type == SCXML_STATE_HISTORY_DEEP || - scxml_states[k].type == SCXML_STATE_HISTORY_SHALLOW) && + if ((SCXML_STATE_MASK(scxml_states[k].type) == SCXML_STATE_HISTORY_DEEP || + SCXML_STATE_MASK(scxml_states[k].type) == SCXML_STATE_HISTORY_SHALLOW) && IS_SET(k, scxml_states[j].children)) { // a nested history state SET_BIT(k, entry_set); @@ -668,7 +668,7 @@ ESTABLISH_ENTRY_SET: SET_BIT(j, trans_set); CLEARBIT(i, entry_set); bit_or(entry_set, scxml_transitions[j].target, 2); - for (size_t k = 0; k < SCXML_NUMBER_STATES; k++) { + for (size_t k = i + 1; k < SCXML_NUMBER_STATES; k++) { if (IS_SET(k, scxml_transitions[j].target)) { bit_or(entry_set, scxml_states[k].ancestors, 2); } @@ -685,7 +685,7 @@ ESTABLISH_ENTRY_SET: bit_or(entry_set, scxml_states[i].completion, 2); if (!bit_has_and(scxml_states[i].completion, scxml_states[i].children, 2)) { // deep completion - for (size_t j = 0; j < SCXML_NUMBER_STATES; j++) { + for (size_t j = i + 1; j < SCXML_NUMBER_STATES; j++) { if (IS_SET(j, scxml_states[i].completion)) { bit_or(entry_set, scxml_states[j].ancestors, 2); break; // completion of compound is single state |