diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-02-19 19:13:21 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-02-19 19:13:21 +0100 |
commit | 12d265315fac9e4f3436c38a87f6d9a23b9e7e2b (patch) | |
tree | 55d04fd2ba3c7f12f32ff24f43b448292fdf7a05 /src/userfunc.c | |
parent | d3f8a9ee65b249d073343e43e423bc3348dd09d0 (diff) |
patch 8.2.2530: Vim9: not enough testing for profilingv8.2.2530
Problem: Vim9: not enough testing for profiling.
Solution: Add a test with nested functions and a lambda. Fix profiling
for calling a compiled function.
Diffstat (limited to 'src/userfunc.c')
-rw-r--r-- | src/userfunc.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/src/userfunc.c b/src/userfunc.c index 3e17621896..64a8fa6063 100644 --- a/src/userfunc.c +++ b/src/userfunc.c @@ -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 |