Author: Anton Gulenko <anton.gule...@googlemail.com>
Branch: strategies-tagging
Changeset: r673:b1593fffd1e7
Date: 2014-03-20 12:54 +0100
http://bitbucket.org/pypy/lang-smalltalk/changeset/b1593fffd1e7/

Log:    Fixing tests.

diff --git a/spyvm/model.py b/spyvm/model.py
--- a/spyvm/model.py
+++ b/spyvm/model.py
@@ -654,7 +654,9 @@
 
 class W_PointersObject(W_AbstractPointersObject):
     _attrs_ = ['_size', 'list_storage', 'int_storage', 'strategy']
-
+    list_storage = None
+    int_storage = None
+    
     @jit.unroll_safe
     def __init__(self, space, w_class, size):
         from spyvm.strategies import strategy_of_size
diff --git a/spyvm/strategies.py b/spyvm/strategies.py
--- a/spyvm/strategies.py
+++ b/spyvm/strategies.py
@@ -44,7 +44,7 @@
     def copy_storage_from(self, space, w_obj, reuse_storage):
         old_strategy = w_obj.strategy
         if old_strategy == self and reuse_storage:
-            return w_obj.list_storage
+            return self.storage(w_obj)
         else:
             # This can be overridden and optimized (reuse_storage flag, less 
temporary storage)
             return self.storage_for_list(space, w_obj.fetch_all(space))
@@ -68,10 +68,10 @@
     def copy_storage_from(self, space, w_obj, reuse_storage):
         old_strategy = w_obj.strategy
         if old_strategy == self and reuse_storage:
-            return w_obj.int_storage
+            return self.storage(w_obj)
         else:
             # This can be overridden and optimized (reuse_storage flag, less 
temporary storage)
-            return self.int_storage_for_list(space, w_obj.fetch_all(space))
+            return self.storage_for_list(space, w_obj.fetch_all(space))
 
 class SingletonMeta(type):
     def __new__(cls, name, bases, dct):
@@ -173,10 +173,10 @@
                 # Storing a wrong type - dehomogenize to ListStorage
                 return w_obj.store_with_new_strategy(space, 
ListStorageStrategy.singleton, n0, w_val)
         
-    def initial_int_storage(self, space, size):
+    def initial_storage(self, space, size):
         return [self.nil_value] * size
     
-    def int_storage_for_list(self, space, collection):
+    def storage_for_list(self, space, collection):
         length = len(collection)
         store = [self.nil_value] * length
         for i in range(length):
diff --git a/spyvm/test/test_primitives.py b/spyvm/test/test_primitives.py
--- a/spyvm/test/test_primitives.py
+++ b/spyvm/test/test_primitives.py
@@ -18,15 +18,17 @@
         self.strategy = strategies.ListStorageStrategy.singleton
         self.initialize_storage(space, size)
         self.store_all(space, [None] * 6 + stack + [space.w_nil] * 6)
-        s_self = self.as_blockcontext_get_shadow()
+        import pdb; pdb.set_trace()
+        s_self = self.as_blockcontext_get_shadow(space)
         s_self.init_stack_and_temps()
         s_self.reset_stack()
         s_self.push_all(stack)
         s_self.store_expected_argument_count(0)
         self.s_class = space.w_MethodContext.as_class_get_shadow(space)
 
-    def as_blockcontext_get_shadow(self):
-        self.shadow = shadow.BlockContextShadow(space, self)
+    def as_blockcontext_get_shadow(self, space):
+        if not self.shadow:
+            self.shadow = shadow.BlockContextShadow(space, self)
         return self.shadow
 
 def wrap(x):
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to