Author: Maciej Fijalkowski <[email protected]>
Branch: cleanup-llgraph-backend
Changeset: r58192:ffad6c83a68b
Date: 2012-10-18 10:18 +0200
http://bitbucket.org/pypy/pypy/changeset/ffad6c83a68b/
Log: fix mostly everything
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
@@ -12,7 +12,7 @@
from pypy.rpython.llinterp import LLInterpreter, LLException
from pypy.rpython.lltypesystem import lltype, llmemory, rffi, rclass, rstr
-from pypy.rlib.rarithmetic import ovfcheck
+from pypy.rlib.rarithmetic import ovfcheck, r_uint, r_ulonglong
from pypy.rlib.rtimer import read_timestamp
class LLTrace(object):
@@ -132,11 +132,18 @@
def is_float_field(self):
return getkind(self.FIELD) == 'float'
+def _example_res(kind):
+ d = {'v': None,
+ 'r': lltype.nullptr(llmemory.GCREF.TO),
+ 'i': 0,
+ 'f': 0.0}
+ return d[kind[0]]
+
class LLGraphCPU(model.AbstractCPU):
from pypy.jit.metainterp.typesystem import llhelper as ts
supports_floats = True
- supports_longlong = True
+ supports_longlong = r_uint is not r_ulonglong
supports_singlefloats = True
translate_support_code = False
@@ -191,6 +198,8 @@
assert not hasattr(oldlooptoken, '_llgraph_redirected')
oldlooptoken.compiled_loop_token._llgraph_redirected = True
oldlooptoken.compiled_loop_token._llgraph_loop = newtrace
+ alltraces = newlooptoken.compiled_loop_token._llgraph_alltraces
+ oldlooptoken.compiled_loop_token._llgraph_alltraces = alltraces
def free_loop_and_bridges(self, compiled_loop_token):
for c in compiled_loop_token._llgraph_alltraces:
@@ -725,11 +734,7 @@
self.cpu.last_exception = None
except LLException, lle:
self.cpu.last_exception = lle
- d = {'void': None,
- 'ref': lltype.nullptr(llmemory.GCREF.TO),
- 'int': 0,
- 'float': 0.0}
- res = d[getkind(TP.RESULT)]
+ res = _example_res[getkind(TP.RESULT)]
return res
execute_call_may_force = execute_call
@@ -768,14 +773,11 @@
try:
result = assembler_helper_ptr(failindex, vable)
except LLException, lle:
- xxxxxxxxxx
- assert _last_exception is None, "exception left behind"
- _last_exception = lle
- # fish op
- op = self.loop.operations[self.opindex]
- if op.result is not None:
- yyyyyyyyyyyyy
- return 0
+ assert self.cpu.last_exception is None, "exception left behind"
+ self.cpu.last_exception = lle
+ if self.current_op.result is not None:
+ return _example_res(self.current_op.result.type)
+ return None
return support.cast_result(lltype.typeOf(result), result)
def _reset_vable(self, jd, vable):
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,10 +67,10 @@
if isinstance(TYPE, lltype.Ptr):
if isinstance(x, (int, long, llmemory.AddressAsInt)):
x = llmemory.cast_int_to_adr(x)
- 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)
+ #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)
elif TYPE == llmemory.Address:
if isinstance(x, (int, long, llmemory.AddressAsInt)):
x = llmemory.cast_int_to_adr(x)
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
@@ -3884,4 +3884,5 @@
class TestLLtype(BaseLLtypeTests, LLJitMixin):
- pass
+ def test_free_object(self):
+ py.test.skip("llgraph backend keeps alive boxes which keep alive
values")
diff --git a/pypy/jit/metainterp/test/test_quasiimmut.py
b/pypy/jit/metainterp/test/test_quasiimmut.py
--- a/pypy/jit/metainterp/test/test_quasiimmut.py
+++ b/pypy/jit/metainterp/test/test_quasiimmut.py
@@ -30,7 +30,7 @@
result = foo.mutate_x
return lltype.cast_opaque_ptr(llmemory.GCREF, result)
- def bh_setfield_gc_r(self, gcref, fielddescr, newvalue_gcref):
+ def bh_setfield_gc_r(self, gcref, newvalue_gcref, fielddescr):
assert fielddescr == mutatefielddescr
foo = lltype.cast_opaque_ptr(lltype.Ptr(STRUCT), gcref)
newvalue = lltype.cast_opaque_ptr(rclass.OBJECTPTR, newvalue_gcref)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit