aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/parser.c
diff options
context:
space:
mode:
authorRobin Haberkorn <rhaberkorn@fmsbw.de>2026-08-23 22:08:16 +0200
committerRobin Haberkorn <rhaberkorn@fmsbw.de>2026-08-23 22:08:16 +0200
commit33bab281e27cf866e77fb3bba6e37f5a5edfef03 (patch)
tree8332298257ccabe511efbc6deeec0de25672fe10 /src/parser.c
parent6aa97a68a85b83267de597bfb30b70c04b7de97b (diff)
Revert "optimize main state machine transitions with tail calls"HEADmaster-fmsbw-cimaster
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.
Diffstat (limited to 'src/parser.c')
-rw-r--r--src/parser.c11
1 files changed, 4 insertions, 7 deletions
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