[pypy-svn] pypy arm-backend-2: merge default
bivab
commits-noreply at bitbucket.org
Fri Feb 25 12:25:01 CET 2011
Author: David Schneider <david.schneider at picle.org>
Branch: arm-backend-2
Changeset: r42277:18ea8abbee36
Date: 2011-02-24 15:32 +0100
http://bitbucket.org/pypy/pypy/changeset/18ea8abbee36/
Log: merge default
diff --git a/pypy/module/_rawffi/error.py b/pypy/module/_rawffi/error.py
deleted file mode 100644
--- a/pypy/module/_rawffi/error.py
+++ /dev/null
@@ -1,2 +0,0 @@
-class SegfaultException(Exception):
- pass
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
@@ -507,6 +507,8 @@
success = run_toplevel(run_it)
elif run_module:
# handle the "-m" command
+ # '' on sys.path is required also here
+ sys.path.insert(0, '')
import runpy
success = run_toplevel(runpy._run_module_as_main, sys.argv[0])
elif run_stdin:
diff --git a/pypy/translator/goal/test2/test_app_main.py b/pypy/translator/goal/test2/test_app_main.py
--- a/pypy/translator/goal/test2/test_app_main.py
+++ b/pypy/translator/goal/test2/test_app_main.py
@@ -435,6 +435,8 @@
child.expect('True')
child.sendline('"pypy.translator.goal.test2.mymodule" in sys.modules')
child.expect('False')
+ child.sendline('sys.path[0]')
+ child.expect("''")
def test_option_i_noexit(self):
child = self.spawn(['-i', '-c', 'import sys; sys.exit(1)'])
diff --git a/pypy/module/_socket/app_socket.py b/pypy/module/_socket/app_socket.py
deleted file mode 100644
--- a/pypy/module/_socket/app_socket.py
+++ /dev/null
@@ -1,15 +0,0 @@
-"""Implementation module for socket operations.
-
-See the socket module for documentation."""
-
-class error(IOError):
- pass
-
-class herror(error):
- pass
-
-class gaierror(error):
- pass
-
-class timeout(error):
- pass
diff --git a/pypy/jit/codewriter/jtransform.py b/pypy/jit/codewriter/jtransform.py
--- a/pypy/jit/codewriter/jtransform.py
+++ b/pypy/jit/codewriter/jtransform.py
@@ -834,8 +834,10 @@
op2 = self._handle_oopspec_call(op1, args,
EffectInfo.OS_LLONG_%s,
EffectInfo.EF_PURE)
+ if %r == "TO_INT":
+ assert op2.result.concretetype == lltype.Signed
return op2
- ''' % (_op, _oopspec.lower(), _oopspec)).compile()
+ ''' % (_op, _oopspec.lower(), _oopspec, _oopspec)).compile()
def _normalize(self, oplist):
if isinstance(oplist, SpaceOperation):
@@ -873,14 +875,24 @@
args = op.args
if fromll:
opname = 'truncate_longlong_to_int'
+ RESULT = lltype.Signed
else:
from pypy.rpython.lltypesystem import rffi
if rffi.cast(op.args[0].concretetype, -1) < 0:
opname = 'cast_int_to_longlong'
else:
opname = 'cast_uint_to_longlong'
- op1 = SpaceOperation(opname, args, op.result)
- return self.rewrite_operation(op1)
+ RESULT = lltype.SignedLongLong
+ v = varoftype(RESULT)
+ op1 = SpaceOperation(opname, args, v)
+ op2 = self.rewrite_operation(op1)
+ #
+ # force a renaming to put the correct result in place, even though
+ # it might be slightly mistyped (e.g. Signed versus Unsigned)
+ assert op2.result is v
+ op2.result = op.result
+ #
+ return op2
# ----------
# Renames, from the _old opname to the _new one.
diff --git a/pypy/module/thread/app_thread.py b/pypy/module/thread/app_thread.py
deleted file mode 100644
--- a/pypy/module/thread/app_thread.py
+++ /dev/null
@@ -1,7 +0,0 @@
-class error(Exception):
- pass
-
-def exit():
- """This is synonymous to ``raise SystemExit''. It will cause the current
-thread to exit silently unless the exception is caught."""
- raise SystemExit
diff --git a/pypy/module/mmap/app_mmap.py b/pypy/module/mmap/app_mmap.py
deleted file mode 100644
--- a/pypy/module/mmap/app_mmap.py
+++ /dev/null
@@ -1,6 +0,0 @@
-ACCESS_READ = 1
-ACCESS_WRITE = 2
-ACCESS_COPY = 3
-
-class error(EnvironmentError):
- pass
diff --git a/pypy/module/pypyjit/test/test_pypy_c_new.py b/pypy/module/pypyjit/test/test_pypy_c_new.py
deleted file mode 100644
--- a/pypy/module/pypyjit/test/test_pypy_c_new.py
+++ /dev/null
@@ -1,99 +0,0 @@
-
-import py, sys, re
-py.test.skip("in-progress?")
-import subprocess
-import disassembler
-from pypy.tool.udir import udir
-from pypy.tool import logparser
-
-class Trace(object):
- pass
-
-class BaseTestPyPyC(object):
- def setup_class(cls):
- cls.tmpdir = udir.join('test-pypy-jit')
- cls.tmpdir.ensure(dir=True)
-
- def setup_method(self, meth):
- self.filepath = self.tmpdir.join(meth.im_func.func_name + '.py')
-
- def parse_out(self, out):
- out = out.strip("\n")
- if out == 'None':
- return None
- try:
- return int(out)
- except ValueError:
- return out
-
- def parse_func(self, func):
- # find lines such as # LOOP <name> is in a line
- code = disassembler.dis(func)
- result = {}
- for i, line in enumerate(py.code.Source(func)):
- m = re.search('# LOOP (\w+)', line)
- if m:
- name = m.group(1)
- result[name] = []
- for opcode in code.opcodes:
- no = opcode.lineno - func.func_code.co_firstlineno
- if i - 1 <= no <= i + 1:
- result[name].append(opcode)
- return result
-
- def run(self, func):
- with self.filepath.open("w") as f:
- f.write(str(py.code.Source(func)) + "\n")
- f.write("print %s()\n" % func.func_name)
- logfile = self.filepath.new(ext='.log')
- pipe = subprocess.Popen([sys.executable, str(self.filepath)],
- stdout=subprocess.PIPE, stderr=subprocess.PIPE,
- env={'PYPYLOG': "jit-log-opt,jit-summary:" + str(logfile)})
- pipe.wait()
- stderr = pipe.stderr.read()
- assert not stderr
- res = self.parse_out(pipe.stdout.read())
- bytecodes = self.parse_func(func)
- assert res == func()
- log = logparser.parse_log_file(str(logfile))
- parts = logparser.extract_category(log, 'jit-log-opt-')
- log.xxx
- return Trace()
-
-class TestInfrastructure(BaseTestPyPyC):
- def test_parse_func(self):
- def f():
- i = 0
- x = 0
- # LOOP name
- z = x + 3
- return z
-
- res = self.parse_func(f)
- assert len(res) == 1
- assert len(res['name']) == 6
-
- def test_full(self):
- def f():
- i = 0
- while i < 1003:
- # LOOP one
- i += 1
-
- trace = self.run(f)
- loop = trace.get_loops('one')
- loop.get_bytecode(3, 'LOAD_FAST').match('''
- int_add
- guard_true
- ''')
- loop.get_bytecode(4, 'LOAD_CONST').match_stats(
- guard='3', call='1-2', call_may_force='0'
- )
- # this would make operations that are "costly" obligatory to pass
- # like new
- loo.get_bytecode(5, 'INPLACE_ADD').match_stats(
- allocs='5-10'
- )
-
-class TestPyPyCNew(BaseTestPyPyC):
- pass
diff --git a/pypy/jit/tool/pypytrace.vim b/pypy/jit/tool/pypytrace.vim
--- a/pypy/jit/tool/pypytrace.vim
+++ b/pypy/jit/tool/pypytrace.vim
@@ -1,5 +1,6 @@
" Language : PyPy JIT traces
" Maintainer : Armin Rigo
+" Usage : set syntax=pypytrace
if exists("b:current_syntax")
finish
diff --git a/pypy/interpreter/pyopcode.py b/pypy/interpreter/pyopcode.py
--- a/pypy/interpreter/pyopcode.py
+++ b/pypy/interpreter/pyopcode.py
@@ -754,6 +754,7 @@
def cmp_is_not(self, w_1, w_2):
return self.space.not_(self.space.is_(w_1, w_2))
+ @jit.unroll_safe
def cmp_exc_match(self, w_1, w_2):
if self.space.is_true(self.space.isinstance(w_2, self.space.w_tuple)):
for w_t in self.space.fixedview(w_2):
diff --git a/pypy/module/signal/app_signal.py b/pypy/module/signal/app_signal.py
deleted file mode 100644
--- a/pypy/module/signal/app_signal.py
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-def default_int_handler(signum, frame):
- """
- default_int_handler(...)
-
- The default handler for SIGINT installed by Python.
- It raises KeyboardInterrupt.
- """
- raise KeyboardInterrupt()
-
-
-class ItimerError(IOError):
- pass
\ No newline at end of file
diff --git a/pypy/rpython/memory/gc/minimark.py b/pypy/rpython/memory/gc/minimark.py
--- a/pypy/rpython/memory/gc/minimark.py
+++ b/pypy/rpython/memory/gc/minimark.py
@@ -1,7 +1,7 @@
""" MiniMark GC.
Environment variables can be used to fine-tune the following parameters:
-
+
PYPY_GC_NURSERY The nursery size. Defaults to half the size of
the L2 cache. Try values like '1.2MB'. Small values
(like 1 or 1KB) are useful for debugging.
@@ -108,6 +108,8 @@
GCFLAG_HAS_CARDS = first_gcflag << 5
GCFLAG_CARDS_SET = first_gcflag << 6 # <- at least one card bit is set
+TID_MASK = (first_gcflag << 7) - 1
+
FORWARDSTUB = lltype.GcStruct('forwarding_stub',
('forw', llmemory.Address))
@@ -820,9 +822,13 @@
that can never be set on a young object -- except if tid == -42.
"""
assert self.is_in_nursery(obj)
- result = (self.header(obj).tid & GCFLAG_FINALIZATION_ORDERING != 0)
+ tid = self.header(obj).tid
+ result = (tid & GCFLAG_FINALIZATION_ORDERING != 0)
if result:
- ll_assert(self.header(obj).tid == -42, "bogus header for young obj")
+ ll_assert(tid == -42, "bogus header for young obj")
+ else:
+ ll_assert(bool(tid), "bogus header (1)")
+ ll_assert(tid & ~TID_MASK == 0, "bogus header (2)")
return result
def get_forwarding_address(self, obj):
diff --git a/pypy/module/zlib/app_zlib.py b/pypy/module/zlib/app_zlib.py
deleted file mode 100644
--- a/pypy/module/zlib/app_zlib.py
+++ /dev/null
@@ -1,11 +0,0 @@
-
-"""
-Application-level definitions for the zlib module.
-
-NOT_RPYTHON
-"""
-
-class error(Exception):
- """
- Raised by zlib operations.
- """
diff --git a/pypy/translator/platform/__init__.py b/pypy/translator/platform/__init__.py
--- a/pypy/translator/platform/__init__.py
+++ b/pypy/translator/platform/__init__.py
@@ -19,9 +19,11 @@
def __repr__(self):
if self.err:
- return "<CompilationError err=%s>" % py.io.saferepr(self.err)
+ attr = 'err'
else:
- return "<CompilationError out=%s>" % py.io.saferepr(self.out)
+ attr = 'out'
+ text = getattr(self, attr).replace('\n', '\n\t')
+ return 'CompilationError(%s="""\n\t%s""")' % (attr, text)
__str__ = __repr__
diff --git a/pypy/translator/c/gcc/trackgcroot.py b/pypy/translator/c/gcc/trackgcroot.py
--- a/pypy/translator/c/gcc/trackgcroot.py
+++ b/pypy/translator/c/gcc/trackgcroot.py
@@ -456,7 +456,7 @@
'inc', 'dec', 'not', 'neg', 'or', 'and', 'sbb', 'adc',
'shl', 'shr', 'sal', 'sar', 'rol', 'ror', 'mul', 'imul', 'div', 'idiv',
'bswap', 'bt', 'rdtsc',
- 'punpck', 'pshufd',
+ 'punpck', 'pshufd', 'pcmp',
# zero-extending moves should not produce GC pointers
'movz',
])
diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
--- a/pypy/interpreter/baseobjspace.py
+++ b/pypy/interpreter/baseobjspace.py
@@ -3,6 +3,7 @@
from pypy.interpreter.executioncontext import ExecutionContext, ActionFlag
from pypy.interpreter.executioncontext import UserDelAction, FrameTraceAction
from pypy.interpreter.error import OperationError, operationerrfmt
+from pypy.interpreter.error import new_exception_class
from pypy.interpreter.argument import Arguments
from pypy.interpreter.miscutils import ThreadLocals
from pypy.tool.cache import Cache
@@ -958,6 +959,10 @@
def exception_issubclass_w(self, w_cls1, w_cls2):
return self.is_true(self.issubtype(w_cls1, w_cls2))
+ def new_exception_class(self, *args, **kwargs):
+ "NOT_RPYTHON; convenience method to create excceptions in modules"
+ return new_exception_class(self, *args, **kwargs)
+
# end of special support code
def eval(self, expression, w_globals, w_locals, hidden_applevel=False):
diff --git a/pypy/module/select/app_select.py b/pypy/module/select/app_select.py
deleted file mode 100644
--- a/pypy/module/select/app_select.py
+++ /dev/null
@@ -1,2 +0,0 @@
-class error(Exception):
- pass
diff --git a/pypy/module/termios/app_termios.py b/pypy/module/termios/app_termios.py
deleted file mode 100644
--- a/pypy/module/termios/app_termios.py
+++ /dev/null
@@ -1,3 +0,0 @@
-
-class error(Exception):
- pass
diff --git a/pypy/interpreter/function.py b/pypy/interpreter/function.py
--- a/pypy/interpreter/function.py
+++ b/pypy/interpreter/function.py
@@ -563,7 +563,7 @@
class StaticMethod(Wrappable):
"""The staticmethod objects."""
- _immutable_ = True
+ _immutable_fields_ = ['w_function']
def __init__(self, w_function):
self.w_function = w_function
@@ -577,7 +577,7 @@
class ClassMethod(Wrappable):
"""The classmethod objects."""
- _immutable_ = True
+ _immutable_fields_ = ['w_function']
def __init__(self, w_function):
self.w_function = w_function
diff --git a/pypy/objspace/std/stringobject.py b/pypy/objspace/std/stringobject.py
--- a/pypy/objspace/std/stringobject.py
+++ b/pypy/objspace/std/stringobject.py
@@ -21,7 +21,7 @@
class W_StringObject(W_Object):
from pypy.objspace.std.stringtype import str_typedef as typedef
- _immutable_ = True
+ _immutable_fields_ = ['_value']
def __init__(w_self, str):
w_self._value = str
diff --git a/pypy/module/_ssl/app_ssl.py b/pypy/module/_ssl/app_ssl.py
deleted file mode 100644
--- a/pypy/module/_ssl/app_ssl.py
+++ /dev/null
@@ -1,7 +0,0 @@
-import _socket
-
-class SSLError(_socket.error):
- pass
-
-__doc__ = """Implementation module for SSL socket operations.
-See the socket module for documentation."""
diff --git a/pypy/module/parser/app_helpers.py b/pypy/module/parser/app_helpers.py
deleted file mode 100644
--- a/pypy/module/parser/app_helpers.py
+++ /dev/null
@@ -1,2 +0,0 @@
-class ParserError(Exception):
- pass
diff --git a/pypy/module/pyexpat/app_pyexpat.py b/pypy/module/pyexpat/app_pyexpat.py
deleted file mode 100644
--- a/pypy/module/pyexpat/app_pyexpat.py
+++ /dev/null
@@ -1,2 +0,0 @@
-class ExpatError(Exception):
- pass
diff --git a/pypy/module/signal/interp_signal.py b/pypy/module/signal/interp_signal.py
--- a/pypy/module/signal/interp_signal.py
+++ b/pypy/module/signal/interp_signal.py
@@ -208,6 +208,16 @@
return action.handlers_w[signum]
return space.wrap(SIG_DFL)
+def default_int_handler(space, w_signum, w_frame):
+ """
+ default_int_handler(...)
+
+ The default handler for SIGINT installed by Python.
+ It raises KeyboardInterrupt.
+ """
+ raise OperationError(space.w_KeyboardInterrupt,
+ space.w_None)
+
@jit.dont_look_inside
@unwrap_spec(timeout=int)
def alarm(space, timeout):
@@ -303,9 +313,13 @@
w_interval = space.wrap(double_from_timeval(val.c_it_interval))
return space.newtuple([w_value, w_interval])
+class Cache:
+ def __init__(self, space):
+ self.w_itimererror = space.new_exception_class("signal.ItimerError",
+ space.w_IOError)
+
def get_itimer_error(space):
- mod = space.getbuiltinmodule("signal")
- return space.getattr(mod, space.wrap("ItimerError"))
+ return space.fromcache(Cache).w_itimererror
@jit.dont_look_inside
@unwrap_spec(which=int, first=float, interval=float)
diff --git a/pypy/module/binascii/app_binascii.py b/pypy/module/binascii/app_binascii.py
deleted file mode 100644
--- a/pypy/module/binascii/app_binascii.py
+++ /dev/null
@@ -1,6 +0,0 @@
-
-class Error(Exception):
- pass
-
-class Incomplete(Exception):
- pass
diff --git a/pypy/rpython/test/test_rclass.py b/pypy/rpython/test/test_rclass.py
--- a/pypy/rpython/test/test_rclass.py
+++ b/pypy/rpython/test/test_rclass.py
@@ -853,17 +853,17 @@
accessor.fields == {"ov" : ""} # for ootype
def test_immutable_subclass_1(self):
+ from pypy.rpython.rclass import ImmutableConflictError
from pypy.jit.metainterp.typesystem import deref
class A(object):
_immutable_ = True
class B(A):
pass
def f():
+ A()
B().v = 123
return B()
- t, typer, graph = self.gengraph(f, [])
- B_TYPE = deref(graph.getreturnvar().concretetype)
- assert B_TYPE._hints["immutable"] # inherited from A
+ py.test.raises(ImmutableConflictError, self.gengraph, f, [])
def test_immutable_subclass_2(self):
from pypy.jit.metainterp.typesystem import deref
@@ -872,6 +872,7 @@
class B(A):
_immutable_ = True
def f():
+ A()
B().v = 123
return B()
t, typer, graph = self.gengraph(f, [])
diff --git a/pypy/module/zipimport/app_zipimport.py b/pypy/module/zipimport/app_zipimport.py
deleted file mode 100644
--- a/pypy/module/zipimport/app_zipimport.py
+++ /dev/null
@@ -1,4 +0,0 @@
-
-class ZipImportError(ImportError):
- pass
-
More information about the Pypy-commit
mailing list