[pypy-commit] lang-smalltalk default: fix instances getting for STM/no-STM
timfel
noreply at buildbot.pypy.org
Thu Jan 16 15:04:59 CET 2014
Author: Tim Felgentreff <timfelgentreff at gmail.com>
Branch:
Changeset: r581:676ac9995e51
Date: 2014-01-16 13:38 +0100
http://bitbucket.org/pypy/lang-smalltalk/changeset/676ac9995e51/
Log: fix instances getting for STM/no-STM
diff --git a/spyvm/primitives.py b/spyvm/primitives.py
--- a/spyvm/primitives.py
+++ b/spyvm/primitives.py
@@ -522,18 +522,19 @@
"""NOT RPYTHON"""
from rpython.rlib import rgc
return hasattr(rgc, "stm_is_enabled") and rgc.stm_is_enabled()
-USES_STM = stm_enabled()
+if stm_enabled():
+ def get_instances_array(space, s_frame, w_class):
+ return []
+else:
+ 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
+ # existing instances or something?
+ match_w = s_frame.instances_array(w_class)
+ if match_w is None:
+ match_w = []
+ from rpython.rlib import rgc
-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
- # existing instances or something?
- match_w = s_frame.instances_array(w_class)
- if match_w is None:
- match_w = []
- from rpython.rlib import rgc
-
- if USES_STM:
roots = [gcref for gcref in rgc.get_rpy_roots() if gcref]
pending = roots[:]
while pending:
@@ -552,7 +553,7 @@
rgc.toggle_gcflag_extra(gcref)
roots.extend(rgc.get_rpy_referents(gcref))
s_frame.store_instances_array(w_class, match_w)
- return match_w
+ return match_w
@expose_primitive(SOME_INSTANCE, unwrap_spec=[object])
def func(interp, s_frame, w_class):
More information about the pypy-commit
mailing list