-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CogVM source as per VMMaker.oscog-eem.3444
StackInterpreter: Move the fast primitive log support up to StackInterpreter as a compile-time option via the conditional define of LOGPRIMITIVES. Slang: Rewrite the Slang transpiler's parse tree and inliner. The original TParseNode/TMethod hierarchy did modifications by scanning the tree for nodes to be changed, entering the modification for the node into a dictionary from existing to replacement node, and then copying the entire tree, substituting replacements during the copy. This had a certain simplicity but had two major downsides a) the search for likely nodes was top-down and largely context-free, focussed on inlining blind-folded as to a node's context b) the system spent nearly all its time reclaiming old trees as most modifications required a tree rewrite The rewrite is to grace all TParseNodes with a parent inst var referencing the node immediately above in the tree, with a TMethod at the top. This has two major advantages: a) inlining decisions can always be made in context by directly asking the parent and ancestors for context. Hence nodes can now easily find whether they're used for effect or value, what their statement level node is, etc. b) modification can be done in place via aNode parent replaceChild: childNode with: replacementNode The resulting framework is much easier to understand and much faster. The inlining strategy has been changed. Before, the attempt to inline expressions and statements was freely intermixed. Now, each TMethod starts off in the expressions inlining phase. Only when no more inlinable expressions remain does it progress to the statements inlining phase, in which it will prefer inlining statements over expressions, but still inline expressions where possible. Finally when no more inlinable expressions or statements remain it progresses to the inlineMustInline phase, where it will inline against its better judgement if the inlinee demands inlining (<inline: #always>). The completeness check may regress to an earlier phase if the inlining of something resulted in inlinable candidates managed in a previous phase. This strategy appears to be significantly better, resulting in less variables and less labels generated in the generated code. More transformations are done before source generation, so now value expansions of literal blocks are done on the parse tree rather than in the emitCCodeOn:level:generator: methods.
- Loading branch information
1 parent
1af9a9b
commit 0d7eba4
Showing
162 changed files
with
694,721 additions
and
813,199 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
Oops, something went wrong.