本文整理匯總了Python中pypy.jit.metainterp.warmstate.WarmEnterState.can_inline_callable方法的典型用法代碼示例。如果您正苦於以下問題:Python WarmEnterState.can_inline_callable方法的具體用法?Python WarmEnterState.can_inline_callable怎麽用?Python WarmEnterState.can_inline_callable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pypy.jit.metainterp.warmstate.WarmEnterState
的用法示例。
在下文中一共展示了WarmEnterState.can_inline_callable方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_make_jitdriver_callbacks_1
# 需要導入模塊: from pypy.jit.metainterp.warmstate import WarmEnterState [as 別名]
# 或者: from pypy.jit.metainterp.warmstate.WarmEnterState import can_inline_callable [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!)'
示例2: test_make_jitdriver_callbacks_2
# 需要導入模塊: from pypy.jit.metainterp.warmstate import WarmEnterState [as 別名]
# 或者: from pypy.jit.metainterp.warmstate.WarmEnterState import can_inline_callable [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
示例3: test_make_jitdriver_callbacks_1
# 需要導入模塊: from pypy.jit.metainterp.warmstate import WarmEnterState [as 別名]
# 或者: from pypy.jit.metainterp.warmstate.WarmEnterState import can_inline_callable [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!)'
示例4: test_make_jitdriver_callbacks_2
# 需要導入模塊: from pypy.jit.metainterp.warmstate import WarmEnterState [as 別名]
# 或者: from pypy.jit.metainterp.warmstate.WarmEnterState import can_inline_callable [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