[pypy-commit] pypy win64-stage1: solved an old win64 rffi issue, finally
ctismer
noreply at buildbot.pypy.org
Sat Mar 17 05:32:49 CET 2012
Author: Christian Tismer <tismer at stackless.com>
Branch: win64-stage1
Changeset: r53746:7ef5dc4e91a4
Date: 2012-03-17 05:32 +0100
http://bitbucket.org/pypy/pypy/changeset/7ef5dc4e91a4/
Log: solved an old win64 rffi issue, finally
diff --git a/pypy/rpython/lltypesystem/rffi.py b/pypy/rpython/lltypesystem/rffi.py
--- a/pypy/rpython/lltypesystem/rffi.py
+++ b/pypy/rpython/lltypesystem/rffi.py
@@ -18,7 +18,7 @@
from pypy.rlib.rstring import StringBuilder, UnicodeBuilder, assert_str0
from pypy.rlib import jit
from pypy.rpython.lltypesystem import llmemory
-from pypy.rlib.rarithmetic import LONG_BIT
+from pypy.rlib.rarithmetic import maxint, LONG_BIT
import os, sys
class CConstant(Symbolic):
@@ -933,14 +933,11 @@
offsetof._annspecialcase_ = 'specialize:memo'
# check that we have a sane configuration
-# XXX re-enable this after correcting the windows case
-"""
assert maxint == (1 << (8 * sizeof(lltype.Signed) - 1)) - 1, (
"Mixed configuration of the word size of the machine:\n\t"
"the underlying Python was compiled with maxint=%d,\n\t"
"but the C compiler says that 'long' is %d bytes" % (
maxint, sizeof(lltype.Signed)))
-"""
# ********************** some helpers *******************
diff --git a/pypy/rpython/lltypesystem/test/test_rffi.py b/pypy/rpython/lltypesystem/test/test_rffi.py
--- a/pypy/rpython/lltypesystem/test/test_rffi.py
+++ b/pypy/rpython/lltypesystem/test/test_rffi.py
@@ -180,7 +180,7 @@
struct.c_three = cast(INT, 5)
result = z(struct)
lltype.free(struct, flavor='raw')
- return cast(LONG, result)
+ return cast(SIGNED, result)
fn = self.compile(f, [], backendopt=False)
assert fn() == 8
@@ -377,7 +377,7 @@
h_source = py.code.Source("""
#ifndef _CALLBACK_H
#define _CALLBACK_H
- extern long eating_callback(long arg, long(*call)(long));
+ extern Signed eating_callback(Signed arg, Signed(*call)(Signed));
#endif /* _CALLBACK_H */
""")
@@ -385,9 +385,9 @@
h_include.write(h_source)
c_source = py.code.Source("""
- long eating_callback(long arg, long(*call)(long))
+ Signed eating_callback(Signed arg, Signed(*call)(Signed))
{
- long res = call(arg);
+ Signed res = call(arg);
if (res == -1)
return -1;
return res;
@@ -399,8 +399,8 @@
separate_module_sources=[c_source],
export_symbols=['eating_callback'])
- args = [LONG, CCallback([LONG], LONG)]
- eating_callback = llexternal('eating_callback', args, LONG,
+ args = [SIGNED, CCallback([SIGNED], SIGNED)]
+ eating_callback = llexternal('eating_callback', args, SIGNED,
compilation_info=eci)
return eating_callback
@@ -554,13 +554,13 @@
p = make(X, c_one=cast(INT, 3))
res = p.c_one
lltype.free(p, flavor='raw')
- return cast(LONG, res)
+ return cast(SIGNED, res)
assert f() == 3
assert interpret(f, []) == 3
def test_structcopy(self):
- X2 = lltype.Struct('X2', ('x', LONG))
- X1 = lltype.Struct('X1', ('a', LONG), ('x2', X2), ('p', lltype.Ptr(X2)))
+ X2 = lltype.Struct('X2', ('x', SIGNED))
+ X1 = lltype.Struct('X1', ('a', SIGNED), ('x2', X2), ('p', lltype.Ptr(X2)))
def f():
p2 = make(X2, x=123)
p1 = make(X1, a=5, p=p2)
@@ -620,7 +620,7 @@
eci = ExternalCompilationInfo(includes=['string.h'])
strlen = llexternal('strlen', [CCHARP], SIZE_T, compilation_info=eci)
def f():
- return cast(LONG, strlen("Xxx"))
+ return cast(SIGNED, strlen("Xxx"))
assert interpret(f, [], backendopt=True) == 3
def test_stringpolicy3(self):
@@ -643,7 +643,7 @@
ll_str = str2charp("Xxx")
res2 = strlen(ll_str)
lltype.free(ll_str, flavor='raw')
- return cast(LONG, res1*10 + res2)
+ return cast(SIGNED, res1*10 + res2)
assert interpret(f, [], backendopt=True) == 43
More information about the pypy-commit
mailing list