#define newAVREF Perl_newAVREF
#define newBINOP Perl_newBINOP
#define newCONDOP Perl_newCONDOP
+#define newCONSTSUB Perl_newCONSTSUB
#define newCVREF Perl_newCVREF
#define newFORM Perl_newFORM
#define newFOROP Perl_newFOROP
newAVREF
newBINOP
newCONDOP
+newCONSTSUB
newCVREF
newFORM
newFOROP
return cv;
}
+void
+newCONSTSUB(HV *stash, char *name, SV *sv)
+{
+ dTHR;
+ U32 oldhints = hints;
+ HV *old_cop_stash = curcop->cop_stash;
+ HV *old_curstash = curstash;
+ line_t oldline = curcop->cop_line;
+ curcop->cop_line = copline;
+
+ hints &= ~HINT_BLOCK_SCOPE;
+ if(stash)
+ curstash = curcop->cop_stash = stash;
+
+ newSUB(
+ MY_start_subparse(FALSE, 0),
+ newSVOP(OP_CONST, 0, newSVpv(name,0)),
+ newSVOP(OP_CONST, 0, &sv_no), /* SvPV(&sv_no) == "" -- GMB */
+ newSTATEOP(0, Nullch, newSVOP(OP_CONST, 0, sv))
+ );
+
+ hints = oldhints;
+ curcop->cop_stash = old_cop_stash;
+ curstash = old_curstash;
+ curcop->cop_line = oldline;
+}
+
CV *
newXS(char *name, void (*subaddr) (CV *), char *filename)
{
void* Newc( x, void *ptr, int size, type, cast )
+=item newCONSTSUB
+
+Creates a constant sub equivalent to Perl C<sub FOO () { 123 }>
+which is eligible for inlining at compile-time.
+
+ void newCONSTSUB(HV* stash, char* name, SV* sv)
+
=item newHV
Creates a new HV. The reference count is set to 1.
OP* newANONSUB _((I32 floor, OP* proto, OP* block));
OP* newASSIGNOP _((I32 flags, OP* left, I32 optype, OP* right));
OP* newCONDOP _((I32 flags, OP* expr, OP* trueop, OP* falseop));
+void newCONSTSUB _((HV* stash, char* name, SV* sv));
void newFORM _((I32 floor, OP* o, OP* block));
OP* newFOROP _((I32 flags, char* label, line_t forline, OP* scalar, OP* expr, OP*block, OP*cont));
OP* newLOGOP _((I32 optype, I32 flags, OP* left, OP* right));