Author: Armin Rigo <[email protected]>
Branch: stmgc-c7
Changeset: r74578:d4f40d9d3bff
Date: 2014-11-15 11:48 +0100
http://bitbucket.org/pypy/pypy/changeset/d4f40d9d3bff/
Log: Tweaks to reduce the diff from default
diff --git a/rpython/rlib/rthread.py b/rpython/rlib/rthread.py
--- a/rpython/rlib/rthread.py
+++ b/rpython/rlib/rthread.py
@@ -79,9 +79,6 @@
def allocate_lock():
- # Add some memory pressure for the size of the lock because it is an
- # Opaque object
- rgc.add_memory_pressure(TLOCKP_SIZE)
return Lock(allocate_ll_lock())
@specialize.arg(0)
@@ -139,9 +136,6 @@
self._lock = ll_lock
def acquire(self, flag):
- return self._acquire(flag) # indirection for the STMLock subclass
-
- def _acquire(self, flag):
res = c_thread_acquirelock(self._lock, int(flag))
res = rffi.cast(lltype.Signed, res)
return bool(res)
@@ -155,7 +149,7 @@
def release(self):
# Sanity check: the lock must be locked
- if self._acquire(False):
+ if self.acquire(False):
c_thread_releaselock(self._lock)
raise error("bad lock")
else:
@@ -204,6 +198,9 @@
if rffi.cast(lltype.Signed, res) <= 0:
lltype.free(ll_lock, flavor='raw', track_allocation=False)
raise error("out of resources")
+ # Add some memory pressure for the size of the lock because it is an
+ # Opaque object
+ rgc.add_memory_pressure(TLOCKP_SIZE)
return ll_lock
def free_ll_lock(ll_lock):
@@ -322,8 +319,8 @@
from rpython.rlib.objectmodel import running_on_llinterp
ptr = cast_instance_to_base_ptr(value)
if not running_on_llinterp:
- if ptr:
- gcref = lltype.cast_opaque_ptr(llmemory.GCREF, ptr)
+ gcref = lltype.cast_opaque_ptr(llmemory.GCREF, ptr)
+ if gcref:
_make_sure_does_not_move(gcref)
llop.threadlocalref_set(lltype.Void, opaque_id, ptr)
ensure_threadlocal()
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit