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.
12 use B qw(main_cv main_root main_start comppadlist
13 class peekop walkoptree svref_2object cstring walksymtable
14 init_av begin_av end_av
15 SVf_POK SVp_POK SVf_IOK SVp_IOK SVf_NOK SVp_NOK
16 SVf_READONLY GVf_IMPORTED_AV GVf_IMPORTED_CV GVf_IMPORTED_HV
19 use B::Asmdata qw(@optype @specialsv_name);
20 use B::Assembler qw(assemble_fh);
24 for ($i = 0; $i < @optype; $i++) {
25 $optype_enum{$optype[$i]} = $i;
28 # Following is SVf_POK|SVp_POK
29 # XXX Shouldn't be hardwired
30 sub POK () { SVf_POK|SVp_POK }
32 # Following is SVf_IOK|SVp_IOK
33 # XXX Shouldn't be hardwired
34 sub IOK () { SVf_IOK|SVp_IOK }
36 # Following is SVf_NOK|SVp_NOK
37 # XXX Shouldn't be hardwired
38 sub NOK () { SVf_NOK|SVp_NOK }
39 # nonexistant flags (see B::GV::bytecode for usage)
40 sub GVf_IMPORTED_IO () { 0; }
41 sub GVf_IMPORTED_FORM () { 0; }
42 my ($verbose, $module_only, $no_assemble, $debug_bc, $debug_cv);
45 my @packages; # list of packages to compile
46 # Optimisation options. On the command line, use hyphens instead of
47 # underscores for compatibility with gcc-style options. We use
48 # underscores here because they are OK in (strict) barewords.
49 my ($strip_syntree, $compress_nullops, $omit_seq, $bypass_nullops);
50 my %optimise = (strip_syntax_tree => \$strip_syntree,
51 compress_nullops => \$compress_nullops,
52 omit_sequence_numbers => \$omit_seq,
53 bypass_nullops => \$bypass_nullops);
56 my %symtable; # maps object addresses to object indices.
57 # Filled in at allocation (newsv/newop) time.
58 my %saved; # maps object addresses (for SVish classes) to "saved yet?"
59 # flag. Set at FOO::bytecode time usually by SV::bytecode.
60 # Manipulated via saved(), mark_saved(), unmark_saved().
62 my $svix = -1; # we keep track of when the sv register contains an element
63 # of the object table to avoid unnecessary repeated
64 # consecutive ldsv instructions.
65 my $opix = -1; # Ditto for the op register.
106 return cstring($str . "\0");
113 # print full precision
114 my $str = sprintf "%.40f", $_[0];
117 sub saved { $saved{${$_[0]}} }
118 sub mark_saved { $saved{${$_[0]}} = 1 }
119 sub unmark_saved { $saved{${$_[0]}} = 0 }
121 sub debug { $debug_bc = shift }
125 warn sprintf("bytecode save method for %s (0x%x) not yet implemented\n",
130 # objix may stomp on the op register (for op objects)
131 # or the sv register (for SV objects)
133 sub B::OBJECT::objix {
135 my $ix = $symtable{$$obj};
139 $obj->newix($nextix);
140 return $symtable{$$obj} = $nextix++;
146 printf "newsv %d\t# %s\n", $sv->FLAGS & 0xf, class($sv);
152 my $gvname = $gv->NAME;
153 my $name = cstring($gv->STASH->NAME . "::" . $gvname);
154 print "gv_fetchpv $name\n";
160 my $name = $hv->NAME;
163 printf "gv_stashpv %s\n", cstring($name);
166 # It's an ordinary HV. Fall back to ordinary newix method
167 $hv->B::SV::newix($ix);
171 sub B::SPECIAL::newix {
173 # Special case. $$sv is not the address of the SV but an
174 # index into svspecialsv_list.
175 printf "ldspecsv $$sv\t# %s\n", $specialsv_name[$$sv];
181 my $class = class($op);
182 my $typenum = $optype_enum{$class};
183 require('Carp.pm'), Carp::croak("OP::newix: can't understand class $class")
184 unless defined($typenum);
185 print "newop $typenum\t# $class\n";
189 sub B::OP::walkoptree_debug {
191 warn(sprintf("walkoptree: %s\n", peekop($op)));
194 sub B::OP::bytecode {
196 my $next = $op->next;
198 my $sibix = $op->sibling->objix unless $strip_syntree;
200 my $type = $op->type;
202 if ($bypass_nullops) {
203 $next = $next->next while $$next && $next->type == 0;
205 $nextix = $next->objix;
207 printf "# %s\n", peekop($op) if $debug_bc;
209 print "op_next $nextix\n";
210 print "op_sibling $sibix\n" unless $strip_syntree;
211 printf "op_type %s\t# %d\n", "pp_" . $op->name, $type;
212 printf("op_seq %d\n", $op->seq) unless $omit_seq;
213 if ($type || !$compress_nullops) {
214 printf "op_targ %d\nop_flags 0x%x\nop_private 0x%x\n",
215 $op->targ, $op->flags, $op->private;
219 sub B::UNOP::bytecode {
221 my $firstix = $op->first->objix unless $strip_syntree;
222 $op->B::OP::bytecode;
223 if (($op->type || !$compress_nullops) && !$strip_syntree) {
224 print "op_first $firstix\n";
228 sub B::LOGOP::bytecode {
230 my $otherix = $op->other->objix;
231 $op->B::UNOP::bytecode;
232 print "op_other $otherix\n";
235 sub B::SVOP::bytecode {
238 my $svix = $sv->objix;
239 $op->B::OP::bytecode;
240 print "op_sv $svix\n";
244 sub B::PADOP::bytecode {
246 my $padix = $op->padix;
247 $op->B::OP::bytecode;
248 print "op_padix $padix\n";
251 sub B::PVOP::bytecode {
254 $op->B::OP::bytecode;
256 # This would be easy except that OP_TRANS uses a PVOP to store an
257 # endian-dependent array of 256 shorts instead of a plain string.
259 if ($op->name eq "trans") {
260 my @shorts = unpack("s256", $pv); # assembler handles endianness
261 print "op_pv_tr ", join(",", @shorts), "\n";
263 printf "newpv %s\nop_pv\n", pvstring($pv);
267 sub B::BINOP::bytecode {
269 my $lastix = $op->last->objix unless $strip_syntree;
270 $op->B::UNOP::bytecode;
271 if (($op->type || !$compress_nullops) && !$strip_syntree) {
272 print "op_last $lastix\n";
276 sub B::LISTOP::bytecode {
278 my $children = $op->children unless $strip_syntree;
279 $op->B::BINOP::bytecode;
280 if (($op->type || !$compress_nullops) && !$strip_syntree) {
281 print "op_children $children\n";
285 sub B::LOOP::bytecode {
287 my $redoopix = $op->redoop->objix;
288 my $nextopix = $op->nextop->objix;
289 my $lastopix = $op->lastop->objix;
290 $op->B::LISTOP::bytecode;
291 print "op_redoop $redoopix\nop_nextop $nextopix\nop_lastop $lastopix\n";
294 sub B::COP::bytecode {
296 my $file = $op->file;
297 my $line = $op->line;
298 if ($debug_bc) { # do this early to aid debugging
299 printf "# line %s:%d\n", $file, $line;
301 my $stashpv = $op->stashpv;
302 my $warnings = $op->warnings;
304 $warningsix = $warnings->objix;
306 $op->B::OP::bytecode;
307 printf <<"EOT", pvstring($op->label), pvstring($stashpv), $op->cop_seq, pvstring($file), $op->arybase;
317 cop_warnings $warningsix
321 sub B::PMOP::bytecode {
323 my $replroot = $op->pmreplroot;
324 my $replrootix = $replroot->objix;
325 my $replstartix = $op->pmreplstart->objix;
326 my $opname = $op->name;
327 # pmnext is corrupt in some PMOPs (see misc.t for example)
328 #my $pmnextix = $op->pmnext->objix;
331 # OP_PUSHRE (a mutated version of OP_MATCH for the regexp
332 # argument to a split) stores a GV in op_pmreplroot instead
333 # of a substitution syntax tree. We don't want to walk that...
334 if ($opname eq "pushre") {
337 walkoptree($replroot, "bytecode");
340 $op->B::LISTOP::bytecode;
341 if ($opname eq "pushre") {
342 printf "op_pmreplrootgv $replrootix\n";
344 print "op_pmreplroot $replrootix\nop_pmreplstart $replstartix\n";
346 my $re = pvstring($op->precomp);
347 # op_pmnext omitted since a perl bug means it's sometime corrupt
348 printf <<"EOT", $op->pmflags, $op->pmpermflags;
356 sub B::SV::bytecode {
358 return if saved($sv);
360 my $refcnt = $sv->REFCNT;
361 my $flags = sprintf("0x%x", $sv->FLAGS);
363 print "sv_refcnt $refcnt\nsv_flags $flags\n";
367 sub B::PV::bytecode {
369 return if saved($sv);
370 $sv->B::SV::bytecode;
371 printf("newpv %s\nxpv\n", pvstring($sv->PV)) if $sv->FLAGS & POK;
374 sub B::IV::bytecode {
376 return if saved($sv);
378 $sv->B::SV::bytecode;
379 printf "%s $iv\n", $sv->needs64bits ? "xiv64" : "xiv32" if $sv->FLAGS & IOK; # could be PVNV
382 sub B::NV::bytecode {
384 return if saved($sv);
385 $sv->B::SV::bytecode;
386 printf "xnv %s\n", nv($sv->NVX);
389 sub B::RV::bytecode {
391 return if saved($sv);
393 my $rvix = $rv->objix;
395 $sv->B::SV::bytecode;
399 sub B::PVIV::bytecode {
401 return if saved($sv);
403 $sv->B::PV::bytecode;
404 printf "%s $iv\n", $sv->needs64bits ? "xiv64" : "xiv32";
407 sub B::PVNV::bytecode {
409 my $flag = shift || 0;
410 # The $flag argument is passed through PVMG::bytecode by BM::bytecode
411 # and AV::bytecode and indicates special handling. $flag = 1 is used by
412 # BM::bytecode and means that we should ensure we save the whole B-M
413 # table. It consists of 257 bytes (256 char array plus a final \0)
414 # which follow the ordinary PV+\0 and the 257 bytes are *not* reflected
415 # in SvCUR. $flag = 2 is used by AV::bytecode and means that we only
416 # call SV::bytecode instead of saving PV and calling NV::bytecode since
417 # PV/NV/IV stuff is different for AVs.
418 return if saved($sv);
420 $sv->B::SV::bytecode;
423 $sv->B::IV::bytecode;
424 printf "xnv %s\n", nv($sv->NVX);
426 $pv .= "\0" . $sv->TABLE;
427 printf "newpv %s\npv_cur %d\nxpv\n", pvstring($pv),length($pv)-257;
429 printf("newpv %s\nxpv\n", pvstring($pv)) if $sv->FLAGS & POK;
434 sub B::PVMG::bytecode {
435 my ($sv, $flag) = @_;
436 # See B::PVNV::bytecode for an explanation of $flag.
437 return if saved($sv);
438 # XXX We assume SvSTASH is already saved and don't save it later ourselves
439 my $stashix = $sv->SvSTASH->objix;
440 my @mgchain = $sv->MAGIC;
443 # We need to traverse the magic chain and get objix for each OBJ
444 # field *before* we do B::PVNV::bytecode since objix overwrites
445 # the sv register. However, we need to write the magic-saving
446 # bytecode *after* B::PVNV::bytecode since sv isn't initialised
447 # to refer to $sv until then.
449 @mgobjix = map($_->OBJ->objix, @mgchain);
450 $sv->B::PVNV::bytecode($flag);
451 print "xmg_stash $stashix\n";
452 foreach $mg (@mgchain) {
453 printf "sv_magic %s\nmg_obj %d\nnewpv %s\nmg_pv\n",
454 cstring($mg->TYPE), shift(@mgobjix), pvstring($mg->PTR);
458 sub B::PVLV::bytecode {
460 return if saved($sv);
461 $sv->B::PVMG::bytecode;
462 printf <<'EOT', $sv->TARGOFF, $sv->TARGLEN, cstring($sv->TYPE);
469 sub B::BM::bytecode {
471 return if saved($sv);
472 # See PVNV::bytecode for an explanation of what the argument does
473 $sv->B::PVMG::bytecode(1);
474 printf "xbm_useful %d\nxbm_previous %d\nxbm_rare %d\n",
475 $sv->USEFUL, $sv->PREVIOUS, $sv->RARE;
478 sub B::GV::bytecode {
480 return if saved($gv);
481 return unless grep { $_ eq $gv->STASH->NAME; } @packages;
485 printf <<"EOT", $gv->FLAGS, $gv->GvFLAGS;
489 my $refcnt = $gv->REFCNT;
490 printf("sv_refcnt_add %d\n", $refcnt - 1) if $refcnt > 1;
491 return if $gv->is_empty;
492 printf <<"EOT", $gv->LINE, pvstring($gv->FILE);
497 my $gvname = $gv->NAME;
498 my $name = cstring($gv->STASH->NAME . "::" . $gvname);
500 my $egvix = $egv->objix;
501 my $gvrefcnt = $gv->GvREFCNT;
502 printf("gp_refcnt_add %d\n", $gvrefcnt - 1) if $gvrefcnt > 1;
503 if ($gvrefcnt > 1 && $ix != $egvix) {
504 print "gp_share $egvix\n";
506 if ($gvname !~ /^([^A-Za-z]|STDIN|STDOUT|STDERR|ARGV|SIG|ENV)$/) {
508 my @subfield_names = qw(SV AV HV CV FORM IO);
509 @subfield_names = grep {;
511 !($gv->GvFLAGS & ${\"GVf_IMPORTED_$_"}->());
513 my @subfields = map($gv->$_(), @subfield_names);
514 my @ixes = map($_->objix, @subfields);
515 # Reset sv register for $gv
517 for ($i = 0; $i < @ixes; $i++) {
518 printf "gp_%s %d\n", lc($subfield_names[$i]), $ixes[$i];
520 # Now save all the subfields
522 foreach $sv (@subfields) {
529 sub B::HV::bytecode {
531 return if saved($hv);
533 my $name = $hv->NAME;
535 printf "sv_refcnt %d\nsv_flags 0x%x\n", $hv->REFCNT, $hv->FLAGS;
537 # It's an ordinary HV. Stashes have NAME set and need no further
538 # saving beyond the gv_stashpv that $hv->objix already ensures.
539 my @contents = $hv->ARRAY;
541 for ($i = 1; $i < @contents; $i += 2) {
542 push(@ixes, $contents[$i]->objix);
544 for ($i = 1; $i < @contents; $i += 2) {
545 $contents[$i]->bytecode;
548 for ($i = 0; $i < @contents; $i += 2) {
549 printf("newpv %s\nhv_store %d\n",
550 pvstring($contents[$i]), $ixes[$i / 2]);
555 sub B::AV::bytecode {
557 return if saved($av);
559 my $fill = $av->FILL;
564 @ixes = map($_->objix, @array);
566 foreach $sv (@array) {
570 # See PVNV::bytecode for the meaning of the flag argument of 2.
571 $av->B::PVMG::bytecode(2);
572 # Recover sv register and set AvMAX and AvFILL to -1 (since we
573 # create an AV with NEWSV and SvUPGRADE rather than doing newAV
574 # which is what sets AvMAX and AvFILL.
576 printf "sv_flags 0x%x\n", $av->FLAGS & ~SVf_READONLY; # SvREADONLY_off($av) in case PADCONST
577 printf "xav_flags 0x%x\nxav_max -1\nxav_fill -1\n", $av->AvFLAGS;
580 foreach $elix (@ixes) {
581 print "av_push $elix\n";
585 print "av_extend $max\n";
588 printf "sv_flags 0x%x\n", $av->FLAGS; # restore flags from above
591 sub B::CV::bytecode {
593 return if saved($cv);
594 return if ${$cv->GV} && ($cv->GV->GvFLAGS & GVf_IMPORTED_CV);
596 $cv->B::PVMG::bytecode;
598 my @subfield_names = qw(ROOT START STASH GV PADLIST OUTSIDE);
599 my @subfields = map($cv->$_(), @subfield_names);
600 my @ixes = map($_->objix, @subfields);
601 # Save OP tree from CvROOT (first element of @subfields)
602 my $root = shift @subfields;
604 walkoptree($root, "bytecode");
606 # Reset sv register for $cv (since above ->objix calls stomped on it)
608 for ($i = 0; $i < @ixes; $i++) {
609 printf "xcv_%s %d\n", lc($subfield_names[$i]), $ixes[$i];
611 printf "xcv_depth %d\nxcv_flags 0x%x\n", $cv->DEPTH, $cv->CvFLAGS;
612 printf "newpv %s\nxcv_file\n", pvstring($cv->FILE);
613 # Now save all the subfields (except for CvROOT which was handled
614 # above) and CvSTART (now the initial element of @subfields).
615 shift @subfields; # bye-bye CvSTART
617 foreach $sv (@subfields) {
622 sub B::IO::bytecode {
624 return if saved($io);
626 my $top_gv = $io->TOP_GV;
627 my $top_gvix = $top_gv->objix;
628 my $fmt_gv = $io->FMT_GV;
629 my $fmt_gvix = $fmt_gv->objix;
630 my $bottom_gv = $io->BOTTOM_GV;
631 my $bottom_gvix = $bottom_gv->objix;
633 $io->B::PVMG::bytecode;
635 print "xio_top_gv $top_gvix\n";
636 print "xio_fmt_gv $fmt_gvix\n";
637 print "xio_bottom_gv $bottom_gvix\n";
639 foreach $field (qw(TOP_NAME FMT_NAME BOTTOM_NAME)) {
640 printf "newpv %s\nxio_%s\n", pvstring($io->$field()), lc($field);
642 foreach $field (qw(LINES PAGE PAGE_LEN LINES_LEFT SUBPROCESS)) {
643 printf "xio_%s %d\n", lc($field), $io->$field();
645 printf "xio_type %s\nxio_flags 0x%x\n", cstring($io->IoTYPE), $io->IoFLAGS;
648 $bottom_gv->bytecode;
651 sub B::SPECIAL::bytecode {
652 # nothing extra needs doing
655 sub bytecompile_object {
657 svref_2object($sv)->bytecode;
661 sub B::GV::bytecodecv {
664 if ($$cv && !saved($cv)) {
666 warn sprintf("saving extra CV &%s::%s (0x%x) from GV 0x%x\n",
667 $gv->STASH->NAME, $gv->NAME, $$cv, $$gv);
673 sub save_call_queues {
674 if (ref(begin_av()) eq "B::AV") { # this is just to save 'use Foo;' calls
675 for my $cv (begin_av->ARRAY) {
676 my $name = $cv->STASH->NAME;
677 next unless grep { $_ eq $name } @packages;
679 $op = $op->next while ($$op && ref $op ne "B::UNOP");
680 if ($$op && $op->name eq 'require') { # should be first UNOP
682 printf "push_begin %d\n", $cv->objix;
686 if (ref(init_av()) eq "B::AV") {
687 for my $cv (init_av->ARRAY) {
688 next unless grep { $_ eq $cv->STASH->NAME } @packages;
690 printf "push_init %d\n", $cv->objix;
693 if (ref(end_av()) eq "B::AV") {
694 for my $cv (end_av->ARRAY) {
695 next unless grep { $_ eq $cv->STASH->NAME } @packages;
697 printf "push_end %d\n", $cv->objix;
704 my $ok = 1 if grep { (my $name = $_[0]) =~ s/::$//; $_ eq $name;} @packages;
705 if (grep { /^$_[0]/; } @packages) {
706 walksymtable(\%{"$_[0]"}, "bytecodecv", \&symwalk, $_[0]);
708 warn "considering $_[0] ... " . ($ok ? "accepted\n" : "rejected\n")
713 sub bytecompile_main {
714 my $curpad = (comppadlist->ARRAY)[1];
715 my $curpadix = $curpad->objix;
717 walkoptree(main_root, "bytecode") unless ref(main_root) eq "B::NULL";
718 warn "done main program, now walking symbol table\n" if $debug_bc;
722 walksymtable(\%{"main::"}, "bytecodecv", \&symwalk);
724 die "No packages requested for compilation!\n";
727 printf "main_root %d\n", main_root->objix;
728 printf "main_start %d\n", main_start->objix;
729 printf "curpad $curpadix\n";
730 # XXX Do min_intro_pending and max_intro_pending matter?
733 sub prepare_assemble {
734 my $newfh = IO::File->new_tmpfile;
742 seek($fh, 0, 0); # rewind the temporary file
743 assemble_fh($fh, sub { print OUT @_ });
748 my ($option, $opt, $arg);
749 open(OUT, ">&STDOUT");
753 while ($option = shift @options) {
754 if ($option =~ /^-(.)(.*)/) {
758 unshift @options, $option;
761 if ($opt eq "-" && $arg eq "-") {
764 } elsif ($opt eq "o") {
765 $arg ||= shift @options;
766 open(OUT, ">$arg") or return "$arg: $!\n";
768 } elsif ($opt eq "a") {
769 $arg ||= shift @options;
770 open(OUT, ">>$arg") or return "$arg: $!\n";
772 } elsif ($opt eq "D") {
773 $arg ||= shift @options;
774 foreach $arg (split(//, $arg)) {
778 } elsif ($arg eq "o") {
780 } elsif ($arg eq "a") {
781 B::Assembler::debug(1);
782 } elsif ($arg eq "C") {
786 } elsif ($opt eq "v") {
788 } elsif ($opt eq "m") { # XXX: NOP
790 } elsif ($opt eq "S") {
792 } elsif ($opt eq "f") {
793 $arg ||= shift @options;
794 my $value = $arg !~ s/^no-//;
796 my $ref = $optimise{$arg};
800 warn qq(ignoring unknown optimisation option "$arg"\n);
802 } elsif ($opt eq "O") {
803 $arg = 1 if $arg eq "";
805 foreach $ref (values %optimise) {
815 $compress_nullops = 1;
818 } elsif ($opt eq "P") {
819 $arg ||= shift @options;
820 push @packages, $arg;
824 warn "No package specified for compilation, assuming main::\n";
825 @packages = qw(main);
827 if (@options) { # XXX: unsupported and untested!
831 $newfh = prepare_assemble() unless $no_assemble;
832 foreach $objname (@options) {
833 eval "bytecompile_object(\\$objname)";
835 do_assemble($newfh) unless $no_assemble;
840 $newfh = prepare_assemble() unless $no_assemble;
842 do_assemble($newfh) unless $no_assemble;
853 B::Bytecode - Perl compiler's bytecode backend
857 perl -MO=Bytecode[,OPTIONS] foo.pl
861 This compiler backend takes Perl source and generates a
862 platform-independent bytecode encapsulating code to load the
863 internal structures perl uses to run your program. When the
864 generated bytecode is loaded in, your program is ready to run,
865 reducing the time which perl would have taken to load and parse
866 your program into its internal semi-compiled form. That means that
867 compiling with this backend will not help improve the runtime
868 execution speed of your program but may improve the start-up time.
869 Depending on the environment in which your program runs this may
870 or may not be a help.
872 The resulting bytecode can be run with a special byteperl executable
873 or (for non-main programs) be loaded via the C<byteload_fh> function
878 If there are any non-option arguments, they are taken to be names of
879 objects to be saved (probably doesn't work properly yet). Without
880 extra arguments, it saves the main program.
886 Output to filename instead of STDOUT.
890 Append output to filename.
894 Force end of options.
898 Force optimisations on or off one at a time. Each can be preceded
899 by B<no-> to turn the option off (e.g. B<-fno-compress-nullops>).
901 =item B<-fcompress-nullops>
903 Only fills in the necessary fields of ops which have
904 been optimised away by perl's internal compiler.
906 =item B<-fomit-sequence-numbers>
908 Leaves out code to fill in the op_seq field of all ops
909 which is only used by perl's internal compiler.
911 =item B<-fbypass-nullops>
913 If op->op_next ever points to a NULLOP, replaces the op_next field
914 with the first non-NULLOP in the path of execution.
916 =item B<-fstrip-syntax-tree>
918 Leaves out code to fill in the pointers which link the internal syntax
919 tree together. They're not needed at run-time but leaving them out
920 will make it impossible to recompile or disassemble the resulting
921 program. It will also stop C<goto label> statements from working.
925 Optimisation level (n = 0, 1, 2, ...). B<-O> means B<-O1>.
926 B<-O1> sets B<-fcompress-nullops> B<-fomit-sequence numbers>.
927 B<-O6> adds B<-fstrip-syntax-tree>.
931 Debug options (concatenated or separate flags like C<perl -D>).
935 Prints each OP as it's processed.
939 Print debugging information about bytecompiler progress.
943 Tells the (bytecode) assembler to include source assembler lines
944 in its output as bytecode comments.
948 Prints each CV taken from the final symbol tree walk.
952 Output (bytecode) assembler source rather than piping it
953 through the assembler and outputting bytecode.
957 Stores package in the output.
963 perl -MO=Bytecode,-O6,-ofoo.plc,-Pmain foo.pl
965 perl -MO=Bytecode,-S,-Pmain foo.pl > foo.S
966 assemble foo.S > foo.plc
968 Note that C<assemble> lives in the C<B> subdirectory of your perl
969 library directory. The utility called perlcc may also be used to
970 help make use of this compiler.
972 perl -MO=Bytecode,-PFoo,-oFoo.pmc Foo.pm
976 Output is still huge and there are still occasional crashes during
977 either compilation or ByteLoading. Current status: experimental.
981 Malcolm Beattie, C<mbeattie@sable.ox.ac.uk>
982 Benjamin Stuhl, C<sho_pi@hotmail.com>