[pypy-commit] pypy win64_gborg: modulo 4 tests (flot/unicode conversion), it all works.
ctismer
noreply at buildbot.pypy.org
Sun Nov 6 15:04:02 CET 2011
Author: Christian Tismer <tismer at stackless.com>
Branch: win64_gborg
Changeset: r48827:c4ab5a26c418
Date: 2011-11-06 15:02 +0100
http://bitbucket.org/pypy/pypy/changeset/c4ab5a26c418/
Log: modulo 4 tests (flot/unicode conversion), it all works. Renamed
stuff to 'Signed', 'Unsigned' after a suggestion from Armin.
diff --git a/pypy/rlib/rarithmetic.py b/pypy/rlib/rarithmetic.py
--- a/pypy/rlib/rarithmetic.py
+++ b/pypy/rlib/rarithmetic.py
@@ -72,7 +72,8 @@
"""get the bit pattern for a long, adjusted to pointer size"""
return struct.pack(_long_typecode, x)
-# used in tests for ctypes:
+# used in tests for ctypes and for genc and friends
+# to handle the win64 special case:
is_emulated_long = _long_typecode <> 'l'
LONG_BIT = _get_long_bit()
diff --git a/pypy/translator/c/src/address.h b/pypy/translator/c/src/address.h
--- a/pypy/translator/c/src/address.h
+++ b/pypy/translator/c/src/address.h
@@ -16,5 +16,5 @@
#define OP_ADR_LT(x,y,r) r = ((x) < (y))
#define OP_ADR_GE(x,y,r) r = ((x) >= (y))
-#define OP_CAST_ADR_TO_INT(x, mode, r) r = ((new_long)x)
+#define OP_CAST_ADR_TO_INT(x, mode, r) r = ((Signed)x)
#define OP_CAST_INT_TO_ADR(x, r) r = ((void *)(x))
diff --git a/pypy/translator/c/src/asm_gcc_x86_64.h b/pypy/translator/c/src/asm_gcc_x86_64.h
--- a/pypy/translator/c/src/asm_gcc_x86_64.h
+++ b/pypy/translator/c/src/asm_gcc_x86_64.h
@@ -2,7 +2,7 @@
*/
#define READ_TIMESTAMP(val) do { \
- unsigned new_long _rax, _rdx; \
+ Unsigned _rax, _rdx; \
asm volatile("rdtsc" : "=a"(_rax), "=d"(_rdx)); \
val = (_rdx << 32) | _rax; \
} while (0)
diff --git a/pypy/translator/c/src/float.h b/pypy/translator/c/src/float.h
--- a/pypy/translator/c/src/float.h
+++ b/pypy/translator/c/src/float.h
@@ -31,8 +31,8 @@
/*** conversions ***/
-#define OP_CAST_FLOAT_TO_INT(x,r) r = (new_long)(x)
-#define OP_CAST_FLOAT_TO_UINT(x,r) r = (unsigned new_long)(x)
+#define OP_CAST_FLOAT_TO_INT(x,r) r = (Signed)(x)
+#define OP_CAST_FLOAT_TO_UINT(x,r) r = (Unsigned)(x)
#define OP_CAST_INT_TO_FLOAT(x,r) r = (double)(x)
#define OP_CAST_UINT_TO_FLOAT(x,r) r = (double)(x)
#define OP_CAST_LONGLONG_TO_FLOAT(x,r) r = (double)(x)
diff --git a/pypy/translator/c/src/g_prerequisite.h b/pypy/translator/c/src/g_prerequisite.h
--- a/pypy/translator/c/src/g_prerequisite.h
+++ b/pypy/translator/c/src/g_prerequisite.h
@@ -9,12 +9,13 @@
#endif
#ifdef _WIN64
-# define new_long __int64
-# define NEW_LONG_MIN LLONG_MIN
+# define Signed __int64
+# define SIGNED_MIN LLONG_MIN
#else
-# define new_long long
-# define NEW_LONG_MIN LONG_MIN
+# define Signed long
+# define SIGNED_MIN LONG_MIN
#endif
+#define Unsigned unsigned Signed
#ifdef _WIN32
# include <io.h> /* needed, otherwise _lseeki64 truncates to 32-bits (??) */
diff --git a/pypy/translator/c/src/int.h b/pypy/translator/c/src/int.h
--- a/pypy/translator/c/src/int.h
+++ b/pypy/translator/c/src/int.h
@@ -7,12 +7,12 @@
/************ win64 support:
- 'new_long' must be defined as
+ 'Signed' must be defined as
__int64 in case of win64
long in all other cases
- 'NEW_LONG_MIN' must be defined as
+ 'SIGNED_MIN' must be defined as
LLONG_MIN in case of win64
LONG_MIN in all other cases
@@ -23,13 +23,13 @@
#define OP_INT_NEG(x,r) r = -(x)
#define OP_INT_NEG_OVF(x,r) \
- if ((x) == NEW_LONG_MIN) FAIL_OVF("integer negate"); \
+ if ((x) == SIGNED_MIN) FAIL_OVF("integer negate"); \
OP_INT_NEG(x,r)
#define OP_INT_ABS(x,r) r = (x) >= 0 ? x : -(x)
#define OP_INT_ABS_OVF(x,r) \
- if ((x) == NEW_LONG_MIN) FAIL_OVF("integer absolute"); \
+ if ((x) == SIGNED_MIN) FAIL_OVF("integer absolute"); \
OP_INT_ABS(x,r)
/*** binary operations ***/
@@ -46,8 +46,8 @@
for the case of a == 0 (both subtractions are then constant-folded).
Note that the following line only works if a <= c in the first place,
which we assume is true. */
-#define OP_INT_BETWEEN(a,b,c,r) r = (((unsigned new_long)b - (unsigned new_long)a) \
- < ((unsigned new_long)c - (unsigned new_long)a))
+#define OP_INT_BETWEEN(a,b,c,r) r = (((Unsigned)b - (Unsigned)a) \
+ < ((Unsigned)c - (Unsigned)a))
/* addition, subtraction */
@@ -55,17 +55,17 @@
/* cast to avoid undefined behaviour on overflow */
#define OP_INT_ADD_OVF(x,y,r) \
- r = (new_long)((unsigned new_long)x + y); \
+ r = (Signed)((Unsigned)x + y); \
if ((r^x) < 0 && (r^y) < 0) FAIL_OVF("integer addition")
#define OP_INT_ADD_NONNEG_OVF(x,y,r) /* y can be assumed >= 0 */ \
- r = (new_long)((unsigned new_long)x + y); \
+ r = (Signed)((Unsigned)x + y); \
if ((r&~x) < 0) FAIL_OVF("integer addition")
#define OP_INT_SUB(x,y,r) r = (x) - (y)
#define OP_INT_SUB_OVF(x,y,r) \
- r = (new_long)((unsigned new_long)x - y); \
+ r = (Signed)((Unsigned)x - y); \
if ((r^x) < 0 && (r^~y) < 0) FAIL_OVF("integer subtraction")
#define OP_INT_MUL(x,y,r) r = (x) * (y)
@@ -91,7 +91,7 @@
#define OP_INT_RSHIFT(x,y,r) CHECK_SHIFT_RANGE(y, PYPY_LONG_BIT); \
- r = Py_ARITHMETIC_RIGHT_SHIFT(new_long, x, (y))
+ r = Py_ARITHMETIC_RIGHT_SHIFT(Signed, x, (y))
#define OP_UINT_RSHIFT(x,y,r) CHECK_SHIFT_RANGE(y, PYPY_LONG_BIT); \
r = (x) >> (y)
#define OP_LLONG_RSHIFT(x,y,r) CHECK_SHIFT_RANGE(y, PYPY_LONGLONG_BIT); \
@@ -111,7 +111,7 @@
#define OP_INT_LSHIFT_OVF(x,y,r) \
OP_INT_LSHIFT(x,y,r); \
- if ((x) != Py_ARITHMETIC_RIGHT_SHIFT(new_long, r, (y))) \
+ if ((x) != Py_ARITHMETIC_RIGHT_SHIFT(Signed, r, (y))) \
FAIL_OVF("x<<y losing bits or changing sign")
/* floor division */
@@ -122,7 +122,7 @@
#define OP_ULLONG_FLOORDIV(x,y,r) r = (x) / (y)
#define OP_INT_FLOORDIV_OVF(x,y,r) \
- if ((y) == -1 && (x) == NEW_LONG_MIN) \
+ if ((y) == -1 && (x) == SIGNED_MIN) \
{ FAIL_OVF("integer division"); r=0; } \
else \
r = (x) / (y)
@@ -162,7 +162,7 @@
#define OP_ULLONG_MOD(x,y,r) r = (x) % (y)
#define OP_INT_MOD_OVF(x,y,r) \
- if ((y) == -1 && (x) == NEW_LONG_MIN) \
+ if ((y) == -1 && (x) == SIGNED_MIN) \
{ FAIL_OVF("integer modulo"); r=0; } \
else \
r = (x) % (y)
@@ -201,18 +201,18 @@
/*** conversions ***/
-#define OP_CAST_BOOL_TO_INT(x,r) r = (new_long)(x)
-#define OP_CAST_BOOL_TO_UINT(x,r) r = (unsigned new_long)(x)
-#define OP_CAST_UINT_TO_INT(x,r) r = (new_long)(x)
-#define OP_CAST_INT_TO_UINT(x,r) r = (unsigned new_long)(x)
+#define OP_CAST_BOOL_TO_INT(x,r) r = (Signed)(x)
+#define OP_CAST_BOOL_TO_UINT(x,r) r = (Unsigned)(x)
+#define OP_CAST_UINT_TO_INT(x,r) r = (Signed)(x)
+#define OP_CAST_INT_TO_UINT(x,r) r = (Unsigned)(x)
#define OP_CAST_INT_TO_LONGLONG(x,r) r = (long long)(x)
-#define OP_CAST_CHAR_TO_INT(x,r) r = (new_long)((unsigned char)(x))
+#define OP_CAST_CHAR_TO_INT(x,r) r = (Signed)((unsigned char)(x))
#define OP_CAST_INT_TO_CHAR(x,r) r = (char)(x)
-#define OP_CAST_PTR_TO_INT(x,r) r = (new_long)(x) /* XXX */
+#define OP_CAST_PTR_TO_INT(x,r) r = (Signed)(x) /* XXX */
-#define OP_TRUNCATE_LONGLONG_TO_INT(x,r) r = (new_long)(x)
+#define OP_TRUNCATE_LONGLONG_TO_INT(x,r) r = (Signed)(x)
-#define OP_CAST_UNICHAR_TO_INT(x,r) r = (new_long)((unsigned new_long)(x)) /*?*/
+#define OP_CAST_UNICHAR_TO_INT(x,r) r = (Signed)((Unsigned)(x)) /*?*/
#define OP_CAST_INT_TO_UNICHAR(x,r) r = (unsigned int)(x)
/* bool operations */
diff --git a/pypy/translator/c/src/mem.h b/pypy/translator/c/src/mem.h
--- a/pypy/translator/c/src/mem.h
+++ b/pypy/translator/c/src/mem.h
@@ -53,7 +53,7 @@
extern void* __gcmapstart;
extern void* __gcmapend;
extern char* __gccallshapes;
-extern new_long pypy_asm_stackwalk(void*, void*);
+extern Signed pypy_asm_stackwalk(void*, void*);
/* With the msvc Microsoft Compiler, the optimizer seems free to move
any code (even asm) that involves local memory (registers and stack).
@@ -66,7 +66,7 @@
pypy_asm_gcroot(void* _r1)
{
static volatile int _constant_always_one_ = 1;
- (new_long)_r1 *= _constant_always_one_;
+ (Signed)_r1 *= _constant_always_one_;
_ReadWriteBarrier();
return _r1;
}
@@ -86,7 +86,7 @@
/* used by pypy.rlib.rstack, but also by asmgcc */
-#define OP_STACK_CURRENT(r) r = (new_long)&r
+#define OP_STACK_CURRENT(r) r = (Signed)&r
#define RAW_MALLOC_ZERO_FILLED 0
diff --git a/pypy/translator/c/src/obmalloc.c b/pypy/translator/c/src/obmalloc.c
--- a/pypy/translator/c/src/obmalloc.c
+++ b/pypy/translator/c/src/obmalloc.c
@@ -224,10 +224,10 @@
#define uint unsigned int /* assuming >= 16 bits */
#undef ulong
-#define ulong unsigned new_long /* assuming >= 32 bits */
+#define ulong Unsigned /* assuming >= 32 bits */
#undef uptr
-#define uptr unsigned new_long
+#define uptr Unsigned
/* When you say memory, my mind reasons in terms of (pointers to) blocks */
typedef uchar block;
diff --git a/pypy/translator/c/src/rtyper.h b/pypy/translator/c/src/rtyper.h
--- a/pypy/translator/c/src/rtyper.h
+++ b/pypy/translator/c/src/rtyper.h
@@ -30,7 +30,7 @@
char *RPyString_AsCharP(RPyString *rps)
{
- new_long len = RPyString_Size(rps);
+ Signed len = RPyString_Size(rps);
struct _RPyString_dump_t *dump = \
malloc(sizeof(struct _RPyString_dump_t) + len);
if (!dump)
diff --git a/pypy/translator/c/src/signals.h b/pypy/translator/c/src/signals.h
--- a/pypy/translator/c/src/signals.h
+++ b/pypy/translator/c/src/signals.h
@@ -54,7 +54,7 @@
/* When a signal is received, pypysig_counter is set to -1. */
/* This is a struct for the JIT. See interp_signal.py. */
struct pypysig_long_struct {
- new_long value;
+ Signed value;
};
extern struct pypysig_long_struct pypysig_counter;
More information about the pypy-commit
mailing list