Author: Armin Rigo <[email protected]>
Branch:
Changeset: r69970:3d19219df4dd
Date: 2014-03-15 09:25 +0100
http://bitbucket.org/pypy/pypy/changeset/3d19219df4dd/
Log: merge heads
diff --git a/lib_pypy/_sqlite3.py b/lib_pypy/_sqlite3.py
--- a/lib_pypy/_sqlite3.py
+++ b/lib_pypy/_sqlite3.py
@@ -38,6 +38,7 @@
if sys.version_info[0] >= 3:
StandardError = Exception
+ cmp = lambda x, y: (x > y) - (x < y)
long = int
xrange = range
basestring = unicode = str
diff --git a/pypy/module/cpyext/test/test_cpyext.py
b/pypy/module/cpyext/test/test_cpyext.py
--- a/pypy/module/cpyext/test/test_cpyext.py
+++ b/pypy/module/cpyext/test/test_cpyext.py
@@ -64,6 +64,8 @@
kwds["libraries"] = [api_library]
# '%s' undefined; assuming extern returning int
kwds["compile_extra"] = ["/we4013"]
+ # prevent linking with python27.lib
+ kwds["compile_extra"].append("/DPy_BUILD_CORE")
elif sys.platform == 'darwin':
kwds["link_files"] = [str(api_library + '.dylib')]
else:
diff --git a/pypy/module/micronumpy/concrete.py
b/pypy/module/micronumpy/concrete.py
--- a/pypy/module/micronumpy/concrete.py
+++ b/pypy/module/micronumpy/concrete.py
@@ -368,13 +368,10 @@
class ConcreteArray(ConcreteArrayNotOwning):
def __init__(self, shape, dtype, order, strides, backstrides,
storage=lltype.nullptr(RAW_STORAGE)):
- null_storage = lltype.nullptr(RAW_STORAGE)
+ if storage == lltype.nullptr(RAW_STORAGE):
+ storage = dtype.itemtype.malloc(support.product(shape) *
dtype.elsize)
ConcreteArrayNotOwning.__init__(self, shape, dtype, order, strides,
backstrides,
- null_storage)
- if storage == lltype.nullptr(RAW_STORAGE):
- self.storage = dtype.itemtype.malloc(self.size)
- else:
- self.storage = storage
+ storage)
def __del__(self):
free_raw_storage(self.storage, track_allocation=False)
diff --git a/rpython/jit/metainterp/optimizeopt/heap.py
b/rpython/jit/metainterp/optimizeopt/heap.py
--- a/rpython/jit/metainterp/optimizeopt/heap.py
+++ b/rpython/jit/metainterp/optimizeopt/heap.py
@@ -93,6 +93,11 @@
# possible aliasing).
self.clear()
self._lazy_setfield = None
+ if optheap.postponed_op:
+ for a in op.getarglist():
+ if a is optheap.postponed_op.result:
+ optheap.emit_postponed_op()
+ break
optheap.next_optimization.propagate_forward(op)
if not can_cache:
return
@@ -179,6 +184,9 @@
def flush(self):
self.force_all_lazy_setfields_and_arrayitems()
+ self.emit_postponed_op()
+
+ def emit_postponed_op(self):
if self.postponed_op:
postponed_op = self.postponed_op
self.postponed_op = None
@@ -227,10 +235,7 @@
def emit_operation(self, op):
self.emitting_operation(op)
- if self.postponed_op:
- postponed_op = self.postponed_op
- self.postponed_op = None
- self.next_optimization.propagate_forward(postponed_op)
+ self.emit_postponed_op()
if (op.is_comparison() or op.getopnum() == rop.CALL_MAY_FORCE
or op.is_ovf()):
self.postponed_op = op
diff --git a/rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py
b/rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py
--- a/rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py
+++ b/rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py
@@ -1660,6 +1660,16 @@
"""
self.optimize_loop(ops, ops)
+ def test_setfield_int_eq_result(self):
+ # test that the setfield_gc does not end up before int_eq
+ ops = """
+ [p1, i1, i2]
+ i3 = int_eq(i1, i2)
+ setfield_gc(p1, i3, descr=valuedescr)
+ jump(p1, i1, i2)
+ """
+ self.optimize_loop(ops, ops)
+
def test_duplicate_setfield_aliasing(self):
# a case where aliasing issues (and not enough cleverness) mean
# that we fail to remove any setfield_gc
@@ -5433,7 +5443,6 @@
jump(i0)
"""
self.optimize_loop(ops, expected)
-
-
+
class TestLLtype(BaseTestOptimizeBasic, LLtypeMixin):
pass
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
@@ -1,14 +1,15 @@
import py
from rpython.rlib.objectmodel import instantiate
+from rpython.jit.metainterp import compile, resume
+from rpython.jit.metainterp.history import AbstractDescr, ConstInt, BoxInt,
TreeLoop
+from rpython.jit.metainterp.optimize import InvalidLoop
+from rpython.jit.metainterp.optimizeopt import build_opt_chain
from rpython.jit.metainterp.optimizeopt.test.test_util import (
LLtypeMixin, BaseTest, convert_old_style_to_targets)
-from rpython.jit.metainterp.optimizeopt import build_opt_chain
-from rpython.jit.metainterp.optimize import InvalidLoop
-from rpython.jit.metainterp.history import AbstractDescr, ConstInt, BoxInt
-from rpython.jit.metainterp.history import TreeLoop
-from rpython.jit.metainterp import compile, resume
+from rpython.jit.metainterp.optimizeopt.test.test_optimizebasic import \
+ FakeMetaInterpStaticData
from rpython.jit.metainterp.resoperation import rop, opname, oparity
-from rpython.jit.metainterp.optimizeopt.test.test_optimizebasic import
FakeMetaInterpStaticData
+
def test_build_opt_chain():
def check(chain, expected_names):
@@ -40,7 +41,6 @@
class BaseTestWithUnroll(BaseTest):
-
enable_opts =
"intbounds:rewrite:virtualize:string:earlyforce:pure:heap:unroll"
def optimize_loop(self, ops, expected, expected_preamble=None,
@@ -93,8 +93,8 @@
def raises(self, e, fn, *args):
return py.test.raises(e, fn, *args).value
+
class OptimizeOptTest(BaseTestWithUnroll):
-
def setup_method(self, meth=None):
class FailDescr(compile.ResumeGuardDescr):
oparse = None
@@ -130,7 +130,6 @@
self.namespace.pop('fdescr', None)
self.namespace.pop('fdescr2', None)
-
def test_simple(self):
ops = """
[]
@@ -974,7 +973,6 @@
"""
self.optimize_loop(ops, expected, preamble)
-
# ----------
def test_virtual_1(self):
@@ -1252,7 +1250,6 @@
"""
self.optimize_loop(ops, expected, preamble)
-
def test_virtual_constant_isnonnull(self):
ops = """
[i0]
@@ -2789,8 +2786,7 @@
p2 = new_with_vtable(ConstClass(node_vtable))
jump(p2)
"""
- self.raises(InvalidLoop, self.optimize_loop,
- ops, "crash!")
+ self.raises(InvalidLoop, self.optimize_loop, ops, "crash!")
def test_invalid_loop_2(self):
ops = """
@@ -2801,8 +2797,7 @@
escape(p2) # prevent it from staying Virtual
jump(p2)
"""
- self.raises(InvalidLoop, self.optimize_loop,
- ops, "crash!")
+ self.raises(InvalidLoop, self.optimize_loop, ops, "crash!")
def test_invalid_loop_3(self):
ops = """
@@ -2824,8 +2819,7 @@
guard_value(p2, ConstPtr(myptr)) []
jump(p2)
"""
- exc = self.raises(InvalidLoop, self.optimize_loop,
- ops, "crash!")
+ exc = self.raises(InvalidLoop, self.optimize_loop, ops, "crash!")
if exc:
assert "node" in exc.msg
@@ -3151,7 +3145,6 @@
"""
self.optimize_loop(ops, expected)
-
def test_int_and_or_with_zero(self):
ops = """
[i0, i1]
@@ -5107,7 +5100,6 @@
"""
self.optimize_loop(ops, expected)
-
def test_division_nonneg(self):
py.test.skip("harder")
# this is how an app-level division turns into right now
@@ -5444,7 +5436,6 @@
"""
self.optimize_loop(ops, ops, ops)
-
def test_mul_ovf(self):
ops = """
[i0, i1]
@@ -5591,7 +5582,6 @@
def is_integer_bounded(self):
return False
-
for n in ('inst_w_seq', 'inst_index', 'inst_w_list', 'inst_length',
'inst_start', 'inst_step'):
self.namespace[n] = FakeDescr(n)
@@ -5847,7 +5837,7 @@
self.optimize_loop(ops, optops, preamble)
# check with replacing 'str' with 'unicode' everywhere
def r(s):
- return s.replace('str','unicode').replace('s"', 'u"')
+ return s.replace('str', 'unicode').replace('s"', 'u"')
self.optimize_loop(r(ops), r(optops), r(preamble))
def test_newstr_1(self):
@@ -6277,7 +6267,7 @@
if isinstance(value, calldescrtype):
extra = value.get_extra_info()
if (extra and isinstance(extra, effectinfotype) and
- extra.oopspecindex == oopspecindex):
+ extra.oopspecindex == oopspecindex):
# returns 0 for 'func' in this test
return value, 0
raise AssertionError("not found: oopspecindex=%d" %
@@ -7395,7 +7385,6 @@
"""
self.optimize_loop(ops, expected, expected_short=short)
-
def test_loopinvariant_constant_strgetitem(self):
ops = """
[p0]
@@ -7454,7 +7443,7 @@
"""
self.optimize_loop(ops, expected, expected_short=short)
- def test_propagate_virtual_arryalen(self):
+ def test_propagate_virtual_arraylen(self):
ops = """
[p0]
p404 = new_array(2, descr=arraydescr)
@@ -7831,7 +7820,6 @@
"""
self.optimize_loop(ops, expected)
-
def test_setarrayitem_followed_by_arraycopy(self):
ops = """
[p1, p2]
@@ -8124,7 +8112,6 @@
"""
self.optimize_loop(ops, expected)
-
def test_issue1080_infinitie_loop_simple(self):
ops = """
[p69]
@@ -8149,8 +8136,7 @@
guard_value(p1, ConstPtr(myptr)) []
jump(p1)
"""
- self.raises(InvalidLoop, self.optimize_loop,
- ops, ops)
+ self.raises(InvalidLoop, self.optimize_loop, ops, ops)
def test_licm_boxed_opaque_getitem(self):
ops = """
@@ -8225,8 +8211,7 @@
guard_value(p1, ConstPtr(myptr)) []
jump(p1)
"""
- self.raises(InvalidLoop, self.optimize_loop,
- ops, ops)
+ self.raises(InvalidLoop, self.optimize_loop, ops, ops)
def test_cond_call_with_a_constant(self):
ops = """
@@ -8253,6 +8238,16 @@
"""
self.optimize_loop(ops, expected)
+ def test_hippyvm_unroll_bug(self):
+ ops = """
+ [p0, i1, i2]
+ i3 = int_add(i1, 1)
+ i4 = int_eq(i3, i2)
+ setfield_gc(p0, i4, descr=valuedescr)
+ jump(p0, i3, i2)
+ """
+ self.optimize_loop(ops, ops)
+
+
class TestLLtype(OptimizeOptTest, LLtypeMixin):
pass
-
diff --git a/rpython/translator/platform/windows.py
b/rpython/translator/platform/windows.py
--- a/rpython/translator/platform/windows.py
+++ b/rpython/translator/platform/windows.py
@@ -369,32 +369,21 @@
for rule in rules:
m.rule(*rule)
- objects = ' $(OBJECTS)'
- create_obj_response_file = []
- if len(' '.join(rel_ofiles)) > 4000:
- # cmd.exe has a limit of ~4000 characters before a command line is
too long.
- # Use a response file instead, at the cost of making the Makefile
very ugly.
- for i in range(len(rel_ofiles) - 1):
- create_obj_response_file.append('echo %s >> obj_names.rsp' % \
- rel_ofiles[i])
- # use cmd /c for the last one so that the file is flushed
- create_obj_response_file.append('cmd /c echo %s >> obj_names.rsp'
% \
- rel_ofiles[-1])
- objects = ' @obj_names.rsp'
if self.version < 80:
m.rule('$(TARGET)', '$(OBJECTS)',
- create_obj_response_file + [\
- '$(CC_LINK) /nologo $(LDFLAGS) $(LDFLAGSEXTRA)' + objects +
' /out:$@ $(LIBDIRS) $(LIBS)',
+ [ '$(CC_LINK) /nologo $(LDFLAGS) $(LDFLAGSEXTRA) /out:$@'
+\
+ ' $(LIBDIRS) $(LIBS) @<<\n$(OBJECTS)\n<<',
])
else:
m.rule('$(TARGET)', '$(OBJECTS)',
- create_obj_response_file + [\
- '$(CC_LINK) /nologo $(LDFLAGS) $(LDFLAGSEXTRA)' + objects
+ ' $(LINKFILES) /out:$@ $(LIBDIRS) $(LIBS) /MANIFEST
/MANIFESTFILE:$*.manifest',
+ [ '$(CC_LINK) /nologo $(LDFLAGS) $(LDFLAGSEXTRA)' + \
+ ' $(LINKFILES) /out:$@ $(LIBDIRS) $(LIBS) /MANIFEST' + \
+ ' /MANIFESTFILE:$*.manifest @<<\n$(OBJECTS)\n<<',
'mt.exe -nologo -manifest $*.manifest
-outputresource:$@;1',
])
m.rule('debugmode_$(TARGET)', '$(OBJECTS)',
- create_obj_response_file + [\
- '$(CC_LINK) /nologo /DEBUG $(LDFLAGS) $(LDFLAGSEXTRA)' +
objects + ' $(LINKFILES) /out:$@ $(LIBDIRS) $(LIBS)',
+ [ '$(CC_LINK) /nologo /DEBUG $(LDFLAGS) $(LDFLAGSEXTRA)' + \
+ ' $(LINKFILES) /out:$@ $(LIBDIRS) $(LIBS)
@<<\n$(OBJECTS)\n<<',
])
if shared:
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit