summaryrefslogtreecommitdiffstats
path: root/generic/tclAssembly.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2019-04-19 00:38:32 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2019-04-19 00:38:32 (GMT)
commit28863a761275880bb39f71acd0793457cb9aa932 (patch)
treed5f2cd9466dd16778484e8ac11d072efe498c19d /generic/tclAssembly.c
parent63942f2e8d2f02745918ec17e0aca4819066df63 (diff)
parent8b9a3558a42cba96fe30f272517260aef43ec7f8 (diff)
downloadtcl-28863a761275880bb39f71acd0793457cb9aa932.zip
tcl-28863a761275880bb39f71acd0793457cb9aa932.tar.gz
tcl-28863a761275880bb39f71acd0793457cb9aa932.tar.bz2
merge 8.7
Diffstat (limited to 'generic/tclAssembly.c')
-rw-r--r--generic/tclAssembly.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/generic/tclAssembly.c b/generic/tclAssembly.c
index a9eb6b2..33d8d6f 100644
--- a/generic/tclAssembly.c
+++ b/generic/tclAssembly.c
@@ -145,6 +145,8 @@ typedef enum TalInstType {
* 1 */
ASSEM_DICT_GET, /* 'dict get' and related - consumes N+1
* operands, produces 1, N > 0 */
+ ASSEM_DICT_GET_DEF, /* 'dict getwithdefault' - consumes N+2
+ * operands, produces 1, N > 0 */
ASSEM_DICT_SET, /* specifies key count and LVT index, consumes
* N+1 operands, produces 1, N > 0 */
ASSEM_DICT_UNSET, /* specifies key count and LVT index, consumes
@@ -362,6 +364,7 @@ static const TalInstDesc TalInstructionTable[] = {
{"dictExists", ASSEM_DICT_GET, INST_DICT_EXISTS, INT_MIN,1},
{"dictExpand", ASSEM_1BYTE, INST_DICT_EXPAND, 3, 1},
{"dictGet", ASSEM_DICT_GET, INST_DICT_GET, INT_MIN,1},
+ {"dictGetDef", ASSEM_DICT_GET_DEF, INST_DICT_GET_DEF, INT_MIN,1},
{"dictIncrImm", ASSEM_SINT4_LVT4,
INST_DICT_INCR_IMM, 1, 1},
{"dictLappend", ASSEM_LVT4, INST_DICT_LAPPEND, 2, 1},
@@ -617,10 +620,14 @@ BBUpdateStackReqs(
if (consumed == INT_MIN) {
/*
- * The instruction is variadic; it consumes 'count' operands.
+ * The instruction is variadic; it consumes 'count' operands, or
+ * 'count+1' for ASSEM_DICT_GET_DEF.
*/
consumed = count;
+ if (TalInstructionTable[tblIdx].instType == ASSEM_DICT_GET_DEF) {
+ consumed++;
+ }
}
if (produced < 0) {
/*
@@ -1394,6 +1401,7 @@ AssembleOneLine(
break;
case ASSEM_DICT_GET:
+ case ASSEM_DICT_GET_DEF:
if (parsePtr->numWords != 2) {
Tcl_WrongNumArgs(interp, 1, &instNameObj, "count");
goto cleanup;