comparison src/vim9execute.c @ 28101:3bc0a639dfb0 v8.2.4575

patch 8.2.4575: Vim9: test for profiling still fails Commit: https://github.com/vim/vim/commit/139575de6653e7fd5807cb036dfb3684b815c519 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Mar 15 19:29:30 2022 +0000 patch 8.2.4575: Vim9: test for profiling still fails Problem: Vim9: test for profiling still fails. Solution: Update flags for profiling and breakpoints when obtaining the compile type. Do not set the FC_CLOSURE flag for a toplevel function.
author Bram Moolenaar <Bram@vim.org>
date Tue, 15 Mar 2022 20:30:03 +0100
parents 632a84e2ce92
children ed151877ebac
comparison
equal deleted inserted replaced
28100:0b5711bd05a9 28101:3bc0a639dfb0
282 int varcount; 282 int varcount;
283 int idx; 283 int idx;
284 estack_T *entry; 284 estack_T *entry;
285 funclocal_T *floc = NULL; 285 funclocal_T *floc = NULL;
286 int res = OK; 286 int res = OK;
287 compiletype_T compile_type;
287 288
288 if (dfunc->df_deleted) 289 if (dfunc->df_deleted)
289 { 290 {
290 // don't use ufunc->uf_name, it may have been freed 291 // don't use ufunc->uf_name, it may have been freed
291 emsg_funcname(e_function_was_deleted_str, 292 emsg_funcname(e_function_was_deleted_str,
307 + ectx->ec_dfunc_idx)->df_ufunc); 308 + ectx->ec_dfunc_idx)->df_ufunc);
308 } 309 }
309 } 310 }
310 #endif 311 #endif
311 312
312 // Update uf_has_breakpoint if needed.
313 update_has_breakpoint(ufunc);
314
315 // When debugging and using "cont" switches to the not-debugged 313 // When debugging and using "cont" switches to the not-debugged
316 // instructions, may need to still compile them. 314 // instructions, may need to still compile them.
317 if (func_needs_compiling(ufunc, COMPILE_TYPE(ufunc))) 315 compile_type = get_compile_type(ufunc);
318 { 316 if (func_needs_compiling(ufunc, compile_type))
319 res = compile_def_function(ufunc, FALSE, COMPILE_TYPE(ufunc), NULL); 317 {
318 res = compile_def_function(ufunc, FALSE, compile_type, NULL);
320 319
321 // compile_def_function() may cause def_functions.ga_data to change 320 // compile_def_function() may cause def_functions.ga_data to change
322 dfunc = ((dfunc_T *)def_functions.ga_data) + cdf_idx; 321 dfunc = ((dfunc_T *)def_functions.ga_data) + cdf_idx;
323 } 322 }
324 if (res == FAIL || INSTRUCTIONS(dfunc) == NULL) 323 if (res == FAIL || INSTRUCTIONS(dfunc) == NULL)
924 typval_T argvars[MAX_FUNC_ARGS]; 923 typval_T argvars[MAX_FUNC_ARGS];
925 funcexe_T funcexe; 924 funcexe_T funcexe;
926 int error; 925 int error;
927 int idx; 926 int idx;
928 int did_emsg_before = did_emsg; 927 int did_emsg_before = did_emsg;
929 compiletype_T compile_type = COMPILE_TYPE(ufunc); 928 compiletype_T compile_type = get_compile_type(ufunc);
930 929
931 if (func_needs_compiling(ufunc, compile_type) 930 if (func_needs_compiling(ufunc, compile_type)
932 && compile_def_function(ufunc, FALSE, compile_type, NULL) 931 && compile_def_function(ufunc, FALSE, compile_type, NULL)
933 == FAIL) 932 == FAIL)
934 return FAIL; 933 return FAIL;
4991 4990
4992 // Get pointer to a local variable on the stack. Negative for arguments. 4991 // Get pointer to a local variable on the stack. Negative for arguments.
4993 #undef STACK_TV_VAR 4992 #undef STACK_TV_VAR
4994 #define STACK_TV_VAR(idx) (((typval_T *)ectx.ec_stack.ga_data) + ectx.ec_frame_idx + STACK_FRAME_SIZE + idx) 4993 #define STACK_TV_VAR(idx) (((typval_T *)ectx.ec_stack.ga_data) + ectx.ec_frame_idx + STACK_FRAME_SIZE + idx)
4995 4994
4996 // Update uf_has_breakpoint if needed.
4997 update_has_breakpoint(ufunc);
4998
4999 if (ufunc->uf_def_status == UF_NOT_COMPILED 4995 if (ufunc->uf_def_status == UF_NOT_COMPILED
5000 || ufunc->uf_def_status == UF_COMPILE_ERROR 4996 || ufunc->uf_def_status == UF_COMPILE_ERROR
5001 || (func_needs_compiling(ufunc, COMPILE_TYPE(ufunc)) 4997 || (func_needs_compiling(ufunc, get_compile_type(ufunc))
5002 && compile_def_function(ufunc, FALSE, COMPILE_TYPE(ufunc), NULL) 4998 && compile_def_function(ufunc, FALSE,
5003 == FAIL)) 4999 get_compile_type(ufunc), NULL) == FAIL))
5004 { 5000 {
5005 if (did_emsg_cumul + did_emsg == did_emsg_before) 5001 if (did_emsg_cumul + did_emsg == did_emsg_before)
5006 semsg(_(e_function_is_not_compiled_str), 5002 semsg(_(e_function_is_not_compiled_str),
5007 printable_func_name(ufunc)); 5003 printable_func_name(ufunc));
5008 return FAIL; 5004 return FAIL;