summaryrefslogtreecommitdiffstats
path: root/generic/tclAssembly.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2013-10-20 18:44:22 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2013-10-20 18:44:22 (GMT)
commite1e7fafd59ee6d7ca2cc2ddb51b4cad37397249d (patch)
treea54217a116100c7326fa1745091bea13b3727a0b /generic/tclAssembly.c
parenta1ae4070993b7b225719352db81a4acd872b751e (diff)
parent8d4b93ccb7866e2a35c9b77117a07dcf7a482a88 (diff)
downloadtcl-e1e7fafd59ee6d7ca2cc2ddb51b4cad37397249d.zip
tcl-e1e7fafd59ee6d7ca2cc2ddb51b4cad37397249d.tar.gz
tcl-e1e7fafd59ee6d7ca2cc2ddb51b4cad37397249d.tar.bz2
merge trunk
Diffstat (limited to 'generic/tclAssembly.c')
-rw-r--r--generic/tclAssembly.c34
1 files changed, 31 insertions, 3 deletions
diff --git a/generic/tclAssembly.c b/generic/tclAssembly.c
index 44cddba..254d344 100644
--- a/generic/tclAssembly.c
+++ b/generic/tclAssembly.c
@@ -246,6 +246,8 @@ static void BBEmitInstInt4(AssemblyEnv* assemEnvPtr, int tblIdx,
int opnd, int count);
static void BBEmitInst1or4(AssemblyEnv* assemEnvPtr, int tblIdx,
int param, int count);
+static void BBEmitInvoke1or4(AssemblyEnv* assemEnvPtr, int tblIdx,
+ int param, int count);
static void BBEmitOpcode(AssemblyEnv* assemEnvPtr, int tblIdx,
int count);
static int BuildExceptionRanges(AssemblyEnv* assemEnvPtr);
@@ -683,10 +685,13 @@ BBEmitInstInt4(
/*
*-----------------------------------------------------------------------------
*
- * BBEmitInst1or4 --
+ * BBEmitInst1or4, BBEmitInvoke1or4 --
*
* Emits a 1- or 4-byte operation according to the magnitude of the
- * operand
+ * operand. The Invoke variant generates wrapping stack-balance
+ * management if necessary (which is not normally required in assembled
+ * code, as loop exception ranges, expansions, breaks and continues can't
+ * be issued currently).
*
*-----------------------------------------------------------------------------
*/
@@ -718,6 +723,29 @@ BBEmitInst1or4(
TclUpdateAtCmdStart(op, envPtr);
BBUpdateStackReqs(bbPtr, tblIdx, count);
}
+
+static void
+BBEmitInvoke1or4(
+ AssemblyEnv* assemEnvPtr, /* Assembly environment */
+ int tblIdx, /* Index in TalInstructionTable of op */
+ int param, /* Variable-length parameter */
+ int count) /* Arity if variadic */
+{
+ CompileEnv* envPtr = assemEnvPtr->envPtr;
+ /* Compilation environment */
+ BasicBlock* bbPtr = assemEnvPtr->curr_bb;
+ /* Current basic block */
+ int op = TalInstructionTable[tblIdx].tclInstCode;
+
+ if (param <= 0xff) {
+ op >>= 8;
+ } else {
+ op &= 0xff;
+ }
+ TclEmitInvoke(envPtr, op, param);
+ TclUpdateAtCmdStart(op, envPtr);
+ BBUpdateStackReqs(bbPtr, tblIdx, count);
+}
/*
*-----------------------------------------------------------------------------
@@ -1454,7 +1482,7 @@ AssembleOneLine(
goto cleanup;
}
- BBEmitInst1or4(assemEnvPtr, tblIdx, opnd, opnd);
+ BBEmitInvoke1or4(assemEnvPtr, tblIdx, opnd, opnd);
break;
case ASSEM_JUMP: