Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMike Gerwitz <mike.gerwitz@rtspecialty.com>2018-03-28 14:22:57 -0400
committerMike Gerwitz <mike.gerwitz@rtspecialty.com>2018-03-28 14:22:57 -0400
commit189751d5cc457f457bce86a368483779a9b09fff (patch)
treedbbadbd84b132de35da9ca878700b921dcd37717 /src
parent852c42e3407f764fd10673f9ad0520e1db3f4b92 (diff)
downloadtame-189751d5cc457f457bce86a368483779a9b09fff.tar.gz
tame-189751d5cc457f457bce86a368483779a9b09fff.tar.bz2
tame-189751d5cc457f457bce86a368483779a9b09fff.zip
Mark generated symbols as localv2.12.1
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'.
Diffstat (limited to 'src')
-rw-r--r--src/current/include/preproc/symtable.xsl28
-rw-r--r--src/current/include/preproc/template.xsl4
-rw-r--r--src/symtable/symbols.xsl8
3 files changed, 36 insertions, 4 deletions
diff --git a/src/current/include/preproc/symtable.xsl b/src/current/include/preproc/symtable.xsl
index 55a4b04..513424c 100644
--- a/src/current/include/preproc/symtable.xsl
+++ b/src/current/include/preproc/symtable.xsl
@@ -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>
diff --git a/src/current/include/preproc/template.xsl b/src/current/include/preproc/template.xsl
index 6787096..a7cd137 100644
--- a/src/current/include/preproc/template.xsl
+++ b/src/current/include/preproc/template.xsl
@@ -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>
diff --git a/src/symtable/symbols.xsl b/src/symtable/symbols.xsl
index e5ecfb5..b9dd089 100644
--- a/src/symtable/symbols.xsl
+++ b/src/symtable/symbols.xsl
@@ -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>