Hi all, Can anyone does the favour for me by explaining the story of RuntimeTypeInfo in RPython? I couldn’t quite understand the description on the online documentation (http://rpython.readthedocs.io/en/latest/rtyper.html#opaque-types). From looking at the source code, and inspecting the generated C source, RTTI doesn’t seem to be used at all at runtime. The generated C source seems to just return an uninitialised function pointer on the stack when compiling the following code:
from rpython.rtyper.rclass import OBJECTPTR class A: pass class B(A): pass def f(a): obj = rffi.cast(OBJECTPTR, a) return lltype.runtime_type_info(obj) t = Translation(f, [A], backend='c') t.backendopt(mallocs=True) t.view() lib = t.compile() We were looking at RTTI in finding a solution to the loss of type information problem at JIT encoding. My collaborators are trying to develop a JIT back-end targeting a micro virtual machine (Mu). It seems that by default the JIT transformer throws away the actual type information (GcStruct etc., which is not representable under RPython, I know) and only keeps the size. However, in Mu, memory allocation requires specific type information. Thus, among other ways, we are trying to see how much we can recover this object layout/type information. RTTI seems promising based on the description on the documentation, but I can’t picture what it looks like at run time. Can anyone provide some insight on this? Thanks, John Zhang ------------------------------------------------------ John Zhang Research Assistant Programming Languages, Design & Implementation Division Computer Systems Group ANU College of Engineering & Computer Science 108 North Rd The Australian National University Acton ACT 2601 john.zh...@anu.edu.au<mailto:john.zh...@anu.edu.au>
_______________________________________________ pypy-dev mailing list pypy-dev@python.org https://mail.python.org/mailman/listinfo/pypy-dev