[pypy-commit] pypy gc-forkfriendly-2: fix accidental unsharing
arigo
pypy.commits at gmail.com
Fri Feb 24 10:19:55 EST 2017
Author: Armin Rigo <arigo at tunes.org>
Branch: gc-forkfriendly-2
Changeset: r90339:bdef0258a588
Date: 2017-02-24 15:19 +0000
http://bitbucket.org/pypy/pypy/changeset/bdef0258a588/
Log: fix accidental unsharing
diff --git a/rpython/memory/gc/incminimark.py b/rpython/memory/gc/incminimark.py
--- a/rpython/memory/gc/incminimark.py
+++ b/rpython/memory/gc/incminimark.py
@@ -1254,15 +1254,17 @@
@specialize.arg(2)
def set_visited_and_other_flag(self, obj, other_flag):
# Optimized 'set_visited(obj)' followed by setting 'other_flag' too
- tid = self.header(obj).tid | other_flag
- must_set_gcflag_visited = True
+ tid = self.header(obj).tid
+ add = GCFLAG_VISITED | other_flag
if self.offline_visited_flags:
if tid & GCFLAG_OLD_OUTSIDE_MINIMARKPAGE == 0:
self.ac.set_visited(obj)
- must_set_gcflag_visited = False
- if must_set_gcflag_visited:
- tid |= GCFLAG_VISITED
- self.header(obj).tid = tid
+ if tid & other_flag:
+ return # common case: 'other_flag' is already set
+ # (not just an optimization: avoids writes
+ # to this object, and thus fork-unsharing)
+ add = other_flag
+ self.header(obj).tid = tid | add
def clear_visited(self, obj):
# Clear the object's GCFLAG_VISITED flag, noting that it may be
More information about the pypy-commit
mailing list