[pypy-commit] pypy cleanup-llgraph-backend: Small fixes
arigo
noreply at buildbot.pypy.org
Wed Oct 17 16:53:43 CEST 2012
Author: Armin Rigo <arigo at tunes.org>
Branch: cleanup-llgraph-backend
Changeset: r58174:f2a4a97675ba
Date: 2012-10-17 16:53 +0200
http://bitbucket.org/pypy/pypy/changeset/f2a4a97675ba/
Log: Small fixes
diff --git a/pypy/jit/backend/llgraph/runner.py b/pypy/jit/backend/llgraph/runner.py
--- a/pypy/jit/backend/llgraph/runner.py
+++ b/pypy/jit/backend/llgraph/runner.py
@@ -40,7 +40,7 @@
self.args = args
class CallDescr(AbstractDescr):
- def __init__(self, RESULT, ARGS, extrainfo=None):
+ def __init__(self, RESULT, ARGS, extrainfo):
self.RESULT = RESULT
self.ARGS = ARGS
self.extrainfo = extrainfo
@@ -306,7 +306,7 @@
try:
return self.descrs[key]
except KeyError:
- descr = CallDescr(RESULT, ARGS)
+ descr = CallDescr(RESULT, ARGS, extrainfo)
self.descrs[key] = descr
return descr
@@ -485,7 +485,7 @@
def bh_new(self, sizedescr):
return lltype.cast_opaque_ptr(llmemory.GCREF,
- lltype.malloc(sizedescr.S))
+ lltype.malloc(sizedescr.S, zero=True))
def bh_new_with_vtable(self, vtable, descr):
result = lltype.malloc(descr.S)
diff --git a/pypy/jit/backend/llgraph/support.py b/pypy/jit/backend/llgraph/support.py
--- a/pypy/jit/backend/llgraph/support.py
+++ b/pypy/jit/backend/llgraph/support.py
@@ -67,9 +67,7 @@
if isinstance(TYPE, lltype.Ptr):
if isinstance(x, (int, long, llmemory.AddressAsInt)):
x = llmemory.cast_int_to_adr(x)
- if TYPE is rffi.VOIDP or (
- hasattr(TYPE.TO, '_hints') and
- TYPE.TO._hints.get("uncast_on_llgraph")):
+ if repr(x.ptr).startswith('<* <C object '): # pom pom pom
# assume that we want a "C-style" cast, without typechecking the value
return rffi.cast(TYPE, x)
return llmemory.cast_adr_to_ptr(x, TYPE)
diff --git a/pypy/jit/metainterp/test/test_executor.py b/pypy/jit/metainterp/test/test_executor.py
--- a/pypy/jit/metainterp/test/test_executor.py
+++ b/pypy/jit/metainterp/test/test_executor.py
@@ -47,18 +47,18 @@
def bh_new(self, descr):
return FakeResultR('new', descr)
- def bh_arraylen_gc(self, descr, array):
+ def bh_arraylen_gc(self, array, descr):
assert not array
assert isinstance(descr, FakeDescr)
return 55
- def bh_setfield_gc_f(self, struct, fielddescr, newvalue):
+ def bh_setfield_gc_f(self, struct, newvalue, fielddescr):
self.fakesetfield = (struct, newvalue, fielddescr)
- def bh_setarrayitem_gc_f(self, arraydescr, array, index, newvalue):
+ def bh_setarrayitem_gc_f(self, array, index, newvalue, arraydescr):
self.fakesetarrayitem = (array, index, newvalue, arraydescr)
- def bh_call_f(self, func, calldescr, args_i, args_r, args_f):
+ def bh_call_f(self, func, args_i, args_r, args_f, calldescr):
self.fakecalled = (func, calldescr, args_i, args_r, args_f)
return longlong.getfloatstorage(42.5)
diff --git a/pypy/jit/metainterp/test/test_rawmem.py b/pypy/jit/metainterp/test/test_rawmem.py
--- a/pypy/jit/metainterp/test/test_rawmem.py
+++ b/pypy/jit/metainterp/test/test_rawmem.py
@@ -6,7 +6,7 @@
class RawMemTests(object):
def test_cast_void_ptr(self):
TP = lltype.Array(lltype.Float, hints={"nolength": True})
- VOID_TP = lltype.Array(lltype.Void, hints={"nolength": True, "uncast_on_llgraph": True})
+ VOID_TP = lltype.Array(lltype.Void, hints={"nolength": True})
class A(object):
def __init__(self, x):
self.storage = rffi.cast(lltype.Ptr(VOID_TP), x)
diff --git a/pypy/rpython/exceptiondata.py b/pypy/rpython/exceptiondata.py
--- a/pypy/rpython/exceptiondata.py
+++ b/pypy/rpython/exceptiondata.py
@@ -69,9 +69,9 @@
example = self.cast_exception(self.lltype_of_exception_value, example)
return example
- def get_standard_ll_exc_instance_by_class(self, exceptionclass):
+ def get_standard_ll_exc_instance_by_class(self, exceptionclass, tb=None):
if exceptionclass not in self.standardexceptions:
- raise UnknownException(exceptionclass)
+ raise UnknownException(exceptionclass, tb)
clsdef = self.rtyper.annotator.bookkeeper.getuniqueclassdef(
exceptionclass)
return self.get_standard_ll_exc_instance(self.rtyper, clsdef)
diff --git a/pypy/rpython/llinterp.py b/pypy/rpython/llinterp.py
--- a/pypy/rpython/llinterp.py
+++ b/pypy/rpython/llinterp.py
@@ -464,8 +464,11 @@
if isinstance(exc, OSError):
self.op_direct_call(exdata.fn_raise_OSError, exc.errno)
assert False, "op_direct_call above should have raised"
+ elif exc.__class__.__name__ == 'UnknownException':
+ raise original[0], original[1], original[2] # just re-raise it
else:
- evalue = exdata.get_standard_ll_exc_instance_by_class(exc.__class__)
+ evalue = exdata.get_standard_ll_exc_instance_by_class(
+ exc.__class__, original[2])
etype = self.op_direct_call(exdata.fn_type_of_exc_inst, evalue)
raise LLException(etype, evalue, *extraargs)
More information about the pypy-commit
mailing list