[pypy-svn] r47861 - pypy/dist/pypy/lang/smalltalk

akuhn at codespeak.net akuhn at codespeak.net
Wed Oct 24 21:06:34 CEST 2007


Author: akuhn
Date: Wed Oct 24 21:06:31 2007
New Revision: 47861

Modified:
   pypy/dist/pypy/lang/smalltalk/squeakimage.py
Log:
keeping objects in same order as in image file

Modified: pypy/dist/pypy/lang/smalltalk/squeakimage.py
==============================================================================
--- pypy/dist/pypy/lang/smalltalk/squeakimage.py	(original)
+++ pypy/dist/pypy/lang/smalltalk/squeakimage.py	Wed Oct 24 21:06:31 2007
@@ -73,7 +73,9 @@
 class ImageReader(object):
     def __init__(self, stream):
         self.stream = stream
-        
+        self.chunks = {}
+        self.chunklist = []
+                
     def initialize(self):
         self.read_header()
         self.read_body()
@@ -96,14 +98,14 @@
         self.stream.skipbytes(headersize - (9 * 4))
 
     def read_body(self):
-        self.chunks = {}
         self.stream.reset_count()
         while self.stream.count < self.endofmemory:
             chunk, pos = self.read_object()
+            self.chunklist.append(chunk)
             self.chunks[pos + self.oldbaseaddress] = chunk
         self.stream.close()    
         del self.stream
-        return self.chunks.values() # return for testing
+        return self.chunklist # return for testing
 
     def init_g_objects(self):
         for chunk in self.chunks.itervalues():
@@ -173,7 +175,7 @@
         self.special_objects = [g_object.w_object for g_object in
                                 reader.chunks[reader.specialobjectspointer]
                                 .g_object.pointers]
-        self.objects = [chunk.g_object.w_object for chunk in reader.chunks.itervalues()]
+        self.objects = [chunk.g_object.w_object for chunk in reader.chunklist]
         
     def special(self, index):
         return self.special_objects[index]  
@@ -330,9 +332,10 @@
                     for pointer in self.chunk.data[:literalsize+1]]
         # --------------------
         l = []
-        for each in self.chunk.data[(literalsize+1):]:
+        for each in self.chunk.data[literalsize+1:]:
             l.append(int2str(each))
-        bytes = "".join(l)[:-(self.format & 3)] 
+        bytes = "".join(l)
+        bytes = bytes[:-(self.format & 3)] 
         w_compiledmethod.__init__(
             w_class = self.g_class.w_object,
             size = literalsize,



More information about the Pypy-commit mailing list