Author: Maciej Fijalkowski <[email protected]>
Branch: lightweight-finalizers
Changeset: r47906:de7e060009e3
Date: 2011-10-09 19:41 +0200
http://bitbucket.org/pypy/pypy/changeset/de7e060009e3/
Log: pass the extra flag in the JIT as well
diff --git a/pypy/jit/backend/llsupport/gc.py b/pypy/jit/backend/llsupport/gc.py
--- a/pypy/jit/backend/llsupport/gc.py
+++ b/pypy/jit/backend/llsupport/gc.py
@@ -604,10 +604,13 @@
def malloc_basic(size, tid):
type_id = llop.extract_ushort(llgroup.HALFWORD, tid)
has_finalizer = bool(tid & (1<<llgroup.HALFSHIFT))
+ has_light_finalizer = bool(tid & (1<<(llgroup.HALFSHIFT + 1)))
check_typeid(type_id)
res = llop1.do_malloc_fixedsize_clear(llmemory.GCREF,
type_id, size,
- has_finalizer, False)
+ has_finalizer,
+ has_light_finalizer,
+ False)
# In case the operation above failed, we are returning NULL
# from this function to assembler. There is also an RPython
# exception set, typically MemoryError; but it's easier and
@@ -702,7 +705,9 @@
type_id = self.layoutbuilder.get_type_id(S)
assert not self.layoutbuilder.is_weakref_type(S)
has_finalizer = bool(self.layoutbuilder.has_finalizer(S))
- flags = int(has_finalizer) << llgroup.HALFSHIFT
+ has_light_finalizer = bool(self.layoutbuilder.has_light_finalizer(S))
+ flags = (int(has_finalizer) << llgroup.HALFSHIFT |
+ int(has_light_finalizer) << (llgroup.HALFSHIFT + 1))
descr.tid = llop.combine_ushort(lltype.Signed, type_id, flags)
def init_array_descr(self, A, descr):
diff --git a/pypy/jit/backend/llsupport/test/test_gc.py
b/pypy/jit/backend/llsupport/test/test_gc.py
--- a/pypy/jit/backend/llsupport/test/test_gc.py
+++ b/pypy/jit/backend/llsupport/test/test_gc.py
@@ -252,7 +252,7 @@
assert not contains_weakptr
p = llmemory.raw_malloc(size)
p = llmemory.cast_adr_to_ptr(p, RESTYPE)
- flags = int(has_finalizer) << 16
+ flags = (int(has_finalizer) << 16) | (int(has_light_finalizer) << 17)
tid = llop.combine_ushort(lltype.Signed, type_id, flags)
self.record.append(("fixedsize", repr(size), tid, p))
return p
diff --git a/pypy/rpython/memory/gctransform/framework.py
b/pypy/rpython/memory/gctransform/framework.py
--- a/pypy/rpython/memory/gctransform/framework.py
+++ b/pypy/rpython/memory/gctransform/framework.py
@@ -1269,6 +1269,10 @@
return rtti is not None and getattr(rtti._obj, 'destructor_funcptr',
None)
+ def has_light_finalizer(self, TYPE):
+ special = self.special_funcptr_for_type(TYPE)
+ return special is not None and special[0] == 'light_finalizer'
+
def has_custom_trace(self, TYPE):
rtti = get_rtti(TYPE)
return rtti is not None and getattr(rtti._obj, 'custom_trace_funcptr',
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit