[pypy-svn] r20878 - in pypy/dist/pypy: annotation rpython rpython/module translator/c/src

mwh at codespeak.net mwh at codespeak.net
Thu Dec 8 11:18:29 CET 2005


Author: mwh
Date: Thu Dec  8 11:18:27 2005
New Revision: 20878

Modified:
   pypy/dist/pypy/annotation/builtin.py
   pypy/dist/pypy/rpython/extfunctable.py
   pypy/dist/pypy/rpython/module/ll_os.py
   pypy/dist/pypy/rpython/rbuiltin.py
   pypy/dist/pypy/translator/c/src/int.h
Log:
ll_os_lseek now returns a long long.  this required changing
far too many places in the code...


Modified: pypy/dist/pypy/annotation/builtin.py
==============================================================================
--- pypy/dist/pypy/annotation/builtin.py	(original)
+++ pypy/dist/pypy/annotation/builtin.py	Thu Dec  8 11:18:27 2005
@@ -85,6 +85,10 @@
     return constpropagate(pypy.rpython.rarithmetic.r_uint, [s_obj],
                           SomeInteger(nonneg=True, unsigned=True))
 
+def restricted_longlong(s_obj):    # for r_uint
+    return constpropagate(pypy.rpython.rarithmetic.r_longlong, [s_obj],
+                          SomeInteger(size=2))
+
 def builtin_float(s_obj):
     return constpropagate(float, [s_obj], SomeFloat())
 
@@ -314,6 +318,7 @@
         BUILTIN_ANALYZERS[original] = value
 
 BUILTIN_ANALYZERS[pypy.rpython.rarithmetic.r_uint] = restricted_uint
+BUILTIN_ANALYZERS[pypy.rpython.rarithmetic.r_longlong] = restricted_longlong
 ##BUILTIN_ANALYZERS[pypy.rpython.rarithmetic.ovfcheck] = rarith_ovfcheck
 ##BUILTIN_ANALYZERS[pypy.rpython.rarithmetic.ovfcheck_lshift] = rarith_ovfcheck_lshift
 BUILTIN_ANALYZERS[pypy.rpython.rarithmetic.intmask] = rarith_intmask

Modified: pypy/dist/pypy/rpython/extfunctable.py
==============================================================================
--- pypy/dist/pypy/rpython/extfunctable.py	(original)
+++ pypy/dist/pypy/rpython/extfunctable.py	Thu Dec  8 11:18:27 2005
@@ -5,7 +5,7 @@
 import time
 import math
 import types
-
+from pypy.rpython.rarithmetic import r_longlong
 
 class ExtFuncInfo:
     def __init__(self, func, annotation, ll_function_path, ll_annotable, backend_functiontemplate):
@@ -149,7 +149,7 @@
 declare(os.write    , posannotation , 'll_os/write')
 declare(os.close    , noneannotation, 'll_os/close')
 declare(os.dup      , int           , 'll_os/dup')
-declare(os.lseek    , int           , 'll_os/lseek')
+declare(os.lseek    , r_longlong    , 'll_os/lseek')
 declare(os.isatty   , bool          , 'll_os/isatty')
 if hasattr(posix, 'ftruncate'):
     declare(os.ftruncate, noneannotation, 'll_os/ftruncate')

Modified: pypy/dist/pypy/rpython/module/ll_os.py
==============================================================================
--- pypy/dist/pypy/rpython/module/ll_os.py	(original)
+++ pypy/dist/pypy/rpython/module/ll_os.py	Thu Dec  8 11:18:27 2005
@@ -20,6 +20,7 @@
 from pypy.rpython.module.support import to_rstr, from_rstr, ll_strcpy, _ll_strfill
 from pypy.rpython.module.support import to_opaque_object, from_opaque_object
 from pypy.rpython import ros
+from pypy.rpython.rarithmetic import r_longlong
 
 def ll_os_open(fname, flag, mode):
     return os.open(from_rstr(fname), flag, mode)
@@ -64,7 +65,7 @@
 ll_os_dup.suggested_primitive = True
 
 def ll_os_lseek(fd,pos,how):
-    return intmask(os.lseek(fd,pos,how))
+    return r_longlong(os.lseek(fd,pos,how))
 ll_os_lseek.suggested_primitive = True
 
 def ll_os_isatty(fd):

Modified: pypy/dist/pypy/rpython/rbuiltin.py
==============================================================================
--- pypy/dist/pypy/rpython/rbuiltin.py	(original)
+++ pypy/dist/pypy/rpython/rbuiltin.py	Thu Dec  8 11:18:27 2005
@@ -146,6 +146,10 @@
     vlist = hop.inputargs(lltype.Unsigned)
     return vlist[0]
 
+def rtype_r_longlong(hop):
+    vlist = hop.inputargs(lltype.SignedLongLong)
+    return vlist[0]
+
 def rtype_builtin_min(hop):
     rint1, rint2 = hop.args_r
     assert isinstance(rint1, IntegerRepr)
@@ -281,6 +285,7 @@
 BUILTIN_TYPER[lltype.runtime_type_info] = rtype_runtime_type_info
 BUILTIN_TYPER[rarithmetic.intmask] = rtype_intmask
 BUILTIN_TYPER[rarithmetic.r_uint] = rtype_r_uint
+BUILTIN_TYPER[rarithmetic.r_longlong] = rtype_r_longlong
 BUILTIN_TYPER[objectmodel.r_dict] = rtype_r_dict
 BUILTIN_TYPER[objectmodel.we_are_translated] = rtype_we_are_translated
 BUILTIN_TYPER[rstack.yield_current_frame_to_caller] = (

Modified: pypy/dist/pypy/translator/c/src/int.h
==============================================================================
--- pypy/dist/pypy/translator/c/src/int.h	(original)
+++ pypy/dist/pypy/translator/c/src/int.h	Thu Dec  8 11:18:27 2005
@@ -277,4 +277,6 @@
 #define OP_UINT_XOR OP_INT_XOR
 
 #define OP_ULLONG_MUL OP_INT_MUL
+
 #define OP_LLONG_MUL OP_INT_MUL
+#define OP_LLONG_EQ OP_INT_EQ



More information about the Pypy-commit mailing list