Author: Anton Gulenko <anton.gule...@googlemail.com> Branch: strategies-tagging Changeset: r678:4aa0466bbb5a Date: 2014-03-20 16:14 +0100 http://bitbucket.org/pypy/lang-smalltalk/changeset/4aa0466bbb5a/
Log: Fix did not work, had to use we_are_translated(). Also removed obsolete pieces of fieldtype functionality. diff --git a/spyvm/model.py b/spyvm/model.py --- a/spyvm/model.py +++ b/spyvm/model.py @@ -22,7 +22,7 @@ from rpython.rlib.rarithmetic import intmask, r_uint, r_int from rpython.rlib.debug import make_sure_not_resized from rpython.tool.pairtype import extendabletype -from rpython.rlib.objectmodel import instantiate, compute_hash, import_from_mixin +from rpython.rlib.objectmodel import instantiate, compute_hash, import_from_mixin, we_are_translated from rpython.rtyper.lltypesystem import lltype, rffi from rsdl import RSDL, RSDL_helper @@ -143,10 +143,6 @@ def unwrap_uint(self, space): raise error.UnwrappingError("Got unexpected class in unwrap_uint") - def fieldtype(self): - from spyvm.strategies import obj - return obj - def is_array_object(self): return False @@ -221,10 +217,6 @@ def clone(self, space): return self - def fieldtype(self): - from spyvm.strategies import SInt - return SInt - class W_AbstractObjectWithIdentityHash(W_Object): """Object with explicit hash (ie all except small ints and floats).""" @@ -327,10 +319,6 @@ def invariant(self): return isinstance(self.value, int) - def fieldtype(self): - from spyvm.strategies import LPI - return LPI - def is_array_object(self): return True @@ -422,10 +410,6 @@ def size(self): return 2 - def fieldtype(self): - from spyvm.strategies import flt - return flt - @signature.finishsigs class W_AbstractObjectWithClassReference(W_AbstractObjectWithIdentityHash): """Objects with arbitrary class (ie not CompiledMethod, SmallInteger or @@ -654,6 +638,9 @@ class W_PointersObject(W_AbstractPointersObject): _attrs_ = ['_size', 'list_storage', 'int_storage', 'strategy'] + if not we_are_translated(): + list_storage = None + int_storage = None @jit.unroll_safe def __init__(self, space, w_class, size): @@ -736,26 +723,8 @@ return False self.strategy, w_other.strategy = w_other.strategy, self.strategy self._size, w_other._size = w_other._size, self._size - - # 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 - + 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 return W_AbstractPointersObject.become(self, w_other) @jit.unroll_safe @@ -766,13 +735,9 @@ self.log_strategy_operation("Cloned") return w_result - def fieldtype(self): - from spyvm.strategies import obj - return obj - class W_WeakPointersObject(W_AbstractPointersObject): _attrs_ = ['_weakvars'] - + @jit.unroll_safe def __init__(self, space, w_class, size): W_AbstractPointersObject.__init__(self, space, w_class, size) diff --git a/spyvm/test/test_strategies.py b/spyvm/test/test_strategies.py --- a/spyvm/test/test_strategies.py +++ b/spyvm/test/test_strategies.py @@ -4,8 +4,6 @@ from spyvm.test import test_miniimage as tools from spyvm.error import WrapperException, FatalError -# Fieldtypes have a separate test file - space, interp = tools.setup_module(tools, filename='bootstrapped.image') class_Array = space.classtable["w_Array"] _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit