[pypy-svn] r26846 - in pypy/dist/pypy/rpython: . lltypesystem
arigo at codespeak.net
arigo at codespeak.net
Sat May 6 10:47:13 CEST 2006
Author: arigo
Date: Sat May 6 10:47:12 2006
New Revision: 26846
Modified:
pypy/dist/pypy/rpython/lltypesystem/rtagged.py
pypy/dist/pypy/rpython/rclass.py
Log:
More fixes for TaggedInstanceRepr.convert_const(). We need most of the
parent's logic.
Modified: pypy/dist/pypy/rpython/lltypesystem/rtagged.py
==============================================================================
--- pypy/dist/pypy/rpython/lltypesystem/rtagged.py (original)
+++ pypy/dist/pypy/rpython/lltypesystem/rtagged.py Sat May 6 10:47:12 2006
@@ -5,7 +5,6 @@
from pypy.rpython.lltypesystem.rclass import MissingRTypeAttribute
from pypy.rpython.lltypesystem.rclass import ll_issubclass_const
from pypy.rpython.rmodel import TyperError, inputconst
-from pypy.rpython.objectmodel import UnboxedValue
class TaggedInstanceRepr(InstanceRepr):
@@ -52,12 +51,9 @@
resulttype = self.lowleveltype)
return v_instance, False # don't call __init__
- def convert_const(self, value):
- if isinstance(value, UnboxedValue):
- number = value.getvalue()
- return ll_int_to_unboxed(self.lowleveltype, number)
- else:
- return InstanceRepr.convert_const(self, value)
+ def convert_const_exact(self, value):
+ number = value.getvalue()
+ return ll_int_to_unboxed(self.lowleveltype, number)
def getvalue_from_unboxed(self, llops, vinst):
assert not self.is_parent
Modified: pypy/dist/pypy/rpython/rclass.py
==============================================================================
--- pypy/dist/pypy/rpython/rclass.py (original)
+++ pypy/dist/pypy/rpython/rclass.py Sat May 6 10:47:12 2006
@@ -155,13 +155,16 @@
result = rinstance.convert_const(value)
return self.upcast(result)
# common case
+ return self.convert_const_exact(value)
+
+ def convert_const_exact(self, value):
try:
return self.prebuiltinstances[id(value)][1]
except KeyError:
self.setup()
result = self.create_instance()
self.prebuiltinstances[id(value)] = value, result
- self.initialize_prebuilt_instance(value, classdef, result)
+ self.initialize_prebuilt_instance(value, self.classdef, result)
return result
def rtype_type(self, hop):
More information about the Pypy-commit
mailing list