Mike Gerwitz

Activist for User Freedom

diff options
authorMike Gerwitz <gerwitzm@lovullo.com>2017-07-12 15:21:43 -0400
committerMike Gerwitz <gerwitzm@lovullo.com>2017-07-12 15:58:37 -0400
commit2af0daceb320b59d13e312c6c9b65ae04e7a615b (patch)
tree4d7681fb1a0cea1a5bfa0c76dfbf9a0b7d5a71ec /src/current/include/preproc/symtable.xsl
parent52c1bb5ebe732582606116342730e76aaaba0c55 (diff)
Remove @keep support from linker
And everything else. This is a big (important) change; it addresses one of the greatest pains of the system. Keeps were added during the DSL rewrite (to support symbols and such) to work around the issue that there was no symbol-driven map; it allowed symbols to persist disjoint from the `__yield' dependency graph so that they could be mapped back and used by external systems. The problem with that is that it's both messy (coupling the concept of external dependencies with the actual code) and difficult to work with. It had a huge performance impact on the linker for two reasons: - Checking whether a package had already been seen and importing the keeps on first visit was expensive because of tree searching and manipulation; and - _every_ keep was imported and processed by the linker, even if it wouldn't end up being used by a particular program. The later especially had huge performance impacts on the entire system. The entire dependency graph is now map-driven, with the exception of the implicit `__yield' (which will eventually be moved into the map as well and the magic `lv:yield' removed in favor of a template). Performance-wise: our largest program ("dwelling") has many thousands of symbols and the largest package imported the majority of them, many of them unneeded, as the result of @keep subgraphs. Compilation of the largest package within that (for the UI) took about a minute and a half and ate up ~6GiB of RAM, for what really is a trivial task of resolving externs, some basic symbol processing, a topological sort, and ordering code fragments. After this change, it takes ~15s and less than 2GiB of RAM. Still a lot---and more improvements can be made---but much, much better. @keep and friends was left in rater.xsd so that nothing breaks while code is cleaned up; it'll be removed in the future. * src/current/compiler/linker.xsl: Remove @keep support. * src/current/dot/attr-keep.xsl: Remove now-unneeded template. * src/current/dot/defnode.xsl: Remove @keep and related. * src/current/include/preproc/eligclass.xsl: Remove @keep and related. * src/current/include/preproc/expand.xsl: Remove @keep and related. * src/current/include/preproc/macros.xsl: Remove @keep and related. * src/current/include/preproc/symtable.xsl: Remove @keep and related. * src/current/rater.xsd: Add TODO to remove @keep and friends.
Diffstat (limited to 'src/current/include/preproc/symtable.xsl')
1 files changed, 5 insertions, 24 deletions
diff --git a/src/current/include/preproc/symtable.xsl b/src/current/include/preproc/symtable.xsl
index e9a7c61..432c3ab 100644
--- a/src/current/include/preproc/symtable.xsl
+++ b/src/current/include/preproc/symtable.xsl
@@ -517,7 +517,6 @@
<xsl:param name="orig-root" />
<xsl:param name="package" select="@package" />
<xsl:param name="export" select="@export" />
- <xsl:param name="ignore-keep" select="@ignore-keep" />
<xsl:param name="no-extclass" select="@no-extclass" />
<xsl:param name="keep-classes" select="@keep-classes" />
@@ -593,7 +592,7 @@
<xsl:when test="@pollute='true'
and @local='true'
and not( @extern='true' )">
- <xsl:sequence select="@name, @src, @pollute, @keep, @parent, @extclass" />
+ <xsl:sequence select="@name, @src, @pollute, @parent, @extclass" />
<!-- copy all the symbol information -->
@@ -633,23 +632,6 @@
- <!-- keep manipulation: *always* keep classes if requested, even if
- @ignore-keep is provided; in the case of the latter, unsets @keep -->
- <xsl:choose>
- <!-- keep classes when requested -->
- <xsl:when test="
- ( @type = 'class' or @type = 'cgen' )
- and $keep-classes = 'true'">
- <xsl:attribute name="keep" select="'false'" />
- </xsl:when>
- <!-- demolish @keep if requested -->
- <xsl:when test="$ignore-keep = 'true'">
- <xsl:attribute name="keep" select="'false'" />
- </xsl:when>
- </xsl:choose>
<!-- children should always be copied, unless poluting -->
<xsl:if test="not( @pollute='true' and @local='true' )">
<xsl:sequence select="preproc:*" />
@@ -663,7 +645,7 @@
<xsl:variable name="external" select="boolean( @external='true' )" />
<preproc:sym name="{@yields}" type="rate"
- extclass="{$external}" keep="{boolean( @keep )}"
+ extclass="{$external}"
local="{@local}" dtype="float" dim="0" tex="{@sym}" />
<xsl:apply-templates mode="preproc:symtable" />
@@ -706,7 +688,7 @@
<xsl:template match="c:*[ @generates ]" mode="preproc:symtable" priority="5">
<xsl:variable name="parent" select="ancestor::lv:rate" />
- <preproc:sym name="{@generates}" keep="{boolean( $parent/@keep )}"
+ <preproc:sym name="{@generates}"
type="gen" dtype="float" dim="1" desc="{@desc}" tex="{@sym}" />
@@ -718,10 +700,9 @@
<xsl:template match="lv:classify" mode="preproc:symtable" priority="5">
<xsl:variable name="external" select="boolean( @external='true' )" />
<xsl:variable name="terminate" select="boolean( @terminate='true' )" />
- <xsl:variable name="keep" select="boolean( @keep='true' )" />
<preproc:sym name=":class:{@as}"
- extclass="{$external}" terminate="{$terminate}" keep="{$keep}"
+ extclass="{$external}" terminate="{$terminate}"
type="class" dim="?" desc="{@desc}" yields="{@yields}"
@@ -733,7 +714,7 @@
to avoid scanning separate object files for such common information)
<xsl:if test="@yields">
- <preproc:sym name="{@yields}" keep="{$keep}"
+ <preproc:sym name="{@yields}"
extclass="{$external}" terminate="{$terminate}"
type="cgen" dtype="boolean" dim="?" desc="{@desc}">