[pypy-commit] pypy default: some minor improvement to minimark. not sure if worth it.
fijal
noreply at buildbot.pypy.org
Sat Jul 27 20:21:47 CEST 2013
Author: Maciej Fijalkowski <fijall at gmail.com>
Branch:
Changeset: r65720:74ec2abeb333
Date: 2013-07-27 20:21 +0200
http://bitbucket.org/pypy/pypy/changeset/74ec2abeb333/
Log: some minor improvement to minimark. not sure if worth it.
diff --git a/rpython/memory/gc/base.py b/rpython/memory/gc/base.py
--- a/rpython/memory/gc/base.py
+++ b/rpython/memory/gc/base.py
@@ -74,7 +74,8 @@
is_rpython_class,
has_custom_trace,
get_custom_trace,
- fast_path_tracing):
+ fast_path_tracing,
+ has_gcptr):
self.getfinalizer = getfinalizer
self.getlightfinalizer = getlightfinalizer
self.is_varsize = is_varsize
@@ -92,6 +93,7 @@
self.has_custom_trace = has_custom_trace
self.get_custom_trace = get_custom_trace
self.fast_path_tracing = fast_path_tracing
+ self.has_gcptr = has_gcptr
def get_member_index(self, type_id):
return self.member_index(type_id)
diff --git a/rpython/memory/gc/minimark.py b/rpython/memory/gc/minimark.py
--- a/rpython/memory/gc/minimark.py
+++ b/rpython/memory/gc/minimark.py
@@ -1511,6 +1511,7 @@
# replace the old object's content with the target address.
# A bit of no-ops to convince llarena that we are changing
# the layout, in non-translated versions.
+ typeid = self.get_type_id(obj)
obj = llarena.getfakearenaaddress(obj)
llarena.arena_reset(obj - size_gc_header, totalsize, 0)
llarena.arena_reserve(obj - size_gc_header,
@@ -1526,7 +1527,9 @@
# because it can contain further pointers to other young objects.
# We will fix such references to point to the copy of the young
# objects when we walk 'old_objects_pointing_to_young'.
- self.old_objects_pointing_to_young.append(newobj)
+ if self.has_gcptr(typeid):
+ # we only have to do it if we have any gcptrs
+ self.old_objects_pointing_to_young.append(newobj)
_trace_drag_out._always_inline_ = True
def _visit_young_rawmalloced_object(self, obj):
@@ -1815,6 +1818,8 @@
#
# It's the first time. We set the flag.
hdr.tid |= GCFLAG_VISITED
+ if not self.has_gcptr(llop.extract_ushort(llgroup.HALFWORD, hdr.tid)):
+ return
#
# Trace the content of the object and put all objects it references
# into the 'objects_to_trace' list.
diff --git a/rpython/memory/gctypelayout.py b/rpython/memory/gctypelayout.py
--- a/rpython/memory/gctypelayout.py
+++ b/rpython/memory/gctypelayout.py
@@ -75,6 +75,10 @@
infobits = self.get(typeid).infobits
return (infobits & T_HAS_GCPTR_IN_VARSIZE) != 0
+ def q_has_gcptr(self, typeid):
+ infobits = self.get(typeid).infobits
+ return (infobits & T_HAS_GCPTR) != 0
+
def q_is_gcarrayofgcptr(self, typeid):
infobits = self.get(typeid).infobits
return (infobits & T_IS_GCARRAY_OF_GCPTR) != 0
@@ -162,7 +166,8 @@
self.q_is_rpython_class,
self.q_has_custom_trace,
self.q_get_custom_trace,
- self.q_fast_path_tracing)
+ self.q_fast_path_tracing,
+ self.q_has_gcptr)
# the lowest 16bits are used to store group member index
@@ -175,7 +180,8 @@
T_HAS_FINALIZER = 0x200000
T_HAS_CUSTOM_TRACE = 0x400000
T_HAS_LIGHTWEIGHT_FINALIZER = 0x800000
-T_KEY_MASK = intmask(0xFF000000)
+T_HAS_GCPTR = 0x1000000
+T_KEY_MASK = intmask(0xFE000000) # bug detection only
T_KEY_VALUE = intmask(0x5A000000) # bug detection only
def _check_valid_type_info(p):
@@ -250,6 +256,8 @@
infobits |= T_IS_WEAKREF
if is_subclass_of_object(TYPE):
infobits |= T_IS_RPYTHON_INSTANCE
+ if infobits | T_HAS_GCPTR_IN_VARSIZE or offsets:
+ infobits |= T_HAS_GCPTR
info.infobits = infobits | T_KEY_VALUE
# ____________________________________________________________
More information about the pypy-commit
mailing list