[pypy-svn] pypy default: make slice_debug_merge_points a classmethod (alternative constructor) of Function

antocuni commits-noreply at bitbucket.org
Fri Feb 18 18:30:53 CET 2011


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: 
Changeset: r42173:8da3130dcb94
Date: 2011-02-18 16:07 +0100
http://bitbucket.org/pypy/pypy/changeset/8da3130dcb94/

Log:	make slice_debug_merge_points a classmethod (alternative
	constructor) of Function

diff --git a/pypy/tool/jitlogparser/test/test_parser.py b/pypy/tool/jitlogparser/test/test_parser.py
--- a/pypy/tool/jitlogparser/test/test_parser.py
+++ b/pypy/tool/jitlogparser/test/test_parser.py
@@ -1,7 +1,7 @@
 from pypy.jit.metainterp.resoperation import ResOperation, rop
 from pypy.jit.metainterp.history import ConstInt, Const
 from pypy.tool.jitlogparser.parser import parse, Bytecode, Function,\
-     slice_debug_merge_points, adjust_bridges
+     adjust_bridges
 from pypy.tool.jitlogparser.storage import LoopStorage
 import py
 
@@ -27,7 +27,7 @@
     []
     debug_merge_point("SomeRandomStuff", 0)
     ''')
-    res = slice_debug_merge_points(ops.operations, LoopStorage())
+    res = Function.from_operations(ops.operations, LoopStorage())
     assert len(res.chunks) == 1
     assert res.chunks[0].repr()
 
@@ -40,7 +40,7 @@
     debug_merge_point("<code object stuff, file '/tmp/x.py', line 200> #11 SUB", 0)
     i2 = int_add(i1, 1)
     ''')
-    res = slice_debug_merge_points(ops.operations, LoopStorage())
+    res = Function.from_operations(ops.operations, LoopStorage())
     assert len(res.chunks) == 3
     assert len(res.chunks[0].operations) == 1
     assert len(res.chunks[1].operations) == 2
@@ -57,7 +57,7 @@
     debug_merge_point('<code object inner, file 'source.py', line 9> #7 RETURN_VALUE', 1)
     debug_merge_point('<code object inlined_call, file 'source.py', line 12> #31 STORE_FAST', 0)
     """)
-    res = slice_debug_merge_points(ops.operations, LoopStorage())
+    res = Function.from_operations(ops.operations, LoopStorage())
     assert len(res.chunks) == 3 # two chunks + inlined call
     assert isinstance(res.chunks[0], Bytecode)
     assert isinstance(res.chunks[1], Function)
@@ -74,7 +74,7 @@
     debug_merge_point("<code object stuff, file '/tmp/x.py', line 202> #11 SUB", 0)
     i2 = int_add(i1, 1)
     ''')
-    res = slice_debug_merge_points(ops.operations, LoopStorage())
+    res = Function.from_operations(ops.operations, LoopStorage())
     assert res.repr() == res.chunks[0].repr()
     assert res.repr() == "stuff, file '/tmp/x.py', line 200"
     assert res.startlineno == 200
@@ -91,7 +91,7 @@
     debug_merge_point("<code object stuff, file '/tmp/x.py', line 202> #11 SUB", 0)
     i2 = int_add(i1, 1)
     ''')
-    res = slice_debug_merge_points(ops.operations, LoopStorage())
+    res = Function.from_operations(ops.operations, LoopStorage())
     assert res.repr() == res.chunks[1].repr()
 
 def test_lineno():
@@ -103,7 +103,7 @@
     debug_merge_point("<code object f, file '%(fname)s', line 2> #6 BINARY_ADD", 0)
     debug_merge_point("<code object f, file '%(fname)s', line 2> #7 RETURN_VALUE", 0)
     ''' % locals())
-    res = slice_debug_merge_points(ops.operations, LoopStorage())
+    res = Function.from_operations(ops.operations, LoopStorage())
     assert res.chunks[1].lineno == 3
 
 def test_linerange():
@@ -116,7 +116,7 @@
     debug_merge_point("<code object f, file '%(fname)s', line 5> #28 LOAD_CONST", 0)
     debug_merge_point("<code object f, file '%(fname)s', line 5> #6 SETUP_LOOP", 0)
     ''' % locals())
-    res = slice_debug_merge_points(ops.operations, LoopStorage())
+    res = Function.from_operations(ops.operations, LoopStorage())
     assert res.linerange == (7, 9)
     assert res.lineset == set([7, 8, 9])
 
@@ -128,7 +128,7 @@
     guard_class(p6, 144264192, descr=<Guard2>)
     p12 = getfield_gc(p6, descr=<GcPtrFieldDescr pypy.objspace.std.iterobject.W_AbstractSeqIterObject.inst_w_seq 12>)
     """ % locals())
-    res = slice_debug_merge_points(ops.operations, LoopStorage())
+    res = Function.from_operations(ops.operations, LoopStorage())
     assert res.lineset
 
 def test_reassign_loops():
@@ -172,6 +172,6 @@
     loop = parse("""
     debug_merge_point('StrLiteralSearch at 11/51 [17, 8, 3, 1, 1, 1, 1, 51, 0, 19, 51, 1]', 0)
     """)
-    ops = slice_debug_merge_points(loop.operations, LoopStorage())
+    ops = Function.from_operations(loop.operations, LoopStorage())
     chunk = ops.chunks[0]
     assert chunk.bytecode_name == 'StrLiteralSearch'


More information about the Pypy-commit mailing list