本文整理汇总了Python中pypy.jit.codewriter.jtransform.Transformer.portal_jd方法的典型用法代码示例。如果您正苦于以下问题:Python Transformer.portal_jd方法的具体用法?Python Transformer.portal_jd怎么用?Python Transformer.portal_jd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pypy.jit.codewriter.jtransform.Transformer
的用法示例。
在下文中一共展示了Transformer.portal_jd方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_jit_merge_point_1
# 需要导入模块: from pypy.jit.codewriter.jtransform import Transformer [as 别名]
# 或者: from pypy.jit.codewriter.jtransform.Transformer import portal_jd [as 别名]
def test_jit_merge_point_1():
class FakeJitDriverSD:
index = 42
class jitdriver:
active = True
greens = ['green1', 'green2', 'voidgreen3']
reds = ['red1', 'red2', 'voidred3']
jd = FakeJitDriverSD()
v1 = varoftype(lltype.Signed)
v2 = varoftype(lltype.Signed)
vvoid1 = varoftype(lltype.Void)
v3 = varoftype(lltype.Signed)
v4 = varoftype(lltype.Signed)
vvoid2 = varoftype(lltype.Void)
v5 = varoftype(lltype.Void)
op = SpaceOperation('jit_marker',
[Constant('jit_merge_point', lltype.Void),
Constant(jd.jitdriver, lltype.Void),
v1, v2, vvoid1, v3, v4, vvoid2], v5)
tr = Transformer()
tr.portal_jd = jd
oplist = tr.rewrite_operation(op)
assert len(oplist) == 7
assert oplist[0].opname == '-live-'
assert oplist[1].opname == 'int_guard_value'
assert oplist[1].args == [v1]
assert oplist[2].opname == '-live-'
assert oplist[3].opname == 'int_guard_value'
assert oplist[3].args == [v2]
assert oplist[4].opname == '-live-'
assert oplist[5].opname == 'jit_merge_point'
assert oplist[5].args[0].value == 42
assert list(oplist[5].args[1]) == [v1, v2]
assert list(oplist[5].args[4]) == [v3, v4]
assert oplist[6].opname == '-live-'