bytecodealliance / wasmtime

A fast and secure runtime for WebAssembly
https://wasmtime.dev/
Apache License 2.0
14.82k stars 1.23k forks source link

Const-propagate some offsets in `VMOffsets` #8806

Closed alexcrichton closed 2 weeks ago

alexcrichton commented 2 weeks ago

Before this commit all offsets to all fields in VMOffsets were stored as fields within VMOffset itself. All of the fields at the start of VMOffsets, however, are statically known given the pointer size. Notably this means that the use of HostPtr in the runtime still was forcing a dynamic lookup of these static offsets.

This commit refactors this to reflect all static offsets based solely on the pointer size in the PtrSize trait, removing all the fields from VMOffsets. All the dynamically sized fields, however, remain in VMOffsets.