Ejemplo n.º 1
0
 def test_split_one_loop_hexguards(self):
     real_loops = [
         FinalBlock(
             preparse("""
     p21 = getfield_gc(p4, descr=<GcPtrFieldDescr 16>)
     guard_class(p4, 141310752, descr=<Guard0x10abcdef2>) [p0, p1]
     """), None),
         FinalBlock(
             preparse("""
     p60 = getfield_gc(p4, descr=<GcPtrFieldDescr 16>)
     guard_nonnull(p60, descr=<Guard0x10abcdef0>) [p0, p1]
     """), None)
     ]
     real_loops[0].loop_no = 0
     real_loops[1].loop_no = 1
     allloops = real_loops[:]
     split_one_loop(real_loops, 'Guard0x10abcdef0', 'extra', 1,
                    guard_number(("0x10abcdef0", "0x")), allloops)
     loop = real_loops[1]
     assert isinstance(loop, Block)
     assert loop.content.endswith('p1]')
     loop.left = allloops[loop.left]
     loop.right = allloops[loop.right]
     assert loop.left.content == ''
     assert loop.right.content == 'extra'
Ejemplo n.º 2
0
 def test_postparse_new(self):
     real_loops = [
         FinalBlock(
             "debug_merge_point(0, 0, '<code object _optimize_charset. file '/usr/local/Cellar/pypy/2.0-beta2/lib-python/2.7/sre_compile.py'. line 207> #351 LOAD_FAST')",
             None)
     ]
     postprocess(real_loops, real_loops[:], {})
     assert real_loops[0].header.startswith(
         "_optimize_charset. file '/usr/local/Cellar/pypy/2.0-beta2/lib-python/2.7/sre_compile.py'. line 207"
     )
Ejemplo n.º 3
0
 def test_postparse(self):
     real_loops = [
         FinalBlock(
             "debug_merge_point('<code object _runCallbacks, file '/tmp/x/twisted-trunk/twisted/internet/defer.py', line 357> #40 POP_TOP', 0)",
             None)
     ]
     postprocess(real_loops, real_loops[:], {})
     assert real_loops[0].header.startswith(
         "_runCallbacks, file '/tmp/x/twisted-trunk/twisted/internet/defer.py', line 357"
     )
Ejemplo n.º 4
0
 def find(s):
     return find_name_key(FinalBlock(s, None))