summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authormig <mig>2013-01-11 18:05:50 (GMT)
committermig <mig>2013-01-11 18:05:50 (GMT)
commitf531d3de422a79dcc477d10d83f2badbbc27e8ea (patch)
treee162abe54acc0422b4e03e7cb397969bc3218dd9 /generic
parent496f711ae9cf8d67deb17e52f10b5b3ae39646f7 (diff)
downloadtcl-f531d3de422a79dcc477d10d83f2badbbc27e8ea.zip
tcl-f531d3de422a79dcc477d10d83f2badbbc27e8ea.tar.gz
tcl-f531d3de422a79dcc477d10d83f2badbbc27e8ea.tar.bz2
fix for consecutive ISC (produced by [while 1 {...})
Diffstat (limited to 'generic')
-rw-r--r--generic/tclExecute.c37
1 files changed, 16 insertions, 21 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index ae9d0c7..bc755e8 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -2300,16 +2300,10 @@ TEBCresume(
TCL_DTRACE_INST_NEXT();
- /*
- * These two instructions account for 26% of all instructions (according
- * to measurements on tclbench by Ben Vitale
- * [http://www.cs.toronto.edu/syslab/pubs/tcl2005-vitale-zaleski.pdf]
- * Resolving them before the switch reduces the cost of branch
- * mispredictions, seems to improve runtime by 5% to 15%, and (amazingly!)
- * reduces total obj size.
- */
-
- if (*pc == INST_START_CMD) {
+ while (*pc == INST_START_CMD) {
+#ifdef TCL_COMPILE_STATS
+ iPtr->stats.instructionCount[*pc]++;
+#endif
iPtr->cmdCount += TclGetUInt4AtPtr(pc+5);
if (checkInterp) {
checkInterp = 0;
@@ -2321,6 +2315,15 @@ TEBCresume(
pc += 9;
}
+ /*
+ * These two instructions account for 26% of all instructions (according
+ * to measurements on tclbench by Ben Vitale
+ * [http://www.cs.toronto.edu/syslab/pubs/tcl2005-vitale-zaleski.pdf]
+ * Resolving them before the switch reduces the cost of branch
+ * mispredictions, seems to improve runtime by 5% to 15%, and (amazingly!)
+ * reduces total obj size.
+ */
+
if (*pc == INST_LOAD_SCALAR1) {
goto instLoadScalar1;
} else if (*pc == INST_PUSH1) {
@@ -2503,19 +2506,10 @@ TEBCresume(
TRACE_WITH_OBJ(("=> discarding "), OBJ_AT_TOS);
objPtr = POP_OBJECT();
TclDecrRefCount(objPtr);
-
- /*
- * Runtime peephole optimisation: an INST_POP is scheduled at the end
- * of most commands. If the next instruction is an INST_START_CMD,
- * fall through to it.
- */
-
- pc++;
- NEXT_INST_F(0, 0, 0);
+ NEXT_INST_F(1, 0, 0);
case INST_NOP:
- pc += 1;
- goto cleanup0;
+ NEXT_INST_F(1, 0, 0);
case INST_DUP:
objResultPtr = OBJ_AT_TOS;
@@ -7081,6 +7075,7 @@ TEBCresume(
{
const char *bytes;
+ checkInterp = 1;
length = 0;
/*