#undef pp_mapstart
#define pp_mapstart pp_grepstart
+#if PATCHLEVEL < 4
+#define vivify_ref(sv, to_what) provide_ref(op, sv)
+#endif
+
static void xs_init _((void));
static PerlInterpreter *my_perl;
EOT
sub OPpLVAL_INTRO () { 128 }
sub OPpDEREF_AV () { 32 }
sub OPpDEREF_HV () { 64 }
+sub OPpDEREF () { OPpDEREF_AV|OPpDEREF_HV }
sub OPpFLIP_LINENUM () { 64 }
sub G_ARRAY () { 1 }
# cop.h
my %optimise = (freetmps_each_bblock => \$freetmps_each_bblock,
freetmps_each_loop => \$freetmps_each_loop,
omit_taint => \$omit_taint);
+# perl patchlevel to generate code for (defaults to current patchlevel)
+my $patchlevel = int(0.5 + 1000 * ($] - 5));
# Could rewrite push_runtime() and output_runtime() to use a
# temporary file if memory is at a premium.
my $private = $op->private;
if ($private & OPpLVAL_INTRO) {
runtime("SAVECLEARSV(curpad[$ix]);");
- } elsif ($private & (OPpDEREF_HV|OPpDEREF_AV)) {
- loadop($op);
- runtime("provide_ref(op, curpad[$ix]);");
+ } elsif ($private & OPpDEREF) {
+ loadop($op) if $patchlevel < 4;
+ runtime(sprintf("vivify_ref(curpad[%d], %d);",
+ $ix, $private & OPpDEREF));
$pad[$ix]->invalidate;
}
}
$arg ||= shift @options;
$module = $arg;
push(@unused_sub_packages, $arg);
+ } elsif ($opt eq "p") {
+ $arg ||= shift @options;
+ $patchlevel = $arg;
} elsif ($opt eq "D") {
$arg ||= shift @options;
foreach $arg (split(//, $arg)) {
boot_Modulename function (which DynaLoader can look
for) does the appropriate initialisation and runs the
main part of the Perl source that is being compiled.
+ -pn Generate code for perl patchlevel n (e.g. 3 or 4).
+ The default is to generate C code which will link
+ with the currently executing version of perl.
+ running the perl compiler.
-D Debug options (concat or separate flags like perl -D)
r Writes debugging output to STDERR just as it's about
to write to the program's runtime (otherwise writes