rlib/test/test_rawrefcount.py::TestTranslated::()::test_full_translation
self = <rpython.rlib.test.test_rawrefcount.TestTranslated object at 0xf5b7b96c>
def test_full_translation(self):
class State:
pass
state = State()
state.seen = []
def dealloc_trigger():
state.seen.append(1)
w_marker = W_Root(-1)
def make_p():
p = W_Root(42)
ob = lltype.malloc(PyObjectS, flavor='raw', zero=True)
rawrefcount.create_link_pypy(p, ob)
ob.c_ob_refcnt += REFCNT_FROM_PYPY
assert rawrefcount.from_obj(PyObject, p) == ob
assert rawrefcount.to_obj(W_Root, ob) == p
return ob, p
FTYPE = rawrefcount.RAWREFCOUNT_DEALLOC_TRIGGER
def entry_point(argv):
ll_dealloc_trigger_callback = llhelper(FTYPE, dealloc_trigger)
rawrefcount.init(ll_dealloc_trigger_callback)
ob, p = make_p()
if state.seen != []:
print "OB COLLECTED REALLY TOO SOON"
return 1
rgc.collect()
if state.seen != []:
print "OB COLLECTED TOO SOON"
return 1
objectmodel.keepalive_until_here(p)
p = None
rgc.collect()
if state.seen != [1]:
print "OB NOT COLLECTED"
return 1
if rawrefcount.next_dead(PyObject) != ob:
print "NEXT_DEAD != OB"
return 1
if ob.c_ob_refcnt != 1:
print "next_dead().ob_refcnt != 1"
return 1
if rawrefcount.next_dead(PyObject) != lltype.nullptr(PyObjectS):
print "NEXT_DEAD second time != NULL"
return 1
if rawrefcount.to_obj(W_Root, ob) is not None:
print "to_obj(dead) is not None?"
return 1
rawrefcount.mark_deallocating(w_marker, ob)
if rawrefcount.to_obj(W_Root, ob) is not w_marker:
print "to_obj(marked-dead) is not w_marker"
return 1
print "OK!"
lltype.free(ob, flavor='raw')
return 0
self.config = get_combined_translation_config(translating=True)
self.config.translation.gc = "incminimark"
> t, cbuilder = self.compile(entry_point)
rlib/test/test_rawrefcount.py:289:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
translator/c/test/test_standalone.py:72: in compile
exe_name=exe_name)
translator/c/genc.py:178: in generate_source
db = self.build_database()
translator/c/genc.py:102: in build_database
self.config.translation.reverse_debugger)
translator/c/database.py:64: in __init__
self.gctransformer = self.gcpolicy.gettransformer(translator, gchooks)
translator/c/gc.py:452: in gettransformer
return shadowstack.ShadowStackFrameworkGCTransformer(translator, gchooks)
memory/gctransform/framework.py:132: in __init__
GCClass, GC_PARAMS = choose_gc_from_config(translator.config)
memory/gc/base.py:593: in choose_gc_from_config
globals(), locals(), [classname])
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
"""
# XXX Should find a way to bound the major collection threshold by the
# XXX total addressable size. Maybe by keeping some minimarkpage arenas
# XXX pre-reserved, enough for a few nursery collections? What about
# XXX raw-malloced memory?
# XXX try merging old_objects_pointing_to_pinned into
# XXX old_objects_pointing_to_young (IRC 2014-10-22, fijal and gregor_w)
import sys
import os
import time
from rpython.rtyper.lltypesystem import lltype, llmemory, llarena, llgroup
from rpython.rtyper.lltypesystem.lloperation import llop
from rpython.rtyper.lltypesystem.llmemory import raw_malloc_usage
from rpython.memory.gc.base import GCBase, MovingGCBase
> from rpython.memory.gc import env
E File "/build_dir/rpython-linux-x86-32/build/rpython/memory/gc/env.py", line 423
E SyntaxError: Non-ASCII character '\xe2' in file /build_dir/rpython-linux-x86-32/build/rpython/memory/gc/env.py on line 423, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
memory/gc/incminimark.py:70: SyntaxError
---------- Captured stderr call ----------
[rtyper] specializing: 100 / 442 blocks (22%)
[rtyper] specializing: 200 / 511 blocks (39%)
[rtyper] specializing: 300 / 511 blocks (58%)
[rtyper] specializing: 400 / 511 blocks (78%)
[rtyper] specializing: 500 / 511 blocks (97%)
[rtyper] -=- specialized 511 blocks -=-
[rtyper] -=- specialized 4 more blocks -=-
[rtyper] -=- specialized 25 more blocks -=-
(somefailed=True in rlib/test/test_rawrefcount.py)
builder: rpython-linux-x86-32 build #832
test: rlib/test/test_rawrefcount/py/TestTranslated/()/test_full_translation