jit/metainterp/test/test_rawmem.py::TestRawMem::()::test_scoped_alloc_buffer
self = <rpython.jit.metainterp.test.test_rawmem.TestRawMem object at 0x0be96770>
def test_scoped_alloc_buffer(self):
def f():
with rffi.scoped_alloc_buffer(42) as p:
p.raw[0] = 'X'
s = p.str(1)
return ord(s[0])
> res = self.interp_operations(f, [])
jit/metainterp/test/test_rawmem.py:105:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
jit/metainterp/test/support.py:273: in interp_operations
result1 = _run_with_blackhole(self, args)
jit/metainterp/test/support.py:132: in _run_with_blackhole
blackholeinterp.run()
jit/metainterp/blackhole.py:360: in run
lle = get_llexception(self.cpu, e)
jit/metainterp/blackhole.py:354: in run
self.dispatch_loop(self, self.jitcode.code, self.position)
jit/metainterp/blackhole.py:95: in dispatch_loop
position = func(self, code, position)
jit/metainterp/blackhole.py:170: in handler
result = unboundmethod(*args)
jit/metainterp/blackhole.py:1285: in bhimpl_inline_call_r_r
None, args_r, None, jitcode.calldescr)
jit/backend/llgraph/runner.py:613: in _do_call
return self.maybe_on_top_of_llinterp(func, args, TP.RESULT)
jit/backend/llgraph/runner.py:603: in maybe_on_top_of_llinterp
res = self.llinterp.eval_graph(ptr._obj.graph, args)
rtyper/llinterp.py:102: in eval_graph
retval = llframe.eval()
rtyper/llinterp.py:300: in eval
nextblock, args = self.eval_block(nextblock)
rtyper/llinterp.py:329: in eval_block
rstackovf.check_stack_overflow()
rtyper/llinterp.py:324: in eval_block
self.eval_operation(op)
rtyper/llinterp.py:427: in eval_operation
retval = ophandler(*vals)
rtyper/llinterp.py:702: in op_direct_call
return self.perform_call(f, FTYPE.ARGS, args)
rtyper/llinterp.py:698: in perform_call
return frame.eval()
rtyper/llinterp.py:300: in eval
nextblock, args = self.eval_block(nextblock)
rtyper/llinterp.py:329: in eval_block
rstackovf.check_stack_overflow()
rtyper/llinterp.py:324: in eval_block
self.eval_operation(op)
rtyper/llinterp.py:427: in eval_operation
retval = ophandler(*vals)
rtyper/llinterp.py:702: in op_direct_call
return self.perform_call(f, FTYPE.ARGS, args)
rtyper/llinterp.py:698: in perform_call
return frame.eval()
rtyper/llinterp.py:300: in eval
nextblock, args = self.eval_block(nextblock)
rtyper/llinterp.py:329: in eval_block
rstackovf.check_stack_overflow()
rtyper/llinterp.py:324: in eval_block
self.eval_operation(op)
rtyper/llinterp.py:427: in eval_operation
retval = ophandler(*vals)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <rpython.rtyper.llinterp.LLFrame object at 0x0c0425b0>, obj = 11
def op_gc_get_stats(self, obj):
> raise NotImplementedError("gc_get_stats")
E NotImplementedError: gc_get_stats
rtyper/llinterp.py:764: NotImplementedError
---------- Captured stdout call ----------
f:
0 new_with_vtable SizeDescr(<GcStruct rpython.rtyper.lltypesystem.rffi.scoped_alloc_buffer { super, inst_case_num, inst_gc_buf, inst_raw, inst_size }>) -> %r0
4 inline_call_ir_v <JitCode 'scoped_alloc_buffer.__init__'>, I[$42], R[%r0]
11 -live- %r0
14 inline_call_r_r <JitCode 'scoped_alloc_buffer.__enter__'>, R[%r0] -> %r1
20 -live- %r0, %r1
23 getfield_gc_i %r1, FieldDescr(<GcStruct rpython.rtyper.lltypesystem.rffi.scoped_alloc_buffer { super, inst_case_num, inst_gc_buf, inst_raw, inst_size }>, 'inst_raw') -> %i0
28 setarrayitem_raw_i %i0, $0, $'X', ArrayDescr(<Array of Char {'nolength': True} >)
34 inline_call_ir_r <JitCode 'scoped_alloc_buffer.str'>, I[$1], R[%r1] -> %r1
42 -live- %r0, %r1
45 catch_exception L1
48 inline_call_r_v <JitCode '__exit____star_3'>, R[%r0, $<* struct exceptions.Exception>, $<* struct exceptions.Exception>]
55 -live- %r1
58 inline_call_ir_i <JitCode 'll_stritem_nonneg__rpy_stringPtr_Signed'>, I[$0], R[%r1] -> %i0
66 -live- %i0
69 int_return %i0
71 ---
71 L1:
71 last_exception -> %i0
73 last_exc_value -> %r1
75 inline_call_r_v <JitCode '__exit____star_3'>, R[%r0, %r1, %r1]
82 -live- %r1
85 raise %r1
ll_stritem_nonneg__rpy_stringPtr_Signed:
0 strgetitem %r0, %i0 -> %i0
4 int_return %i0
__exit____star_3:
0 getfield_gc_i %r0, FieldDescr(<GcStruct rpython.rtyper.lltypesystem.rffi.scoped_alloc_buffer { super, inst_case_num, inst_gc_buf, inst_raw, inst_size }>, 'inst_raw') -> %i0
5 getfield_gc_r %r0, FieldDescr(<GcStruct rpython.rtyper.lltypesystem.rffi.scoped_alloc_buffer { super, inst_case_num, inst_gc_buf, inst_raw, inst_size }>, 'inst_gc_buf') -> %r1
10 getfield_gc_i %r0, FieldDescr(<GcStruct rpython.rtyper.lltypesystem.rffi.scoped_alloc_buffer { super, inst_case_num, inst_gc_buf, inst_raw, inst_size }>, 'inst_case_num') -> %i1
15 residual_call_ir_v $<* fn keep_buffer_alive_until_here>, I[%i0, %i1], R[%r1], CallDescr(<Void>, (<* Array of Char {'nolength': True} >, <* GcStruct rpy_string { hash, chars }>, <Signed>), <EffectInfo 0xc0398d0: EF=2>)
24 void_return
scoped_alloc_buffer.str:
0 getfield_gc_i %r0, FieldDescr(<GcStruct rpython.rtyper.lltypesystem.rffi.scoped_alloc_buffer { super, inst_case_num, inst_gc_buf, inst_raw, inst_size }>, 'inst_raw') -> %i0
5 getfield_gc_r %r0, FieldDescr(<GcStruct rpython.rtyper.lltypesystem.rffi.scoped_alloc_buffer { super, inst_case_num, inst_gc_buf, inst_raw, inst_size }>, 'inst_gc_buf') -> %r1
10 getfield_gc_i %r0, FieldDescr(<GcStruct rpython.rtyper.lltypesystem.rffi.scoped_alloc_buffer { super, inst_case_num, inst_gc_buf, inst_raw, inst_size }>, 'inst_case_num') -> %i1
15 residual_call_ir_r $<* fn str_from_buffer>, I[%i0, %i1, $42, $1], R[%r1], CallDescr(<* GcStruct rpy_string { hash, chars }>, (<* Array of Char {'nolength': True} >, <* GcStruct rpy_string { hash, chars }>, <Signed>, <Signed>, <Signed>), <EffectInfo 0xc0399f0: EF=5>) -> %r0
27 -live- %r0
30 ref_return %r0
scoped_alloc_buffer.__enter__:
0 residual_call_ir_r $<* fn alloc_buffer>, I[$42], R[], CallDescr(<* GcStruct tuple3 { item0, item1, item2 }>, (<Signed>,), <EffectInfo 0xc0399f0: EF=5>) -> %r1
8 -live- %r0, %r1
11 getfield_gc_i_pure %r1, FieldDescr(<GcStruct tuple3 { item0, item1, item2 }>, 'item0') -> %i0
16 getfield_gc_r_pure %r1, FieldDescr(<GcStruct tuple3 { item0, item1, item2 }>, 'item1') -> %r2
21 getfield_gc_i_pure %r1, FieldDescr(<GcStruct tuple3 { item0, item1, item2 }>, 'item2') -> %i1
26 setfield_gc_i %r0, %i0, FieldDescr(<GcStruct rpython.rtyper.lltypesystem.rffi.scoped_alloc_buffer { super, inst_case_num, inst_gc_buf, inst_raw, inst_size }>, 'inst_raw')
31 setfield_gc_r %r0, %r2, FieldDescr(<GcStruct rpython.rtyper.lltypesystem.rffi.scoped_alloc_buffer { super, inst_case_num, inst_gc_buf, inst_raw, inst_size }>, 'inst_gc_buf')
36 setfield_gc_i %r0, %i1, FieldDescr(<GcStruct rpython.rtyper.lltypesystem.rffi.scoped_alloc_buffer { super, inst_case_num, inst_gc_buf, inst_raw, inst_size }>, 'inst_case_num')
41 ref_return %r0
scoped_alloc_buffer.__init__:
0 setfield_gc_i %r0, $42, FieldDescr(<GcStruct rpython.rtyper.lltypesystem.rffi.scoped_alloc_buffer { super, inst_case_num, inst_gc_buf, inst_raw, inst_size }>, 'inst_size')
5 void_return
bh: new_with_vtable [<rpython.jit.backend.llgraph.runner.LLGraphCPU object at 0x0bfe12d0>, SizeDescr(<GcStruct rpython.rtyper.lltypesystem.rffi.scoped_alloc_buffer { super, inst_case_num, inst_gc_buf, inst_raw, inst_size }>)] -> * GCREF hidden
bh: inline_call_ir_v [<rpython.jit.backend.llgraph.runner.LLGraphCPU object at 0x0bfe12d0>, <JitCode 'scoped_alloc_buffer.__init__'>, [42], [<* GCREF hidden>]]
bh: live [12] -> 14
bh: inline_call_r_r [<rpython.jit.backend.llgraph.runner.LLGraphCPU object at 0x0bfe12d0>, <JitCode 'scoped_alloc_buffer.__enter__'>, [<* GCREF hidden>]] -> NotImplementedError!
---------- Captured stderr call ----------
[rtyper] -=- specialized 81 blocks -=-
[rtyper] -=- specialized 4 more blocks -=-
[backendopt:removeassert] Removed 3 asserts
[backendopt:malloc] starting malloc removal
[backendopt:malloc] removed 0 simple mallocs in total
[backendopt:mergeifblocks] starting to merge if blocks
[rtyper] -=- specialized 2 more blocks -=-
[rtyper] -=- specialized 7 more blocks -=-
[rtyper] specializing: 100 / 100 blocks (100%)
[rtyper] -=- specialized 6 more blocks -=-
[rtyper] -=- specialized 17 more blocks -=-
[rtyper] -=- specialized 2 more blocks -=-
[jitcodewriter:info] making JitCodes...
[jitcodewriter:info] There are 6 JitCode instances.
[jitcodewriter:info] There are 8 -live- ops. Size of liveness is 16 bytes
builder: rpython-linux-x86-32 build #772*
test: jit/metainterp/test/test_rawmem.py::TestRawMem::()::test_scoped_alloc_buffer