Skip to content

Commit

Permalink
C: revert 0b97dd deferred INC cleanup
Browse files Browse the repository at this point in the history
Note that tests pass now again, but I am not sure why. I have
not found the real problem with 0b97dd deferred INC cleanup yet.
Improve it with 1.38.
  • Loading branch information
Reini Urban committed Jan 17, 2012
1 parent 719589e commit 72cc085
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 15 deletions.
12 changes: 9 additions & 3 deletions Changes
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
Save %main:: stashes w/o -fno-stash. Switched to git, added github mirror Save %main:: stashes w/o -fno-stash. Switched to git, added github mirror
Fixed hashes and share_hek, when mixed compiled and load-time for >5.8. Fixed hashes and share_hek, when mixed compiled and load-time for >5.8.


* C: save stashes also, but only values which are also Stability: This release is the first which passes all module tests and passes
most tests and is used in production with -staticxs -O3, but further logical
improvements failed for no apparent reasons, so it's still considered unstable.

* C: save stashes optionally with -fstash, but only values which are also
stashes to avoid a second walker besides savecv, and thus do not stashes to avoid a second walker besides savecv, and thus do not
walk into unneeded territory; B::STASHGV (46, issue 79) walk into unneeded territory; B::STASHGV (46, issue 79)
New -fno-stash with -O2 to omit stashes which are rarely needed. New -fno-stash with -O2 to omit stashes which are rarely needed.
Expand Down Expand Up @@ -48,7 +52,8 @@
need -fstash to add stashes. It caused not understood problems. need -fstash to add stashes. It caused not understood problems.
Fixed saving %SIG signals and more -2 SV magic (issue 92) Fixed saving %SIG signals and more -2 SV magic (issue 92)
Adjusted IO logic, was erronously skipped (issue 59) Adjusted IO logic, was erronously skipped (issue 59)
Defer saving INC to match internally skipped packages (issue 85,87) XXX: Defer saving INC to match internally skipped packages (issue 85,87)
inc_cleanup: save only those %INC keys which are stored.
Save ext/mro only if the ext mro methods were loaded. Save ext/mro only if the ext mro methods were loaded.
Force loading of -u arguments to avoid runtime loading. Force loading of -u arguments to avoid runtime loading.
* CC (1.12): allow overriding of -f<opt> B::C flags. * CC (1.12): allow overriding of -f<opt> B::C flags.
Expand All @@ -64,9 +69,10 @@
Changed verbosity levels and output wording. Changed verbosity levels and output wording.
* META.yml: remove from MANIFEST and repo, let make dist * META.yml: remove from MANIFEST and repo, let make dist
autogenerate it. autogenerate it.
* t/TESTS: changed test 46 (Exporter:: and other stashes in * t/test.pl, t/TESTS: changed test 46 (Exporter:: and other stashes in
%main:: stash) to cover issue 79. %main:: stash) to cover issue 79.
use Exporter; print q(ok) if %main::Exporter:: use Exporter; print q(ok) if %main::Exporter::
* t/test.pl: use general comments with optional TODO. Before only TODO
* t/perldoc.t: fixed for 5.8 with manually adding -uFile::Spec -uIO::Handle * t/perldoc.t: fixed for 5.8 with manually adding -uFile::Spec -uIO::Handle
* t/issue81.t: added * t/issue81.t: added


Expand Down
10 changes: 5 additions & 5 deletions Makefile.PL
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ int main() {
"; ";
my $testc = $testori; my $testc = $testori;
if (try_compile($testc)) { if (try_compile($testc)) {
warn "independent_comalloc() as-is activated\n"; warn "-fav-init2 available: independent_comalloc() as-is activated\n";
return 1; return 1;
} }


Expand All @@ -154,7 +154,7 @@ int main() {
$lib =~ s/^-l(.+)$/lib$1.lib/ if $^O eq 'MSWin32'; $lib =~ s/^-l(.+)$/lib$1.lib/ if $^O eq 'MSWin32';
if (try_compile($testc, $lib)) { if (try_compile($testc, $lib)) {
$extra_libs = " $lib"; $extra_libs = " $lib";
warn "independent_comalloc() with $lib activated\n"; warn "-fav-init2 available: independent_comalloc() with $lib activated\n";
return 1; return 1;
} }
} }
Expand All @@ -165,7 +165,7 @@ int main() {
if (try_compile($testc, $lib)) { if (try_compile($testc, $lib)) {
$extra_libs = " $lib"; $extra_libs = " $lib";
$use_declare_independent_comalloc = 1; $use_declare_independent_comalloc = 1;
warn "dlindependent_comalloc() with $lib activated\n"; warn "-fav-init2 available: dlindependent_comalloc() with $lib activated\n";
return 1; return 1;
} }
} }
Expand All @@ -177,11 +177,11 @@ int main() {
if (try_compile($testc, $lib)) { if (try_compile($testc, $lib)) {
$extra_cflags = " -DNEED_MALLOC_283"; $extra_cflags = " -DNEED_MALLOC_283";
$extra_libs = " $lib"; $extra_libs = " $lib";
warn "independent_comalloc() with -DNEED_MALLOC_283 $lib activated\n"; warn "-fav-init2 available: independent_comalloc() with -DNEED_MALLOC_283 $lib activated\n";
return 1; return 1;
} }
} }
warn "independent_comalloc() not detected.\n"; warn "-fav-init2 not available: independent_comalloc() not detected.\n";
warn " Install with $^X Makefile.PL INSTALL_PTMALLOC3 on POSIX systems\n"; warn " Install with $^X Makefile.PL INSTALL_PTMALLOC3 on POSIX systems\n";
return 0; return 0;
} }
Expand Down
19 changes: 12 additions & 7 deletions lib/B/C.pm
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -2913,7 +2913,7 @@ sub B::GV::save {
my $sym = objsym($gv); my $sym = objsym($gv);
if ( defined($sym) ) { if ( defined($sym) ) {
warn sprintf( "GV 0x%x already saved as $sym\n", $$gv ) if $debug{gv}; warn sprintf( "GV 0x%x already saved as $sym\n", $$gv ) if $debug{gv};
return $sym unless $_[1] eq 'main::INC' and $_[2]; return $sym; # unless $_[1] eq 'main::INC' and $_[2];
} }
else { else {
my $ix = $gv_index++; my $ix = $gv_index++;
Expand Down Expand Up @@ -2976,9 +2976,9 @@ if (0) {
return $sym; return $sym;
} }
# defer to the end because we remove compiler-internal and skipped stuff # defer to the end because we remove compiler-internal and skipped stuff
if ($fullname eq 'main::INC' and !$_[2]) { #if ($fullname eq 'main::INC' and !$_[2]) {
return $sym; # return $sym;
} #}
$init->add(qq[$sym = gv_fetchpv($name, TRUE, SVt_PV);]); $init->add(qq[$sym = gv_fetchpv($name, TRUE, SVt_PV);]);
my $svflags = $gv->FLAGS; my $svflags = $gv->FLAGS;
my $savefields = 0; my $savefields = 0;
Expand Down Expand Up @@ -3109,6 +3109,9 @@ if (0) {
} }
my $gvhv = $gv->HV; my $gvhv = $gv->HV;
if ( $$gvhv && $savefields & Save_HV ) { if ( $$gvhv && $savefields & Save_HV ) {
if ($fullname eq 'main::INC') {
inc_cleanup();
}
if ($fullname ne 'main::ENV') { if ($fullname ne 'main::ENV') {
warn "GV::save \%$fullname\n" if $debug{gv}; warn "GV::save \%$fullname\n" if $debug{gv};
if ($fullname eq 'main::!') { # force loading Errno if ($fullname eq 'main::!') { # force loading Errno
Expand Down Expand Up @@ -5000,6 +5003,7 @@ sub save_unused_subs {
} }


sub inc_cleanup { sub inc_cleanup {
return if $inc_cleanup;
# %INC sanity check issue 89: # %INC sanity check issue 89:
# omit unused, unsaved packages, so that at least run-time require will pull them in. # omit unused, unsaved packages, so that at least run-time require will pull them in.
for my $packname (keys %INC) { for my $packname (keys %INC) {
Expand All @@ -5017,6 +5021,7 @@ sub inc_cleanup {
warn "\%INC: ".join(" ",keys %INC)."\n"; warn "\%INC: ".join(" ",keys %INC)."\n";
warn "\%include_package: ".join(" ",grep{$include_package{$_}} keys %include_package)."\n"; warn "\%include_package: ".join(" ",grep{$include_package{$_}} keys %include_package)."\n";
} }
$inc_cleanup++;
} }


sub save_context { sub save_context {
Expand Down Expand Up @@ -5069,10 +5074,10 @@ sub save_context {
warn "\%INC and \@INC:\n" if $verbose; warn "\%INC and \@INC:\n" if $verbose;
$init->add('/* %INC */'); $init->add('/* %INC */');
inc_cleanup(); inc_cleanup();
svref_2object( \*main::INC )->save('main::INC', 'now'); # svref_2object( \*main::INC )->save('main::INC', 'now');
$inc_hv = svref_2object( \%main::INC )->save('main::INC'); $inc_hv = svref_2object( \%INC )->save('main::INC');
$init->add('/* @INC */'); $init->add('/* @INC */');
$inc_av = svref_2object( \@main::INC )->save('main::INC'); $inc_av = svref_2object( \@INC )->save('main::INC');
} }
my $amagic_generate = amagic_generation; my $amagic_generate = amagic_generation;
warn "amagic_generation = $amagic_generate\n" if $verbose; warn "amagic_generation = $amagic_generate\n" if $verbose;
Expand Down

0 comments on commit 72cc085

Please sign in to comment.