The "stacktest" patch will fail on the current CVS source, due to a bug in
push_generic_entry.
--
Jason
Index: t/op/stacks.t
===================================================================
RCS file: /home/perlcvs/parrot/t/op/stacks.t,v
retrieving revision 1.3
diff -u -r1.3 stacks.t
--- t/op/stacks.t 2001/10/14 00:43:50 1.3
+++ t/op/stacks.t 2001/10/20 15:36:21
@@ -8,7 +8,7 @@
# Still to write: tests for (push|pop)_p(_c)?
# tests for warp, unwarp and set_warp
-use Parrot::Test tests => 9;
+use Parrot::Test tests => 10;
output_is( <<"CODE", <<'OUTPUT', "pushi & popi" );
@{[ set_int_regs( sub { $_[0]} )]}
@@ -143,6 +143,35 @@
Seem to have positive Nx after pop
OUTPUT
}
+
+# Test proper stack chunk handling
+output_is(<<CODE, <<'OUTPUT', 'save_i & restore_i');
+ set I3, 1
+
+testloop:
+ set I0, 0
+ set I1, I3
+
+saveloop:
+ inc I0
+ save I0
+ ne I0, I1, saveloop
+
+restoreloop:
+ restore I0
+ ne I0, I1, error
+ dec I1
+ ne I1, 0, restoreloop
+
+ add I3, I3, 1
+ ne I3, 769, testloop # At least 3 stack chunks
+
+ print "OK\\n"
+error: end
+CODE
+OK
+OUTPUT
+
# Now, to make it do BAD THINGS!
output_is(<<"CODE",'No more I register frames to pop!','ENO I frames');
Index: stacks.c
===================================================================
RCS file: /home/perlcvs/parrot/stacks.c,v
retrieving revision 1.6
diff -u -r1.6 stacks.c
--- stacks.c 2001/10/19 17:14:21 1.6
+++ stacks.c 2001/10/20 15:39:03
@@ -92,6 +92,7 @@
new_chunk->prev = chunk_base;
chunk_base->next = new_chunk;
interpreter->stack_top = &new_chunk->entry[0];
+ chunk_base = new_chunk;
}
/* Remember the type */