# New Ticket Created by Jason Gloudon
# Please include the string: [perl #18127]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=18127 >
Here is what I suggested in a previous email. Always walk the stack in the same
direction, regardless of the direction in which it grows. PARROT_STACK_DIR is
not used.
Non-contiguous stack systems will have to use an entirely different version of
the stack walking function. This is left as an exercise for the reader.
--
Jason
-- attachment 1 ------------------------------------------------------
url: http://rt.perl.org/rt2/attach/40655/32777/3abb22/dod.patch
Index: dod.c
===================================================================
RCS file: /cvs/public/parrot/dod.c,v
retrieving revision 1.24
diff -u -r1.24 dod.c
--- dod.c 23 Oct 2002 05:27:01 -0000 1.24
+++ dod.c 25 Oct 2002 21:55:24 -0000
@@ -460,7 +460,7 @@
{
size_t lo_var_ptr = (size_t)interpreter->lo_var_ptr;
size_t hi_var_ptr = (size_t)&lo_var_ptr;
- size_t prefix;
+ size_t prefix, tmp_ptr;
ptrdiff_t cur_var_ptr;
size_t buffer_min = get_min_buffer_address(interpreter);
@@ -471,6 +471,12 @@
size_t mask = find_common_mask(buffer_min < pmc_min ? buffer_min: pmc_min,
buffer_max > pmc_max ? buffer_max : pmc_max);
+ if(lo_var_ptr > hi_var_ptr){
+ tmp_ptr = hi_var_ptr;
+ hi_var_ptr = lo_var_ptr;
+ lo_var_ptr = tmp_ptr;
+ }
+
/* Get the expected prefix */
prefix = mask & buffer_min;
@@ -478,10 +484,8 @@
return last;
for (cur_var_ptr = lo_var_ptr;
- (ptrdiff_t)(cur_var_ptr * PARROT_STACK_DIR) <
- (ptrdiff_t)(hi_var_ptr * PARROT_STACK_DIR);
- cur_var_ptr = (size_t)( (ptrdiff_t)cur_var_ptr +
- PARROT_STACK_DIR * PARROT_PTR_ALIGNMENT )
+ cur_var_ptr < hi_var_ptr;
+ cur_var_ptr = (size_t)((ptrdiff_t)cur_var_ptr + PARROT_PTR_ALIGNMENT)
) {
size_t ptr = *(size_t *)cur_var_ptr;