[pypy-commit] pypy py3k: merge default
pjenvey
noreply at buildbot.pypy.org
Tue Apr 9 00:39:08 CEST 2013
Author: Philip Jenvey <pjenvey at underboss.org>
Branch: py3k
Changeset: r63157:3d53acc6c795
Date: 2013-04-08 15:38 -0700
http://bitbucket.org/pypy/pypy/changeset/3d53acc6c795/
Log: merge default
diff --git a/.hgignore b/.hgignore
--- a/.hgignore
+++ b/.hgignore
@@ -70,6 +70,7 @@
^rpython/translator/cli/src/pypylib\.dll$
^rpython/translator/cli/src/query\.exe$
^rpython/translator/cli/src/main\.exe$
+^lib_pypy/__pycache__$
^lib_pypy/ctypes_config_cache/_.+_cache\.py$
^lib_pypy/ctypes_config_cache/_.+_.+_\.py$
^rpython/translator/cli/query-descriptions$
diff --git a/lib_pypy/_ctypes/function.py b/lib_pypy/_ctypes/function.py
--- a/lib_pypy/_ctypes/function.py
+++ b/lib_pypy/_ctypes/function.py
@@ -8,7 +8,6 @@
import _ffi
import sys
import traceback
-import warnings
try: from __pypy__ import builtinify
except ImportError: builtinify = lambda f: f
@@ -315,8 +314,12 @@
return
if argtypes is None:
- warnings.warn('C function without declared arguments called',
- RuntimeWarning, stacklevel=2)
+ # XXX this warning was originally meaning "it's going to be
+ # really slow". Now we don't worry that much about slowness
+ # of ctypes, and it's strange to get warnings for perfectly-
+ # legal code.
+ #warnings.warn('C function without declared arguments called',
+ # RuntimeWarning, stacklevel=2)
argtypes = []
if self._com_index:
@@ -342,6 +345,7 @@
if not outargs:
return result
+ from ctypes import c_void_p
simple_cdata = type(c_void_p()).__bases__[0]
outargs = [x.value if type(x).__bases__[0] is simple_cdata else x
for x in outargs]
diff --git a/lib_pypy/_curses.py b/lib_pypy/_curses.py
--- a/lib_pypy/_curses.py
+++ b/lib_pypy/_curses.py
@@ -364,7 +364,9 @@
key_n = ffi.string(key_n)
if key_n == b"UNKNOWN KEY":
continue
- key_n = key_n.decode().replace('(', '').replace(')', '')
+ if not isinstance(key_n, str): # python 3
+ key_n = key_n.decode()
+ key_n = key_n.replace('(', '').replace(')', '')
globals()[key_n] = key
_setup()
diff --git a/lib_pypy/_sqlite3.py b/lib_pypy/_sqlite3.py
--- a/lib_pypy/_sqlite3.py
+++ b/lib_pypy/_sqlite3.py
@@ -256,7 +256,12 @@
typedef ... sqlite3;
int sqlite3_enable_load_extension(sqlite3 *db, int onoff);
""")
- unverified_lib = unverified_ffi.dlopen('sqlite3')
+ libname = 'sqlite3'
+ if sys.platform == 'win32':
+ _libname = os.path.join(os.path.dirname(sys.executable), libname)
+ if os.path.exists(_libname + '.dll'):
+ libname = _libname
+ unverified_lib = unverified_ffi.dlopen(libname)
return hasattr(unverified_lib, 'sqlite3_enable_load_extension')
if _has_load_extension():
diff --git a/pypy/doc/release-2.0.0-beta2.rst b/pypy/doc/release-2.0.0-beta2.rst
--- a/pypy/doc/release-2.0.0-beta2.rst
+++ b/pypy/doc/release-2.0.0-beta2.rst
@@ -82,3 +82,13 @@
* we now have special strategies for ``dict``/``set``/``list`` which contain
unicode strings, which means that now such collections will be both faster
and more compact.
+
+.. _`eventlet`: http://eventlet.net/
+.. _`gevent`: http://www.gevent.org/
+.. _`cffi`: http://cffi.readthedocs.org/en/release-0.6/
+.. _`JIT hooks`: http://doc.pypy.org/en/latest/jit-hooks.html
+.. _`pypycore`: https://github.com/gevent-on-pypy/pypycore
+.. _`pypy-hacks`: https://github.com/schmir/gevent/tree/pypy-hacks
+.. _`_curses.py`: https://bitbucket.org/pypy/pypy/src/aefddd47f224e3c12e2ea74f5c796d76f4355bdb/lib_pypy/_curses.py?at=default
+.. _`_sqlite3.py`: https://bitbucket.org/pypy/pypy/src/aefddd47f224e3c12e2ea74f5c796d76f4355bdb/lib_pypy/_sqlite3.py?at=default
+
diff --git a/pypy/doc/stackless.rst b/pypy/doc/stackless.rst
--- a/pypy/doc/stackless.rst
+++ b/pypy/doc/stackless.rst
@@ -17,8 +17,8 @@
Continulets can be directly used by application code, or it is possible
to write (entirely at app-level) more user-friendly interfaces.
-Currently PyPy implements greenlets_ on top of continulets. It would be
-easy to implement tasklets and channels as well, emulating the model
+Currently PyPy implements greenlets_ on top of continulets. It also
+implements (an approximation of) tasklets and channels, emulating the model
of `Stackless Python`_.
Continulets are extremely light-weight, which means that PyPy should be
diff --git a/pypy/goal/getnightly.py b/pypy/goal/getnightly.py
--- a/pypy/goal/getnightly.py
+++ b/pypy/goal/getnightly.py
@@ -13,8 +13,13 @@
if sys.maxint == 2**63 - 1:
arch += '64'
+hg = py.path.local.sysfind('hg')
+branch = hg.sysexec('branch').strip()
+if branch == 'default':
+ branch = 'trunk'
+
filename = 'pypy-c-jit-latest-%s.tar.bz2' % arch
-url = 'http://buildbot.pypy.org/nightly/trunk/%s' % filename
+url = 'http://buildbot.pypy.org/nightly/%s/%s' % (branch, filename)
tmp = py.path.local.mkdtemp()
mydir = tmp.chdir()
print 'Downloading pypy to', tmp
diff --git a/pypy/interpreter/astcompiler/misc.py b/pypy/interpreter/astcompiler/misc.py
--- a/pypy/interpreter/astcompiler/misc.py
+++ b/pypy/interpreter/astcompiler/misc.py
@@ -1,5 +1,4 @@
from pypy.interpreter import gateway
-from pypy.interpreter.astcompiler import ast
from rpython.rlib.objectmodel import we_are_translated
from rpython.rlib.unroll import unrolling_iterable
@@ -28,6 +27,7 @@
def parse_future(tree, feature_flags):
+ from pypy.interpreter.astcompiler import ast
future_lineno = 0
future_column = 0
flags = 0
@@ -91,13 +91,9 @@
return lookup
-MANGLE_LEN = 256 # magic constant from compile.c
-
def mangle(name, klass):
if not name.startswith('__'):
return name
- if len(name) + 2 >= MANGLE_LEN:
- return name
# Don't mangle __id__ or names with dots. The only time a name with a dot
# can occur is when we are compiling an import statement that has a package
# name.
@@ -109,17 +105,7 @@
i = i + 1
except IndexError:
return name
- klass = klass[i:]
-
- tlen = len(klass) + len(name)
- if tlen > MANGLE_LEN:
- end = len(klass) + MANGLE_LEN-tlen
- if end < 0:
- klass = '' # slices of negative length are invalid in RPython
- else:
- klass = klass[:end]
-
- return "_%s%s" % (klass, name)
+ return "_%s%s" % (klass[i:], name)
def new_identifier(space, name):
diff --git a/pypy/interpreter/astcompiler/test/test_misc.py b/pypy/interpreter/astcompiler/test/test_misc.py
new file mode 100644
--- /dev/null
+++ b/pypy/interpreter/astcompiler/test/test_misc.py
@@ -0,0 +1,14 @@
+from pypy.interpreter.astcompiler.misc import mangle
+
+def test_mangle():
+ assert mangle("foo", "Bar") == "foo"
+ assert mangle("__foo__", "Bar") == "__foo__"
+ assert mangle("foo.baz", "Bar") == "foo.baz"
+ assert mangle("__", "Bar") == "__"
+ assert mangle("___", "Bar") == "___"
+ assert mangle("____", "Bar") == "____"
+ assert mangle("__foo", "Bar") == "_Bar__foo"
+ assert mangle("__foo", "_Bar") == "_Bar__foo"
+ assert mangle("__foo", "__Bar") == "_Bar__foo"
+ assert mangle("__foo", "___") == "__foo"
+ assert mangle("___foo", "__Bar") == "_Bar___foo"
diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
--- a/pypy/interpreter/baseobjspace.py
+++ b/pypy/interpreter/baseobjspace.py
@@ -723,6 +723,8 @@
def new_interned_w_str(self, w_s):
s = self.str_w(w_s)
+ if not we_are_translated():
+ assert type(s) is str
try:
return self.interned_strings[s]
except KeyError:
@@ -731,6 +733,8 @@
return w_s
def new_interned_str(self, s):
+ if not we_are_translated():
+ assert type(s) is str
try:
return self.interned_strings[s]
except KeyError:
diff --git a/pypy/module/__pypy__/interp_time.py b/pypy/module/__pypy__/interp_time.py
--- a/pypy/module/__pypy__/interp_time.py
+++ b/pypy/module/__pypy__/interp_time.py
@@ -61,7 +61,7 @@
ret = c_clock_gettime(clk_id, tp)
if ret != 0:
raise exception_from_errno(space, space.w_IOError)
- return space.wrap(tp.c_tv_sec + tp.c_tv_nsec * 1e-9)
+ return space.wrap(int(tp.c_tv_sec) + 1e-9 * int(tp.c_tv_nsec))
@unwrap_spec(clk_id="c_int")
def clock_getres(space, clk_id):
@@ -69,4 +69,4 @@
ret = c_clock_getres(clk_id, tp)
if ret != 0:
raise exception_from_errno(space, space.w_IOError)
- return space.wrap(tp.c_tv_sec + tp.c_tv_nsec * 1e-9)
+ return space.wrap(int(tp.c_tv_sec) + 1e-9 * int(tp.c_tv_nsec))
diff --git a/pypy/module/_cffi_backend/ctypeprim.py b/pypy/module/_cffi_backend/ctypeprim.py
--- a/pypy/module/_cffi_backend/ctypeprim.py
+++ b/pypy/module/_cffi_backend/ctypeprim.py
@@ -162,7 +162,7 @@
def __init__(self, *args):
W_CTypePrimitive.__init__(self, *args)
self.value_fits_long = self.size <= rffi.sizeof(lltype.Signed)
- if self.size < rffi.sizeof(lltype.SignedLongLong):
+ if self.size < rffi.sizeof(lltype.Signed):
assert self.value_fits_long
sh = self.size * 8
self.vmin = r_uint(-1) << (sh - 1)
diff --git a/pypy/module/_minimal_curses/__init__.py b/pypy/module/_minimal_curses/__init__.py
--- a/pypy/module/_minimal_curses/__init__.py
+++ b/pypy/module/_minimal_curses/__init__.py
@@ -27,6 +27,7 @@
}
for i in dir(_curses):
+ i = str(i) # workaround for pypy 2.0-beta2
val = getattr(_curses, i)
if i.isupper() and type(val) is int:
Module.interpleveldefs[i] = "space.wrap(%s)" % val
diff --git a/pypy/module/micronumpy/interp_numarray.py b/pypy/module/micronumpy/interp_numarray.py
--- a/pypy/module/micronumpy/interp_numarray.py
+++ b/pypy/module/micronumpy/interp_numarray.py
@@ -772,6 +772,16 @@
return space.int(self.descr_getitem(space, space.wrap(0)))
raise OperationError(space.w_TypeError, space.wrap("only length-1 arrays can be converted to Python scalars"))
+ def descr_float(self, space):
+ shape = self.get_shape()
+ if len(shape) == 0:
+ assert isinstance(self.implementation, scalar.Scalar)
+ return space.float(space.wrap(self.implementation.get_scalar_value()))
+ if shape == [1]:
+ return space.float(self.descr_getitem(space, space.wrap(0)))
+ raise OperationError(space.w_TypeError, space.wrap("only length-1 arrays can be converted to Python scalars"))
+
+
@unwrap_spec(offset=int)
def descr_new_array(space, w_subtype, w_shape, w_dtype=None, w_buffer=None,
@@ -813,6 +823,7 @@
__repr__ = interp2app(W_NDimArray.descr_repr),
__str__ = interp2app(W_NDimArray.descr_str),
__int__ = interp2app(W_NDimArray.descr_int),
+ __float__ = interp2app(W_NDimArray.descr_float),
__pos__ = interp2app(W_NDimArray.descr_pos),
__neg__ = interp2app(W_NDimArray.descr_neg),
diff --git a/pypy/module/micronumpy/test/test_numarray.py b/pypy/module/micronumpy/test/test_numarray.py
--- a/pypy/module/micronumpy/test/test_numarray.py
+++ b/pypy/module/micronumpy/test/test_numarray.py
@@ -422,6 +422,18 @@
assert a[4] == 5.0
raises(IndexError, "a[5] = 0.0")
raises(IndexError, "a[-6] = 3.0")
+ a[1] = array(100)
+ a[2] = array([100])
+ assert a[1] == 100
+ assert a[2] == 100
+ a = array(range(5), dtype=float)
+ a[0] = 0.005
+ assert a[0] == 0.005
+ a[1] = array(-0.005)
+ a[2] = array([-0.005])
+ assert a[1] == -0.005
+ assert a[2] == -0.005
+
def test_setitem_tuple(self):
from numpypy import array
diff --git a/pypy/module/pyexpat/test/test_parser.py b/pypy/module/pyexpat/test/test_parser.py
--- a/pypy/module/pyexpat/test/test_parser.py
+++ b/pypy/module/pyexpat/test/test_parser.py
@@ -219,7 +219,7 @@
try:
for event, node in stream:
- print event, node
+ print(event, node)
except DTDForbidden:
pass
else:
diff --git a/pypy/module/test_lib_pypy/ctypes_tests/test_functions.py b/pypy/module/test_lib_pypy/ctypes_tests/test_functions.py
--- a/pypy/module/test_lib_pypy/ctypes_tests/test_functions.py
+++ b/pypy/module/test_lib_pypy/ctypes_tests/test_functions.py
@@ -510,6 +510,7 @@
assert seen == ["yadda"]
def test_warnings(self):
+ py.test.skip("warnings are disabled")
import warnings
warnings.simplefilter("always")
with warnings.catch_warnings(record=True) as w:
diff --git a/pypy/module/test_lib_pypy/test_sqlite3.py b/pypy/module/test_lib_pypy/test_sqlite3.py
--- a/pypy/module/test_lib_pypy/test_sqlite3.py
+++ b/pypy/module/test_lib_pypy/test_sqlite3.py
@@ -1,16 +1,25 @@
"""Tests for _sqlite3.py"""
-import sys
+import pytest, sys
+
if sys.version_info < (2, 7):
- skip("lib_pypy._sqlite3 doesn't work with python < 2.7")
+ pytest.skip("_sqlite3 requires Python 2.7")
+try:
+ import _cffi_backend
+except ImportError:
+ # On CPython, "pip install cffi". On old PyPy's, no chance
+ pytest.skip("_sqlite3 requires _cffi_backend to be installed")
-import pytest
from lib_pypy import _sqlite3
-def test_list_ddl():
+def pytest_funcarg__con(request):
+ con = _sqlite3.connect(':memory:')
+ request.addfinalizer(lambda: con.close())
+ return con
+
+def test_list_ddl(con):
"""From issue996. Mostly just looking for lack of exceptions."""
- connection = _sqlite3.connect(':memory:')
- cursor = connection.cursor()
+ cursor = con.cursor()
cursor.execute('CREATE TABLE foo (bar INTEGER)')
result = list(cursor)
assert result == []
@@ -21,8 +30,7 @@
result = list(cursor)
assert result == [(42,)]
-def test_total_changes_after_close():
- con = _sqlite3.connect(':memory:')
+def test_total_changes_after_close(con):
con.close()
pytest.raises(_sqlite3.ProgrammingError, "con.total_changes")
@@ -35,25 +43,22 @@
e = pytest.raises(_sqlite3.ProgrammingError, "con.cursor()")
assert '__init__' in e.value.message
-def test_cursor_check_init():
+def test_cursor_check_init(con):
class Cursor(_sqlite3.Cursor):
def __init__(self, name):
pass
- con = _sqlite3.connect(":memory:")
cur = Cursor(con)
e = pytest.raises(_sqlite3.ProgrammingError, "cur.execute('select 1')")
assert '__init__' in e.value.message
-def test_connection_after_close():
- con = _sqlite3.connect(':memory:')
+def test_connection_after_close(con):
pytest.raises(TypeError, "con()")
con.close()
# raises ProgrammingError because should check closed before check args
pytest.raises(_sqlite3.ProgrammingError, "con()")
-def test_cursor_iter():
- con = _sqlite3.connect(':memory:')
+def test_cursor_iter(con):
cur = con.cursor()
with pytest.raises(StopIteration):
next(cur)
@@ -85,8 +90,7 @@
with pytest.raises(StopIteration):
next(cur)
-def test_cursor_after_close():
- con = _sqlite3.connect(':memory:')
+def test_cursor_after_close(con):
cur = con.execute('select 1')
cur.close()
con.close()
@@ -131,11 +135,10 @@
finally:
resource.setrlimit(resource.RLIMIT_NOFILE, limit)
-def test_on_conflict_rollback_executemany():
+def test_on_conflict_rollback_executemany(con):
major, minor, micro = _sqlite3.sqlite_version.split('.')
if (int(major), int(minor), int(micro)) < (3, 2, 2):
pytest.skip("requires sqlite3 version >= 3.2.2")
- con = _sqlite3.connect(":memory:")
con.execute("create table foo(x, unique(x) on conflict rollback)")
con.execute("insert into foo(x) values (1)")
try:
@@ -147,10 +150,8 @@
con.commit()
except _sqlite3.OperationalError:
pytest.fail("_sqlite3 knew nothing about the implicit ROLLBACK")
- con.close()
-def test_statement_arg_checking():
- con = _sqlite3.connect(':memory:')
+def test_statement_arg_checking(con):
with pytest.raises(_sqlite3.Warning) as e:
con(123)
assert str(e.value) == 'SQL is of wrong type. Must be string or unicode.'
@@ -164,8 +165,7 @@
con.executescript(123)
assert str(e.value) == 'script argument must be unicode or string.'
-def test_statement_param_checking():
- con = _sqlite3.connect(':memory:')
+def test_statement_param_checking(con):
con.execute('create table foo(x)')
con.execute('insert into foo(x) values (?)', [2])
con.execute('insert into foo(x) values (?)', (2,))
@@ -183,10 +183,8 @@
with pytest.raises(ValueError) as e:
con.execute('insert into foo(x) values (?)', 2)
assert str(e.value) == 'parameters are of unsupported type'
- con.close()
-def test_explicit_begin():
- con = _sqlite3.connect(':memory:')
+def test_explicit_begin(con):
con.execute('BEGIN')
con.execute('BEGIN ')
con.execute('BEGIN')
@@ -194,31 +192,32 @@
con.execute('BEGIN')
con.commit()
-def test_row_factory_use():
- con = _sqlite3.connect(':memory:')
+def test_row_factory_use(con):
con.row_factory = 42
con.execute('select 1')
-def test_returning_blob_must_own_memory():
+def test_returning_blob_must_own_memory(con):
import gc
- con = _sqlite3.connect(":memory:")
con.create_function("returnblob", 0, lambda: buffer("blob"))
- cur = con.cursor()
- cur.execute("select returnblob()")
+ cur = con.execute("select returnblob()")
val = cur.fetchone()[0]
for i in range(5):
gc.collect()
got = (val[0], val[1], val[2], val[3])
assert got == ('b', 'l', 'o', 'b')
+ # in theory 'val' should be a read-write buffer
+ # but it's not right now
+ pytest.skip("in theory 'val' should be a read-write buffer")
+ val[1] = 'X'
+ got = (val[0], val[1], val[2], val[3])
+ assert got == ('b', 'X', 'o', 'b')
-def test_description_after_fetchall():
- con = _sqlite3.connect(":memory:")
+def test_description_after_fetchall(con):
cur = con.cursor()
cur.execute("select 42").fetchall()
assert cur.description is not None
-def test_executemany_lastrowid():
- con = _sqlite3.connect(':memory:')
+def test_executemany_lastrowid(con):
cur = con.cursor()
cur.execute("create table test(a)")
cur.executemany("insert into test values (?)", [[1], [2], [3]])
diff --git a/pypy/objspace/std/typeobject.py b/pypy/objspace/std/typeobject.py
--- a/pypy/objspace/std/typeobject.py
+++ b/pypy/objspace/std/typeobject.py
@@ -4,6 +4,7 @@
from pypy.interpreter.function import Function, StaticMethod
from pypy.interpreter.typedef import weakref_descr, GetSetProperty,\
descr_get_dict
+from pypy.interpreter.astcompiler.misc import mangle
from pypy.objspace.std.model import W_Object
from pypy.objspace.std.register_all import register_all
from pypy.objspace.std.stdtypedef import std_dict_descr, issubtypedef, Member
@@ -26,34 +27,6 @@
return w_value.w_value
return w_value
-# from compiler/misc.py
-
-MANGLE_LEN = 256 # magic constant from compile.c
-
-def _mangle(name, klass):
- if not name.startswith('__'):
- return name
- if len(name) + 2 >= MANGLE_LEN:
- return name
- if name.endswith('__'):
- return name
- try:
- i = 0
- while klass[i] == '_':
- i = i + 1
- except IndexError:
- return name
- klass = klass[i:]
-
- tlen = len(klass) + len(name)
- if tlen > MANGLE_LEN:
- end = len(klass) + MANGLE_LEN-tlen
- if end < 0:
- klass = '' # annotator hint
- else:
- klass = klass[:end]
-
- return "_%s%s" % (klass, name)
class VersionTag(object):
pass
@@ -989,7 +962,7 @@
raise OperationError(space.w_TypeError,
space.wrap('__slots__ must be identifiers'))
# create member
- slot_name = _mangle(slot_name, w_self.name)
+ slot_name = mangle(slot_name, w_self.name)
if slot_name not in w_self.dict_w:
# Force interning of slot names.
slot_name = space.str_w(space.new_interned_str(slot_name))
diff --git a/pypy/tool/release/package.py b/pypy/tool/release/package.py
--- a/pypy/tool/release/package.py
+++ b/pypy/tool/release/package.py
@@ -67,7 +67,8 @@
'Bogus path: %r does not exist (see docstring for more info)'
% (os.path.dirname(str(pypy_c)),))
subprocess.check_call([str(pypy_c), '-c', 'import _sqlite3'])
- subprocess.check_call([str(pypy_c), '-c', 'import _curses'])
+ if not sys.platform == 'win32':
+ subprocess.check_call([str(pypy_c), '-c', 'import _curses'])
if sys.platform == 'win32' and not rename_pypy_c.lower().endswith('.exe'):
rename_pypy_c += '.exe'
binaries = [(pypy_c, rename_pypy_c)]
diff --git a/rpython/config/translationoption.py b/rpython/config/translationoption.py
--- a/rpython/config/translationoption.py
+++ b/rpython/config/translationoption.py
@@ -115,7 +115,7 @@
("translation.gcrootfinder", DEFL_ROOTFINDER_WITHJIT),
("translation.list_comprehension_operations", True)]),
ChoiceOption("jit_backend", "choose the backend for the JIT",
- ["auto", "x86", "x86-without-sse2", 'armv7'],
+ ["auto", "x86", "x86-without-sse2", 'armv7', 'armv7hf', 'armv6hf'],
default="auto", cmdline="--jit-backend"),
ChoiceOption("jit_profiler", "integrate profiler support into the JIT",
["off", "oprofile"],
diff --git a/rpython/flowspace/framestate.py b/rpython/flowspace/framestate.py
--- a/rpython/flowspace/framestate.py
+++ b/rpython/flowspace/framestate.py
@@ -2,7 +2,7 @@
from rpython.rlib.unroll import SpecTag
-class FrameState:
+class FrameState(object):
def __init__(self, mergeable, blocklist, next_instr):
self.mergeable = mergeable
self.blocklist = blocklist
@@ -63,6 +63,7 @@
class UnionError(Exception):
"The two states should be merged."
+
def union(w1, w2):
"Union of two variables or constants."
if w1 is None or w2 is None:
@@ -117,7 +118,7 @@
key = unroller.__class__, len(vars)
try:
tag = PICKLE_TAGS[key]
- except:
+ except KeyError:
tag = PICKLE_TAGS[key] = Constant(PickleTag())
UNPICKLE_TAGS[tag] = key
lst[i:i + 1] = [tag] + vars
diff --git a/rpython/jit/backend/arm/assembler.py b/rpython/jit/backend/arm/assembler.py
--- a/rpython/jit/backend/arm/assembler.py
+++ b/rpython/jit/backend/arm/assembler.py
@@ -1035,7 +1035,8 @@
assert 0, 'unsupported case'
def _mov_stack_to_loc(self, prev_loc, loc, cond=c.AL):
- helper = self._regalloc.get_free_reg()
+ # disabled for now, has side effects in combination with remap_frame_layout when called from a jump
+ helper = None # self._regalloc.get_free_reg()
if loc.is_reg():
assert prev_loc.type != FLOAT, 'trying to load from an \
incompatible location into a core register'
diff --git a/rpython/jit/backend/arm/test/test_runner.py b/rpython/jit/backend/arm/test/test_runner.py
--- a/rpython/jit/backend/arm/test/test_runner.py
+++ b/rpython/jit/backend/arm/test/test_runner.py
@@ -34,11 +34,11 @@
else:
bridge_loop_instructions = ['ldr', 'mov', 'nop', 'nop', 'nop', 'cmp', 'bge',
'push', 'ldr', 'mov',
- '', # inline constant
+ '*', # inline constant
'push', 'ldr', 'mov',
- 'ldrsblt', #inline constant (decodes as instruction)
+ '*', # inline constant
'blx', 'ldr', 'mov',
- '', # inline constant
+ '*', # inline constant
'bx']
def get_cpu(self):
diff --git a/rpython/jit/backend/test/runner_test.py b/rpython/jit/backend/test/runner_test.py
--- a/rpython/jit/backend/test/runner_test.py
+++ b/rpython/jit/backend/test/runner_test.py
@@ -3475,6 +3475,8 @@
def checkops(mc, ops):
assert len(mc) == len(ops)
for i in range(len(mc)):
+ if ops[i] == '*':
+ continue # ingore ops marked as '*', i.e. inline constants
assert mc[i].split("\t")[2].startswith(ops[i])
data = ctypes.string_at(info.asmaddr, info.asmlen)
diff --git a/rpython/jit/metainterp/blackhole.py b/rpython/jit/metainterp/blackhole.py
--- a/rpython/jit/metainterp/blackhole.py
+++ b/rpython/jit/metainterp/blackhole.py
@@ -857,6 +857,8 @@
@arguments("r")
def bhimpl_debug_fatalerror(msg):
+ from rpython.rtyper.lltypesystem import rstr
+ msg = lltype.cast_opaque_ptr(lltype.Ptr(rstr.STR), msg)
llop.debug_fatalerror(lltype.Void, msg)
@arguments("r", "i", "i", "i", "i")
diff --git a/rpython/jit/metainterp/optimizeopt/rewrite.py b/rpython/jit/metainterp/optimizeopt/rewrite.py
--- a/rpython/jit/metainterp/optimizeopt/rewrite.py
+++ b/rpython/jit/metainterp/optimizeopt/rewrite.py
@@ -456,7 +456,7 @@
[op.getarg(1),
ConstInt(index + source_start)], resbox,
descr=arraydescr)
- self.optimizer.propagate_forward(newop)
+ self.optimizer.send_extra_operation(newop)
val = self.getvalue(resbox)
if dest_value.is_virtual():
dest_value.setitem(index + dest_start, val)
diff --git a/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py b/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py
--- a/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py
+++ b/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py
@@ -7621,10 +7621,9 @@
"""
expected = """
[i1, i2]
+ # operations are not all removed because this new_array() is var-sized
p1 = new_array(i1, descr=arraydescr)
- # operations are not all removed because this new_array() is var-sized
- # unsure exactly which operations should be left, but right now it's
- # really buggy
+ setarrayitem_gc(p1, 0, i2, descr=arraydescr)
jump(i1, i2)
"""
self.optimize_loop(ops, expected)
diff --git a/rpython/jit/metainterp/test/test_blackhole.py b/rpython/jit/metainterp/test/test_blackhole.py
--- a/rpython/jit/metainterp/test/test_blackhole.py
+++ b/rpython/jit/metainterp/test/test_blackhole.py
@@ -228,5 +228,15 @@
assert BlackholeInterpreter.bhimpl_int_lshift.im_func(100, 3) == 100<<3
assert BlackholeInterpreter.bhimpl_int_rshift.im_func(100, 3) == 100>>3
- assert BlackholeInterpreter.bhimpl_uint_rshift.im_func(100, 3) == 100>>3
-
+ assert BlackholeInterpreter.bhimpl_uint_rshift.im_func(100, 3) == 100>>3
+
+def test_debug_fatalerror():
+ from rpython.rtyper.lltypesystem import lltype, llmemory, rstr
+ from rpython.rtyper.llinterp import LLFatalError
+ msg = rstr.mallocstr(1)
+ msg.chars[0] = "!"
+ msg = lltype.cast_opaque_ptr(llmemory.GCREF, msg)
+ e = py.test.raises(LLFatalError,
+ BlackholeInterpreter.bhimpl_debug_fatalerror.im_func,
+ msg)
+ assert str(e.value) == '!'
diff --git a/rpython/jit/tl/tla/tla_assembler.py b/rpython/jit/tl/tla/tla_assembler.py
--- a/rpython/jit/tl/tla/tla_assembler.py
+++ b/rpython/jit/tl/tla/tla_assembler.py
@@ -2,8 +2,8 @@
import sys
import py
+from rpython.jit.tl.tla.test_tla import assemble
py.path.local(__file__)
-from rpython.jit.tl.tla.test_tla import assemble
def usage():
print >> sys.stderr, 'Usage: tla_assembler.py filename.tla.py'
diff --git a/rpython/rtyper/lltypesystem/lloperation.py b/rpython/rtyper/lltypesystem/lloperation.py
--- a/rpython/rtyper/lltypesystem/lloperation.py
+++ b/rpython/rtyper/lltypesystem/lloperation.py
@@ -555,7 +555,7 @@
'debug_offset': LLOp(canrun=True),
'debug_flush': LLOp(canrun=True),
'debug_assert': LLOp(tryfold=True),
- 'debug_fatalerror': LLOp(),
+ 'debug_fatalerror': LLOp(canrun=True),
'debug_llinterpcall': LLOp(canraise=(Exception,)),
# Python func call 'res=arg[0](*arg[1:])'
# in backends, abort() or whatever is fine
diff --git a/rpython/rtyper/lltypesystem/lltype.py b/rpython/rtyper/lltypesystem/lltype.py
--- a/rpython/rtyper/lltypesystem/lltype.py
+++ b/rpython/rtyper/lltypesystem/lltype.py
@@ -503,7 +503,7 @@
return obj
def __init__(self, OF, length, **kwds):
- if hasattr(self, '_name'):
+ if '_name' in self.__dict__:
assert self.OF == OF
assert self.length == length
return
diff --git a/rpython/rtyper/lltypesystem/opimpl.py b/rpython/rtyper/lltypesystem/opimpl.py
--- a/rpython/rtyper/lltypesystem/opimpl.py
+++ b/rpython/rtyper/lltypesystem/opimpl.py
@@ -654,6 +654,13 @@
from rpython.rlib.rtimer import read_timestamp
return read_timestamp()
+def op_debug_fatalerror(ll_msg):
+ from rpython.rtyper.lltypesystem import lltype, rstr
+ from rpython.rtyper.llinterp import LLFatalError
+ assert lltype.typeOf(ll_msg) == lltype.Ptr(rstr.STR)
+ msg = ''.join(ll_msg.chars)
+ raise LLFatalError(msg)
+
# ____________________________________________________________
def get_op_impl(opname):
diff --git a/rpython/rtyper/rptr.py b/rpython/rtyper/rptr.py
--- a/rpython/rtyper/rptr.py
+++ b/rpython/rtyper/rptr.py
@@ -234,6 +234,7 @@
class InteriorPtrRepr(Repr):
def __init__(self, ptrtype):
assert isinstance(ptrtype, lltype.InteriorPtr)
+ self._ptrtype = ptrtype # for debugging
self.v_offsets = []
numitemoffsets = 0
for i, offset in enumerate(ptrtype.offsets):
diff --git a/rpython/translator/c/gcc/test/elf64/track_basic_argument_registers.s b/rpython/translator/c/gcc/test/elf64/track_basic_argument_registers.s
--- a/rpython/translator/c/gcc/test/elf64/track_basic_argument_registers.s
+++ b/rpython/translator/c/gcc/test/elf64/track_basic_argument_registers.s
@@ -25,7 +25,8 @@
/* GCROOT -48(%rbp) */
movq -24(%rbp), %rax
leave
- ret
+ ; try out a "rep ret" instead of just a "ret", for bad reasons
+ rep ret
.cfi_endproc
.LFE0:
.size foobar, .-foobar
diff --git a/rpython/translator/c/gcc/trackgcroot.py b/rpython/translator/c/gcc/trackgcroot.py
--- a/rpython/translator/c/gcc/trackgcroot.py
+++ b/rpython/translator/c/gcc/trackgcroot.py
@@ -664,6 +664,12 @@
def visit_ret(self, line):
return InsnRet(self.CALLEE_SAVE_REGISTERS)
+ def visit_rep(self, line):
+ # 'rep ret': bad reasons for this bogus 'rep' here
+ if line.split()[:2] == ['rep', 'ret']:
+ return self.visit_ret(line)
+ return []
+
def visit_jmp(self, line):
tablelabels = []
match = self.r_jmp_switch.match(line)
diff --git a/rpython/translator/goal/translate.py b/rpython/translator/goal/translate.py
--- a/rpython/translator/goal/translate.py
+++ b/rpython/translator/goal/translate.py
@@ -50,7 +50,7 @@
return result
translate_optiondescr = OptionDescription("translate", "XXX", [
- StrOption("targetspec", "XXX", default='../../../pypy/goal/targetpypystandalone',
+ StrOption("targetspec", "XXX", default='targetpypystandalone',
cmdline=None),
ChoiceOption("opt",
"optimization level", OPT_LEVELS, default=DEFAULT_OPT_LEVEL,
diff --git a/rpython/translator/platform/arm.py b/rpython/translator/platform/arm.py
--- a/rpython/translator/platform/arm.py
+++ b/rpython/translator/platform/arm.py
@@ -47,11 +47,12 @@
return ExecutionResult(returncode, stdout, stderr)
def include_dirs_for_libffi(self):
- return [SB2 + '/usr/include/arm-linux-gnueabi/']
+ return [SB2 + '/usr/include/arm-linux-gnueabi/',
+ SB2 + '/usr/include/arm-linux-gnueabihf/']
def library_dirs_for_libffi(self):
- # on the other hand, library lands in usual place...
- return []
+ return [SB2 + '/usr/lib/arm-linux-gnueabi/',
+ SB2 + '/usr/lib/arm-linux-gnueabihf/']
def execute_makefile(self, path_to_makefile, extra_opts=[]):
if isinstance(path_to_makefile, GnuMakefile):
More information about the pypy-commit
mailing list