[pypy-svn] r77600 - in pypy/branch/32ptr-on-64bit/pypy: rpython rpython/lltypesystem translator/c
arigo at codespeak.net
arigo at codespeak.net
Tue Oct 5 14:27:23 CEST 2010
Author: arigo
Date: Tue Oct 5 14:27:21 2010
New Revision: 77600
Modified:
pypy/branch/32ptr-on-64bit/pypy/rpython/lltypesystem/rcompressed.py
pypy/branch/32ptr-on-64bit/pypy/rpython/rmodel.py
pypy/branch/32ptr-on-64bit/pypy/translator/c/node.py
pypy/branch/32ptr-on-64bit/pypy/translator/c/primitive.py
Log:
Check-in before I think about changing the approach.
Modified: pypy/branch/32ptr-on-64bit/pypy/rpython/lltypesystem/rcompressed.py
==============================================================================
--- pypy/branch/32ptr-on-64bit/pypy/rpython/lltypesystem/rcompressed.py (original)
+++ pypy/branch/32ptr-on-64bit/pypy/rpython/lltypesystem/rcompressed.py Tue Oct 5 14:27:21 2010
@@ -3,7 +3,8 @@
from pypy.config.translationoption import IS_64_BITS
from pypy.rpython.rmodel import Repr, inputconst
from pypy.rpython.lltypesystem import lltype, llmemory, rffi
-
+from pypy.rpython.lltypesystem.lloperation import llop
+from pypy.rpython.error import TyperError
def get_compressed_gcref_repr(rtyper, baserepr):
@@ -38,6 +39,8 @@
class CompressedGcRefRepr(Repr):
lowleveltype = llmemory.HiddenGcRef32
+ ll_hash_function = None
+ ll_fasthash_function = None
def __init__(self, mgr, baserepr):
self.mgr = mgr
@@ -50,6 +53,42 @@
assert T == self.BASETYPE
return llmemory._hiddengcref32(llmemory.cast_ptr_to_adr(ptr))
+ def get_ll_eq_function(self):
+ if self.baserepr.get_ll_eq_function() is not None:
+ raise TyperError("%r has an eq function" % (self.baserepr,))
+ return None
+
+ def get_ll_hash_function(self):
+ if self.ll_hash_function is None:
+ basefunc = self.baserepr.get_ll_hash_function()
+ BASETYPE = self.BASETYPE
+ #
+ def ll_hiddengcref32_hash(x):
+ x = llop.show_from_adr32(BASETYPE, x)
+ return basefunc(x)
+ #
+ return self.ll_hash_function
+
+ def get_ll_fasthash_function(self):
+ if self.ll_fasthash_function is None:
+ basefunc = self.baserepr.get_ll_fasthash_function()
+ if basefunc is None:
+ return None
+ BASETYPE = self.BASETYPE
+ #
+ def ll_hiddengcref32_fasthash(x):
+ x = llop.show_from_adr32(BASETYPE, x)
+ return basefunc(x)
+ #
+ return self.ll_fasthash_function
+
+ def get_ll_dummyval_obj(self, rtyper, s_value):
+ DummyVal()
+
+
+class DummyVal(object):
+ ll_dummy_value = llop.hide_into_adr32xxx
+
class __extend__(pairtype(Repr, CompressedGcRefRepr)):
def convert_from_to((r_from, r_to), v, llops):
Modified: pypy/branch/32ptr-on-64bit/pypy/rpython/rmodel.py
==============================================================================
--- pypy/branch/32ptr-on-64bit/pypy/rpython/rmodel.py (original)
+++ pypy/branch/32ptr-on-64bit/pypy/rpython/rmodel.py Tue Oct 5 14:27:21 2010
@@ -438,8 +438,11 @@
from pypy.rpython import rclass
if (isinstance(item_repr, rclass.AbstractInstanceRepr) and
getattr(item_repr, 'gcflavor', 'gc') == 'gc'):
- #if rtyper.annotator.translator.config.translation.compressptr:
- # return externalvsinternalfield(rtyper, item_repr)
+ if rtyper.annotator.translator.config.translation.compressptr:
+ item_repr, internal_item_repr = externalvsinternalfield(rtyper,
+ item_repr)
+ if internal_item_repr is not item_repr:
+ return item_repr, internal_item_repr
return item_repr, rclass.getinstancerepr(rtyper, None)
return item_repr, item_repr
Modified: pypy/branch/32ptr-on-64bit/pypy/translator/c/node.py
==============================================================================
--- pypy/branch/32ptr-on-64bit/pypy/translator/c/node.py (original)
+++ pypy/branch/32ptr-on-64bit/pypy/translator/c/node.py Tue Oct 5 14:27:21 2010
@@ -789,7 +789,7 @@
expr = '0.0 /* patched later by %sinfinity */' % (
'-+'[value > 0])
elif TYPE == llmemory.HiddenGcRef32:
- if value.adr64:
+ if value.special_value is None:
name = db.get(value.adr64.ptr)
db.late_initializations_hiddengcref32.append((access_expr,
name))
@@ -797,7 +797,8 @@
name = '(%s)' % name
expr = '0 /*HIDE_INTO_ADR32%s*/' % name
else:
- expr = '0'
+ assert isinstance(value.special_value, int)
+ expr = str(value.special_value)
else:
expr = db.get(value)
if TYPE is Void:
Modified: pypy/branch/32ptr-on-64bit/pypy/translator/c/primitive.py
==============================================================================
--- pypy/branch/32ptr-on-64bit/pypy/translator/c/primitive.py (original)
+++ pypy/branch/32ptr-on-64bit/pypy/translator/c/primitive.py Tue Oct 5 14:27:21 2010
@@ -150,7 +150,8 @@
def name_hiddengcref32(value, db):
# The only prebuilt HiddenGcRef32 that should occur in a translated C
# program occur as fields or items of a GcStruct or GcArray.
- db.get(value.adr64)
+ if not value.special_value:
+ db.get(value.adr64)
return 'HIDE_INTO_ADR32(???) /* see primitive.py, name_hiddengcref32() */'
def name_small_integer(value, db):
More information about the Pypy-commit
mailing list