comparison src/structs.h @ 18991:847cc7932c42 v8.2.0056

patch 8.2.0056: execution stack is incomplete and inefficient Commit: https://github.com/vim/vim/commit/1a47ae32cdc19b0fd5a82e19fe5fddf45db1a506 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Dec 29 23:04:25 2019 +0100 patch 8.2.0056: execution stack is incomplete and inefficient Problem: Execution stack is incomplete and inefficient. Solution: Introduce a proper execution stack and use it instead of sourcing_name/sourcing_lnum. Create a string only when used.
author Bram Moolenaar <Bram@vim.org>
date Sun, 29 Dec 2019 23:15:04 +0100
parents 6bd715870e32
children d9ea4f0bfd34
comparison
equal deleted inserted replaced
18990:1219ae40b086 18991:847cc7932c42
1494 # endif 1494 # endif
1495 sctx_T uf_script_ctx; // SCTX where function was defined, 1495 sctx_T uf_script_ctx; // SCTX where function was defined,
1496 // used for s: variables 1496 // used for s: variables
1497 int uf_refcount; // reference count, see func_name_refcount() 1497 int uf_refcount; // reference count, see func_name_refcount()
1498 funccall_T *uf_scoped; // l: local variables for closure 1498 funccall_T *uf_scoped; // l: local variables for closure
1499 char_u *uf_name_exp; // if "uf_name[]" starts with SNR the name with
1500 // "<SNR>" as a string, otherwise NULL
1499 char_u uf_name[1]; // name of function (actually longer); can 1501 char_u uf_name[1]; // name of function (actually longer); can
1500 // start with <SNR>123_ (<SNR> is K_SPECIAL 1502 // start with <SNR>123_ (<SNR> is K_SPECIAL
1501 // KS_EXTRA KE_SNR) 1503 // KS_EXTRA KE_SNR)
1502 } ufunc_T; 1504 } ufunc_T;
1503 1505
1662 // dict.member in handle_subscript() 1664 // dict.member in handle_subscript()
1663 int pt_argc; // number of arguments 1665 int pt_argc; // number of arguments
1664 typval_T *pt_argv; // arguments in allocated array 1666 typval_T *pt_argv; // arguments in allocated array
1665 dict_T *pt_dict; // dict for "self" 1667 dict_T *pt_dict; // dict for "self"
1666 }; 1668 };
1669
1670 typedef struct AutoPatCmd_S AutoPatCmd;
1671
1672 /*
1673 * Entry in the execution stack "exestack".
1674 */
1675 typedef enum {
1676 ETYPE_TOP, // toplevel
1677 ETYPE_SCRIPT, // sourcing script, use es_info.sctx
1678 ETYPE_UFUNC, // user function, use es_info.ufunc
1679 ETYPE_AUCMD, // autocomand, use es_info.aucmd
1680 ETYPE_MODELINE, // modeline, use es_info.sctx
1681 ETYPE_EXCEPT, // exception, use es_info.exception
1682 ETYPE_ARGS, // command line argument
1683 ETYPE_ENV, // environment variable
1684 ETYPE_INTERNAL, // internal operation
1685 ETYPE_SPELL, // loading spell file
1686 } etype_T;
1687
1688 typedef struct {
1689 long es_lnum; // replaces "sourcing_lnum"
1690 char_u *es_name; // replaces "sourcing_name"
1691 etype_T es_type;
1692 union {
1693 sctx_T *sctx; // script and modeline info
1694 #if defined(FEAT_EVAL)
1695 ufunc_T *ufunc; // function info
1696 #endif
1697 AutoPatCmd *aucmd; // autocommand info
1698 except_T *except; // exception info
1699 } es_info;
1700 } estack_T;
1667 1701
1668 // Information returned by get_tty_info(). 1702 // Information returned by get_tty_info().
1669 typedef struct { 1703 typedef struct {
1670 int backspace; // what the Backspace key produces 1704 int backspace; // what the Backspace key produces
1671 int enter; // what the Enter key produces 1705 int enter; // what the Enter key produces