Subject: | Proposal to improve code |
You have next comment at xs
Show quoted text
>This is from Runops::Hook. We need to find a way to share c functions
...
Show quoted text>
/* we fake B::UNOP object (fakeop_sv) that points to our static fakeop.
* then we set first_op to the op we want to make an object out of, and
* trampoline into B::UNOP->first so that it creates the B::OP of the
* correct class for us.
* B should really have a way to create an op from a pointer via some
* external API. This sucks monkey balls on olympic levels */
But now we may use call to make_op_object which will create SV from OP
From B.xs
static SV *
make_op_object(pTHX_ const OP *o)
{
SV *opsv = sv_newmortal();
sv_setiv(newSVrv(opsv, opclassnames[cc_opclass(aTHX_ o)]), PTR2IV(o));
return opsv;
}