3 # Copyright (c) 1996-1998 Malcolm Beattie
5 # You may distribute under the terms of either the GNU General Public
6 # License or the Artistic License, as specified in the README file.
10 our $VERSION = '1.00';
14 use B qw(main_cv main_root main_start comppadlist
15 class peekop walkoptree svref_2object cstring walksymtable
16 init_av begin_av end_av
17 SVf_POK SVp_POK SVf_IOK SVp_IOK SVf_NOK SVp_NOK
18 SVf_READONLY GVf_IMPORTED_AV GVf_IMPORTED_CV GVf_IMPORTED_HV
19 GVf_IMPORTED_SV SVTYPEMASK
21 use B::Asmdata qw(@optype @specialsv_name);
22 use B::Assembler qw(newasm endasm assemble);
26 for ($i = 0; $i < @optype; $i++) {
27 $optype_enum{$optype[$i]} = $i;
30 # Following is SVf_POK|SVp_POK
31 # XXX Shouldn't be hardwired
32 sub POK () { SVf_POK|SVp_POK }
34 # Following is SVf_IOK|SVp_IOK
35 # XXX Shouldn't be hardwired
36 sub IOK () { SVf_IOK|SVp_IOK }
38 # Following is SVf_NOK|SVp_NOK
39 # XXX Shouldn't be hardwired
40 sub NOK () { SVf_NOK|SVp_NOK }
42 # nonexistant flags (see B::GV::bytecode for usage)
43 sub GVf_IMPORTED_IO () { 0; }
44 sub GVf_IMPORTED_FORM () { 0; }
46 my ($verbose, $no_assemble, $debug_bc, $debug_cv);
47 my @packages; # list of packages to compile
49 sub asm (@) { # print replacement that knows about assembling
53 my $buf = join '', @_;
54 assemble($_) for (split /\n/, $buf);
58 sub asmf (@) { # printf replacement that knows about assembling
63 my $buf = sprintf $format, @_;
64 assemble($_) for (split /\n/, $buf);
68 # Optimisation options. On the command line, use hyphens instead of
69 # underscores for compatibility with gcc-style options. We use
70 # underscores here because they are OK in (strict) barewords.
71 my ($compress_nullops, $omit_seq, $bypass_nullops);
72 my %optimise = (compress_nullops => \$compress_nullops,
73 omit_sequence_numbers => \$omit_seq,
74 bypass_nullops => \$bypass_nullops);
76 my $strip_syntree; # this is left here in case stripping the
77 # syntree ever becomes safe again
81 my %symtable; # maps object addresses to object indices.
82 # Filled in at allocation (newsv/newop) time.
84 my %saved; # maps object addresses (for SVish classes) to "saved yet?"
85 # flag. Set at FOO::bytecode time usually by SV::bytecode.
86 # Manipulated via saved(), mark_saved(), unmark_saved().
88 my %strtable; # maps shared strings to object indices
89 # Filled in at allocation (pvix) time
91 my $svix = -1; # we keep track of when the sv register contains an element
92 # of the object table to avoid unnecessary repeated
93 # consecutive ldsv instructions.
95 my $opix = -1; # Ditto for the op register.
136 return cstring($str . "\0");
143 # print full precision
144 my $str = sprintf "%.40f", $_[0];
145 $str =~ s/0+$//; # remove trailing zeros
150 sub saved { $saved{${$_[0]}} }
151 sub mark_saved { $saved{${$_[0]}} = 1 }
152 sub unmark_saved { $saved{${$_[0]}} = 0 }
154 sub debug { $debug_bc = shift }
156 sub pvix { # save a shared PV (mainly for COPs)
157 return $strtable{$_[0]} if defined($strtable{$_[0]});
158 asmf "newpv %s\n", pvstring($_[0]);
160 $strtable{$_[0]} = $ix;
161 asmf "stpv %d\n", $ix;
167 warn sprintf("bytecode save method for %s (0x%x) not yet implemented\n",
172 # objix may stomp on the op register (for op objects)
173 # or the sv register (for SV objects)
175 sub B::OBJECT::objix {
177 my $ix = $symtable{$$obj};
181 $obj->newix($nextix);
182 return $symtable{$$obj} = $nextix++;
188 asmf "newsv %d\t# %s\n", $sv->FLAGS & SVTYPEMASK, class($sv);
194 my $gvname = $gv->NAME;
195 my $name = cstring($gv->STASH->NAME . "::" . $gvname);
196 asm "gv_fetchpv $name\n";
202 my $name = $hv->NAME;
205 asmf "gv_stashpv %s\n", cstring($name);
208 # It's an ordinary HV. Fall back to ordinary newix method
209 $hv->B::SV::newix($ix);
213 sub B::SPECIAL::newix {
215 # Special case. $$sv is not the address of the SV but an
216 # index into svspecialsv_list.
217 asmf "ldspecsv $$sv\t# %s\n", $specialsv_name[$$sv];
223 my $class = class($op);
224 my $typenum = $optype_enum{$class};
225 croak("OP::newix: can't understand class $class") unless defined($typenum);
226 asm "newop $typenum\t# $class\n";
230 sub B::OP::walkoptree_debug {
232 warn(sprintf("walkoptree: %s\n", peekop($op)));
235 sub B::OP::bytecode {
237 my $next = $op->next;
239 my $sibix = $op->sibling->objix unless $strip_syntree;
241 my $type = $op->type;
243 if ($bypass_nullops) {
244 $next = $next->next while $$next && $next->type == 0;
246 $nextix = $next->objix;
248 asmf "# %s\n", peekop($op) if $debug_bc;
250 asm "op_next $nextix\n";
251 asm "op_sibling $sibix\n" unless $strip_syntree;
252 asmf "op_type %s\t# %d\n", "pp_" . $op->name, $type;
253 asmf("op_seq %d\n", $op->seq) unless $omit_seq;
254 if ($type || !$compress_nullops) {
255 asmf "op_targ %d\nop_flags 0x%x\nop_private 0x%x\n",
256 $op->targ, $op->flags, $op->private;
260 sub B::UNOP::bytecode {
262 my $firstix = $op->first->objix unless $strip_syntree;
263 $op->B::OP::bytecode;
264 if (($op->type || !$compress_nullops) && !$strip_syntree) {
265 asm "op_first $firstix\n";
269 sub B::LOGOP::bytecode {
271 my $otherix = $op->other->objix;
272 $op->B::UNOP::bytecode;
273 asm "op_other $otherix\n";
276 sub B::SVOP::bytecode {
279 my $svix = $sv->objix;
280 $op->B::OP::bytecode;
285 sub B::PADOP::bytecode {
287 my $padix = $op->padix;
288 $op->B::OP::bytecode;
289 asm "op_padix $padix\n";
292 sub B::PVOP::bytecode {
295 $op->B::OP::bytecode;
297 # This would be easy except that OP_TRANS uses a PVOP to store an
298 # endian-dependent array of 256 shorts instead of a plain string.
300 if ($op->name eq "trans") {
301 my @shorts = unpack("s256", $pv); # assembler handles endianness
302 asm "op_pv_tr ", join(",", @shorts), "\n";
304 asmf "newpv %s\nop_pv\n", pvstring($pv);
308 sub B::BINOP::bytecode {
310 my $lastix = $op->last->objix unless $strip_syntree;
311 $op->B::UNOP::bytecode;
312 if (($op->type || !$compress_nullops) && !$strip_syntree) {
313 asm "op_last $lastix\n";
317 sub B::LOOP::bytecode {
319 my $redoopix = $op->redoop->objix;
320 my $nextopix = $op->nextop->objix;
321 my $lastopix = $op->lastop->objix;
322 $op->B::LISTOP::bytecode;
323 asm "op_redoop $redoopix\nop_nextop $nextopix\nop_lastop $lastopix\n";
326 sub B::COP::bytecode {
328 my $file = $op->file;
329 my $line = $op->line;
330 if ($debug_bc) { # do this early to aid debugging
331 asmf "# line %s:%d\n", $file, $line;
333 my $stashpv = $op->stashpv;
334 my $warnings = $op->warnings;
335 my $warningsix = $warnings->objix;
336 my $labelix = pvix($op->label);
337 my $stashix = pvix($stashpv);
338 my $fileix = pvix($file);
340 $op->B::OP::bytecode;
341 asmf <<"EOT", $labelix, $stashix, $op->cop_seq, $fileix, $op->arybase;
348 cop_warnings $warningsix
352 sub B::PMOP::bytecode {
354 my $replroot = $op->pmreplroot;
355 my $replrootix = $replroot->objix;
356 my $replstartix = $op->pmreplstart->objix;
357 my $opname = $op->name;
358 # pmnext is corrupt in some PMOPs (see misc.t for example)
359 #my $pmnextix = $op->pmnext->objix;
362 # OP_PUSHRE (a mutated version of OP_MATCH for the regexp
363 # argument to a split) stores a GV in op_pmreplroot instead
364 # of a substitution syntax tree. We don't want to walk that...
365 if ($opname eq "pushre") {
368 walkoptree($replroot, "bytecode");
371 $op->B::LISTOP::bytecode;
372 if ($opname eq "pushre") {
373 asmf "op_pmreplrootgv $replrootix\n";
375 asm "op_pmreplroot $replrootix\nop_pmreplstart $replstartix\n";
377 my $re = pvstring($op->precomp);
378 # op_pmnext omitted since a perl bug means it's sometime corrupt
379 asmf <<"EOT", $op->pmflags, $op->pmpermflags;
387 sub B::SV::bytecode {
389 return if saved($sv);
391 my $refcnt = $sv->REFCNT;
392 my $flags = sprintf("0x%x", $sv->FLAGS);
394 asm "sv_refcnt $refcnt\nsv_flags $flags\n";
398 sub B::PV::bytecode {
400 return if saved($sv);
401 $sv->B::SV::bytecode;
402 asmf("newpv %s\nxpv\n", pvstring($sv->PV)) if $sv->FLAGS & POK;
405 sub B::IV::bytecode {
407 return if saved($sv);
409 $sv->B::SV::bytecode;
410 asmf "%s $iv\n", $sv->needs64bits ? "xiv64" : "xiv32" if $sv->FLAGS & IOK; # could be PVNV
413 sub B::NV::bytecode {
415 return if saved($sv);
416 $sv->B::SV::bytecode;
417 asmf "xnv %s\n", nv($sv->NVX);
420 sub B::RV::bytecode {
422 return if saved($sv);
424 my $rvix = $rv->objix;
426 $sv->B::SV::bytecode;
430 sub B::PVIV::bytecode {
432 return if saved($sv);
434 $sv->B::PV::bytecode;
435 asmf "%s $iv\n", $sv->needs64bits ? "xiv64" : "xiv32";
438 sub B::PVNV::bytecode {
440 my $flag = shift || 0;
441 # The $flag argument is passed through PVMG::bytecode by BM::bytecode
442 # and AV::bytecode and indicates special handling. $flag = 1 is used by
443 # BM::bytecode and means that we should ensure we save the whole B-M
444 # table. It consists of 257 bytes (256 char array plus a final \0)
445 # which follow the ordinary PV+\0 and the 257 bytes are *not* reflected
446 # in SvCUR. $flag = 2 is used by AV::bytecode and means that we only
447 # call SV::bytecode instead of saving PV and calling NV::bytecode since
448 # PV/NV/IV stuff is different for AVs.
449 return if saved($sv);
451 $sv->B::SV::bytecode;
454 $sv->B::IV::bytecode;
455 asmf "xnv %s\n", nv($sv->NVX);
457 $pv .= "\0" . $sv->TABLE;
458 asmf "newpv %s\npv_cur %d\nxpv\n", pvstring($pv),length($pv)-257;
460 asmf("newpv %s\nxpv\n", pvstring($pv)) if $sv->FLAGS & POK;
465 sub B::PVMG::bytecode {
466 my ($sv, $flag) = @_;
467 # See B::PVNV::bytecode for an explanation of $flag.
468 return if saved($sv);
469 # XXX We assume SvSTASH is already saved and don't save it later ourselves
470 my $stashix = $sv->SvSTASH->objix;
471 my @mgchain = $sv->MAGIC;
474 # We need to traverse the magic chain and get objix for each OBJ
475 # field *before* we do B::PVNV::bytecode since objix overwrites
476 # the sv register. However, we need to write the magic-saving
477 # bytecode *after* B::PVNV::bytecode since sv isn't initialised
478 # to refer to $sv until then.
480 @mgobjix = map($_->OBJ->objix, @mgchain);
481 $sv->B::PVNV::bytecode($flag);
482 asm "xmg_stash $stashix\n";
483 foreach $mg (@mgchain) {
484 asmf "sv_magic %s\nmg_obj %d\nnewpv %s\nmg_pv\n",
485 cstring($mg->TYPE), shift(@mgobjix), pvstring($mg->PTR);
489 sub B::PVLV::bytecode {
491 return if saved($sv);
492 $sv->B::PVMG::bytecode;
493 asmf <<'EOT', $sv->TARGOFF, $sv->TARGLEN, cstring($sv->TYPE);
500 sub B::BM::bytecode {
502 return if saved($sv);
503 # See PVNV::bytecode for an explanation of what the argument does
504 $sv->B::PVMG::bytecode(1);
505 asmf "xbm_useful %d\nxbm_previous %d\nxbm_rare %d\n",
506 $sv->USEFUL, $sv->PREVIOUS, $sv->RARE;
509 sub empty_gv { # is a GV empty except for imported stuff?
512 return 0 if ($gv->SV->FLAGS & SVTYPEMASK); # sv not SVt_NULL
513 my @subfield_names = qw(AV HV CV FORM IO);
514 @subfield_names = grep {;
516 !($gv->GvFLAGS & ${\"GVf_IMPORTED_$_"}->()) && ${$gv->$_()};
518 return scalar @subfield_names;
521 sub B::GV::bytecode {
523 return if saved($gv);
524 return unless grep { $_ eq $gv->STASH->NAME; } @packages;
525 return if $gv->NAME =~ m/^\(/; # ignore overloads - they'll be rebuilt
529 asmf <<"EOT", $gv->FLAGS, $gv->GvFLAGS;
533 my $refcnt = $gv->REFCNT;
534 asmf("sv_refcnt_add %d\n", $refcnt - 1) if $refcnt > 1;
535 return if $gv->is_empty;
536 asmf <<"EOT", $gv->LINE, pvix($gv->FILE);
540 my $gvname = $gv->NAME;
541 my $name = cstring($gv->STASH->NAME . "::" . $gvname);
543 my $egvix = $egv->objix;
544 my $gvrefcnt = $gv->GvREFCNT;
545 asmf("gp_refcnt_add %d\n", $gvrefcnt - 1) if $gvrefcnt > 1;
546 if ($gvrefcnt > 1 && $ix != $egvix) {
547 asm "gp_share $egvix\n";
549 if ($gvname !~ /^([^A-Za-z]|STDIN|STDOUT|STDERR|ARGV|SIG|ENV)$/) {
551 my @subfield_names = qw(SV AV HV CV FORM IO);
552 @subfield_names = grep {;
554 !($gv->GvFLAGS & ${\"GVf_IMPORTED_$_"}->());
556 my @subfields = map($gv->$_(), @subfield_names);
557 my @ixes = map($_->objix, @subfields);
558 # Reset sv register for $gv
560 for ($i = 0; $i < @ixes; $i++) {
561 asmf "gp_%s %d\n", lc($subfield_names[$i]), $ixes[$i];
563 # Now save all the subfields
565 foreach $sv (@subfields) {
572 sub B::HV::bytecode {
574 return if saved($hv);
576 my $name = $hv->NAME;
579 # It's an ordinary HV. Stashes have NAME set and need no further
580 # saving beyond the gv_stashpv that $hv->objix already ensures.
581 my @contents = $hv->ARRAY;
583 for ($i = 1; $i < @contents; $i += 2) {
584 push(@ixes, $contents[$i]->objix);
586 for ($i = 1; $i < @contents; $i += 2) {
587 $contents[$i]->bytecode;
590 for ($i = 0; $i < @contents; $i += 2) {
591 asmf("newpv %s\nhv_store %d\n",
592 pvstring($contents[$i]), $ixes[$i / 2]);
594 asmf "sv_refcnt %d\nsv_flags 0x%x\n", $hv->REFCNT, $hv->FLAGS;
598 sub B::AV::bytecode {
600 return if saved($av);
602 my $fill = $av->FILL;
607 @ixes = map($_->objix, @array);
609 foreach $sv (@array) {
613 # See PVNV::bytecode for the meaning of the flag argument of 2.
614 $av->B::PVMG::bytecode(2);
615 # Recover sv register and set AvMAX and AvFILL to -1 (since we
616 # create an AV with NEWSV and SvUPGRADE rather than doing newAV
617 # which is what sets AvMAX and AvFILL.
619 asmf "sv_flags 0x%x\n", $av->FLAGS & ~SVf_READONLY; # SvREADONLY_off($av) in case PADCONST
620 asmf "xav_flags 0x%x\nxav_max -1\nxav_fill -1\n", $av->AvFLAGS;
623 foreach $elix (@ixes) {
624 asm "av_push $elix\n";
628 asm "av_extend $max\n";
631 asmf "sv_flags 0x%x\n", $av->FLAGS; # restore flags from above
634 sub B::CV::bytecode {
636 return if saved($cv);
637 return if ${$cv->GV} && ($cv->GV->GvFLAGS & GVf_IMPORTED_CV);
638 my $fileix = pvix($cv->FILE);
640 $cv->B::PVMG::bytecode;
642 my @subfield_names = qw(ROOT START STASH GV PADLIST OUTSIDE);
643 my @subfields = map($cv->$_(), @subfield_names);
644 my @ixes = map($_->objix, @subfields);
645 # Save OP tree from CvROOT (first element of @subfields)
646 my $root = shift @subfields;
648 walkoptree($root, "bytecode");
650 # Reset sv register for $cv (since above ->objix calls stomped on it)
652 for ($i = 0; $i < @ixes; $i++) {
653 asmf "xcv_%s %d\n", lc($subfield_names[$i]), $ixes[$i];
655 asmf "xcv_depth %d\nxcv_flags 0x%x\n", $cv->DEPTH, $cv->CvFLAGS;
656 asmf "xcv_file %d\n", $fileix;
657 # Now save all the subfields (except for CvROOT which was handled
658 # above) and CvSTART (now the initial element of @subfields).
659 shift @subfields; # bye-bye CvSTART
661 foreach $sv (@subfields) {
666 sub B::IO::bytecode {
668 return if saved($io);
670 my $top_gv = $io->TOP_GV;
671 my $top_gvix = $top_gv->objix;
672 my $fmt_gv = $io->FMT_GV;
673 my $fmt_gvix = $fmt_gv->objix;
674 my $bottom_gv = $io->BOTTOM_GV;
675 my $bottom_gvix = $bottom_gv->objix;
677 $io->B::PVMG::bytecode;
679 asm "xio_top_gv $top_gvix\n";
680 asm "xio_fmt_gv $fmt_gvix\n";
681 asm "xio_bottom_gv $bottom_gvix\n";
683 foreach $field (qw(TOP_NAME FMT_NAME BOTTOM_NAME)) {
684 asmf "newpv %s\nxio_%s\n", pvstring($io->$field()), lc($field);
686 foreach $field (qw(LINES PAGE PAGE_LEN LINES_LEFT SUBPROCESS)) {
687 asmf "xio_%s %d\n", lc($field), $io->$field();
689 asmf "xio_type %s\nxio_flags 0x%x\n", cstring($io->IoTYPE), $io->IoFLAGS;
692 $bottom_gv->bytecode;
695 sub B::SPECIAL::bytecode {
696 # nothing extra needs doing
699 sub bytecompile_object {
701 svref_2object($sv)->bytecode;
705 sub B::GV::bytecodecv {
708 if ($$cv && !saved($cv) && !($gv->FLAGS & GVf_IMPORTED_CV)) {
710 warn sprintf("saving extra CV &%s::%s (0x%x) from GV 0x%x\n",
711 $gv->STASH->NAME, $gv->NAME, $$cv, $$gv);
717 sub save_call_queues {
718 if (begin_av()->isa("B::AV")) { # this is just to save 'use Foo;' calls
719 for my $cv (begin_av()->ARRAY) {
720 next unless grep { $_ eq $cv->STASH->NAME; } @packages;
724 if ($op->name eq 'require') { # save any BEGIN that does a require
726 asmf "push_begin %d\n", $cv->objix;
733 if (init_av()->isa("B::AV")) {
734 for my $cv (init_av()->ARRAY) {
735 next unless grep { $_ eq $cv->STASH->NAME; } @packages;
737 asmf "push_init %d\n", $cv->objix;
740 if (end_av()->isa("B::AV")) {
741 for my $cv (end_av()->ARRAY) {
742 next unless grep { $_ eq $cv->STASH->NAME; } @packages;
744 asmf "push_end %d\n", $cv->objix;
751 my $ok = 1 if grep { (my $name = $_[0]) =~ s/::$//; $_ eq $name;} @packages;
752 if (grep { /^$_[0]/; } @packages) {
753 walksymtable(\%{"$_[0]"}, "bytecodecv", \&symwalk, $_[0]);
755 warn "considering $_[0] ... " . ($ok ? "accepted\n" : "rejected\n")
760 sub bytecompile_main {
761 my $curpad = (comppadlist->ARRAY)[1];
762 my $curpadix = $curpad->objix;
765 walkoptree(main_root, "bytecode") unless ref(main_root) eq "B::NULL";
766 warn "done main program, now walking symbol table\n" if $debug_bc;
769 walksymtable(\%{"main::"}, "bytecodecv", \&symwalk);
771 die "No packages requested for compilation!\n";
773 asmf "main_root %d\n", main_root->objix;
774 asmf "main_start %d\n", main_start->objix;
775 asmf "curpad $curpadix\n";
776 # XXX Do min_intro_pending and max_intro_pending matter?
781 my ($option, $opt, $arg);
782 open(OUT, ">&STDOUT");
786 while ($option = shift @options) {
787 if ($option =~ /^-(.)(.*)/) {
791 unshift @options, $option;
794 if ($opt eq "-" && $arg eq "-") {
797 } elsif ($opt eq "o") {
798 $arg ||= shift @options;
799 open(OUT, ">$arg") or return "$arg: $!\n";
801 } elsif ($opt eq "a") {
802 $arg ||= shift @options;
803 open(OUT, ">>$arg") or return "$arg: $!\n";
805 } elsif ($opt eq "D") {
806 $arg ||= shift @options;
807 foreach $arg (split(//, $arg)) {
811 } elsif ($arg eq "o") {
813 } elsif ($arg eq "a") {
814 B::Assembler::debug(1);
815 } elsif ($arg eq "C") {
819 } elsif ($opt eq "v") {
821 } elsif ($opt eq "S") {
823 } elsif ($opt eq "f") {
824 $arg ||= shift @options;
825 my $value = $arg !~ s/^no-//;
827 my $ref = $optimise{$arg};
831 warn qq(ignoring unknown optimisation option "$arg"\n);
833 } elsif ($opt eq "O") {
834 $arg = 1 if $arg eq "";
836 foreach $ref (values %optimise) {
843 $compress_nullops = 1;
846 } elsif ($opt eq "u") {
847 $arg ||= shift @options;
848 push @packages, $arg;
850 warn qq(ignoring unknown option "$opt$arg"\n);
854 warn "No package specified for compilation, assuming main::\n";
855 @packages = qw(main);
858 die "Extraneous options left on B::Bytecode commandline: @options\n";
861 newasm(\&apr) unless $no_assemble;
863 endasm() unless $no_assemble;
868 sub apr { print @_; }
876 B::Bytecode - Perl compiler's bytecode backend
880 perl -MO=Bytecode[,OPTIONS] foo.pl
884 This compiler backend takes Perl source and generates a
885 platform-independent bytecode encapsulating code to load the
886 internal structures perl uses to run your program. When the
887 generated bytecode is loaded in, your program is ready to run,
888 reducing the time which perl would have taken to load and parse
889 your program into its internal semi-compiled form. That means that
890 compiling with this backend will not help improve the runtime
891 execution speed of your program but may improve the start-up time.
892 Depending on the environment in which your program runs this may
893 or may not be a help.
895 The resulting bytecode can be run with a special byteperl executable
896 or (for non-main programs) be loaded via the C<byteload_fh> function
901 If there are any non-option arguments, they are taken to be names of
902 objects to be saved (probably doesn't work properly yet). Without
903 extra arguments, it saves the main program.
909 Output to filename instead of STDOUT.
913 Append output to filename.
917 Force end of options.
921 Force optimisations on or off one at a time. Each can be preceded
922 by B<no-> to turn the option off (e.g. B<-fno-compress-nullops>).
924 =item B<-fcompress-nullops>
926 Only fills in the necessary fields of ops which have
927 been optimised away by perl's internal compiler.
929 =item B<-fomit-sequence-numbers>
931 Leaves out code to fill in the op_seq field of all ops
932 which is only used by perl's internal compiler.
934 =item B<-fbypass-nullops>
936 If op->op_next ever points to a NULLOP, replaces the op_next field
937 with the first non-NULLOP in the path of execution.
941 Optimisation level (n = 0, 1, 2, ...). B<-O> means B<-O1>.
942 B<-O1> sets B<-fcompress-nullops> B<-fomit-sequence numbers>.
943 B<-O2> adds B<-fbypass-nullops>.
947 Debug options (concatenated or separate flags like C<perl -D>).
951 Prints each OP as it's processed.
955 Print debugging information about bytecompiler progress.
959 Tells the (bytecode) assembler to include source assembler lines
960 in its output as bytecode comments.
964 Prints each CV taken from the final symbol tree walk.
968 Output (bytecode) assembler source rather than piping it
969 through the assembler and outputting bytecode.
973 Stores package in the output.
979 perl -MO=Bytecode,-O6,-ofoo.plc,-umain foo.pl
981 perl -MO=Bytecode,-S,-umain foo.pl > foo.S
982 assemble foo.S > foo.plc
984 Note that C<assemble> lives in the C<B> subdirectory of your perl
985 library directory. The utility called perlcc may also be used to
986 help make use of this compiler.
988 perl -MO=Bytecode,-uFoo,-oFoo.pmc Foo.pm
992 Output is still huge and there are still occasional crashes during
993 either compilation or ByteLoading. Current status: experimental.
997 Malcolm Beattie, C<mbeattie@sable.ox.ac.uk>
998 Benjamin Stuhl, C<sho_pi@hotmail.com>