Actually, I thought so at first, but perhaps not. op_class[] is not available on Perl 5.24.4 and earlier. But leaving that aside, although the "name" method seems to return the right thing, other fields don't
When I try with:
I get:sub testing { my $site = sub { callsite() }; my $addr = $site->(); printf "Op address is 0x%x\n", $addr; my $op = make_op_object($addr); printf("op %s, name: %s, parent: %s\n", $op, $op->name, $op->paren +t); # I can get OPs by walking and looking for $op_addr, # but I don't want to do that. my $walker = B::Concise::compile('-terse', '-src', \&testing); B::Concise::walk_output(\my $buf); $walker->(); # walks and renders into $buf; print $buf; } testing();
Note that the address is different as is the parent.Op address is 0x55eddbdfba80 op B::OP=SCALAR(0x55eddba2c578), name: padsv, parent: B::BINOP=SCALAR( +0x55eddba422d0) B::Concise::compile(CODE(0x55eddbe20a80)) UNOP (0x55eddbe1ab10) leavesub [1] LISTOP (0x55eddbdfb9a0) lineseq # 37: my $site = sub { callsite() }; COP (0x55eddbab2048) nextstate BINOP (0x55eddbdfb9f8) sassign UNOP (0x55eddbdfba40) srefgen UNOP (0x55eddbdfbab8) null [157] SVOP (0x55eddbdfbb00) anoncode [2] CV (0x55eddba4d +0f8) OP (0x55eddbdfbb40) padsv [1] # 38: my $addr = $site->(); COP (0x55eddbab1e68) nextstate BINOP (0x55eddbab1ec8) sassign UNOP (0x55eddbab1f10) entersub [4] UNOP (0x55eddbab1f88) null [157] OP (0x55eddbab1f50) pushmark UNOP (0x55eddbab1fd0) null [16] OP (0x55eddbab2010) padsv [1] OP (0x55eddbdfba80) padsv [3]
In reply to Re^2: How can I turn an op address into the right kind of B::OP?
by rockyb
in thread How can I turn an op address into the right kind of B::OP?
by rockyb
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |