From: Vishal Bhatia Date: Sat, 31 Jul 1999 19:08:33 +0000 (-0700) Subject: "use constant" in the compiler X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e9a14d94c9b931be6c4d19e6c264464cb1e842cb;p=p5sagit%2Fp5-mst-13.2.git "use constant" in the compiler Message-ID: p4raw-id: //depot/perl@3869 --- diff --git a/ext/B/B/C.pm b/ext/B/B/C.pm index 39a78c9..18c1aba 100644 --- a/ext/B/B/C.pm +++ b/ext/B/B/C.pm @@ -582,7 +582,7 @@ sub try_autoload { } } } - +sub Dummy_initxs{}; sub B::CV::save { my ($cv) = @_; my $sym = objsym($cv); @@ -596,10 +596,19 @@ sub B::CV::save { my $cvname = $gv->NAME; my $root = $cv->ROOT; my $cvxsub = $cv->XSUB; - if ($cvxsub) { + #INIT is removed from the symbol table, so this call must come + # from PL_initav->save. Re-bootstrapping will push INIT back in + # so nullop should be sent. + if ($cvxsub && ($cvname ne "INIT")) { + #if ($cvxsub) { my $egv = $gv->EGV; my $stashname = $egv->STASH->NAME; $xsub{$stashname}='Static' unless $xsub{$stashname}; + return qq/(perl_get_cv("$stashname\:\:$cvname",0))/; + } + if ($cvxsub && $cvname eq "INIT") { + no strict 'refs'; + return svref_2object(\&Dummy_initxs)->save; } my $sv_ix = $svsect->index + 1; $svsect->add("svix$sv_ix"); diff --git a/ext/B/B/CC.pm b/ext/B/B/CC.pm index 4affda0..9369464 100644 --- a/ext/B/B/CC.pm +++ b/ext/B/B/CC.pm @@ -101,7 +101,8 @@ sub debug { if ($debug_runtime) { warn(@_); } else { - runtime(map { chomp; "/* $_ */"} @_); + my @tmp=@_; + runtime(map { chomp; "/* $_ */"} @tmp); } } @@ -1480,6 +1481,11 @@ sub compile_bblock { sub cc { my ($name, $root, $start, @padlist) = @_; my $op; + if($done{$$start}){ + #warn "repeat=>".ref($start)."$name,\n";#debug + $decl->add(sprintf("#define $name %s",$done{$$start})); + return; + } init_pp($name); load_pad(@padlist); B::Pseudoreg->new_scope; @@ -1503,7 +1509,7 @@ sub cc { next if !defined($op) || !$$op || $done{$$op}; #warn "...compiling it\n"; # debug do { - $done{$$op} = 1; + $done{$$op} = $name; $op = compile_bblock($op); if ($need_freetmps && $freetmps_each_bblock) { runtime("FREETMPS;");