Author: Eric Seckler <eric.seck...@student.hpi.uni-potsdam.de>
Branch: 
Changeset: r751:81165d5663ee
Date: 2014-01-14 16:13 +0100
http://bitbucket.org/pypy/lang-smalltalk/changeset/81165d5663ee/

Log:    moar stm

diff --git a/spyvm/interpreter.py b/spyvm/interpreter.py
--- a/spyvm/interpreter.py
+++ b/spyvm/interpreter.py
@@ -135,7 +135,7 @@
     jit_driver = jit.JitDriver(
         greens=[],
         reds=['pc', 's_context', 'self', 'method'],
-        virtualizables=['s_context'],
+        # virtualizables=['s_context'],
         stm_do_transaction_breaks=True
         # get_printable_location=get_printable_location
     )
@@ -238,9 +238,9 @@
                 if jit.we_are_jitted():
                     self.quick_check_for_interrupt(s_context,
                                     dec=self._get_adapted_tick_counter())
-                self.jit_driver.can_enter_jit(
-                    pc=pc, self=self, method=method,
-                    s_context=s_context)
+                #self.jit_driver.can_enter_jit(
+                #    pc=pc, self=self, method=method,
+                #    s_context=s_context)
             old_pc = pc
 
             # STM-ONLY JITDRIVER!
diff --git a/spyvm/primitives.py b/spyvm/primitives.py
--- a/spyvm/primitives.py
+++ b/spyvm/primitives.py
@@ -522,38 +522,38 @@
     return hasattr(rgc, "stm_is_enabled") and rgc.stm_is_enabled()
 USES_STM = stm_enabled()
 
-if USES_STM:
-    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
-
-            roots = [gcref for gcref in rgc.get_rpy_roots() if gcref]
-            pending = roots[:]
-            while pending:
-                gcref = pending.pop()
-                if not rgc.get_gcflag_extra(gcref):
-                    rgc.toggle_gcflag_extra(gcref)
-                    w_obj = rgc.try_cast_gcref_to_instance(model.W_Object, 
gcref)
-                    if (w_obj is not None and w_obj.has_class()
-                        and w_obj.getclass(space) is w_class):
-                        match_w.append(w_obj)
-                    pending.extend(rgc.get_rpy_referents(gcref))
-
-            while roots:
-                gcref = roots.pop()
-                if rgc.get_gcflag_extra(gcref):
-                    rgc.toggle_gcflag_extra(gcref)
-                    roots.extend(rgc.get_rpy_referents(gcref))
-            s_frame.store_instances_array(w_class, match_w)
-        return match_w
+#if USES_STM:
+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
+#
+#         roots = [gcref for gcref in rgc.get_rpy_roots() if gcref]
+#         pending = roots[:]
+#         while pending:
+#             gcref = pending.pop()
+#             if not rgc.get_gcflag_extra(gcref):
+#                 rgc.toggle_gcflag_extra(gcref)
+#                 w_obj = rgc.try_cast_gcref_to_instance(model.W_Object, gcref)
+#                 if (w_obj is not None and w_obj.has_class()
+#                     and w_obj.getclass(space) is w_class):
+#                     match_w.append(w_obj)
+#                 pending.extend(rgc.get_rpy_referents(gcref))
+#
+#         while roots:
+#             gcref = roots.pop()
+#             if rgc.get_gcflag_extra(gcref):
+#                 rgc.toggle_gcflag_extra(gcref)
+#                 roots.extend(rgc.get_rpy_referents(gcref))
+#         s_frame.store_instances_array(w_class, match_w)
+#     return match_w
 
 @expose_primitive(SOME_INSTANCE, unwrap_spec=[object])
 def func(interp, s_frame, w_class):
diff --git a/targetimageloadingsmalltalk.py b/targetimageloadingsmalltalk.py
--- a/targetimageloadingsmalltalk.py
+++ b/targetimageloadingsmalltalk.py
@@ -59,7 +59,7 @@
     except error.Exit, e:
         print e.msg
 
-def _run_code(interp, code, as_benchmark=False):
+def _run_code(interp, code, as_benchmark=False, use_stm=False):
     import time
     selector = "codeTest%d" % int(time.time())
     try:
@@ -93,7 +93,7 @@
                 print w_result.as_repr_string().replace('\r', '\n')
         return 0
     else:
-        return _run_benchmark(interp, 0, selector, "")
+        return _run_benchmark(interp, 0, selector, "", use_stm)
 
 
 space = objspace.ObjSpace()
@@ -208,7 +208,7 @@
         print "Running Benchmark"
         return _run_benchmark(interp, number, benchmark, stringarg, use_stm)
     elif code is not None:
-        return _run_code(interp, code, as_benchmark=as_benchmark)
+        return _run_code(interp, code, as_benchmark=as_benchmark, 
use_stm=use_stm)
     else:
         print "Running Image"
         _run_image(interp)
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to