Author: pmichaud
Date: Tue Aug 19 05:37:27 2008
New Revision: 30331
Modified:
branches/rakpbc/languages/perl6/src/parser/actions.pm
Log:
[rakudo]: running load_bytecode on a precompiled perl6 file runs the mainline
Modified: branches/rakpbc/languages/perl6/src/parser/actions.pm
==============================================================================
--- branches/rakpbc/languages/perl6/src/parser/actions.pm (original)
+++ branches/rakpbc/languages/perl6/src/parser/actions.pm Tue Aug 19
05:37:27 2008
@@ -29,6 +29,23 @@
# Make sure we have the interpinfo constants.
$past.unshift( PAST::Op.new( :inline('.include "interpinfo.pasm"') ) );
+ # convert the last operation of the block into a .return op
+ # so that :load block below isn't used as return value
+ $past.push( PAST::Op.new( $past.pop(), :pirop('return') ) );
+ # automatically invoke mainline on :load (but not :init)
+ $past.push(
+ PAST::Block.new(
+ PAST::Op.new(
+ :inline(
+ '$P0 = interpinfo .INTERPINFO_CURRENT_SUB',
+ '$P0 = $P0."get_outer"()',
+ '$P0()'
+ )
+ ),
+ :pirflags(':load')
+ )
+ );
+
make $past;
}