summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormig <mig>2013-12-20 21:59:28 (GMT)
committermig <mig>2013-12-20 21:59:28 (GMT)
commitdb7ebfac4369ff2b956e1f5d7a8865e88d4ffc50 (patch)
tree369c1986c44ad9e1aca2cebf078fb10f90fc3b31
parent40ee4723305e14d61c083785f230b614b2829361 (diff)
downloadtcl-db7ebfac4369ff2b956e1f5d7a8865e88d4ffc50.zip
tcl-db7ebfac4369ff2b956e1f5d7a8865e88d4ffc50.tar.gz
tcl-db7ebfac4369ff2b956e1f5d7a8865e88d4ffc50.tar.bz2
remove INST_TRY_CVT_TO_NUMERIC when it is known not be necessary (cherrypick from mig-optimize)
-rw-r--r--generic/tclCompCmds.c1
-rw-r--r--generic/tclCompCmdsGR.c2
-rw-r--r--generic/tclCompCmdsSZ.c1
-rw-r--r--generic/tclCompile.h12
4 files changed, 16 insertions, 0 deletions
diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c
index 72b338c..b7fc9b5 100644
--- a/generic/tclCompCmds.c
+++ b/generic/tclCompCmds.c
@@ -2276,6 +2276,7 @@ TclCompileForCmd(
SetLineInformation(2);
TclCompileExprWords(interp, testTokenPtr, 1, envPtr);
+ TclClearNumConversion(envPtr);
jumpDist = CurrentOffset(envPtr) - bodyCodeOffset;
if (jumpDist > 127) {
diff --git a/generic/tclCompCmdsGR.c b/generic/tclCompCmdsGR.c
index d00327d..b7c89df 100644
--- a/generic/tclCompCmdsGR.c
+++ b/generic/tclCompCmdsGR.c
@@ -229,6 +229,7 @@ TclCompileIfCmd(
SetLineInformation(wordIdx);
Tcl_ResetResult(interp);
TclCompileExprWords(interp, testTokenPtr, 1, envPtr);
+ TclClearNumConversion(envPtr);
if (jumpFalseFixupArray.next >= jumpFalseFixupArray.end) {
TclExpandJumpFixupArray(&jumpFalseFixupArray);
}
@@ -478,6 +479,7 @@ TclCompileIncrCmd(
} else {
SetLineInformation(2);
CompileTokens(envPtr, incrTokenPtr, interp);
+ TclClearNumConversion(envPtr);
}
} else { /* No incr amount given so use 1. */
haveImmValue = 1;
diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c
index 754238f..3e4a55a 100644
--- a/generic/tclCompCmdsSZ.c
+++ b/generic/tclCompCmdsSZ.c
@@ -3071,6 +3071,7 @@ TclCompileWhileCmd(
}
SetLineInformation(1);
TclCompileExprWords(interp, testTokenPtr, 1, envPtr);
+ TclClearNumConversion(envPtr);
jumpDist = CurrentOffset(envPtr) - bodyCodeOffset;
if (jumpDist > 127) {
diff --git a/generic/tclCompile.h b/generic/tclCompile.h
index b421aaf..287ab1d 100644
--- a/generic/tclCompile.h
+++ b/generic/tclCompile.h
@@ -1309,6 +1309,18 @@ MODULE_SCOPE Tcl_Obj *TclNewInstNameObj(unsigned char inst);
} while (0)
/*
+ * If the expr compiler finished with TRY_CONVERT, macro to remove it when the
+ * job is done by the following instruction.
+ */
+
+#define TclClearNumConversion(envPtr) \
+ do { \
+ if (*(envPtr->codeNext - 1) == INST_TRY_CVT_TO_NUMERIC) { \
+ envPtr->codeNext--; \
+ } \
+ } while (0)
+
+/*
* Macros to update a (signed or unsigned) integer starting at a pointer. The
* two variants depend on the number of bytes. The ANSI C "prototypes" for
* these macros are: