[pypy-svn] r79747 - in pypy/branch/fast-forward: lib_pypy pypy/doc/config pypy/jit/backend/llgraph pypy/jit/backend/llsupport pypy/jit/backend/llsupport/test pypy/jit/backend/test pypy/jit/backend/x86 pypy/jit/backend/x86/test pypy/jit/metainterp/optimizeopt pypy/module/_minimal_curses pypy/module/array/benchmark pypy/module/array/test pypy/module/test_lib_pypy/ctypes_tests pypy/rlib pypy/rlib/test pypy/rpython
afa at codespeak.net
afa at codespeak.net
Thu Dec 2 14:17:19 CET 2010
Author: afa
Date: Thu Dec 2 14:17:16 2010
New Revision: 79747
Modified:
pypy/branch/fast-forward/lib_pypy/_locale.py
pypy/branch/fast-forward/lib_pypy/_marshal.py
pypy/branch/fast-forward/lib_pypy/_minimal_curses.py
pypy/branch/fast-forward/lib_pypy/cPickle.py
pypy/branch/fast-forward/lib_pypy/cmath.py
pypy/branch/fast-forward/lib_pypy/grp.py
pypy/branch/fast-forward/lib_pypy/itertools.py
pypy/branch/fast-forward/lib_pypy/msvcrt.py
pypy/branch/fast-forward/lib_pypy/pwd.py
pypy/branch/fast-forward/lib_pypy/pyexpat.py
pypy/branch/fast-forward/lib_pypy/resource.py
pypy/branch/fast-forward/lib_pypy/syslog.py
pypy/branch/fast-forward/pypy/doc/config/objspace.usemodules.array.txt (props changed)
pypy/branch/fast-forward/pypy/jit/backend/llgraph/llimpl.py
pypy/branch/fast-forward/pypy/jit/backend/llsupport/asmmemmgr.py
pypy/branch/fast-forward/pypy/jit/backend/llsupport/gc.py
pypy/branch/fast-forward/pypy/jit/backend/llsupport/test/test_asmmemmgr.py
pypy/branch/fast-forward/pypy/jit/backend/llsupport/test/test_gc.py
pypy/branch/fast-forward/pypy/jit/backend/test/runner_test.py
pypy/branch/fast-forward/pypy/jit/backend/x86/assembler.py
pypy/branch/fast-forward/pypy/jit/backend/x86/regalloc.py
pypy/branch/fast-forward/pypy/jit/backend/x86/regloc.py
pypy/branch/fast-forward/pypy/jit/backend/x86/test/test_gc_integration.py
pypy/branch/fast-forward/pypy/jit/backend/x86/test/test_regalloc.py
pypy/branch/fast-forward/pypy/jit/metainterp/optimizeopt/optimizer.py (props changed)
pypy/branch/fast-forward/pypy/module/_minimal_curses/__init__.py
pypy/branch/fast-forward/pypy/module/array/benchmark/Makefile (props changed)
pypy/branch/fast-forward/pypy/module/array/benchmark/intimg.c (props changed)
pypy/branch/fast-forward/pypy/module/array/benchmark/intimgtst.c (props changed)
pypy/branch/fast-forward/pypy/module/array/benchmark/intimgtst.py (props changed)
pypy/branch/fast-forward/pypy/module/array/benchmark/loop.c (props changed)
pypy/branch/fast-forward/pypy/module/array/benchmark/sum.c (props changed)
pypy/branch/fast-forward/pypy/module/array/benchmark/sumtst.c (props changed)
pypy/branch/fast-forward/pypy/module/array/benchmark/sumtst.py (props changed)
pypy/branch/fast-forward/pypy/module/array/test/test_array_old.py (props changed)
pypy/branch/fast-forward/pypy/module/test_lib_pypy/ctypes_tests/test_guess_argtypes.py
pypy/branch/fast-forward/pypy/module/test_lib_pypy/ctypes_tests/test_keepalive.py
pypy/branch/fast-forward/pypy/rlib/jit.py
pypy/branch/fast-forward/pypy/rlib/rerased.py (props changed)
pypy/branch/fast-forward/pypy/rlib/test/test_rerased.py (props changed)
pypy/branch/fast-forward/pypy/rpython/extfunc.py
Log:
Merge from trunk: -r79701:79741
Modified: pypy/branch/fast-forward/lib_pypy/_locale.py
==============================================================================
--- pypy/branch/fast-forward/lib_pypy/_locale.py (original)
+++ pypy/branch/fast-forward/lib_pypy/_locale.py Thu Dec 2 14:17:16 2010
@@ -11,7 +11,8 @@
# load the platform-specific cache made by running locale.ctc.py
from ctypes_config_cache._locale_cache import *
-import __pypy__
+try: from __pypy__ import builtinify
+except ImportError: builtinify = lambda f: f
# Ubuntu Gusty i386 structure
@@ -160,7 +161,7 @@
ul = ''.join(ul)
string.letters = ul
- at __pypy__.builtinify
+ at builtinify
def setlocale(category, locale=None):
"(integer,string=None) -> string. Activates/queries locale processing."
if locale:
@@ -185,7 +186,7 @@
groups.append(0)
return groups
- at __pypy__.builtinify
+ at builtinify
def localeconv():
"() -> dict. Returns numeric and monetary locale-specific parameters."
@@ -219,7 +220,7 @@
}
return result
- at __pypy__.builtinify
+ at builtinify
def strcoll(s1, s2):
"string,string -> int. Compares two strings according to the locale."
@@ -238,7 +239,7 @@
# Collate the strings.
return _wcscoll(s1, s2)
- at __pypy__.builtinify
+ at builtinify
def strxfrm(s):
"string -> string. Returns a string that behaves for cmp locale-aware."
@@ -252,7 +253,7 @@
_strxfrm(buf, s, n2)
return buf.value
- at __pypy__.builtinify
+ at builtinify
def getdefaultlocale():
# TODO: Port code from CPython for Windows and Mac OS
raise NotImplementedError()
@@ -274,31 +275,31 @@
raise ValueError("unsupported langinfo constant")
if HAS_LIBINTL:
- @__pypy__.builtinify
+ @builtinify
def gettext(msg):
"""gettext(msg) -> string
Return translation of msg."""
return _gettext(msg)
- @__pypy__.builtinify
+ @builtinify
def dgettext(domain, msg):
"""dgettext(domain, msg) -> string
Return translation of msg in domain."""
return _dgettext(domain, msg)
- @__pypy__.builtinify
+ @builtinify
def dcgettext(domain, msg, category):
"""dcgettext(domain, msg, category) -> string
Return translation of msg in domain and category."""
return _dcgettext(domain, msg, category)
- @__pypy__.builtinify
+ @builtinify
def textdomain(domain):
"""textdomain(domain) -> string
Set the C library's textdomain to domain, returning the new domain."""
return _textdomain(domain)
- @__pypy__.builtinify
+ @builtinify
def bindtextdomain(domain, dir):
"""bindtextdomain(domain, dir) -> string
Bind the C library's domain to dir."""
@@ -309,7 +310,7 @@
return dirname
if HAS_BIND_TEXTDOMAIN_CODESET:
- @__pypy__.builtinify
+ @builtinify
def bind_textdomain_codeset(domain, codeset):
"""bind_textdomain_codeset(domain, codeset) -> string
Bind the C library's domain to codeset."""
Modified: pypy/branch/fast-forward/lib_pypy/_marshal.py
==============================================================================
--- pypy/branch/fast-forward/lib_pypy/_marshal.py (original)
+++ pypy/branch/fast-forward/lib_pypy/_marshal.py Thu Dec 2 14:17:16 2010
@@ -3,9 +3,13 @@
This module contains functions that can read and write Python values in a binary format. The format is specific to Python, but independent of machine architecture issues (e.g., you can write a Python value to a file on a PC, transport the file to a Sun, and read it back there). Details of the format may change between Python versions.
"""
-import types, __pypy__
+import types
from _codecs import utf_8_decode, utf_8_encode
+try: from __pypy__ import builtinify
+except ImportError: builtinify = lambda f: f
+
+
TYPE_NULL = '0'
TYPE_NONE = 'N'
TYPE_FALSE = 'F'
@@ -645,18 +649,18 @@
version = 1
- at __pypy__.builtinify
+ at builtinify
def dump(x, f, version=version):
# XXX 'version' is ignored, we always dump in a version-0-compatible format
m = _Marshaller(f.write)
m.dump(x)
- at __pypy__.builtinify
+ at builtinify
def load(f):
um = _Unmarshaller(f.read)
return um.load()
- at __pypy__.builtinify
+ at builtinify
def dumps(x, version=version):
# XXX 'version' is ignored, we always dump in a version-0-compatible format
buffer = []
@@ -664,7 +668,7 @@
m.dump(x)
return ''.join(buffer)
- at __pypy__.builtinify
+ at builtinify
def loads(s):
um = _FastUnmarshaller(s)
return um.load()
Modified: pypy/branch/fast-forward/lib_pypy/_minimal_curses.py
==============================================================================
--- pypy/branch/fast-forward/lib_pypy/_minimal_curses.py (original)
+++ pypy/branch/fast-forward/lib_pypy/_minimal_curses.py Thu Dec 2 14:17:16 2010
@@ -35,23 +35,24 @@
# ____________________________________________________________
-import __pypy__
+try: from __pypy__ import builtinify
+except ImportError: builtinify = lambda f: f
- at __pypy__.builtinify
+ at builtinify
def setupterm(termstr, fd):
err = ctypes.c_int(0)
result = clib.setupterm(termstr, fd, ctypes.byref(err))
if result == ERR:
raise error("setupterm() failed (err=%d)" % err.value)
- at __pypy__.builtinify
+ at builtinify
def tigetstr(cap):
result = clib.tigetstr(cap)
if ctypes.cast(result, ctypes.c_void_p).value == ERR:
return None
return ctypes.cast(result, ctypes.c_char_p).value
- at __pypy__.builtinify
+ at builtinify
def tparm(str, i1=0, i2=0, i3=0, i4=0, i5=0, i6=0, i7=0, i8=0, i9=0):
result = clib.tparm(str, i1, i2, i3, i4, i5, i6, i7, i8, i9)
if result is None:
Modified: pypy/branch/fast-forward/lib_pypy/cPickle.py
==============================================================================
--- pypy/branch/fast-forward/lib_pypy/cPickle.py (original)
+++ pypy/branch/fast-forward/lib_pypy/cPickle.py Thu Dec 2 14:17:16 2010
@@ -4,7 +4,10 @@
from pickle import *
from pickle import __doc__, __version__, format_version, compatible_formats
-import __pypy__
+
+try: from __pypy__ import builtinify
+except ImportError: builtinify = lambda f: f
+
BadPickleGet = KeyError
UnpickleableError = PicklingError
@@ -32,11 +35,11 @@
def getvalue(self):
return self.__f and self.__f.getvalue()
- at __pypy__.builtinify
+ at builtinify
def dump(obj, file, protocol=None):
Pickler(file, protocol).dump(obj)
- at __pypy__.builtinify
+ at builtinify
def dumps(obj, protocol=None):
file = StringIO()
Pickler(file, protocol).dump(obj)
Modified: pypy/branch/fast-forward/lib_pypy/cmath.py
==============================================================================
--- pypy/branch/fast-forward/lib_pypy/cmath.py (original)
+++ pypy/branch/fast-forward/lib_pypy/cmath.py Thu Dec 2 14:17:16 2010
@@ -5,9 +5,12 @@
# much code borrowed from mathmodule.c
-import math, __pypy__
+import math
from math import e, pi
+try: from __pypy__ import builtinify
+except ImportError: builtinify = lambda f: f
+
# constants
_one = complex(1., 0.)
@@ -32,14 +35,13 @@
return complex(real, imag)
-
- at __pypy__.builtinify
+ at builtinify
def phase(x):
x = _to_complex(x)
return math.atan2(x.imag, x.real)
- at __pypy__.builtinify
+ at builtinify
def polar(x):
x = _to_complex(x)
phi = math.atan2(x.imag, x.real)
@@ -47,12 +49,12 @@
return r, phi
- at __pypy__.builtinify
+ at builtinify
def rect(r, phi):
return complex(r * math.cos(phi), r * math.sin(phi))
- at __pypy__.builtinify
+ at builtinify
def acos(x):
"""acos(x)
@@ -62,7 +64,7 @@
return -(_prodi(log((x+(_i*sqrt((_one-(x*x))))))))
- at __pypy__.builtinify
+ at builtinify
def acosh(x):
"""acosh(x)
@@ -73,7 +75,7 @@
return z+z
- at __pypy__.builtinify
+ at builtinify
def asin(x):
"""asin(x)
@@ -86,7 +88,7 @@
return -(_prodi(log((sqrt_1_minus_x_sq+_prodi(x)))))
- at __pypy__.builtinify
+ at builtinify
def asinh(x):
"""asinh(x)
@@ -97,7 +99,7 @@
return z+z
- at __pypy__.builtinify
+ at builtinify
def atan(x):
"""atan(x)
@@ -107,7 +109,7 @@
return _halfi*log(((_i+x)/(_i-x)))
- at __pypy__.builtinify
+ at builtinify
def atanh(x):
"""atanh(x)
@@ -117,7 +119,7 @@
return _half*log((_one+x)/(_one-x))
- at __pypy__.builtinify
+ at builtinify
def cos(x):
"""cos(x)
@@ -129,7 +131,7 @@
return complex(real, imag)
- at __pypy__.builtinify
+ at builtinify
def cosh(x):
"""cosh(x)
@@ -141,7 +143,7 @@
return complex(real, imag)
- at __pypy__.builtinify
+ at builtinify
def exp(x):
"""exp(x)
@@ -154,7 +156,7 @@
return complex(real, imag)
- at __pypy__.builtinify
+ at builtinify
def log(x, base=None):
"""log(x)
@@ -169,7 +171,7 @@
return complex(real, imag)
- at __pypy__.builtinify
+ at builtinify
def log10(x):
"""log10(x)
@@ -182,7 +184,7 @@
return complex(real, imag)
- at __pypy__.builtinify
+ at builtinify
def sin(x):
"""sin(x)
@@ -194,7 +196,7 @@
return complex(real, imag)
- at __pypy__.builtinify
+ at builtinify
def sinh(x):
"""sinh(x)
@@ -206,7 +208,7 @@
return complex(real, imag)
- at __pypy__.builtinify
+ at builtinify
def sqrt(x):
"""sqrt(x)
@@ -232,7 +234,7 @@
_sqrt_half = sqrt(_half)
- at __pypy__.builtinify
+ at builtinify
def tan(x):
"""tan(x)
@@ -253,7 +255,7 @@
return complex(real, imag)
- at __pypy__.builtinify
+ at builtinify
def tanh(x):
"""tanh(x)
Modified: pypy/branch/fast-forward/lib_pypy/grp.py
==============================================================================
--- pypy/branch/fast-forward/lib_pypy/grp.py (original)
+++ pypy/branch/fast-forward/lib_pypy/grp.py Thu Dec 2 14:17:16 2010
@@ -2,13 +2,17 @@
""" This module provides ctypes version of cpython's grp module
"""
-import sys, __pypy__
+import sys
if sys.platform == 'win32':
raise ImportError("No grp module on Windows")
from ctypes import Structure, c_char_p, c_int, POINTER
from ctypes_support import standard_c_lib as libc
+try: from __pypy__ import builtinify
+except ImportError: builtinify = lambda f: f
+
+
gid_t = c_int
class GroupStruct(Structure):
@@ -64,7 +68,7 @@
return Group(res.contents.gr_name, res.contents.gr_passwd,
res.contents.gr_gid, mem)
- at __pypy__.builtinify
+ at builtinify
def getgrgid(gid):
res = libc.getgrgid(gid)
if not res:
@@ -72,7 +76,7 @@
raise KeyError(gid)
return _group_from_gstruct(res)
- at __pypy__.builtinify
+ at builtinify
def getgrnam(name):
if not isinstance(name, str):
raise TypeError("expected string")
@@ -81,7 +85,7 @@
raise KeyError(name)
return _group_from_gstruct(res)
- at __pypy__.builtinify
+ at builtinify
def getgrall():
libc.setgrent()
lst = []
Modified: pypy/branch/fast-forward/lib_pypy/itertools.py
==============================================================================
--- pypy/branch/fast-forward/lib_pypy/itertools.py (original)
+++ pypy/branch/fast-forward/lib_pypy/itertools.py Thu Dec 2 14:17:16 2010
@@ -27,7 +27,8 @@
'ifilterfalse', 'imap', 'islice', 'izip', 'repeat', 'starmap',
'takewhile', 'tee']
-import __pypy__
+try: from __pypy__ import builtinify
+except ImportError: builtinify = lambda f: f
class chain(object):
@@ -634,7 +635,7 @@
return self
- at __pypy__.builtinify
+ at builtinify
def tee(iterable, n=2):
"""Return n independent iterators from a single iterable.
Note : once tee() has made a split, the original iterable
Modified: pypy/branch/fast-forward/lib_pypy/msvcrt.py
==============================================================================
--- pypy/branch/fast-forward/lib_pypy/msvcrt.py (original)
+++ pypy/branch/fast-forward/lib_pypy/msvcrt.py Thu Dec 2 14:17:16 2010
@@ -11,13 +11,16 @@
from ctypes_support import standard_c_lib as _c
from ctypes_support import get_errno
import errno
-import __pypy__
try:
open_osfhandle = _c._open_osfhandle
except AttributeError: # we are not on windows
raise ImportError
+try: from __pypy__ import builtinify
+except ImportError: builtinify = lambda f: f
+
+
open_osfhandle.argtypes = [ctypes.c_int, ctypes.c_int]
open_osfhandle.restype = ctypes.c_int
@@ -35,7 +38,7 @@
_locking.argtypes = [ctypes.c_int, ctypes.c_int, ctypes.c_int]
_locking.restype = ctypes.c_int
- at __pypy__.builtinify
+ at builtinify
def locking(fd, mode, nbytes):
'''lock or unlock a number of bytes in a file.'''
rv = _locking(fd, mode, nbytes)
Modified: pypy/branch/fast-forward/lib_pypy/pwd.py
==============================================================================
--- pypy/branch/fast-forward/lib_pypy/pwd.py (original)
+++ pypy/branch/fast-forward/lib_pypy/pwd.py Thu Dec 2 14:17:16 2010
@@ -10,13 +10,17 @@
exception is raised if the entry asked for cannot be found.
"""
-import sys, __pypy__
+import sys
if sys.platform == 'win32':
raise ImportError("No pwd module on Windows")
from ctypes_support import standard_c_lib as libc
from ctypes import Structure, POINTER, c_int, c_char_p
+try: from __pypy__ import builtinify
+except ImportError: builtinify = lambda f: f
+
+
uid_t = c_int
gid_t = c_int
@@ -79,12 +83,12 @@
_endpwent.argtypes = None
_endpwent.restype = None
- at __pypy__.builtinify
+ at builtinify
def mkpwent(pw):
pw = pw.contents
return struct_passwd(pw)
- at __pypy__.builtinify
+ at builtinify
def getpwuid(uid):
"""
getpwuid(uid) -> (pw_name,pw_passwd,pw_uid,
@@ -97,7 +101,7 @@
raise KeyError("getpwuid(): uid not found: %s" % uid)
return mkpwent(pw)
- at __pypy__.builtinify
+ at builtinify
def getpwnam(name):
"""
getpwnam(name) -> (pw_name,pw_passwd,pw_uid,
@@ -112,7 +116,7 @@
raise KeyError("getpwname(): name not found: %s" % name)
return mkpwent(pw)
- at __pypy__.builtinify
+ at builtinify
def getpwall():
"""
getpwall() -> list_of_entries
Modified: pypy/branch/fast-forward/lib_pypy/pyexpat.py
==============================================================================
--- pypy/branch/fast-forward/lib_pypy/pyexpat.py (original)
+++ pypy/branch/fast-forward/lib_pypy/pyexpat.py Thu Dec 2 14:17:16 2010
@@ -2,11 +2,14 @@
import ctypes
import ctypes.util
from ctypes import c_char_p, c_int, c_void_p, POINTER, c_char, c_wchar_p
-import sys, __pypy__
+import sys
# load the platform-specific cache made by running pyexpat.ctc.py
from ctypes_config_cache._pyexpat_cache import *
+try: from __pypy__ import builtinify
+except ImportError: builtinify = lambda f: f
+
lib = ctypes.CDLL(ctypes.util.find_library('expat'))
@@ -425,11 +428,11 @@
new_parser._set_unknown_encoding_handler()
return new_parser
- at __pypy__.builtinify
+ at builtinify
def ErrorString(errno):
return XML_ErrorString(errno)[:200]
- at __pypy__.builtinify
+ at builtinify
def ParserCreate(encoding=None, namespace_separator=None, intern=None):
if (not isinstance(encoding, str) and
not encoding is None):
Modified: pypy/branch/fast-forward/lib_pypy/resource.py
==============================================================================
--- pypy/branch/fast-forward/lib_pypy/resource.py (original)
+++ pypy/branch/fast-forward/lib_pypy/resource.py Thu Dec 2 14:17:16 2010
@@ -1,4 +1,4 @@
-import sys, __pypy__
+import sys
if sys.platform == 'win32':
raise ImportError('resource module not available for win32')
@@ -11,6 +11,10 @@
from errno import EINVAL, EPERM
import _structseq
+try: from __pypy__ import builtinify
+except ImportError: builtinify = lambda f: f
+
+
class error(Exception):
pass
@@ -77,7 +81,7 @@
ru_nvcsw = _structseq.structseqfield(14)
ru_nivcsw = _structseq.structseqfield(15)
- at __pypy__.builtinify
+ at builtinify
def rlimit_check_bounds(rlim_cur, rlim_max):
if rlim_cur > rlim_t_max:
raise ValueError("%d does not fit into rlim_t" % rlim_cur)
@@ -90,7 +94,7 @@
("rlim_max", rlim_t),
)
- at __pypy__.builtinify
+ at builtinify
def getrusage(who):
ru = _struct_rusage()
ret = _getrusage(who, byref(ru))
@@ -118,7 +122,7 @@
ru.ru_nivcsw,
))
- at __pypy__.builtinify
+ at builtinify
def getrlimit(resource):
if not(0 <= resource < RLIM_NLIMITS):
return ValueError("invalid resource specified")
@@ -130,7 +134,7 @@
raise error(errno)
return (rlim.rlim_cur, rlim.rlim_max)
- at __pypy__.builtinify
+ at builtinify
def setrlimit(resource, rlim):
if not(0 <= resource < RLIM_NLIMITS):
return ValueError("invalid resource specified")
@@ -147,7 +151,7 @@
else:
raise error(errno)
- at __pypy__.builtinify
+ at builtinify
def getpagesize():
pagesize = 0
if _getpagesize:
Modified: pypy/branch/fast-forward/lib_pypy/syslog.py
==============================================================================
--- pypy/branch/fast-forward/lib_pypy/syslog.py (original)
+++ pypy/branch/fast-forward/lib_pypy/syslog.py Thu Dec 2 14:17:16 2010
@@ -5,7 +5,7 @@
syslog facility.
"""
-import sys, __pypy__
+import sys
if sys.platform == 'win32':
raise ImportError("No syslog on Windows")
@@ -15,6 +15,10 @@
from ctypes_support import standard_c_lib as libc
from ctypes import c_int, c_char_p
+try: from __pypy__ import builtinify
+except ImportError: builtinify = lambda f: f
+
+
# Real prototype is:
# void syslog(int priority, const char *format, ...);
# But we also need format ("%s") and one format argument (message)
@@ -34,11 +38,11 @@
_setlogmask.argtypes = (c_int,)
_setlogmask.restype = c_int
- at __pypy__.builtinify
+ at builtinify
def openlog(ident, option, facility):
_openlog(ident, option, facility)
- at __pypy__.builtinify
+ at builtinify
def syslog(arg1, arg2=None):
if arg2 is not None:
priority, message = arg1, arg2
@@ -46,19 +50,19 @@
priority, message = LOG_INFO, arg1
_syslog(priority, "%s", message)
- at __pypy__.builtinify
+ at builtinify
def closelog():
_closelog()
- at __pypy__.builtinify
+ at builtinify
def setlogmask(mask):
return _setlogmask(mask)
- at __pypy__.builtinify
+ at builtinify
def LOG_MASK(pri):
return (1 << pri)
- at __pypy__.builtinify
+ at builtinify
def LOG_UPTO(pri):
return (1 << (pri + 1)) - 1
Modified: pypy/branch/fast-forward/pypy/jit/backend/llgraph/llimpl.py
==============================================================================
--- pypy/branch/fast-forward/pypy/jit/backend/llgraph/llimpl.py (original)
+++ pypy/branch/fast-forward/pypy/jit/backend/llgraph/llimpl.py Thu Dec 2 14:17:16 2010
@@ -583,7 +583,12 @@
def op_debug_merge_point(self, _, value, recdepth):
from pypy.jit.metainterp.warmspot import get_stats
loc = ConstPtr(value)._get_str()
- get_stats().add_merge_point_location(loc)
+ try:
+ stats = get_stats()
+ except AttributeError:
+ pass
+ else:
+ stats.add_merge_point_location(loc)
def op_guard_true(self, _, value):
if not value:
Modified: pypy/branch/fast-forward/pypy/jit/backend/llsupport/asmmemmgr.py
==============================================================================
--- pypy/branch/fast-forward/pypy/jit/backend/llsupport/asmmemmgr.py (original)
+++ pypy/branch/fast-forward/pypy/jit/backend/llsupport/asmmemmgr.py Thu Dec 2 14:17:16 2010
@@ -43,6 +43,22 @@
self.total_mallocs -= (stop - start)
self._add_free_block(start, stop)
+ def open_malloc(self, minsize):
+ """Allocate at least minsize bytes. Returns (start, stop)."""
+ result = self._allocate_block(minsize)
+ (start, stop) = result
+ self.total_mallocs += stop - start
+ return result
+
+ def open_free(self, middle, stop):
+ """Used for freeing the end of an open-allocated block of memory."""
+ if stop - middle >= self.min_fragment:
+ self.total_mallocs -= (stop - middle)
+ self._add_free_block(middle, stop)
+ return True
+ else:
+ return False # too small to record
+
def _allocate_large_block(self, minsize):
# Compute 'size' from 'minsize': it must be rounded up to
# 'large_alloc_size'. Additionally, we use the following line
@@ -140,6 +156,40 @@
self._allocated = None
+class MachineDataBlockWrapper(object):
+ def __init__(self, asmmemmgr, allblocks):
+ self.asmmemmgr = asmmemmgr
+ self.allblocks = allblocks
+ self.rawstart = 0
+ self.rawposition = 0
+ self.rawstop = 0
+
+ def done(self):
+ if self.rawstart != 0:
+ if self.asmmemmgr.open_free(self.rawposition, self.rawstop):
+ self.rawstop = self.rawposition
+ self.allblocks.append((self.rawstart, self.rawstop))
+ self.rawstart = 0
+ self.rawposition = 0
+ self.rawstop = 0
+
+ def _allocate_next_block(self, minsize):
+ self.done()
+ self.rawstart, self.rawstop = self.asmmemmgr.open_malloc(minsize)
+ self.rawposition = self.rawstart
+
+ def malloc_aligned(self, size, alignment):
+ p = self.rawposition
+ p = (p + alignment - 1) & (-alignment)
+ if p + size > self.rawstop:
+ self._allocate_next_block(size + alignment - 1)
+ p = self.rawposition
+ p = (p + alignment - 1) & (-alignment)
+ assert p + size <= self.rawstop
+ self.rawposition = p + size
+ return p
+
+
class BlockBuilderMixin(object):
_mixin_ = True
# A base class to generate assembler. It is equivalent to just a list
@@ -156,7 +206,6 @@
SUBBLOCK_PTR.TO.become(SUBBLOCK)
gcroot_markers = None
- gcroot_markers_total_size = 0
def __init__(self, translated=None):
if translated is None:
@@ -224,11 +273,8 @@
self.copy_to_raw_memory(rawstart)
if self.gcroot_markers is not None:
assert gcrootmap is not None
- gcrootmap.add_raw_gcroot_markers(asmmemmgr,
- allblocks,
- self.gcroot_markers,
- self.gcroot_markers_total_size,
- rawstart)
+ for pos, mark in self.gcroot_markers:
+ gcrootmap.put(rawstart + pos, mark)
return rawstart
def _become_a_plain_block_builder(self):
@@ -247,4 +293,3 @@
if self.gcroot_markers is None:
self.gcroot_markers = []
self.gcroot_markers.append((self.get_relative_pos(), mark))
- self.gcroot_markers_total_size += len(mark)
Modified: pypy/branch/fast-forward/pypy/jit/backend/llsupport/gc.py
==============================================================================
--- pypy/branch/fast-forward/pypy/jit/backend/llsupport/gc.py (original)
+++ pypy/branch/fast-forward/pypy/jit/backend/llsupport/gc.py Thu Dec 2 14:17:16 2010
@@ -222,7 +222,7 @@
LOC_EBP_MINUS = 3
GCMAP_ARRAY = rffi.CArray(lltype.Signed)
- CALLSHAPE_ARRAY = rffi.CArray(rffi.UCHAR)
+ CALLSHAPE_ARRAY_PTR = rffi.CArrayPtr(rffi.UCHAR)
def __init__(self):
# '_gcmap' is an array of length '_gcmap_maxlength' of addresses.
@@ -264,8 +264,7 @@
self._gcmap_sorted = True
return sorted
- @rgc.no_collect
- def _put(self, retaddr, callshapeaddr):
+ def put(self, retaddr, callshapeaddr):
"""'retaddr' is the address just after the CALL.
'callshapeaddr' is the address of the raw 'shape' marker.
Both addresses are actually integers here."""
@@ -308,37 +307,6 @@
lltype.free(oldgcmap, flavor='raw', track_allocation=False)
return j
- def add_raw_gcroot_markers(self, asmmemmgr, allblocks,
- markers, total_size, rawstart):
- """The interface is a bit custom, but this routine writes the
- shapes of gcroots (for the GC to use) into raw memory."""
- # xxx so far, we never try to share them. But right now
- # the amount of potential sharing would not be too large.
- dst = 1
- stop = 0
- for relpos, shape in markers:
- #
- if dst + len(shape) > stop:
- # No more space in the previous raw block,
- # allocate a raw block of memory big enough to fit
- # as many of the remaining 'shapes' as possible
- start, stop = asmmemmgr.malloc(len(shape), total_size)
- # add the raw block to 'compiled_loop_token.asmmemmgr_blocks'
- allblocks.append((start, stop))
- dst = start
- #
- # add the entry 'pos_after_call -> dst' to the table
- self._put(rawstart + relpos, dst)
- # Copy 'shape' into the raw memory, reversing the order
- # of the bytes. Similar to compress_callshape() in
- # trackgcroot.py.
- total_size -= len(shape)
- src = len(shape) - 1
- while src >= 0:
- rffi.cast(rffi.CCHARP, dst)[0] = shape[src]
- dst += 1
- src -= 1
-
@rgc.no_collect
def freeing_block(self, start, stop):
# if [start:stop] is a raw block of assembler, then look up the
@@ -409,6 +377,16 @@
assert reg_index > 0
shape.append(chr(self.LOC_REG | (reg_index << 2)))
+ def compress_callshape(self, shape, datablockwrapper):
+ # Similar to compress_callshape() in trackgcroot.py.
+ # Returns an address to raw memory (as an integer).
+ length = len(shape)
+ rawaddr = datablockwrapper.malloc_aligned(length, 1)
+ p = rffi.cast(self.CALLSHAPE_ARRAY_PTR, rawaddr)
+ for i in range(length):
+ p[length-1-i] = rffi.cast(rffi.UCHAR, shape[i])
+ return rawaddr
+
class WriteBarrierDescr(AbstractDescr):
def __init__(self, gc_ll_descr):
Modified: pypy/branch/fast-forward/pypy/jit/backend/llsupport/test/test_asmmemmgr.py
==============================================================================
--- pypy/branch/fast-forward/pypy/jit/backend/llsupport/test/test_asmmemmgr.py (original)
+++ pypy/branch/fast-forward/pypy/jit/backend/llsupport/test/test_asmmemmgr.py Thu Dec 2 14:17:16 2010
@@ -1,5 +1,6 @@
import random
from pypy.jit.backend.llsupport.asmmemmgr import AsmMemoryManager
+from pypy.jit.backend.llsupport.asmmemmgr import MachineDataBlockWrapper
from pypy.jit.backend.llsupport.asmmemmgr import BlockBuilderMixin
from pypy.rpython.lltypesystem import lltype, rffi
@@ -151,14 +152,10 @@
prev_total = new_total
def test_insert_gcroot_marker(self):
+ puts = []
class FakeGcRootMap:
- def add_raw_gcroot_markers(self, asmmemmgr, allblocks, markers,
- total_size, rawstart):
- self.asmmemmgr = asmmemmgr
- self.allblocks = allblocks
- self.markers = markers
- self.total_size = total_size
- self.rawstart = rawstart
+ def put(self, retaddr, mark):
+ puts.append((retaddr, mark))
#
mc = BlockBuilderMixin()
mc.writechar('X')
@@ -181,10 +178,8 @@
assert p[4] == 'Z'
assert p[5] == 'z'
assert allblocks == [(rawstart, rawstart + 6)]
- assert gcrootmap.markers == [(2, ['a', 'b', 'c', 'd']),
- (4, ['e', 'f', 'g'])]
- assert gcrootmap.total_size == 4 + 3
- assert gcrootmap.rawstart == rawstart
+ assert puts == [(rawstart + 2, ['a', 'b', 'c', 'd']),
+ (rawstart + 4, ['e', 'f', 'g'])]
def test_blockbuildermixin(translated=True):
@@ -215,3 +210,41 @@
def test_blockbuildermixin2():
test_blockbuildermixin(translated=False)
+
+def test_machinedatablock():
+ ops = []
+ class FakeMemMgr:
+ _addr = 1597
+ def open_malloc(self, minsize):
+ result = (self._addr, self._addr + 100)
+ ops.append(('malloc', minsize) + result)
+ self._addr += 200
+ return result
+ def open_free(self, frm, to):
+ ops.append(('free', frm, to))
+ return to - frm >= 8
+ #
+ allblocks = []
+ md = MachineDataBlockWrapper(FakeMemMgr(), allblocks)
+ p = md.malloc_aligned(26, 16)
+ assert p == 1600
+ assert ops == [('malloc', 26 + 15, 1597, 1697)]
+ del ops[:]
+ #
+ p = md.malloc_aligned(26, 16)
+ assert p == 1632
+ p = md.malloc_aligned(26, 16)
+ assert p == 1664
+ assert allblocks == []
+ assert ops == []
+ #
+ p = md.malloc_aligned(27, 16)
+ assert p == 1808
+ assert allblocks == [(1597, 1697)]
+ assert ops == [('free', 1690, 1697),
+ ('malloc', 27 + 15, 1797, 1897)]
+ del ops[:]
+ #
+ md.done()
+ assert allblocks == [(1597, 1697), (1797, 1835)]
+ assert ops == [('free', 1835, 1897)]
Modified: pypy/branch/fast-forward/pypy/jit/backend/llsupport/test/test_gc.py
==============================================================================
--- pypy/branch/fast-forward/pypy/jit/backend/llsupport/test/test_gc.py (original)
+++ pypy/branch/fast-forward/pypy/jit/backend/llsupport/test/test_gc.py Thu Dec 2 14:17:16 2010
@@ -91,11 +91,27 @@
assert shape == map(chr, [6, 7, 11, 15, 2, 0, num1a, num2b, num2a,
4, 8, 12, 16])
+ def test_compress_callshape(self):
+ class FakeDataBlockWrapper:
+ def malloc_aligned(self, size, alignment):
+ assert alignment == 1 # here
+ assert size == 4
+ return rffi.cast(lltype.Signed, p)
+ datablockwrapper = FakeDataBlockWrapper()
+ p = lltype.malloc(rffi.CArray(lltype.Char), 4, immortal=True)
+ gcrootmap = GcRootMap_asmgcc()
+ shape = ['a', 'b', 'c', 'd']
+ gcrootmap.compress_callshape(shape, datablockwrapper)
+ assert p[0] == 'd'
+ assert p[1] == 'c'
+ assert p[2] == 'b'
+ assert p[3] == 'a'
+
def test_put_basic(self):
gcrootmap = GcRootMap_asmgcc()
retaddr = 1234567890
shapeaddr = 51627384
- gcrootmap._put(retaddr, shapeaddr)
+ gcrootmap.put(retaddr, shapeaddr)
assert gcrootmap._gcmap[0] == retaddr
assert gcrootmap._gcmap[1] == shapeaddr
p = rffi.cast(rffi.LONGP, gcrootmap.gcmapstart())
@@ -109,7 +125,7 @@
for i in range(700):
shapeaddr = i * 100 + 1
retaddr = 123456789 + i
- gcrootmap._put(retaddr, shapeaddr)
+ gcrootmap.put(retaddr, shapeaddr)
for i in range(700):
assert gcrootmap._gcmap[i*2+0] == 123456789 + i
assert gcrootmap._gcmap[i*2+1] == i * 100 + 1
@@ -126,7 +142,7 @@
for i in range(700):
shapeaddr = i * 100 # 0 if i == 0
retaddr = 123456789 + i
- gcrootmap._put(retaddr, shapeaddr)
+ gcrootmap.put(retaddr, shapeaddr)
if shapeaddr != 0:
expected.append((retaddr, shapeaddr))
# at the first resize, the 0 should be removed
@@ -142,72 +158,11 @@
# check that we can again insert 350 entries without a resize
oldgcmap = gcrootmap._gcmap
for i in range(0, 699, 2):
- gcrootmap._put(515151 + i + repeat, 626262 + i)
+ gcrootmap.put(515151 + i + repeat, 626262 + i)
expected.append((515151 + i + repeat, 626262 + i))
assert gcrootmap._gcmap == oldgcmap
check()
- def test_add_raw_gcroot_markers_maxalloc(self):
- class FakeAsmMemMgr:
- def malloc(self, minsize, maxsize):
- assert minsize == 4
- assert maxsize == 7
- return (prawstart, prawstart + 8)
- put = []
- def fakeput(a, b):
- put.append((a, b))
- gcrootmap = GcRootMap_asmgcc()
- gcrootmap._put = fakeput
- memmgr = FakeAsmMemMgr()
- allblocks = []
- p = lltype.malloc(rffi.CArray(lltype.Char), 7, immortal=True)
- prawstart = rffi.cast(lltype.Signed, p)
- gcrootmap.add_raw_gcroot_markers(memmgr, allblocks,
- [(2, ['a', 'b', 'c', 'd']),
- (4, ['e', 'f', 'g'])],
- 4 + 3, 1200000)
- assert allblocks == [(prawstart, prawstart + 8)]
- assert ''.join([p[i] for i in range(7)]) == 'dcbagfe'
- assert put == [(1200002, prawstart),
- (1200004, prawstart + 4)]
-
- def test_add_raw_gcroot_markers_minalloc(self):
- class FakeAsmMemMgr:
- callnum = 0
- def malloc(self, minsize, maxsize):
- self.callnum += 1
- if self.callnum == 1:
- assert minsize == 4
- assert maxsize == 7
- return (prawstart, prawstart + 6)
- elif self.callnum == 2:
- assert minsize == 3
- assert maxsize == 3
- return (qrawstart, qrawstart + 5)
- else:
- raise AssertionError
- put = []
- def fakeput(a, b):
- put.append((a, b))
- gcrootmap = GcRootMap_asmgcc()
- gcrootmap._put = fakeput
- memmgr = FakeAsmMemMgr()
- allblocks = []
- p = lltype.malloc(rffi.CArray(lltype.Char), 6, immortal=True)
- prawstart = rffi.cast(lltype.Signed, p)
- q = lltype.malloc(rffi.CArray(lltype.Char), 5, immortal=True)
- qrawstart = rffi.cast(lltype.Signed, q)
- gcrootmap.add_raw_gcroot_markers(memmgr, allblocks,
- [(2, ['a', 'b', 'c', 'd']),
- (4, ['e', 'f', 'g'])],
- 4 + 3, 1200000)
- assert allblocks == [(prawstart, prawstart + 6),
- (qrawstart, qrawstart + 5)]
- assert ''.join([p[i] for i in range(4)]) == 'dcba'
- assert ''.join([q[i] for i in range(3)]) == 'gfe'
- assert put == [(1200002, prawstart),
- (1200004, qrawstart)]
-
def test_freeing_block(self):
from pypy.jit.backend.llsupport import gc
class Asmgcroot:
Modified: pypy/branch/fast-forward/pypy/jit/backend/test/runner_test.py
==============================================================================
--- pypy/branch/fast-forward/pypy/jit/backend/test/runner_test.py (original)
+++ pypy/branch/fast-forward/pypy/jit/backend/test/runner_test.py Thu Dec 2 14:17:16 2010
@@ -1203,6 +1203,13 @@
yield nan_and_infinity, rop.FLOAT_GT, operator.gt, all_cases_binary
yield nan_and_infinity, rop.FLOAT_GE, operator.ge, all_cases_binary
+ def test_noops(self):
+ c_box = self.alloc_string("hi there").constbox()
+ c_nest = ConstInt(0)
+ self.execute_operation(rop.DEBUG_MERGE_POINT, [c_box, c_nest], 'void')
+ self.execute_operation(rop.JIT_DEBUG, [c_box, c_nest, c_nest,
+ c_nest, c_nest], 'void')
+
class LLtypeBackendTest(BaseBackendTest):
Modified: pypy/branch/fast-forward/pypy/jit/backend/x86/assembler.py
==============================================================================
--- pypy/branch/fast-forward/pypy/jit/backend/x86/assembler.py (original)
+++ pypy/branch/fast-forward/pypy/jit/backend/x86/assembler.py Thu Dec 2 14:17:16 2010
@@ -1,5 +1,6 @@
import sys, os
from pypy.jit.backend.llsupport import symbolic
+from pypy.jit.backend.llsupport.asmmemmgr import MachineDataBlockWrapper
from pypy.jit.metainterp.history import Const, Box, BoxInt, BoxPtr, BoxFloat
from pypy.jit.metainterp.history import (AbstractFailDescr, INT, REF, FLOAT,
LoopToken)
@@ -55,7 +56,6 @@
DEBUG_COUNTER = lltype.Struct('DEBUG_COUNTER', ('i', lltype.Signed))
class Assembler386(object):
- _float_constants = None
_regalloc = None
_output_loop_log = None
@@ -83,6 +83,7 @@
self.debug_counter_descr = cpu.fielddescrof(DEBUG_COUNTER, 'i')
self.fail_boxes_count = 0
self._current_depths_cache = (0, 0)
+ self.datablockwrapper = None
self.teardown()
def leave_jitted_hook(self):
@@ -125,10 +126,14 @@
self.set_debug(have_debug_prints())
debug_stop('jit-backend-counts')
- def setup(self):
+ def setup(self, looptoken):
assert self.memcpy_addr != 0, "setup_once() not called?"
self.pending_guard_tokens = []
self.mc = codebuf.MachineCodeBlockWrapper()
+ if self.datablockwrapper is None:
+ allblocks = self.get_asmmemmgr_blocks(looptoken)
+ self.datablockwrapper = MachineDataBlockWrapper(self.cpu.asmmemmgr,
+ allblocks)
def teardown(self):
self.pending_guard_tokens = None
@@ -145,13 +150,9 @@
debug_stop('jit-backend-counts')
def _build_float_constants(self):
- # 44 bytes: 32 bytes for the data, and up to 12 bytes for alignment
- addr = lltype.malloc(rffi.CArray(lltype.Char), 44, flavor='raw',
- track_allocation=False)
- if not we_are_translated():
- self._keepalive_malloced_float_consts = addr
- float_constants = rffi.cast(lltype.Signed, addr)
- float_constants = (float_constants + 15) & ~15 # align to 16 bytes
+ datablockwrapper = MachineDataBlockWrapper(self.cpu.asmmemmgr, [])
+ float_constants = datablockwrapper.malloc_aligned(32, alignment=16)
+ datablockwrapper.done()
addr = rffi.cast(rffi.CArrayPtr(lltype.Char), float_constants)
qword_padding = '\x00\x00\x00\x00\x00\x00\x00\x00'
# 0x8000000000000000
@@ -203,13 +204,18 @@
_x86_arglocs
_x86_debug_checksum
'''
+ # XXX this function is too longish and contains some code
+ # duplication with assemble_bridge(). Also, we should think
+ # about not storing on 'self' attributes that will live only
+ # for the duration of compiling one loop or a one bridge.
+
clt = CompiledLoopToken(self.cpu, looptoken.number)
looptoken.compiled_loop_token = clt
if not we_are_translated():
# Arguments should be unique
assert len(set(inputargs)) == len(inputargs)
- self.setup()
+ self.setup(looptoken)
self.currently_compiling_loop = looptoken
funcname = self._find_debug_merge_point(operations)
if log:
@@ -235,7 +241,7 @@
self.write_pending_failure_recoveries()
fullsize = self.mc.get_relative_pos()
#
- rawstart = self.materialize(looptoken)
+ rawstart = self.materialize_loop(looptoken)
debug_print("Loop #%d (%s) has address %x to %x" % (
looptoken.number, funcname,
rawstart + self.looppos,
@@ -268,7 +274,7 @@
"was already compiled!")
return
- self.setup()
+ self.setup(original_loop_token)
funcname = self._find_debug_merge_point(operations)
if log:
self._register_counter()
@@ -289,7 +295,7 @@
self.write_pending_failure_recoveries()
fullsize = self.mc.get_relative_pos()
#
- rawstart = self.materialize(original_loop_token)
+ rawstart = self.materialize_loop(original_loop_token)
debug_print("Bridge out of guard %d (%s) has address %x to %x" %
(descr_number, funcname, rawstart, rawstart + codeendpos))
@@ -328,12 +334,17 @@
p = rffi.cast(rffi.INTP, addr)
p[0] = rffi.cast(rffi.INT, relative_target)
- def materialize(self, looptoken):
+ def get_asmmemmgr_blocks(self, looptoken):
clt = looptoken.compiled_loop_token
if clt.asmmemmgr_blocks is None:
clt.asmmemmgr_blocks = []
- return self.mc.materialize(self.cpu.asmmemmgr,
- clt.asmmemmgr_blocks,
+ return clt.asmmemmgr_blocks
+
+ def materialize_loop(self, looptoken):
+ self.datablockwrapper.done() # finish using cpu.asmmemmgr
+ self.datablockwrapper = None
+ allblocks = self.get_asmmemmgr_blocks(looptoken)
+ return self.mc.materialize(self.cpu.asmmemmgr, allblocks,
self.cpu.gc_ll_descr.gcrootmap)
def _find_debug_merge_point(self, operations):
Modified: pypy/branch/fast-forward/pypy/jit/backend/x86/regalloc.py
==============================================================================
--- pypy/branch/fast-forward/pypy/jit/backend/x86/regalloc.py (original)
+++ pypy/branch/fast-forward/pypy/jit/backend/x86/regalloc.py Thu Dec 2 14:17:16 2010
@@ -60,32 +60,6 @@
r15: 5,
}
-class FloatConstants(object):
- BASE_CONSTANT_SIZE = 1000
-
- def __init__(self):
- self.cur_array_free = 0
- self.const_id = 0
-
- def _get_new_array(self):
- n = self.BASE_CONSTANT_SIZE
- # known to leak
- self.cur_array = lltype.malloc(rffi.CArray(lltype.Float), n, # YYY leak
- flavor='raw', track_allocation=False)
- self.cur_array_free = n
- _get_new_array._dont_inline_ = True
-
- def record_float(self, floatval):
- if self.cur_array_free == 0:
- self._get_new_array()
- arr = self.cur_array
- n = self.cur_array_free - 1
- arr[n] = floatval
- self.cur_array_free = n
- self.const_id += 1
- return (self.const_id, rffi.cast(lltype.Signed, arr) + n * 8)
-
-
class X86XMMRegisterManager(RegisterManager):
box_types = [FLOAT]
@@ -93,20 +67,11 @@
# we never need lower byte I hope
save_around_call_regs = all_regs
- def __init__(self, longevity, frame_manager=None, assembler=None):
- RegisterManager.__init__(self, longevity, frame_manager=frame_manager,
- assembler=assembler)
- if assembler is None:
- self.float_constants = FloatConstants()
- else:
- if assembler._float_constants is None:
- assembler._float_constants = FloatConstants()
- self.float_constants = assembler._float_constants
-
def convert_to_imm(self, c):
- const_id, adr = self.float_constants.record_float(c.getfloat())
- return ConstFloatLoc(adr, const_id)
-
+ adr = self.assembler.datablockwrapper.malloc_aligned(8, 8)
+ rffi.cast(rffi.CArrayPtr(rffi.DOUBLE), adr)[0] = c.getfloat()
+ return ConstFloatLoc(adr)
+
def after_call(self, v):
# the result is stored in st0, but we don't have this around,
# so genop_call will move it to some frame location immediately
@@ -1108,7 +1073,8 @@
if (isinstance(v, BoxPtr) and self.rm.stays_alive(v)):
assert reg in self.rm.REGLOC_TO_GCROOTMAP_REG_INDEX
gcrootmap.add_callee_save_reg(shape, self.rm.REGLOC_TO_GCROOTMAP_REG_INDEX[reg])
- return shape
+ return gcrootmap.compress_callshape(shape,
+ self.assembler.datablockwrapper)
def consider_force_token(self, op):
loc = self.rm.force_allocate_reg(op.result)
Modified: pypy/branch/fast-forward/pypy/jit/backend/x86/regloc.py
==============================================================================
--- pypy/branch/fast-forward/pypy/jit/backend/x86/regloc.py (original)
+++ pypy/branch/fast-forward/pypy/jit/backend/x86/regloc.py Thu Dec 2 14:17:16 2010
@@ -177,24 +177,15 @@
class ConstFloatLoc(AssemblerLocation):
# XXX: We have to use this class instead of just AddressLoc because
- # AddressLoc is "untyped" and also we to have need some sort of unique
- # identifier that we can use in _getregkey (for jump.py)
-
+ # we want a width of 8 (... I think. Check this!)
_immutable_ = True
-
width = 8
- def __init__(self, address, const_id):
+ def __init__(self, address):
self.value = address
- self.const_id = const_id
def __repr__(self):
- return '<ConstFloatLoc(%s, %s)>' % (self.value, self.const_id)
-
- def _getregkey(self):
- # XXX: 1000 is kind of magic: We just don't want to be confused
- # with any registers
- return 1000 + self.const_id
+ return '<ConstFloatLoc @%s>' % (self.value,)
def location_code(self):
return 'j'
Modified: pypy/branch/fast-forward/pypy/jit/backend/x86/test/test_gc_integration.py
==============================================================================
--- pypy/branch/fast-forward/pypy/jit/backend/x86/test/test_gc_integration.py (original)
+++ pypy/branch/fast-forward/pypy/jit/backend/x86/test/test_gc_integration.py Thu Dec 2 14:17:16 2010
@@ -33,6 +33,10 @@
def add_callee_save_reg(self, shape, reg_index):
index_to_name = { 1: 'ebx', 2: 'esi', 3: 'edi' }
shape.append(index_to_name[reg_index])
+ def compress_callshape(self, shape, datablockwrapper):
+ assert datablockwrapper == 'fakedatablockwrapper'
+ assert shape[0] == 'shape'
+ return ['compressed'] + shape[1:]
class MockGcDescr(GcCache):
def get_funcptr_for_new(self):
@@ -57,6 +61,7 @@
cpu = CPU(None, None)
cpu.setup_once()
regalloc = RegAlloc(MockAssembler(cpu, MockGcDescr(False)))
+ regalloc.assembler.datablockwrapper = 'fakedatablockwrapper'
boxes = [BoxPtr() for i in range(len(X86RegisterManager.all_regs))]
longevity = {}
for box in boxes:
@@ -79,7 +84,7 @@
assert len(regalloc.assembler.movs) == 3
#
mark = regalloc.get_mark_gc_roots(cpu.gc_ll_descr.gcrootmap)
- assert mark[0] == 'shape'
+ assert mark[0] == 'compressed'
base = -WORD * FRAME_FIXED_SIZE
expected = ['ebx', 'esi', 'edi', base, base-WORD, base-WORD*2]
assert dict.fromkeys(mark[1:]) == dict.fromkeys(expected)
Modified: pypy/branch/fast-forward/pypy/jit/backend/x86/test/test_regalloc.py
==============================================================================
--- pypy/branch/fast-forward/pypy/jit/backend/x86/test/test_regalloc.py (original)
+++ pypy/branch/fast-forward/pypy/jit/backend/x86/test/test_regalloc.py Thu Dec 2 14:17:16 2010
@@ -9,7 +9,7 @@
from pypy.jit.backend.llsupport.descr import GcCache
from pypy.jit.backend.detect_cpu import getcpuclass
from pypy.jit.backend.x86.regalloc import RegAlloc, X86RegisterManager,\
- FloatConstants, is_comparison_or_ovf_op
+ is_comparison_or_ovf_op
from pypy.jit.backend.x86.arch import IS_X86_32, IS_X86_64
from pypy.jit.tool.oparser import parse
from pypy.rpython.lltypesystem import lltype, llmemory, rffi
@@ -520,16 +520,6 @@
self.interpret(ops, [0.1, .2, .3, .4, .5, .6, .7, .8, .9])
assert self.getfloats(9) == [.1+.2, .9+3.5, .3, .4, .5, .6, .7, .8, .9]
- def test_float_overflow_const_list(self):
- ops = ['[f0]']
- BASE_CONSTANT_SIZE = FloatConstants.BASE_CONSTANT_SIZE
- for i in range(BASE_CONSTANT_SIZE * 2):
- ops.append('f%d = float_add(f%d, 3.5)' % (i + 1, i))
- ops.append('finish(f%d)' % (BASE_CONSTANT_SIZE * 2))
- ops = "\n".join(ops)
- self.interpret(ops, [0.1])
- assert abs(self.getfloat(0) - (BASE_CONSTANT_SIZE * 2) * 3.5 - 0.1) < 0.00001
-
def test_lt_const(self):
ops = '''
[f0]
Modified: pypy/branch/fast-forward/pypy/module/_minimal_curses/__init__.py
==============================================================================
--- pypy/branch/fast-forward/pypy/module/_minimal_curses/__init__.py (original)
+++ pypy/branch/fast-forward/pypy/module/_minimal_curses/__init__.py Thu Dec 2 14:17:16 2010
@@ -4,7 +4,7 @@
try:
import _minimal_curses as _curses # when running on top of pypy-c
except ImportError:
- import py; py.test.skip("no _curses module") # no _curses at all
+ raise ImportError("no _curses or _minimal_curses module") # no _curses at all
from pypy.interpreter.mixedmodule import MixedModule
from pypy.module._minimal_curses import fficurses
Modified: pypy/branch/fast-forward/pypy/module/test_lib_pypy/ctypes_tests/test_guess_argtypes.py
==============================================================================
--- pypy/branch/fast-forward/pypy/module/test_lib_pypy/ctypes_tests/test_guess_argtypes.py (original)
+++ pypy/branch/fast-forward/pypy/module/test_lib_pypy/ctypes_tests/test_guess_argtypes.py Thu Dec 2 14:17:16 2010
@@ -11,21 +11,23 @@
py.test.skip("pypy white-box test")
from _ctypes.function import CFuncPtr
- guess = CFuncPtr._guess_argtypes
+ def guess(value):
+ cobj = CFuncPtr._conv_param(None, value, 0)
+ return type(cobj)
- assert guess([13]) == [c_int]
- assert guess([0]) == [c_int]
- assert guess(['xca']) == [c_char_p]
- assert guess([None]) == [c_void_p]
- assert guess([c_int(3)]) == [c_int]
- assert guess([u'xca']) == [c_wchar_p]
+ assert guess(13) == c_int
+ assert guess(0) == c_int
+ assert guess('xca') == c_char_p
+ assert guess(None) == c_void_p
+ assert guess(c_int(3)) == c_int
+ assert guess(u'xca') == c_wchar_p
class Stuff:
pass
s = Stuff()
s._as_parameter_ = None
- assert guess([s]) == [c_void_p]
+ assert guess(s) == c_void_p
def test_guess_unicode():
if not hasattr(sys, 'pypy_translation_info') and sys.platform != 'win32':
Modified: pypy/branch/fast-forward/pypy/module/test_lib_pypy/ctypes_tests/test_keepalive.py
==============================================================================
--- pypy/branch/fast-forward/pypy/module/test_lib_pypy/ctypes_tests/test_keepalive.py (original)
+++ pypy/branch/fast-forward/pypy/module/test_lib_pypy/ctypes_tests/test_keepalive.py Thu Dec 2 14:17:16 2010
@@ -99,7 +99,7 @@
def test_primitive(self):
if not hasattr(sys, 'pypy_translation_info'):
py.test.skip("pypy white-box test")
- assert c_char_p("abc")._objects['0']._buffer[0] == "a"
+ assert c_char_p("abc")._objects._buffer[0] == "a"
assert c_int(3)._objects is None
def test_pointer_to_pointer(self):
@@ -123,7 +123,7 @@
pass
cf = CFUNCTYPE(c_int, c_int)(f)
p1 = cast(cf, c_void_p)
- assert p1._objects == {'1': cf, '0': {'0': cf}}
+ assert p1._objects == {id(cf): cf, '0': cf}
def test_array_of_struct_with_pointer(self):
class S(Structure):
@@ -221,7 +221,7 @@
import gc; gc.collect()
print 'x =', repr(x)
assert x.value == 'hellohello'
- assert x._objects.keys() == ['0']
+ assert x._objects == 'hellohello'
#
class datum(Structure):
_fields_ = [
Modified: pypy/branch/fast-forward/pypy/rlib/jit.py
==============================================================================
--- pypy/branch/fast-forward/pypy/rlib/jit.py (original)
+++ pypy/branch/fast-forward/pypy/rlib/jit.py Thu Dec 2 14:17:16 2010
@@ -156,7 +156,7 @@
def jit_debug(string, arg1=-sys.maxint-1, arg2=-sys.maxint-1,
arg3=-sys.maxint-1, arg4=-sys.maxint-1):
- """When JITted, cause an extra operation DEBUG_MERGE_POINT to appear in
+ """When JITted, cause an extra operation JIT_DEBUG to appear in
the graphs. Should not be left after debugging."""
keepalive_until_here(string) # otherwise the whole function call is removed
jit_debug.oopspec = 'jit.debug(string, arg1, arg2, arg3, arg4)'
Modified: pypy/branch/fast-forward/pypy/rpython/extfunc.py
==============================================================================
--- pypy/branch/fast-forward/pypy/rpython/extfunc.py (original)
+++ pypy/branch/fast-forward/pypy/rpython/extfunc.py Thu Dec 2 14:17:16 2010
@@ -201,6 +201,11 @@
exec py.code.compile("""
from pypy.rlib.objectmodel import running_on_llinterp
from pypy.rlib.debug import llinterpcall
+ from pypy.rlib.jit import dont_look_inside
+ # note: we say 'dont_look_inside' mostly because the
+ # JIT does not support 'running_on_llinterp', but in
+ # theory it is probably right to stop jitting anyway.
+ @dont_look_inside
def ll_wrapper(%s):
if running_on_llinterp:
return llinterpcall(s_result, fakeimpl, %s)
More information about the Pypy-commit
mailing list