summaryrefslogtreecommitdiffstats
path: root/generic/tclAssembly.c
diff options
context:
space:
mode:
authorKevin B Kenny <kennykb@acm.org>2017-03-15 02:40:56 (GMT)
committerKevin B Kenny <kennykb@acm.org>2017-03-15 02:40:56 (GMT)
commitbbe4542d364121720a36d12051e45c8c42cf25d9 (patch)
treecc56a92667132923a5a6db8320ad3e2df4a0fd60 /generic/tclAssembly.c
parentbbf9191cdf2558bb4e7571a1cf57886d79826c7e (diff)
parent89b08916f5e330151206c6ab42468f957bfd41af (diff)
downloadtcl-bbe4542d364121720a36d12051e45c8c42cf25d9.zip
tcl-bbe4542d364121720a36d12051e45c8c42cf25d9.tar.gz
tcl-bbe4542d364121720a36d12051e45c8c42cf25d9.tar.bz2
Compile [clock clicks], [clock microseconds], [clock milliseconds] and [clock seconds].
Diffstat (limited to 'generic/tclAssembly.c')
-rw-r--r--generic/tclAssembly.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/generic/tclAssembly.c b/generic/tclAssembly.c
index 8c6f81a..4c5ae68 100644
--- a/generic/tclAssembly.c
+++ b/generic/tclAssembly.c
@@ -137,6 +137,8 @@ typedef enum TalInstType {
* ranges */
ASSEM_BOOL, /* One Boolean operand */
ASSEM_BOOL_LVT4, /* One Boolean, one 4-byte LVT ref. */
+ ASSEM_CLOCK_READ, /* 1-byte unsigned-integer case number, in the
+ * range 0-3 */
ASSEM_CONCAT1, /* 1-byte unsigned-integer operand count, must
* be strictly positive, consumes N, produces
* 1 */
@@ -350,6 +352,7 @@ static const TalInstDesc TalInstructionTable[] = {
{"bitnot", ASSEM_1BYTE, INST_BITNOT, 1, 1},
{"bitor", ASSEM_1BYTE, INST_BITOR, 2, 1},
{"bitxor", ASSEM_1BYTE, INST_BITXOR, 2, 1},
+ {"clockRead", ASSEM_CLOCK_READ, INST_CLOCK_READ, 0, 1},
{"concat", ASSEM_CONCAT1, INST_STR_CONCAT1, INT_MIN,1},
{"concatStk", ASSEM_LIST, INST_CONCAT_STK, INT_MIN,1},
{"coroName", ASSEM_1BYTE, INST_COROUTINE_NAME, 0, 1},
@@ -1361,6 +1364,23 @@ AssembleOneLine(
TclEmitInt4(localVar, envPtr);
break;
+ case ASSEM_CLOCK_READ:
+ if (parsePtr->numWords != 2) {
+ Tcl_WrongNumArgs(interp, 1, &instNameObj, "imm8");
+ goto cleanup;
+ }
+ if (GetIntegerOperand(assemEnvPtr, &tokenPtr, &opnd) != TCL_OK) {
+ goto cleanup;
+ }
+ if (opnd < 0 || opnd > 3) {
+ Tcl_SetObjResult(interp,
+ Tcl_NewStringObj("operand must be [0..3]", -1));
+ Tcl_SetErrorCode(interp, "TCL", "ASSEM", "OPERAND<0,>3", NULL);
+ goto cleanup;
+ }
+ BBEmitInstInt1(assemEnvPtr, tblIdx, opnd, opnd);
+ break;
+
case ASSEM_CONCAT1:
if (parsePtr->numWords != 2) {
Tcl_WrongNumArgs(interp, 1, &instNameObj, "imm8");