@@ -1512,7 +1512,7 @@ sub as_output_code {
1512
1512
# OUTPUT:
1513
1513
# RETVAL output_code
1514
1514
print " \t $output_code \n " ;
1515
- print " \t ++SP;\n " if $pxs -> {xsub_stack_was_reset };
1515
+ print " \t ++SP;\n " if $xbody -> {output_part }{ stack_was_reset };
1516
1516
return ;
1517
1517
}
1518
1518
@@ -1737,7 +1737,7 @@ sub as_output_code {
1737
1737
}
1738
1738
1739
1739
print @lines ;
1740
- print " \t ++SP;\n " if $pxs -> {xsub_stack_was_reset };
1740
+ print " \t ++SP;\n " if $xbody -> {output_part }{ stack_was_reset };
1741
1741
}
1742
1742
1743
1743
@@ -2365,8 +2365,6 @@ sub parse {
2365
2365
2366
2366
$self -> SUPER::parse($pxs ); # set file/line_no
2367
2367
2368
- $pxs -> {xsub_stack_was_reset } = 0; # XSprePUSH not yet emitted
2369
-
2370
2368
# Process any implicit INPUT section.
2371
2369
{
2372
2370
my $input = ExtUtils::ParseXS::Node::INPUT-> new();
@@ -2587,6 +2585,9 @@ BEGIN { $build_subclass->('', # parent
2587
2585
2588
2586
' targ_used' , # Bool: the TARG has been allocated for this body,
2589
2587
# so is no longer available for use.
2588
+
2589
+ ' stack_was_reset' , # Bool: An XSprePUSH was emitted, so return values
2590
+ # should be PUSHed rather than just set.
2590
2591
)};
2591
2592
2592
2593
@@ -2621,6 +2622,9 @@ sub as_code {
2621
2622
# TARG is available for use within this body.
2622
2623
$self -> {targ_used } = 0;
2623
2624
2625
+ # SP still pointing at top arg
2626
+ $self -> {stack_was_reset } = 0;
2627
+
2624
2628
if ($self -> {kids }) {
2625
2629
$_ -> as_code($pxs , $xsub , $xbody ) for @{$self -> {kids }};
2626
2630
}
@@ -2658,7 +2662,7 @@ sub as_code {
2658
2662
# If there are any OUTLIST vars to be returned, we reset SP to
2659
2663
# the base of the stack frame and then PUSH any return values.
2660
2664
print " \t XSprePUSH;\n " ;
2661
- $pxs -> {xsub_stack_was_reset } = 1;
2665
+ $self -> {stack_was_reset } = 1;
2662
2666
}
2663
2667
2664
2668
# Extend the stack if we're going to return more values than were
0 commit comments