-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inline storage for instance fields and frame locals #44
base: master
Are you sure you want to change the base?
Conversation
feat: more trait impls for `Gc<T>`
Here are the benchmark results for AST interpreter
|
Here are the benchmark results for AST interpreter
Bytecode interpreter
|
Current results on our machines: https://rebench.stefan-marr.de/som-rs/compare/aa52b413ea453d496882546092419c839d56633f..a596c147c4b629fa1feaa89be2767744fb34e134 Assuming I didn't mess up the comparison (I don't think I did), it's a big slowdown - though not on FieldLoop for some reason? |
Currently (before this PR), in the bytecode interpreter, instance fields and frame locals are stored within vectors (as
Vec<Value>
).This means that to reach them, one needs to first dereference two pointers.
In the example of a class instance (stored as
SOMRef<Instance>
), one needs to:Due to the vector being a separate allocation, it is very likely that this causes cache misses, slowing down the program.
This PR uses raw pointer arithmetic, a bit of
unsafe
, and coordination with the GC to allocate additional space right besides the class instance (or stack frame) to store the fields (or locals) into, rather than into a separate vector, and uses pointer offsets to implement accesses, hopefully improving locality and therefore improving cache hit rates.Depends on #33.