Author: Alex Gaynor <[email protected]>
Branch: jit-raw-array-of-struct
Changeset: r48596:bb85820f08a3
Date: 2011-10-29 02:13 -0400
http://bitbucket.org/pypy/pypy/changeset/bb85820f08a3/

Log:    random changes

diff --git a/pypy/jit/backend/llgraph/llimpl.py 
b/pypy/jit/backend/llgraph/llimpl.py
--- a/pypy/jit/backend/llgraph/llimpl.py
+++ b/pypy/jit/backend/llgraph/llimpl.py
@@ -1477,7 +1477,7 @@
     return do_setinteriorfield_gc
 do_setinteriorfield_gc_int = new_setinteriorfield_gc(cast_from_int)
 do_setinteriorfield_gc_float = new_setinteriorfield_gc(cast_from_floatstorage)
-do_setinteriorfield_gc_ptr = new_setinteriorfield_gc(cast_from_ptr)        
+do_setinteriorfield_gc_ptr = new_setinteriorfield_gc(cast_from_ptr)
 
 def do_setfield_raw_int(struct, fieldnum, newvalue):
     STRUCT, fieldname = symbolic.TokenToField[fieldnum]
diff --git a/pypy/jit/codewriter/assembler.py b/pypy/jit/codewriter/assembler.py
--- a/pypy/jit/codewriter/assembler.py
+++ b/pypy/jit/codewriter/assembler.py
@@ -7,6 +7,7 @@
 from pypy.rlib.objectmodel import ComputedIntSymbolic
 from pypy.objspace.flow.model import Constant
 from pypy.rpython.lltypesystem import lltype, llmemory, rclass, rffi
+from pypy.rpython.memory.lltypelayout import convert_offset_to_int
 
 
 class AssemblerError(Exception):
@@ -79,7 +80,7 @@
             if TYPE is lltype.SingleFloat:
                 value = longlong.singlefloat2int(value)
             if not isinstance(value, (llmemory.AddressAsInt,
-                                      llmemory.ItemOffset,
+                                      llmemory.AddressOffset,
                                       ComputedIntSymbolic)):
                 value = lltype.cast_primitive(lltype.Signed, value)
                 if allow_short and -128 <= value <= 127:
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
@@ -3566,19 +3566,20 @@
         )
         ARRAY = lltype.Array(POINT, hints={"nolength": True})
         myjitdriver = JitDriver(greens = [], reds=["vals", "i", "n", "result"])
-        def f(n):
-            vals = lltype.malloc(ARRAY, n, flavor="raw")
-            for i in xrange(n):
-                vals[i].x = n
-                vals[i].y = 2
+        def g(vals, n):
             result = 0.0
             i = 0
             while i < n:
                 myjitdriver.jit_merge_point(vals=vals, i=i, n=n, result=result)
                 result += vals[i].x * vals[i].y
                 i += 1
-            lltype.free(vals, flavor="raw")
             return result
+        def f(n):
+            with lltype.scoped_alloc(ARRAY, n) as vals:
+                for i in xrange(n):
+                    vals[i].x = n
+                    vals[i].y = 2
+                return g(vals, n)
         res = self.meta_interp(f, [10])
         assert res == f(10)
         self.check_loops({})
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to