lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi,

I have a few questions about subj:

1) Can GC happen during parsing (in stock lua)? (tests & glances at lparser.c say `no', but I'm still not sure)
2) Is the parser GC-safe?
3) Imagine now that somewhere in my modified parser I want to read a sequence of identifiers separated by dots:

tn ::= name`.'name`.'name`.'name

And I'm using the following code (just an example):

tn.parts[0] = str_checkname(ls);
tn.parts[1] = str_checkname(ls);
tn.parts[2] = str_checkname(ls);
tn.parts[3] = str_checkname(ls);
dosmthwithtn(&tn);

And GC can occur somewhere in dosmthwithtn...

What is the best way in this case to protect tn.parts from being touched by collector? (currently I'm thinking about doing l_setbit((s)->tsv.marked, FIXEDBIT) before and resetbit((s)->tsv.marked, FIXEDBIT) after dosmthwithtn. But I'm not sure whether this is the correct solution or not...)

TIA,
Antero Vipunen.

A language that doesn't affect the way you think about programming, is not worth knowing -- Alan Perlis