bjorn3 opened PR #2249 from module_rework to main:
The old design has a
Modulestruct that wraps around aBackendimplementation. Because theBackendis not exposed it is not possible to export extra methods to do things like deallocating specific functions or adding new predefined imports for the jit. It is also not possible to customise the behavior of existing methods to for example allow replacing an already defined function for hot code swapping. It was also not possible to create a module with a non-static lifetime (required for headcrab-inject) In the new designModuleis instead a trait withModuleDeclarationsbeing a struct for some shared behavior regarding how declarations are handled. As theModuleis fully exposed, it is possible to add new methlds to the api of every module and customize the behavior of existing methods. None of the previously mentioned use cases are implemented yet. I will leave that for a future PR.Also fixes #1691
pchickey requested pchickey for a review on PR #2249.
sunfishcode submitted PR Review.
sunfishcode created PR Review Comment:
Please document whether this is in bytes or in log2(bytes).
sunfishcode edited PR Review Comment.
bjorn3 updated PR #2249 from module_rework to main:
The old design has a
Modulestruct that wraps around aBackendimplementation. Because theBackendis not exposed it is not possible to export extra methods to do things like deallocating specific functions or adding new predefined imports for the jit. It is also not possible to customise the behavior of existing methods to for example allow replacing an already defined function for hot code swapping. It was also not possible to create a module with a non-static lifetime (required for headcrab-inject) In the new designModuleis instead a trait withModuleDeclarationsbeing a struct for some shared behavior regarding how declarations are handled. As theModuleis fully exposed, it is possible to add new methlds to the api of every module and customize the behavior of existing methods. None of the previously mentioned use cases are implemented yet. I will leave that for a future PR.Also fixes #1691
bjorn3 submitted PR Review.
bjorn3 created PR Review Comment:
Done
bjorn3 updated PR #2249 from module_rework to main:
The old design has a
Modulestruct that wraps around aBackendimplementation. Because theBackendis not exposed it is not possible to export extra methods to do things like deallocating specific functions or adding new predefined imports for the jit. It is also not possible to customise the behavior of existing methods to for example allow replacing an already defined function for hot code swapping. It was also not possible to create a module with a non-static lifetime (required for headcrab-inject) In the new designModuleis instead a trait withModuleDeclarationsbeing a struct for some shared behavior regarding how declarations are handled. As theModuleis fully exposed, it is possible to add new methlds to the api of every module and customize the behavior of existing methods. None of the previously mentioned use cases are implemented yet. I will leave that for a future PR.Also fixes #1691
pchickey submitted PR Review.
pchickey merged PR #2249.
Last updated: Dec 06 2025 at 06:05 UTC