develooper Front page | perl.perl5.porters | Postings from August 2001

RE: [PATCH] [ID 20010813.010] List::Util::first fails on Array ofArr ayrefs

Thread Previous | Thread Next
Wilson, Doug
August 17, 2001 13:58
RE: [PATCH] [ID 20010813.010] List::Util::first fails on Array ofArr ayrefs
Message ID:

> From: Graham Barr

> I think this patch is just hiding the problem in this particular
> case. I think there is a problem with how the stack is being
> handled. Try this, it fails both before and after the patch
> sub add {
>   my($aa, $bb) = @_;
> #warn join(",",@_);
>   return $aa + $bb;
> }
> my $sum = reduce { print "$a $b\n"; 0+add($a, $b) } 3, 2, 1;

I think you're right. After the print, pp_nextstate is called
again, and then the top of the stack is set to
the bottom of the stack, and the problem rears its ugly head
again. I manually reset the stack pointer to what it was supposed
to be while debugging, and got the correct output.

Now I'm thinking that pp_nextstate maybe IS the correct op, but that
on this line in pp_nextstate:
PL_stack_sp = PL_stack_base + cxstack[cxstack_ix].blk_oldsp;

the blk_oldsp is not set correctly. It looks like blk_oldsp is
updated through PUSHBLOCK, which is called in the pp_enter or pp_entersub
ops, and so shouldn't one of these be called before (or instead of?)
pp_nextstate when
we start calling the code block (it makes sense, we are entering a new
block, eh)?

I'm not sure how to get this to happen (let alone how to get it to happen
correctly) yet, its getting beyond my novice internals expertise :)

-Douglas Wilson

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About