Author: Armin Rigo <[email protected]>
Branch: concurrent-marksweep
Changeset: r47889:31f8caa85b5c
Date: 2011-10-09 12:54 +0200
http://bitbucket.org/pypy/pypy/changeset/31f8caa85b5c/
Log: Tweaks.
diff --git a/pypy/rpython/memory/gc/concurrentms.py
b/pypy/rpython/memory/gc/concurrentms.py
--- a/pypy/rpython/memory/gc/concurrentms.py
+++ b/pypy/rpython/memory/gc/concurrentms.py
@@ -138,6 +138,8 @@
# is a collection running and the mutator tries to change an object
# that was not scanned yet.
self._init_writebarrier_logic()
+ #
+ self.main_thread_ident = ll_thread.get_ident()
def setup(self):
"Start the concurrent collector thread."
@@ -368,6 +370,7 @@
llarena.arena_reset(adr, self.HDRSIZE, 0)
llarena.arena_reserve(adr, totalsize)
return adr + llmemory.raw_malloc_usage(self.HDRSIZE)
+ grow_reservation._always_inline_ = True
def write_barrier(self, newvalue, addr_struct):
mark = self.header(addr_struct).tid & 0xFF
@@ -530,7 +533,8 @@
raise
def acquire(self, lock):
- if we_are_translated():
+ if (we_are_translated() or
+ ll_thread.get_ident() != self.main_thread_ident):
ll_thread.c_thread_acquirelock(lock, 1)
else:
while rffi.cast(lltype.Signed,
diff --git a/pypy/translator/c/primitive.py b/pypy/translator/c/primitive.py
--- a/pypy/translator/c/primitive.py
+++ b/pypy/translator/c/primitive.py
@@ -1,7 +1,7 @@
import sys
from pypy.rlib.objectmodel import Symbolic, ComputedIntSymbolic
from pypy.rlib.objectmodel import CDefinedIntSymbolic
-from pypy.rlib.rarithmetic import r_longlong
+from pypy.rlib.rarithmetic import r_longlong, LONG_BIT
from pypy.rlib.rfloat import isinf, isnan
from pypy.rpython.lltypesystem.lltype import *
from pypy.rpython.lltypesystem import rffi, llgroup
@@ -62,6 +62,11 @@
name = name_small_integer(value.lowpart, db)
assert (value.rest & value.MASK) == 0
return '(%s+%dL)' % (name, value.rest)
+ elif isinstance(value, llgroup.HighCombinedSymbolic):
+ name = name_small_integer(value.hipart, db)
+ assert (value.rest & value.MASK) == 0
+ return '((((long)%s)<<%d)+%dL)' % (name, LONG_BIT//2,
+ value.rest)
elif isinstance(value, AddressAsInt):
return '((long)%s)' % name_address(value.adr, db)
else:
diff --git a/pypy/translator/c/src/llgroup.h b/pypy/translator/c/src/llgroup.h
--- a/pypy/translator/c/src/llgroup.h
+++ b/pypy/translator/c/src/llgroup.h
@@ -58,4 +58,9 @@
#define OP_EXTRACT_USHORT(value, r) r = (pypy_halfword_t)value
#define OP_COMBINE_USHORT(ushort, rest, r) r = ((long)ushort) | rest
+#define OP_EXTRACT_HIGH_USHORT(value, r) \
+ r = (pypy_halfword_t)(value >> (PYPY_LONG_BIT/2))
+#define OP_COMBINE_HIGH_USHORT(ushort, rest, r) \
+ r = (((long)ushort) << (PYPY_LONG_BIT/2)) | rest
+
#endif /* _PYPY_LL_GROUP_H_ */
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit