[pypy-commit] pypy py3k: hg merge default
amauryfa
noreply at buildbot.pypy.org
Fri Apr 26 22:33:36 CEST 2013
Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: py3k
Changeset: r63667:e6b80345d013
Date: 2013-04-26 22:26 +0200
http://bitbucket.org/pypy/pypy/changeset/e6b80345d013/
Log: hg merge default
diff --git a/pypy/interpreter/astcompiler/consts.py b/pypy/interpreter/astcompiler/consts.py
--- a/pypy/interpreter/astcompiler/consts.py
+++ b/pypy/interpreter/astcompiler/consts.py
@@ -16,8 +16,6 @@
CO_FUTURE_PRINT_FUNCTION = 0x10000
CO_FUTURE_UNICODE_LITERALS = 0x20000
CO_FUTURE_BARRY_AS_BDFL = 0x40000
-CO_CONTAINSGLOBALS = 0x80000 # pypy-specific: need to check that it's not used
- # by any other flag
PyCF_MASK = (CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT |
CO_FUTURE_WITH_STATEMENT | CO_FUTURE_PRINT_FUNCTION |
diff --git a/pypy/interpreter/pycode.py b/pypy/interpreter/pycode.py
--- a/pypy/interpreter/pycode.py
+++ b/pypy/interpreter/pycode.py
@@ -12,7 +12,7 @@
from pypy.interpreter.gateway import unwrap_spec
from pypy.interpreter.astcompiler.consts import (
CO_OPTIMIZED, CO_NEWLOCALS, CO_VARARGS, CO_VARKEYWORDS, CO_NESTED,
- CO_GENERATOR, CO_CONTAINSGLOBALS)
+ CO_GENERATOR)
from pypy.tool.stdlib_opcode import opcodedesc, HAVE_ARGUMENT
from rpython.rlib.rarithmetic import intmask
from rpython.rlib.objectmodel import compute_hash, we_are_translated
@@ -106,8 +106,6 @@
self._initialize()
def _initialize(self):
- self._init_flags()
-
if self.co_cellvars:
argcount = self.co_argcount
argcount += self.co_kwonlyargcount
@@ -153,22 +151,6 @@
'__pypy__' not in sys.builtin_module_names):
raise Exception("CPython host codes should not be rendered")
- def _init_flags(self):
- co_code = self.co_code
- next_instr = 0
- while next_instr < len(co_code):
- opcode = ord(co_code[next_instr])
- next_instr += 1
- if opcode >= HAVE_ARGUMENT:
- next_instr += 2
- while opcode == opcodedesc.EXTENDED_ARG.index:
- opcode = ord(co_code[next_instr])
- next_instr += 3
- if opcode == opcodedesc.LOAD_GLOBAL.index:
- self.co_flags |= CO_CONTAINSGLOBALS
- elif opcode == opcodedesc.LOAD_NAME.index:
- self.co_flags |= CO_CONTAINSGLOBALS
-
co_names = property(lambda self: [self.space.str_w(w_name) for w_name in self.co_names_w]) # for trace
def signature(self):
diff --git a/pypy/interpreter/test/test_code.py b/pypy/interpreter/test/test_code.py
--- a/pypy/interpreter/test/test_code.py
+++ b/pypy/interpreter/test/test_code.py
@@ -9,7 +9,6 @@
filename = filename[:-1]
cls.w_file = cls.space.wrap(filename)
- cls.w_CO_CONTAINSGLOBALS = cls.space.wrap(consts.CO_CONTAINSGLOBALS)
cls.w_CO_NOFREE = cls.space.wrap(consts.CO_NOFREE)
def test_attributes(self):
@@ -193,27 +192,3 @@
# CO_NESTED
assert d['f'](4).__code__.co_flags & 0x10
assert d['f'].__code__.co_flags & 0x10 == 0
- # check for CO_CONTAINSGLOBALS
- assert not d['f'].__code__.co_flags & self.CO_CONTAINSGLOBALS
-
-
- exec("""if 1:
- r = range
- def f():
- return [l for l in r(100)]
- def g():
- return [l for l in [1, 2, 3, 4]]
-""", d)
-
- # check for CO_CONTAINSGLOBALS
- assert d['f'].__code__.co_flags & self.CO_CONTAINSGLOBALS
- assert not d['g'].__code__.co_flags & self.CO_CONTAINSGLOBALS
-
- exec("""if 1:
- b = 2
- def f(x):
- exec("a = 1")
- return a + b + x
-""", d)
- # check for CO_CONTAINSGLOBALS
- assert d['f'].__code__.co_flags & self.CO_CONTAINSGLOBALS
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
@@ -861,6 +861,9 @@
class AppTestOptimizer:
+ def setup_class(cls):
+ cls.w_runappdirect = cls.space.wrap(cls.runappdirect)
+
def test_remove_ending(self):
source = """def f():
return 3
@@ -885,7 +888,8 @@
for name in "None", "True", "False":
snip = "def f(): return " + name
co = compile(snip, "<test>", "exec").co_consts[0]
- assert name not in co.co_names
+ if not self.runappdirect: # This is a pypy optimization
+ assert name not in co.co_names
co = co.co_code
op = co[0]
assert op == opcode.opmap["LOAD_CONST"]
@@ -904,27 +908,46 @@
def code(source):
return compile(source, "<test>", "exec")
co = code("x = 10//4")
- assert len(co.co_consts) == 2
- assert co.co_consts[0] == 2
+ if self.runappdirect:
+ assert 2 in co.co_consts
+ else:
+ # PyPy is more precise
+ assert len(co.co_consts) == 2
+ assert co.co_consts[0] == 2
co = code("x = 10/4")
- assert len(co.co_consts) == 2
- assert co.co_consts[0] == 2.5
+ if self.runappdirect:
+ assert 2.5 in co.co_consts
+ else:
+ assert len(co.co_consts) == 2
+ assert co.co_consts[0] == 2.5
def test_tuple_folding(self):
co = compile("x = (1, 2, 3)", "<test>", "exec")
- assert co.co_consts == ((1, 2, 3), None)
+ if not self.runappdirect:
+ # PyPy is more precise
+ assert co.co_consts == ((1, 2, 3), None)
+ else:
+ assert (1, 2, 3) in co.co_consts
+ assert None in co.co_consts
co = compile("x = ()", "<test>", "exec")
- assert co.co_consts == ((), None)
+ assert set(co.co_consts) == set(((), None))
def test_unary_folding(self):
+ def check_const(co, value):
+ assert value in co.co_consts
+ if not self.runappdirect:
+ # This is a pypy optimization
+ assert co.co_consts[0] == value
co = compile("x = -(3)", "<test>", "exec")
- assert co.co_consts[0] == -3
+ check_const(co, -3)
co = compile("x = ~3", "<test>", "exec")
- assert co.co_consts[0] == ~3
+ check_const(co, ~3)
co = compile("x = +(-3)", "<test>", "exec")
- assert co.co_consts[0] == -3
+ check_const(co, -3)
co = compile("x = not None", "<test>", "exec")
- assert co.co_consts[0] is True
+ if not self.runappdirect:
+ # CPython does not have this optimization
+ assert co.co_consts == (True, None)
def test_folding_of_binops_on_constants(self):
def disassemble(func):
diff --git a/rpython/jit/backend/arm/codebuilder.py b/rpython/jit/backend/arm/codebuilder.py
--- a/rpython/jit/backend/arm/codebuilder.py
+++ b/rpython/jit/backend/arm/codebuilder.py
@@ -335,7 +335,7 @@
# XXX remove and setup aligning in llsupport
def materialize(self, asmmemmgr, allblocks, gcrootmap=None):
- size = self.get_relative_pos()
+ size = self.get_relative_pos() + WORD
malloced = asmmemmgr.malloc(size, size + 7)
allblocks.append(malloced)
rawstart = malloced[0]
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
@@ -41,8 +41,8 @@
class Runner(object):
- add_loop_instruction = ['overload for a specific cpu']
- bridge_loop_instruction = ['overload for a specific cpu']
+ add_loop_instructions = ['overload for a specific cpu']
+ bridge_loop_instructions = ['overload for a specific cpu']
def execute_operation(self, opname, valueboxes, result_type, descr=None):
inputargs, operations = self._get_single_operation_list(opname,
diff --git a/rpython/jit/codewriter/support.py b/rpython/jit/codewriter/support.py
--- a/rpython/jit/codewriter/support.py
+++ b/rpython/jit/codewriter/support.py
@@ -203,7 +203,6 @@
_ll_2_list_append = rlist.ll_append
_ll_2_list_extend = rlist.ll_extend
_ll_3_list_insert = rlist.ll_insert_nonneg
-_ll_4_list_setslice = rlist.ll_listsetslice
_ll_2_list_delslice_startonly = rlist.ll_listdelslice_startonly
_ll_3_list_delslice_startstop = rlist.ll_listdelslice_startstop
_ll_2_list_inplace_mul = rlist.ll_inplace_mul
diff --git a/rpython/jit/metainterp/heapcache.py b/rpython/jit/metainterp/heapcache.py
--- a/rpython/jit/metainterp/heapcache.py
+++ b/rpython/jit/metainterp/heapcache.py
@@ -125,7 +125,7 @@
for descr, cache in self.heap_array_cache.iteritems():
for idx, cache in cache.iteritems():
for frombox in cache.keys():
- if frombox not in self.new_boxes:
+ if not self.new_boxes.get(frombox, False):
del cache[frombox]
return
else:
diff --git a/rpython/jit/metainterp/test/test_list.py b/rpython/jit/metainterp/test/test_list.py
--- a/rpython/jit/metainterp/test/test_list.py
+++ b/rpython/jit/metainterp/test/test_list.py
@@ -128,10 +128,10 @@
res = self.interp_operations(f, [], listops=True)
assert res == 10
- def test_arraycopy_bug(self):
+ def test_arraycopy_bug(self):
def f():
l = [1, 2, 3, 4]
- l2 = [1, 2, 3, 4]
+ l2 = [1, 2, 3, 5]
l[2] = 13
l2[0:len(l2)] = l[:]
return l2[0] + l2[1] + l2[2] + l2[3]
diff --git a/rpython/memory/test/test_generational_gc.py b/rpython/memory/test/test_generational_gc.py
--- a/rpython/memory/test/test_generational_gc.py
+++ b/rpython/memory/test/test_generational_gc.py
@@ -1,4 +1,4 @@
-from rpython.memory.test.test_semispace_gc import TestSemiSpaceGC
+from rpython.memory.test import test_semispace_gc
-class TestGenerationalGC(TestSemiSpaceGC):
+class TestGenerationalGC(test_semispace_gc.TestSemiSpaceGC):
from rpython.memory.gc.generation import GenerationGC as GCClass
diff --git a/rpython/memory/test/test_growingsemispace_gc.py b/rpython/memory/test/test_growingsemispace_gc.py
--- a/rpython/memory/test/test_growingsemispace_gc.py
+++ b/rpython/memory/test/test_growingsemispace_gc.py
@@ -1,8 +1,8 @@
from rpython.rlib.rarithmetic import LONG_BIT
-from rpython.memory.test.test_semispace_gc import TestSemiSpaceGC
+from rpython.memory.test import test_semispace_gc
WORD = LONG_BIT // 8
-class TestGrowingSemiSpaceGC(TestSemiSpaceGC):
+class TestGrowingSemiSpaceGC(test_semispace_gc.TestSemiSpaceGC):
GC_PARAMS = {'space_size': 16*WORD}
diff --git a/rpython/memory/test/test_hybrid_gc.py b/rpython/memory/test/test_hybrid_gc.py
--- a/rpython/memory/test/test_hybrid_gc.py
+++ b/rpython/memory/test/test_hybrid_gc.py
@@ -3,10 +3,10 @@
from rpython.rtyper.lltypesystem import lltype
from rpython.rtyper.lltypesystem.lloperation import llop
-from rpython.memory.test.test_generational_gc import TestGenerationalGC
+from rpython.memory.test import test_generational_gc
-class TestHybridGC(TestGenerationalGC):
+class TestHybridGC(test_generational_gc.TestGenerationalGC):
from rpython.memory.gc.hybrid import HybridGC as GCClass
GC_CAN_MALLOC_NONMOVABLE = True
GC_CAN_SHRINK_BIG_ARRAY = False
diff --git a/rpython/memory/test/test_minimark_gc.py b/rpython/memory/test/test_minimark_gc.py
--- a/rpython/memory/test/test_minimark_gc.py
+++ b/rpython/memory/test/test_minimark_gc.py
@@ -1,10 +1,10 @@
from rpython.rlib.rarithmetic import LONG_BIT
-from rpython.memory.test.test_semispace_gc import TestSemiSpaceGC
+from rpython.memory.test import test_semispace_gc
WORD = LONG_BIT // 8
-class TestMiniMarkGC(TestSemiSpaceGC):
+class TestMiniMarkGC(test_semispace_gc.TestSemiSpaceGC):
from rpython.memory.gc.minimark import MiniMarkGC as GCClass
GC_CAN_SHRINK_BIG_ARRAY = False
GC_CAN_MALLOC_NONMOVABLE = True
diff --git a/rpython/memory/test/test_minimark_gc_cardmarking.py b/rpython/memory/test/test_minimark_gc_cardmarking.py
--- a/rpython/memory/test/test_minimark_gc_cardmarking.py
+++ b/rpython/memory/test/test_minimark_gc_cardmarking.py
@@ -1,4 +1,4 @@
-from rpython.memory.test.test_minimark_gc import TestMiniMarkGC
+from rpython.memory.test import test_minimark_gc
-class TestMiniMarkGCCardMarking(TestMiniMarkGC):
+class TestMiniMarkGCCardMarking(test_minimark_gc.TestMiniMarkGC):
GC_PARAMS = {'card_page_indices': 4}
diff --git a/rpython/rtyper/rlist.py b/rpython/rtyper/rlist.py
--- a/rpython/rtyper/rlist.py
+++ b/rpython/rtyper/rlist.py
@@ -955,7 +955,7 @@
"setslice cannot resize lists in RPython")
# XXX ...but it would be easy enough to support if really needed
ll_arraycopy(l2, l1, 0, start, count)
-ll_listsetslice.oopspec = 'list.setslice(l1, start, stop, l2)'
+
# ____________________________________________________________
#
More information about the pypy-commit
mailing list