[pypy-commit] stmgc default: Another example (that unfortunately segfaults)

fijal noreply at buildbot.pypy.org
Mon Jul 8 10:31:48 CEST 2013


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: 
Changeset: r370:b52283fb3bc9
Date: 2013-07-08 10:31 +0200
http://bitbucket.org/pypy/stmgc/changeset/b52283fb3bc9/

Log:	Another example (that unfortunately segfaults)

diff --git a/duhton/demo/trees2.duh b/duhton/demo/trees2.duh
new file mode 100644
--- /dev/null
+++ b/duhton/demo/trees2.duh
@@ -0,0 +1,19 @@
+
+(defun create-tree (n)
+   (if (< n 1) (list 1) (list (create-tree (/ n 2)) (create-tree (/ n 2))))
+)
+
+(defun walk-tree (tree)
+   (if (== (len tree) 1) (get tree 0)
+      (+ (walk-tree (get tree 0)) (walk-tree (get tree 1)))
+   )
+)
+
+(defun lookup-tree ()
+   (walk-tree (create-tree 1024))
+)
+
+(setq n 0)
+(while (< n 1000)
+   (transaction lookup-tree)
+   (setq n (+ n 1)))


More information about the pypy-commit mailing list