[pypy-commit] stmgc c7: performance: not always do a safe-point in stm_allocate() (still missing a way to request it though)

Remi Meier noreply at buildbot.pypy.org
Wed Feb 5 09:17:48 CET 2014


Author: Remi Meier
Branch: c7
Changeset: r701:4313bc715c7e
Date: 2014-02-05 09:18 +0100
http://bitbucket.org/pypy/stmgc/changeset/4313bc715c7e/

Log:	performance: not always do a safe-point in stm_allocate() (still
	missing a way to request it though)

diff --git a/c7/nursery.c b/c7/nursery.c
--- a/c7/nursery.c
+++ b/c7/nursery.c
@@ -177,6 +177,13 @@
 
 localchar_t *collect_and_reserve(size_t size)
 {
+    /* reset nursery_current (left invalid by the caller) */
+    _STM_TL->nursery_current -= size;
+
+    /* XXX: check for requested safe-point (by setting nursery_current
+       too high or similar) */
+    
+    
     _stm_start_safe_point(0);    /* don't release the COLLECT lock,
                                    that needs to be done afterwards if
                                    we want a major collection */
@@ -196,16 +203,12 @@
 {
     object_t *result;
     
-    _stm_start_safe_point(LOCK_COLLECT);
-    /* all collections may happen here */
-    _stm_stop_safe_point(LOCK_COLLECT);
-    
     assert(_STM_TL->active);
     assert(size % 8 == 0);
     assert(16 <= size);
 
     /* XXX move out of fastpath */
-    if (size >= NURSERY_SECTION) {
+    if (UNLIKELY(size >= NURSERY_SECTION)) {
         /* allocate large objects outside the nursery immediately,
            otherwise they may trigger too many minor collections
            and degrade performance */
@@ -231,7 +234,6 @@
     assert((uintptr_t)new_current < (1L << 32));
 
     if ((uintptr_t)new_current > FIRST_AFTER_NURSERY_PAGE * 4096) {
-        _STM_TL->nursery_current = current; /* reset for nursery-clearing in minor_collect!! */
         current = collect_and_reserve(size);
     }
 


More information about the pypy-commit mailing list