pypy / pypy / jit / backend / llgraph / test / test_llgraph.py

Armin Rigo f4b9995 




Maciej Fijalkows… b73ad0f 

Armin Rigo f4b9995 

Maciej Fijalkows… fff8b52 
Armin Rigo 1641ad7 
Armin Rigo f4b9995 
Samuele Pedroni a1f3549 
Maciej Fijalkows… 82060c2 


Samuele Pedroni a1f3549 
Maciej Fijalkows… f64b1b7 
Armin Rigo 6db80ac 
Armin Rigo 6f74fde 
Benjamin Peterso… 8ffed5b 
Armin Rigo 88d80ae 


Armin Rigo f4b9995 
Maciej Fijalkows… fff8b52 










Benjamin Peterso… 98cc99e 
Antonio Cuni 6d3af55 


Antonio Cuni e444a48 

Maciej Fijalkows… fff8b52 
Antonio Cuni e444a48 






import py
from pypy.rpython.lltypesystem import lltype, llmemory, rstr, rclass
from pypy.rpython.test.test_llinterp import interpret
from pypy.rlib.unroll import unrolling_iterable

from pypy.jit.metainterp.history import BoxInt, BoxPtr, Const, ConstInt,\
     TreeLoop
from pypy.jit.metainterp.resoperation import ResOperation, rop
from pypy.jit.metainterp.executor import execute
from pypy.jit.codewriter import heaptracker
from pypy.jit.backend.test.runner_test import LLtypeBackendTest

class TestLLTypeLLGraph(LLtypeBackendTest):
    # for individual tests see:
    # ====> ../../test/runner_test.py
    
    from pypy.jit.backend.llgraph.runner import LLtypeCPU as cpu_type

    def setup_method(self, _):
        self.cpu = self.cpu_type(None)

    def test_memoryerror(self):
        py.test.skip("does not make much sense on the llgraph backend")


def test_cast_adr_to_int_and_back():
    X = lltype.Struct('X', ('foo', lltype.Signed))
    x = lltype.malloc(X, immortal=True)
    x.foo = 42
    a = llmemory.cast_ptr_to_adr(x)
    i = heaptracker.adr2int(a)
    assert lltype.typeOf(i) is lltype.Signed
    a2 = heaptracker.int2adr(i)
    assert llmemory.cast_adr_to_ptr(a2, lltype.Ptr(X)) == x
    assert heaptracker.adr2int(llmemory.NULL) == 0
    assert heaptracker.int2adr(0) == llmemory.NULL

## these tests never worked
## class TestOOTypeLLGraph(LLGraphTest):
##     from pypy.jit.backend.llgraph.runner import OOtypeCPU as cpu_type

def test_fielddescr_ootype():
    py.test.skip("ootype tests skipped")
    from pypy.rpython.ootypesystem import ootype
    from pypy.jit.backend.llgraph.runner import OOtypeCPU
    A = ootype.Instance("A", ootype.ROOT, {"foo": ootype.Signed})
    B = ootype.Instance("B", A)
    cpu = OOtypeCPU(None)
    descr1 = cpu.fielddescrof(A, "foo")
    descr2 = cpu.fielddescrof(B, "foo")
    assert descr1 is descr2
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 ProjectModifiedEvent.java.
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.