Author: Antonio Cuni <[email protected]>
Branch: virtual-raw-mallocs
Changeset: r59547:4eb0fe76fbb0
Date: 2012-12-24 10:11 +0100
http://bitbucket.org/pypy/pypy/changeset/4eb0fe76fbb0/

Log:    failing test and fix for forcing raw virtuals after GUARD_NOT_FORCE

diff --git a/pypy/jit/metainterp/resume.py b/pypy/jit/metainterp/resume.py
--- a/pypy/jit/metainterp/resume.py
+++ b/pypy/jit/metainterp/resume.py
@@ -455,6 +455,7 @@
 
 
 class AbstractVirtualInfo(object):
+    kind = REF
     #def allocate(self, decoder, index):
     #    raise NotImplementedError
     def equals(self, fieldnums):
@@ -549,7 +550,8 @@
 
 
 class VRawBufferStateInfo(AbstractVirtualInfo):
-
+    kind = INT
+    
     def __init__(self, size, offsets, descrs):
         self.size = size
         self.offsets = offsets
@@ -753,8 +755,14 @@
         rd_virtuals = self.rd_virtuals
         if rd_virtuals:
             for i in range(len(rd_virtuals)):
-                if rd_virtuals[i] is not None:
-                    self.getvirtual(i)
+                rd_virtual = rd_virtuals[i]
+                if rd_virtual is not None:
+                    if rd_virtual.kind == REF:
+                        self.getvirtual(i)
+                    elif rd_virtual.kind == INT:
+                        self.getvirtual_int(i)
+                    else:
+                        assert False
         return self.virtuals_cache
 
     def _prepare_virtuals(self, virtuals):
diff --git a/pypy/jit/metainterp/test/test_virtualref.py 
b/pypy/jit/metainterp/test/test_virtualref.py
--- a/pypy/jit/metainterp/test/test_virtualref.py
+++ b/pypy/jit/metainterp/test/test_virtualref.py
@@ -1,5 +1,5 @@
 import py
-from pypy.rpython.lltypesystem import lltype, llmemory, lloperation
+from pypy.rpython.lltypesystem import lltype, llmemory, lloperation, rffi
 from pypy.rpython.exceptiondata import UnknownException
 from pypy.rlib.jit import JitDriver, dont_look_inside, vref_None
 from pypy.rlib.jit import virtual_ref, virtual_ref_finish, InvalidVirtualRef
@@ -307,12 +307,16 @@
                 xy.next1 = lltype.malloc(A, 0)
                 xy.next2 = lltype.malloc(A, 0)
                 xy.next3 = lltype.malloc(A, 0)
+                # this is a raw virtual
+                xy.next4 = lltype.malloc(rffi.CCHARP.TO, 1, flavor='raw')
                 xy.n = n
                 exctx.topframeref = vref = virtual_ref(xy)
                 n -= externalfn(n)
                 xy.next1 = lltype.nullptr(A)
                 xy.next2 = lltype.nullptr(A)
                 xy.next3 = lltype.nullptr(A)
+                lltype.free(xy.next4, flavor='raw')
+                xy.next4 = lltype.nullptr(rffi.CCHARP.TO)
                 virtual_ref_finish(vref, xy)
                 exctx.topframeref = vref_None
             return exctx.m
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to