[pypy-commit] lang-smalltalk default: determine if we're using stm at compile time
timfel
noreply at buildbot.pypy.org
Tue Dec 17 16:18:59 CET 2013
Author: Tim Felgentreff <timfelgentreff at gmail.com>
Branch:
Changeset: r528:82eefe4aa56b
Date: 2013-12-17 15:49 +0100
http://bitbucket.org/pypy/lang-smalltalk/changeset/82eefe4aa56b/
Log: determine if we're using stm at compile time
diff --git a/spyvm/primitives.py b/spyvm/primitives.py
--- a/spyvm/primitives.py
+++ b/spyvm/primitives.py
@@ -515,6 +515,13 @@
w_frame.store(interp.space, constants.CTXPART_STACKP_INDEX, interp.space.wrap_int(stackp))
return w_frame
+
+def stm_enabled():
+ """NOT RPYTHON"""
+ from rpython.rlib import rgc
+ return hasattr(rgc, "stm_is_enabled") and rgc.stm_is_enabled()
+USES_STM = stm_enabled()
+
def get_instances_array(space, s_frame, w_class):
# This primitive returns some instance of the class on the stack.
# Not sure quite how to do this; maintain a weak list of all
@@ -524,7 +531,7 @@
match_w = []
from rpython.rlib import rgc
- if rgc.stm_is_enabled is None or not rgc.stm_is_enabled():
+ if USES_STM:
roots = [gcref for gcref in rgc.get_rpy_roots() if gcref]
pending = roots[:]
while pending:
More information about the pypy-commit
mailing list