diff src/vim9compile.c @ 23735:7caffd835aa1 v8.2.2409

patch 8.2.2409: Vim9: profiling only works for one function Commit: https://github.com/vim/vim/commit/e5ea346a07a7750c02a89996b67716b43c767d06 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Jan 25 21:01:48 2021 +0100 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)
author Bram Moolenaar <Bram@vim.org>
date Mon, 25 Jan 2021 21:15:06 +0100
parents 7eef04861034
children c0f2c6c56147
line wrap: on
line diff
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -1775,9 +1775,9 @@ generate_CALL(cctx_T *cctx, ufunc_T *ufu
 		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 @@ generate_funcref(cctx_T *cctx, char_u *n
 	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 @@ compile_lambda(char_u **arg, cctx_T *cct
     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 @@ compile_nested_function(exarg_T *eap, cc
 	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);