diff options
author | Vishal Bhatia <vishal@deja.com> | 1999-07-31 12:08:33 -0700 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1999-08-02 06:59:09 +0000 |
commit | e9a14d94c9b931be6c4d19e6c264464cb1e842cb (patch) | |
tree | dccf727d69505a8705b3d504798ccd394b1c0881 | |
parent | fafe5ef9b0f9552ce3bd6b5ce464911fdd3aaaff (diff) | |
download | perl-e9a14d94c9b931be6c4d19e6c264464cb1e842cb.tar.gz |
"use constant" in the compiler
Message-ID: <LAONLKLELDJAFAAA@my-deja.com>
p4raw-id: //depot/perl@3869
-rw-r--r-- | ext/B/B/C.pm | 13 | ||||
-rw-r--r-- | ext/B/B/CC.pm | 10 |
2 files changed, 19 insertions, 4 deletions
diff --git a/ext/B/B/C.pm b/ext/B/B/C.pm index 39a78c98e6..18c1aba433 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 4affda0014..9369464344 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;"); |