mirror of
https://github.com/vim/vim.git
synced 2025-09-05 21:43:39 -04:00
patch 8.2.2401: build fails without +profiling feature
Problem: Build fails without +profiling feature. Solution: Add #ifdefs.
This commit is contained in:
parent
b204990346
commit
f002a41d12
@ -1906,6 +1906,11 @@ typedef struct {
|
|||||||
proftime_T pi_call_start;
|
proftime_T pi_call_start;
|
||||||
} profinfo_T;
|
} profinfo_T;
|
||||||
|
|
||||||
|
# else
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
int dummy;
|
||||||
|
} profinfo_T;
|
||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
// dummy typedefs for use in function prototypes
|
// dummy typedefs for use in function prototypes
|
||||||
|
@ -1848,6 +1848,9 @@ def s:Profiled(): string
|
|||||||
enddef
|
enddef
|
||||||
|
|
||||||
def Test_profiled()
|
def Test_profiled()
|
||||||
|
if !has('profile')
|
||||||
|
MissingFeature 'profile'
|
||||||
|
endif
|
||||||
var res = execute('disass! s:Profiled')
|
var res = execute('disass! s:Profiled')
|
||||||
assert_match('<SNR>\d*_Profiled\_s*' ..
|
assert_match('<SNR>\d*_Profiled\_s*' ..
|
||||||
'echo "profiled"\_s*' ..
|
'echo "profiled"\_s*' ..
|
||||||
|
@ -750,6 +750,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
2401,
|
||||||
/**/
|
/**/
|
||||||
2400,
|
2400,
|
||||||
/**/
|
/**/
|
||||||
|
@ -373,8 +373,10 @@ struct dfunc_S {
|
|||||||
// After compiling "df_instr" and/or "df_instr_prof" is not NULL.
|
// After compiling "df_instr" and/or "df_instr_prof" is not NULL.
|
||||||
isn_T *df_instr; // function body to be executed
|
isn_T *df_instr; // function body to be executed
|
||||||
int df_instr_count; // size of "df_instr"
|
int df_instr_count; // size of "df_instr"
|
||||||
isn_T *df_instr_prof; // like "df_instr" with profiling
|
#ifdef FEAT_PROFILE
|
||||||
int df_instr_prof_count; // size of "df_instr_prof"
|
isn_T *df_instr_prof; // like "df_instr" with profiling
|
||||||
|
int df_instr_prof_count; // size of "df_instr_prof"
|
||||||
|
#endif
|
||||||
|
|
||||||
int df_varcount; // number of local variables
|
int df_varcount; // number of local variables
|
||||||
int df_has_closure; // one if a closure was created
|
int df_has_closure; // one if a closure was created
|
||||||
|
@ -1699,22 +1699,27 @@ generate_BLOBAPPEND(cctx_T *cctx)
|
|||||||
* "profile" indicates profiling is to be done.
|
* "profile" indicates profiling is to be done.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
func_needs_compiling(ufunc_T *ufunc, int profile)
|
func_needs_compiling(ufunc_T *ufunc, int profile UNUSED)
|
||||||
{
|
{
|
||||||
switch (ufunc->uf_def_status)
|
switch (ufunc->uf_def_status)
|
||||||
{
|
{
|
||||||
case UF_NOT_COMPILED: return FALSE;
|
case UF_NOT_COMPILED: break;
|
||||||
case UF_TO_BE_COMPILED: return TRUE;
|
case UF_TO_BE_COMPILED: return TRUE;
|
||||||
case UF_COMPILED:
|
case UF_COMPILED:
|
||||||
{
|
{
|
||||||
|
#ifdef FEAT_PROFILE
|
||||||
dfunc_T *dfunc = ((dfunc_T *)def_functions.ga_data)
|
dfunc_T *dfunc = ((dfunc_T *)def_functions.ga_data)
|
||||||
+ ufunc->uf_dfunc_idx;
|
+ ufunc->uf_dfunc_idx;
|
||||||
|
|
||||||
return profile ? dfunc->df_instr_prof == NULL
|
return profile ? dfunc->df_instr_prof == NULL
|
||||||
: dfunc->df_instr == NULL;
|
: dfunc->df_instr == NULL;
|
||||||
|
#else
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
case UF_COMPILING: return FALSE;
|
case UF_COMPILING: break;
|
||||||
}
|
}
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2088,6 +2093,7 @@ generate_undo_cmdmods(cctx_T *cctx)
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef FEAT_PROFILE
|
||||||
static void
|
static void
|
||||||
may_generate_prof_end(cctx_T *cctx, int prof_lnum)
|
may_generate_prof_end(cctx_T *cctx, int prof_lnum)
|
||||||
{
|
{
|
||||||
@ -2100,6 +2106,7 @@ may_generate_prof_end(cctx_T *cctx, int prof_lnum)
|
|||||||
cctx->ctx_lnum = save_lnum;
|
cctx->ctx_lnum = save_lnum;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Reserve space for a local variable.
|
* Reserve space for a local variable.
|
||||||
@ -7143,9 +7150,11 @@ compile_while(char_u *arg, cctx_T *cctx)
|
|||||||
|
|
||||||
// "endwhile" jumps back here, one before when profiling
|
// "endwhile" jumps back here, one before when profiling
|
||||||
scope->se_u.se_while.ws_top_label = instr->ga_len;
|
scope->se_u.se_while.ws_top_label = instr->ga_len;
|
||||||
|
#ifdef FEAT_PROFILE
|
||||||
if (cctx->ctx_profiling && ((isn_T *)instr->ga_data)[instr->ga_len - 1]
|
if (cctx->ctx_profiling && ((isn_T *)instr->ga_data)[instr->ga_len - 1]
|
||||||
.isn_type == ISN_PROF_START)
|
.isn_type == ISN_PROF_START)
|
||||||
--scope->se_u.se_while.ws_top_label;
|
--scope->se_u.se_while.ws_top_label;
|
||||||
|
#endif
|
||||||
|
|
||||||
// compile "expr"
|
// compile "expr"
|
||||||
if (compile_expr0(&p, cctx) == FAIL)
|
if (compile_expr0(&p, cctx) == FAIL)
|
||||||
@ -7178,8 +7187,10 @@ compile_endwhile(char_u *arg, cctx_T *cctx)
|
|||||||
cctx->ctx_scope = scope->se_outer;
|
cctx->ctx_scope = scope->se_outer;
|
||||||
unwind_locals(cctx, scope->se_local_count);
|
unwind_locals(cctx, scope->se_local_count);
|
||||||
|
|
||||||
|
#ifdef FEAT_PROFILE
|
||||||
// count the endwhile before jumping
|
// count the endwhile before jumping
|
||||||
may_generate_prof_end(cctx, cctx->ctx_lnum);
|
may_generate_prof_end(cctx, cctx->ctx_lnum);
|
||||||
|
#endif
|
||||||
|
|
||||||
// At end of ":for" scope jump back to the FOR instruction.
|
// At end of ":for" scope jump back to the FOR instruction.
|
||||||
generate_JUMP(cctx, JUMP_ALWAYS, scope->se_u.se_while.ws_top_label);
|
generate_JUMP(cctx, JUMP_ALWAYS, scope->se_u.se_while.ws_top_label);
|
||||||
@ -7851,7 +7862,7 @@ add_def_function(ufunc_T *ufunc)
|
|||||||
compile_def_function(
|
compile_def_function(
|
||||||
ufunc_T *ufunc,
|
ufunc_T *ufunc,
|
||||||
int check_return_type,
|
int check_return_type,
|
||||||
int profiling,
|
int profiling UNUSED,
|
||||||
cctx_T *outer_cctx)
|
cctx_T *outer_cctx)
|
||||||
{
|
{
|
||||||
char_u *line = NULL;
|
char_u *line = NULL;
|
||||||
@ -7865,7 +7876,9 @@ compile_def_function(
|
|||||||
int save_estack_compiling = estack_compiling;
|
int save_estack_compiling = estack_compiling;
|
||||||
int do_estack_push;
|
int do_estack_push;
|
||||||
int new_def_function = FALSE;
|
int new_def_function = FALSE;
|
||||||
|
#ifdef FEAT_PROFILE
|
||||||
int prof_lnum = -1;
|
int prof_lnum = -1;
|
||||||
|
#endif
|
||||||
|
|
||||||
// When using a function that was compiled before: Free old instructions.
|
// When using a function that was compiled before: Free old instructions.
|
||||||
// The index is reused. Otherwise add a new entry in "def_functions".
|
// The index is reused. Otherwise add a new entry in "def_functions".
|
||||||
@ -7886,7 +7899,9 @@ compile_def_function(
|
|||||||
|
|
||||||
CLEAR_FIELD(cctx);
|
CLEAR_FIELD(cctx);
|
||||||
|
|
||||||
|
#ifdef FEAT_PROFILE
|
||||||
cctx.ctx_profiling = profiling;
|
cctx.ctx_profiling = profiling;
|
||||||
|
#endif
|
||||||
cctx.ctx_ufunc = ufunc;
|
cctx.ctx_ufunc = ufunc;
|
||||||
cctx.ctx_lnum = -1;
|
cctx.ctx_lnum = -1;
|
||||||
cctx.ctx_outer = outer_cctx;
|
cctx.ctx_outer = outer_cctx;
|
||||||
@ -7989,7 +8004,9 @@ compile_def_function(
|
|||||||
if (cctx.ctx_lnum >= ufunc->uf_lines.ga_len)
|
if (cctx.ctx_lnum >= ufunc->uf_lines.ga_len)
|
||||||
{
|
{
|
||||||
// beyond the last line
|
// beyond the last line
|
||||||
|
#ifdef FEAT_PROFILE
|
||||||
may_generate_prof_end(&cctx, prof_lnum);
|
may_generate_prof_end(&cctx, prof_lnum);
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -8005,6 +8022,7 @@ compile_def_function(
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef FEAT_PROFILE
|
||||||
if (cctx.ctx_profiling && cctx.ctx_lnum != prof_lnum)
|
if (cctx.ctx_profiling && cctx.ctx_lnum != prof_lnum)
|
||||||
{
|
{
|
||||||
may_generate_prof_end(&cctx, prof_lnum);
|
may_generate_prof_end(&cctx, prof_lnum);
|
||||||
@ -8012,6 +8030,7 @@ compile_def_function(
|
|||||||
prof_lnum = cctx.ctx_lnum;
|
prof_lnum = cctx.ctx_lnum;
|
||||||
generate_instr(&cctx, ISN_PROF_START);
|
generate_instr(&cctx, ISN_PROF_START);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Some things can be recognized by the first character.
|
// Some things can be recognized by the first character.
|
||||||
switch (*ea.cmd)
|
switch (*ea.cmd)
|
||||||
@ -8376,12 +8395,14 @@ nextline:
|
|||||||
+ ufunc->uf_dfunc_idx;
|
+ ufunc->uf_dfunc_idx;
|
||||||
dfunc->df_deleted = FALSE;
|
dfunc->df_deleted = FALSE;
|
||||||
dfunc->df_script_seq = current_sctx.sc_seq;
|
dfunc->df_script_seq = current_sctx.sc_seq;
|
||||||
|
#ifdef FEAT_PROFILE
|
||||||
if (cctx.ctx_profiling)
|
if (cctx.ctx_profiling)
|
||||||
{
|
{
|
||||||
dfunc->df_instr_prof = instr->ga_data;
|
dfunc->df_instr_prof = instr->ga_data;
|
||||||
dfunc->df_instr_prof_count = instr->ga_len;
|
dfunc->df_instr_prof_count = instr->ga_len;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
dfunc->df_instr = instr->ga_data;
|
dfunc->df_instr = instr->ga_data;
|
||||||
dfunc->df_instr_count = instr->ga_len;
|
dfunc->df_instr_count = instr->ga_len;
|
||||||
|
@ -645,7 +645,11 @@ call_ufunc(
|
|||||||
int error;
|
int error;
|
||||||
int idx;
|
int idx;
|
||||||
int did_emsg_before = did_emsg;
|
int did_emsg_before = did_emsg;
|
||||||
|
#ifdef FEAT_PROFILE
|
||||||
int profiling = do_profiling == PROF_YES && ufunc->uf_profiling;
|
int profiling = do_profiling == PROF_YES && ufunc->uf_profiling;
|
||||||
|
#else
|
||||||
|
# define profiling FALSE
|
||||||
|
#endif
|
||||||
|
|
||||||
if (func_needs_compiling(ufunc, profiling)
|
if (func_needs_compiling(ufunc, profiling)
|
||||||
&& compile_def_function(ufunc, FALSE, profiling, NULL) == FAIL)
|
&& compile_def_function(ufunc, FALSE, profiling, NULL) == FAIL)
|
||||||
@ -1131,7 +1135,11 @@ call_def_function(
|
|||||||
int save_did_emsg_def = did_emsg_def;
|
int save_did_emsg_def = did_emsg_def;
|
||||||
int trylevel_at_start = trylevel;
|
int trylevel_at_start = trylevel;
|
||||||
int orig_funcdepth;
|
int orig_funcdepth;
|
||||||
|
#ifdef FEAT_PROFILE
|
||||||
int profiling = do_profiling == PROF_YES && ufunc->uf_profiling;
|
int profiling = do_profiling == PROF_YES && ufunc->uf_profiling;
|
||||||
|
#else
|
||||||
|
# define profiling FALSE
|
||||||
|
#endif
|
||||||
|
|
||||||
// Get pointer to item in the stack.
|
// Get pointer to item in the stack.
|
||||||
#define STACK_TV(idx) (((typval_T *)ectx.ec_stack.ga_data) + idx)
|
#define STACK_TV(idx) (((typval_T *)ectx.ec_stack.ga_data) + idx)
|
||||||
@ -1158,7 +1166,11 @@ call_def_function(
|
|||||||
// Check the function was really compiled.
|
// Check the function was really compiled.
|
||||||
dfunc_T *dfunc = ((dfunc_T *)def_functions.ga_data)
|
dfunc_T *dfunc = ((dfunc_T *)def_functions.ga_data)
|
||||||
+ ufunc->uf_dfunc_idx;
|
+ ufunc->uf_dfunc_idx;
|
||||||
if ((profiling ? dfunc->df_instr_prof : dfunc->df_instr) == NULL)
|
if ((
|
||||||
|
#ifdef FEAT_PROFILE
|
||||||
|
profiling ? dfunc->df_instr_prof :
|
||||||
|
#endif
|
||||||
|
dfunc->df_instr) == NULL)
|
||||||
{
|
{
|
||||||
iemsg("using call_def_function() on not compiled function");
|
iemsg("using call_def_function() on not compiled function");
|
||||||
return FAIL;
|
return FAIL;
|
||||||
@ -1297,7 +1309,11 @@ call_def_function(
|
|||||||
++ectx.ec_stack.ga_len;
|
++ectx.ec_stack.ga_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef FEAT_PROFILE
|
||||||
ectx.ec_instr = profiling ? dfunc->df_instr_prof : dfunc->df_instr;
|
ectx.ec_instr = profiling ? dfunc->df_instr_prof : dfunc->df_instr;
|
||||||
|
#else
|
||||||
|
ectx.ec_instr = dfunc->df_instr;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Following errors are in the function, not the caller.
|
// Following errors are in the function, not the caller.
|
||||||
@ -3501,6 +3517,7 @@ call_def_function(
|
|||||||
case ISN_PROF_START:
|
case ISN_PROF_START:
|
||||||
case ISN_PROF_END:
|
case ISN_PROF_END:
|
||||||
{
|
{
|
||||||
|
#ifdef FEAT_PROFILE
|
||||||
funccall_T cookie;
|
funccall_T cookie;
|
||||||
ufunc_T *cur_ufunc =
|
ufunc_T *cur_ufunc =
|
||||||
(((dfunc_T *)def_functions.ga_data)
|
(((dfunc_T *)def_functions.ga_data)
|
||||||
@ -3515,6 +3532,7 @@ call_def_function(
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
func_line_end(&cookie);
|
func_line_end(&cookie);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -3715,9 +3733,14 @@ ex_disassemble(exarg_T *eap)
|
|||||||
msg((char *)ufunc->uf_name);
|
msg((char *)ufunc->uf_name);
|
||||||
|
|
||||||
dfunc = ((dfunc_T *)def_functions.ga_data) + ufunc->uf_dfunc_idx;
|
dfunc = ((dfunc_T *)def_functions.ga_data) + ufunc->uf_dfunc_idx;
|
||||||
|
#ifdef FEAT_PROFILE
|
||||||
instr = eap->forceit ? dfunc->df_instr_prof : dfunc->df_instr;
|
instr = eap->forceit ? dfunc->df_instr_prof : dfunc->df_instr;
|
||||||
instr_count = eap->forceit ? dfunc->df_instr_prof_count
|
instr_count = eap->forceit ? dfunc->df_instr_prof_count
|
||||||
: dfunc->df_instr_count;
|
: dfunc->df_instr_count;
|
||||||
|
#else
|
||||||
|
instr = dfunc->df_instr;
|
||||||
|
instr_count = dfunc->df_instr_count;
|
||||||
|
#endif
|
||||||
for (current = 0; current < instr_count; ++current)
|
for (current = 0; current < instr_count; ++current)
|
||||||
{
|
{
|
||||||
isn_T *iptr = &instr[current];
|
isn_T *iptr = &instr[current];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user