0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.2.2530: Vim9: not enough testing for profiling

Problem:    Vim9: not enough testing for profiling.
Solution:   Add a test with nested functions and a lambda.  Fix profiling
            for calling a compiled function.
This commit is contained in:
Bram Moolenaar
2021-02-19 19:13:21 +01:00
parent d3f8a9ee65
commit 12d265315f
6 changed files with 114 additions and 38 deletions

View File

@@ -1649,16 +1649,20 @@ call_user_func(
if (fp->uf_def_status != UF_NOT_COMPILED)
{
#ifdef FEAT_PROFILE
ufunc_T *caller = fc->caller == NULL ? NULL : fc->caller->func;
#endif
// Execute the function, possibly compiling it first.
#ifdef FEAT_PROFILE
profile_may_start_func(&profile_info, fp, fc);
if (do_profiling == PROF_YES)
profile_may_start_func(&profile_info, fp, caller);
#endif
call_def_function(fp, argcount, argvars, funcexe->partial, rettv);
funcdepth_decrement();
#ifdef FEAT_PROFILE
if (do_profiling == PROF_YES && (fp->uf_profiling
|| (fc->caller != NULL && fc->caller->func->uf_profiling)))
profile_may_end_func(&profile_info, fp, fc);
|| (caller != NULL && caller->uf_profiling)))
profile_may_end_func(&profile_info, fp, caller);
#endif
current_funccal = fc->caller;
free_funccal(fc);
@@ -1872,7 +1876,9 @@ call_user_func(
--no_wait_return;
}
#ifdef FEAT_PROFILE
profile_may_start_func(&profile_info, fp, fc);
if (do_profiling == PROF_YES)
profile_may_start_func(&profile_info, fp,
fc->caller == NULL ? NULL : fc->caller->func);
#endif
save_current_sctx = current_sctx;
@@ -1908,9 +1914,13 @@ call_user_func(
}
#ifdef FEAT_PROFILE
if (do_profiling == PROF_YES && (fp->uf_profiling
|| (fc->caller != NULL && fc->caller->func->uf_profiling)))
profile_may_end_func(&profile_info, fp, fc);
if (do_profiling == PROF_YES)
{
ufunc_T *caller = fc->caller == NULL ? NULL : fc->caller->func;
if (fp->uf_profiling || (caller != NULL && caller->uf_profiling))
profile_may_end_func(&profile_info, fp, caller);
}
#endif
// when being verbose, mention the return value