Exemplo n.º 1
0
 def _test_size_limit(self, toobig):
     import sys
     from pypy.rpython.lltypesystem import llgroup
     from pypy.rpython.lltypesystem.lloperation import llop
     from pypy.translator.platform import CompilationError
     if toobig and sys.maxint > 2147483647:
         py.test.skip("not easy to test groups too big on 64-bit platforms")
     grp = llgroup.group("big")
     S1 = Struct('S1', ('x', Signed), ('y', Signed),
                       ('z', Signed), ('u', Signed),
                       ('x2', Signed), ('y2', Signed),
                       ('z2', Signed), ('u2', Signed),
                       ('x3', Signed), ('y3', Signed),
                       ('z3', Signed), ('u3', Signed),
                       ('x4', Signed), ('y4', Signed),
                       ('z4', Signed), ('u4', Signed))
     goffsets = []
     for i in range(4096 + toobig):
         ofs = grp.add_member(malloc(S1, immortal=True))
         goffsets.append(llgroup.CombinedSymbolic(ofs, 0))
     grpptr = grp._as_ptr()
     def f(n):
         o = llop.extract_ushort(llgroup.HALFWORD, goffsets[n])
         p = llop.get_group_member(Ptr(S1), grpptr, o)
         p.x = 5
         for i in range(len(goffsets)):
             if i != n:
                 o = llop.extract_ushort(llgroup.HALFWORD, goffsets[i])
                 q = llop.get_group_member(Ptr(S1), grpptr, o)
                 q.x = 666
         return p.x
     if toobig:
         py.test.raises(CompilationError, self.getcompiled, f, [int])
     else:
         fn = self.getcompiled(f, [int])
         res = fn(len(goffsets)-1)
         assert res == 5
Exemplo n.º 2
0
def op_combine_ushort(ushort, rest):
    from pypy.rpython.lltypesystem import llgroup
    return llgroup.CombinedSymbolic(ushort, rest)