-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal: use dedicated context type for
vmbackend
(#835)
## Summary Add and use a dedicated type for the contextual state of the VM code- generation orchestrator. This removes the hard coupling between `vmbackend` and `vmdef.TCtx` and is another preparation for splitting up the latter. ## Details The new `GenCtx` type replaces `TCtx` as the contextual-state type for the orchestrator. For now, `GenCtx` still stores an instance of `TCtx`, as the latter currently contains the code generator state. In preparation for splitting up `TCtx`, usage of its `idgen` and `functions` fields are removed from `vmbackend.nim`. The ID generator is directly passed to procedures that need one, and the function table (`functions`) is now stored in `GenCtx` -- prior to serializing the VM environment, the function table stored with `GenCtx`'s is moved into the `TCtx` instance. With the new dedicated type for the orchestrator, the collected globals don't have to be stored in `TCtx` anymore. The `collectedGlobals` field is made part of `GenCtx` and is renamed to just `globals`. ### Misc - add the `base` template for `OrdinalSeq` and use it to reduce the noise in the `OrdinalSeq` routines - fix the `add` template for `OrdinalSeq`
- Loading branch information
Showing
4 changed files
with
87 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters