• Re: How does TCL select the bytecode engine vs interpreted engine

    From Don Porter@21:1/5 to sam appleton on Mon Oct 23 15:49:34 2023
    On 10/23/23 15:27, sam appleton wrote:
    Hiya All,

    We are facing some difficulties in the behavior of TCL between the "non-bytecode" execution vs bytecode execution,
    for since

    Tcl_LappendObjCmd
    vs.
    TclCompileLappendCmd

    How does TCL determine whether it's going to "compile" input or just interpret it - and is there any way to "force" one way or the other (dynamically)
    for testing purposes? For our testing, we need to force the two paths through the
    interpreter for the same input to verify that the behavior is the same. For example, in some cases we see TCL take the "interpreted" path and call Tcl_LappendObjCmd, and in other cases, it bytecompiles the input and goes through the
    TclCompileLappendCmd path.


    Sam Appleton
    Ausdia Inc.

    Use the TCL_EVAL_DIRECT flag to Tcl_EvalObjEx() to forbid use of
    bytecode.

    https://www.tcl.tk/man/tcl8.6/TclLib/Eval.html

    --
    | Don Porter Applied and Computational Mathematics Division |
    | [email protected] Information Technology Laboratory |
    | http://math.nist.gov/~DPorter/ NIST | |______________________________________________________________________|

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From sam appleton@21:1/5 to All on Mon Oct 23 12:27:34 2023
    Hiya All,

    We are facing some difficulties in the behavior of TCL between the "non-bytecode" execution vs bytecode execution,
    for since

    Tcl_LappendObjCmd
    vs.
    TclCompileLappendCmd

    How does TCL determine whether it's going to "compile" input or just
    interpret it - and is there any way to "force" one way or the other (dynamically)
    for testing purposes? For our testing, we need to force the two paths through the
    interpreter for the same input to verify that the behavior is the same. For example, in some cases we see TCL take the "interpreted" path and call Tcl_LappendObjCmd, and in other cases, it bytecompiles the input and goes through the TclCompileLappendCmd
    path.


    Sam Appleton
    Ausdia Inc.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ashok@21:1/5 to sam appleton on Tue Oct 24 10:40:23 2023
    At a script level, I believe the following three cases are necessary to exercise all code paths. Using lappend as an example

    1. Compiled with a local variable table (or use apply instead of
    defining a proc)
    proc testlappend {} {
    lappend L a b c
    }
    testlappend

    2. Compiled without a local variable table
    lappend L a b c

    3. Uncompiled
    set testcmd lappend
    $testcmd L a b c

    Corrections from Tcl bytecode gurus welcome

    /Ashok

    On 10/24/2023 12:57 AM, sam appleton wrote:
    Hiya All,

    We are facing some difficulties in the behavior of TCL between the "non-bytecode" execution vs bytecode execution,
    for since

    Tcl_LappendObjCmd
    vs.
    TclCompileLappendCmd

    How does TCL determine whether it's going to "compile" input or just interpret it - and is there any way to "force" one way or the other (dynamically)
    for testing purposes? For our testing, we need to force the two paths through the
    interpreter for the same input to verify that the behavior is the same. For example, in some cases we see TCL take the "interpreted" path and call Tcl_LappendObjCmd, and in other cases, it bytecompiles the input and goes through the
    TclCompileLappendCmd path.


    Sam Appleton
    Ausdia Inc.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)