summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-08-02 19:10:38 +0200
committerBram Moolenaar <Bram@vim.org>2021-08-02 19:10:38 +0200
commit35578168becd1e11973bec413f2078a4bf81ba6b (patch)
tree1eb46d3b958d66b12f83f6e8c583adc33d95a74f
parent952d9d827e5bfc66a6b1d39956e4e5596b09e2bd (diff)
downloadvim-git-35578168becd1e11973bec413f2078a4bf81ba6b.tar.gz
patch 8.2.3275: optimizer can use hints about ga_grow() normally succeedingv8.2.3275
Problem: Optimizer can use hints about ga_grow() normally succeeding. Solution: Use GA_GROW_FAILS() and GA_GROW_OK() in several places. (Dominique Pellé, issue #8635)
-rw-r--r--src/arglist.c6
-rw-r--r--src/macros.h6
-rw-r--r--src/version.c2
-rw-r--r--src/vim9compile.c42
-rw-r--r--src/vim9execute.c69
5 files changed, 64 insertions, 61 deletions
diff --git a/src/arglist.c b/src/arglist.c
index 5370142a7..244dd0678 100644
--- a/src/arglist.c
+++ b/src/arglist.c
@@ -148,7 +148,7 @@ alist_set(
return;
alist_clear(al);
- if (ga_grow(&al->al_ga, count) == OK)
+ if (GA_GROW_OK(&al->al_ga, count))
{
for (i = 0; i < count; ++i)
{
@@ -355,7 +355,7 @@ alist_add_list(
int old_argcount = ARGCOUNT;
if (check_arglist_locked() != FAIL
- && ga_grow(&ALIST(curwin)->al_ga, count) == OK)
+ && GA_GROW_OK(&ALIST(curwin)->al_ga, count))
{
if (after < 0)
after = 0;
@@ -599,7 +599,7 @@ ex_args(exarg_T *eap)
garray_T *gap = &curwin->w_alist->al_ga;
// ":argslocal": make a local copy of the global argument list.
- if (ga_grow(gap, GARGCOUNT) == OK)
+ if (GA_GROW_OK(gap, GARGCOUNT))
for (i = 0; i < GARGCOUNT; ++i)
if (GARGLIST[i].ae_fname != NULL)
{
diff --git a/src/macros.h b/src/macros.h
index 4ca24c0f5..ae7ed1a7a 100644
--- a/src/macros.h
+++ b/src/macros.h
@@ -387,8 +387,10 @@
// Inline the condition for performance.
#define CHECK_LIST_MATERIALIZE(l) if ((l)->lv_first == &range_list_item) range_list_materialize(l)
-// Inlined version of ga_grow(). Especially useful if "n" is a constant.
-#define GA_GROW(gap, n) (((gap)->ga_maxlen - (gap)->ga_len < n) ? ga_grow_inner((gap), (n)) : OK)
+// Inlined version of ga_grow() with optimized condition that it fails.
+#define GA_GROW_FAILS(gap, n) unlikely((((gap)->ga_maxlen - (gap)->ga_len < n) ? ga_grow_inner((gap), (n)) : OK) == FAIL)
+// Inlined version of ga_grow() with optimized condition that it succeeds.
+#define GA_GROW_OK(gap, n) likely((((gap)->ga_maxlen - (gap)->ga_len < n) ? ga_grow_inner((gap), (n)) : OK) == OK)
#ifndef MIN
# define MIN(a, b) ((a) < (b) ? (a) : (b))
diff --git a/src/version.c b/src/version.c
index 34e4ceb49..fae2fd63c 100644
--- a/src/version.c
+++ b/src/version.c
@@ -756,6 +756,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 3275,
+/**/
3274,
/**/
3273,
diff --git a/src/vim9compile.c b/src/vim9compile.c
index 8e7be28f7..15e6e63a8 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -548,7 +548,7 @@ generate_instr(cctx_T *cctx, isntype_T isn_type)
isn_T *isn;
RETURN_NULL_IF_SKIP(cctx);
- if (ga_grow(instr, 1) == FAIL)
+ if (GA_GROW_FAILS(instr, 1))
return NULL;
isn = ((isn_T *)instr->ga_data) + instr->ga_len;
isn->isn_type = isn_type;
@@ -585,7 +585,7 @@ generate_instr_type(cctx_T *cctx, isntype_T isn_type, type_T *type)
if ((isn = generate_instr(cctx, isn_type)) == NULL)
return NULL;
- if (ga_grow(stack, 1) == FAIL)
+ if (GA_GROW_FAILS(stack, 1))
return NULL;
((type_T **)stack->ga_data)[stack->ga_len] = type == NULL ? &t_any : type;
++stack->ga_len;
@@ -1288,7 +1288,7 @@ generate_GETITEM(cctx_T *cctx, int index, int with_op)
isn->isn_arg.getitem.gi_with_op = with_op;
// add the item type to the type stack
- if (ga_grow(stack, 1) == FAIL)
+ if (GA_GROW_FAILS(stack, 1))
return FAIL;
((type_T **)stack->ga_data)[stack->ga_len] = item_type;
++stack->ga_len;
@@ -1590,7 +1590,7 @@ generate_NEWLIST(cctx_T *cctx, int count)
stack->ga_len -= count;
// add the list type to the type stack
- if (ga_grow(stack, 1) == FAIL)
+ if (GA_GROW_FAILS(stack, 1))
return FAIL;
((type_T **)stack->ga_data)[stack->ga_len] = type;
++stack->ga_len;
@@ -1626,7 +1626,7 @@ generate_NEWDICT(cctx_T *cctx, int count)
stack->ga_len -= 2 * count;
// add the dict type to the type stack
- if (ga_grow(stack, 1) == FAIL)
+ if (GA_GROW_FAILS(stack, 1))
return FAIL;
((type_T **)stack->ga_data)[stack->ga_len] = type;
++stack->ga_len;
@@ -1654,7 +1654,7 @@ generate_FUNCREF(cctx_T *cctx, ufunc_T *ufunc)
if (ufunc->uf_flags & FC_CLOSURE)
cctx->ctx_ufunc->uf_flags |= FC_CLOSURE;
- if (ga_grow(stack, 1) == FAIL)
+ if (GA_GROW_FAILS(stack, 1))
return FAIL;
((type_T **)stack->ga_data)[stack->ga_len] =
ufunc->uf_func_type == NULL ? &t_func_any : ufunc->uf_func_type;
@@ -1759,7 +1759,7 @@ generate_FOR(cctx_T *cctx, int loop_idx)
return FAIL;
isn->isn_arg.forloop.for_idx = loop_idx;
- if (ga_grow(stack, 1) == FAIL)
+ if (GA_GROW_FAILS(stack, 1))
return FAIL;
// type doesn't matter, will be stored next
((type_T **)stack->ga_data)[stack->ga_len] = &t_any;
@@ -1841,7 +1841,7 @@ generate_BCALL(cctx_T *cctx, int func_idx, int argcount, int method_call)
// Drop the argument types and push the return type.
stack->ga_len -= argcount;
- if (ga_grow(stack, 1) == FAIL)
+ if (GA_GROW_FAILS(stack, 1))
return FAIL;
((type_T **)stack->ga_data)[stack->ga_len] =
internal_func_ret_type(func_idx, argcount, argtypes);
@@ -2031,7 +2031,7 @@ generate_CALL(cctx_T *cctx, ufunc_T *ufunc, int pushed_argcount)
}
stack->ga_len -= argcount; // drop the arguments
- if (ga_grow(stack, 1) == FAIL)
+ if (GA_GROW_FAILS(stack, 1))
return FAIL;
// add return value
((type_T **)stack->ga_data)[stack->ga_len] = ufunc->uf_ret_type;
@@ -2056,7 +2056,7 @@ generate_UCALL(cctx_T *cctx, char_u *name, int argcount)
isn->isn_arg.ufunc.cuf_argcount = argcount;
stack->ga_len -= argcount; // drop the arguments
- if (ga_grow(stack, 1) == FAIL)
+ if (GA_GROW_FAILS(stack, 1))
return FAIL;
// add return value
((type_T **)stack->ga_data)[stack->ga_len] = &t_any;
@@ -2265,7 +2265,7 @@ generate_LEGACY_EVAL(cctx_T *cctx, char_u *line)
return FAIL;
isn->isn_arg.string = vim_strsave(line);
- if (ga_grow(stack, 1) == FAIL)
+ if (GA_GROW_FAILS(stack, 1))
return FAIL;
((type_T **)stack->ga_data)[stack->ga_len] = &t_any;
++stack->ga_len;
@@ -2297,7 +2297,7 @@ generate_RANGE(cctx_T *cctx, char_u *range)
return FAIL;
isn->isn_arg.string = range;
- if (ga_grow(stack, 1) == FAIL)
+ if (GA_GROW_FAILS(stack, 1))
return FAIL;
((type_T **)stack->ga_data)[stack->ga_len] = &t_number;
++stack->ga_len;
@@ -2431,7 +2431,7 @@ reserve_local(
return NULL;
}
- if (ga_grow(&cctx->ctx_locals, 1) == FAIL)
+ if (GA_GROW_FAILS(&cctx->ctx_locals, 1))
return NULL;
lvar = ((lvar_T *)cctx->ctx_locals.ga_data) + cctx->ctx_locals.ga_len++;
CLEAR_POINTER(lvar);
@@ -2448,7 +2448,7 @@ reserve_local(
lvar->lv_type = type;
// Remember the name for debugging.
- if (ga_grow(&dfunc->df_var_names, 1) == FAIL)
+ if (GA_GROW_FAILS(&dfunc->df_var_names, 1))
return NULL;
((char_u **)dfunc->df_var_names.ga_data)[lvar->lv_idx] =
vim_strsave(lvar->lv_name);
@@ -3280,7 +3280,7 @@ compile_string(isn_T *isn, cctx_T *cctx)
trailing_error = *s != NUL;
if (expr_res == FAIL || trailing_error
- || ga_grow(&cctx->ctx_instr, 1) == FAIL)
+ || GA_GROW_FAILS(&cctx->ctx_instr, 1))
{
if (trailing_error)
semsg(_(e_trailing_arg), s);
@@ -7034,7 +7034,7 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
else
{
// variables are always initialized
- if (ga_grow(instr, 1) == FAIL)
+ if (GA_GROW_FAILS(instr, 1))
goto theend;
switch (lhs.lhs_member_type->tt_type)
{
@@ -7653,7 +7653,7 @@ compile_elseif(char_u *arg, cctx_T *cctx)
// Move any CMDMOD instruction to after the jump
if (((isn_T *)instr->ga_data)[instr->ga_len - 1].isn_type == ISN_CMDMOD)
{
- if (ga_grow(instr, 1) == FAIL)
+ if (GA_GROW_FAILS(instr, 1))
return NULL;
((isn_T *)instr->ga_data)[instr->ga_len] =
((isn_T *)instr->ga_data)[instr->ga_len - 1];
@@ -7999,7 +7999,7 @@ compile_for(char_u *arg_start, cctx_T *cctx)
arg = skipwhite(arg + 1); // skip white after '['
// the list item is replaced by a number of items
- if (ga_grow(stack, var_count - 1) == FAIL)
+ if (GA_GROW_FAILS(stack, var_count - 1))
{
drop_scope(cctx);
return NULL;
@@ -9107,7 +9107,7 @@ compile_substitute(char_u *arg, exarg_T *eap, cctx_T *cctx)
trailing_error = *cmd != delimiter && *cmd != NUL;
if (expr_res == FAIL || trailing_error
- || ga_grow(&cctx->ctx_instr, 1) == FAIL)
+ || GA_GROW_FAILS(&cctx->ctx_instr, 1))
{
if (trailing_error)
semsg(_(e_trailing_arg), cmd);
@@ -9267,13 +9267,13 @@ add_def_function(ufunc_T *ufunc)
{
// The first position is not used, so that a zero uf_dfunc_idx means it
// wasn't set.
- if (ga_grow(&def_functions, 1) == FAIL)
+ if (GA_GROW_FAILS(&def_functions, 1))
return FAIL;
++def_functions.ga_len;
}
// Add the function to "def_functions".
- if (ga_grow(&def_functions, 1) == FAIL)
+ if (GA_GROW_FAILS(&def_functions, 1))
return FAIL;
dfunc = ((dfunc_T *)def_functions.ga_data) + def_functions.ga_len;
CLEAR_POINTER(dfunc);
diff --git a/src/vim9execute.c b/src/vim9execute.c
index 11f190c0d..f415d9a24 100644
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -137,7 +137,7 @@ exe_newlist(int count, ectx_T *ectx)
if (count > 0)
ectx->ec_stack.ga_len -= count - 1;
- else if (unlikely(GA_GROW(&ectx->ec_stack, 1) == FAIL))
+ else if (GA_GROW_FAILS(&ectx->ec_stack, 1))
return FAIL;
else
++ectx->ec_stack.ga_len;
@@ -210,7 +210,7 @@ call_dfunc(
#ifdef FEAT_PROFILE
if (do_profiling == PROF_YES)
{
- if (likely(ga_grow(&profile_info_ga, 1) == OK))
+ if (GA_GROW_OK(&profile_info_ga, 1))
{
profinfo_T *info = ((profinfo_T *)profile_info_ga.ga_data)
+ profile_info_ga.ga_len;
@@ -289,8 +289,7 @@ call_dfunc(
// - if needed: a counter for number of closures created in
// ectx->ec_funcrefs.
varcount = dfunc->df_varcount + dfunc->df_has_closure;
- if (unlikely(ga_grow(&ectx->ec_stack, arg_to_add + STACK_FRAME_SIZE
- + varcount) == FAIL))
+ if (GA_GROW_FAILS(&ectx->ec_stack, arg_to_add + STACK_FRAME_SIZE + varcount))
return FAIL;
// If depth of calling is getting too high, don't execute the function.
@@ -703,7 +702,7 @@ call_prepare(int argcount, typval_T *argvars, ectx_T *ectx)
// Result replaces the arguments on the stack.
if (argcount > 0)
ectx->ec_stack.ga_len -= argcount - 1;
- else if (unlikely(GA_GROW(&ectx->ec_stack, 1) == FAIL))
+ else if (GA_GROW_FAILS(&ectx->ec_stack, 1))
return FAIL;
else
++ectx->ec_stack.ga_len;
@@ -941,7 +940,7 @@ call_partial(
{
// Make space for arguments from the partial, shift the "argcount"
// arguments up.
- if (unlikely(ga_grow(&ectx->ec_stack, pt->pt_argc) == FAIL))
+ if (GA_GROW_FAILS(&ectx->ec_stack, pt->pt_argc))
return FAIL;
for (i = 1; i <= argcount; ++i)
*STACK_TV_BOT(-i + pt->pt_argc) = *STACK_TV_BOT(-i);
@@ -1378,7 +1377,7 @@ fill_partial_and_closure(partial_T *pt, ufunc_T *ufunc, ectx_T *ectx)
// If this function returns and the closure is still being used, we
// need to make a copy of the context (arguments and local variables).
// Store a reference to the partial so we can handle that.
- if (unlikely(ga_grow(&ectx->ec_funcrefs, 1) == FAIL))
+ if (GA_GROW_FAILS(&ectx->ec_funcrefs, 1))
{
vim_free(pt);
return FAIL;
@@ -1511,7 +1510,7 @@ handle_debug(isn_T *iptr, ectx_T *ectx)
p = skipwhite(p);
if (*p == '#')
break;
- if (likely(ga_grow(&ga, 1) == OK))
+ if (GA_GROW_OK(&ga, 1))
((char_u **)(ga.ga_data))[ga.ga_len++] = p;
if (STRNCMP(p, "def ", 4) == 0)
break;
@@ -1612,7 +1611,7 @@ exec_instructions(ectx_T *ectx)
{
// Not inside try or need to return from current functions.
// Push a dummy return value.
- if (unlikely(GA_GROW(&ectx->ec_stack, 1) == FAIL))
+ if (GA_GROW_FAILS(&ectx->ec_stack, 1))
goto theend;
tv = STACK_TV_BOT(0);
tv->v_type = VAR_NUMBER;
@@ -1687,7 +1686,7 @@ exec_instructions(ectx_T *ectx)
int res;
int save_flags = cmdmod.cmod_flags;
- if (unlikely(GA_GROW(&ectx->ec_stack, 1) == FAIL))
+ if (GA_GROW_FAILS(&ectx->ec_stack, 1))
goto theend;
tv = STACK_TV_BOT(0);
init_tv(tv);
@@ -1703,7 +1702,7 @@ exec_instructions(ectx_T *ectx)
// push typeval VAR_INSTR with instructions to be executed
case ISN_INSTR:
{
- if (unlikely(GA_GROW(&ectx->ec_stack, 1) == FAIL))
+ if (GA_GROW_FAILS(&ectx->ec_stack, 1))
goto theend;
tv = STACK_TV_BOT(0);
tv->vval.v_instr = ALLOC_ONE(instr_T);
@@ -1768,7 +1767,7 @@ exec_instructions(ectx_T *ectx)
clear_redir_lval();
redir_vname = 0;
- if (unlikely(GA_GROW(&ectx->ec_stack, 1) == FAIL))
+ if (GA_GROW_FAILS(&ectx->ec_stack, 1))
{
vim_free(res);
goto theend;
@@ -1904,7 +1903,7 @@ exec_instructions(ectx_T *ectx)
p = tv_stringify(tv, buf);
len = (int)STRLEN(p);
- if (unlikely(ga_grow(&ga, len + 2) == FAIL))
+ if (GA_GROW_FAILS(&ga, len + 2))
failed = TRUE;
else
{
@@ -1955,7 +1954,7 @@ exec_instructions(ectx_T *ectx)
// load local variable or argument
case ISN_LOAD:
- if (unlikely(GA_GROW(&ectx->ec_stack, 1) == FAIL))
+ if (GA_GROW_FAILS(&ectx->ec_stack, 1))
goto theend;
copy_tv(STACK_TV_VAR(iptr->isn_arg.number), STACK_TV_BOT(0));
++ectx->ec_stack.ga_len;
@@ -1963,7 +1962,7 @@ exec_instructions(ectx_T *ectx)
// load v: variable
case ISN_LOADV:
- if (unlikely(GA_GROW(&ectx->ec_stack, 1) == FAIL))
+ if (GA_GROW_FAILS(&ectx->ec_stack, 1))
goto theend;
copy_tv(get_vim_var_tv(iptr->isn_arg.number), STACK_TV_BOT(0));
++ectx->ec_stack.ga_len;
@@ -1979,7 +1978,7 @@ exec_instructions(ectx_T *ectx)
if (sv == NULL)
goto theend;
allocate_if_null(sv->sv_tv);
- if (unlikely(GA_GROW(&ectx->ec_stack, 1) == FAIL))
+ if (GA_GROW_FAILS(&ectx->ec_stack, 1))
goto theend;
copy_tv(sv->sv_tv, STACK_TV_BOT(0));
++ectx->ec_stack.ga_len;
@@ -2002,7 +2001,7 @@ exec_instructions(ectx_T *ectx)
}
else
{
- if (unlikely(GA_GROW(&ectx->ec_stack, 1) == FAIL))
+ if (GA_GROW_FAILS(&ectx->ec_stack, 1))
goto theend;
copy_tv(&di->di_tv, STACK_TV_BOT(0));
++ectx->ec_stack.ga_len;
@@ -2052,7 +2051,7 @@ exec_instructions(ectx_T *ectx)
}
else
{
- if (unlikely(GA_GROW(&ectx->ec_stack, 1) == FAIL))
+ if (GA_GROW_FAILS(&ectx->ec_stack, 1))
goto theend;
copy_tv(&di->di_tv, STACK_TV_BOT(0));
++ectx->ec_stack.ga_len;
@@ -2065,7 +2064,7 @@ exec_instructions(ectx_T *ectx)
{
char_u *name = iptr->isn_arg.string;
- if (unlikely(GA_GROW(&ectx->ec_stack, 1) == FAIL))
+ if (GA_GROW_FAILS(&ectx->ec_stack, 1))
goto theend;
SOURCING_LNUM = iptr->isn_lnum;
if (eval_variable(name, (int)STRLEN(name),
@@ -2092,7 +2091,7 @@ exec_instructions(ectx_T *ectx)
default: // Cannot reach here
goto theend;
}
- if (unlikely(GA_GROW(&ectx->ec_stack, 1) == FAIL))
+ if (GA_GROW_FAILS(&ectx->ec_stack, 1))
goto theend;
tv = STACK_TV_BOT(0);
tv->v_type = VAR_DICT;
@@ -2111,7 +2110,7 @@ exec_instructions(ectx_T *ectx)
// This is not expected to fail, name is checked during
// compilation: don't set SOURCING_LNUM.
- if (unlikely(GA_GROW(&ectx->ec_stack, 1) == FAIL))
+ if (GA_GROW_FAILS(&ectx->ec_stack, 1))
goto theend;
if (eval_option(&name, &optval, TRUE) == FAIL)
goto theend;
@@ -2126,7 +2125,7 @@ exec_instructions(ectx_T *ectx)
typval_T optval;
char_u *name = iptr->isn_arg.string;
- if (unlikely(GA_GROW(&ectx->ec_stack, 1) == FAIL))
+ if (GA_GROW_FAILS(&ectx->ec_stack, 1))
goto theend;
// name is always valid, checked when compiling
(void)eval_env_var(&name, &optval, TRUE);
@@ -2137,7 +2136,7 @@ exec_instructions(ectx_T *ectx)
// load @register
case ISN_LOADREG:
- if (unlikely(GA_GROW(&ectx->ec_stack, 1) == FAIL))
+ if (GA_GROW_FAILS(&ectx->ec_stack, 1))
goto theend;
tv = STACK_TV_BOT(0);
tv->v_type = VAR_STRING;
@@ -2572,7 +2571,7 @@ exec_instructions(ectx_T *ectx)
+ iptr->isn_arg.outer.outer_idx;
if (iptr->isn_type == ISN_LOADOUTER)
{
- if (unlikely(GA_GROW(&ectx->ec_stack, 1) == FAIL))
+ if (GA_GROW_FAILS(&ectx->ec_stack, 1))
goto theend;
copy_tv(tv, STACK_TV_BOT(0));
++ectx->ec_stack.ga_len;
@@ -2760,7 +2759,7 @@ exec_instructions(ectx_T *ectx)
case ISN_PUSHFUNC:
case ISN_PUSHCHANNEL:
case ISN_PUSHJOB:
- if (unlikely(GA_GROW(&ectx->ec_stack, 1) == FAIL))
+ if (GA_GROW_FAILS(&ectx->ec_stack, 1))
goto theend;
tv = STACK_TV_BOT(0);
tv->v_lock = 0;
@@ -2885,7 +2884,7 @@ exec_instructions(ectx_T *ectx)
if (count > 0)
ectx->ec_stack.ga_len -= 2 * count - 1;
- else if (unlikely(GA_GROW(&ectx->ec_stack, 1) == FAIL))
+ else if (GA_GROW_FAILS(&ectx->ec_stack, 1))
goto theend;
else
++ectx->ec_stack.ga_len;
@@ -2967,7 +2966,7 @@ exec_instructions(ectx_T *ectx)
// return from a :def function call without a value
case ISN_RETURN_VOID:
- if (unlikely(GA_GROW(&ectx->ec_stack, 1) == FAIL))
+ if (GA_GROW_FAILS(&ectx->ec_stack, 1))
goto theend;
tv = STACK_TV_BOT(0);
++ectx->ec_stack.ga_len;
@@ -3009,7 +3008,7 @@ exec_instructions(ectx_T *ectx)
if (pt == NULL)
goto theend;
- if (unlikely(GA_GROW(&ectx->ec_stack, 1) == FAIL))
+ if (GA_GROW_FAILS(&ectx->ec_stack, 1))
{
vim_free(pt);
goto theend;
@@ -3104,7 +3103,7 @@ exec_instructions(ectx_T *ectx)
typval_T *idxtv =
STACK_TV_VAR(iptr->isn_arg.forloop.for_idx);
- if (unlikely(GA_GROW(&ectx->ec_stack, 1) == FAIL))
+ if (GA_GROW_FAILS(&ectx->ec_stack, 1))
goto theend;
if (ltv->v_type == VAR_LIST)
{
@@ -3211,7 +3210,7 @@ exec_instructions(ectx_T *ectx)
{
trycmd_T *trycmd = NULL;
- if (unlikely(GA_GROW(&ectx->ec_trystack, 1) == FAIL))
+ if (GA_GROW_FAILS(&ectx->ec_trystack, 1))
goto theend;
trycmd = ((trycmd_T *)ectx->ec_trystack.ga_data)
+ ectx->ec_trystack.ga_len;
@@ -3236,7 +3235,7 @@ exec_instructions(ectx_T *ectx)
iemsg("Evaluating catch while current_exception is NULL");
goto theend;
}
- if (unlikely(GA_GROW(&ectx->ec_stack, 1) == FAIL))
+ if (GA_GROW_FAILS(&ectx->ec_stack, 1))
goto theend;
tv = STACK_TV_BOT(0);
++ectx->ec_stack.ga_len;
@@ -3895,7 +3894,7 @@ exec_instructions(ectx_T *ectx)
tv = STACK_TV_BOT(-1 - gi->gi_with_op);
li = list_find(tv->vval.v_list, gi->gi_index);
- if (unlikely(GA_GROW(&ectx->ec_stack, 1) == FAIL))
+ if (GA_GROW_FAILS(&ectx->ec_stack, 1))
goto theend;
++ectx->ec_stack.ga_len;
copy_tv(&li->li_tv, STACK_TV_BOT(-1));
@@ -4130,7 +4129,7 @@ exec_instructions(ectx_T *ectx)
if (parse_cmd_address(&ea, &errormsg, FALSE) == FAIL)
goto on_error;
- if (unlikely(GA_GROW(&ectx->ec_stack, 1) == FAIL))
+ if (GA_GROW_FAILS(&ectx->ec_stack, 1))
goto theend;
++ectx->ec_stack.ga_len;
tv = STACK_TV_BOT(-1);
@@ -4232,7 +4231,7 @@ exec_instructions(ectx_T *ectx)
}
CHECK_LIST_MATERIALIZE(l);
- if (unlikely(GA_GROW(&ectx->ec_stack, count - 1) == FAIL))
+ if (GA_GROW_FAILS(&ectx->ec_stack, count - 1))
goto theend;
ectx->ec_stack.ga_len += count - 1;
@@ -4506,7 +4505,7 @@ call_def_function(
CLEAR_FIELD(ectx);
ectx.ec_dfunc_idx = ufunc->uf_dfunc_idx;
ga_init2(&ectx.ec_stack, sizeof(typval_T), 500);
- if (unlikely(ga_grow(&ectx.ec_stack, 20) == FAIL))
+ if (GA_GROW_FAILS(&ectx.ec_stack, 20))
{
funcdepth_decrement();
return FAIL;