Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

BC: first stab at B::PADLIST and CvGV_set changes with 5.17

  • Loading branch information...
commit 9514b5aef691fc2e06d3b6254388f4eb7a605881 1 parent 305fc77
Reini Urban authored
23 ByteLoader/bytecode.h
View
@@ -286,7 +286,7 @@ static int bget_swab = 0;
#define BSET_pv_free(pv) Safefree(pv.xpv_pv)
#if PERL_VERSION > 13 || defined(CvGV_set)
-#define BSET_xcv_gv(sv, arg) ((SvANY((CV*)bstate->bs_sv))->xcv_gv = (GV*)arg)
+#define BSET_xcv_gv(sv, arg) (CvGV_set((CV*)bstate->bs_sv, (GV*)arg))
#else
#define BSET_xcv_gv(sv, arg) (*(SV**)&CvGV(bstate->bs_sv) = arg)
#endif
@@ -612,7 +612,24 @@ static int bget_swab = 0;
LEAVE; \
} STMT_END
#endif
-#if (PERL_VERSION >= 10)
+#if (PERL_VERSION >= 10) && (PERL_VERSION < 17)
+#define BSET_push_begin(ary,cv) \
+ STMT_START { \
+ I32 oldscope = PL_scopestack_ix; \
+ ENTER; \
+ SAVECOPFILE(&PL_compiling); \
+ SAVECOPLINE(&PL_compiling); \
+ if (!PL_beginav) \
+ PL_beginav = newAV(); \
+ av_push(PL_beginav, (SV*)cv); \
+ GvCV(CvGV(cv)) = 0; /* cv has been hijacked */\
+ call_list(oldscope, PL_beginav); \
+ PL_curcop = &PL_compiling; \
+ CopHINTS_set(&PL_compiling, (U8)PL_HINTS_PRIVATE); \
+ LEAVE; \
+ } STMT_END
+#endif
+#if (PERL_VERSION >= 17)
#define BSET_push_begin(ary,cv) \
STMT_START { \
I32 oldscope = PL_scopestack_ix; \
@@ -622,7 +639,7 @@ static int bget_swab = 0;
if (!PL_beginav) \
PL_beginav = newAV(); \
av_push(PL_beginav, (SV*)cv); \
- SvANY((CV*)cv)->xcv_gv = 0;/* cv has been hijacked */ \
+ CvGV_set((CV*)cv, NULL);/* cv has been hijacked */ \
call_list(oldscope, PL_beginav); \
PL_curcop = &PL_compiling; \
CopHINTS_set(&PL_compiling, (U8)PL_HINTS_PRIVATE); \
4 bytecode.pl
View
@@ -911,7 +911,7 @@ =head1 AUTHOR
50 13 xcv_stash bstate->bs_sv svindex x
51 0 xcv_start CvSTART(bstate->bs_sv) opindex
52 0 xcv_root CvROOT(bstate->bs_sv) opindex
-53 0 xcv_gv bstate->bs_sv svindex x
+53 0 xcv_gv bstate->bs_sv svindex x
# <8 xcv_filegv *(SV**)&CvFILEGV(bstate->bs_sv) svindex
54 0 xcv_file CvFILE(bstate->bs_sv) pvindex
55 0 xcv_depth CvDEPTH(bstate->bs_sv) long
@@ -1024,7 +1024,7 @@ =head1 AUTHOR
148 8 xgv_stash *(SV**)&GvSTASH(bstate->bs_sv) svindex
149 8 signal bstate->bs_sv strconst 24x
# formfeed is deprecated
-150 8 formfeed PL_formfeed svindex
+150 8-17 formfeed PL_formfeed svindex
151 9-17 op_latefree PL_op->op_latefree U8
152 9-17 op_latefreed PL_op->op_latefreed U8
153 9-17 op_attached PL_op->op_attached U8
29 lib/B/Bytecode.pm
View
@@ -233,6 +233,22 @@ sub B::SV::ix {
}
}
+sub B::PADLIST::ix {
+ my $sv = shift;
+ my $ix = $svtab{$$sv};
+ defined($ix) ? $ix : do {
+ nice '[' . class($sv) . " $tix]";
+ B::Assembler::maxsvix($tix) if $debug{A};
+ my $type = 0xff; # SVTYPEMASK
+ asm "newsvx", 0,
+ $debug{Comment} ? sprintf("type=%d", $type) : "";
+ asm "stsv", $tix if $PERL56;
+ $svtab{$$sv} = $varix = $ix = $tix++;
+ $sv->bsave($ix);
+ $ix;
+ }
+}
+
sub B::GV::ix {
my ( $gv, $desired ) = @_;
my $ix = $svtab{$$gv};
@@ -666,6 +682,19 @@ sub B::AV::bsave {
asm "xmg_stash", $stashix;
}
+sub B::PADLIST::bsave {
+ my ( $av, $ix ) = @_;
+ my @array = $av->ARRAY;
+ $_ = $_->ix for @array; # hack. walks the ->ix methods to save the elements
+ # my $stashix = $av->SvSTASH->ix;
+ nice "-AV-",
+ asm "ldsv", $varix = $ix, sv_flags($av) unless $ix == $varix;
+ asm "av_extend", $av->MAX if $av->MAX >= 0;
+ asm "av_pushx", $_ for @array;
+ asm "sv_refcnt", $av->REFCNT;
+ # asm "xmg_stash", $stashix;
+}
+
sub B::GV::desired {
my $gv = shift;
my ( $cv, $form );
6 lib/B/C.pm
View
@@ -4862,10 +4862,10 @@ int my_perl_destruct( PerlInterpreter *my_perl ) {
print " SvPV_set($s, (char*)&PL_sv_undef);\n";
} elsif ($s =~ /^cop_list/) {
if ($ITHREADS or !$MULTI) {
- print " CopFILE_set(&$s, NULL);";
+ print " CopFILE_set(&$s, NULL);\n";
print !$ITHREADS or $]<5.016 or $]>=5.017
- ? " CopSTASHPV_set(&$s, NULL);\n"
- : " CopSTASHPV_set(&$s, NULL, 0);\n";
+ ? " CopSTASHPV_set(&$s, NULL);\n"
+ : " CopSTASHPV_set(&$s, NULL, 0);\n";
}
} elsif ($s ne 'ptr_undef') {
warn("unknown static_free: $s at index $_");
Please sign in to comment.
Something went wrong with that request. Please try again.