Basically the idea of the state machine is to avoid needing to allocate any memory for common headers. If the parser can match a well known header (such as Host for instance) it will return a constant, rather than allocating a new string.

You can't actually give the corresponding Java, as it uses goto which is not part of the language, but basically there are three states:

- Multiple possible headers can match.This state basically has a big switch statement, that looks at the next character and determines which state is next. 
- Only one header can match. After the first fre characters have been matched you are generally only left with one option, in this state it just compares the request bytes to the rest of the header, and if they match it will return the constant value.
- No match. In this state it just stores the header in a buffer and returns a new HttpString

Stuart

On Sat, 30 May 2020 at 03:05, shallowinggg- <shallowinggg@icloud.com> wrote:
Hello, guys. I’m learning knowledge about module parser-generator these days, and very interested in state machine generator. I want to know how is the byte code structure designed, can you give me some help?
_______________________________________________
undertow-dev mailing list
undertow-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/undertow-dev