[stringtemplate-interest] pushed another ST4 build

Terence Parr parrt at cs.usfca.edu
Wed Dec 29 09:03:04 PST 2010


Nope, just an array;

t(x,y) ::= "<x><y>"

generates

load_local 0
write
load_local 1
write

The compiler translates id to int.  For dynamic scoping look up, it  
keeps a hashtable but in the template def object not the ST itself.  
then you can do

locals[impl.formalArgs.get(id).index]

to get value if you only have a name.

This saves a hashtable per ST :)  memory and gc overhead savings

T
On Dec 28, 2010, at 2:32 PM, Monty Zukowski wrote:

> What's the rationale there?  Is the array key,value,key,value?  Since
> the number of items is usually short, a few equals() calls beats the
> hash function?
>
> Monty
>
> On Mon, Dec 27, 2010 at 12:54 PM, Terence Parr <parrt at cs.usfca.edu>  
> wrote:
>> fast array not hashmap look up for attributes.
>> http://bit.ly/hVN7PG
>> Ter
>> _______________________________________________
>> stringtemplate-interest mailing list
>> stringtemplate-interest at antlr.org
>> http://www.antlr.org/mailman/listinfo/stringtemplate-interest
>>
>>
> _______________________________________________
> stringtemplate-interest mailing list
> stringtemplate-interest at antlr.org
> http://www.antlr.org/mailman/listinfo/stringtemplate-interest



More information about the stringtemplate-interest mailing list