Author: Armin Rigo <[email protected]>
Branch: stmgc-c7
Changeset: r70142:b5920bc6dd6c
Date: 2014-03-21 09:39 +0100
http://bitbucket.org/pypy/pypy/changeset/b5920bc6dd6c/

Log:    Remove this bogus setting; always use 10000 as the default for
        sys.setcheckinterval(). Use floating-point fractions internally.

diff --git a/pypy/module/thread/stm.py b/pypy/module/thread/stm.py
--- a/pypy/module/thread/stm.py
+++ b/pypy/module/thread/stm.py
@@ -63,10 +63,6 @@
         """NOT_RPYTHON: set up a mechanism to send to the C code the value
         set by space.actionflag.setcheckinterval()."""
         #
-        # Set the default checkinterval to 200000, found by exploration to
-        # be a good default value.  XXX do some more in-depth tests
-        space.actionflag.setcheckinterval(200000)
-        #
         def setcheckinterval_callback():
             self.configure_transaction_length(space)
         #
@@ -110,7 +106,7 @@
     def configure_transaction_length(self, space):
         if self.threads_running:
             interval = space.actionflag.getcheckinterval()
-            rstm.set_transaction_length(interval)
+            rstm.set_transaction_length(interval / 10000.0)
 
 # ____________________________________________________________
 
diff --git a/rpython/rlib/rstm.py b/rpython/rlib/rstm.py
--- a/rpython/rlib/rstm.py
+++ b/rpython/rlib/rstm.py
@@ -61,8 +61,8 @@
         llop.stm_should_break_transaction(lltype.Bool))
 
 @dont_look_inside
-def set_transaction_length(length):
-    llop.stm_set_transaction_length(lltype.Void, length)
+def set_transaction_length(fraction):
+    llop.stm_set_transaction_length(lltype.Void, float(fraction))
 
 @dont_look_inside
 def increment_atomic():
diff --git a/rpython/translator/stm/src_stm/stmgcintf.c 
b/rpython/translator/stm/src_stm/stmgcintf.c
--- a/rpython/translator/stm/src_stm/stmgcintf.c
+++ b/rpython/translator/stm/src_stm/stmgcintf.c
@@ -35,11 +35,11 @@
 static long pypy_transaction_length;
 
 
-void pypy_stm_set_transaction_length(long percentage)
+void pypy_stm_set_transaction_length(double fraction)
 {
     /* the value '100' means 'use the default'.  Other values are
        interpreted proportionally, up to some maximum. */
-    long low_fill_mark = LOW_FILL_MARK * percentage / 100;
+    long low_fill_mark = (long)(LOW_FILL_MARK * fraction);
     if (low_fill_mark > NURSERY_SIZE / 2)
         low_fill_mark = NURSERY_SIZE / 2;
     pypy_transaction_length = low_fill_mark;
@@ -50,7 +50,7 @@
     stm_setup();
     pypy_stm_register_thread_local();
     pypy_stm_ready_atomic = 1;
-    pypy_stm_set_transaction_length(100);
+    pypy_stm_set_transaction_length(1.0);
     pypy_stm_start_inevitable_if_not_atomic();
 }
 
diff --git a/rpython/translator/stm/src_stm/stmgcintf.h 
b/rpython/translator/stm/src_stm/stmgcintf.h
--- a/rpython/translator/stm/src_stm/stmgcintf.h
+++ b/rpython/translator/stm/src_stm/stmgcintf.h
@@ -46,7 +46,7 @@
 }
 long pypy_stm_enter_callback_call(void);
 void pypy_stm_leave_callback_call(long);
-void pypy_stm_set_transaction_length(long);
+void pypy_stm_set_transaction_length(double);
 void pypy_stm_perform_transaction(object_t *, int(object_t *, int));
 
 static inline int pypy_stm_should_break_transaction(void)
diff --git a/rpython/translator/stm/test/test_ztranslated.py 
b/rpython/translator/stm/test/test_ztranslated.py
--- a/rpython/translator/stm/test/test_ztranslated.py
+++ b/rpython/translator/stm/test/test_ztranslated.py
@@ -98,7 +98,7 @@
 
     def test_set_transaction_length(self):
         def entry_point(argv):
-            rstm.set_transaction_length(123)
+            rstm.set_transaction_length(0.123)
             return 0
         t, cbuilder = self.compile(entry_point)
         cbuilder.cmdexec('')
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to