[pypy-svn] r26734 - pypy/dist/pypy/rpython/memory
arigo at codespeak.net
arigo at codespeak.net
Wed May 3 18:57:14 CEST 2006
Author: arigo
Date: Wed May 3 18:57:11 2006
New Revision: 26734
Modified:
pypy/dist/pypy/rpython/memory/gctransform.py
Log:
Crashed the Boehm gc transformer (in the presence of a __del__).
Modified: pypy/dist/pypy/rpython/memory/gctransform.py
==============================================================================
--- pypy/dist/pypy/rpython/memory/gctransform.py (original)
+++ pypy/dist/pypy/rpython/memory/gctransform.py Wed May 3 18:57:11 2006
@@ -295,28 +295,28 @@
Their calls are replaced by a simple operation of the GC transformer,
e.g. ll_pop_alive.
"""
- def __init__(self, transformer, opname):
- self.transformer = transformer
- self.opname = opname
+ def __init__(self, transformer_method, see_type=None):
+ self.transformer_method = transformer_method
+ self.see_type = see_type
class LLTransformerOpEntry(ExtRegistryEntry):
"Annotation and specialization of LLTransformerOp() instances."
_type_ = LLTransformerOp
def compute_result_annotation(self, s_arg):
- assert isinstance(s_arg, annmodel.SomePtr)
- PTRTYPE = s_arg.ll_ptrtype
- if PTRTYPE.TO is not lltype.PyObject:
- # look for and annotate a dynamic deallocator if necessary;
- # doing so implicitly in specialize_call() is too late.
- op = self.instance # the LLTransformerOp instance
- op.transformer.dynamic_deallocation_funcptr_for_type(PTRTYPE.TO)
+ op = self.instance # the LLTransformerOp instance
+ if op.see_type is not None:
+ assert isinstance(s_arg, annmodel.SomePtr)
+ PTRTYPE = s_arg.ll_ptrtype
+ if PTRTYPE.TO is not lltype.PyObject:
+ # look for and annotate a dynamic deallocator if necessary;
+ # doing so implicitly in specialize_call() is too late.
+ op.see_type(PTRTYPE.TO)
return annmodel.s_None
def specialize_call(self, hop):
op = self.instance # the LLTransformerOp instance
- meth = getattr(op.transformer, op.opname)
- newops = meth(hop.args_v[0])
+ newops = op.transformer_method(hop.args_v[0])
hop.llops.extend(newops)
hop.exception_cannot_occur()
return hop.inputconst(hop.r_result.lowleveltype, hop.s_result.const)
@@ -527,7 +527,8 @@
body = '\n'.join(_static_deallocator_body_for_type('v', TYPE))
src = ('def ll_deallocator(addr):\n v = cast_adr_to_ptr(addr, PTR_TYPE)\n' +
body + '\n llop.gc_free(lltype.Void, addr)\n')
- d = {'pop_alive': LLTransformerOp(self, 'pop_alive'),
+ d = {'pop_alive': LLTransformerOp(self.pop_alive,
+ self.dynamic_deallocation_funcptr_for_type),
'llop': llop,
'lltype': lltype,
'destrptr': destrptr,
@@ -668,7 +669,7 @@
raise Exception("can't mix PyObjects and __del__ with Boehm")
static_body = '\n'.join(_static_deallocator_body_for_type('v', TYPE))
- d = {'pop_alive': LLTransformerOp(self, 'pop_alive'),
+ d = {'pop_alive': LLTransformerOp(self.pop_alive),
'PTR_TYPE':lltype.Ptr(TYPE),
'cast_adr_to_ptr': llmemory.cast_adr_to_ptr}
src = ("def ll_finalizer(addr):\n"
More information about the Pypy-commit
mailing list