You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We will soon need to introduce character set like [a-zA-Z] and \w or even [\w\d\s] so there might be a new variant Inst::Char(CharKind::Charset(...)) which will definitely bloat the size of struct Inst.
The size of this struct should be kept as small as possible to reduce the overall memory consumption for the compiled program. So it may be helpful to have a CharKind::Charset(Box<HashSet<char>>) instead of CharKind::Charset(HashSet<char>).
Also, we can compile to bytecode so that each Inst variant takes 2 bytes. A trick could be played on the Split instructions. Since we're using i32 to represent an instruction address, the valid range is 0x00000000 - 0x7fffffff. So we can use the sign bit to record whether the next instruction is preferred. In this way we only need to record one Iaddr on a Split. Also 2 bytes is enough for holding a Box<HashSet<char>>.
The text was updated successfully, but these errors were encountered:
We will soon need to introduce character set like
[a-zA-Z]
and\w
or even[\w\d\s]
so there might be a new variantInst::Char(CharKind::Charset(...))
which will definitely bloat the size ofstruct Inst
.The size of this struct should be kept as small as possible to reduce the overall memory consumption for the compiled program. So it may be helpful to have a
CharKind::Charset(Box<HashSet<char>>)
instead ofCharKind::Charset(HashSet<char>)
.Also, we can compile to bytecode so that each
Inst
variant takes 2 bytes. A trick could be played on theSplit
instructions. Since we're usingi32
to represent an instruction address, the valid range is0x00000000 - 0x7fffffff
. So we can use the sign bit to record whether the next instruction is preferred. In this way we only need to record oneIaddr
on aSplit
. Also 2 bytes is enough for holding aBox<HashSet<char>>
.The text was updated successfully, but these errors were encountered: