summaryrefslogtreecommitdiff
path: root/src/vim9execute.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-07-11 17:55:01 +0200
committerBram Moolenaar <Bram@vim.org>2021-07-11 17:55:01 +0200
commit648594eaf703fe9a862cb12a35702a10aff6e5a9 (patch)
tree10c97df4f865c248292f255d496d794ecedc5ec5 /src/vim9execute.c
parentc03fe66ade4c79a4eb5fc05d1d549c8f931a04b6 (diff)
downloadvim-git-648594eaf703fe9a862cb12a35702a10aff6e5a9.tar.gz
patch 8.2.3147: Vim9: profiling does not work with a nested functionv8.2.3147
Problem: Vim9: profiling does not work with a nested function. Solution: Also compile a nested function without profiling. (closes #8543) Handle that compiling may cause the table of compiled functions to change.
Diffstat (limited to 'src/vim9execute.c')
-rw-r--r--src/vim9execute.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/vim9execute.c b/src/vim9execute.c
index 87f3c424e..41249284d 100644
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -197,6 +197,7 @@ call_dfunc(
int idx;
estack_T *entry;
funclocal_T *floc = NULL;
+ int res = OK;
if (dfunc->df_deleted)
{
@@ -219,14 +220,6 @@ call_dfunc(
(((dfunc_T *)def_functions.ga_data)
+ ectx->ec_dfunc_idx)->df_ufunc);
}
-
- // Profiling might be enabled/disabled along the way. This should not
- // fail, since the function was compiled before and toggling profiling
- // doesn't change any errors.
- if (func_needs_compiling(ufunc, COMPILE_TYPE(ufunc))
- && compile_def_function(ufunc, FALSE, COMPILE_TYPE(ufunc), NULL)
- == FAIL)
- return FAIL;
}
#endif
@@ -235,10 +228,14 @@ call_dfunc(
// When debugging and using "cont" switches to the not-debugged
// instructions, may need to still compile them.
- if ((func_needs_compiling(ufunc, COMPILE_TYPE(ufunc))
- && compile_def_function(ufunc, FALSE, COMPILE_TYPE(ufunc), NULL)
- == FAIL)
- || INSTRUCTIONS(dfunc) == NULL)
+ if (func_needs_compiling(ufunc, COMPILE_TYPE(ufunc)))
+ {
+ res = compile_def_function(ufunc, FALSE, COMPILE_TYPE(ufunc), NULL);
+
+ // compile_def_function() may cause def_functions.ga_data to change
+ dfunc = ((dfunc_T *)def_functions.ga_data) + cdf_idx;
+ }
+ if (res == FAIL || INSTRUCTIONS(dfunc) == NULL)
{
if (did_emsg_cumul + did_emsg == did_emsg_before)
semsg(_(e_function_is_not_compiled_str),