[pypy-commit] lang-smalltalk strategies-tagging: Fixed the configurable rerased thing.
anton_gulenko
noreply at buildbot.pypy.org
Fri Mar 21 11:27:30 CET 2014
Author: Anton Gulenko <anton.gulenko at googlemail.com>
Branch: strategies-tagging
Changeset: r677:9aca5f6a189d
Date: 2014-03-20 15:33 +0100
http://bitbucket.org/pypy/lang-smalltalk/changeset/9aca5f6a189d/
Log: Fixed the configurable rerased thing.
diff --git a/spyvm/model.py b/spyvm/model.py
--- a/spyvm/model.py
+++ b/spyvm/model.py
@@ -654,8 +654,6 @@
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):
@@ -738,8 +736,26 @@
return False
self.strategy, w_other.strategy = w_other.strategy, self.strategy
self._size, w_other._size = w_other._size, self._size
- self.list_storage, w_other.list_storage = w_other.list_storage, self.list_storage
- self.int_storage, w_other.int_storage = w_other.int_storage, self.int_storage
+
+ # Unfortunately, the following is necessary to work both with RPYTHON and in interpreted mode.
+ # Rpython cannot handle list_storage = None in combination with a rerased pair.
+
+ if hasattr(self, 'list_storage'):
+ if hasattr(w_other, 'list_storage'):
+ self.list_storage, w_other.list_storage = w_other.list_storage, self.list_storage
+ else:
+ w_other.list_storage = self.list_storage
+ elif hasattr(w_other, 'list_storage'):
+ self.list_storage = w_other.list_storage
+
+ if hasattr(self, 'int_storage'):
+ if hasattr(w_other, 'int_storage'):
+ self.int_storage, w_other.int_storage = w_other.int_storage, self.int_storage
+ else:
+ w_other.int_storage = self.int_storage
+ elif hasattr(w_other, 'int_storage'):
+ self.int_storage = w_other.int_storage
+
return W_AbstractPointersObject.become(self, w_other)
@jit.unroll_safe
diff --git a/spyvm/strategies.py b/spyvm/strategies.py
--- a/spyvm/strategies.py
+++ b/spyvm/strategies.py
@@ -30,13 +30,13 @@
strategy_tag = 'abstract-list'
def storage(self, w_obj):
- return w_obj.list_storage
+ return self.unerase(w_obj.list_storage)
def set_initial_storage(self, space, w_obj, size):
- w_obj.list_storage = self.initial_storage(space, size)
+ w_obj.list_storage = self.erase(self.initial_storage(space, size))
def set_storage_for_list(self, space, w_obj, collection):
- w_obj.list_storage = self.storage_for_list(space, collection)
+ w_obj.list_storage = self.erase(self.storage_for_list(space, collection))
def set_storage_copied_from(self, space, w_obj, w_source_obj, reuse_storage=False):
- w_obj.list_storage = self.copy_storage_from(space, w_source_obj, reuse_storage)
+ w_obj.list_storage = self.erase(self.copy_storage_from(space, w_source_obj, reuse_storage))
def initial_storage(self, space, size):
raise NotImplementedError("Abstract base class")
More information about the pypy-commit
mailing list