当前位置: 首页>>代码示例>>Python>>正文


Python WarmEnterState.make_jitdriver_callbacks方法代码示例

本文整理汇总了Python中pypy.jit.metainterp.warmstate.WarmEnterState.make_jitdriver_callbacks方法的典型用法代码示例。如果您正苦于以下问题:Python WarmEnterState.make_jitdriver_callbacks方法的具体用法?Python WarmEnterState.make_jitdriver_callbacks怎么用?Python WarmEnterState.make_jitdriver_callbacks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pypy.jit.metainterp.warmstate.WarmEnterState的用法示例。


在下文中一共展示了WarmEnterState.make_jitdriver_callbacks方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_make_jitdriver_callbacks_4

# 需要导入模块: from pypy.jit.metainterp.warmstate import WarmEnterState [as 别名]
# 或者: from pypy.jit.metainterp.warmstate.WarmEnterState import make_jitdriver_callbacks [as 别名]
def test_make_jitdriver_callbacks_4():
    def confirm_enter_jit(x, y, z):
        assert x == 5
        assert y == 42.5
        assert z == 3
        return True

    ENTER_JIT = lltype.Ptr(lltype.FuncType([lltype.Signed, lltype.Float, lltype.Signed], lltype.Bool))

    class FakeWarmRunnerDesc:
        rtyper = None
        cpu = None
        memory_manager = None

    class FakeJitDriverSD:
        jitdriver = None
        _green_args_spec = [lltype.Signed, lltype.Float]
        _get_printable_location_ptr = None
        _confirm_enter_jit_ptr = llhelper(ENTER_JIT, confirm_enter_jit)
        _can_never_inline_ptr = None
        _get_jitcell_at_ptr = None
        _should_unroll_one_iteration_ptr = None
        red_args_types = []

    state = WarmEnterState(FakeWarmRunnerDesc(), FakeJitDriverSD())
    state.make_jitdriver_callbacks()
    res = state.confirm_enter_jit(5, 42.5, 3)
    assert res is True
开发者ID:junion,项目名称:butlerbot-unstable,代码行数:30,代码来源:test_warmstate.py

示例2: test_make_jitdriver_callbacks_5

# 需要导入模块: from pypy.jit.metainterp.warmstate import WarmEnterState [as 别名]
# 或者: from pypy.jit.metainterp.warmstate.WarmEnterState import make_jitdriver_callbacks [as 别名]
def test_make_jitdriver_callbacks_5():
    def can_never_inline(x, y):
        assert x == 5
        assert y == 42.5
        return True

    CAN_NEVER_INLINE = lltype.Ptr(lltype.FuncType([lltype.Signed, lltype.Float], lltype.Bool))

    class FakeWarmRunnerDesc:
        rtyper = None
        cpu = None
        memory_manager = None

    class FakeJitDriverSD:
        jitdriver = None
        _green_args_spec = [lltype.Signed, lltype.Float]
        _get_printable_location_ptr = None
        _confirm_enter_jit_ptr = None
        _can_never_inline_ptr = llhelper(CAN_NEVER_INLINE, can_never_inline)
        _get_jitcell_at_ptr = None
        _should_unroll_one_iteration_ptr = None
        red_args_types = []

    state = WarmEnterState(FakeWarmRunnerDesc(), FakeJitDriverSD())
    state.make_jitdriver_callbacks()
    res = state.can_never_inline(5, 42.5)
    assert res is True
开发者ID:junion,项目名称:butlerbot-unstable,代码行数:29,代码来源:test_warmstate.py

示例3: test_make_jitdriver_callbacks_3

# 需要导入模块: from pypy.jit.metainterp.warmstate import WarmEnterState [as 别名]
# 或者: from pypy.jit.metainterp.warmstate.WarmEnterState import make_jitdriver_callbacks [as 别名]
def test_make_jitdriver_callbacks_3():
    def get_location(x, y):
        assert x == 5
        assert y == 42.5
        return "hi there"  # abuse the return type, but nobody checks it

    GET_LOCATION = lltype.Ptr(lltype.FuncType([lltype.Signed, lltype.Float], lltype.Ptr(rstr.STR)))

    class FakeWarmRunnerDesc:
        rtyper = None
        cpu = None
        memory_manager = None

    class FakeJitDriverSD:
        jitdriver = None
        _green_args_spec = [lltype.Signed, lltype.Float]
        _get_printable_location_ptr = llhelper(GET_LOCATION, get_location)
        _confirm_enter_jit_ptr = None
        _can_never_inline_ptr = None
        _get_jitcell_at_ptr = None
        _should_unroll_one_iteration_ptr = None
        red_args_types = []

    state = WarmEnterState(FakeWarmRunnerDesc(), FakeJitDriverSD())
    state.make_jitdriver_callbacks()
    res = state.get_location_str([ConstInt(5), constfloat(42.5)])
    assert res == "hi there"
开发者ID:junion,项目名称:butlerbot-unstable,代码行数:29,代码来源:test_warmstate.py

示例4: test_make_jitdriver_callbacks_1

# 需要导入模块: from pypy.jit.metainterp.warmstate import WarmEnterState [as 别名]
# 或者: from pypy.jit.metainterp.warmstate.WarmEnterState import make_jitdriver_callbacks [as 别名]
def test_make_jitdriver_callbacks_1():
    class FakeWarmRunnerDesc:
        cpu = None
        memory_manager = None

    class FakeJitDriverSD:
        jitdriver = None
        _green_args_spec = [lltype.Signed, lltype.Float]
        _get_printable_location_ptr = None
        _confirm_enter_jit_ptr = None
        _can_never_inline_ptr = None
        _should_unroll_one_iteration_ptr = None
        red_args_types = []

    class FakeCell:
        dont_trace_here = False

    state = WarmEnterState(FakeWarmRunnerDesc(), FakeJitDriverSD())

    def jit_getter(build, *args):
        return FakeCell()

    state.jit_getter = jit_getter
    state.make_jitdriver_callbacks()
    res = state.get_location_str([ConstInt(5), constfloat(42.5)])
    assert res == "(no jitdriver.get_printable_location!)"
开发者ID:junion,项目名称:butlerbot-unstable,代码行数:28,代码来源:test_warmstate.py

示例5: test_make_jitdriver_callbacks_1

# 需要导入模块: from pypy.jit.metainterp.warmstate import WarmEnterState [as 别名]
# 或者: from pypy.jit.metainterp.warmstate.WarmEnterState import make_jitdriver_callbacks [as 别名]
def test_make_jitdriver_callbacks_1():
    class FakeWarmRunnerDesc:
        can_inline_ptr = None
        get_printable_location_ptr = None
    state = WarmEnterState(FakeWarmRunnerDesc())
    state.make_jitdriver_callbacks()
    res = state.can_inline_callable([BoxInt(5), BoxFloat(42.5)])
    assert res is True
    res = state.get_location_str([BoxInt(5), BoxFloat(42.5)])
    assert res == '(no jitdriver.get_printable_location!)'
开发者ID:enyst,项目名称:plexnet,代码行数:12,代码来源:test_warmstate.py

示例6: test_make_jitdriver_callbacks_3

# 需要导入模块: from pypy.jit.metainterp.warmstate import WarmEnterState [as 别名]
# 或者: from pypy.jit.metainterp.warmstate.WarmEnterState import make_jitdriver_callbacks [as 别名]
def test_make_jitdriver_callbacks_3():
    def get_location(x, y):
        assert x == 5
        assert y == 42.5
        return "hi there"    # abuse the return type, but nobody checks it
    GET_LOCATION = lltype.Ptr(lltype.FuncType([lltype.Signed, lltype.Float],
                                              lltype.Ptr(rstr.STR)))
    class FakeWarmRunnerDesc:
        rtyper = None
        green_args_spec = [lltype.Signed, lltype.Float]
        can_inline_ptr = None
        get_printable_location_ptr = llhelper(GET_LOCATION, get_location)
    state = WarmEnterState(FakeWarmRunnerDesc())
    state.make_jitdriver_callbacks()
    res = state.get_location_str([BoxInt(5), BoxFloat(42.5)])
    assert res == "hi there"
开发者ID:enyst,项目名称:plexnet,代码行数:18,代码来源:test_warmstate.py

示例7: test_make_jitdriver_callbacks_2

# 需要导入模块: from pypy.jit.metainterp.warmstate import WarmEnterState [as 别名]
# 或者: from pypy.jit.metainterp.warmstate.WarmEnterState import make_jitdriver_callbacks [as 别名]
def test_make_jitdriver_callbacks_2():
    def can_inline(x, y):
        assert x == 5
        assert y == 42.5
        return False
    CAN_INLINE = lltype.Ptr(lltype.FuncType([lltype.Signed, lltype.Float],
                                            lltype.Bool))
    class FakeWarmRunnerDesc:
        rtyper = None
        green_args_spec = [lltype.Signed, lltype.Float]
        can_inline_ptr = llhelper(CAN_INLINE, can_inline)
        get_printable_location_ptr = None
    state = WarmEnterState(FakeWarmRunnerDesc())
    state.make_jitdriver_callbacks()
    res = state.can_inline_callable([BoxInt(5), BoxFloat(42.5)])
    assert res is False
开发者ID:enyst,项目名称:plexnet,代码行数:18,代码来源:test_warmstate.py

示例8: test_make_jitdriver_callbacks_1

# 需要导入模块: from pypy.jit.metainterp.warmstate import WarmEnterState [as 别名]
# 或者: from pypy.jit.metainterp.warmstate.WarmEnterState import make_jitdriver_callbacks [as 别名]
def test_make_jitdriver_callbacks_1():
    class FakeWarmRunnerDesc:
        can_inline_ptr = None
        get_printable_location_ptr = None
        confirm_enter_jit_ptr = None
        green_args_spec = [lltype.Signed, lltype.Float]
    class FakeCell:
        dont_trace_here = False
    state = WarmEnterState(FakeWarmRunnerDesc())
    def jit_getter(*args):
        return FakeCell()
    state.jit_getter = jit_getter
    state.make_jitdriver_callbacks()
    res = state.can_inline_callable([ConstInt(5), ConstFloat(42.5)])
    assert res is True
    res = state.get_location_str([ConstInt(5), ConstFloat(42.5)])
    assert res == '(no jitdriver.get_printable_location!)'
开发者ID:alkorzt,项目名称:pypy,代码行数:19,代码来源:test_warmstate.py

示例9: test_make_jitdriver_callbacks_4

# 需要导入模块: from pypy.jit.metainterp.warmstate import WarmEnterState [as 别名]
# 或者: from pypy.jit.metainterp.warmstate.WarmEnterState import make_jitdriver_callbacks [as 别名]
def test_make_jitdriver_callbacks_4():
    def confirm_enter_jit(x, y, z):
        assert x == 5
        assert y == 42.5
        assert z == 3
        return True
    ENTER_JIT = lltype.Ptr(lltype.FuncType([lltype.Signed, lltype.Float,
                                            lltype.Signed], lltype.Bool))
    class FakeWarmRunnerDesc:
        rtyper = None
        green_args_spec = [lltype.Signed, lltype.Float]
        can_inline_ptr = None
        get_printable_location_ptr = None
        confirm_enter_jit_ptr = llhelper(ENTER_JIT, confirm_enter_jit)
        get_jitcell_at_ptr = None

    state = WarmEnterState(FakeWarmRunnerDesc())
    state.make_jitdriver_callbacks()
    res = state.confirm_enter_jit(5, 42.5, 3)
    assert res is True
开发者ID:alkorzt,项目名称:pypy,代码行数:22,代码来源:test_warmstate.py

示例10: test_make_jitdriver_callbacks_2

# 需要导入模块: from pypy.jit.metainterp.warmstate import WarmEnterState [as 别名]
# 或者: from pypy.jit.metainterp.warmstate.WarmEnterState import make_jitdriver_callbacks [as 别名]
def test_make_jitdriver_callbacks_2():
    def can_inline(x, y):
        assert x == 5
        assert y == 42.5
        return False
    CAN_INLINE = lltype.Ptr(lltype.FuncType([lltype.Signed, lltype.Float],
                                            lltype.Bool))
    class FakeCell:
        dont_trace_here = False
    class FakeWarmRunnerDesc:
        rtyper = None
        green_args_spec = [lltype.Signed, lltype.Float]
        can_inline_ptr = llhelper(CAN_INLINE, can_inline)
        get_printable_location_ptr = None
        confirm_enter_jit_ptr = None
    state = WarmEnterState(FakeWarmRunnerDesc())
    def jit_getter(*args):
        return FakeCell()
    state.jit_getter = jit_getter
    state.make_jitdriver_callbacks()
    res = state.can_inline_callable([ConstInt(5), ConstFloat(42.5)])
    assert res is False
开发者ID:alkorzt,项目名称:pypy,代码行数:24,代码来源:test_warmstate.py


注:本文中的pypy.jit.metainterp.warmstate.WarmEnterState.make_jitdriver_callbacks方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。