當前位置: 首頁>>代碼示例>>Python>>正文


Python WarmEnterState.jit_getter方法代碼示例

本文整理匯總了Python中pypy.jit.metainterp.warmstate.WarmEnterState.jit_getter方法的典型用法代碼示例。如果您正苦於以下問題:Python WarmEnterState.jit_getter方法的具體用法?Python WarmEnterState.jit_getter怎麽用?Python WarmEnterState.jit_getter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pypy.jit.metainterp.warmstate.WarmEnterState的用法示例。


在下文中一共展示了WarmEnterState.jit_getter方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_make_jitdriver_callbacks_1

# 需要導入模塊: from pypy.jit.metainterp.warmstate import WarmEnterState [as 別名]
# 或者: from pypy.jit.metainterp.warmstate.WarmEnterState import jit_getter [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

示例2: test_make_jitdriver_callbacks_1

# 需要導入模塊: from pypy.jit.metainterp.warmstate import WarmEnterState [as 別名]
# 或者: from pypy.jit.metainterp.warmstate.WarmEnterState import jit_getter [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

示例3: test_make_jitdriver_callbacks_2

# 需要導入模塊: from pypy.jit.metainterp.warmstate import WarmEnterState [as 別名]
# 或者: from pypy.jit.metainterp.warmstate.WarmEnterState import jit_getter [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.jit_getter方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。