about summary refs log tree commit diff
path: root/users/tazjin/rlox/src/bytecode/interner (follow)
AgeCommit message (Collapse)AuthorFilesLines
2021-03-06 r/2273 feat(tazjin/rlox): Implement global variable definitionVincent Ambo1-1/+1
identifier_str might look a bit overengineered, but we want to reuse this bit of code and it needs a reference to the token from which to pick the identifier. The problem with this is that the token would be owned by self, but the function needs to mutate (the interner), so this implementation is the most straightforward way of acquiring and working with an immutable reference to the token before interning the identifier. Change-Id: I618ce8f789cb59b3a9c5b79a13111ea6d00b2424 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2592 Reviewed-by: tazjin <mail@tazj.in> Tested-by: BuildkiteCI
2021-03-01 r/2259 feat(tazjin/rlox): Add a simple string internerVincent Ambo2-0/+111
This is based on this matklad post: https://matklad.github.io/2020/03/22/fast-simple-rust-interner.html It's modified slightly to provide a safer interface and slightly more readable implementation: * interned string IDs are wrapped in a newtype that is not publicly constructible * unsafe block is reduced to only the small scope in which it is needed * lookup lifetime is pinned explicitly to make the intent clearer when reading this code Change-Id: Ia3dae988f33f8e5e7d8dc0c1a9216914a945b036 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2578 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in>