comparison src/vim9compile.c @ 24895:e61a2085c89b v8.2.2985

patch 8.2.2985: Vim9: a compiled function cannot be debugged Commit: https://github.com/vim/vim/commit/e99d422bbd3e47620915bf89671673f0711671b4 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jun 13 14:01:26 2021 +0200 patch 8.2.2985: Vim9: a compiled function cannot be debugged Problem: Vim9: a compiled function cannot be debugged. Solution: Add initial debugging support.
author Bram Moolenaar <Bram@vim.org>
date Sun, 13 Jun 2021 14:15:04 +0200
parents 1d6242cf1163
children 80edcb27d19a
comparison
equal deleted inserted replaced
24894:6270bfeab91f 24895:e61a2085c89b
172 ufunc_T *ctx_ufunc; // current function 172 ufunc_T *ctx_ufunc; // current function
173 int ctx_lnum; // line number in current function 173 int ctx_lnum; // line number in current function
174 char_u *ctx_line_start; // start of current line or NULL 174 char_u *ctx_line_start; // start of current line or NULL
175 garray_T ctx_instr; // generated instructions 175 garray_T ctx_instr; // generated instructions
176 176
177 int ctx_profiling; // when TRUE generate ISN_PROF_START 177 compiletype_T ctx_compile_type;
178 178
179 garray_T ctx_locals; // currently visible local variables 179 garray_T ctx_locals; // currently visible local variables
180 int ctx_locals_count; // total number of local variables 180 int ctx_locals_count; // total number of local variables
181 181
182 int ctx_has_closure; // set to one if a closures was created in 182 int ctx_has_closure; // set to one if a closures was created in
1855 /* 1855 /*
1856 * Return TRUE if "ufunc" should be compiled, taking into account whether 1856 * Return TRUE if "ufunc" should be compiled, taking into account whether
1857 * "profile" indicates profiling is to be done. 1857 * "profile" indicates profiling is to be done.
1858 */ 1858 */
1859 int 1859 int
1860 func_needs_compiling(ufunc_T *ufunc, int profile UNUSED) 1860 func_needs_compiling(ufunc_T *ufunc, compiletype_T compile_type)
1861 { 1861 {
1862 switch (ufunc->uf_def_status) 1862 switch (ufunc->uf_def_status)
1863 { 1863 {
1864 case UF_TO_BE_COMPILED: 1864 case UF_TO_BE_COMPILED:
1865 return TRUE; 1865 return TRUE;
1866 1866
1867 case UF_COMPILED: 1867 case UF_COMPILED:
1868 { 1868 {
1869 #ifdef FEAT_PROFILE
1870 dfunc_T *dfunc = ((dfunc_T *)def_functions.ga_data) 1869 dfunc_T *dfunc = ((dfunc_T *)def_functions.ga_data)
1871 + ufunc->uf_dfunc_idx; 1870 + ufunc->uf_dfunc_idx;
1872 1871
1873 return profile ? dfunc->df_instr_prof == NULL 1872 switch (compile_type)
1874 : dfunc->df_instr == NULL; 1873 {
1875 #else 1874 case CT_NONE:
1876 break; 1875 return dfunc->df_instr == NULL;
1877 #endif 1876 case CT_PROFILE:
1877 return dfunc->df_instr_prof == NULL;
1878 case CT_DEBUG:
1879 return dfunc->df_instr_debug == NULL;
1880 }
1878 } 1881 }
1879 1882
1880 case UF_NOT_COMPILED: 1883 case UF_NOT_COMPILED:
1881 case UF_COMPILE_ERROR: 1884 case UF_COMPILE_ERROR:
1882 case UF_COMPILING: 1885 case UF_COMPILING:
1943 { 1946 {
1944 arg_type_mismatch(expected, actual, i + 1); 1947 arg_type_mismatch(expected, actual, i + 1);
1945 return FAIL; 1948 return FAIL;
1946 } 1949 }
1947 } 1950 }
1948 if (func_needs_compiling(ufunc, PROFILING(ufunc)) 1951 if (func_needs_compiling(ufunc, COMPILE_TYPE(ufunc))
1949 && compile_def_function(ufunc, ufunc->uf_ret_type == NULL, 1952 && compile_def_function(ufunc, ufunc->uf_ret_type == NULL,
1950 PROFILING(ufunc), NULL) == FAIL) 1953 COMPILE_TYPE(ufunc), NULL) == FAIL)
1951 return FAIL; 1954 return FAIL;
1952 } 1955 }
1953 if (ufunc->uf_def_status == UF_COMPILE_ERROR) 1956 if (ufunc->uf_def_status == UF_COMPILE_ERROR)
1954 { 1957 {
1955 emsg_funcname(_(e_call_to_function_that_failed_to_compile_str), 1958 emsg_funcname(_(e_call_to_function_that_failed_to_compile_str),
2311 current_instr_idx(cctx_T *cctx) 2314 current_instr_idx(cctx_T *cctx)
2312 { 2315 {
2313 garray_T *instr = &cctx->ctx_instr; 2316 garray_T *instr = &cctx->ctx_instr;
2314 int idx = instr->ga_len; 2317 int idx = instr->ga_len;
2315 2318
2316 if (cctx->ctx_has_cmdmod && ((isn_T *)instr->ga_data)[idx - 1] 2319 while (idx > 0)
2320 {
2321 if (cctx->ctx_has_cmdmod && ((isn_T *)instr->ga_data)[idx - 1]
2317 .isn_type == ISN_CMDMOD) 2322 .isn_type == ISN_CMDMOD)
2318 --idx; 2323 {
2324 --idx;
2325 continue;
2326 }
2319 #ifdef FEAT_PROFILE 2327 #ifdef FEAT_PROFILE
2320 if (cctx->ctx_profiling && ((isn_T *)instr->ga_data)[idx - 1] 2328 if (((isn_T *)instr->ga_data)[idx - 1].isn_type == ISN_PROF_START)
2321 .isn_type == ISN_PROF_START) 2329 {
2322 --idx; 2330 --idx;
2331 continue;
2332 }
2323 #endif 2333 #endif
2334 if (((isn_T *)instr->ga_data)[idx - 1].isn_type == ISN_DEBUG)
2335 {
2336 --idx;
2337 continue;
2338 }
2339 break;
2340 }
2324 return idx; 2341 return idx;
2325 } 2342 }
2326 2343
2327 #ifdef FEAT_PROFILE 2344 #ifdef FEAT_PROFILE
2328 static void 2345 static void
2329 may_generate_prof_end(cctx_T *cctx, int prof_lnum) 2346 may_generate_prof_end(cctx_T *cctx, int prof_lnum)
2330 { 2347 {
2331 if (cctx->ctx_profiling && prof_lnum >= 0) 2348 if (cctx->ctx_compile_type == CT_PROFILE && prof_lnum >= 0)
2332 generate_instr(cctx, ISN_PROF_END); 2349 generate_instr(cctx, ISN_PROF_END);
2333 } 2350 }
2334 #endif 2351 #endif
2335 2352
2336 /* 2353 /*
2970 2987
2971 if (ufunc == NULL) 2988 if (ufunc == NULL)
2972 return FAIL; 2989 return FAIL;
2973 2990
2974 // Need to compile any default values to get the argument types. 2991 // Need to compile any default values to get the argument types.
2975 if (func_needs_compiling(ufunc, PROFILING(ufunc)) 2992 if (func_needs_compiling(ufunc, COMPILE_TYPE(ufunc))
2976 && compile_def_function(ufunc, TRUE, PROFILING(ufunc), NULL) 2993 && compile_def_function(ufunc, TRUE, COMPILE_TYPE(ufunc), NULL)
2977 == FAIL) 2994 == FAIL)
2978 return FAIL; 2995 return FAIL;
2979 return generate_PUSHFUNC(cctx, ufunc->uf_name, ufunc->uf_func_type); 2996 return generate_PUSHFUNC(cctx, ufunc->uf_name, ufunc->uf_func_type);
2980 } 2997 }
2981 2998
3568 // Compile it here to get the return type. The return type is optional, 3585 // Compile it here to get the return type. The return type is optional,
3569 // when it's missing use t_unknown. This is recognized in 3586 // when it's missing use t_unknown. This is recognized in
3570 // compile_return(). 3587 // compile_return().
3571 if (ufunc->uf_ret_type->tt_type == VAR_VOID) 3588 if (ufunc->uf_ret_type->tt_type == VAR_VOID)
3572 ufunc->uf_ret_type = &t_unknown; 3589 ufunc->uf_ret_type = &t_unknown;
3573 compile_def_function(ufunc, FALSE, PROFILING(ufunc), cctx); 3590 compile_def_function(ufunc, FALSE, COMPILE_TYPE(ufunc), cctx);
3574 3591
3575 // evalarg.eval_tofree_cmdline may have a copy of the last line and "*arg" 3592 // evalarg.eval_tofree_cmdline may have a copy of the last line and "*arg"
3576 // points into it. Point to the original line to avoid a dangling pointer. 3593 // points into it. Point to the original line to avoid a dangling pointer.
3577 if (evalarg.eval_tofree_cmdline != NULL) 3594 if (evalarg.eval_tofree_cmdline != NULL)
3578 { 3595 {
5564 sizeof(int) * block_depth); 5581 sizeof(int) * block_depth);
5565 ufunc->uf_block_depth = block_depth; 5582 ufunc->uf_block_depth = block_depth;
5566 } 5583 }
5567 } 5584 }
5568 5585
5569 if (func_needs_compiling(ufunc, PROFILING(ufunc)) 5586 if (func_needs_compiling(ufunc, COMPILE_TYPE(ufunc))
5570 && compile_def_function(ufunc, TRUE, PROFILING(ufunc), cctx) 5587 && compile_def_function(ufunc, TRUE, COMPILE_TYPE(ufunc), cctx)
5571 == FAIL) 5588 == FAIL)
5572 { 5589 {
5573 func_ptr_unref(ufunc); 5590 func_ptr_unref(ufunc);
5574 goto theend; 5591 goto theend;
5575 } 5592 }
7374 } 7391 }
7375 else 7392 else
7376 scope->se_u.se_if.is_if_label = -1; 7393 scope->se_u.se_if.is_if_label = -1;
7377 7394
7378 #ifdef FEAT_PROFILE 7395 #ifdef FEAT_PROFILE
7379 if (cctx->ctx_profiling && cctx->ctx_skip == SKIP_YES 7396 if (cctx->ctx_compile_type == CT_PROFILE && cctx->ctx_skip == SKIP_YES
7380 && skip_save != SKIP_YES) 7397 && skip_save != SKIP_YES)
7381 { 7398 {
7382 // generated a profile start, need to generate a profile end, since it 7399 // generated a profile start, need to generate a profile end, since it
7383 // won't be done after returning 7400 // won't be done after returning
7384 cctx->ctx_skip = SKIP_NOT; 7401 cctx->ctx_skip = SKIP_NOT;
7455 CLEAR_FIELD(ppconst); 7472 CLEAR_FIELD(ppconst);
7456 if (cctx->ctx_skip == SKIP_YES) 7473 if (cctx->ctx_skip == SKIP_YES)
7457 { 7474 {
7458 cctx->ctx_skip = SKIP_UNKNOWN; 7475 cctx->ctx_skip = SKIP_UNKNOWN;
7459 #ifdef FEAT_PROFILE 7476 #ifdef FEAT_PROFILE
7460 if (cctx->ctx_profiling) 7477 if (cctx->ctx_compile_type == CT_PROFILE)
7461 { 7478 {
7462 // the previous block was skipped, need to profile this line 7479 // the previous block was skipped, need to profile this line
7463 generate_instr(cctx, ISN_PROF_START); 7480 generate_instr(cctx, ISN_PROF_START);
7464 instr_count = instr->ga_len; 7481 instr_count = instr->ga_len;
7465 } 7482 }
7466 #endif 7483 #endif
7484 if (cctx->ctx_compile_type == CT_DEBUG)
7485 {
7486 // the previous block was skipped, may want to debug this line
7487 generate_instr(cctx, ISN_DEBUG);
7488 instr_count = instr->ga_len;
7489 }
7467 } 7490 }
7468 if (compile_expr1(&p, cctx, &ppconst) == FAIL) 7491 if (compile_expr1(&p, cctx, &ppconst) == FAIL)
7469 { 7492 {
7470 clear_ppconst(&ppconst); 7493 clear_ppconst(&ppconst);
7471 return NULL; 7494 return NULL;
7529 if (!cctx->ctx_had_return) 7552 if (!cctx->ctx_had_return)
7530 scope->se_u.se_if.is_had_return = FALSE; 7553 scope->se_u.se_if.is_had_return = FALSE;
7531 scope->se_u.se_if.is_seen_else = TRUE; 7554 scope->se_u.se_if.is_seen_else = TRUE;
7532 7555
7533 #ifdef FEAT_PROFILE 7556 #ifdef FEAT_PROFILE
7534 if (cctx->ctx_profiling) 7557 if (cctx->ctx_compile_type == CT_PROFILE)
7535 { 7558 {
7536 if (cctx->ctx_skip == SKIP_NOT 7559 if (cctx->ctx_skip == SKIP_NOT
7537 && ((isn_T *)instr->ga_data)[instr->ga_len - 1] 7560 && ((isn_T *)instr->ga_data)[instr->ga_len - 1]
7538 .isn_type == ISN_PROF_START) 7561 .isn_type == ISN_PROF_START)
7539 // the previous block was executed, do not count "else" for profiling 7562 // the previous block was executed, do not count "else" for
7563 // profiling
7540 --instr->ga_len; 7564 --instr->ga_len;
7541 if (cctx->ctx_skip == SKIP_YES && !scope->se_u.se_if.is_seen_skip_not) 7565 if (cctx->ctx_skip == SKIP_YES && !scope->se_u.se_if.is_seen_skip_not)
7542 { 7566 {
7543 // the previous block was not executed, this one will, do count the 7567 // the previous block was not executed, this one will, do count the
7544 // "else" for profiling 7568 // "else" for profiling
7610 compile_fill_jump_to_end(&ifscope->is_end_label, instr->ga_len, cctx); 7634 compile_fill_jump_to_end(&ifscope->is_end_label, instr->ga_len, cctx);
7611 7635
7612 #ifdef FEAT_PROFILE 7636 #ifdef FEAT_PROFILE
7613 // even when skipping we count the endif as executed, unless the block it's 7637 // even when skipping we count the endif as executed, unless the block it's
7614 // in is skipped 7638 // in is skipped
7615 if (cctx->ctx_profiling && cctx->ctx_skip == SKIP_YES 7639 if (cctx->ctx_compile_type == CT_PROFILE && cctx->ctx_skip == SKIP_YES
7616 && scope->se_skip_save != SKIP_YES) 7640 && scope->se_skip_save != SKIP_YES)
7617 { 7641 {
7618 cctx->ctx_skip = SKIP_NOT; 7642 cctx->ctx_skip = SKIP_NOT;
7619 generate_instr(cctx, ISN_PROF_START); 7643 generate_instr(cctx, ISN_PROF_START);
7620 } 7644 }
8181 8205
8182 if (cctx->ctx_skip != SKIP_YES) 8206 if (cctx->ctx_skip != SKIP_YES)
8183 { 8207 {
8184 #ifdef FEAT_PROFILE 8208 #ifdef FEAT_PROFILE
8185 // the profile-start should be after the jump 8209 // the profile-start should be after the jump
8186 if (cctx->ctx_profiling && ((isn_T *)instr->ga_data)[instr->ga_len - 1] 8210 if (cctx->ctx_compile_type == CT_PROFILE
8211 && ((isn_T *)instr->ga_data)[instr->ga_len - 1]
8187 .isn_type == ISN_PROF_START) 8212 .isn_type == ISN_PROF_START)
8188 --instr->ga_len; 8213 --instr->ga_len;
8189 #endif 8214 #endif
8190 // Jump from end of previous block to :finally or :endtry 8215 // Jump from end of previous block to :finally or :endtry
8191 if (compile_jump_to_end(&scope->se_u.se_try.ts_end_label, 8216 if (compile_jump_to_end(&scope->se_u.se_try.ts_end_label,
8201 // Previous catch without match jumps here 8226 // Previous catch without match jumps here
8202 isn = ((isn_T *)instr->ga_data) + scope->se_u.se_try.ts_catch_label; 8227 isn = ((isn_T *)instr->ga_data) + scope->se_u.se_try.ts_catch_label;
8203 isn->isn_arg.jump.jump_where = instr->ga_len; 8228 isn->isn_arg.jump.jump_where = instr->ga_len;
8204 } 8229 }
8205 #ifdef FEAT_PROFILE 8230 #ifdef FEAT_PROFILE
8206 if (cctx->ctx_profiling) 8231 if (cctx->ctx_compile_type == CT_PROFILE)
8207 { 8232 {
8208 // a "throw" that jumps here needs to be counted 8233 // a "throw" that jumps here needs to be counted
8209 generate_instr(cctx, ISN_PROF_END); 8234 generate_instr(cctx, ISN_PROF_END);
8210 // the "catch" is also counted 8235 // the "catch" is also counted
8211 generate_instr(cctx, ISN_PROF_START); 8236 generate_instr(cctx, ISN_PROF_START);
8212 } 8237 }
8213 #endif 8238 #endif
8239 if (cctx->ctx_compile_type == CT_DEBUG)
8240 generate_instr(cctx, ISN_DEBUG);
8214 } 8241 }
8215 8242
8216 p = skipwhite(arg); 8243 p = skipwhite(arg);
8217 if (ends_excmd2(arg, p)) 8244 if (ends_excmd2(arg, p))
8218 { 8245 {
8296 return NULL; 8323 return NULL;
8297 } 8324 }
8298 8325
8299 this_instr = instr->ga_len; 8326 this_instr = instr->ga_len;
8300 #ifdef FEAT_PROFILE 8327 #ifdef FEAT_PROFILE
8301 if (cctx->ctx_profiling && ((isn_T *)instr->ga_data)[instr->ga_len - 1] 8328 if (cctx->ctx_compile_type == CT_PROFILE
8329 && ((isn_T *)instr->ga_data)[instr->ga_len - 1]
8302 .isn_type == ISN_PROF_START) 8330 .isn_type == ISN_PROF_START)
8303 // jump to the profile start of the "finally" 8331 // jump to the profile start of the "finally"
8304 --this_instr; 8332 --this_instr;
8305 #endif 8333 #endif
8306 8334
8365 emsg(_(e_missing_catch_or_finally)); 8393 emsg(_(e_missing_catch_or_finally));
8366 return NULL; 8394 return NULL;
8367 } 8395 }
8368 8396
8369 #ifdef FEAT_PROFILE 8397 #ifdef FEAT_PROFILE
8370 if (cctx->ctx_profiling && ((isn_T *)instr->ga_data)[instr->ga_len - 1] 8398 if (cctx->ctx_compile_type == CT_PROFILE
8399 && ((isn_T *)instr->ga_data)[instr->ga_len - 1]
8371 .isn_type == ISN_PROF_START) 8400 .isn_type == ISN_PROF_START)
8372 // move the profile start after "endtry" so that it's not counted when 8401 // move the profile start after "endtry" so that it's not counted when
8373 // the exception is rethrown. 8402 // the exception is rethrown.
8374 --instr->ga_len; 8403 --instr->ga_len;
8375 #endif 8404 #endif
8397 try_isn->isn_arg.try.try_ref->try_endtry = instr->ga_len; 8426 try_isn->isn_arg.try.try_ref->try_endtry = instr->ga_len;
8398 if (cctx->ctx_skip != SKIP_YES 8427 if (cctx->ctx_skip != SKIP_YES
8399 && generate_instr(cctx, ISN_ENDTRY) == NULL) 8428 && generate_instr(cctx, ISN_ENDTRY) == NULL)
8400 return NULL; 8429 return NULL;
8401 #ifdef FEAT_PROFILE 8430 #ifdef FEAT_PROFILE
8402 if (cctx->ctx_profiling) 8431 if (cctx->ctx_compile_type == CT_PROFILE)
8403 generate_instr(cctx, ISN_PROF_START); 8432 generate_instr(cctx, ISN_PROF_START);
8404 #endif 8433 #endif
8405 } 8434 }
8406 return arg; 8435 return arg;
8407 } 8436 }
8963 * "def_functions". 8992 * "def_functions".
8964 * Returns OK or FAIL. 8993 * Returns OK or FAIL.
8965 */ 8994 */
8966 int 8995 int
8967 compile_def_function( 8996 compile_def_function(
8968 ufunc_T *ufunc, 8997 ufunc_T *ufunc,
8969 int check_return_type, 8998 int check_return_type,
8970 int profiling UNUSED, 8999 compiletype_T compile_type,
8971 cctx_T *outer_cctx) 9000 cctx_T *outer_cctx)
8972 { 9001 {
8973 char_u *line = NULL; 9002 char_u *line = NULL;
8974 char_u *line_to_free = NULL; 9003 char_u *line_to_free = NULL;
8975 char_u *p; 9004 char_u *p;
8976 char *errormsg = NULL; // error message 9005 char *errormsg = NULL; // error message
8985 int do_estack_push; 9014 int do_estack_push;
8986 int new_def_function = FALSE; 9015 int new_def_function = FALSE;
8987 #ifdef FEAT_PROFILE 9016 #ifdef FEAT_PROFILE
8988 int prof_lnum = -1; 9017 int prof_lnum = -1;
8989 #endif 9018 #endif
9019 int debug_lnum = -1;
8990 9020
8991 // When using a function that was compiled before: Free old instructions. 9021 // When using a function that was compiled before: Free old instructions.
8992 // The index is reused. Otherwise add a new entry in "def_functions". 9022 // The index is reused. Otherwise add a new entry in "def_functions".
8993 if (ufunc->uf_dfunc_idx > 0) 9023 if (ufunc->uf_dfunc_idx > 0)
8994 { 9024 {
9005 9035
9006 ufunc->uf_def_status = UF_COMPILING; 9036 ufunc->uf_def_status = UF_COMPILING;
9007 9037
9008 CLEAR_FIELD(cctx); 9038 CLEAR_FIELD(cctx);
9009 9039
9010 #ifdef FEAT_PROFILE 9040 cctx.ctx_compile_type = compile_type;
9011 cctx.ctx_profiling = profiling;
9012 #endif
9013 cctx.ctx_ufunc = ufunc; 9041 cctx.ctx_ufunc = ufunc;
9014 cctx.ctx_lnum = -1; 9042 cctx.ctx_lnum = -1;
9015 cctx.ctx_outer = outer_cctx; 9043 cctx.ctx_outer = outer_cctx;
9016 ga_init2(&cctx.ctx_locals, sizeof(lvar_T), 10); 9044 ga_init2(&cctx.ctx_locals, sizeof(lvar_T), 10);
9017 ga_init2(&cctx.ctx_type_stack, sizeof(type_T *), 50); 9045 ga_init2(&cctx.ctx_type_stack, sizeof(type_T *), 50);
9157 line = (char_u *)""; 9185 line = (char_u *)"";
9158 continue; 9186 continue;
9159 } 9187 }
9160 9188
9161 #ifdef FEAT_PROFILE 9189 #ifdef FEAT_PROFILE
9162 if (cctx.ctx_profiling && cctx.ctx_lnum != prof_lnum && 9190 if (cctx.ctx_compile_type == CT_PROFILE && cctx.ctx_lnum != prof_lnum
9163 cctx.ctx_skip != SKIP_YES) 9191 && cctx.ctx_skip != SKIP_YES)
9164 { 9192 {
9165 may_generate_prof_end(&cctx, prof_lnum); 9193 may_generate_prof_end(&cctx, prof_lnum);
9166 9194
9167 prof_lnum = cctx.ctx_lnum; 9195 prof_lnum = cctx.ctx_lnum;
9168 generate_instr(&cctx, ISN_PROF_START); 9196 generate_instr(&cctx, ISN_PROF_START);
9169 } 9197 }
9170 #endif 9198 #endif
9199 if (cctx.ctx_compile_type == CT_DEBUG && cctx.ctx_lnum != debug_lnum
9200 && cctx.ctx_skip != SKIP_YES)
9201 {
9202 debug_lnum = cctx.ctx_lnum;
9203 generate_instr(&cctx, ISN_DEBUG);
9204 }
9171 9205
9172 // Some things can be recognized by the first character. 9206 // Some things can be recognized by the first character.
9173 switch (*ea.cmd) 9207 switch (*ea.cmd)
9174 { 9208 {
9175 case '}': 9209 case '}':
9615 dfunc_T *dfunc = ((dfunc_T *)def_functions.ga_data) 9649 dfunc_T *dfunc = ((dfunc_T *)def_functions.ga_data)
9616 + ufunc->uf_dfunc_idx; 9650 + ufunc->uf_dfunc_idx;
9617 dfunc->df_deleted = FALSE; 9651 dfunc->df_deleted = FALSE;
9618 dfunc->df_script_seq = current_sctx.sc_seq; 9652 dfunc->df_script_seq = current_sctx.sc_seq;
9619 #ifdef FEAT_PROFILE 9653 #ifdef FEAT_PROFILE
9620 if (cctx.ctx_profiling) 9654 if (cctx.ctx_compile_type == CT_PROFILE)
9621 { 9655 {
9622 dfunc->df_instr_prof = instr->ga_data; 9656 dfunc->df_instr_prof = instr->ga_data;
9623 dfunc->df_instr_prof_count = instr->ga_len; 9657 dfunc->df_instr_prof_count = instr->ga_len;
9624 } 9658 }
9625 else 9659 else
9626 #endif 9660 #endif
9661 if (cctx.ctx_compile_type == CT_DEBUG)
9662 {
9663 dfunc->df_instr_debug = instr->ga_data;
9664 dfunc->df_instr_debug_count = instr->ga_len;
9665 }
9666 else
9627 { 9667 {
9628 dfunc->df_instr = instr->ga_data; 9668 dfunc->df_instr = instr->ga_data;
9629 dfunc->df_instr_count = instr->ga_len; 9669 dfunc->df_instr_count = instr->ga_len;
9630 } 9670 }
9631 dfunc->df_varcount = cctx.ctx_locals_count; 9671 dfunc->df_varcount = cctx.ctx_locals_count;
9917 case ISN_COMPARENR: 9957 case ISN_COMPARENR:
9918 case ISN_COMPARESPECIAL: 9958 case ISN_COMPARESPECIAL:
9919 case ISN_COMPARESTRING: 9959 case ISN_COMPARESTRING:
9920 case ISN_CONCAT: 9960 case ISN_CONCAT:
9921 case ISN_COND2BOOL: 9961 case ISN_COND2BOOL:
9962 case ISN_DEBUG:
9922 case ISN_DROP: 9963 case ISN_DROP:
9923 case ISN_ECHO: 9964 case ISN_ECHO:
9924 case ISN_ECHOERR: 9965 case ISN_ECHOERR:
9925 case ISN_ECHOMSG: 9966 case ISN_ECHOMSG:
9926 case ISN_ENDTRY: 9967 case ISN_ENDTRY:
9927 case ISN_EXECCONCAT: 9968 case ISN_EXECCONCAT:
9928 case ISN_EXECUTE: 9969 case ISN_EXECUTE:
9929 case ISN_FINALLY: 9970 case ISN_FINALLY:
9971 case ISN_FINISH:
9930 case ISN_FOR: 9972 case ISN_FOR:
9931 case ISN_GETITEM: 9973 case ISN_GETITEM:
9932 case ISN_JUMP: 9974 case ISN_JUMP:
9933 case ISN_JUMP_IF_ARG_SET: 9975 case ISN_JUMP_IF_ARG_SET:
9934 case ISN_LISTAPPEND: 9976 case ISN_LISTAPPEND:
9947 case ISN_NEGATENR: 9989 case ISN_NEGATENR:
9948 case ISN_NEWDICT: 9990 case ISN_NEWDICT:
9949 case ISN_NEWLIST: 9991 case ISN_NEWLIST:
9950 case ISN_OPANY: 9992 case ISN_OPANY:
9951 case ISN_OPFLOAT: 9993 case ISN_OPFLOAT:
9952 case ISN_FINISH:
9953 case ISN_OPNR: 9994 case ISN_OPNR:
9954 case ISN_PCALL: 9995 case ISN_PCALL:
9955 case ISN_PCALL_END: 9996 case ISN_PCALL_END:
9956 case ISN_PROF_END: 9997 case ISN_PROF_END:
9957 case ISN_PROF_START: 9998 case ISN_PROF_START: