Jos Visser <[EMAIL PROTECTED]> wrote:
> Hi all,

> In my case my "problem" (challenge) is that I want to generate some
> parrot code that is capable of searching the lexical pads for the
> existence of a lexical. In my particular case this code executes
> frequently.

I would implement the proposed OrderedHash (HashArray) PMC, base
lexicals on these and then iterate over these aggregates in the lexical
pad. Trying to search for non existent lexicals doesn't seem to be a
good idea.

> My current code generator generates code to trap the LEX_NOT_FOUND
> exception. However, the "set_eh" instruction is *terribly* slow...

The C<set_eh> is a stack_push and shouldn't be that slow. But your are
right. Something is fishy here. I'll try to find int.

> I hacked around var.ops a bit to introduce a set of ops called
> 'search_lex' which just return a null PMC if the lexical is not found

While I'm not strictly against these, a new C<error> flag (like the
current C<warns>) in the interpreter->ctx to toggle some exception would
be better.

> ++Jos.nl

leo

Reply via email to