Mark generated symbols as local

We need to cut down on symbol imports as much as possible; the whole system
starts dragging if we are importing thousands of symbols into a single
package.

* src/current/include/preproc/symtable.xsl (preproc:symtable)[lv:rate,c:*]: Mark
  as local if `@preproc:generated`.
* src/current/include/preproc/template.xsl (preproc:macros)[lv:inline-template]:
  Mark generated templates as such.
* src/symtable/symbols.xsl (preproc:symtable)[lv:template]: Mark as local if
  `@preproc:generated'.
master v2.12.1
Mike Gerwitz 2018-03-28 14:22:57 -04:00
parent 852c42e340
commit 189751d5cc
3 changed files with 36 additions and 4 deletions

View File

@ -660,7 +660,12 @@
<preproc:sym name="{@yields}" type="rate"
extclass="{$external}"
local="{@local}" dtype="float" dim="0" tex="{@sym}" />
local="{@local}" dtype="float" dim="0" tex="{@sym}">
<xsl:if test="@preproc:generated = 'true'">
<xsl:attribute name="local" select="'true'" />
</xsl:if>
</preproc:sym>
<xsl:apply-templates mode="preproc:symtable" />
</xsl:template>
@ -710,7 +715,12 @@
<preproc:sym name="{@generates}"
parent="{$parent/@yields}"
type="gen" dtype="float" dim="{$dim}" desc="{@desc}" tex="{@sym}" />
type="gen" dtype="float" dim="{$dim}" desc="{@desc}" tex="{@sym}">
<xsl:if test="@preproc:generated = 'true'">
<xsl:attribute name="local" select="'true'" />
</xsl:if>
</preproc:sym>
<xsl:apply-templates mode="preproc:symtable" />
</xsl:template>
@ -721,11 +731,18 @@
<xsl:variable name="external" select="boolean( @external='true' )" />
<xsl:variable name="terminate" select="boolean( @terminate='true' )" />
<xsl:variable name="is-generated" as="xs:boolean"
select="@preproc:generated = 'true'" />
<preproc:sym name=":class:{@as}"
extclass="{$external}" terminate="{$terminate}"
type="class" dim="?" desc="{@desc}" yields="{@yields}"
orig-name="{@as}">
<xsl:if test="$is-generated">
<xsl:attribute name="local" select="'true'" />
</xsl:if>
<!-- copy preprocessor metadata to symbol for easy reference -->
<xsl:sequence select="@preproc:*" />
</preproc:sym>
@ -743,6 +760,13 @@
<xsl:attribute name="preproc:generated" select="'true'" />
</xsl:if>
<!-- we only want to mark as local if $is-generated, not
@preproc:yields-generated, beacuse otherwise class yield lookups
would not always work in packages -->
<xsl:if test="$is-generated">
<xsl:attribute name="local" select="'true'" />
</xsl:if>
<xsl:sequence select="@preproc:*" />
</preproc:sym>
</xsl:if>

View File

@ -421,7 +421,9 @@
</xsl:message>
<!-- generate template -->
<lv:template name="{$name}" desc="Inline template" preproc:from-inline="{$name}">
<lv:template name="{$name}" desc="Inline template"
preproc:from-inline="{$name}"
preproc:generated="true">
<!-- generate params (from both our own attrs and any for-each sets) -->
<xsl:variable name="params">
<params>

View File

@ -381,7 +381,13 @@
<preproc:sym type="tpl"
name="{@name}"
dim="0"
desc="{@desc}" />
desc="{@desc}">
<if test="@preproc:generated = 'true'">
<attribute name="local" select="'true'" />
</if>
<sequence select="@preproc:*" />
</preproc:sym>
</template>