Permalink
Browse files

C: simplify dynamic lexwarns - savepvn

use a single line, even the old Copy method had an ending \0.
t/modules.t: TODO Attribute::Handlers on 5.18 and 5.10 threaded #169
all coretests pass
  • Loading branch information...
1 parent 205fbbc commit 2413c50d5f2584a9835438b73da469137619a244 @rurban committed Feb 19, 2014
Showing with 15 additions and 11 deletions.
  1. +5 −9 lib/B/C.pm
  2. +8 −1 t/modules.t
  3. +2 −1 t/testc.sh
View
14 lib/B/C.pm
@@ -1754,13 +1754,10 @@ sub B::COP::save {
$copw =~ s/^\(STRLEN\*\)&//;
# on cv_undef (scope exit, die, ...) CvROOT and all its kids are freed.
# lexical cop_warnings need to be dynamic, but just the ptr to the static string.
- $init->add("{", # allocate new ptr
- " STRLEN *lexwarn;",
- " Newxz(lexwarn, sizeof(STRLEN *), STRLEN);",
- " if ($copw)",
- " Copy($copw, lexwarn, sizeof($copw), char);",
- " cop_list[$ix].cop_warnings = lexwarn;",
- "}");
+ if ($copw) {
+ my $cop = "cop_list[$ix]";
+ $init->add("$cop.cop_warnings = (STRLEN*)savepvn((char*)&".$copw.", sizeof($copw));");
+ }
} else {
$init->add( sprintf( "cop_list[$ix].cop_warnings = %s;", $warn_sv ) )
unless $B::C::optimize_warn_sv;
@@ -3485,8 +3482,7 @@ sub B::CV::save {
$init->add( sprintf( "CvFLAGS((CV*)%s) = 0x%x; %s", $sym, $CvFLAGS,
$debug{flags}?"/* ".$cv->flagspv." */":"" ) );
}
- # XXX TODO someone is overwriting CvSTART also
- $init->add("CvSTART($sym) = $startfield;");
+ $init->add("CvSTART($sym) = $startfield;"); # XXX TODO someone is overwriting CvSTART also
} else {
$init->add( sprintf( "CvGV(%s) = %s;", $sym, objsym($gv) ) );
}
View
9 t/modules.t
@@ -289,7 +289,11 @@ sub is_todo {
)) { return '>= 5.16' if $_ eq $module; }}
if ($] >= 5.018) { foreach(qw(
ExtUtils::ParseXS
- )) { return '>= 5.18 #135 Eval-group not allowed at runtime' if $_ eq $module; }}
+ )) { return '>= 5.18 #135 Eval-group not allowed at runtime' if $_ eq $module; }}
+
+ if ($] >= 5.018) { foreach(qw(
+ Attribute::Handlers
+ )) { return '>= 5.18 #169 early my_exit + SEGV' if $_ eq $module; }}
# ---------------------------------------
if ($Config{useithreads}) {
@@ -322,6 +326,9 @@ sub is_todo {
# Module::Pluggable
# Test::Warn
#)) { return '5.10 with threads' if $_ eq $module; }}
+ if ($] >= 5.010 and $] < 5.012 and $DEBUGGING) { foreach(qw(
+ Attribute::Handlers
+ )) { return '5.10 DEBUGGING #169 early my_exit + SEGV' if $_ eq $module; }}
if ($] >= 5.012 and $] < 5.014) { foreach(qw(
ExtUtils::CBuilder
)) { return '5.12 with threads' if $_ eq $module; }}
View
3 t/testc.sh
@@ -1162,7 +1162,8 @@ result[289]='ok'
tests[295]='#TODO @-
"zzaaabbb" =~ m/(a+)(b+)/ and print "@- : @+\n"'
result[295]='2 2 5 : 8 5 8'
-tests[299]='package Pickup; use UNIVERSAL qw( VERSION ); print qq{ok\n} if VERSION "UNIVERSAL";'
+tests[299]='#TODO
+package Pickup; use UNIVERSAL qw( VERSION ); print qq{ok\n} if VERSION "UNIVERSAL";'
result[299]='ok'
tests[300]='use mro;print @{mro::get_linear_isa("mro")};'
result[300]='mro'

0 comments on commit 2413c50

Please sign in to comment.