[pypy-commit] pypy py3k: kill tests about mixed sequences, they are unordeable now
Author: Antonio Cuni anto.c...@gmail.com Branch: py3k Changeset: r53090:a4c2a1793449 Date: 2012-03-02 10:27 +0100 http://bitbucket.org/pypy/pypy/changeset/a4c2a1793449/ Log:kill tests about mixed sequences, they are unordeable now diff --git a/pypy/module/__builtin__/test/test_minmax.py b/pypy/module/__builtin__/test/test_minmax.py --- a/pypy/module/__builtin__/test/test_minmax.py +++ b/pypy/module/__builtin__/test/test_minmax.py @@ -17,9 +17,6 @@ def test_min_strings(self): assert min('aaa', 'bbb', 'c') == 'aaa' - def test_min_mixed(self): - assert min('1', 2, 3, 'aa') == 2 - def test_min_noargs(self): raises(TypeError, min) @@ -43,9 +40,6 @@ def test_max_strings(self): assert max('aaa', 'bbb', 'c') == 'c' - def test_max_mixed(self): - assert max('1', 2, 3, 'aa') == 'aa' - def test_max_noargs(self): raises(TypeError, max) @@ -66,9 +60,6 @@ def test_max_strings(self): assert max(('aaa', 'bbb', 'c')) == 'c' - def test_max_mixed(self): - assert max(('1', 2, 3, 'aa')) == 'aa' - class AppTestMinList: def test_min_usual(self): @@ -82,6 +73,3 @@ def test_min_strings(self): assert min(['aaa', 'bbb', 'c']) == 'aaa' - - def test_min_mixed(self): - assert min(['1', 2, 3, 'aa']) == 2 ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3k: kill this line, cmp no longer exists
Author: Antonio Cuni anto.c...@gmail.com Branch: py3k Changeset: r53092:fcd3bb999210 Date: 2012-03-02 10:31 +0100 http://bitbucket.org/pypy/pypy/changeset/fcd3bb999210/ Log:kill this line, cmp no longer exists diff --git a/pypy/module/_collections/test/test_deque.py b/pypy/module/_collections/test/test_deque.py --- a/pypy/module/_collections/test/test_deque.py +++ b/pypy/module/_collections/test/test_deque.py @@ -108,7 +108,6 @@ assert (x = y) == (list(x) = list(y)) assert (x y) == (list(x) list(y)) assert (x = y) == (list(x) = list(y)) -assert cmp(x,y) == cmp(list(x),list(y)) def test_extend(self): from _collections import deque ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: sys.version is a string, so this test has been evaluated to false for ages. Use sys.version_info instead
Author: Antonio Cuni anto.c...@gmail.com Branch: Changeset: r53093:32e1793c68ea Date: 2012-03-02 10:34 +0100 http://bitbucket.org/pypy/pypy/changeset/32e1793c68ea/ Log:sys.version is a string, so this test has been evaluated to false for ages. Use sys.version_info instead diff --git a/pypy/module/_md5/test/test_md5.py b/pypy/module/_md5/test/test_md5.py --- a/pypy/module/_md5/test/test_md5.py +++ b/pypy/module/_md5/test/test_md5.py @@ -28,7 +28,7 @@ assert self.md5.digest_size == 16 #assert self.md5.digestsize == 16-- not on CPython assert self.md5.md5().digest_size == 16 -if sys.version = (2, 5): +if sys.version_info = (2, 5): assert self.md5.blocksize == 1 assert self.md5.md5().digestsize == 16 ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3k: hg merge default
Author: Antonio Cuni anto.c...@gmail.com Branch: py3k Changeset: r53094:7e9798e88c4b Date: 2012-03-02 10:34 +0100 http://bitbucket.org/pypy/pypy/changeset/7e9798e88c4b/ Log:hg merge default diff --git a/pypy/module/_md5/test/test_md5.py b/pypy/module/_md5/test/test_md5.py --- a/pypy/module/_md5/test/test_md5.py +++ b/pypy/module/_md5/test/test_md5.py @@ -26,7 +26,7 @@ import sys assert self.md5.md5().digest_size == 16 -if sys.version = (2, 5): +if sys.version_info = (2, 5): assert self.md5.blocksize == 1 assert self.md5.md5().digestsize == 16 diff --git a/pypy/module/array/test/test_array.py b/pypy/module/array/test/test_array.py --- a/pypy/module/array/test/test_array.py +++ b/pypy/module/array/test/test_array.py @@ -504,12 +504,6 @@ assert (a = c) is False assert (c = a) is True -assert a == a -assert a == b -assert a c -assert b == a -assert c a - def test_reduce(self): import pickle a = self.array('i', [1, 2, 3]) ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3k: we can no longer sort mixed types. Use set() instead of sorted() to compare the content of the lists
Author: Antonio Cuni anto.c...@gmail.com Branch: py3k Changeset: r53096:3af950e78b9e Date: 2012-03-02 11:17 +0100 http://bitbucket.org/pypy/pypy/changeset/3af950e78b9e/ Log:we can no longer sort mixed types. Use set() instead of sorted() to compare the content of the lists diff --git a/pypy/objspace/std/test/test_listobject.py b/pypy/objspace/std/test/test_listobject.py --- a/pypy/objspace/std/test/test_listobject.py +++ b/pypy/objspace/std/test/test_listobject.py @@ -404,7 +404,7 @@ # this raised TypeError on ListStrategies l1 = [a, 2, True, a] l2 = [1, 2, a, a] -assert sorted(l1) == sorted(l2) +assert set(l1) == set(l2) def test_notequals(self): assert [1,2,3,4] != [1,2,5,4] ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3k: we have one more test now, adapt the expected number of passed ones
Author: Antonio Cuni anto.c...@gmail.com Branch: py3k Changeset: r53098:e1d8fdaa2ed9 Date: 2012-03-02 11:20 +0100 http://bitbucket.org/pypy/pypy/changeset/e1d8fdaa2ed9/ Log:we have one more test now, adapt the expected number of passed ones diff --git a/pypy/tool/pytest/test/test_conftest1.py b/pypy/tool/pytest/test/test_conftest1.py --- a/pypy/tool/pytest/test/test_conftest1.py +++ b/pypy/tool/pytest/test/test_conftest1.py @@ -17,7 +17,7 @@ def test_selection_by_keyword_app(self, testdir): sorter = testdir.inline_run(-k, applevel -docstring, innertest) passed, skipped, failed = sorter.listoutcomes() -assert len(passed) == 2 +assert len(passed) == 3 assert failed == [] assert skipped == [] assert app_test_something in passed[0].nodeid @@ -27,7 +27,7 @@ sorter = testdir.inline_run(innertest, '-k', 'applevel -docstring', '--runappdirect') passed, skipped, failed = sorter.listoutcomes() -assert len(passed) == 2 +assert len(passed) == 3 print passed assert app_test_something in passed[0].nodeid assert test_method_app in passed[1].nodeid ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3k: kill the cmp argument to list.sort() and sorted()
Author: Antonio Cuni anto.c...@gmail.com Branch: py3k Changeset: r53097:084d689a182e Date: 2012-03-02 11:18 +0100 http://bitbucket.org/pypy/pypy/changeset/084d689a182e/ Log:kill the cmp argument to list.sort() and sorted() diff --git a/pypy/module/__builtin__/app_functional.py b/pypy/module/__builtin__/app_functional.py --- a/pypy/module/__builtin__/app_functional.py +++ b/pypy/module/__builtin__/app_functional.py @@ -11,10 +11,10 @@ # -def sorted(lst, cmp=None, key=None, reverse=None): -sorted(iterable, cmp=None, key=None, reverse=False) -- new sorted list +def sorted(lst, key=None, reverse=None): +sorted(iterable, key=None, reverse=False) -- new sorted list sorted_lst = list(lst) -sorted_lst.sort(cmp, key, reverse) +sorted_lst.sort(key=key, reverse=reverse) return sorted_lst def any(seq): diff --git a/pypy/objspace/std/listobject.py b/pypy/objspace/std/listobject.py --- a/pypy/objspace/std/listobject.py +++ b/pypy/objspace/std/listobject.py @@ -1364,20 +1364,6 @@ def lt(self, a, b): return a b -class CustomCompareSort(SimpleSort): -def lt(self, a, b): -space = self.space -w_cmp = self.w_cmp -w_result = space.call_function(w_cmp, a, b) -try: -result = space.int_w(w_result) -except OperationError, e: -if e.match(space, space.w_TypeError): -raise OperationError(space.w_TypeError, -space.wrap(comparison function must return int)) -raise -return result 0 - class CustomKeySort(SimpleSort): def lt(self, a, b): assert isinstance(a, KeyContainer) @@ -1385,24 +1371,16 @@ space = self.space return space.is_true(space.lt(a.w_key, b.w_key)) -class CustomKeyCompareSort(CustomCompareSort): -def lt(self, a, b): -assert isinstance(a, KeyContainer) -assert isinstance(b, KeyContainer) -return CustomCompareSort.lt(self, a.w_key, b.w_key) +def list_sort__List_ANY_ANY(space, w_list, w_keyfunc, w_reverse): -def list_sort__List_ANY_ANY_ANY(space, w_list, w_cmp, w_keyfunc, w_reverse): - -has_cmp = not space.is_w(w_cmp, space.w_None) has_key = not space.is_w(w_keyfunc, space.w_None) has_reverse = space.is_true(w_reverse) # create and setup a TimSort instance -if has_cmp: -if has_key: -sorterclass = CustomKeyCompareSort -else: -sorterclass = CustomCompareSort +if 0: +# this was the old if has_cmp path. We didn't remove the if not to +# diverge too much from default, to avoid spurious conflicts +pass else: if has_key: sorterclass = CustomKeySort @@ -1415,7 +1393,6 @@ sorter = sorterclass(w_list.getitems(), w_list.length()) sorter.space = space -sorter.w_cmp = w_cmp try: # The list is temporarily made empty, so that mutations performed diff --git a/pypy/objspace/std/listtype.py b/pypy/objspace/std/listtype.py --- a/pypy/objspace/std/listtype.py +++ b/pypy/objspace/std/listtype.py @@ -24,10 +24,10 @@ ' occurrences of value') list_reverse = SMM('reverse',1, doc='L.reverse() -- reverse *IN PLACE*') -list_sort = SMM('sort', 4, defaults=(None, None, False), -argnames=['cmp', 'key', 'reverse'], -doc='L.sort(cmp=None, key=None, reverse=False) -- stable' -' sort *IN PLACE*;\ncmp(x, y) - -1, 0, 1') +list_sort = SMM('sort', 3, defaults=(None, None, False), +argnames=['key', 'reverse'], +doc='L.sort(key=None, reverse=False) -- stable' +' sort *IN PLACE*') list_reversed = SMM('__reversed__', 1, doc='L.__reversed__() -- return a reverse iterator over' ' the list') diff --git a/pypy/objspace/std/test/test_listobject.py b/pypy/objspace/std/test/test_listobject.py --- a/pypy/objspace/std/test/test_listobject.py +++ b/pypy/objspace/std/test/test_listobject.py @@ -543,18 +543,6 @@ l.sort() assert l == [1.1, 2.2, 3.1, 3.3, 4.4, 5.5] -def test_sort_cmp(self): -def lencmp(a,b): return cmp(len(a), len(b)) -l = [ 'a', 'fiver', 'tre', '' ] -l.sort(lencmp) -assert l == ['', 'a', 'tre', 'fiver'] -l = [] -l.sort(lencmp) -assert l == [] -l = [ 'a' ] -l.sort(lencmp) -assert l == [ 'a' ] - def test_sort_key(self): def lower(x): return x.lower() l = ['a', 'C', 'b'] ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3k: add docs for the atexit module, and kill a clearly out-of-place comment
Author: Antonio Cuni anto.c...@gmail.com Branch: py3k Changeset: r53099:5a558b1ae15d Date: 2012-03-02 11:24 +0100 http://bitbucket.org/pypy/pypy/changeset/5a558b1ae15d/ Log:add docs for the atexit module, and kill a clearly out-of-place comment diff --git a/pypy/doc/config/objspace.usemodules.atexit.txt b/pypy/doc/config/objspace.usemodules.atexit.txt new file mode 100644 --- /dev/null +++ b/pypy/doc/config/objspace.usemodules.atexit.txt @@ -0,0 +1,2 @@ +Use the 'atexit' module. +Allow programmer to define multiple exit functions to be executed upon normal program termination. diff --git a/pypy/module/atexit/__init__.py b/pypy/module/atexit/__init__.py --- a/pypy/module/atexit/__init__.py +++ b/pypy/module/atexit/__init__.py @@ -1,8 +1,3 @@ -A _string module, to export formatter_parser and - formatter_field_name_split to the string.Formatter class - implemented in Python. - - from pypy.interpreter.mixedmodule import MixedModule class Module(MixedModule): ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy core-only-tracing: (antocuni, arigo): mark more modules as is_core, because they really contain extensions to pyopcode.py
Author: Antonio Cuni anto.c...@gmail.com Branch: core-only-tracing Changeset: r53101:46d4d363c415 Date: 2012-01-20 17:26 +0100 http://bitbucket.org/pypy/pypy/changeset/46d4d363c415/ Log:(antocuni, arigo): mark more modules as is_core, because they really contain extensions to pyopcode.py diff --git a/pypy/module/pypyjit/policy.py b/pypy/module/pypyjit/policy.py --- a/pypy/module/pypyjit/policy.py +++ b/pypy/module/pypyjit/policy.py @@ -153,5 +153,10 @@ def is_core_function(self, func): mod = func.__module__ or '?' -is_interpreter = mod.startswith('pypy.interpreter.') -return is_interpreter or mod.startswith('pypy.module.pypyjit.') +fname = func.func_name +is_interpreter = (mod.startswith('pypy.interpreter.') or + mod.startswith('pypy.objspace.std.frame') or + mod.startswith('pypy.objspace.std.callmethod') or + (mod.startswith('pypy.objspace.std.mapdict') and + (fname.startswith('LOOKUP') or fname.startswith('LOAD' +return is_interpreter or mod.startswith('pypy.module.pypyjit') ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3k: cStringIO no longer exists
Author: Antonio Cuni anto.c...@gmail.com Branch: py3k Changeset: r53102:155b1c49f9e5 Date: 2012-03-02 11:42 +0100 http://bitbucket.org/pypy/pypy/changeset/155b1c49f9e5/ Log:cStringIO no longer exists diff --git a/pypy/config/pypyoption.py b/pypy/config/pypyoption.py --- a/pypy/config/pypyoption.py +++ b/pypy/config/pypyoption.py @@ -30,7 +30,7 @@ [_socket, unicodedata, mmap, fcntl, _locale, pwd, rctime , select, zipimport, _lsprof, crypt, signal, _rawffi, termios, zlib, bz2, - struct, _hashlib, _md5, _sha, _minimal_curses, cStringIO, + struct, _hashlib, _md5, _sha, _minimal_curses, thread, itertools, pyexpat, _ssl, cpyext, array, _bisect, binascii, _multiprocessing, '_warnings', _collections, _multibytecodec, micronumpy, _ffi, ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy ppc-jit-backend: more cleanups
Author: hager sven.ha...@uni-duesseldorf.de Branch: ppc-jit-backend Changeset: r53103:7af263689381 Date: 2012-03-02 02:56 -0800 http://bitbucket.org/pypy/pypy/changeset/7af263689381/ Log:more cleanups diff --git a/pypy/jit/backend/ppc/codebuilder.py b/pypy/jit/backend/ppc/codebuilder.py --- a/pypy/jit/backend/ppc/codebuilder.py +++ b/pypy/jit/backend/ppc/codebuilder.py @@ -5,7 +5,6 @@ from pypy.jit.backend.ppc.arch import (IS_PPC_32, WORD, IS_PPC_64) import pypy.jit.backend.ppc.register as r from pypy.jit.backend.llsupport.asmmemmgr import BlockBuilderMixin -from pypy.jit.backend.llsupport.regalloc import RegisterManager from pypy.rpython.lltypesystem import lltype, rffi from pypy.jit.metainterp.resoperation import rop from pypy.tool.udir import udir diff --git a/pypy/jit/backend/ppc/ppc_assembler.py b/pypy/jit/backend/ppc/ppc_assembler.py --- a/pypy/jit/backend/ppc/ppc_assembler.py +++ b/pypy/jit/backend/ppc/ppc_assembler.py @@ -9,14 +9,12 @@ FPR_SAVE_AREA, FLOAT_INT_CONVERSION, FORCE_INDEX, SIZE_LOAD_IMM_PATCH_SP) -from pypy.jit.backend.ppc.helper.assembler import (gen_emit_cmp_op, - decode64, Saved_Volatiles) +from pypy.jit.backend.ppc.helper.assembler import Saved_Volatiles from pypy.jit.backend.ppc.helper.regalloc import _check_imm_arg import pypy.jit.backend.ppc.register as r import pypy.jit.backend.ppc.condition as c from pypy.jit.metainterp.history import AbstractFailDescr from pypy.jit.backend.llsupport.asmmemmgr import MachineDataBlockWrapper -from pypy.jit.backend.llsupport.regalloc import compute_vars_longevity from pypy.jit.backend.model import CompiledLoopToken from pypy.rpython.lltypesystem import lltype, rffi, llmemory from pypy.jit.metainterp.resoperation import rop @@ -185,7 +183,6 @@ bytecode = rffi.cast(rffi.UCHARP, mem_loc) num = 0 value = 0 -fvalue = 0 code_inputarg = False while True: code = rffi.cast(lltype.Signed, bytecode[0]) @@ -522,11 +519,9 @@ operations = self.setup(looptoken, operations) self.startpos = self.mc.currpos() -longevity = compute_vars_longevity(inputargs, operations) regalloc = Regalloc(assembler=self, frame_manager=PPCFrameManager()) regalloc.prepare_loop(inputargs, operations) -regalloc_head = self.mc.currpos() start_pos = self.mc.currpos() looptoken._ppc_loop_code = start_pos @@ -584,7 +579,6 @@ operations = self.setup(looptoken, operations) assert isinstance(faildescr, AbstractFailDescr) code = self._find_failure_recovery_bytecode(faildescr) -frame_depth = faildescr._ppc_frame_depth arglocs = self.decode_inputargs(code) if not we_are_translated(): assert len(inputargs) == len(arglocs) diff --git a/pypy/jit/backend/ppc/regalloc.py b/pypy/jit/backend/ppc/regalloc.py --- a/pypy/jit/backend/ppc/regalloc.py +++ b/pypy/jit/backend/ppc/regalloc.py @@ -912,28 +912,6 @@ arglocs.append(t) return arglocs -# from ../x86/regalloc.py:791 -def _unpack_fielddescr(self, fielddescr): -assert isinstance(fielddescr, BaseFieldDescr) -ofs = fielddescr.offset -size = fielddescr.get_field_size(self.cpu.translate_support_code) -ptr = fielddescr.is_pointer_field() -return ofs, size, ptr - -# from ../x86/regalloc.py:779 -def _unpack_arraydescr(self, arraydescr): -assert isinstance(arraydescr, BaseArrayDescr) -cpu = self.cpu -ofs_length = arraydescr.get_ofs_length(cpu.translate_support_code) -ofs = arraydescr.get_base_size(cpu.translate_support_code) -size = arraydescr.get_item_size(cpu.translate_support_code) -ptr = arraydescr.is_array_of_pointers() -scale = 0 -while (1 scale) size: -scale += 1 -assert (1 scale) == size -return size, scale, ofs, ofs_length, ptr - def prepare_force_spill(self, op): self.force_spill_var(op.getarg(0)) return [] ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy ppc-jit-backend: port test from ARM backend
Author: hager sven.ha...@uni-duesseldorf.de Branch: ppc-jit-backend Changeset: r53104:049cb55075c8 Date: 2012-03-02 03:15 -0800 http://bitbucket.org/pypy/pypy/changeset/049cb55075c8/ Log:port test from ARM backend diff --git a/pypy/jit/backend/ppc/test/test_generated.py b/pypy/jit/backend/ppc/test/test_generated.py new file mode 100644 --- /dev/null +++ b/pypy/jit/backend/ppc/test/test_generated.py @@ -0,0 +1,525 @@ +import py +from pypy.jit.metainterp.history import (AbstractFailDescr, + AbstractDescr, + BasicFailDescr, + BoxInt, Box, BoxPtr, + ConstInt, ConstPtr, + BoxObj, Const, + ConstObj, BoxFloat, ConstFloat) +from pypy.jit.metainterp.history import JitCellToken +from pypy.jit.metainterp.resoperation import ResOperation, rop +from pypy.rpython.test.test_llinterp import interpret +from pypy.jit.backend.detect_cpu import getcpuclass + +CPU = getcpuclass() +class TestStuff(object): + +def test0(self): +faildescr1 = BasicFailDescr(1) +faildescr2 = BasicFailDescr(2) +v1 = BoxInt() +v2 = BoxInt() +v3 = BoxInt() +v4 = BoxInt() +v5 = BoxInt() +v6 = BoxInt() +v7 = BoxInt() +v8 = BoxInt() +v9 = BoxInt() +v10 = BoxInt() +v11 = BoxInt() +v12 = BoxInt() +cpu = CPU(None, None) +cpu.setup_once() +inputargs = [v1, v2, v3, v4, v5, v6, v7, v8, v9, v10] +operations = [ +ResOperation(rop.INT_SUB, [ConstInt(-1073741824), v7], v11), +ResOperation(rop.INT_GE, [v3, ConstInt(23)], v12), +ResOperation(rop.GUARD_TRUE, [v12], None, descr=faildescr1), +ResOperation(rop.FINISH, [v9, v6, v10, v2, v8, v5, v1, v4], None, descr=faildescr2), +] +looptoken = JitCellToken() +operations[2].setfailargs([v12, v8, v3, v2, v1, v11]) +cpu.compile_loop(inputargs, operations, looptoken) +args = [-12 , -26 , -19 , 7 , -5 , -24 , -37 , 62 , 9 , 12] +op = cpu.execute_token(looptoken, *args) +assert cpu.get_latest_value_int(0) == 0 +assert cpu.get_latest_value_int(1) == 62 +assert cpu.get_latest_value_int(2) == -19 +assert cpu.get_latest_value_int(3) == -26 +assert cpu.get_latest_value_int(4) == -12 +assert cpu.get_latest_value_int(5) == -1073741787 + +def test_overflow(self): +faildescr1 = BasicFailDescr(1) +faildescr2 = BasicFailDescr(2) +faildescr3 = BasicFailDescr(3) +v1 = BoxInt() +v2 = BoxInt() +v3 = BoxInt() +v4 = BoxInt() +v5 = BoxInt() +v6 = BoxInt() +v7 = BoxInt() +v8 = BoxInt() +v9 = BoxInt() +v10 = BoxInt() +v11 = BoxInt() +v12 = BoxInt() +v13 = BoxInt() +v14 = BoxInt() +v15 = BoxInt() +v16 = BoxInt() +v17 = BoxInt() +v18 = BoxInt() +cpu = CPU(None, None) +cpu.setup_once() +inputargs = [v1, v2, v3, v4, v5, v6, v7, v8, v9, v10] +operations = [ +ResOperation(rop.INT_SUB, [ConstInt(21), v5], v11), +ResOperation(rop.INT_MUL_OVF, [v8, v4], v12), +ResOperation(rop.GUARD_NO_OVERFLOW, [], None, descr=faildescr1), +ResOperation(rop.UINT_LT, [v10, v3], v13), +ResOperation(rop.INT_IS_TRUE, [v3], v14), +ResOperation(rop.INT_XOR, [v9, v8], v15), +ResOperation(rop.INT_LE, [v12, v6], v16), +ResOperation(rop.UINT_GT, [v15, v5], v17), +ResOperation(rop.UINT_LE, [ConstInt(-9), v13], v18), +ResOperation(rop.GUARD_FALSE, [v13], None, descr=faildescr2), +ResOperation(rop.FINISH, [v7, v1, v2], None, descr=faildescr3), +] +operations[2].setfailargs([v10, v6]) +operations[9].setfailargs([v15, v7, v10, v18, v4, v17, v1]) +looptoken = JitCellToken() +cpu.compile_loop(inputargs, operations, looptoken) +args = [16 , 5 , 5 , 16 , 46 , 6 , 63 , 39 , 78 , 0] +op = cpu.execute_token(looptoken, *args) +assert cpu.get_latest_value_int(0) == 105 +assert cpu.get_latest_value_int(1) == 63 +assert cpu.get_latest_value_int(2) == 0 +assert cpu.get_latest_value_int(3) == 0 +assert cpu.get_latest_value_int(4) == 16 +assert cpu.get_latest_value_int(5) == 1 +assert cpu.get_latest_value_int(6) == 16 + +def test_sub_with_neg_const_first_arg(self): +faildescr1 = BasicFailDescr(1) +faildescr2 = BasicFailDescr(2) +faildescr3 = BasicFailDescr(3) +v1 = BoxInt() +v2 = BoxInt() +v3 = BoxInt() +v4 = BoxInt() +v5 = BoxInt() +v6 = BoxInt()
[pypy-commit] pypy ppc-jit-backend: remove obsolete information about old guard encoding style
Author: hager sven.ha...@uni-duesseldorf.de Branch: ppc-jit-backend Changeset: r53105:4c2db371ef83 Date: 2012-03-02 03:35 -0800 http://bitbucket.org/pypy/pypy/changeset/4c2db371ef83/ Log:remove obsolete information about old guard encoding style diff --git a/pypy/jit/backend/ppc/ppc_assembler.py b/pypy/jit/backend/ppc/ppc_assembler.py --- a/pypy/jit/backend/ppc/ppc_assembler.py +++ b/pypy/jit/backend/ppc/ppc_assembler.py @@ -66,16 +66,6 @@ class AssemblerPPC(OpAssembler): -FLOAT_TYPE = '\xED' -REF_TYPE = '\xEE' -INT_TYPE = '\xEF' - -STACK_LOC = '\xFC' -IMM_LOC = '\xFD' -# REG_LOC is empty -EMPTY_LOC = '\xFE' -END_OF_LOCS = '\xFF' - FORCE_INDEX_AREA= len(r.MANAGED_REGS) * WORD ENCODING_AREA = len(r.MANAGED_REGS) * WORD OFFSET_SPP_TO_GPR_SAVE_AREA = (FORCE_INDEX + FLOAT_INT_CONVERSION ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy ppc-jit-backend: emit some information when hitting not implemented operations
Author: hager sven.ha...@uni-duesseldorf.de Branch: ppc-jit-backend Changeset: r53106:285f2e51cbcc Date: 2012-03-02 04:12 -0800 http://bitbucket.org/pypy/pypy/changeset/285f2e51cbcc/ Log:emit some information when hitting not implemented operations diff --git a/pypy/jit/backend/ppc/ppc_assembler.py b/pypy/jit/backend/ppc/ppc_assembler.py --- a/pypy/jit/backend/ppc/ppc_assembler.py +++ b/pypy/jit/backend/ppc/ppc_assembler.py @@ -1070,10 +1070,13 @@ assert 0, not implemented yet def notimplemented_op(self, op, arglocs, regalloc): -raise NotImplementedError, op +print [PPC/asm] %s not implemented % op.getopname() +raise NotImplementedError(op) def notimplemented_op_with_guard(self, op, guard_op, arglocs, regalloc): -raise NotImplementedError, op +print [PPC/asm] %s with guard %s not implemented % \ +(op.getopname(), guard_op.getopname()) +raise NotImplementedError(op) operations = [notimplemented_op] * (rop._LAST + 1) operations_with_guard = [notimplemented_op_with_guard] * (rop._LAST + 1) diff --git a/pypy/jit/backend/ppc/regalloc.py b/pypy/jit/backend/ppc/regalloc.py --- a/pypy/jit/backend/ppc/regalloc.py +++ b/pypy/jit/backend/ppc/regalloc.py @@ -920,11 +920,15 @@ return lambda self, op: fn(self, op, None) def notimplemented(self, op): -raise NotImplementedError, op +print [PPC/regalloc] %s not implemented % op.getopname() +raise NotImplementedError(op) def notimplemented_with_guard(self, op, guard_op): +print [PPC/regalloc] %s with guard %s not implemented % \ +(op.getopname(), guard_op.getopname()) +raise NotImplementedError(op) -raise NotImplementedError, op + operations = [notimplemented] * (rop._LAST + 1) operations_with_guard = [notimplemented_with_guard] * (rop._LAST + 1) ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy ppc-jit-backend: use setup_method instead of setup_class
Author: hager sven.ha...@uni-duesseldorf.de Branch: ppc-jit-backend Changeset: r53107:a3fb941acdca Date: 2012-03-02 04:32 -0800 http://bitbucket.org/pypy/pypy/changeset/a3fb941acdca/ Log:use setup_method instead of setup_class diff --git a/pypy/jit/backend/ppc/test/test_runner.py b/pypy/jit/backend/ppc/test/test_runner.py --- a/pypy/jit/backend/ppc/test/test_runner.py +++ b/pypy/jit/backend/ppc/test/test_runner.py @@ -19,9 +19,9 @@ class TestPPC(LLtypeBackendTest): -def setup_class(cls): -cls.cpu = PPC_64_CPU(rtyper=None, stats=FakeStats()) -cls.cpu.setup_once() +def setup_method(self, meth): +self.cpu = PPC_64_CPU(rtyper=None, stats=FakeStats()) +self.cpu.setup_once() def test_compile_loop_many_int_args(self): for numargs in range(2, 16): ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3k: we cannot push frame.last_exception directly to the valuestack: instead, we wrap it inside a tiny operation error wrapper
Author: Antonio Cuni anto.c...@gmail.com Branch: py3k Changeset: r53108:1466c3172b9b Date: 2012-03-02 14:02 +0100 http://bitbucket.org/pypy/pypy/changeset/1466c3172b9b/ Log:we cannot push frame.last_exception directly to the valuestack: instead, we wrap it inside a tiny operation error wrapper diff --git a/pypy/interpreter/error.py b/pypy/interpreter/error.py --- a/pypy/interpreter/error.py +++ b/pypy/interpreter/error.py @@ -469,3 +469,14 @@ def typed_unwrap_error_msg(space, expected, w_obj): type_name = space.type(w_obj).getname(space) return space.wrap(expected %s, got %s object % (expected, type_name)) + + +from pypy.interpreter.baseobjspace import Wrappable + +class W_OperationError(Wrappable): + +Tiny applevel wrapper around an OperationError. + + +def __init__(self, operr): +self.operr = operr diff --git a/pypy/interpreter/pyopcode.py b/pypy/interpreter/pyopcode.py --- a/pypy/interpreter/pyopcode.py +++ b/pypy/interpreter/pyopcode.py @@ -529,10 +529,16 @@ self.setdictscope(w_locals) def POP_EXCEPT(self, oparg, next_instr): +from pypy.interpreter.error import W_OperationError assert self.space.py3k # on CPython, POP_EXCEPT also pops the block. Here, the block is # automatically popped by unrollstack() -self.last_exception = self.popvalue() +w_last_exception = self.popvalue() +if not isinstance(w_last_exception, W_OperationError): +msg = expected an OperationError, got %s % ( +self.space.str_w(w_last_exception)) +raise BytecodeCorruption(msg) +self.last_exception = w_last_exception.operr def POP_BLOCK(self, oparg, next_instr): block = self.pop_block() @@ -1277,8 +1283,11 @@ # instead of the traceback, we store the unroller object, # wrapped. if frame.space.py3k: +from pypy.interpreter.error import W_OperationError # this is popped by POP_EXCEPT, which is present only in py3k -frame.pushvalue(frame.last_exception) +w_last_exception = W_OperationError(frame.last_exception) +w_last_exception = frame.space.wrap(w_last_exception) +frame.pushvalue(w_last_exception) frame.pushvalue(frame.space.wrap(unroller)) frame.pushvalue(operationerr.get_w_value(frame.space)) frame.pushvalue(operationerr.w_type) diff --git a/pypy/interpreter/typedef.py b/pypy/interpreter/typedef.py --- a/pypy/interpreter/typedef.py +++ b/pypy/interpreter/typedef.py @@ -6,7 +6,7 @@ from pypy.interpreter.gateway import interp2app, BuiltinCode from pypy.interpreter.argument import Arguments from pypy.interpreter.baseobjspace import Wrappable, DescrMismatch -from pypy.interpreter.error import OperationError, operationerrfmt +from pypy.interpreter.error import OperationError, operationerrfmt, W_OperationError from pypy.tool.sourcetools import compile2, func_with_new_name from pypy.rlib.objectmodel import instantiate, compute_identity_hash, specialize from pypy.rlib.jit import promote @@ -940,3 +940,5 @@ SuspendedUnroller.typedef = TypeDef(SuspendedUnroller) SuspendedUnroller.typedef.acceptable_as_base_class = False + +W_OperationError.typedef = TypeDef(OperationError) ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3k: after 145994f7f8f9 we pass the result of getattr(..., '__traceback__') to set_traceback(), which means that the annotator things it's a W_Root. Force the field to be annotated
Author: Antonio Cuni anto.c...@gmail.com Branch: py3k Changeset: r53109:0f407c6962c0 Date: 2012-03-02 14:39 +0100 http://bitbucket.org/pypy/pypy/changeset/0f407c6962c0/ Log:after 145994f7f8f9 we pass the result of getattr(..., '__traceback__') to set_traceback(), which means that the annotator things it's a W_Root. Force the field to be annotated as PyTraceback diff --git a/pypy/interpreter/error.py b/pypy/interpreter/error.py --- a/pypy/interpreter/error.py +++ b/pypy/interpreter/error.py @@ -283,6 +283,8 @@ only if the exception really propagates out of this frame, by executioncontext.leave() being called with got_exception=True. +from pypy.interpreter.pytraceback import PyTraceback +assert isinstance(traceback, PyTraceback) self._application_traceback = traceback # ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy ppc-jit-backend: kill unused encoding/decoding functions
Author: hager sven.ha...@uni-duesseldorf.de Branch: ppc-jit-backend Changeset: r53110:62a9e5c0e0be Date: 2012-03-02 05:53 -0800 http://bitbucket.org/pypy/pypy/changeset/62a9e5c0e0be/ Log:kill unused encoding/decoding functions diff --git a/pypy/jit/backend/ppc/helper/assembler.py b/pypy/jit/backend/ppc/helper/assembler.py --- a/pypy/jit/backend/ppc/helper/assembler.py +++ b/pypy/jit/backend/ppc/helper/assembler.py @@ -52,45 +52,6 @@ self.mc.rlwinm(res.value, res.value, 1, 31, 31) return f -def encode32(mem, i, n): -mem[i+3] = chr(n 0xFF) -mem[i+2] = chr((n 8) 0xFF) -mem[i+1] = chr((n 16) 0xFF) -mem[i] = chr((n 24) 0xFF) - -# XXX this sign extension looks a bit strange ... -# It is important for PPC64. -def decode32(mem, index): -value = ( ord(mem[index+3]) -| ord(mem[index+2]) 8 -| ord(mem[index+1]) 16 -| ord(mem[index]) 24) - -rffi_value = rffi.cast(rffi.INT, value) -# do sign extension -return rffi.cast(lltype.Signed, rffi_value) - -def encode64(mem, i, n): -mem[i+7] = chr(n 0xFF) -mem[i+6] = chr((n 8) 0xFF) -mem[i+5] = chr((n 16) 0xFF) -mem[i+4] = chr((n 24) 0xFF) -mem[i+3] = chr((n 32) 0xFF) -mem[i+2] = chr((n 40) 0xFF) -mem[i+1] = chr((n 48) 0xFF) -mem[i] = chr((n 56) 0xFF) - -def decode64(mem, index): -value = ( ord(mem[index+7]) -| ord(mem[index+6]) 8 -| ord(mem[index+5]) 16 -| ord(mem[index+4]) 24 -| ord(mem[index+3]) 32 -| ord(mem[index+2]) 40 -| ord(mem[index+1]) 48 -| ord(mem[index]) 56) -return intmask(value) - def count_reg_args(args): reg_args = 0 words = 0 diff --git a/pypy/jit/backend/ppc/test/test_helper.py b/pypy/jit/backend/ppc/test/test_helper.py deleted file mode 100644 --- a/pypy/jit/backend/ppc/test/test_helper.py +++ /dev/null @@ -1,25 +0,0 @@ -from pypy.jit.backend.ppc.helper.assembler import (encode32, decode32) - #encode64, decode64) - -def test_encode32(): -mem = [None]*4 -encode32(mem, 0, 1234567) -assert ''.join(mem) == '\x00\x12\xd6\x87' -mem = [None]*4 -encode32(mem, 0, 983040) -assert ''.join(mem) == '\x00\x0F\x00\x00' - -def test_decode32(): -mem = list('\x00\x12\xd6\x87') -assert decode32(mem, 0) == 1234567 -mem = list('\x00\x0F\x00\x00') -assert decode32(mem, 0) == 983040 -mem = list(\x00\x00\x00\x03) -assert decode32(mem, 0) == 3 - -def test_encode32_and_decode32(): -mem = [None] * 4 -for val in [1, 45654, -456456, 123, 9]: -encode32(mem, 0, val) -assert decode32(mem, 0) == val - ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: we cannot mix space.{eq, lt, gt, ...}: we need to specialize the function
Author: Antonio Cuni anto.c...@gmail.com Branch: Changeset: r53111:228da252ffd5 Date: 2012-03-02 15:39 +0100 http://bitbucket.org/pypy/pypy/changeset/228da252ffd5/ Log:we cannot mix space.{eq,lt,gt,...}: we need to specialize the function diff --git a/pypy/module/array/interp_array.py b/pypy/module/array/interp_array.py --- a/pypy/module/array/interp_array.py +++ b/pypy/module/array/interp_array.py @@ -11,6 +11,7 @@ from pypy.objspace.std.register_all import register_all from pypy.rlib.rarithmetic import ovfcheck from pypy.rlib.unroll import unrolling_iterable +from pypy.rlib.objectmodel import specialize from pypy.rpython.lltypesystem import lltype, rffi @@ -583,6 +584,7 @@ raise OperationError(space.w_ValueError, space.wrap(msg)) # Compare methods +@specialize.arg(3) def _cmp_impl(space, self, other, space_fn): if isinstance(other, W_ArrayBase): w_lst1 = array_tolist__Array(space, self) ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3k: hg merge default
Author: Antonio Cuni anto.c...@gmail.com Branch: py3k Changeset: r53112:88183ba02b87 Date: 2012-03-02 15:40 +0100 http://bitbucket.org/pypy/pypy/changeset/88183ba02b87/ Log:hg merge default diff --git a/pypy/jit/backend/test/runner_test.py b/pypy/jit/backend/test/runner_test.py --- a/pypy/jit/backend/test/runner_test.py +++ b/pypy/jit/backend/test/runner_test.py @@ -266,6 +266,38 @@ res = self.cpu.get_latest_value_int(0) assert res == 20 +def test_compile_big_bridge_out_of_small_loop(self): +i0 = BoxInt() +faildescr1 = BasicFailDescr(1) +looptoken = JitCellToken() +operations = [ +ResOperation(rop.GUARD_FALSE, [i0], None, descr=faildescr1), +ResOperation(rop.FINISH, [], None, descr=BasicFailDescr(2)), +] +inputargs = [i0] +operations[0].setfailargs([i0]) +self.cpu.compile_loop(inputargs, operations, looptoken) + +i1list = [BoxInt() for i in range(1000)] +bridge = [] +iprev = i0 +for i1 in i1list: +bridge.append(ResOperation(rop.INT_ADD, [iprev, ConstInt(1)], i1)) +iprev = i1 +bridge.append(ResOperation(rop.GUARD_FALSE, [i0], None, + descr=BasicFailDescr(3))) +bridge.append(ResOperation(rop.FINISH, [], None, + descr=BasicFailDescr(4))) +bridge[-2].setfailargs(i1list) + +self.cpu.compile_bridge(faildescr1, [i0], bridge, looptoken) + +fail = self.cpu.execute_token(looptoken, 1) +assert fail.identifier == 3 +for i in range(1000): +res = self.cpu.get_latest_value_int(i) +assert res == 2 + i + def test_get_latest_value_count(self): i0 = BoxInt() i1 = BoxInt() diff --git a/pypy/jit/metainterp/blackhole.py b/pypy/jit/metainterp/blackhole.py --- a/pypy/jit/metainterp/blackhole.py +++ b/pypy/jit/metainterp/blackhole.py @@ -1379,7 +1379,8 @@ elif opnum == rop.GUARD_NO_OVERFLOW: # Produced by int_xxx_ovf(). The pc is just after the opcode. # We get here because it did not used to overflow, but now it does. -return get_llexception(self.cpu, OverflowError()) +if not dont_change_position: +return get_llexception(self.cpu, OverflowError()) # elif opnum == rop.GUARD_OVERFLOW: # Produced by int_xxx_ovf(). The pc is just after the opcode. diff --git a/pypy/jit/metainterp/pyjitpl.py b/pypy/jit/metainterp/pyjitpl.py --- a/pypy/jit/metainterp/pyjitpl.py +++ b/pypy/jit/metainterp/pyjitpl.py @@ -2064,11 +2064,12 @@ pass # XXX we want to do something special in resume descr, # but not now elif opnum == rop.GUARD_NO_OVERFLOW: # an overflow now detected -self.execute_raised(OverflowError(), constant=True) -try: -self.finishframe_exception() -except ChangeFrame: -pass +if not dont_change_position: +self.execute_raised(OverflowError(), constant=True) +try: +self.finishframe_exception() +except ChangeFrame: +pass elif opnum == rop.GUARD_OVERFLOW: # no longer overflowing self.clear_exception() else: diff --git a/pypy/jit/metainterp/test/test_ajit.py b/pypy/jit/metainterp/test/test_ajit.py --- a/pypy/jit/metainterp/test/test_ajit.py +++ b/pypy/jit/metainterp/test/test_ajit.py @@ -288,10 +288,10 @@ if y4 == 0: x1, x2 = x2, x1 return res +res = self.meta_interp(f, [6, sys.maxint, 32, 48]) +assert res == f(6, sys.maxint, 32, 48) res = self.meta_interp(f, [sys.maxint, 6, 32, 48]) assert res == f(sys.maxint, 6, 32, 48) -res = self.meta_interp(f, [6, sys.maxint, 32, 48]) -assert res == f(6, sys.maxint, 32, 48) def test_loop_invariant_intbox(self): diff --git a/pypy/jit/metainterp/warmspot.py b/pypy/jit/metainterp/warmspot.py --- a/pypy/jit/metainterp/warmspot.py +++ b/pypy/jit/metainterp/warmspot.py @@ -100,7 +100,7 @@ if not kwds.get('translate_support_code', False): warmrunnerdesc.metainterp_sd.profiler.finish() warmrunnerdesc.metainterp_sd.cpu.finish_once() -print '~~~ return value:', res +print '~~~ return value:', repr(res) while repeat 1: print '~' * 79 res1 = interp.eval_graph(graph, args) diff --git a/pypy/module/array/interp_array.py b/pypy/module/array/interp_array.py --- a/pypy/module/array/interp_array.py +++ b/pypy/module/array/interp_array.py @@ -10,6 +10,7 @@ from pypy.objspace.std.register_all import register_all from pypy.rlib.rarithmetic import ovfcheck from pypy.rlib.unroll import unrolling_iterable +from pypy.rlib.objectmodel import specialize from
[pypy-commit] pypy default: Test and fix.
Author: Armin Rigo ar...@tunes.org Branch: Changeset: r53113:18eccde6f1a4 Date: 2012-03-02 16:00 +0100 http://bitbucket.org/pypy/pypy/changeset/18eccde6f1a4/ Log:Test and fix. diff --git a/pypy/module/array/interp_array.py b/pypy/module/array/interp_array.py --- a/pypy/module/array/interp_array.py +++ b/pypy/module/array/interp_array.py @@ -160,13 +160,15 @@ def make_array(mytype): +W_ArrayBase = globals()['W_ArrayBase'] + class W_Array(W_ArrayBase): itemsize = mytype.bytes typecode = mytype.typecode @staticmethod def register(typeorder): -typeorder[W_Array] = [] +typeorder[W_Array] = [(W_ArrayBase, None)] def __init__(self, space): self.space = space @@ -586,29 +588,26 @@ # Compare methods @specialize.arg(3) def _cmp_impl(space, self, other, space_fn): -if isinstance(other, W_ArrayBase): -w_lst1 = array_tolist__Array(space, self) -w_lst2 = space.call_method(other, 'tolist') -return space_fn(w_lst1, w_lst2) -else: -return space.w_NotImplemented +w_lst1 = array_tolist__Array(space, self) +w_lst2 = space.call_method(other, 'tolist') +return space_fn(w_lst1, w_lst2) -def eq__Array_ANY(space, self, other): +def eq__Array_ArrayBase(space, self, other): return _cmp_impl(space, self, other, space.eq) -def ne__Array_ANY(space, self, other): +def ne__Array_ArrayBase(space, self, other): return _cmp_impl(space, self, other, space.ne) -def lt__Array_ANY(space, self, other): +def lt__Array_ArrayBase(space, self, other): return _cmp_impl(space, self, other, space.lt) -def le__Array_ANY(space, self, other): +def le__Array_ArrayBase(space, self, other): return _cmp_impl(space, self, other, space.le) -def gt__Array_ANY(space, self, other): +def gt__Array_ArrayBase(space, self, other): return _cmp_impl(space, self, other, space.gt) -def ge__Array_ANY(space, self, other): +def ge__Array_ArrayBase(space, self, other): return _cmp_impl(space, self, other, space.ge) # Misc methods diff --git a/pypy/module/array/test/test_array.py b/pypy/module/array/test/test_array.py --- a/pypy/module/array/test/test_array.py +++ b/pypy/module/array/test/test_array.py @@ -845,8 +845,11 @@ cls.maxint = sys.maxint class AppTestArray(BaseArrayTests): +OPTIONS = {} + def setup_class(cls): -cls.space = gettestobjspace(usemodules=('array', 'struct', '_rawffi')) +cls.space = gettestobjspace(usemodules=('array', 'struct', '_rawffi'), +**cls.OPTIONS) cls.w_array = cls.space.appexec([], (): import array return array.array @@ -868,3 +871,7 @@ a = self.array('b', range(4)) a[::-1] = a assert a == self.array('b', [3, 2, 1, 0]) + + +class AppTestArrayBuiltinShortcut(AppTestArray): +OPTIONS = {'objspace.std.builtinshortcut': True} ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix the test.
Author: Armin Rigo ar...@tunes.org Branch: Changeset: r53114:6f07c52e6ee9 Date: 2012-03-02 16:01 +0100 http://bitbucket.org/pypy/pypy/changeset/6f07c52e6ee9/ Log:Fix the test. diff --git a/pypy/jit/metainterp/test/test_compile.py b/pypy/jit/metainterp/test/test_compile.py --- a/pypy/jit/metainterp/test/test_compile.py +++ b/pypy/jit/metainterp/test/test_compile.py @@ -14,7 +14,7 @@ ts = typesystem.llhelper def __init__(self): self.seen = [] -def compile_loop(self, inputargs, operations, token, name=''): +def compile_loop(self, inputargs, operations, token, log=True, name=''): self.seen.append((inputargs, operations, token)) class FakeLogger(object): ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy ppc-jit-backend: add debug information
Author: hager sven.ha...@uni-duesseldorf.de Branch: ppc-jit-backend Changeset: r53115:5e0e0edb387e Date: 2012-03-02 07:42 -0800 http://bitbucket.org/pypy/pypy/changeset/5e0e0edb387e/ Log:add debug information diff --git a/pypy/jit/backend/ppc/ppc_assembler.py b/pypy/jit/backend/ppc/ppc_assembler.py --- a/pypy/jit/backend/ppc/ppc_assembler.py +++ b/pypy/jit/backend/ppc/ppc_assembler.py @@ -14,20 +14,22 @@ import pypy.jit.backend.ppc.register as r import pypy.jit.backend.ppc.condition as c from pypy.jit.metainterp.history import AbstractFailDescr +from pypy.jit.metainterp.history import ConstInt, BoxInt from pypy.jit.backend.llsupport.asmmemmgr import MachineDataBlockWrapper from pypy.jit.backend.model import CompiledLoopToken from pypy.rpython.lltypesystem import lltype, rffi, llmemory -from pypy.jit.metainterp.resoperation import rop +from pypy.jit.metainterp.resoperation import rop, ResOperation from pypy.jit.metainterp.history import (INT, REF, FLOAT) from pypy.jit.backend.x86.support import values_array from pypy.rlib.debug import (debug_print, debug_start, debug_stop, have_debug_prints) from pypy.rlib import rgc from pypy.rpython.annlowlevel import llhelper -from pypy.rlib.objectmodel import we_are_translated +from pypy.rlib.objectmodel import we_are_translated, specialize from pypy.rpython.lltypesystem.lloperation import llop from pypy.jit.backend.ppc.locations import StackLocation, get_spp_offset from pypy.rlib.jit import AsmInfo +from pypy.rlib.objectmodel import compute_unique_id memcpy_fn = rffi.llexternal('memcpy', [llmemory.Address, llmemory.Address, rffi.SIZE_T], lltype.Void, @@ -475,6 +477,55 @@ debug_print(prefix + ':' + str(struct.i)) debug_stop('jit-backend-counts') +# XXX: merge with x86 +def _register_counter(self, tp, number, token): +# YYY very minor leak -- we need the counters to stay alive +# forever, just because we want to report them at the end +# of the process +struct = lltype.malloc(DEBUG_COUNTER, flavor='raw', + track_allocation=False) +struct.i = 0 +struct.type = tp +if tp == 'b' or tp == 'e': +struct.number = number +else: +assert token +struct.number = compute_unique_id(token) +self.loop_run_counters.append(struct) +return struct + +def _append_debugging_code(self, operations, tp, number, token): +counter = self._register_counter(tp, number, token) +c_adr = ConstInt(rffi.cast(lltype.Signed, counter)) +box = BoxInt() +box2 = BoxInt() +ops = [ResOperation(rop.GETFIELD_RAW, [c_adr], +box, descr=self.debug_counter_descr), + ResOperation(rop.INT_ADD, [box, ConstInt(1)], box2), + ResOperation(rop.SETFIELD_RAW, [c_adr, box2], +None, descr=self.debug_counter_descr)] +operations.extend(ops) + +@specialize.argtype(1) +def _inject_debugging_code(self, looptoken, operations, tp, number): +if self._debug: +# before doing anything, let's increase a counter +s = 0 +for op in operations: +s += op.getopnum() +looptoken._arm_debug_checksum = s + +newoperations = [] +self._append_debugging_code(newoperations, tp, number, +None) +for op in operations: +newoperations.append(op) +if op.getopnum() == rop.LABEL: +self._append_debugging_code(newoperations, 'l', number, +op.getdescr()) +operations = newoperations +return operations + @staticmethod def _release_gil_shadowstack(): before = rffi.aroundstate.before @@ -508,6 +559,10 @@ assert len(set(inputargs)) == len(inputargs) operations = self.setup(looptoken, operations) + +if log: +operations = self._inject_debugging_code(looptoken, operations, + 'e', looptoken.number) self.startpos = self.mc.currpos() regalloc = Regalloc(assembler=self, frame_manager=PPCFrameManager()) @@ -541,10 +596,11 @@ looptoken._ppc_func_addr = fdescr self.process_pending_guards(loop_start) -if not we_are_translated(): -print 'Loop', inputargs, operations -self.mc._dump_trace(loop_start, 'loop_%s.asm' % self.cpu.total_compiled_loops) -print 'Done assembling loop with token %r' % looptoken + +if log and not we_are_translated(): +self.mc._dump_trace(real_start, +'loop_%s.asm' % self.cpu.total_compiled_loops) + ops_offset = self.mc.ops_offset
[pypy-commit] pypy ppc-jit-backend: kill outcommented lines
Author: hager sven.ha...@uni-duesseldorf.de Branch: ppc-jit-backend Changeset: r53116:e1151080d3a0 Date: 2012-03-02 07:49 -0800 http://bitbucket.org/pypy/pypy/changeset/e1151080d3a0/ Log:kill outcommented lines diff --git a/pypy/jit/backend/ppc/ppc_assembler.py b/pypy/jit/backend/ppc/ppc_assembler.py --- a/pypy/jit/backend/ppc/ppc_assembler.py +++ b/pypy/jit/backend/ppc/ppc_assembler.py @@ -660,10 +660,6 @@ self.cpu.total_compiled_bridges) self._patch_sp_offset(sp_patch_location, rawstart) -#if not we_are_translated(): -#print 'Loop', inputargs, operations -#self.mc._dump_trace(rawstart, 'bridge_%s.asm' % self.cpu.total_compiled_loops) -#print 'Done assembling bridge with token %r' % looptoken ops_offset = self.mc.ops_offset self._teardown() ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy pytest: testrunner: also generate junitxml for each test driver instance
Author: Ronny Pfannschmidt ronny.pfannschm...@gmx.de Branch: pytest Changeset: r53118:017c3d40ee44 Date: 2012-03-02 17:08 +0100 http://bitbucket.org/pypy/pypy/changeset/017c3d40ee44/ Log:testrunner: also generate junitxml for each test driver instance this is meant to give stdout/err later for use in the buildbot diff --git a/testrunner/runner.py b/testrunner/runner.py --- a/testrunner/runner.py +++ b/testrunner/runner.py @@ -107,7 +107,10 @@ do_dry_run=False, timeout=None, _win32=(sys.platform=='win32')): args = interp + test_driver -args += ['-p', 'resultlog', '--resultlog=%s' % logfname, test] +args += ['-p', 'resultlog', + '--resultlog=%s' % logfname, + '--junitxml=%s.junit' % logfname, + test] args = map(str, args) interp0 = args[0] diff --git a/testrunner/test/test_runner.py b/testrunner/test/test_runner.py --- a/testrunner/test/test_runner.py +++ b/testrunner/test/test_runner.py @@ -119,6 +119,8 @@ 'driver', 'darg', '-p', 'resultlog', '--resultlog=LOGFILE', +'--junitxml=LOGFILE.junit', + 'test_one'] assert self.called == (expected, '/wd', 'out', 'secs') @@ -136,8 +138,9 @@ 'driver', 'darg', '-p', 'resultlog', '--resultlog=LOGFILE', +'--junitxml=LOGFILE.junit', 'test_one'] - +assert self.called[0] == expected assert self.called == (expected, '/wd', 'out', 'secs') assert res == 0 ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy ppc-jit-backend: add test from ARM backend
Author: hager sven.ha...@uni-duesseldorf.de Branch: ppc-jit-backend Changeset: r53119:9028367e2e13 Date: 2012-03-02 08:10 -0800 http://bitbucket.org/pypy/pypy/changeset/9028367e2e13/ Log:add test from ARM backend diff --git a/pypy/jit/backend/test/runner_test.py b/pypy/jit/backend/test/runner_test.py --- a/pypy/jit/backend/test/runner_test.py +++ b/pypy/jit/backend/test/runner_test.py @@ -714,6 +714,27 @@ descr=calldescr) assert res.getfloat() == 4.0 +def test_call_box_func(self): +def a(a1, a2): +return a1 + a2 +def b(b1, b2): +return b1 * b2 + +arg1 = 40 +arg2 = 2 +for f in [a, b]: +TP = lltype.Signed +FPTR = self.Ptr(self.FuncType([TP, TP], TP)) +func_ptr = llhelper(FPTR, f) +FUNC = deref(FPTR) +funcconst = self.get_funcbox(self.cpu, func_ptr) +funcbox = funcconst.clonebox() +calldescr = self.cpu.calldescrof(FUNC, FUNC.ARGS, FUNC.RESULT, +EffectInfo.MOST_GENERAL) +res = self.execute_operation(rop.CALL, + [funcbox, BoxInt(arg1), BoxInt(arg2)], + 'int', descr=calldescr) +assert res.getint() == f(arg1, arg2) def test_field_basic(self): t_box, T_box = self.alloc_instance(self.T) ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] Notification: lang-js
You have received a notification from Rafael Caricio. Hi, I forked lang-js. My fork is at https://bitbucket.org/rjcf/lang-js. -- Disable notifications at https://bitbucket.org/account/notifications/ ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] Notification: pypy-llvm
You have received a notification from Manuel Jacob. Hi, I forked pypy. My fork is at https://bitbucket.org/mjacob/pypy-llvm. -- Disable notifications at https://bitbucket.org/account/notifications/ ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy continulet-jit-2: hg merge default
Author: Armin Rigo ar...@tunes.org Branch: continulet-jit-2 Changeset: r53120:bb90c26d0cd1 Date: 2012-03-02 16:02 +0100 http://bitbucket.org/pypy/pypy/changeset/bb90c26d0cd1/ Log:hg merge default diff --git a/pypy/jit/metainterp/blackhole.py b/pypy/jit/metainterp/blackhole.py --- a/pypy/jit/metainterp/blackhole.py +++ b/pypy/jit/metainterp/blackhole.py @@ -1379,7 +1379,8 @@ elif opnum == rop.GUARD_NO_OVERFLOW: # Produced by int_xxx_ovf(). The pc is just after the opcode. # We get here because it did not used to overflow, but now it does. -return get_llexception(self.cpu, OverflowError()) +if not dont_change_position: +return get_llexception(self.cpu, OverflowError()) # elif opnum == rop.GUARD_OVERFLOW: # Produced by int_xxx_ovf(). The pc is just after the opcode. diff --git a/pypy/jit/metainterp/pyjitpl.py b/pypy/jit/metainterp/pyjitpl.py --- a/pypy/jit/metainterp/pyjitpl.py +++ b/pypy/jit/metainterp/pyjitpl.py @@ -2064,11 +2064,12 @@ pass # XXX we want to do something special in resume descr, # but not now elif opnum == rop.GUARD_NO_OVERFLOW: # an overflow now detected -self.execute_raised(OverflowError(), constant=True) -try: -self.finishframe_exception() -except ChangeFrame: -pass +if not dont_change_position: +self.execute_raised(OverflowError(), constant=True) +try: +self.finishframe_exception() +except ChangeFrame: +pass elif opnum == rop.GUARD_OVERFLOW: # no longer overflowing self.clear_exception() else: diff --git a/pypy/jit/metainterp/test/test_ajit.py b/pypy/jit/metainterp/test/test_ajit.py --- a/pypy/jit/metainterp/test/test_ajit.py +++ b/pypy/jit/metainterp/test/test_ajit.py @@ -288,10 +288,10 @@ if y4 == 0: x1, x2 = x2, x1 return res +res = self.meta_interp(f, [6, sys.maxint, 32, 48]) +assert res == f(6, sys.maxint, 32, 48) res = self.meta_interp(f, [sys.maxint, 6, 32, 48]) assert res == f(sys.maxint, 6, 32, 48) -res = self.meta_interp(f, [6, sys.maxint, 32, 48]) -assert res == f(6, sys.maxint, 32, 48) def test_loop_invariant_intbox(self): diff --git a/pypy/jit/metainterp/test/test_compile.py b/pypy/jit/metainterp/test/test_compile.py --- a/pypy/jit/metainterp/test/test_compile.py +++ b/pypy/jit/metainterp/test/test_compile.py @@ -14,7 +14,7 @@ ts = typesystem.llhelper def __init__(self): self.seen = [] -def compile_loop(self, inputargs, operations, token, name=''): +def compile_loop(self, inputargs, operations, token, log=True, name=''): self.seen.append((inputargs, operations, token)) class FakeLogger(object): diff --git a/pypy/jit/metainterp/warmspot.py b/pypy/jit/metainterp/warmspot.py --- a/pypy/jit/metainterp/warmspot.py +++ b/pypy/jit/metainterp/warmspot.py @@ -100,7 +100,7 @@ if not kwds.get('translate_support_code', False): warmrunnerdesc.metainterp_sd.profiler.finish() warmrunnerdesc.metainterp_sd.cpu.finish_once() -print '~~~ return value:', res +print '~~~ return value:', repr(res) while repeat 1: print '~' * 79 res1 = interp.eval_graph(graph, args) diff --git a/pypy/module/_md5/test/test_md5.py b/pypy/module/_md5/test/test_md5.py --- a/pypy/module/_md5/test/test_md5.py +++ b/pypy/module/_md5/test/test_md5.py @@ -28,7 +28,7 @@ assert self.md5.digest_size == 16 #assert self.md5.digestsize == 16-- not on CPython assert self.md5.md5().digest_size == 16 -if sys.version = (2, 5): +if sys.version_info = (2, 5): assert self.md5.blocksize == 1 assert self.md5.md5().digestsize == 16 diff --git a/pypy/module/array/interp_array.py b/pypy/module/array/interp_array.py --- a/pypy/module/array/interp_array.py +++ b/pypy/module/array/interp_array.py @@ -11,6 +11,7 @@ from pypy.objspace.std.register_all import register_all from pypy.rlib.rarithmetic import ovfcheck from pypy.rlib.unroll import unrolling_iterable +from pypy.rlib.objectmodel import specialize from pypy.rpython.lltypesystem import lltype, rffi @@ -159,13 +160,15 @@ def make_array(mytype): +W_ArrayBase = globals()['W_ArrayBase'] + class W_Array(W_ArrayBase): itemsize = mytype.bytes typecode = mytype.typecode @staticmethod def register(typeorder): -typeorder[W_Array] = [] +typeorder[W_Array] = [(W_ArrayBase, None)] def __init__(self, space): self.space = space @@ -583,30 +586,28 @@ raise OperationError(space.w_ValueError, space.wrap(msg)) # Compare methods +
[pypy-commit] pypy continulet-jit-2: Fix.
Author: Armin Rigo ar...@tunes.org Branch: continulet-jit-2 Changeset: r53121:3436f7e6b821 Date: 2012-03-02 15:42 + http://bitbucket.org/pypy/pypy/changeset/3436f7e6b821/ Log:Fix. diff --git a/pypy/jit/backend/x86/assembler.py b/pypy/jit/backend/x86/assembler.py --- a/pypy/jit/backend/x86/assembler.py +++ b/pypy/jit/backend/x86/assembler.py @@ -2282,8 +2282,7 @@ use_words = (2 + max(asmgcroot.INDEX_OF_EBP, asmgcroot.FRAME_PTR) + 1) pos = self._regalloc.fm.reserve_location_in_frame(use_words) -css = get_ebp_ofs(pos + use_words - 1) - # +css = get_ebp_ofs(pos) self._regalloc.close_stack_struct = css # The location where the future CALL will put its return address # will be [ESP-WORD]. But we can't use that as the next frame's ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy continulet-jit-2: Turn this magic constant 2 into a CONSTANT.
Author: Armin Rigo ar...@tunes.org Branch: continulet-jit-2 Changeset: r53122:4d76aae321b7 Date: 2012-03-02 16:46 +0100 http://bitbucket.org/pypy/pypy/changeset/4d76aae321b7/ Log:Turn this magic constant 2 into a CONSTANT. diff --git a/pypy/jit/backend/x86/arch.py b/pypy/jit/backend/x86/arch.py --- a/pypy/jit/backend/x86/arch.py +++ b/pypy/jit/backend/x86/arch.py @@ -37,6 +37,7 @@ # order as the one in the comments above); but whereas the real stack would # have the spilled values stored in (ebp-20), (ebp-24), etc., the off-stack # has them stored in (ebp+8), (ebp+12), etc. +OFFSTACK_START_AT_WORD = 2 # # In stacklet mode, the real frame contains always just OFFSTACK_REAL_FRAME # words reserved for temporary usage like call arguments. To maintain diff --git a/pypy/jit/backend/x86/regalloc.py b/pypy/jit/backend/x86/regalloc.py --- a/pypy/jit/backend/x86/regalloc.py +++ b/pypy/jit/backend/x86/regalloc.py @@ -24,6 +24,7 @@ from pypy.jit.backend.x86.arch import WORD, FRAME_FIXED_SIZE from pypy.jit.backend.x86.arch import IS_X86_32, IS_X86_64, MY_COPY_OF_REGS from pypy.jit.backend.x86.arch import OFFSTACK_REAL_FRAME +from pypy.jit.backend.x86.arch import OFFSTACK_START_AT_WORD from pypy.rlib.rarithmetic import r_longlong class X86RegisterManager(RegisterManager): @@ -1550,7 +1551,7 @@ def get_ebp_ofs(position): # Argument is a frame position (0, 1, 2...). # Returns (ebp+8), (ebp+12), (ebp+16)... -return WORD * (2 + position) +return WORD * (OFFSTACK_START_AT_WORD + position) def _valid_addressing_size(size): return size == 1 or size == 2 or size == 4 or size == 8 ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy continulet-jit-2: Fix.
Author: Armin Rigo ar...@tunes.org Branch: continulet-jit-2 Changeset: r53123:4d38fc264f1e Date: 2012-03-02 16:57 +0100 http://bitbucket.org/pypy/pypy/changeset/4d38fc264f1e/ Log:Fix. diff --git a/pypy/jit/backend/x86/assembler.py b/pypy/jit/backend/x86/assembler.py --- a/pypy/jit/backend/x86/assembler.py +++ b/pypy/jit/backend/x86/assembler.py @@ -514,7 +514,7 @@ operations, self.current_clt.allgcrefs) -frame_size_pos = self._enter_bridge_code() +frame_size_pos = self._enter_bridge_code(regalloc) (frame_depth #, param_depth ) = self._assemble(regalloc, operations) codeendpos = self.mc.get_relative_pos() @@ -725,15 +725,15 @@ self.mc.LEA32_rb(esp.value, 0) return self.mc.get_relative_pos() - 4 -def _enter_bridge_code(self): +def _enter_bridge_code(self, regalloc): # XXX XXX far too heavy saving and restoring j = 0 if self.cpu.supports_floats: -for reg in self._regalloc.xrm.save_around_call_regs: +for reg in regalloc.xrm.save_around_call_regs: self.mc.MOVSD_sx(j, reg.value) j += 8 # -save_regs = self._regalloc.rm.save_around_call_regs +save_regs = regalloc.rm.save_around_call_regs if IS_X86_32: assert len(save_regs) == 3 self.mc.MOV_sr(j, save_regs[0].value) @@ -768,7 +768,7 @@ # if self.cpu.supports_floats: j = 0 -for reg in self._regalloc.xrm.save_around_call_regs: +for reg in regalloc.xrm.save_around_call_regs: self.mc.MOVSD_xs(reg.value, j) j += 8 # ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Rework a bit the --help format, and split the JIT-related help
Author: Armin Rigo ar...@tunes.org Branch: Changeset: r53124:935c947b80cf Date: 2012-03-02 20:14 +0100 http://bitbucket.org/pypy/pypy/changeset/935c947b80cf/ Log:Rework a bit the --help format, and split the JIT-related help in its own subpage obtained from --jit help. diff --git a/pypy/jit/metainterp/optimizeopt/__init__.py b/pypy/jit/metainterp/optimizeopt/__init__.py --- a/pypy/jit/metainterp/optimizeopt/__init__.py +++ b/pypy/jit/metainterp/optimizeopt/__init__.py @@ -9,7 +9,7 @@ from pypy.jit.metainterp.optimizeopt.simplify import OptSimplify from pypy.jit.metainterp.optimizeopt.pure import OptPure from pypy.jit.metainterp.optimizeopt.earlyforce import OptEarlyForce -from pypy.rlib.jit import PARAMETERS +from pypy.rlib.jit import PARAMETERS, ENABLE_ALL_OPTS from pypy.rlib.unroll import unrolling_iterable from pypy.rlib.debug import debug_start, debug_stop, debug_print @@ -30,6 +30,9 @@ ALL_OPTS_LIST = [name for name, _ in ALL_OPTS] ALL_OPTS_NAMES = ':'.join([name for name, _ in ALL_OPTS]) +assert ENABLE_ALL_OPTS == ALL_OPTS_NAMES, ( +'please fix rlib/jit.py to say ENABLE_ALL_OPTS = %r' % (ALL_OPTS_NAMES,)) + def build_opt_chain(metainterp_sd, enable_opts): config = metainterp_sd.config optimizations = [] diff --git a/pypy/rlib/jit.py b/pypy/rlib/jit.py --- a/pypy/rlib/jit.py +++ b/pypy/rlib/jit.py @@ -392,6 +392,9 @@ class JitHintError(Exception): Inconsistency in the JIT hints. +ENABLE_ALL_OPTS = ( +'intbounds:rewrite:virtualize:string:earlyforce:pure:heap:ffi:unroll') + PARAMETER_DOCS = { 'threshold': 'number of times a loop has to run for it to become hot', 'function_threshold': 'number of times a function must run for it to become traced from start', @@ -402,7 +405,8 @@ 'retrace_limit': 'how many times we can try retracing before giving up', 'max_retrace_guards': 'number of extra guards a retrace can cause', 'max_unroll_loops': 'number of extra unrollings a loop can cause', -'enable_opts': 'optimizations to enable or all, INTERNAL USE ONLY' +'enable_opts': 'INTERNAL USE ONLY: optimizations to enable, or all = %s' % + ENABLE_ALL_OPTS, } PARAMETERS = {'threshold': 1039, # just above 1024, prime diff --git a/pypy/translator/goal/app_main.py b/pypy/translator/goal/app_main.py --- a/pypy/translator/goal/app_main.py +++ b/pypy/translator/goal/app_main.py @@ -130,30 +130,46 @@ sys.executable,) print __doc__.rstrip() if 'pypyjit' in sys.builtin_module_names: -_print_jit_help() +print --jit OPTIONS advanced JIT options: try 'off' or 'help' print raise SystemExit def _print_jit_help(): -import pypyjit +try: +import pypyjit +except ImportError: +print sys.stderr, No jit support in %s % (sys.executable,) +return items = pypyjit.defaults.items() items.sort() +print 'Advanced JIT options: a comma-separated list of OPTION=VALUE:' for key, value in items: -prefix = ' --jit %s=N %s' % (key, ' '*(18-len(key))) +print +print ' %s=N' % (key,) doc = '%s (default %s)' % (pypyjit.PARAMETER_DOCS[key], value) -while len(doc) 51: -i = doc[:51].rfind(' ') -print prefix + doc[:i] +while len(doc) 72: +i = doc[:74].rfind(' ') +if i 0: +i = doc.find(' ') +if i 0: +i = len(doc) +print '' + doc[:i] doc = doc[i+1:] -prefix = ' '*len(prefix) -print prefix + doc -print ' --jit off turn off the JIT' +print '' + doc +print +print ' off' +print 'turn off the JIT' +print ' help' +print 'print this page' def print_version(*args): print sys.stderr, Python, sys.version raise SystemExit def set_jit_option(options, jitparam, *args): +if jitparam == 'help': +_print_jit_help() +raise SystemExit if 'pypyjit' not in sys.builtin_module_names: print sys.stderr, (Warning: No jit support in %s % (sys.executable,)) ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy continulet-jit-2: Found the other place that depends on this constant.
Author: Armin Rigo ar...@tunes.org Branch: continulet-jit-2 Changeset: r53125:22efc5bf3868 Date: 2012-03-02 20:28 +0100 http://bitbucket.org/pypy/pypy/changeset/22efc5bf3868/ Log:Found the other place that depends on this constant. diff --git a/pypy/jit/backend/x86/assembler.py b/pypy/jit/backend/x86/assembler.py --- a/pypy/jit/backend/x86/assembler.py +++ b/pypy/jit/backend/x86/assembler.py @@ -14,7 +14,8 @@ from pypy.jit.backend.x86.arch import (FRAME_FIXED_SIZE, FORCE_INDEX_OFS, WORD, IS_X86_32, IS_X86_64, - OFFSTACK_REAL_FRAME) + OFFSTACK_REAL_FRAME, + OFFSTACK_START_AT_WORD) from pypy.jit.backend.x86.regloc import (eax, ecx, edx, ebx, esp, ebp, esi, edi, @@ -777,7 +778,7 @@ def _patch_stackadjust(self, adr_to_fix, allocated_depth): # patch the requested size in the call to malloc/realloc mc = codebuf.MachineCodeBlockWrapper() -words = FRAME_FIXED_SIZE + 1 + allocated_depth +words = FRAME_FIXED_SIZE-1 + OFFSTACK_START_AT_WORD + allocated_depth mc.writeimm32(words * WORD) mc.copy_to_raw_memory(adr_to_fix) return ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy continulet-jit-2: Yay. This is enough at least to have test_zrpy_gc -k AsmGcc pass.
Author: Armin Rigo ar...@tunes.org Branch: continulet-jit-2 Changeset: r53129:a852412187c3 Date: 2012-03-02 22:17 +0100 http://bitbucket.org/pypy/pypy/changeset/a852412187c3/ Log:Yay. This is enough at least to have test_zrpy_gc -k AsmGcc pass. diff --git a/pypy/jit/backend/llsupport/gc.py b/pypy/jit/backend/llsupport/gc.py --- a/pypy/jit/backend/llsupport/gc.py +++ b/pypy/jit/backend/llsupport/gc.py @@ -337,11 +337,18 @@ self._gcmap_deadentries += 1 item += asmgcroot.arrayitemsize -def get_basic_shape(self): +def get_basic_shape(self, return_addr_words_from_esp=0): # XXX: Should this code even really know about stack frame layout of # the JIT? +if return_addr_words_from_esp == 0: +retaddr = chr(self.LOC_EBP_PLUS | 4) # return addr: at WORD(%rbp) +else: +x = return_addr_words_from_esp * 4 +assert 0 x 128 +retaddr = chr(self.LOC_ESP_PLUS | x) +# if self.is_64_bit: -return [chr(self.LOC_EBP_PLUS | 4),# return addr: at 8(%rbp) +return [retaddr, chr(self.LOC_EBP_MINUS | 4),# saved %rbx: at -8(%rbp) chr(self.LOC_EBP_MINUS | 8),# saved %r12: at -16(%rbp) chr(self.LOC_EBP_MINUS | 12), # saved %r13: at -24(%rbp) @@ -350,7 +357,7 @@ chr(self.LOC_EBP_PLUS | 0),# saved %rbp: at(%rbp) chr(0)] else: -return [chr(self.LOC_EBP_PLUS | 4),# return addr: at 4(%ebp) +return [retaddr, chr(self.LOC_EBP_MINUS | 4),# saved %ebx: at -4(%ebp) chr(self.LOC_EBP_MINUS | 8),# saved %esi: at -8(%ebp) chr(self.LOC_EBP_MINUS | 12), # saved %edi: at -12(%ebp) @@ -523,7 +530,7 @@ def initialize(self): pass -def get_basic_shape(self): +def get_basic_shape(self, return_addr_words_from_esp=0): return [] def add_frame_offset(self, shape, offset): diff --git a/pypy/jit/backend/x86/regalloc.py b/pypy/jit/backend/x86/regalloc.py --- a/pypy/jit/backend/x86/regalloc.py +++ b/pypy/jit/backend/x86/regalloc.py @@ -1418,7 +1418,8 @@ self.force_spill_var(op.getarg(0)) def get_mark_gc_roots(self, gcrootmap, use_copy_area=False): -shape = gcrootmap.get_basic_shape() +orf = OFFSTACK_REAL_FRAME +shape = gcrootmap.get_basic_shape(return_addr_words_from_esp=orf) for v, val in self.fm.bindings.items(): if (isinstance(v, BoxPtr) and self.rm.stays_alive(v)): assert isinstance(val, StackLoc) ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: disable those prints for now
Author: Maciej Fijalkowski fij...@gmail.com Branch: Changeset: r53130:c7407123b4a0 Date: 2012-03-02 15:06 -0800 http://bitbucket.org/pypy/pypy/changeset/c7407123b4a0/ Log:disable those prints for now diff --git a/pypy/jit/metainterp/optimizeopt/virtualstate.py b/pypy/jit/metainterp/optimizeopt/virtualstate.py --- a/pypy/jit/metainterp/optimizeopt/virtualstate.py +++ b/pypy/jit/metainterp/optimizeopt/virtualstate.py @@ -681,13 +681,14 @@ self.synthetic[op] = True def debug_print(self, logops): -debug_start('jit-short-boxes') -for box, op in self.short_boxes.items(): -if op: -debug_print(logops.repr_of_arg(box) + ': ' + logops.repr_of_resop(op)) -else: -debug_print(logops.repr_of_arg(box) + ': None') -debug_stop('jit-short-boxes') +if 0: +debug_start('jit-short-boxes') +for box, op in self.short_boxes.items(): +if op: +debug_print(logops.repr_of_arg(box) + ': ' + logops.repr_of_resop(op)) +else: +debug_print(logops.repr_of_arg(box) + ': None') +debug_stop('jit-short-boxes') def operations(self): if not we_are_translated(): # For tests ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: disable more debug prints
Author: Maciej Fijalkowski fij...@gmail.com Branch: Changeset: r53131:08f324aa11f4 Date: 2012-03-02 15:11 -0800 http://bitbucket.org/pypy/pypy/changeset/08f324aa11f4/ Log:disable more debug prints diff --git a/pypy/jit/metainterp/optimizeopt/unroll.py b/pypy/jit/metainterp/optimizeopt/unroll.py --- a/pypy/jit/metainterp/optimizeopt/unroll.py +++ b/pypy/jit/metainterp/optimizeopt/unroll.py @@ -9,7 +9,6 @@ from pypy.jit.metainterp.inliner import Inliner from pypy.jit.metainterp.resoperation import rop, ResOperation from pypy.jit.metainterp.resume import Snapshot -from pypy.rlib.debug import debug_print import sys, os # FIXME: Introduce some VirtualOptimizer super class instead @@ -121,9 +120,9 @@ limit = self.optimizer.metainterp_sd.warmrunnerdesc.memory_manager.retrace_limit if cell_token.retraced_count limit: cell_token.retraced_count += 1 -debug_print('Retracing (%d/%d)' % (cell_token.retraced_count, limit)) +#debug_print('Retracing (%d/%d)' % (cell_token.retraced_count, limit)) else: -debug_print(Retrace count reached, jumping to preamble) +#debug_print(Retrace count reached, jumping to preamble) assert cell_token.target_tokens[0].virtual_state is None jumpop.setdescr(cell_token.target_tokens[0]) self.optimizer.send_extra_operation(jumpop) @@ -273,9 +272,9 @@ not newvalue.is_constant(): op = ResOperation(rop.SAME_AS, [op.result], newresult) self.optimizer._newoperations.append(op) -if self.optimizer.loop.logops: -debug_print(' Falling back to add extra: ' + - self.optimizer.loop.logops.repr_of_resop(op)) +#if self.optimizer.loop.logops: +#debug_print(' Falling back to add extra: ' + +# self.optimizer.loop.logops.repr_of_resop(op)) self.optimizer.flush() self.optimizer.emitting_dissabled = False @@ -341,8 +340,8 @@ if i == len(newoperations): while j len(jumpargs): a = jumpargs[j] -if self.optimizer.loop.logops: -debug_print('J: ' + self.optimizer.loop.logops.repr_of_arg(a)) +#if self.optimizer.loop.logops: +#debug_print('J: ' + self.optimizer.loop.logops.repr_of_arg(a)) self.import_box(a, inputargs, short_jumpargs, jumpargs) j += 1 else: @@ -353,11 +352,11 @@ if op.is_guard(): args = args + op.getfailargs() -if self.optimizer.loop.logops: -debug_print('OP: ' + self.optimizer.loop.logops.repr_of_resop(op)) +#if self.optimizer.loop.logops: +#debug_print('OP: ' + self.optimizer.loop.logops.repr_of_resop(op)) for a in args: -if self.optimizer.loop.logops: -debug_print('A: ' + self.optimizer.loop.logops.repr_of_arg(a)) +#if self.optimizer.loop.logops: +#debug_print('A: ' + self.optimizer.loop.logops.repr_of_arg(a)) self.import_box(a, inputargs, short_jumpargs, jumpargs) i += 1 newoperations = self.optimizer.get_newoperations() @@ -370,18 +369,18 @@ # that is compatible with the virtual state at the start of the loop modifier = VirtualStateAdder(self.optimizer) final_virtual_state = modifier.get_virtual_state(original_jumpargs) -debug_start('jit-log-virtualstate') -virtual_state.debug_print('Closed loop with ') +#debug_start('jit-log-virtualstate') +#virtual_state.debug_print('Closed loop with ') bad = {} if not virtual_state.generalization_of(final_virtual_state, bad): # We ended up with a virtual state that is not compatible # and we are thus unable to jump to the start of the loop -final_virtual_state.debug_print(Bad virtual state at end of loop, , -bad) -debug_stop('jit-log-virtualstate') +#final_virtual_state.debug_print(Bad virtual state at end of loop, , +#bad) +#debug_stop('jit-log-virtualstate') raise InvalidLoop -debug_stop('jit-log-virtualstate') +#debug_stop('jit-log-virtualstate') maxguards = self.optimizer.metainterp_sd.warmrunnerdesc.memory_manager.max_retrace_guards if self.optimizer.emitted_guards maxguards: @@ -444,9 +443,9 @@
[pypy-commit] Notification: pypy
You have received a notification from Ross Lagerwall. Hi, I forked pypy. My fork is at https://bitbucket.org/rosslagerwall/pypy. -- Disable notifications at https://bitbucket.org/account/notifications/ ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy numpy-record-dtypes: make string and unicode boxes instantiatable, but completely unusable
Author: Maciej Fijalkowski fij...@gmail.com Branch: numpy-record-dtypes Changeset: r53133:9b0ff4af758c Date: 2012-03-02 22:27 -0800 http://bitbucket.org/pypy/pypy/changeset/9b0ff4af758c/ Log:make string and unicode boxes instantiatable, but completely unusable diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py --- a/pypy/interpreter/baseobjspace.py +++ b/pypy/interpreter/baseobjspace.py @@ -1335,7 +1335,7 @@ if not self.is_true(self.isinstance(w_obj, self.w_str)): raise OperationError(self.w_TypeError, self.wrap('argument must be a string')) -return self.str_w(w_obj) +return self.str_w(w_obj) def unicode_w(self, w_obj): return w_obj.unicode_w(self) diff --git a/pypy/module/micronumpy/interp_boxes.py b/pypy/module/micronumpy/interp_boxes.py --- a/pypy/module/micronumpy/interp_boxes.py +++ b/pypy/module/micronumpy/interp_boxes.py @@ -4,7 +4,7 @@ from pypy.interpreter.typedef import TypeDef from pypy.objspace.std.floattype import float_typedef from pypy.objspace.std.stringtype import str_typedef -from pypy.objspace.std.unicodetype import unicode_typedef +from pypy.objspace.std.unicodetype import unicode_typedef, unicode_from_object from pypy.objspace.std.inttype import int_typedef from pypy.rlib.rarithmetic import LONG_BIT from pypy.tool.sourcetools import func_with_new_name @@ -242,15 +242,17 @@ arr.storage[i] = arg[i] return W_StringBox(arr, 0) + class W_UnicodeBox(W_CharacterBox): def descr__new__(space, w_subtype, w_arg): from pypy.module.micronumpy.interp_numarray import W_NDimArray from pypy.module.micronumpy.interp_dtype import new_unicode_dtype -arg = space.unicode_w(space.unicode(w_arg)) +arg = space.unicode_w(unicode_from_object(space, w_arg)) arr = W_NDimArray([1], new_unicode_dtype(space, len(arg))) -for i in range(len(arg)): -arr.setitem(i, arg[i]) +# XXX not this way, we need store +#for i in range(len(arg)): +#arr.storage[i] = arg[i] return W_UnicodeBox(arr, 0) W_GenericBox.typedef = TypeDef(generic, @@ -424,6 +426,8 @@ W_StringBox.typedef = TypeDef(string_, (str_typedef, W_CharacterBox.typedef), __module__ = numpypy, __new__ = interp2app(W_StringBox.descr__new__.im_func), +__eq__ = interp2app(W_StringBox.descr_eq), +__ne__ = interp2app(W_StringBox.descr_ne), ) W_UnicodeBox.typedef = TypeDef(unicode_, (unicode_typedef, W_CharacterBox.typedef), diff --git a/pypy/module/micronumpy/test/test_dtypes.py b/pypy/module/micronumpy/test/test_dtypes.py --- a/pypy/module/micronumpy/test/test_dtypes.py +++ b/pypy/module/micronumpy/test/test_dtypes.py @@ -525,11 +525,11 @@ def test_string_boxes(self): from _numpypy import str_ -assert str_(3) == '3' +assert isinstance(str_(3), str_) def test_unicode_boxes(self): -from _numpypy import str_ -assert str_(3) == '3' +from _numpypy import unicode_ +assert isinstance(unicode_(3), unicode) class AppTestRecordDtypes(BaseNumpyAppTest): def test_create(self): ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy numpy-record-dtypes: fix the merge
Author: Maciej Fijalkowski fij...@gmail.com Branch: numpy-record-dtypes Changeset: r53134:6dcf1d779df6 Date: 2012-03-02 22:54 -0800 http://bitbucket.org/pypy/pypy/changeset/6dcf1d779df6/ Log:fix the merge diff --git a/pypy/module/micronumpy/interp_support.py b/pypy/module/micronumpy/interp_support.py --- a/pypy/module/micronumpy/interp_support.py +++ b/pypy/module/micronumpy/interp_support.py @@ -74,21 +74,24 @@ raise OperationError(space.w_ValueError, space.wrap( string is smaller than requested size)) -a = W_NDimArray(count, [count], dtype=dtype) -fromstring_loop(a, count, dtype, itemsize, s) +a = W_NDimArray([count], dtype=dtype) +fromstring_loop(a, dtype, itemsize, s) return space.wrap(a) -fromstring_driver = jit.JitDriver(greens=[], reds=['count', 'i', 'itemsize', - 'dtype', 's', 'a']) +fromstring_driver = jit.JitDriver(greens=[], reds=['i', 'itemsize', + 'dtype', 'ai', 's', 'a']) -def fromstring_loop(a, count, dtype, itemsize, s): +def fromstring_loop(a, dtype, itemsize, s): i = 0 -while i count: -fromstring_driver.jit_merge_point(a=a, count=count, dtype=dtype, - itemsize=itemsize, s=s, i=i) +ai = a.create_iter() +while not ai.done(): +fromstring_driver.jit_merge_point(a=a, dtype=dtype, + itemsize=itemsize, s=s, i=i, + ai=ai) val = dtype.itemtype.runpack_str(s[i*itemsize:i*itemsize + itemsize]) -a.dtype.setitem(a.storage, i, val) -i += itemsize +a.dtype.setitem(a, ai.offset, val) +ai = ai.next(1) +i += 1 @unwrap_spec(s=str, count=int, sep=str) def fromstring(space, s, w_dtype=None, count=-1, sep=''): ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy numpy-record-dtypes: implement more stuff on fake objspace
Author: Maciej Fijalkowski fij...@gmail.com Branch: numpy-record-dtypes Changeset: r53135:9b1cb0354751 Date: 2012-03-02 23:05 -0800 http://bitbucket.org/pypy/pypy/changeset/9b1cb0354751/ Log:implement more stuff on fake objspace diff --git a/pypy/objspace/fake/objspace.py b/pypy/objspace/fake/objspace.py --- a/pypy/objspace/fake/objspace.py +++ b/pypy/objspace/fake/objspace.py @@ -207,6 +207,11 @@ is_arguments(args) return w_some_obj() +def get_and_call_function(space, w_descr, w_obj, *args_w): +args = argument.Arguments(space, list(args_w)) +w_impl = space.get(w_descr, w_obj) +return space.call_args(w_impl, args) + def gettypefor(self, cls): return self.gettypeobject(cls.typedef) ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy reflex-support: another stab at getting the bootstrapping right ...
Author: Wim Lavrijsen wlavrij...@lbl.gov Branch: reflex-support Changeset: r53136:fad46404508b Date: 2012-03-02 23:00 -0800 http://bitbucket.org/pypy/pypy/changeset/fad46404508b/ Log:another stab at getting the bootstrapping right ... diff --git a/pypy/module/cppyy/interp_cppyy.py b/pypy/module/cppyy/interp_cppyy.py --- a/pypy/module/cppyy/interp_cppyy.py +++ b/pypy/module/cppyy/interp_cppyy.py @@ -51,12 +51,6 @@ r_cppscope = W_CPPType(space, final_name, cppscope) state.r_cppscope_cache[name] = r_cppscope -# prevent getting reflection info that may be linked in through the -# back-end libs or that may be available through an auto-loader, during -# translation time (else it will get translated, too) -if space.config.translating and not objectmodel.we_are_translated(): -return r_cppscope - r_cppscope._find_methods() r_cppscope._find_data_members() return r_cppscope @@ -432,8 +426,6 @@ self.data_members[data_member_name] = data_member def update(self): -if self.space.config.translating and not objectmodel.we_are_translated(): - return cpptype self._find_methods() self._find_data_members() diff --git a/pypy/module/cppyy/pythonify.py b/pypy/module/cppyy/pythonify.py --- a/pypy/module/cppyy/pythonify.py +++ b/pypy/module/cppyy/pythonify.py @@ -92,11 +92,22 @@ def make_cppnamespace(namespace_name, cppns, build_in_full=True): -nsdct = {_cpp_proxy : cppns } +# build up a representation of a C++ namespace (namespaces are classes) # create a meta class to allow properties (for static data write access) metans = type(CppyyNamespaceMeta)(namespace_name+'_meta', (CppyyNamespaceMeta,), {}) +if cppns: +nsdct = {_cpp_proxy : cppns } +else: +nsdct = dict() +def cpp_proxy_loader(cls): +cpp_proxy = cppyy._type_byname(cls.__name__ != '::' and cls.__name__ or '') +del cls.__class__._cpp_proxy +cls._cpp_proxy = cpp_proxy +return cpp_proxy +metans._cpp_proxy = property(cpp_proxy_loader) + if build_in_full: # if False, rely on lazy build-up # insert static methods into the namespace dictionary for func_name in cppns.get_method_names(): @@ -207,8 +218,6 @@ if isinstance(scope, CppyyNamespaceMeta): global _loaded_dictionaries_isdirty if _loaded_dictionaries_isdirty: # TODO: this should be per namespace -if not scope._cpp_proxy: -scope._cpp_proxy = cppyy._type_byname(scope.__name__) scope._cpp_proxy.update() # TODO: this is currently quadratic _loaded_dictionaries_isdirty = False @@ -295,7 +304,7 @@ _loaded_dictionaries = {} -_loaded_dictionaries_isdirty = False# should be per namespace +_loaded_dictionaries_isdirty = True # should be per namespace def load_reflection_info(name): try: return _loaded_dictionaries[name] @@ -307,10 +316,10 @@ return dct -# user interface objects (note the two-step: creation of global functions may -# cause the creation of classes in the global namespace, so gbl must exist at -# that point to cache them) -gbl = make_cppnamespace(::, cppyy._type_byname(), False) # global C++ namespace +# user interface objects (note the two-step of not calling type_byname here: +# creation of global functions may cause the creation of classes in the global +# namespace, so gbl must exist at that point to cache them) +gbl = make_cppnamespace(::, None, False) # global C++ namespace -# mostly for the benefit of CINT, which treats std as special -gbl.std = make_cppnamespace(std, cppyy._type_byname(std), False) +# mostly for the benefit of the CINT backend, which treats std as special +gbl.std = make_cppnamespace(std, None, False) ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy reflex-support: merge default into branch
Author: Wim Lavrijsen wlavrij...@lbl.gov Branch: reflex-support Changeset: r53137:3759abe3a35d Date: 2012-03-02 23:00 -0800 http://bitbucket.org/pypy/pypy/changeset/3759abe3a35d/ Log:merge default into branch diff --git a/pypy/interpreter/test/test_typedef.py b/pypy/interpreter/test/test_typedef.py --- a/pypy/interpreter/test/test_typedef.py +++ b/pypy/interpreter/test/test_typedef.py @@ -304,6 +304,42 @@ assert_method(w_o1, c, True) assert_method(w_o2, c, False) +def test_total_ordering(self): +class W_SomeType(Wrappable): +def __init__(self, space, x): +self.space = space +self.x = x + +def descr__lt(self, w_other): +assert isinstance(w_other, W_SomeType) +return self.space.wrap(self.x w_other.x) + +def descr__eq(self, w_other): +assert isinstance(w_other, W_SomeType) +return self.space.wrap(self.x == w_other.x) + +W_SomeType.typedef = typedef.TypeDef( +'some_type', +__total_ordering__ = 'auto', +__lt__ = interp2app(W_SomeType.descr__lt), +__eq__ = interp2app(W_SomeType.descr__eq), +) +space = self.space +w_b = space.wrap(W_SomeType(space, 2)) +w_c = space.wrap(W_SomeType(space, 2)) +w_a = space.wrap(W_SomeType(space, 1)) +# explicitly defined +assert space.is_true(space.lt(w_a, w_b)) +assert not space.is_true(space.eq(w_a, w_b)) +assert space.is_true(space.eq(w_b, w_c)) +# automatically defined +assert space.is_true(space.le(w_a, w_b)) +assert space.is_true(space.le(w_b, w_c)) +assert space.is_true(space.gt(w_b, w_a)) +assert space.is_true(space.ge(w_b, w_a)) +assert space.is_true(space.ge(w_b, w_c)) +assert space.is_true(space.ne(w_a, w_b)) +assert not space.is_true(space.ne(w_b, w_c)) class AppTestTypeDef: diff --git a/pypy/interpreter/typedef.py b/pypy/interpreter/typedef.py --- a/pypy/interpreter/typedef.py +++ b/pypy/interpreter/typedef.py @@ -12,7 +12,7 @@ from pypy.rlib.jit import promote class TypeDef: -def __init__(self, __name, __base=None, **rawdict): +def __init__(self, __name, __base=None, __total_ordering__=None, **rawdict): NOT_RPYTHON: initialization-time only self.name = __name if __base is None: @@ -34,6 +34,9 @@ # xxx used by faking self.fakedcpytype = None self.add_entries(**rawdict) +assert __total_ordering__ in (None, 'auto'), Unknown value for __total_ordering +if __total_ordering__ == 'auto': +self.auto_total_ordering() def add_entries(self, **rawdict): # xxx fix the names of the methods to match what app-level expects @@ -41,7 +44,15 @@ if isinstance(value, (interp2app, GetSetProperty)): value.name = key self.rawdict.update(rawdict) - + +def auto_total_ordering(self): +assert '__lt__' in self.rawdict, __total_ordering='auto' requires __lt__ +assert '__eq__' in self.rawdict, __total_ordering='auto' requires __eq__ +self.add_entries(__le__ = auto__le__, + __gt__ = auto__gt__, + __ge__ = auto__ge__, + __ne__ = auto__ne__) + def _freeze_(self): # hint for the annotator: track individual constant instances of TypeDef return True @@ -50,6 +61,26 @@ return %s name=%r % (self.__class__.__name__, self.name) +# generic special cmp methods defined on top of __lt__ and __eq__, used by +# automatic total ordering + +@interp2app +def auto__le__(space, w_self, w_other): +return space.not_(space.lt(w_other, w_self)) + +@interp2app +def auto__gt__(space, w_self, w_other): +return space.lt(w_other, w_self) + +@interp2app +def auto__ge__(space, w_self, w_other): +return space.not_(space.lt(w_self, w_other)) + +@interp2app +def auto__ne__(space, w_self, w_other): +return space.not_(space.eq(w_self, w_other)) + + # # Hash support diff --git a/pypy/jit/backend/llsupport/gc.py b/pypy/jit/backend/llsupport/gc.py --- a/pypy/jit/backend/llsupport/gc.py +++ b/pypy/jit/backend/llsupport/gc.py @@ -208,6 +208,7 @@ This is the class supporting --gcrootfinder=asmgcc. is_shadow_stack = False +is_64_bit = (WORD == 8) LOC_REG = 0 LOC_ESP_PLUS = 1 @@ -336,17 +337,17 @@ self._gcmap_deadentries += 1 item += asmgcroot.arrayitemsize -def get_basic_shape(self, is_64_bit=False): +def get_basic_shape(self): # XXX: Should this code even really know about stack frame layout of # the JIT? -if is_64_bit: -return [chr(self.LOC_EBP_PLUS | 8), -