How does Perl's interpreter do if-statements? I wanted to try to implement a simple Lazy-Basic-Block-Versioning for if-statements that use ref
as a predicate, and maybe subsequently for sub-routines as well.
After studying the source code I see OP codes for everything but control flow. My interpreter experience is quite limited, but I would assume to see a OP_IF
that would pop the stack for it's predicates OP codes or something along those lines. I found KEY_if
which comes from the Yacc grammar, which then subsequently is used in toke.c
and translated to a KW_IF
, but I can't find where KW_IF
is actually used.
I originally intended to just add some basic optimization with global state to peep.c
, but since there is no OP_IF
I'm struggling to see the big-picture of how control flow is handled.
-MO=Concise,-exec
and Devel::Peek'sDump
are your friends. – Rocray0.09
, while the web page (linked above in my previous comment) is0.06
– Unguiculatepdf
and anindex.html
. A link on Google Drive: perl-illguts-0.49 – Unguiculate