Mercurial > vim
comparison src/userfunc.c @ 23976:03819ebd3e6d v8.2.2530
patch 8.2.2530: Vim9: not enough testing for profiling
Commit: https://github.com/vim/vim/commit/12d265315fac9e4f3436c38a87f6d9a23b9e7e2b
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Feb 19 19:13:21 2021 +0100
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 19 Feb 2021 19:15:03 +0100 |
parents | e979bf909fd8 |
children | 686af23ec132 |
comparison
equal
deleted
inserted
replaced
23975:a1b074b83f39 | 23976:03819ebd3e6d |
---|---|
1647 ga_init2(&fc->fc_funcs, sizeof(ufunc_T *), 1); | 1647 ga_init2(&fc->fc_funcs, sizeof(ufunc_T *), 1); |
1648 func_ptr_ref(fp); | 1648 func_ptr_ref(fp); |
1649 | 1649 |
1650 if (fp->uf_def_status != UF_NOT_COMPILED) | 1650 if (fp->uf_def_status != UF_NOT_COMPILED) |
1651 { | 1651 { |
1652 #ifdef FEAT_PROFILE | |
1653 ufunc_T *caller = fc->caller == NULL ? NULL : fc->caller->func; | |
1654 #endif | |
1652 // Execute the function, possibly compiling it first. | 1655 // Execute the function, possibly compiling it first. |
1653 #ifdef FEAT_PROFILE | 1656 #ifdef FEAT_PROFILE |
1654 profile_may_start_func(&profile_info, fp, fc); | 1657 if (do_profiling == PROF_YES) |
1658 profile_may_start_func(&profile_info, fp, caller); | |
1655 #endif | 1659 #endif |
1656 call_def_function(fp, argcount, argvars, funcexe->partial, rettv); | 1660 call_def_function(fp, argcount, argvars, funcexe->partial, rettv); |
1657 funcdepth_decrement(); | 1661 funcdepth_decrement(); |
1658 #ifdef FEAT_PROFILE | 1662 #ifdef FEAT_PROFILE |
1659 if (do_profiling == PROF_YES && (fp->uf_profiling | 1663 if (do_profiling == PROF_YES && (fp->uf_profiling |
1660 || (fc->caller != NULL && fc->caller->func->uf_profiling))) | 1664 || (caller != NULL && caller->uf_profiling))) |
1661 profile_may_end_func(&profile_info, fp, fc); | 1665 profile_may_end_func(&profile_info, fp, caller); |
1662 #endif | 1666 #endif |
1663 current_funccal = fc->caller; | 1667 current_funccal = fc->caller; |
1664 free_funccal(fc); | 1668 free_funccal(fc); |
1665 return; | 1669 return; |
1666 } | 1670 } |
1870 | 1874 |
1871 verbose_leave_scroll(); | 1875 verbose_leave_scroll(); |
1872 --no_wait_return; | 1876 --no_wait_return; |
1873 } | 1877 } |
1874 #ifdef FEAT_PROFILE | 1878 #ifdef FEAT_PROFILE |
1875 profile_may_start_func(&profile_info, fp, fc); | 1879 if (do_profiling == PROF_YES) |
1880 profile_may_start_func(&profile_info, fp, | |
1881 fc->caller == NULL ? NULL : fc->caller->func); | |
1876 #endif | 1882 #endif |
1877 | 1883 |
1878 save_current_sctx = current_sctx; | 1884 save_current_sctx = current_sctx; |
1879 current_sctx = fp->uf_script_ctx; | 1885 current_sctx = fp->uf_script_ctx; |
1880 save_did_emsg = did_emsg; | 1886 save_did_emsg = did_emsg; |
1906 rettv->v_type = VAR_NUMBER; | 1912 rettv->v_type = VAR_NUMBER; |
1907 rettv->vval.v_number = -1; | 1913 rettv->vval.v_number = -1; |
1908 } | 1914 } |
1909 | 1915 |
1910 #ifdef FEAT_PROFILE | 1916 #ifdef FEAT_PROFILE |
1911 if (do_profiling == PROF_YES && (fp->uf_profiling | 1917 if (do_profiling == PROF_YES) |
1912 || (fc->caller != NULL && fc->caller->func->uf_profiling))) | 1918 { |
1913 profile_may_end_func(&profile_info, fp, fc); | 1919 ufunc_T *caller = fc->caller == NULL ? NULL : fc->caller->func; |
1920 | |
1921 if (fp->uf_profiling || (caller != NULL && caller->uf_profiling)) | |
1922 profile_may_end_func(&profile_info, fp, caller); | |
1923 } | |
1914 #endif | 1924 #endif |
1915 | 1925 |
1916 // when being verbose, mention the return value | 1926 // when being verbose, mention the return value |
1917 if (p_verbose >= 12) | 1927 if (p_verbose >= 12) |
1918 { | 1928 { |