[pypy-commit] pypy win64-stage1: Merge
ctismer
noreply at buildbot.pypy.org
Thu Nov 24 20:29:41 CET 2011
Author: Christian Tismer <tismer at stackless.com>
Branch: win64-stage1
Changeset: r49756:2819522de5e0
Date: 2011-11-24 20:27 +0100
http://bitbucket.org/pypy/pypy/changeset/2819522de5e0/
Log: Merge
diff --git a/pypy/__init__.py b/pypy/__init__.py
--- a/pypy/__init__.py
+++ b/pypy/__init__.py
@@ -1,1 +1,9 @@
# Empty
+# XXX Should be empty again, soon.
+# XXX hack for win64:
+# This patch must stay here until the ENDS OF STAGE 1
+# When all tests work, this branch will be merged
+# and the branch stage 2 is started, where we remove this patch.
+import sys
+if hasattr(sys, "maxsize"):
+ sys.maxint = max(sys.maxint, sys.maxsize)
diff --git a/pypy/annotation/builtin.py b/pypy/annotation/builtin.py
--- a/pypy/annotation/builtin.py
+++ b/pypy/annotation/builtin.py
@@ -163,7 +163,7 @@
r.const = False
return r
- assert not issubclass(typ, (int,long)) or typ in (bool, int), (
+ assert not issubclass(typ, (int, long)) or typ in (bool, int, long), (
"for integers only isinstance(.,int|r_uint) are supported")
if s_obj.is_constant():
diff --git a/pypy/interpreter/test/test_compiler.py b/pypy/interpreter/test/test_compiler.py
--- a/pypy/interpreter/test/test_compiler.py
+++ b/pypy/interpreter/test/test_compiler.py
@@ -794,7 +794,7 @@
def test_tuple_constants(self):
ns = {}
exec "x = (1, 0); y = (1L, 0L)" in ns
- assert isinstance(ns["x"][0], int)
+ assert isinstance(ns["x"][0], (int, long))
assert isinstance(ns["y"][0], long)
def test_division_folding(self):
diff --git a/pypy/jit/backend/test/runner_test.py b/pypy/jit/backend/test/runner_test.py
--- a/pypy/jit/backend/test/runner_test.py
+++ b/pypy/jit/backend/test/runner_test.py
@@ -454,7 +454,7 @@
if cpu.supports_floats:
def func(f, i):
assert isinstance(f, float)
- assert isinstance(i, int)
+ assert isinstance(i, (int, long))
return f - float(i)
FPTR = self.Ptr(self.FuncType([lltype.Float, lltype.Signed],
lltype.Float))
diff --git a/pypy/jit/backend/test/support.py b/pypy/jit/backend/test/support.py
--- a/pypy/jit/backend/test/support.py
+++ b/pypy/jit/backend/test/support.py
@@ -24,7 +24,7 @@
from pypy.annotation import model as annmodel
for arg in args:
- assert isinstance(arg, int)
+ assert isinstance(arg, (int, long))
self.pre_translation_hook()
t = self._get_TranslationContext()
diff --git a/pypy/jit/codewriter/test/test_longlong.py b/pypy/jit/codewriter/test/test_longlong.py
--- a/pypy/jit/codewriter/test/test_longlong.py
+++ b/pypy/jit/codewriter/test/test_longlong.py
@@ -32,7 +32,7 @@
def test_functions():
xll = longlong.getfloatstorage(3.5)
assert longlong.getrealfloat(xll) == 3.5
- assert isinstance(longlong.gethash(xll), int)
+ assert isinstance(longlong.gethash(xll), (int, long))
class TestLongLong:
diff --git a/pypy/jit/metainterp/executor.py b/pypy/jit/metainterp/executor.py
--- a/pypy/jit/metainterp/executor.py
+++ b/pypy/jit/metainterp/executor.py
@@ -248,7 +248,7 @@
def do_read_timestamp(cpu, _):
x = read_timestamp()
if longlong.is_64_bit:
- assert isinstance(x, int) # 64-bit
+ assert isinstance(x, (int, long)) # 64-bit
return BoxInt(x)
else:
assert isinstance(x, r_longlong) # 32-bit
diff --git a/pypy/jit/metainterp/history.py b/pypy/jit/metainterp/history.py
--- a/pypy/jit/metainterp/history.py
+++ b/pypy/jit/metainterp/history.py
@@ -268,7 +268,7 @@
def __init__(self, value):
if not we_are_translated():
- if isinstance(value, int):
+ if isinstance(value, (int, long)):
if isinstance(value, (int, long)):
value = int(value) # bool -> int
else:
diff --git a/pypy/jit/metainterp/optimizeopt/intutils.py b/pypy/jit/metainterp/optimizeopt/intutils.py
--- a/pypy/jit/metainterp/optimizeopt/intutils.py
+++ b/pypy/jit/metainterp/optimizeopt/intutils.py
@@ -1,10 +1,9 @@
-from pypy.rlib.rarithmetic import ovfcheck, LONG_BIT
+from pypy.rlib.rarithmetic import ovfcheck, LONG_BIT, maxint, is_valid_int
from pypy.rlib.objectmodel import we_are_translated
from pypy.jit.metainterp.resoperation import rop, ResOperation
from pypy.jit.metainterp.history import BoxInt, ConstInt
-import sys
-MAXINT = sys.maxint
-MININT = -sys.maxint - 1
+MAXINT = maxint
+MININT = -maxint - 1
class IntBound(object):
_attrs_ = ('has_upper', 'has_lower', 'upper', 'lower')
@@ -16,8 +15,8 @@
self.lower = lower
# check for unexpected overflows:
if not we_are_translated():
- assert type(upper) is not long
- assert type(lower) is not long
+ assert is_valid_int(upper)
+ assert is_valid_int(lower)
# Returns True if the bound was updated
def make_le(self, other):
diff --git a/pypy/jit/tl/tlc.py b/pypy/jit/tl/tlc.py
--- a/pypy/jit/tl/tlc.py
+++ b/pypy/jit/tl/tlc.py
@@ -219,7 +219,7 @@
class Frame(object):
def __init__(self, args, pc):
- assert isinstance(pc, int)
+ assert isinstance(pc, (int, long))
self.args = args
self.pc = pc
self.stack = []
@@ -239,7 +239,7 @@
return interp_eval(code, pc, args, pool).int_o()
def interp_eval(code, pc, args, pool):
- assert isinstance(pc, int)
+ assert isinstance(pc, (int, long))
frame = Frame(args, pc)
pc = frame.pc
diff --git a/pypy/rlib/rarithmetic.py b/pypy/rlib/rarithmetic.py
--- a/pypy/rlib/rarithmetic.py
+++ b/pypy/rlib/rarithmetic.py
@@ -133,8 +133,11 @@
r_class.BITS == LONG_BIT and r_class.SIGNED)
_should_widen_type._annspecialcase_ = 'specialize:memo'
+# the replacement for sys.maxint
+maxint = int(LONG_TEST - 1)
+
def is_valid_int(r):
- return -sys.maxint - 1 <= r <= sys.maxint
+ return -maxint - 1 <= r <= maxint
def ovfcheck(r):
"NOT_RPYTHON"
diff --git a/pypy/rpython/llinterp.py b/pypy/rpython/llinterp.py
--- a/pypy/rpython/llinterp.py
+++ b/pypy/rpython/llinterp.py
@@ -1126,7 +1126,7 @@
def op_oonewarray(self, ARRAY, length):
assert isinstance(ARRAY, ootype.Array)
- assert isinstance(length, int)
+ assert isinstance(length, (int, long))
return ootype.oonewarray(ARRAY, length)
def op_runtimenew(self, class_):
diff --git a/pypy/rpython/memory/gc/markcompact.py b/pypy/rpython/memory/gc/markcompact.py
--- a/pypy/rpython/memory/gc/markcompact.py
+++ b/pypy/rpython/memory/gc/markcompact.py
@@ -353,7 +353,7 @@
# like header(), but asserts that we have a forwarding header
hdr = MovingGCBase.header(self, addr)
if not we_are_translated():
- assert isinstance(hdr.tid, int)
+ assert isinstance(hdr.tid, (int, long))
return hdr
def combine(self, typeid16, flags):
diff --git a/pypy/rpython/test/test_rbuiltin.py b/pypy/rpython/test/test_rbuiltin.py
--- a/pypy/rpython/test/test_rbuiltin.py
+++ b/pypy/rpython/test/test_rbuiltin.py
@@ -542,7 +542,7 @@
if r_longlong is not r_int:
assert isinstance(res, r_longlong)
else:
- assert isinstance(res, int)
+ assert isinstance(res, (int, long))
#
def llfn(v):
return rffi.cast(rffi.ULONGLONG, v)
diff --git a/pypy/rpython/tool/rffi_platform.py b/pypy/rpython/tool/rffi_platform.py
--- a/pypy/rpython/tool/rffi_platform.py
+++ b/pypy/rpython/tool/rffi_platform.py
@@ -704,9 +704,13 @@
PYPY_EXTERNAL_DIR = py.path.local(pypydir).join('..', '..')
# XXX make this configurable
if sys.platform == 'win32':
- libdir = py.path.local('c:/buildslave/support') # on the bigboard buildbot
- if libdir.check():
- PYPY_EXTERNAL_DIR = libdir
+ for libdir in [
+ py.path.local('c:/buildslave/support'), # on the bigboard buildbot
+ py.path.local('d:/myslave'), # on the snakepit buildbot
+ ]:
+ if libdir.check():
+ PYPY_EXTERNAL_DIR = libdir
+ break
def configure_external_library(name, eci, configurations,
symbol=None, _cache={}):
@@ -784,9 +788,15 @@
if platform is None:
from pypy.translator.platform import platform
if sys.platform == 'win32':
- library_dir = 'Release'
- libraries = ['gc']
- includes=['gc.h']
+ import platform as host_platform # just to ask for the arch. Confusion-alert!
+ if host_platform.architecture()[0] == '32bit':
+ library_dir = 'Release'
+ libraries = ['gc']
+ includes=['gc.h']
+ else:
+ library_dir = ''
+ libraries = ['gc64_dll']
+ includes = ['gc.h']
else:
library_dir = ''
libraries = ['gc', 'dl']
diff --git a/pypy/translator/c/src/commondefs.h b/pypy/translator/c/src/commondefs.h
--- a/pypy/translator/c/src/commondefs.h
+++ b/pypy/translator/c/src/commondefs.h
@@ -11,6 +11,21 @@
In particular, Win64 is not supported because it has sizeof(long) == 4.
To fix this, find and review all the places that cast a pointer to a long.
+
+ Update:
+ We are trying to lift this restriction for Win64:
+
+ Win64 int long long long void*
+ --64-bit-- 32 32 64 64
+
+ The migration to this platform is complicated and tedious, because
+ PyPy assumes that a void* fits into a long. Therefore, the created PyPy
+ will (first) have a 64 bit int type. The dependency of sys.maxint must
+ be removed in very many places, and the distinction between Python int
+ and long must be changed in explicit range checks.
+
+ This is work in progress with first successes.
+
*/
#include <limits.h>
@@ -54,16 +69,32 @@
/******************** 64-bit support ********************/
#else
-# if LONG_MAX != 9223372036854775807L
-# error "error in LONG_MAX (64-bit sources but a 32-bit compiler?)"
+# ifndef _WIN64
+# if LONG_MAX != 9223372036854775807L
+# error "error in LONG_MAX (64-bit sources but a 32-bit compiler?)"
+# endif
+# if LONG_MIN != -9223372036854775807L-1L
+# error "unsupported value for LONG_MIN"
+# endif
+
+# define SIZEOF_INT 4
+# define SIZEOF_LONG 8
+# define SIZEOF_LONG_LONG 8
+
+/******************** Win-64 support ********************/
+# else
+# if LONG_MAX != 2147483647L
+# error "error in LONG_MAX (64-bit sources but incompatible compiler?)"
+# endif
+# if LONG_MIN != -2147483647L-1L
+# error "unsupported value for LONG_MIN"
+# endif
+
+# define SIZEOF_INT 4
+# define SIZEOF_LONG 4
+# define SIZEOF_LONG_LONG 8
+
# endif
-# if LONG_MIN != -9223372036854775807L-1L
-# error "unsupported value for LONG_MIN"
-# endif
-
-# define SIZEOF_INT 4
-# define SIZEOF_LONG 8
-# define SIZEOF_LONG_LONG 8
#endif
diff --git a/pypy/translator/goal/win32/gc_patch_windows.py b/pypy/translator/goal/win32/gc_patch_windows.py
--- a/pypy/translator/goal/win32/gc_patch_windows.py
+++ b/pypy/translator/goal/win32/gc_patch_windows.py
@@ -1,6 +1,9 @@
# patches for the Boehm GC for PyPy under Windows
"""
+This file is obsolete now since gc-7.0 / gc-7.1 .
+Please use the instructions in pypy\doc\windows.rst .
+
How to build a pypy compatible version of the Boehm collector
for Windows and Visual Studio .net 2003.
diff --git a/pypy/translator/platform/windows.py b/pypy/translator/platform/windows.py
--- a/pypy/translator/platform/windows.py
+++ b/pypy/translator/platform/windows.py
@@ -91,8 +91,9 @@
standalone_only = ()
shared_only = ()
environ = None
-
+
def __init__(self, cc=None, x64=False):
+ self.x64 = x64
if x64:
msvc_compiler_environ = msvc_compiler_environ64
else:
@@ -302,7 +303,10 @@
('CC_LINK', self.link),
('LINKFILES', eci.link_files),
('MASM', self.masm),
+ ('_WIN32', '1'),
]
+ if self.x64:
+ definitions.append(('_WIN64', '1'))
for args in definitions:
m.definition(*args)
More information about the pypy-commit
mailing list