[svn:parrot] r49281 - trunk/t/op

bacek at svn.parrot.org bacek at svn.parrot.org
Fri Sep 24 01:19:35 UTC 2010


Author: bacek
Date: Fri Sep 24 01:19:35 2010
New Revision: 49281
URL: https://trac.parrot.org/parrot/changeset/49281

Log:
Add test for TT#1723

Added:
   trunk/t/op/gc-non-recursive.t

Added: trunk/t/op/gc-non-recursive.t
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/t/op/gc-non-recursive.t	Fri Sep 24 01:19:35 2010	(r49281)
@@ -0,0 +1,55 @@
+#!./parrot
+# Copyright (C) 2010, Parrot Foundation.
+# $Id$
+
+=head1 NAME
+
+t/op/gc-non-recursive.t - test for marking very large linked-list
+
+=head1 SYNOPSIS
+
+    % prove t/op/gc-non-recursive.t
+
+=head1 DESCRIPTION
+
+See http://trac.parrot.org/parrot/ticket/1723
+
+=cut
+
+
+.sub 'main' :main
+    .include 'test_more.pir'
+
+    .local pmc iterclass, intclass
+
+    iterclass = newclass ['RangeIter']
+    addattribute iterclass, '$!value'
+    addattribute iterclass, '$!nextIter'
+    intclass = subclass ['Integer'], 'Int'
+
+    .local pmc head, next
+    head = new iterclass
+    $P0 = new intclass
+    setattribute head, '$!value', $P0
+
+    next = head
+  loop:
+    ($I0, next) = next.'reify'()
+    if $I1 < 10000000 goto loop
+    sweep 1
+    ok(1, "Marking of large list doesn't exaust C stack")
+    done_testing()
+.end
+
+
+.namespace ['RangeIter']
+
+.sub 'reify' :method
+    .local pmc value, nextiter
+    value = getattribute self, '$!value'
+    nextiter = new ['RangeIter']
+    setattribute self, '$!nextIter', nextiter
+    $P0 = add value, 1.0
+    setattribute nextiter, '$!value', $P0
+    .return ($P0, nextiter)
+.end


More information about the parrot-commits mailing list