Attachment "bc84.diff" to
ticket [1720895fff]
added by
hobbs
2007-05-18 01:13:12.
0000: 49 6e 64 65 78 3a 20 67 65 6e 65 72 69 63 2f 74 Index: generic/t
0010: 63 6c 45 78 65 63 75 74 65 2e 63 0a 3d 3d 3d 3d clExecute.c.====
0020: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
0030: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
0040: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
0050: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a ===============.
0060: 52 43 53 20 66 69 6c 65 3a 20 2f 63 76 73 72 6f RCS file: /cvsro
0070: 6f 74 2f 74 63 6c 2f 74 63 6c 2f 67 65 6e 65 72 ot/tcl/tcl/gener
0080: 69 63 2f 74 63 6c 45 78 65 63 75 74 65 2e 63 2c ic/tclExecute.c,
0090: 76 0a 72 65 74 72 69 65 76 69 6e 67 20 72 65 76 v.retrieving rev
00a0: 69 73 69 6f 6e 20 31 2e 32 38 35 0a 64 69 66 66 ision 1.285.diff
00b0: 20 2d 75 20 2d 72 31 2e 32 38 35 20 74 63 6c 45 -u -r1.285 tclE
00c0: 78 65 63 75 74 65 2e 63 0a 2d 2d 2d 20 67 65 6e xecute.c.--- gen
00d0: 65 72 69 63 2f 74 63 6c 45 78 65 63 75 74 65 2e eric/tclExecute.
00e0: 63 09 31 37 20 4d 61 79 20 32 30 30 37 20 31 33 c.17 May 2007 13
00f0: 3a 34 35 3a 32 37 20 2d 30 30 30 30 09 31 2e 32 :45:27 -0000.1.2
0100: 38 35 0a 2b 2b 2b 20 67 65 6e 65 72 69 63 2f 74 85.+++ generic/t
0110: 63 6c 45 78 65 63 75 74 65 2e 63 09 31 37 20 4d clExecute.c.17 M
0120: 61 79 20 32 30 30 37 20 31 38 3a 30 39 3a 35 39 ay 2007 18:09:59
0130: 20 2d 30 30 30 30 0a 40 40 20 2d 31 31 39 2c 36 -0000.@@ -119,6
0140: 20 2b 31 31 39 2c 36 35 20 40 40 0a 20 23 65 6e +119,65 @@. #en
0150: 64 69 66 20 2f 2a 20 54 43 4c 5f 43 4f 4d 50 49 dif /* TCL_COMPI
0160: 4c 45 5f 53 54 41 54 53 20 2a 2f 0a 20 0a 20 2f LE_STATS */. . /
0170: 2a 0a 2b 20 2a 20 53 75 70 70 6f 72 74 20 70 72 *.+ * Support pr
0180: 65 2d 38 2e 35 20 62 79 74 65 63 6f 64 65 73 20 e-8.5 bytecodes
0190: 75 6e 6c 65 73 73 20 73 70 65 63 69 66 69 63 61 unless specifica
01a0: 6c 6c 79 20 72 65 71 75 65 73 74 65 64 20 6f 74 lly requested ot
01b0: 68 65 72 77 69 73 65 0a 2b 20 2a 2f 0a 2b 0a 2b herwise.+ */.+.+
01c0: 23 69 66 6e 64 65 66 20 54 43 4c 5f 53 55 50 50 #ifndef TCL_SUPP
01d0: 4f 52 54 5f 38 34 5f 42 59 54 45 43 4f 44 45 0a ORT_84_BYTECODE.
01e0: 2b 23 64 65 66 69 6e 65 20 54 43 4c 5f 53 55 50 +#define TCL_SUP
01f0: 50 4f 52 54 5f 38 34 5f 42 59 54 45 43 4f 44 45 PORT_84_BYTECODE
0200: 20 31 0a 2b 23 65 6e 64 69 66 0a 2b 0a 2b 23 69 1.+#endif.+.+#i
0210: 66 20 54 43 4c 5f 53 55 50 50 4f 52 54 5f 38 34 f TCL_SUPPORT_84
0220: 5f 42 59 54 45 43 4f 44 45 0a 2b 2f 2a 0a 2b 20 _BYTECODE.+/*.+
0230: 2a 20 57 65 20 6e 65 65 64 20 74 6f 20 6b 6e 6f * We need to kno
0240: 77 20 74 68 65 20 74 63 6c 42 75 69 6c 74 69 6e w the tclBuiltin
0250: 46 75 6e 63 54 61 62 6c 65 20 74 6f 20 73 75 70 FuncTable to sup
0260: 70 6f 72 74 20 74 72 61 6e 73 6c 61 74 69 6f 6e port translation
0270: 20 6f 66 20 70 72 65 2d 38 2e 35 0a 2b 20 2a 20 of pre-8.5.+ *
0280: 6d 61 74 68 20 66 75 6e 63 74 69 6f 6e 73 20 74 math functions t
0290: 6f 20 74 68 65 20 6e 61 6d 65 73 70 61 63 65 2d o the namespace-
02a0: 62 61 73 65 64 20 3a 3a 74 63 6c 3a 3a 6d 61 74 based ::tcl::mat
02b0: 68 66 75 6e 63 3a 3a 6f 70 20 69 6e 20 38 2e 35 hfunc::op in 8.5
02c0: 2b 2e 0a 2b 20 2a 2f 0a 2b 0a 2b 74 79 70 65 64 +..+ */.+.+typed
02d0: 65 66 20 73 74 72 75 63 74 20 7b 0a 2b 20 20 20 ef struct {.+
02e0: 20 63 68 61 72 20 2a 6e 61 6d 65 3b 09 09 2f 2a char *name;../*
02f0: 20 4e 61 6d 65 20 6f 66 20 66 75 6e 63 74 69 6f Name of functio
0300: 6e 2e 20 2a 2f 0a 2b 20 20 20 20 69 6e 74 20 6e n. */.+ int n
0310: 75 6d 41 72 67 73 3b 09 2f 2a 20 4e 75 6d 62 65 umArgs;./* Numbe
0320: 72 20 6f 66 20 61 72 67 75 6d 65 6e 74 73 20 66 r of arguments f
0330: 6f 72 20 66 75 6e 63 74 69 6f 6e 2e 20 2a 2f 0a or function. */.
0340: 2b 7d 20 42 75 69 6c 74 69 6e 46 75 6e 63 3b 0a +} BuiltinFunc;.
0350: 2b 0a 2b 2f 2a 0a 2b 20 2a 20 54 61 62 6c 65 20 +.+/*.+ * Table
0360: 64 65 73 63 72 69 62 69 6e 67 20 74 68 65 20 62 describing the b
0370: 75 69 6c 74 2d 69 6e 20 6d 61 74 68 20 66 75 6e uilt-in math fun
0380: 63 74 69 6f 6e 73 2e 20 45 6e 74 72 69 65 73 20 ctions. Entries
0390: 69 6e 20 74 68 69 73 20 74 61 62 6c 65 20 61 72 in this table ar
03a0: 65 0a 2b 20 2a 20 69 6e 64 65 78 65 64 20 62 79 e.+ * indexed by
03b0: 20 74 68 65 20 76 61 6c 75 65 73 20 6f 66 20 74 the values of t
03c0: 68 65 20 49 4e 53 54 5f 43 41 4c 4c 5f 42 55 49 he INST_CALL_BUI
03d0: 4c 54 49 4e 5f 46 55 4e 43 20 69 6e 73 74 72 75 LTIN_FUNC instru
03e0: 63 74 69 6f 6e 27 73 0a 2b 20 2a 20 6f 70 65 72 ction's.+ * oper
03f0: 61 6e 64 20 62 79 74 65 2e 0a 2b 20 2a 2f 0a 2b and byte..+ */.+
0400: 0a 2b 73 74 61 74 69 63 20 42 75 69 6c 74 69 6e .+static Builtin
0410: 46 75 6e 63 20 74 63 6c 42 75 69 6c 74 69 6e 46 Func tclBuiltinF
0420: 75 6e 63 54 61 62 6c 65 5b 5d 20 3d 20 7b 0a 2b uncTable[] = {.+
0430: 20 20 20 20 7b 22 61 63 6f 73 22 2c 20 31 7d 2c {"acos", 1},
0440: 0a 2b 20 20 20 20 7b 22 61 73 69 6e 22 2c 20 31 .+ {"asin", 1
0450: 7d 2c 0a 2b 20 20 20 20 7b 22 61 74 61 6e 22 2c },.+ {"atan",
0460: 20 31 7d 2c 0a 2b 20 20 20 20 7b 22 61 74 61 6e 1},.+ {"atan
0470: 32 22 2c 20 32 7d 2c 0a 2b 20 20 20 20 7b 22 63 2", 2},.+ {"c
0480: 65 69 6c 22 2c 20 31 7d 2c 0a 2b 20 20 20 20 7b eil", 1},.+ {
0490: 22 63 6f 73 22 2c 20 31 7d 2c 0a 2b 20 20 20 20 "cos", 1},.+
04a0: 7b 22 63 6f 73 68 22 2c 20 31 7d 2c 0a 2b 20 20 {"cosh", 1},.+
04b0: 20 20 7b 22 65 78 70 22 2c 20 31 7d 2c 0a 2b 20 {"exp", 1},.+
04c0: 20 20 20 7b 22 66 6c 6f 6f 72 22 2c 20 31 7d 2c {"floor", 1},
04d0: 0a 2b 20 20 20 20 7b 22 66 6d 6f 64 22 2c 20 32 .+ {"fmod", 2
04e0: 7d 2c 0a 2b 20 20 20 20 7b 22 68 79 70 6f 74 22 },.+ {"hypot"
04f0: 2c 20 32 7d 2c 0a 2b 20 20 20 20 7b 22 6c 6f 67 , 2},.+ {"log
0500: 22 2c 20 31 7d 2c 0a 2b 20 20 20 20 7b 22 6c 6f ", 1},.+ {"lo
0510: 67 31 30 22 2c 20 31 7d 2c 0a 2b 20 20 20 20 7b g10", 1},.+ {
0520: 22 70 6f 77 22 2c 20 32 7d 2c 0a 2b 20 20 20 20 "pow", 2},.+
0530: 7b 22 73 69 6e 22 2c 20 31 7d 2c 0a 2b 20 20 20 {"sin", 1},.+
0540: 20 7b 22 73 69 6e 68 22 2c 20 31 7d 2c 0a 2b 20 {"sinh", 1},.+
0550: 20 20 20 7b 22 73 71 72 74 22 2c 20 31 7d 2c 0a {"sqrt", 1},.
0560: 2b 20 20 20 20 7b 22 74 61 6e 22 2c 20 31 7d 2c + {"tan", 1},
0570: 0a 2b 20 20 20 20 7b 22 74 61 6e 68 22 2c 20 31 .+ {"tanh", 1
0580: 7d 2c 0a 2b 20 20 20 20 7b 22 61 62 73 22 2c 20 },.+ {"abs",
0590: 31 7d 2c 0a 2b 20 20 20 20 7b 22 64 6f 75 62 6c 1},.+ {"doubl
05a0: 65 22 2c 20 31 7d 2c 0a 2b 20 20 20 20 7b 22 69 e", 1},.+ {"i
05b0: 6e 74 22 2c 20 31 7d 2c 0a 2b 20 20 20 20 7b 22 nt", 1},.+ {"
05c0: 72 61 6e 64 22 2c 20 30 7d 2c 0a 2b 20 20 20 20 rand", 0},.+
05d0: 7b 22 72 6f 75 6e 64 22 2c 20 31 7d 2c 0a 2b 20 {"round", 1},.+
05e0: 20 20 20 7b 22 73 72 61 6e 64 22 2c 20 31 7d 2c {"srand", 1},
05f0: 0a 2b 20 20 20 20 7b 22 77 69 64 65 22 2c 20 31 .+ {"wide", 1
0600: 7d 2c 0a 2b 20 20 20 20 7b 30 7d 2c 0a 2b 7d 3b },.+ {0},.+};
0610: 0a 2b 0a 2b 23 64 65 66 69 6e 65 20 4c 41 53 54 .+.+#define LAST
0620: 5f 42 55 49 4c 54 49 4e 5f 46 55 4e 43 09 32 35 _BUILTIN_FUNC.25
0630: 0a 2b 0a 2b 23 65 6e 64 69 66 0a 2b 0a 2b 2f 2a .+.+#endif.+.+/*
0640: 0a 20 20 2a 20 54 68 65 20 6e 65 77 20 6d 61 63 . * The new mac
0650: 72 6f 20 66 6f 72 20 65 6e 64 69 6e 67 20 61 6e ro for ending an
0660: 20 69 6e 73 74 72 75 63 74 69 6f 6e 3b 20 6e 6f instruction; no
0670: 74 65 20 74 68 61 74 20 61 20 72 65 61 73 6f 6e te that a reason
0680: 61 62 6c 65 20 43 2d 6f 70 74 69 6d 69 73 65 72 able C-optimiser
0690: 0a 20 20 2a 20 77 69 6c 6c 20 72 65 73 6f 6c 76 . * will resolv
06a0: 65 20 61 6c 6c 20 62 72 61 6e 63 68 65 73 20 61 e all branches a
06b0: 74 20 63 6f 6d 70 69 6c 65 20 74 69 6d 65 2e 20 t compile time.
06c0: 28 72 65 73 75 6c 74 29 20 69 73 20 61 6c 77 61 (result) is alwa
06d0: 79 73 20 61 20 63 6f 6e 73 74 61 6e 74 3b 0a 20 ys a constant;.
06e0: 20 2a 20 74 68 65 20 6d 61 63 72 6f 20 4e 45 58 * the macro NEX
06f0: 54 5f 49 4e 53 54 5f 46 20 68 61 6e 64 6c 65 73 T_INST_F handles
0700: 20 63 6f 6e 73 74 61 6e 74 20 28 6e 43 6c 65 61 constant (nClea
0710: 6e 75 70 29 2c 20 4e 45 58 54 5f 49 4e 53 54 5f nup), NEXT_INST_
0720: 56 20 69 73 20 72 65 73 6f 6c 76 65 64 0a 40 40 V is resolved.@@
0730: 20 2d 31 39 32 36 2c 36 20 2b 31 39 38 35 2c 38 -1926,6 +1985,8
0740: 36 20 40 40 0a 20 09 09 67 6f 74 6f 20 70 72 6f 6 @@. ..goto pro
0750: 63 65 73 73 45 78 63 65 70 74 69 6f 6e 52 65 74 cessExceptionRet
0760: 75 72 6e 3b 0a 20 09 20 20 20 20 7d 0a 20 09 7d urn;. . }. .}
0770: 0a 2b 0a 2b 23 69 66 20 54 43 4c 5f 53 55 50 50 .+.+#if TCL_SUPP
0780: 4f 52 54 5f 38 34 5f 42 59 54 45 43 4f 44 45 0a ORT_84_BYTECODE.
0790: 2b 20 20 20 20 63 61 73 65 20 49 4e 53 54 5f 43 + case INST_C
07a0: 41 4c 4c 5f 42 55 49 4c 54 49 4e 5f 46 55 4e 43 ALL_BUILTIN_FUNC
07b0: 31 3a 20 7b 0a 2b 09 2f 2a 0a 2b 09 20 2a 20 43 1: {.+./*.+. * C
07c0: 61 6c 6c 20 6f 6e 65 20 6f 66 20 74 68 65 20 62 all one of the b
07d0: 75 69 6c 74 2d 69 6e 20 70 72 65 2d 38 2e 35 20 uilt-in pre-8.5
07e0: 54 63 6c 20 6d 61 74 68 20 66 75 6e 63 74 69 6f Tcl math functio
07f0: 6e 73 2e 0a 2b 09 20 2a 20 54 68 69 73 20 74 72 ns..+. * This tr
0800: 61 6e 73 6c 61 74 65 73 20 74 6f 20 49 4e 53 54 anslates to INST
0810: 5f 49 4e 56 4f 4b 45 5f 53 54 4b 31 20 77 69 74 _INVOKE_STK1 wit
0820: 68 20 74 68 65 20 66 69 72 73 74 20 61 72 67 75 h the first argu
0830: 6d 65 6e 74 20 6f 66 0a 2b 09 20 2a 20 3a 3a 74 ment of.+. * ::t
0840: 63 6c 3a 3a 6d 61 74 68 66 75 6e 63 3a 3a 24 6f cl::mathfunc::$o
0850: 62 6a 76 5b 30 5d 2e 20 20 57 65 20 6e 65 65 64 bjv[0]. We need
0860: 20 74 6f 20 69 6e 73 65 72 74 20 74 68 65 20 6e to insert the n
0870: 61 6d 65 64 20 6d 61 74 68 0a 2b 09 20 2a 20 66 amed math.+. * f
0880: 75 6e 63 74 69 6f 6e 20 69 6e 74 6f 20 74 68 65 unction into the
0890: 20 73 74 61 63 6b 2e 0a 2b 09 20 2a 2f 0a 2b 09 stack..+. */.+.
08a0: 69 6e 74 20 6f 70 6e 64 2c 20 6e 75 6d 41 72 67 int opnd, numArg
08b0: 73 3b 0a 2b 09 54 63 6c 5f 4f 62 6a 20 2a 6f 62 s;.+.Tcl_Obj *ob
08c0: 6a 50 74 72 3b 0a 2b 0a 2b 09 6f 70 6e 64 20 3d jPtr;.+.+.opnd =
08d0: 20 54 63 6c 47 65 74 55 49 6e 74 31 41 74 50 74 TclGetUInt1AtPt
08e0: 72 28 70 63 2b 31 29 3b 0a 2b 09 69 66 20 28 28 r(pc+1);.+.if ((
08f0: 6f 70 6e 64 20 3c 20 30 29 20 7c 7c 20 28 6f 70 opnd < 0) || (op
0900: 6e 64 20 3e 20 4c 41 53 54 5f 42 55 49 4c 54 49 nd > LAST_BUILTI
0910: 4e 5f 46 55 4e 43 29 29 20 7b 0a 2b 09 20 20 20 N_FUNC)) {.+.
0920: 20 54 52 41 43 45 28 28 22 55 4e 52 45 43 4f 47 TRACE(("UNRECOG
0930: 4e 49 5a 45 44 20 42 55 49 4c 54 49 4e 20 46 55 NIZED BUILTIN FU
0940: 4e 43 20 43 4f 44 45 20 25 64 5c 6e 22 2c 20 6f NC CODE %d\n", o
0950: 70 6e 64 29 29 3b 0a 2b 09 20 20 20 20 54 63 6c pnd));.+. Tcl
0960: 5f 50 61 6e 69 63 28 22 54 63 6c 45 78 65 63 75 _Panic("TclExecu
0970: 74 65 42 79 74 65 43 6f 64 65 3a 20 75 6e 72 65 teByteCode: unre
0980: 63 6f 67 6e 69 7a 65 64 20 62 75 69 6c 74 69 6e cognized builtin
0990: 20 66 75 6e 63 74 69 6f 6e 20 63 6f 64 65 20 25 function code %
09a0: 64 22 2c 20 6f 70 6e 64 29 3b 0a 2b 09 7d 0a 2b d", opnd);.+.}.+
09b0: 0a 2b 09 6f 62 6a 50 74 72 20 3d 20 54 63 6c 5f .+.objPtr = Tcl_
09c0: 4e 65 77 53 74 72 69 6e 67 4f 62 6a 28 22 3a 3a NewStringObj("::
09d0: 74 63 6c 3a 3a 6d 61 74 68 66 75 6e 63 3a 3a 22 tcl::mathfunc::"
09e0: 2c 20 31 37 29 3b 0a 2b 09 54 63 6c 5f 41 70 70 , 17);.+.Tcl_App
09f0: 65 6e 64 54 6f 4f 62 6a 28 6f 62 6a 50 74 72 2c endToObj(objPtr,
0a00: 20 74 63 6c 42 75 69 6c 74 69 6e 46 75 6e 63 54 tclBuiltinFuncT
0a10: 61 62 6c 65 5b 6f 70 6e 64 5d 2e 6e 61 6d 65 2c able[opnd].name,
0a20: 20 2d 31 29 3b 0a 2b 0a 2b 09 2f 2a 20 6f 6e 6c -1);.+.+./* onl
0a30: 79 20 30 2c 20 31 20 6f 72 20 32 20 61 72 67 73 y 0, 1 or 2 args
0a40: 20 2a 2f 0a 2b 09 6e 75 6d 41 72 67 73 20 3d 20 */.+.numArgs =
0a50: 74 63 6c 42 75 69 6c 74 69 6e 46 75 6e 63 54 61 tclBuiltinFuncTa
0a60: 62 6c 65 5b 6f 70 6e 64 5d 2e 6e 75 6d 41 72 67 ble[opnd].numArg
0a70: 73 3b 0a 2b 09 69 66 20 28 6e 75 6d 41 72 67 73 s;.+.if (numArgs
0a80: 20 3d 3d 20 30 29 20 7b 0a 2b 09 20 20 20 20 50 == 0) {.+. P
0a90: 55 53 48 5f 4f 42 4a 45 43 54 28 6f 62 6a 50 74 USH_OBJECT(objPt
0aa0: 72 29 3b 0a 2b 09 7d 20 65 6c 73 65 20 69 66 20 r);.+.} else if
0ab0: 28 6e 75 6d 41 72 67 73 20 3d 3d 20 31 29 20 7b (numArgs == 1) {
0ac0: 0a 2b 09 20 20 20 20 54 63 6c 5f 4f 62 6a 20 2a .+. Tcl_Obj *
0ad0: 74 6d 70 50 74 72 31 20 3d 20 50 4f 50 5f 4f 42 tmpPtr1 = POP_OB
0ae0: 4a 45 43 54 28 29 3b 0a 2b 09 20 20 20 20 50 55 JECT();.+. PU
0af0: 53 48 5f 4f 42 4a 45 43 54 28 6f 62 6a 50 74 72 SH_OBJECT(objPtr
0b00: 29 3b 0a 2b 09 20 20 20 20 50 55 53 48 5f 4f 42 );.+. PUSH_OB
0b10: 4a 45 43 54 28 74 6d 70 50 74 72 31 29 3b 0a 2b JECT(tmpPtr1);.+
0b20: 09 20 20 20 20 54 63 6c 5f 44 65 63 72 52 65 66 . Tcl_DecrRef
0b30: 43 6f 75 6e 74 28 74 6d 70 50 74 72 31 29 3b 0a Count(tmpPtr1);.
0b40: 2b 09 7d 20 65 6c 73 65 20 7b 0a 2b 09 20 20 20 +.} else {.+.
0b50: 20 54 63 6c 5f 4f 62 6a 20 2a 74 6d 70 50 74 72 Tcl_Obj *tmpPtr
0b60: 31 2c 20 2a 74 6d 70 50 74 72 32 3b 0a 2b 09 20 1, *tmpPtr2;.+.
0b70: 20 20 20 74 6d 70 50 74 72 32 20 3d 20 50 4f 50 tmpPtr2 = POP
0b80: 5f 4f 42 4a 45 43 54 28 29 3b 0a 2b 09 20 20 20 _OBJECT();.+.
0b90: 20 74 6d 70 50 74 72 31 20 3d 20 50 4f 50 5f 4f tmpPtr1 = POP_O
0ba0: 42 4a 45 43 54 28 29 3b 0a 2b 09 20 20 20 20 50 BJECT();.+. P
0bb0: 55 53 48 5f 4f 42 4a 45 43 54 28 6f 62 6a 50 74 USH_OBJECT(objPt
0bc0: 72 29 3b 0a 2b 09 20 20 20 20 50 55 53 48 5f 4f r);.+. PUSH_O
0bd0: 42 4a 45 43 54 28 74 6d 70 50 74 72 31 29 3b 0a BJECT(tmpPtr1);.
0be0: 2b 09 20 20 20 20 50 55 53 48 5f 4f 42 4a 45 43 +. PUSH_OBJEC
0bf0: 54 28 74 6d 70 50 74 72 32 29 3b 0a 2b 09 20 20 T(tmpPtr2);.+.
0c00: 20 20 54 63 6c 5f 44 65 63 72 52 65 66 43 6f 75 Tcl_DecrRefCou
0c10: 6e 74 28 74 6d 70 50 74 72 31 29 3b 0a 2b 09 20 nt(tmpPtr1);.+.
0c20: 20 20 20 54 63 6c 5f 44 65 63 72 52 65 66 43 6f Tcl_DecrRefCo
0c30: 75 6e 74 28 74 6d 70 50 74 72 32 29 3b 0a 2b 09 unt(tmpPtr2);.+.
0c40: 7d 0a 2b 0a 2b 09 6f 62 6a 63 20 3d 20 6e 75 6d }.+.+.objc = num
0c50: 41 72 67 73 20 2b 20 31 3b 0a 2b 09 70 63 41 64 Args + 1;.+.pcAd
0c60: 6a 75 73 74 6d 65 6e 74 20 3d 20 32 3b 0a 2b 09 justment = 2;.+.
0c70: 67 6f 74 6f 20 64 6f 49 6e 76 6f 63 61 74 69 6f goto doInvocatio
0c80: 6e 3b 0a 2b 20 20 20 20 7d 0a 2b 0a 2b 20 20 20 n;.+ }.+.+
0c90: 20 63 61 73 65 20 49 4e 53 54 5f 43 41 4c 4c 5f case INST_CALL_
0ca0: 46 55 4e 43 31 3a 20 7b 0a 2b 09 2f 2a 0a 2b 09 FUNC1: {.+./*.+.
0cb0: 20 2a 20 43 61 6c 6c 20 61 20 6e 6f 6e 2d 62 75 * Call a non-bu
0cc0: 69 6c 74 69 6e 20 54 63 6c 20 6d 61 74 68 20 66 iltin Tcl math f
0cd0: 75 6e 63 74 69 6f 6e 20 70 72 65 76 69 6f 75 73 unction previous
0ce0: 6c 79 20 72 65 67 69 73 74 65 72 65 64 20 62 79 ly registered by
0cf0: 20 61 0a 2b 09 20 2a 20 63 61 6c 6c 20 74 6f 20 a.+. * call to
0d00: 54 63 6c 5f 43 72 65 61 74 65 4d 61 74 68 46 75 Tcl_CreateMathFu
0d10: 6e 63 20 70 72 65 2d 38 2e 35 2e 0a 2b 09 20 2a nc pre-8.5..+. *
0d20: 20 54 68 69 73 20 69 73 20 65 73 73 65 6e 74 69 This is essenti
0d30: 61 6c 6c 79 20 49 4e 53 54 5f 49 4e 56 4f 4b 45 ally INST_INVOKE
0d40: 5f 53 54 4b 31 20 63 6f 6e 76 65 72 74 69 6e 67 _STK1 converting
0d50: 20 74 68 65 20 66 69 72 73 74 20 61 72 67 0a 2b the first arg.+
0d60: 09 20 2a 20 74 6f 20 3a 3a 74 63 6c 3a 3a 6d 61 . * to ::tcl::ma
0d70: 74 68 66 75 6e 63 3a 3a 24 6f 62 6a 76 5b 30 5d thfunc::$objv[0]
0d80: 2e 0a 2b 09 20 2a 2f 0a 2b 09 54 63 6c 5f 4f 62 ..+. */.+.Tcl_Ob
0d90: 6a 20 2a 74 6d 70 50 74 72 2c 20 2a 6f 62 6a 50 j *tmpPtr, *objP
0da0: 74 72 3b 0a 2b 0a 2b 09 2f 2a 20 4e 75 6d 62 65 tr;.+.+./* Numbe
0db0: 72 20 6f 66 20 61 72 67 75 6d 65 6e 74 73 2e 20 r of arguments.
0dc0: 54 68 65 20 66 75 6e 63 74 69 6f 6e 20 6e 61 6d The function nam
0dd0: 65 20 69 73 20 74 68 65 20 30 2d 74 68 20 61 72 e is the 0-th ar
0de0: 67 75 6d 65 6e 74 2e 20 2a 2f 0a 2b 09 6f 62 6a gument. */.+.obj
0df0: 63 20 3d 20 54 63 6c 47 65 74 55 49 6e 74 31 41 c = TclGetUInt1A
0e00: 74 50 74 72 28 70 63 2b 31 29 3b 0a 2b 0a 2b 09 tPtr(pc+1);.+.+.
0e10: 6f 62 6a 50 74 72 20 3d 20 4f 42 4a 5f 41 54 5f objPtr = OBJ_AT_
0e20: 44 45 50 54 48 28 6f 62 6a 63 2d 31 29 3b 0a 2b DEPTH(objc-1);.+
0e30: 09 74 6d 70 50 74 72 20 3d 20 54 63 6c 5f 4e 65 .tmpPtr = Tcl_Ne
0e40: 77 53 74 72 69 6e 67 4f 62 6a 28 22 3a 3a 74 63 wStringObj("::tc
0e50: 6c 3a 3a 6d 61 74 68 66 75 6e 63 3a 3a 22 2c 20 l::mathfunc::",
0e60: 31 37 29 3b 0a 2b 09 54 63 6c 5f 41 70 70 65 6e 17);.+.Tcl_Appen
0e70: 64 4f 62 6a 54 6f 4f 62 6a 28 74 6d 70 50 74 72 dObjToObj(tmpPtr
0e80: 2c 20 6f 62 6a 50 74 72 29 3b 0a 2b 09 54 63 6c , objPtr);.+.Tcl
0e90: 5f 44 65 63 72 52 65 66 43 6f 75 6e 74 28 6f 62 _DecrRefCount(ob
0ea0: 6a 50 74 72 29 3b 0a 2b 09 2f 2a 20 76 61 72 69 jPtr);.+./* vari
0eb0: 61 74 69 6f 6e 20 6f 66 20 50 55 53 48 5f 4f 42 ation of PUSH_OB
0ec0: 4a 45 43 54 20 2a 2f 0a 2b 09 4f 42 4a 5f 41 54 JECT */.+.OBJ_AT
0ed0: 5f 44 45 50 54 48 28 6f 62 6a 63 2d 31 29 20 3d _DEPTH(objc-1) =
0ee0: 20 74 6d 70 50 74 72 3b 0a 2b 09 54 63 6c 5f 49 tmpPtr;.+.Tcl_I
0ef0: 6e 63 72 52 65 66 43 6f 75 6e 74 28 74 6d 70 50 ncrRefCount(tmpP
0f00: 74 72 29 3b 0a 2b 0a 2b 09 70 63 41 64 6a 75 73 tr);.+.+.pcAdjus
0f10: 74 6d 65 6e 74 20 3d 20 32 3b 0a 2b 09 67 6f 74 tment = 2;.+.got
0f20: 6f 20 64 6f 49 6e 76 6f 63 61 74 69 6f 6e 3b 0a o doInvocation;.
0f30: 2b 20 20 20 20 7d 0a 2b 23 65 6c 73 65 0a 2b 20 + }.+#else.+
0f40: 20 20 20 2f 2a 0a 2b 20 20 20 20 20 2a 20 49 4e /*.+ * IN
0f50: 53 54 5f 43 41 4c 4c 5f 42 55 49 4c 54 49 4e 5f ST_CALL_BUILTIN_
0f60: 46 55 4e 43 31 20 61 6e 64 20 49 4e 53 54 5f 43 FUNC1 and INST_C
0f70: 41 4c 4c 5f 46 55 4e 43 31 20 77 65 72 65 20 6d ALL_FUNC1 were m
0f80: 61 64 65 20 6f 62 73 6f 6c 65 74 65 20 62 79 20 ade obsolete by
0f90: 74 68 65 0a 2b 20 20 20 20 20 2a 20 63 68 61 6e the.+ * chan
0fa0: 67 65 73 20 74 6f 20 61 64 64 20 61 20 3a 3a 74 ges to add a ::t
0fb0: 63 6c 3a 3a 6d 61 74 68 66 75 6e 63 20 6e 61 6d cl::mathfunc nam
0fc0: 65 73 70 61 63 65 20 69 6e 20 38 2e 35 2e 20 20 espace in 8.5.
0fd0: 4f 70 74 69 6f 6e 61 6c 20 73 75 70 70 6f 72 74 Optional support
0fe0: 0a 2b 20 20 20 20 20 2a 20 72 65 6d 61 69 6e 73 .+ * remains
0ff0: 20 66 6f 72 20 65 78 69 73 74 69 6e 67 20 62 79 for existing by
1000: 74 65 63 6f 64 65 20 70 72 65 63 6f 6d 70 69 6c tecode precompil
1010: 65 64 20 66 69 6c 65 73 2e 0a 2b 20 20 20 20 20 ed files..+
1020: 2a 2f 0a 2b 20 20 20 20 63 61 73 65 20 49 4e 53 */.+ case INS
1030: 54 5f 43 41 4c 4c 5f 42 55 49 4c 54 49 4e 5f 46 T_CALL_BUILTIN_F
1040: 55 4e 43 31 3a 0a 2b 09 54 63 6c 5f 50 61 6e 69 UNC1:.+.Tcl_Pani
1050: 63 28 22 54 63 6c 45 78 65 63 75 74 65 42 79 74 c("TclExecuteByt
1060: 65 43 6f 64 65 3a 20 6f 62 73 6f 6c 65 74 65 20 eCode: obsolete
1070: 49 4e 53 54 5f 43 41 4c 4c 5f 42 55 49 4c 54 49 INST_CALL_BUILTI
1080: 4e 5f 46 55 4e 43 31 20 66 6f 75 6e 64 22 29 3b N_FUNC1 found");
1090: 0a 2b 20 20 20 20 63 61 73 65 20 49 4e 53 54 5f .+ case INST_
10a0: 43 41 4c 4c 5f 46 55 4e 43 31 3a 0a 2b 09 54 63 CALL_FUNC1:.+.Tc
10b0: 6c 5f 50 61 6e 69 63 28 22 54 63 6c 45 78 65 63 l_Panic("TclExec
10c0: 75 74 65 42 79 74 65 43 6f 64 65 3a 20 6f 62 73 uteByteCode: obs
10d0: 6f 6c 65 74 65 20 49 4e 53 54 5f 43 41 4c 4c 5f olete INST_CALL_
10e0: 46 55 4e 43 31 20 66 6f 75 6e 64 22 29 3b 0a 2b FUNC1 found");.+
10f0: 23 65 6e 64 69 66 0a 20 20 20 20 20 7d 0a 20 0a #endif. }. .
1100: 20 20 20 20 20 63 61 73 65 20 49 4e 53 54 5f 45 case INST_E
1110: 56 41 4c 5f 53 54 4b 3a 20 7b 0a 40 40 20 2d 35 VAL_STK: {.@@ -5
1120: 35 32 36 2c 31 34 20 2b 35 36 36 35 2c 36 20 40 526,14 +5665,6 @
1130: 40 0a 20 09 7d 0a 20 20 20 20 20 7d 0a 20 0a 2d @. .}. }. .-
1140: 20 20 20 20 63 61 73 65 20 49 4e 53 54 5f 43 41 case INST_CA
1150: 4c 4c 5f 42 55 49 4c 54 49 4e 5f 46 55 4e 43 31 LL_BUILTIN_FUNC1
1160: 3a 20 7b 0a 2d 09 54 63 6c 5f 50 61 6e 69 63 28 : {.-.Tcl_Panic(
1170: 22 54 63 6c 45 78 65 63 75 74 65 42 79 74 65 43 "TclExecuteByteC
1180: 6f 64 65 3a 20 6f 62 73 6f 6c 65 74 65 20 49 4e ode: obsolete IN
1190: 53 54 5f 43 41 4c 4c 5f 42 55 49 4c 54 49 4e 5f ST_CALL_BUILTIN_
11a0: 46 55 4e 43 31 20 66 6f 75 6e 64 22 29 3b 0a 2d FUNC1 found");.-
11b0: 20 20 20 20 7d 0a 2d 0a 2d 20 20 20 20 63 61 73 }.-.- cas
11c0: 65 20 49 4e 53 54 5f 43 41 4c 4c 5f 46 55 4e 43 e INST_CALL_FUNC
11d0: 31 3a 20 7b 0a 2d 09 54 63 6c 5f 50 61 6e 69 63 1: {.-.Tcl_Panic
11e0: 28 22 54 63 6c 45 78 65 63 75 74 65 42 79 74 65 ("TclExecuteByte
11f0: 43 6f 64 65 3a 20 6f 62 73 6f 6c 65 74 65 20 49 Code: obsolete I
1200: 4e 53 54 5f 43 41 4c 4c 5f 46 55 4e 43 31 20 66 NST_CALL_FUNC1 f
1210: 6f 75 6e 64 22 29 3b 0a 2d 20 20 20 20 7d 0a 2d ound");.- }.-
1220: 0a 20 20 20 20 20 63 61 73 65 20 49 4e 53 54 5f . case INST_
1230: 55 50 4c 55 53 3a 0a 20 20 20 20 20 63 61 73 65 UPLUS:. case
1240: 20 49 4e 53 54 5f 54 52 59 5f 43 56 54 5f 54 4f INST_TRY_CVT_TO
1250: 5f 4e 55 4d 45 52 49 43 3a 20 7b 0a 20 09 2f 2a _NUMERIC: {. ./*
1260: 0a .