def _become(self, w_other): if isinstance(w_other, W_AbstractFloat): raise error.PrimitiveFailedError self_value, w_other_value = self.getvalue(), w_other.getvalue() self.setvalue(w_other_value) w_other.setvalue(self_value) W_AbstractObjectWithIdentityHash._become(self, w_other)
def _become(self, w_other): if not isinstance(w_other, W_BlockClosure): raise error.PrimitiveFailedError self.changed() # aborts trace self._w_outerContext, w_other._w_outerContext = w_other._w_outerContext, self._w_outerContext self._startpc_stacklen_args, w_other._startpc_stacklen_args = w_other._startpc_stacklen_args, self._startpc_stacklen_args self._stack, w_other._stack = w_other._stack, self._stack W_AbstractObjectWithIdentityHash._become(self, w_other)
def _become(self, w_other): if not isinstance(w_other, W_PointersObject): raise error.PrimitiveFailedError # Make sure our class shadow is initialized, we will need it if self.getclass(None) and self.getclass(None).has_space(): self.class_shadow(self.getclass(None).space()) if w_other.getclass(None) and w_other.getclass(None).has_space(): w_other.class_shadow(w_other.getclass(None).space()) # Only one strategy will handle the become (or none of them). # The receivers strategy gets the first shot. # If it doesn't want to, let the w_other's strategy handle it. if self.has_strategy() and self._get_strategy().handles_become(): self.strategy.become(w_other) elif w_other.has_strategy() and w_other._get_strategy().handles_become(): w_other.strategy.become(self) self.strategy, w_other.strategy = w_other.strategy, self.strategy self._storage, w_other._storage = w_other._storage, self._storage W_AbstractObjectWithIdentityHash._become(self, w_other)
def _become(self, w_other): if not isinstance(w_other, W_PointersObject): raise error.PrimitiveFailedError # Make sure our class shadow is initialized, we will need it if self.getclass(None) and self.getclass(None).has_space(): self.class_shadow(self.getclass(None).space()) if w_other.getclass(None) and w_other.getclass(None).has_space(): w_other.class_shadow(w_other.getclass(None).space()) # Only one strategy will handle the become (or none of them). # The receivers strategy gets the first shot. # If it doesn't want to, let the w_other's strategy handle it. if self.has_strategy() and self._get_strategy().handles_become(): self.strategy.become(w_other) elif w_other.has_strategy() and w_other._get_strategy().handles_become( ): w_other.strategy.become(self) self.strategy, w_other.strategy = w_other.strategy, self.strategy self._storage, w_other._storage = w_other._storage, self._storage W_AbstractObjectWithIdentityHash._become(self, w_other)
def _become(self, w_other): if not isinstance(w_other, W_CompiledMethod): raise error.PrimitiveFailedError self.argsize, w_other.argsize = w_other.argsize, self.argsize self._primitive, w_other._primitive = w_other._primitive, self._primitive self.literals, w_other.literals = w_other.literals, self.literals self._tempsize, w_other._tempsize = w_other._tempsize, self._tempsize self.bytes, w_other.bytes = w_other.bytes, self.bytes self.header, w_other.header = w_other.header, self.header self.literalsize, w_other.literalsize = w_other.literalsize, self.literalsize self.islarge, w_other.islarge = w_other.islarge, self.islarge self.lookup_selector, w_other.lookup_selector = w_other.lookup_selector, self.lookup_selector self.compiledin_class, w_other.compiledin_class = w_other.compiledin_class, self.compiledin_class W_AbstractObjectWithIdentityHash._become(self, w_other) if isinstance(self.compiledin_class, W_PointersObject): space = self.compiledin_class.space() self.compiledin_class.as_class_get_shadow(space).flush_method_caches() if isinstance(w_other.compiledin_class, W_PointersObject): space = w_other.compiledin_class.space() w_other.compiledin_class.as_class_get_shadow(space).flush_method_caches()
def _become(self, w_other): if not isinstance(w_other, W_Character): raise error.PrimitiveFailedError self.value, w_other.value = w_other.value, self.value W_AbstractObjectWithIdentityHash._become(self, w_other)