summaryrefslogtreecommitdiffstats
path: root/generic/tclCompile.c
Commit message (Collapse)AuthorAgeFilesLines
...
| * | silence compiler warningsdgp2009-08-261-2/+2
| | |
| * | * generic/tclBasic.c (Tcl_CreateInterp, Tcl_EvalTokensStandard,andreas_kupries2009-08-251-7/+156
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | EvalTokensStandard, Tcl_EvalEx, EvalEx, TclAdvanceContinuations, TclEvalObjEx): * generic/tclCmdMZ.c (Tcl_SwitchObjCmd, TclListLines): * generic/tclCompCmds.c (*): * generic/tclCompile.c (TclSetByteCodeFromAny, TclInitCompileEnv, TclFreeCompileEnv, TclCompileScript): * generic/tclCompile.h (CompileEnv): * generic/tclInt.h (ContLineLoc, Interp): * generic/tclObj.c (ThreadSpecificData, ContLineLocFree, TclThreadFinalizeObjects, TclInitObjSubsystem, TclContinuationsEnter, TclContinuationsEnterDerived, TclContinuationsCopy, TclContinuationsGet, TclFreeObj): * generic/tclParse.c (TclSubstTokens, Tcl_SubstObj): * generic/tclProc.c (TclCreateProc): * generic/tclVar.c (TclPtrSetVar): * tests/info.test (info-30.0-24): Extended parser, compiler, and execution with code and attendant data structures tracking the positions of continuation lines which are not visible in script Tcl_Obj*'s, to properly account for them while counting lines for #280.
| * | * generic/tclCmdIL.c: Removed unused variables.dgp2009-07-161-5/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * generic/tclCompile.c: * generic/tclVar.c: * unix/tclUnixChan.c: * generic/tclScan.c: Typo in ACCEPT_NAN configuration. * generic/tclStrToD.c: Set floating point control register on MIPS systems so that the gradual underflow expected by Tcl is in effect. [Bug 2819200]
| * | fix 64bit int <-> ptr cast warningsdas2009-07-151-2/+2
| | |
| * | * generic/tclBasic.c (DeleteInterpProc,TclArgumentBCEnter,andreas_kupries2009-07-141-51/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TclArgumentBCRelease, TclArgumentGet): * generic/tclCompile.c (EnterCmdWordIndex, TclCleanupByteCode, TclInitCompileEnv, TclCompileScript): * generic/tclCompile.h (ExtCmdLoc): * generic/tclExecute.c (TclExecuteByteCode): * generic/tclInt.h (ExtIndex, CFWordBC): * tests/info.test (info-39.0): Backport of some changes made to the Tcl head, to handle literal sharing better. The code here is much simpler (trimmed down) compared to the head as the 8.5 branch is not bytecode compiling whole files, and doesn't compile eval'd code either. Reworked the handling of literal command arguments in bytecode to be saved (compiler) and used (execution) per command (See the TCL_INVOKE_STK* instructions), and not per the whole bytecode. This removes the problems with location data caused by literal sharing in proc bodies. Simplified the associated datastructures (ExtIndex is gone, as is the function EnterCmdWordIndex).
| * | * generic/tclCompile.c: The value stashed in iPtr->compiledProcPtrdgp2009-06-131-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * generic/tclProc.c: when compiling a proc survives too long. We * tests/execute.test: only need it there long enough for the right TclInitCompileEnv() call to re-stash it into envPtr->procPtr. Once that is done, the CompileEnv controls. If we let the value of iPtr->compiledProcPtr linger, though, then any other bytecode compile operation that takes place will also have its CompileEnv initialized with it, and that's not correct. The value is meant to control the compile of the proc body only, not other compile tasks that happen along. Thanks to Carlos Tasada for discovering and reporting the problem. [Bug 2802881].
| * | * tests/info.test: Tests 38.* added, exactly testing the trackingandreas_kupries2008-07-251-19/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | of location for uplevel scripts. * generic/tclCompile.c (TclInitCompileEnv): Reorganized the initialization of the #280 location information to match the flow in TclEvalObjEx to get more absolute contexts. * generic/tclBasic.c (TclEvalObjEx): Moved the pure-list optimization out of the eval-direct code path to be done always, i.e. even when a compile is requested. This way we do not loose the association between #280 location information and the list elements, if any.
| * | * generic/tclBasic.c: Modified TclArgumentGet to reject pure listsandreas_kupries2008-07-231-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * generic/tclCmdIL.c: immediately, without search. Reworked setup * generic/tclCompile.c: of eoFramePtr, doesn't need the line * tests/info.test: information, more sensible to have everything on line 1 when eval'ing a pure list. Updated the users of the line information to special case this based on the frame type (i.e. TCL_LOCATION_EVAL_LIST). Added a testcase demonstrating the new behaviour.
| * | * generic/tclCompile.c: Made the new TclEnterCmdWordIndexandreas_kupries2008-07-221-11/+14
| | | | | | | | | | | | * generic/tclCompile.h: static, and ansified.
| * | * generic/tclBasic.c: Reworked the handling of bytecode literalsandreas_kupries2008-07-221-16/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * generic/tclCompile.c: for #280 to fix the abysmal performance * generic/tclCompile.h: for deep recursion, replaced the linear * generic/tclExecute.c: search through the whole stack with * generic/tclInt.h: another hashtable and simplified the data structure used by the compiler (array instead of hashtable). Incidentially this also fixes the memory leak reported via [Bug 2024937].
| * | * generic/tclBasic.c: Extended the existing TIP #280 system (infoandreas_kupries2008-07-211-1/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * generic/tclCmdAH.c: frame), added the ability to track the * generic/tclCompCmds.c: absolute location of literal procedure * generic/tclCompile.c: arguments, and making this information * generic/tclCompile.h: available to uplevel, eval, and * generic/tclInterp.c: siblings. This allows proper tracking of * generic/tclInt.h: absolute location through custom (Tcl-coded) * generic/tclNamesp.c: control structures based on uplevel, etc. * generic/tclProc.c:
| * | * generic/tclCompile.c: fix crash with tcl_traceExec. Found andMiguel Sofer2008-05-161-2/+2
| | | | | | | | | | | | fixed by Alexander Pasadyn [Bug 1964803].
* | | [Bug 3129448]: Possible over-allocation on 64-bit platforms, part 2nijtmans2010-12-101-4/+3
| | |
* | | [Patch 2995655] Report inner contexts in [info errorstack]ferrieux2010-10-201-1/+177
| | |
* | | * generic/tclCompCmds.c (TclCompileDictForCmd): Update the compilationdkf2010-10-201-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | * generic/tclCompile.c (tclInstructionTable): of [dict for] so that * generic/tclExecute.c (TEBCresume): it no longer makes any use of INST_DICT_DONE now that's not needed, and make it clearer in the implementation of the instruction that it's just a deprecated form of unset operation. Followup to my commit of 2010-10-16.
* | | remove outdated commentdgp2010-10-131-7/+1
| | |
* | | * generic/tclCompile.c: Alternative fix for [Bugs 467523,983660] wheredgp2010-10-131-4/+4
| | | | | | | | | | | | * generic/tclExecute.c: sharing of empty scripts is allowed again.
* | | * generic/tclCompile.c: Prevent writing to the intrep fields of adgp2010-10-061-3/+3
| | | | | | | | | | | | * tests/subst.test: freed Tcl_Obj. [Bug 3081065]
* | | * generic/tclBasic.c: [Patch 3072080] (minus the itclMiguel Sofer2010-09-271-6/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * generic/tclCmdIL.c: update): a saner NRE. * generic/tclCompExpr.c: * generic/tclCompile.c: This makes TclNRExecuteByteCode * generic/tclCompile.h: (ex TEBC) to be a normal NRE * generic/tclExecute.c: citizen: it loses its special status. * generic/tclInt.decls: The logic flow within the BC engine is * generic/tclInt.h: simplified considerably. * generic/tclIntDecls.h: * generic/tclObj.c: * generic/tclProc.c: * generic/tclTest.c:
* | | Remove many type casts which are no longernecessary as a result of [Patch ↵nijtmans2010-08-221-2/+2
| | | | | | | | | | | | 3009403]: Signature of Tcl_GetHashKey, Tcl_(Create|Find)HashEntry
* | | Correct some comments (Jos Decoster found...)dkf2010-05-141-4/+4
| | |
* | | * generic/tclCompExpr.c: Slight change in the literal sharingMiguel Sofer2010-04-291-13/+4
| | | | | | | | | | | | | | | | | | * generic/tclCompile.c: mechanism to avoid shimmering of * generic/tclCompile.h: command names. * generic/tclLiteral.c:
* | | Code Audit results:dkf2010-03-051-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | * use do { ... } while (0) in macros * avoid shadowing one local variable with another * use clearer 'foo.bar++;' instead of '++foo.bar;' where result not required (i.e., semantically equivalent) * follow Engineering Manual rules on spacing and declarations
* | | Pure whitespace changes, changing to follow Engineering Manual style.dkf2010-02-241-18/+18
| | |
* | | Small changes to align code style with Tcl Engineering Manualdkf2010-02-191-155/+169
| | |
* | | Fix error in stack depth calculation for [dict update], correct misleadingdkf2010-02-171-4/+4
| | | | | | | | | | | | comment in description of opcode.
* | | Make the [unset] command be bytecode compiled.dkf2010-01-301-2/+17
| | |
* | | Eliminate various gcc warnings (in -Wextra mode)nijtmans2009-11-181-3/+3
| | |
* | | TIP #356 IMPLEMENTATIONdgp2009-09-241-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * generic/tcl.decls: Promote internal routine TclNRSubstObj() * generic/tclCmdMZ.c: to public Tcl_NRSubstObj(). Still needs docs. * generic/tclCompile.c: * generic/tclInt.h: * generic/tclDecls.h: make genstubs * generic/tclStubInit.c:
* | | * generic/tclCompile.c: Correct botch in the conversion ofdgp2009-09-211-2/+4
| | | | | | | | | | | | Tcl_SubstObj(). Thanks to Kevin Kenny for detection and report.
* | | * generic/tclCompile.c: Re-implement Tcl_SubstObj() as a simpledgp2009-09-171-1/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * generic/tclParse.c: wrapper around TclNRSubstObj(). This has * tests/basic.test: the effect of caching compiled bytecode in * tests/parse.test: the value to be substituted. Note that Tcl_SubstObj() now exists only for extensions. Tcl itself no longer makes any use of it. Note also that TclSubstTokens() is now reachable only by Tcl_EvalEx() and Tcl_ParseVar() so tests aiming to test its functioning needed adjustment to still have the intended effect.
* | | fix warningdas2009-09-121-2/+2
| | |
* | | * generic/tclBasic.c: Completed the NR-enabling of [subst].dgp2009-09-111-1/+155
| | | | | | | | | | | | | | | | | | | | | | | | | | | * generic/tclCmdMZ.c: [Bug 2314561]. * generic/tclCompCmds.c: * generic/tclCompile.c: * generic/tclInt.h: * tests/coroutine.test: * tests/parse.test:
* | | * generic/tclCompCmds.c (TclCompileSubstCmd): Added a bytecodedgp2009-09-041-70/+102
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * generic/tclBasic.c: compiler routine for the [subst] command. * generic/tclCmdMZ.c: This is a partial solution to the need to * generic/tclCompile.c: NR-enable [subst] since bytecode execution is * generic/tclCompile.h: already NR-enabled. [Bug 2314561] Two new * generic/tclExecute.c: bytecode instructions, INST_NOP and * generic/tclInt.h: INST_RETURN_CODE_BRANCH were added to support * generic/tclParse.c: the new routine. INST_RETURN_CODE_BRANCH is * tests/basic.test: likely to be useful in any future effort to * tests/info.test: add a bytecode compiler routine for [try]. * tests/parse.test:
* | | fix warningsdas2009-08-251-2/+2
| | |
* | | * generic/tclBasic.c (Tcl_CreateInterp, Tcl_EvalTokensStandard,andreas_kupries2009-08-251-4/+152
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Tcl_EvalEx, TclEvalEx, TclAdvanceContinuations, TclNREvalObjEx): * generic/tclCmdMZ.c (Tcl_SwitchObjCmd, TclListLines): * generic/tclCompCmds.c (*): * generic/tclCompile.c (TclSetByteCodeFromAny, TclInitCompileEnv, TclFreeCompileEnv, TclCompileScript, TclCompileTokens): * generic/tclCompile.h (CompileEnv): * generic/tclInt.h (ContLineLoc, Interp): * generic/tclObj.c (ThreadSpecificData, ContLineLocFree, TclThreadFinalizeObjects, TclInitObjSubsystem, TclContinuationsEnter, TclContinuationsEnterDerived, TclContinuationsCopy, TclContinuationsGet, TclFreeObj): * generic/tclParse.c (TclSubstTokens, Tcl_SubstObj): * generic/tclProc.c (TclCreateProc): * generic/tclVar.c (TclPtrSetVar): * tests/info.test (info-30.0-24): Extended the parser, compiler, and execution engine with code and attendant data structures tracking the position of continuation lines which are not visible in the resulting script Tcl_Obj*'s, to properly account for them while counting lines for #280.
* | | * generic/tclBinary.c: Removed unused variables.dgp2009-07-161-5/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * generic/tclCmdIL.c: * generic/tclCompile.c: * generic/tclExecute.c: * generic/tclHash.c: * generic/tclIOUtil.c: * generic/tclVar.c: * generic/tclBasic.c: Silence compiler warnings about ClientData. * generic/tclProc.c: * generic/tclScan.c: Typo in ACCEPT_NAN configuration. * generic/tclStrToD.c: Set floating point control register on MIPS systems so that the gradual underflow expected by Tcl is in effect. [Bug 2819200]
* | | fix 64bit int <-> ptr cast warningsdas2009-07-141-2/+2
| | |
* | | * generic/tclCompile.c (TclInitCompileEnv, EnterCmdWordIndex,andreas_kupries2009-07-141-51/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TclCleanupByteCode, TclCompileScript): * generic/tclExecute.c (TclCompileObj, TclExecuteByteCode): * tclCompile.h (ExtCmdLoc): * tclInt.h (ExtIndex, CFWordBC, CmdFrame): * tclBasic.c (DeleteInterpProc, TclArgumentBCEnter, TclArgumentBCRelease, TclArgumentGet, SAVE_CONTEXT, RESTORE_CONTEXT, NRCoroutineExitCallback, TclNRCoroutineObjCmd): * generic/tclCmdAH.c (TclNRForObjCmd, TclNRForIterCallback, ForNextCallback): * generic/tclCmdMZ.c (TclNRWhileObjCmd): Extended the bytecode compiler initialization to recognize the compilation of whole files (NRE enabled 'source' command) and switch to the counting of absolute lines in that case. Further extended the bytecode compiler to track the start line in the generated information, and modified the bytecode execution to recompile an object if the location as per the calling context doesn't match the location saved in the bytecode. This part could be optimized more by using more memory to keep all possibilities which occur around, or by just adjusting the location information instead of a total recompile. Reworked the handling of literal command arguments in bytecode to be saved (compiler) and used (execution) per command (See the TCL_INVOKE_STK* instructions), and not per the whole bytecode. This, and the previous change remove the problems with location data caused by literal sharing (across whole files, but also proc bodies). Simplified the associated datastructures (ExtIndex is gone, as is the function EnterCmdWordIndex). The last change causes the hashtable 'lineLABCPtr' to be state which has to be kept per coroutine, like the CmdFrame stack. Reworked the coroutine support code to create, delete and switch the information as needed. Further reworked the tailcall command as well, it has to pop its own arguments when run in a bytecode context to keep a proper stack in 'lineLABCPtr'. Fixed the mishandling of line information in the NRE-enabled 'for' and 'while' commands introduced when both were made to share their iteration callbacks without taking into account that the loop body is found in different words of the command. Introduced a separate data structure to hold all the callback information, as we went over the limit of 4 direct client-data values for NRE callbacks. The above fixes [Bug 1605269].
* | | * generic/tclCompile.c: The value stashed in iPtr->compiledProcPtrdgp2009-06-131-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * generic/tclProc.c: when compiling a proc survives too long. We * tests/execute.test: only need it there long enough for the right TclInitCompileEnv() call to re-stash it into envPtr->procPtr. Once that is done, the CompileEnv controls. If we let the value of iPtr->compiledProcPtr linger, though, then any other bytecode compile operation that takes place will also have its CompileEnv initialized with it, and that's not correct. The value is meant to control the compile of the proc body only, not other compile tasks that happen along. Thanks to Carlos Tasada for discovering and reporting the problem. [Bug 2802881].
* | | fix [Bug 2555129] const compilernijtmans2009-02-091-3/+3
| | | | | | | | | | | | warning (as error) in tclCompile.c
* | | CONSTify TclPrintInstruction and TclpNativeJoinPath (TIP #27)nijtmans2009-01-221-4/+4
| | | | | | | | | | | | | | | {unix win} in *.decls is equivalent to {generic} tclGetDate.y, tclDate.c: single internal const decoration
* | | Style fixes (unfouling whitespace, sorting comments, removing useless casts, ↵dkf2009-01-091-27/+26
| | | | | | | | | | | | etc.)
* | | Alternate fix for[Bug 2251175]: missing backslash substitution on expanded ↵ferrieux2008-11-271-28/+3
| | | | | | | | | | | | literals.
* | | Simplification of expanded-literals handling after analysis of dead branchesferrieux2008-11-191-29/+5
| | |
* | | Fix [Bug 2251175]: missing backslash substitution on expanded literals.ferrieux2008-11-171-5/+54
| | |
* | | Style improvements - invoking callbacks without visual junk.dkf2008-10-261-9/+9
| | |
* | | Add "const" to many internalnijtmans2008-10-151-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | const tables, so those will be put by the C-compiler in the TEXT segment in stead of the DATA segment. This makes those table sharable in shared libraries.
* | | * generic/tclCompile.c: fix bug in srcDelta encoding withinMiguel Sofer2008-10-121-3/+3
| | | | | | | | | | | | | | | | | | ByteCodes. The bug can only be triggered under conditions that cannot happen in Tcl, but were met during development of L. Thanks go to Robert Netzer for diagnose and fix.
* | | * generic/tclInt.decls: CONSTified the AuxDataType argumentnijtmans2008-10-051-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * generic/tclCompCmds.c: of TclCreateAuxData and * generic/tclCompile.c TclRegisterAuxDataType and the return * generic/tclCompile.h values of TclGetAuxDataType and * generic/tclExecute.c TclGetInstructionTable * ChangeLog * generic/tclIntDecls.h: regenerated This change complies with TIP #27 (even though it only involves internal function, so this is not even necessary).