pypy / pypy / jit / backend / arm / test /

David Schneider 2a82d42 

David Schneider d8b64e6 

David Schneider 2a82d42 
David Schneider d8b64e6 
David Schneider 2a82d42 

David Schneider d8b64e6 

from pypy.jit.backend.x86.test.test_regalloc import BaseTestRegalloc
from pypy.jit.backend.detect_cpu import getcpuclass
from pypy.rpython.lltypesystem import lltype, llmemory
CPU = getcpuclass()

class TestConstPtr(BaseTestRegalloc):

    cpu = CPU(None, None)
    #cpu.gc_ll_descr = MockGcDescr(False)

    S = lltype.GcForwardReference()
    fields = [('int%d' % i, lltype.Signed) for i in range(1050)]
    S.become(lltype.GcStruct('S', *fields))

    fielddescr = cpu.fielddescrof(S, 'int1049')

    struct_ptr = lltype.malloc(S)
    struct_ref = lltype.cast_opaque_ptr(llmemory.GCREF, struct_ptr)

    ptr0 = struct_ref

    namespace = locals().copy()

    def test_finish_failargs_constptr(self):
        ops = '''
        i1 = int_add(i0, 1)
        finish(i1, ConstPtr(ptr0))
        self.interpret(ops, [99])
        assert self.getint(0) == 100
        ptr = self.cpu.get_latest_value_ref(1)
        assert self.ptr0 == ptr

    def test_getfield_with_offset_gt_one_byte(self):
        self.struct_ptr.int1049 = 666
        ops = '''
        i0 = getfield_gc(p0, descr=fielddescr)
        self.interpret(ops, [self.struct_ptr])
        assert self.getint(0) == 666

    def test_setfield_with_offset_gt_one_byte(self):
        ops = '''
        setfield_gc(p0, 777, descr=fielddescr)
        self.interpret(ops, [self.struct_ptr])
        assert self.struct_ptr.int1049 == 777
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.