Permalink
Browse files

Merge branch 'master' into opt_require

  • Loading branch information...
2 parents d03fb20 + 3adf3cc commit 1e5b1c410f83c4b3c56946f1a0aecfa85722f768 @rurban committed Jun 10, 2012
Showing with 40 additions and 14 deletions.
  1. +2 −1 Changes
  2. +33 −11 lib/B/C.pm
  3. +5 −2 lib/B/CC.pm
View
@@ -34,7 +34,8 @@
if the $VERSION had already version magic attached. (no testcase, hard to repro)
perl 5.16.0 shipped a slightly broken B without cop_stashlen. As workaround
we do not support utf8 stashes nor null bytes in stashes on 5.16.0 threaded.
- If you need it upgrade to B 1.35
+ 5.17 thr introduced a yet unsupported cop->stashoff (alloccopstash not exported).
+ Fixed Null COP storage for 5.16 and 5.17
amagic_generation was removed with 5.17
* CC (1.13): added check_entersub, check_bless - bless and new caching
* Bytecode (1.14): fixed require and op_first, issue 97
View
@@ -209,7 +209,7 @@ our @EXPORT_OK =
use B
qw( minus_c sv_undef walkoptree walkoptree_slow walksymtable main_root main_start peekop
class cchar svref_2object compile_stats comppadlist hash
- threadsv_names main_cv init_av end_av opnumber amagic_generation cstring
+ threadsv_names main_cv init_av end_av opnumber cstring
HEf_SVKEY SVf_POK SVf_ROK SVf_IOK SVf_NOK SVf_IVisUV SVf_READONLY );
BEGIN {
@@ -1093,12 +1093,24 @@ sub B::OP::save {
}
return savesym( $op, $op->next->save );
}
- if ($ITHREADS and $] >= 5.015004) {
+ if ($ITHREADS and $] >= 5.017) {
$copsect->comment(
- "$opsect_common, line, stash, file, hints, seq, warnings, hints_hash");
+ "$opsect_common, line, stashoff, file, hints, seq, warnings, hints_hash");
+ $copsect->add(sprintf("%s, 0, 0, (char *)NULL, 0, 0, NULL, NULL",
+ $op->_save_common));
+ }
+ elsif ($ITHREADS and $] >= 5.016) {
+ $copsect->comment(
+ "$opsect_common, line, stashpv, file, stashlen, hints, seq, warnings, hints_hash");
$copsect->add(sprintf("%s, 0, (char *)NULL, NULL, 0, 0, 0, NULL, NULL",
$op->_save_common));
}
+ elsif ($ITHREADS and $] >= 5.015004) {
+ $copsect->comment(
+ "$opsect_common, line, stash, file, hints, seq, warnings, hints_hash");
+ $copsect->add(sprintf("%s, 0, (char *)NULL, NULL, 0, 0, NULL, NULL",
+ $op->_save_common));
+ }
elsif ($PERL512) {
$copsect->comment(
"$opsect_common, line, stash, file, hints, seq, warnings, hints_hash");
@@ -1575,21 +1587,31 @@ sub B::COP::save {
my $file = $op->file;
$file =~ s/\.pl$/.c/;
if ($PERL512) {
- if ($ITHREADS and $] >= 5.016) {
+ if ($ITHREADS and $] >= 5.017) {
+ $copsect->comment(
+ "$opsect_common, line, stashoff, file, hints, seq, warnings, hints_hash");
+ $copsect->add(
+ sprintf(
+ "%s, %u, " . "%d, %s, 0, " . "%s, %s, NULL",
+ $op->_save_common, $op->line,
+ $op->stashoff, "(char*)".constpv( $file ), #hints=0
+ ivx($op->cop_seq), $B::C::optimize_warn_sv ? $warn_sv : 'NULL'
+ ));
+ } elsif ($ITHREADS and $] >= 5.016) {
# [perl #113034] [PATCH] 2d8d7b1 replace B::COP::stashflags by B::COP::stashlen (5.16.0 only)
$copsect->comment(
- "$opsect_common, line, stashpv, file, ".$] >= 5.017 ?"stashoff":"stashlen"
- .", hints, seq, warnings, hints_hash");
+ "$opsect_common, line, stashpv, file, stashlen, hints, seq, warnings, hints_hash");
$copsect->add(
sprintf(
"%s, %u, " . "%s, %s, %d, 0, " . "%s, %s, NULL",
$op->_save_common, $op->line,
+
"(char*)".constpv( $op->stashpv ), # we can store this static
"(char*)".constpv( $file ),
- # XXX at broken 5.16.0 with B-1.34 we do non-utf8, non-null only (=> negative len)
- # 5.16.0 B-1.35 has stashlen, 5.17 not anymore
- $] >= 5.017 ? $op->stashoff :
- ($op->can('stashlen') : $op->stashlen : length($op->stashpv)),
+ # XXX at broken 5.16.0 with B-1.34 we do non-utf8, non-null only (=> negative len),
+ # 5.16.0 B-1.35 has stashlen, 5.16.1 we will see.
+ $op->can('stashlen') ? $op->stashlen : length($op->stashpv),
+
ivx($op->cop_seq), $B::C::optimize_warn_sv ? $warn_sv : 'NULL'
));
} elsif ($ITHREADS and $] >= 5.015004 and $] < 5.016) {
@@ -5775,7 +5797,7 @@ sub save_context {
"av_store(CvPADLIST(PL_main_cv), 0, SvREFCNT_inc($curpad_nam)); /* namepad */",
"av_store(CvPADLIST(PL_main_cv), 1, SvREFCNT_inc($curpad_sym)); /* curpad */");
if ($] < 5.017) {
- my $amagic_generate = amagic_generation;
+ my $amagic_generate = B::amagic_generation;
warn "amagic_generation = $amagic_generate\n" if $verbose;
$init->add("PL_amagic_generation = $amagic_generate;");
};
View
@@ -262,7 +262,7 @@ use Config;
use strict;
#use 5.008;
use B qw(main_start main_root class comppadlist peekop svref_2object
- timing_info init_av end_av sv_undef amagic_generation
+ timing_info init_av end_av sv_undef
OPf_WANT_VOID OPf_WANT_SCALAR OPf_WANT_LIST OPf_WANT
OPf_MOD OPf_STACKED OPf_SPECIAL
OPpASSIGN_BACKWARDS OPpLVAL_INTRO OPpDEREF_AV OPpDEREF_HV
@@ -2914,7 +2914,6 @@ sub cc_main {
return if $errors or $check;
if ( !defined($module) ) {
- my $amagic_generate = amagic_generation;
# XXX TODO push BEGIN/END blocks to modules code.
$init->add(
sprintf( "PL_main_root = s\\_%x;", ${ main_root() } ),
@@ -2929,6 +2928,10 @@ sub cc_main {
"PL_initav = (AV*)$init_av;",
"PL_endav = (AV*)$end_av;"
);
+ if ($] < 5.017) {
+ my $amagic_generate = B::amagic_generation;
+ $init->add("PL_amagic_generation = $amagic_generate;");
+ };
}
seek( STDOUT, 0, 0 ); #prevent print statements from BEGIN{} into the output

0 comments on commit 1e5b1c4

Please sign in to comment.