SPIN Code Generator with Text String Optimisation
he1957
Posts: 58
Not sure of some semantics so please allow some leeway here.
I've been examining (in particular) the FemtoBasic source code and wonder why the use of "in-line" ASCII text is used in most "error" message emissions.· WRT the SPIN manual it implies the·reference·to "frequently"·accessed "text" is best coded using access to DAT 'objects' (defined as·ZeroTerminated 'byte array(s)' [noparse][[/noparse]symbols]).
I guess the real question(s) is/are would it be more efficient (size wise) to:
1. Use symbol references in messages/abort code method/function calls (to TEXT in a DAT block)
2.·Use same in generic [noparse][[/noparse]static] message emissions
In familiar language usage I've noted compilers "collect" strings and place them into "common" storage where applicable so I'm wondering if SPIN does similar.
I'm just trying to get the most "free" space available for user code rather than 'overheads'.
Thanks in advance,
HarryE.
·
I've been examining (in particular) the FemtoBasic source code and wonder why the use of "in-line" ASCII text is used in most "error" message emissions.· WRT the SPIN manual it implies the·reference·to "frequently"·accessed "text" is best coded using access to DAT 'objects' (defined as·ZeroTerminated 'byte array(s)' [noparse][[/noparse]symbols]).
I guess the real question(s) is/are would it be more efficient (size wise) to:
1. Use symbol references in messages/abort code method/function calls (to TEXT in a DAT block)
2.·Use same in generic [noparse][[/noparse]static] message emissions
In familiar language usage I've noted compilers "collect" strings and place them into "common" storage where applicable so I'm wondering if SPIN does similar.
I'm just trying to get the most "free" space available for user code rather than 'overheads'.
Thanks in advance,
HarryE.
·
Comments
FemtoBasic was not written for optimal memory use. Most error text is unique so it's clearer to use "string()". Note that the message "Syntax Error", which is used many times, is in a DAT section. There are probably a few other strings that are used often where manually collecting them would be useful, but I don't think you'd save much overall.
I believe using 'string("Hello World")' multiple times in a Spin program generates as multiple entries.
Forum search is effective with one word searches.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--Steve
Propalyzer: Propeller PC Logic Analyzer
http://forums.parallax.com/showthread.php?p=788230