[pypy-commit] lang-smalltalk stmgc-c7: stm: compile time stm checks assume everytime no stm, replace them

mswart noreply at buildbot.pypy.org
Thu May 8 18:32:19 CEST 2014


Author: Malte Swart <malte.swart at student.hpi.uni-potsdam.de>
Branch: stmgc-c7
Changeset: r811:fe1ee893cfb1
Date: 2014-05-08 18:22 +0200
http://bitbucket.org/pypy/lang-smalltalk/changeset/fe1ee893cfb1/

Log:	stm: compile time stm checks assume everytime no stm, replace them

	rgc.is_stm_enabled first return None and is replace within a
	trancelation by the real one. This means that it is not possible to
	use them for compile time checks (at module import time) as it would
	always assume that stm is disabled.

diff --git a/spyvm/primitives.py b/spyvm/primitives.py
--- a/spyvm/primitives.py
+++ b/spyvm/primitives.py
@@ -521,16 +521,11 @@
     w_frame.store(interp.space, constants.CTXPART_STACKP_INDEX, interp.space.wrap_int(stackp))
     return w_frame
 
-
-def stm_enabled():
-    """NOT RPYTHON"""
+def get_instances_array(space, s_frame, w_class):
     from rpython.rlib import rgc
-    return hasattr(rgc, "stm_is_enabled") and rgc.stm_is_enabled()
-if stm_enabled():
-    def get_instances_array(space, s_frame, w_class):
+    if rgc.stm_is_enabled():
         return []
-else:
-    def get_instances_array(space, s_frame, w_class):
+    else:
         # This primitive returns some instance of the class on the stack.
         # Not sure quite how to do this; maintain a weak list of all
         # existing instances or something?
@@ -931,12 +926,13 @@
     return w_rcvr
 
 
-if not stm_enabled():
-    # XXX: We don't have a global symbol cache. Instead, we get all
-    # method dictionary shadows (those exists for all methodDicts that
-    # have been modified) and flush them
-    @expose_primitive(SYMBOL_FLUSH_CACHE, unwrap_spec=[object])
-    def func(interp, s_frame, w_rcvr):
+# XXX: We don't have a global symbol cache. Instead, we get all
+# method dictionary shadows (those exists for all methodDicts that
+# have been modified) and flush them
+ at expose_primitive(SYMBOL_FLUSH_CACHE, unwrap_spec=[object])
+def func(interp, s_frame, w_rcvr):
+    from rpython.rlib import rgc
+    if not rgc.stm_is_enabled():
         dicts_s = []
         from rpython.rlib import rgc
 
@@ -961,6 +957,8 @@
             if s_dict.invalid:
                 s_dict.sync_cache()
         return w_rcvr
+    else:
+        raise PrimitiveFailedError("SYMBOL_FLUSH_CACHE not implemented with STM")
 
 # ___________________________________________________________________________
 # Miscellaneous Primitives (120-127)


More information about the pypy-commit mailing list