Author: Anton Gulenko <anton.gule...@googlemail.com>
Branch: storage
Changeset: r877:307b424d7195
Date: 2014-07-09 13:59 +0200
http://bitbucket.org/pypy/lang-smalltalk/changeset/307b424d7195/

Log:    Fixed the suppress_process_switch hack, using an array to store the
        flag, making it modifiable.

diff --git a/spyvm/interpreter.py b/spyvm/interpreter.py
--- a/spyvm/interpreter.py
+++ b/spyvm/interpreter.py
@@ -86,7 +86,7 @@
                     s_new_context = s_sender
                 s_new_context.push(nlr.value)
             except ProcessSwitch, p:
-                assert not self.space.suppress_process_switch, "ProcessSwitch 
should be disabled..."
+                assert not self.space.suppress_process_switch[0], 
"ProcessSwitch should be disabled..."
                 if self.trace:
                     print "====== Switched process from: %s" % 
s_new_context.short_str()
                     print "====== to: %s " % p.s_new_context.short_str()
diff --git a/spyvm/objspace.py b/spyvm/objspace.py
--- a/spyvm/objspace.py
+++ b/spyvm/objspace.py
@@ -23,7 +23,7 @@
         self.make_bootstrap_objects()
         
         # This is a hack; see compile_code() in targetimageloadingsmalltalk.py
-        self.suppress_process_switch = False
+        self.suppress_process_switch = [False]
 
     def find_executable(self, executable):
         if os.sep in executable or (os.name == "nt" and ":" in executable):
diff --git a/spyvm/wrapper.py b/spyvm/wrapper.py
--- a/spyvm/wrapper.py
+++ b/spyvm/wrapper.py
@@ -93,7 +93,7 @@
         active_priority = active_process.priority()
         priority = self.priority()
         if priority > active_priority:
-            if not self.space.suppress_process_switch:
+            if not self.space.suppress_process_switch[0]:
                 active_process.deactivate(s_current_frame)
                 self.activate()
         else:
@@ -104,7 +104,7 @@
 
     def suspend(self, s_current_frame):
         if self.is_active_process():
-            if not self.space.suppress_process_switch:
+            if not self.space.suppress_process_switch[0]:
                 assert self.my_list().is_nil(self.space)
                 w_process = 
scheduler(self.space).pop_highest_priority_process()
                 self.deactivate(s_current_frame, put_to_sleep=False)
diff --git a/targetimageloadingsmalltalk.py b/targetimageloadingsmalltalk.py
--- a/targetimageloadingsmalltalk.py
+++ b/targetimageloadingsmalltalk.py
@@ -178,7 +178,7 @@
             # registered (primitive 136 not called), so the idle process will 
never be left once it is entered.
             # TODO - Find a way to cleanly initialize the image, without 
executing the active_context of the image.
             # Instead, we want to execute our own context. Then remove this 
flag (and all references to it)
-            interp.space.suppress_process_switch = True
+            interp.space.suppress_process_switch[0] = True
             w_result = interp.perform(
                 w_receiver_class,
                 "compile:classified:notifying:",
@@ -187,7 +187,7 @@
                 space.w_nil]
             )
         finally:
-            interp.space.suppress_process_switch = False
+            interp.space.suppress_process_switch[0] = False
         # TODO - is this expected in every image?
         if not isinstance(w_result, model.W_BytesObject) or 
w_result.as_string() != selector:
             print "Compilation failed, unexpected result: %s" % 
result_string(w_result)
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to