[pypy-svn] r46617 - pypy/dist/pypy/rpython
arigo at codespeak.net
arigo at codespeak.net
Sat Sep 15 11:40:08 CEST 2007
Author: arigo
Date: Sat Sep 15 11:40:07 2007
New Revision: 46617
Modified:
pypy/dist/pypy/rpython/rbuiltin.py
Log:
More cases in gen_cast(). This seems to be enough to make
jit.gencode.i386.test.test_rgenop pass (didn't run all tests yet).
rffi+ll2ctypes is kind of amazing...
Modified: pypy/dist/pypy/rpython/rbuiltin.py
==============================================================================
--- pypy/dist/pypy/rpython/rbuiltin.py (original)
+++ pypy/dist/pypy/rpython/rbuiltin.py Sat Sep 15 11:40:07 2007
@@ -459,6 +459,20 @@
return llops.genop('cast_int_to_ptr', [v_value], resulttype=TGT)
elif TGT == llmemory.Address and isinstance(ORIG, lltype.Ptr):
return llops.genop('cast_ptr_to_adr', [v_value], resulttype = TGT)
+ elif isinstance(TGT, lltype.Primitive) and TGT in _cast_from_Signed:
+ if isinstance(ORIG, lltype.Ptr):
+ v_value = llops.genop('cast_ptr_to_int', [v_value],
+ resulttype=lltype.Signed)
+ elif ORIG == llmemory.Address:
+ v_value = llops.genop('cast_adr_to_int', [v_value],
+ resulttype=lltype.Signed)
+ else:
+ raise TypeError("don't know how to cast from %r to %r" % (ORIG,
+ TGT))
+ op = _cast_from_Signed[TGT]
+ if op:
+ v_value = llops.genop(op, [v_value], resulttype=TGT)
+ return v_value
raise TypeError("don't know how to cast from %r to %r" % (ORIG, TGT))
def rtype_cast_ptr_to_int(hop):
More information about the Pypy-commit
mailing list