diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-12-29 23:04:25 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-12-29 23:04:25 +0100 |
commit | 1a47ae32cdc19b0fd5a82e19fe5fddf45db1a506 (patch) | |
tree | 8f5dc27f3eeea927ad3ca8de42fe0df06a041dd5 /src/profiler.c | |
parent | 257a396879ff67a0482841a39237f30a8e1e27c5 (diff) | |
download | vim-git-1a47ae32cdc19b0fd5a82e19fe5fddf45db1a506.tar.gz |
patch 8.2.0056: execution stack is incomplete and inefficientv8.2.0056
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.
Diffstat (limited to 'src/profiler.c')
-rw-r--r-- | src/profiler.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/profiler.c b/src/profiler.c index 0bfce8696..cd962cabd 100644 --- a/src/profiler.c +++ b/src/profiler.c @@ -602,10 +602,10 @@ func_line_start(void *cookie) funccall_T *fcp = (funccall_T *)cookie; ufunc_T *fp = fcp->func; - if (fp->uf_profiling && sourcing_lnum >= 1 - && sourcing_lnum <= fp->uf_lines.ga_len) + if (fp->uf_profiling && SOURCING_LNUM >= 1 + && SOURCING_LNUM <= fp->uf_lines.ga_len) { - fp->uf_tml_idx = sourcing_lnum - 1; + fp->uf_tml_idx = SOURCING_LNUM - 1; // Skip continuation lines. while (fp->uf_tml_idx > 0 && FUNCLINE(fp, fp->uf_tml_idx) == NULL) --fp->uf_tml_idx; @@ -906,13 +906,13 @@ script_line_start(void) if (current_sctx.sc_sid <= 0 || current_sctx.sc_sid > script_items.ga_len) return; si = &SCRIPT_ITEM(current_sctx.sc_sid); - if (si->sn_prof_on && sourcing_lnum >= 1) + if (si->sn_prof_on && SOURCING_LNUM >= 1) { // Grow the array before starting the timer, so that the time spent // here isn't counted. (void)ga_grow(&si->sn_prl_ga, - (int)(sourcing_lnum - si->sn_prl_ga.ga_len)); - si->sn_prl_idx = sourcing_lnum - 1; + (int)(SOURCING_LNUM - si->sn_prl_ga.ga_len)); + si->sn_prl_idx = SOURCING_LNUM - 1; while (si->sn_prl_ga.ga_len <= si->sn_prl_idx && si->sn_prl_ga.ga_len < si->sn_prl_ga.ga_maxlen) { |