[pypy-commit] lang-smalltalk storage-display-refactoring: Added --hacks parameter to enable run_spy_hacks method.

anton_gulenko noreply at buildbot.pypy.org
Tue Jul 22 19:47:41 CEST 2014


Author: Anton Gulenko <anton.gulenko at googlemail.com>
Branch: storage-display-refactoring
Changeset: r930:b5dbc52fd7e3
Date: 2014-07-21 18:35 +0200
http://bitbucket.org/pypy/lang-smalltalk/changeset/b5dbc52fd7e3/

Log:	Added --hacks parameter to enable run_spy_hacks method.

diff --git a/spyvm/objspace.py b/spyvm/objspace.py
--- a/spyvm/objspace.py
+++ b/spyvm/objspace.py
@@ -33,6 +33,7 @@
         self.no_specialized_storage = ConstantFlag()
         # This is a hack; see compile_code() in targetimageloadingsmalltalk.py
         self.suppress_process_switch = ConstantFlag()
+        self.run_spy_hacks = ConstantFlag()
         self.headless = ConstantFlag()
         
         self.classtable = {}
diff --git a/spyvm/squeakimage.py b/spyvm/squeakimage.py
--- a/spyvm/squeakimage.py
+++ b/spyvm/squeakimage.py
@@ -386,12 +386,13 @@
         self.startup_time = time.time()
 
     def run_spy_hacks(self, space):
-        pass
-        # w_display = space.objtable["w_display"]
-        # if w_display is not None and not w_display.is_nil(space):
-        #     if space.unwrap_int(w_display.fetch(space, 3)) < 8:
-        #         # non-native indexed color depth not well supported
-        #         w_display.store(space, 3, space.wrap_int(8))
+        if not space.run_spy_hacks.is_set():
+            return
+        w_display = space.objtable["w_display"]
+        if w_display is not None and not w_display.is_nil(space):
+            if space.unwrap_int(w_display.fetch(space, 3)) < 8:
+                # non-native indexed color depth not well supported
+                w_display.store(space, 3, space.wrap_int(8))
 
     def find_symbol(self, space, reader, symbol):
         w_dnu = self.special(constants.SO_DOES_NOT_UNDERSTAND)
diff --git a/targetimageloadingsmalltalk.py b/targetimageloadingsmalltalk.py
--- a/targetimageloadingsmalltalk.py
+++ b/targetimageloadingsmalltalk.py
@@ -36,6 +36,7 @@
             -p|--poll          - Actively poll for events. Try this if the image is not responding well.
             -i|--no-interrupts - Disable timer interrupt. Disables non-cooperative scheduling.
             -S                 - Disable specialized storage strategies; always use generic ListStorage
+            --hacks            - Enable Spy hacks. Set display color depth to 8.
             
           Logging parameters:
             -t|--trace                 - Output a trace of each message, primitive, return value and process switch.
@@ -119,6 +120,8 @@
                 interrupts = False
             elif arg in ["-P", "--process"]:
                 headless = False
+            elif arg in ["--hacks"]:
+                space.run_spy_hacks.set()
             elif arg in ["-S"]:
                 space.no_specialized_storage.set()
             elif arg in ["-u"]:


More information about the pypy-commit mailing list