From 33bab281e27cf866e77fb3bba6e37f5a5edfef03 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Sun, 23 Aug 2026 22:08:16 +0200 Subject: Revert "optimize main state machine transitions with tail calls" For yet unknown reasons this does not improve performance on GCC 16 even though it also supports `__attribute__((musttail))`. As long as I do not understand why, I don't want to risk any unnecessary problems. I have reason to believe that the tail-call optimized version still has subtle bugs. See also the "tail-calls" branch. This reverts commit 2e097cec409182c3cb39b74489387480bf8a278f. --- src/parser.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'src/parser.c') diff --git a/src/parser.c b/src/parser.c index 8ec051e..8b02764 100644 --- a/src/parser.c +++ b/src/parser.c @@ -104,9 +104,6 @@ teco_machine_main_step(teco_machine_main_t *ctx, const gchar *macro, gsize stop_ { gsize last_pc = 0; - ctx->macro = macro; - ctx->stop_pos = stop_pos; - while (ctx->macro_pc < stop_pos) { last_pc = ctx->macro_pc; @@ -1094,7 +1091,7 @@ teco_state_expectstring_input(teco_machine_main_t *ctx, gunichar chr, GError **e * as allowing whitespace escape_chars is harmful. */ if (ctx->flags.modifier_at && teco_is_noop(chr)) - TECO_RETURN(ctx, current, error); + return current; /* * String termination handling @@ -1109,7 +1106,7 @@ teco_state_expectstring_input(teco_machine_main_t *ctx, gunichar chr, GError **e if (ctx->parent.must_undo) teco_undo_gunichar(ctx->expectstring.machine.escape_char); ctx->expectstring.machine.escape_char = g_unichar_toupper(chr); - TECO_RETURN(ctx, current, error); + return current; } /* @@ -1180,7 +1177,7 @@ teco_state_expectstring_input(teco_machine_main_t *ctx, gunichar chr, GError **e if (ctx->parent.must_undo) teco_undo_gsize(ctx->expectstring.insert_len); ctx->expectstring.insert_len = 0; - TECO_RETURN(ctx, next, error); + return next; } /* @@ -1216,7 +1213,7 @@ teco_state_expectstring_input(teco_machine_main_t *ctx, gunichar chr, GError **e teco_undo_gsize(ctx->expectstring.insert_len); ctx->expectstring.insert_len += ctx->expectstring.string.len - old_len; - TECO_RETURN(ctx, current, error); + return current; } gboolean -- cgit v1.2.3