summaryrefslogtreecommitdiffstats
path: root/generic/tclCompile.c
Commit message (Collapse)AuthorAgeFilesLines
* New TEBC opcode, INST_JUMP_TABLE, for compiling the simple (and common) case ofdkf2005-11-301-5/+13
| | | | | [switch] into a jump-table. Much faster for long switches. Also compiler support for generating the new instruction where appropriate.
* Strip a few more pre-ANSI-ismsdkf2005-11-071-21/+20
|
* Remove _ANSI_ARGS_ and clean up a few commentsdkf2005-10-131-161/+160
|
* Compiler for [dict] and related changes.dkf2005-07-211-6/+57
|
* More minor tinkering with comments and code-layoutdkf2005-07-141-13/+14
|
* Style improvements to tclCompile.c, plus bytecode printing enhancements.dkf2005-07-141-917/+879
|
* typodkf2005-06-201-2/+2
|
* Add compilation for TIP#90-style [catch] requiring a new opcode [Bug1219112]dkf2005-06-201-20/+31
|
* Merged kennykb-numerics-branch back to the head; TIPs 132 and 232Kevin B Kenny2005-05-101-1/+1
|
* * generic/tclCompCmds.c: Replaced all instance ofdgp2005-05-051-5/+4
| | | | | | | | * generic/tclCompile.c: TCL_OUT_LINE_COMPILE with TCL_ERROR. * generic/tclInt.h: Now that we've eradicated the mistaken * tests/appendComp.test: notion of a "compile-time error", we can use the TCL_ERROR return code to signal any failure to produce bytecode.
* * generic/tclCompile.c:Commented out the functionsMiguel Sofer2005-04-131-1/+7
| | | | | TclPrintInstruction(), TclPrintObject() and TclPrintSource() when not debugging the compiler, as they are never called in that case.
* * generic/tclCompile.c: fixed INST_RETURN's stack effect inMiguel Sofer2005-03-141-2/+2
| | | | tclInstructionTable (-1 instead of -2)
* Avoid sharing cmdName literals accross namespaces, and generalise usage ofMiguel Sofer2004-12-241-11/+12
| | | | the TclRegisterNewLiteral macro [Patch 1090905]
* * generic/tclCompile.c: moved TclInitCompiledLocals to tclProc.cMiguel Sofer2004-12-201-139/+1
| | | | | | | | * generic/tclProc.c: new static InitCompiledLocals to allow for a single pass over the proc's arguments at proc load time (instead of two as previously). TclObjInterpProc() now allocates the compiledLocals on the tcl execution stack, using the new TclStackAlloc/Free functions.
* optimised loops that initialise a proc's arguments and compiled localMiguel Sofer2004-12-101-59/+88
| | | | variables, removing tests from inner loops.
* Core of implementation of TIP#201 ('in' and 'ni' operators)dkf2004-10-081-1/+6
|
* Convert string to stringPtrdkf2004-10-061-12/+12
|
* Factorize out the code for freeing an object's internal rep.dkf2004-09-291-5/+2
|
* Report compilation errors at runtime, [Patch 103368] by dgp.Miguel Sofer2004-09-261-184/+80
|
* Corrected the base for the errorline calculationdgp2004-09-231-2/+2
|
* * generic/tclCmdMZ.c (TclProcessReturn): Support the -errorlinedgp2004-09-221-25/+43
| | | | | | | * generic/tclCompile.c (TclCompileScript): option to [return]. * tests/compile.test (16.23.*): Use that capability to defer reporting * tests/misc.test (1.2): of parse errors until runtime. Updated tests to reflect change. [Bug 1032805]
* * generic/tclBasic.c: Reworked management of the interpdgp2004-09-211-10/+1
| | | | | | | | | | | | | | * generic/tclCompile.c: flag ERR_ALREADY_LOGGED, to reduce * generic/tclExecute.c: its exposure. Still left several * generic/tclNamesp.c: references that are just too nice on performace to do away with. These changes also resolve an inconsistency in the ::errorInfo values produced by [namespace eval x error foo bar] and [namespace eval x {error foo bar}]. * generic/tclExecute.c (TclCompEvalObj): Simplified the TclCompEvalObj routine. Much housekeeping now reliably happens elsewhere. [Patch 1031949]
* * generic/tclCompile.c (TclCompileScript):Miguel Sofer2004-07-151-3/+8
| | | | | | | | | * generic/tclLiteral.c (TclReleaseLiteral): fix for [Bug 467523], which resurfaced with the latest changes. The previous strategy was to have special code in TclReleaseLiteral to handle the self-references generated by empty scripts. The new approach avoids the self-reference altogether, by having empty scripts return an unshared literal.
* Modified the logic of literal table cleanup at interp deletion time,Miguel Sofer2004-07-081-13/+15
| | | | | insuring that the fix of [Bug 983660] does not have a negative perf impact.
* * generic/tclCompile.c (TclCompileScript): fix for [Bug 458361].Miguel Sofer2004-07-071-1/+10
| | | | | Single-word scripts are compiled with an unshared cmdName to avoid shimmering between bytecode and cmdName reps.
* * tests/cmdMZ.test (cmdMZ-return-2.17): Added a test that a worddgp2004-07-061-4/+5
| | | | | | | | | containing backslash-quoted value is treated correctly. * generic/tclCompile.c (TclWordKnownAtCompileTime): [Bug 986196] Corrected flaw above and the flaw that caused TCL_TOKEN_SIMPLE_WORDs to have their original word value copied ( "{a b}" ) rather than the actual value ( "a b" ). Thanks to Kevin Kenny for report and tests.
* * generic/tclCompile.c:Miguel Sofer2004-06-081-2/+6
| | | | * generic/tclExecute.c: handle warning [Bug 969066]
* * generic/tclCompile.h:Miguel Sofer2004-05-161-63/+37
| | | | | | | | | | | * generic/tclCompile.c: * generic/tclExecute.c: changed implementation of {expand}, last chance while in alpha as ... ***POTENTIAL INCOMPATIBILITY*** Scripts precompiled with ProComp under previous tcl8.5a versions may malfunction due to changed instruction numbers for INST_LIST_INDEX_IMM, INST_LIST_RANGE_IMM and INST_START_CMD.
* Optimisations for INST_START_CMD [Bug 926164].Miguel Sofer2004-05-121-13/+21
| | | | | | | | | * generic/tclCompile.c (TclCompileScript): avoid emitting INST_START_CMD as the first instruction in a bytecoded Tcl_Obj. It is not needed, as the checks are done before calling TEBC. * generic/tclExecute.c (TclExecuteByteCode): runtime peephole optimisation: check at INST_POP if the next instruction is INST_START_CMD, in which case we fall through.
* slight improvement to last commitMiguel Sofer2004-05-041-7/+7
|
* * generic/tclCompile.c (TclCompileScript): setting the compilationMiguel Sofer2004-05-041-7/+7
| | | | namespace outside of the loop.
* * generic/tclCompile.c:Miguel Sofer2004-05-031-22/+7
| | | | | | * generic/tclInt.h: reverted fix for [Bug 926445] of 2004-04-02, restoring TCL_ALIGN to the header file. Todd Helfter reported that the macro is required by tbcload.
* * generic/tclCompile.c:Miguel Sofer2004-04-021-7/+22
| | | | | * generic/tclInt.h: removed the macro TCL_ALIGN() from tclInt.h, replaced by the static macro ALIGN() in tclCompile.c [Bug 926445]
* * generic/tclCompile.c: New instruction code INST_START_CMDMiguel Sofer2004-03-301-1/+21
| | | | | | | | | * generic/tclCompile.h: that allows checking the bytecode's * generic/tclExecute.c: validity [Bug 729692] and the interp's * tests/interp.test (18.9): readyness [Bug 495830] before running * tests/proc.test (7.1): the command. It also changes the * tests/rename.test (6.1): mechanics of the async tests in TEBC, doing it now at command start instead of every 16 instructions.
* * generic/tclCompile.c (TclCompileScript): corrected possibleMiguel Sofer2004-03-291-3/+4
| | | | | segfault when a compilation returns TCL_OUTLINE_COMPILE after having grown the compile environment.
* Minor whitespace/capitalization fixesdkf2004-01-201-15/+15
|
* Full bytecode compilation for [lassign]dkf2004-01-181-2/+17
|
* Patch 876451: restores performance of [return]. Also allows formsdgp2004-01-131-3/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | such as [return -code error $msg] to be bytecompiled. * generic/tclInt.h: Factored Tcl_ReturnObjCmd() into two pieces: * generic/tclCmdMZ.c: TclMergeReturnOptions(), which can parse the options to [return], check their validity, and create the corresponding return options dictionary, and TclProcessReturn(), which takes that return options dictionary and performs the [return] operation. * generic/tclCompCmds.c: Rewrote TclCompileReturnCmd() to call TclMergeReturnOptions() at compile time so the return options dictionary is computed at compile time (when it is fully known). The dictionary is pushed on the stack along with the result, and the code and level values are included in the bytecode as operands. Also supports optimized compilation of un-[catch]ed [return]s from procs with default options into the INST_DONE instruction. * generic/tclExecute.c: Rewrote INST_RETURN instruction to retrieve the code and level operands, pop the return options from the stack, and call TclProcessReturn() to perform the [return] operation. * generic/tclCompile.h: New utilities include TclEmitInt4 macro * generic/tclCompile.c: and TclWordKnownAtCompileTime().
* All uses of 'panic' (the macro) changeddavygrvy2003-12-241-18/+18
| | | | | | | to 'Tcl_Panic' (the function). The #define of panic in tcl.h clearly states it is deprecated in the comments. [Patch 865264]
* Fixed Bug 845412; long commands without expansion don't get tangled with thedkf2003-11-191-2/+2
| | | | expansion machinery now...
* Added cast to suppress compiler warning.dgp2003-11-171-2/+2
|
* * doc/ParseCmd.3: Implementation of TIP 157. Adds recognitiondgp2003-11-141-18/+99
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * doc/Tcl.n: of the new leading {expand} syntax on words. * generic/tcl.h: Parses such words as the new Tcl_Token type * generic/tclBasic.c: TCL_TOKEN_EXPAND_WORD. Updated Tcl_EvalEx * generic/tclCompile.c: and the bytecode compiler/execution engine * generic/tclCompile.h: to recognize the new token type. New opcodes * generic/tclExecute.c: INST_LIST_VERIFY and INST_INVOKE_EXP and a new * generic/tclParse.c: operand type OPERAND_ULIST1 are defined. Docs * generic/tclTest.c: and tests are included. * tests/basic.test: * tests/compile.test: * tests/parse.test: * library/auto.tcl: Replaced several [eval]s used to perform * library/package.tcl: argument expansion with the new syntax. * library/safe.tcl: In the test files lindex.test and lset.test, * tests/cmdInfo.test: replaced use of [eval] to force direct * tests/encoding.test: string evaluation with use of [testevalex] * tests/execute.test: which more directly and robustly serves the * tests/fCmd.test: same purpose. * tests/http.test: * tests/init.test: * tests/interp.test: * tests/io.test: * tests/ioUtil.test: * tests/iogt.test: * tests/lindex.test: * tests/lset.test: * tests/namespace-old.test: * tests/namespace.test: * tests/pkg.test: * tests/pkgMkIndex.test: * tests/proc.test: * tests/reg.test: * tests/trace.test: * tests/upvar.test: * tests/winConsole.test: * tests/winFCmd.test:
* * generic/tclBasic.c (TclAppendObjToErrorInfo): New internal routinedgp2003-10-141-18/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | that appends a Tcl_Obj to the errorInfo, saving the caller the trouble of extracting the string rep. * generic/tclStringObj.c (TclAppendLimitedToObj): New internal routine that supports truncated appends with optional ellipsis marking. This single routine supports UTF-8-safe truncated appends needed in several places throughout the Tcl source code, mostly for error and stack messages. Clean fix for [Bug 760872]. * generic/tclInt.h: Declarations for new internal routines. * generic/tclCmdMZ.c: Updated callers to use the new routines. * generic/tclCompExpr.c: * generic/tclCompile.c: * generic/tclExecute.c: * generic/tclIOUtil.c: * generic/tclNamesp.c: * generic/tclObj.c: * generic/tclParseExpr.c: * generic/tclProc.c: * generic/tclStringObj.c: * mac/tclMacResource.c: * library/init.tcl: Updated ::errorInfo cleanup in [unknown] to reflect slight modifications to Tcl_LogCommandInfo(). Corrects failing init-4.* tests.
* TIP#123 Implementation based on work by Arjen Markus. [Patch 655176]dkf2003-09-121-1/+3
|
* fixing previous patchMiguel Sofer2003-05-091-5/+5
|
* fix for [Bug 735055]Miguel Sofer2003-05-091-1/+3
|
* corrected bogus commentsdgp2003-04-181-7/+2
|
* * generic/tclCompile.c:Miguel Sofer2003-03-191-2/+9
| | | | | * tests/compile.test: bad command count on TCL_OUT_LINE_COMPILE [Bug 705406] (Don Porter).
* * generic/tclCompCmds.c (TclCompileReturnCmd): Alternative fix fordgp2003-03-191-1/+3
| | | | | | | * generic/tclCompile.c (INST_RETURN): [Bug 633204] that uses a new * generic/tclCompile.h (INST_RETURN): bytecode INST_RETURN to * generic/tclExecute.c (INST_RETURN): properly bytecode the [return] command to something that returns TCL_RETURN.
* * generic/tclBasic.c (Tcl_EvalTokensStandard):dgp2003-03-131-98/+15
| | | | | | | | | | | | | | | | | | | | | | | | * generic/tclCmdMZ.c (Tcl_SubstObj): * generic/tclCompCmds.c (TclCompileSwitchCmd): * generic/tclCompExpr.c (CompileSubExpr): * generic/tclCompile.c (TclSetByteCodeFromAny,TclCompileScript, TclCompileTokens,TclCompileCmdWord): * generic/tclCompile.h (TclCompileScript): * generic/tclExecute.c (TclCompEvalObj): * generic/tclInt.h (Interp,TCL_BRACKET_TERM,TclSubstTokens): * generic/tclParse.c (ParseTokens,Tcl_SubstObj,TclSubstTokens): * tests/subst.test (2.4, 8.7, 8.8, 11.4, 11.5): Substantial refactoring of Tcl_SubstObj to make use of the same parsing and substitution procedures as normal script evaluation. Tcl_SubstObj() moved to tclParse.c. New routine TclSubstTokens() created in tclParse.c which implements all substantial functioning of Tcl_EvalTokensStandard(). TclCompileScript() loses its "nested" argument, the Tcl_Interp struct loses its termOffset field and the TCL_BRACKET_TERM flag in the evalFlags field, all of which were only used (indirectly) by Tcl_SubstObj(). Tests subst-8.7,8.8,11.4,11.5 modified to accomodate the only behavior change: reporting of parse errors now takes precedence over [return] and [continue] exceptions. All other behavior should