patch 8.2.2409: Vim9: profiling only works for one function
Problem: Vim9: profiling only works for one function.
Solution: Select the right instructions when calling and returning.
(closes #7743)
diff --git a/src/vim9compile.c b/src/vim9compile.c
index 2dd3a4f..5b9f7f5 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -1775,9 +1775,9 @@
return FAIL;
}
}
- if (func_needs_compiling(ufunc, cctx->ctx_profiling)
+ if (func_needs_compiling(ufunc, PROFILING(ufunc))
&& compile_def_function(ufunc, ufunc->uf_ret_type == NULL,
- cctx->ctx_profiling, NULL) == FAIL)
+ PROFILING(ufunc), NULL) == FAIL)
return FAIL;
}
@@ -2615,8 +2615,8 @@
return FAIL;
// Need to compile any default values to get the argument types.
- if (func_needs_compiling(ufunc, cctx->ctx_profiling)
- && compile_def_function(ufunc, TRUE, cctx->ctx_profiling, NULL)
+ if (func_needs_compiling(ufunc, PROFILING(ufunc))
+ && compile_def_function(ufunc, TRUE, PROFILING(ufunc), NULL)
== FAIL)
return FAIL;
return generate_PUSHFUNC(cctx, ufunc->uf_name, ufunc->uf_func_type);
@@ -3111,7 +3111,7 @@
clear_tv(&rettv);
// Compile the function into instructions.
- compile_def_function(ufunc, TRUE, cctx->ctx_profiling, cctx);
+ compile_def_function(ufunc, TRUE, PROFILING(ufunc), cctx);
clear_evalarg(&evalarg, NULL);
@@ -5088,8 +5088,8 @@
r = eap->skip ? OK : FAIL;
goto theend;
}
- if (func_needs_compiling(ufunc, cctx->ctx_profiling)
- && compile_def_function(ufunc, TRUE, cctx->ctx_profiling, cctx)
+ if (func_needs_compiling(ufunc, PROFILING(ufunc))
+ && compile_def_function(ufunc, TRUE, PROFILING(ufunc), cctx)
== FAIL)
{
func_ptr_unref(ufunc);