diff --git a/src/terminal/Parser.zig b/src/terminal/Parser.zig index 61ac4e312..05cbe7957 100644 --- a/src/terminal/Parser.zig +++ b/src/terminal/Parser.zig @@ -254,7 +254,7 @@ pub fn deinit(self: *Parser) void { /// Next consumes the next character c and returns the actions to execute. /// Up to 3 actions may need to be executed -- in order -- representing /// the state exit, transition, and entry actions. -pub inline fn next(self: *Parser, c: u8) [3]?Action { +pub fn next(self: *Parser, c: u8) [3]?Action { const effect = table[c][@intFromEnum(self.state)]; // log.info("next: {x}", .{c}); diff --git a/src/terminal/stream.zig b/src/terminal/stream.zig index 539807b44..db43aae47 100644 --- a/src/terminal/stream.zig +++ b/src/terminal/stream.zig @@ -278,7 +278,14 @@ pub fn Stream(comptime Handler: type) type { return; } - const actions = self.parser.next(c); + // We explicitly inline this call here for performance reasons. + // + // We do this rather than mark Parser.next as inline because doing + // that causes weird behavior in some tests- I'm not sure if they + // miscompile or it's just very counter-intuitive comptime stuff, + // but regardless, this is the easy solution. + const actions = @call(.always_inline, Parser.next, .{ &self.parser, c }); + for (actions) |action_opt| { const action = action_opt orelse continue; if (comptime debug) log.info("action: {}", .{action});