[pypy-commit] pypy default: merge heads
mattip
noreply at buildbot.pypy.org
Mon Apr 8 20:35:08 CEST 2013
Author: mattip <matti.picus at gmail.com>
Branch:
Changeset: r63154:1c7e961aa0ab
Date: 2013-04-08 21:22 +0300
http://bitbucket.org/pypy/pypy/changeset/1c7e961aa0ab/
Log: merge heads
diff --git a/pypy/module/__pypy__/interp_time.py b/pypy/module/__pypy__/interp_time.py
--- a/pypy/module/__pypy__/interp_time.py
+++ b/pypy/module/__pypy__/interp_time.py
@@ -61,7 +61,7 @@
ret = c_clock_gettime(clk_id, tp)
if ret != 0:
raise exception_from_errno(space, space.w_IOError)
- return space.wrap(tp.c_tv_sec + tp.c_tv_nsec * 1e-9)
+ return space.wrap(int(tp.c_tv_sec) + 1e-9 * int(tp.c_tv_nsec))
@unwrap_spec(clk_id="c_int")
def clock_getres(space, clk_id):
@@ -69,4 +69,4 @@
ret = c_clock_getres(clk_id, tp)
if ret != 0:
raise exception_from_errno(space, space.w_IOError)
- return space.wrap(tp.c_tv_sec + tp.c_tv_nsec * 1e-9)
+ return space.wrap(int(tp.c_tv_sec) + 1e-9 * int(tp.c_tv_nsec))
diff --git a/rpython/jit/metainterp/blackhole.py b/rpython/jit/metainterp/blackhole.py
--- a/rpython/jit/metainterp/blackhole.py
+++ b/rpython/jit/metainterp/blackhole.py
@@ -857,6 +857,8 @@
@arguments("r")
def bhimpl_debug_fatalerror(msg):
+ from rpython.rtyper.lltypesystem import rstr
+ msg = lltype.cast_opaque_ptr(lltype.Ptr(rstr.STR), msg)
llop.debug_fatalerror(lltype.Void, msg)
@arguments("r", "i", "i", "i", "i")
diff --git a/rpython/jit/metainterp/test/test_blackhole.py b/rpython/jit/metainterp/test/test_blackhole.py
--- a/rpython/jit/metainterp/test/test_blackhole.py
+++ b/rpython/jit/metainterp/test/test_blackhole.py
@@ -228,5 +228,15 @@
assert BlackholeInterpreter.bhimpl_int_lshift.im_func(100, 3) == 100<<3
assert BlackholeInterpreter.bhimpl_int_rshift.im_func(100, 3) == 100>>3
- assert BlackholeInterpreter.bhimpl_uint_rshift.im_func(100, 3) == 100>>3
-
+ assert BlackholeInterpreter.bhimpl_uint_rshift.im_func(100, 3) == 100>>3
+
+def test_debug_fatalerror():
+ from rpython.rtyper.lltypesystem import lltype, llmemory, rstr
+ from rpython.rtyper.llinterp import LLFatalError
+ msg = rstr.mallocstr(1)
+ msg.chars[0] = "!"
+ msg = lltype.cast_opaque_ptr(llmemory.GCREF, msg)
+ e = py.test.raises(LLFatalError,
+ BlackholeInterpreter.bhimpl_debug_fatalerror.im_func,
+ msg)
+ assert str(e.value) == '!'
diff --git a/rpython/rtyper/lltypesystem/lloperation.py b/rpython/rtyper/lltypesystem/lloperation.py
--- a/rpython/rtyper/lltypesystem/lloperation.py
+++ b/rpython/rtyper/lltypesystem/lloperation.py
@@ -555,7 +555,7 @@
'debug_offset': LLOp(canrun=True),
'debug_flush': LLOp(canrun=True),
'debug_assert': LLOp(tryfold=True),
- 'debug_fatalerror': LLOp(),
+ 'debug_fatalerror': LLOp(canrun=True),
'debug_llinterpcall': LLOp(canraise=(Exception,)),
# Python func call 'res=arg[0](*arg[1:])'
# in backends, abort() or whatever is fine
diff --git a/rpython/rtyper/lltypesystem/opimpl.py b/rpython/rtyper/lltypesystem/opimpl.py
--- a/rpython/rtyper/lltypesystem/opimpl.py
+++ b/rpython/rtyper/lltypesystem/opimpl.py
@@ -654,6 +654,13 @@
from rpython.rlib.rtimer import read_timestamp
return read_timestamp()
+def op_debug_fatalerror(ll_msg):
+ from rpython.rtyper.lltypesystem import lltype, rstr
+ from rpython.rtyper.llinterp import LLFatalError
+ assert lltype.typeOf(ll_msg) == lltype.Ptr(rstr.STR)
+ msg = ''.join(ll_msg.chars)
+ raise LLFatalError(msg)
+
# ____________________________________________________________
def get_op_impl(opname):
More information about the pypy-commit
mailing list