[pypy-svn] r51716 - in pypy/branch/unified-rtti/pypy: rpython rpython/lltypesystem rpython/lltypesystem/test rpython/memory/gctransform rpython/test translator/c
arigo at codespeak.net
arigo at codespeak.net
Thu Feb 21 11:35:15 CET 2008
Author: arigo
Date: Thu Feb 21 11:35:14 2008
New Revision: 51716
Modified:
pypy/branch/unified-rtti/pypy/rpython/llinterp.py
pypy/branch/unified-rtti/pypy/rpython/lltypesystem/lltype.py
pypy/branch/unified-rtti/pypy/rpython/lltypesystem/rclass.py
pypy/branch/unified-rtti/pypy/rpython/lltypesystem/rtagged.py
pypy/branch/unified-rtti/pypy/rpython/lltypesystem/test/test_lltype.py
pypy/branch/unified-rtti/pypy/rpython/lltypesystem/test/test_rtagged.py
pypy/branch/unified-rtti/pypy/rpython/memory/gctransform/boehm.py
pypy/branch/unified-rtti/pypy/rpython/memory/gctransform/framework.py
pypy/branch/unified-rtti/pypy/rpython/memory/gctransform/refcounting.py
pypy/branch/unified-rtti/pypy/rpython/memory/gctransform/support.py
pypy/branch/unified-rtti/pypy/rpython/test/test_exception.py
pypy/branch/unified-rtti/pypy/rpython/test/test_llann.py
pypy/branch/unified-rtti/pypy/rpython/test/test_nongc.py
pypy/branch/unified-rtti/pypy/rpython/test/test_rlist.py
pypy/branch/unified-rtti/pypy/rpython/test/tool.py
pypy/branch/unified-rtti/pypy/translator/c/gc.py
pypy/branch/unified-rtti/pypy/translator/c/node.py
Log:
Some general progress.
Modified: pypy/branch/unified-rtti/pypy/rpython/llinterp.py
==============================================================================
--- pypy/branch/unified-rtti/pypy/rpython/llinterp.py (original)
+++ pypy/branch/unified-rtti/pypy/rpython/llinterp.py Thu Feb 21 11:35:14 2008
@@ -507,7 +507,7 @@
if ll_exc is None:
raise LLFatalError(msg)
else:
- ll_exc_type = lltype.cast_pointer(rclass.OBJECTPTR, ll_exc).typeptr
+ ll_exc_type = rclass.ll_type(ll_exc)
raise LLFatalError(msg, LLException(ll_exc_type, ll_exc))
def op_debug_llinterpcall(self, pythonfunction, *args_ll):
Modified: pypy/branch/unified-rtti/pypy/rpython/lltypesystem/lltype.py
==============================================================================
--- pypy/branch/unified-rtti/pypy/rpython/lltypesystem/lltype.py (original)
+++ pypy/branch/unified-rtti/pypy/rpython/lltypesystem/lltype.py Thu Feb 21 11:35:14 2008
@@ -1805,7 +1805,7 @@
def getRuntimeTypeInfo(TYPE, cache=None):
"""Return the runtime_type_info attached to the GcStruct TYPE,
- as a Ptr(RuntimeTypeInfo). This raises TypeError if the TYPE has
+ as a Ptr(RuntimeTypeInfo). This returns None if the TYPE has
no runtime_type_info, unless 'cache' is specified; in that case,
TYPE can be any GC type and a runtime_type_info is created for
it if it has none and stored in the cache to avoid mutating
@@ -1814,7 +1814,7 @@
if isinstance(TYPE, GcStruct) and hasattr(TYPE, '_rtti'):
return TYPE._rtti._as_ptr()
if cache is None:
- raise TypeError("%r has no runtime_type_info" % (TYPE,))
+ return None
try:
return cache[TYPE]
except KeyError:
Modified: pypy/branch/unified-rtti/pypy/rpython/lltypesystem/rclass.py
==============================================================================
--- pypy/branch/unified-rtti/pypy/rpython/lltypesystem/rclass.py (original)
+++ pypy/branch/unified-rtti/pypy/rpython/lltypesystem/rclass.py Thu Feb 21 11:35:14 2008
@@ -14,7 +14,7 @@
cast_pointer, cast_ptr_to_int, castable, nullptr, \
typeOf, Array, Char, Void, \
FuncType, Bool, Signed, functionptr, FuncType, PyObject
-from pypy.rpython.lltypesystem import lltype
+from pypy.rpython.lltypesystem import lltype, rffi
from pypy.rpython.robject import PyObjRepr, pyobj_repr
from pypy.rpython.extregistry import ExtRegistryEntry
from pypy.annotation import model as annmodel
@@ -29,7 +29,7 @@
# RuntimeTypeInfo rtti; //GC-specific information
# Signed subclassrange_min; //this is also the id of the class itself
# Signed subclassrange_max;
-# array { char } * name;
+# char * name;
# struct object * instantiate();
# }
#
@@ -66,13 +66,17 @@
('rtti', lltype.RuntimeTypeInfo),
('subclassrange_min', Signed),
('subclassrange_max', Signed),
- ('name', Ptr(Array(Char))),
+ ('name', rffi.CCHARP),
('instantiate', Ptr(FuncType([], OBJECTPTR))),
hints = {'immutable': True})
CLASSTYPE = Ptr(OBJECT_VTABLE)
+root_object_vtable = malloc(OBJECT_VTABLE, immortal=True, zero=True)
+root_object_vtable.subclassrange_min = 0
+root_object_vtable.subclassrange_max = sys.maxint
+root_object_vtable.name = rffi.str2charp("object")
+
OBJECT.become(GcStruct('object',
- runtime_type_info = malloc(OBJECT_VTABLE,
- immortal=True),
+ runtime_type_info = root_object_vtable,
adtmeths = {'gettypeptr': ll_gettypeptr}))
# non-gc case
@@ -94,6 +98,8 @@
if classdef is None:
# 'object' root type
self.vtable_type = OBJECT_VTABLE
+ self.vtable = root_object_vtable
+ self.vtable_filled = True
else:
self.vtable_type = lltype.ForwardReference()
self.lowleveltype = Ptr(self.vtable_type)
@@ -139,11 +145,11 @@
*llfields, **kwds)
self.vtable_type.become(vtable_type)
allmethods.update(self.rbase.allmethods)
+ self.vtable = malloc(self.vtable_type, immortal=True)
+ self.vtable_filled = False
self.clsfields = clsfields
self.pbcfields = pbcfields
self.allmethods = allmethods
- self.vtable = malloc(self.vtable_type, immortal=True)
- self.vtable_filled = False
def getvtable(self):
"""Return a ptr to the vtable of this type."""
@@ -158,22 +164,12 @@
given subclass."""
if self.classdef is None:
# initialize the 'subclassrange_*' and 'name' fields
- if rsubcls.classdef is not None:
- vtable.subclassrange_min = rsubcls.classdef.minid
- vtable.subclassrange_max = rsubcls.classdef.maxid
- else: #for the root class
- vtable.subclassrange_min = 0
- vtable.subclassrange_max = sys.maxint
+ assert rsubcls.classdef is not None
+ vtable.subclassrange_min = rsubcls.classdef.minid
+ vtable.subclassrange_max = rsubcls.classdef.maxid
rinstance = getinstancerepr(self.rtyper, rsubcls.classdef)
rinstance.setup()
- if rsubcls.classdef is None:
- name = 'object'
- else:
- name = rsubcls.classdef.shortname
- vtable.name = malloc(Array(Char), len(name)+1, immortal=True)
- for i in range(len(name)):
- vtable.name[i] = name[i]
- vtable.name[len(name)] = '\x00'
+ vtable.name = rffi.str2charp(rsubcls.classdef.shortname)
if hasattr(rsubcls.classdef, 'my_instantiate_graph'):
graph = rsubcls.classdef.my_instantiate_graph
vtable.instantiate = self.rtyper.getcallable(graph)
@@ -488,9 +484,17 @@
ctype = inputconst(Void, self.object_type)
cflags = inputconst(Void, flags)
vlist = [ctype, cflags]
- self.rclass.getvtable() # force it to be filled
+ vtable = self.rclass.getvtable() # don't remove this line,
+ # it forces the vtable to be filled
vptr = llops.genop('malloc', vlist,
resulttype = Ptr(self.object_type))
+ if self.gcflavor != 'gc':
+ # fill in 'typeptr'
+ vbase = llops.genop('cast_pointer', [vptr],
+ resulttype=NONGCOBJECTPTR)
+ ctypeptr = inputconst(Void, 'typeptr')
+ cvalue = inputconst(CLASSTYPE, vtable)
+ llops.genop('setfield', [vbase, ctypeptr, cvalue])
# initialize instance attributes from their defaults from the class
if self.classdef is not None:
flds = self.allinstancefields.keys()
@@ -562,13 +566,15 @@
BASEPTR = Ptr(self.get_base_object_type())
instance = cast_pointer(BASEPTR, i)
vtable = instance.gettypeptr()
+ nameLen = 0
+ while vtable.name[nameLen] != '\x00':
+ nameLen += 1
+ nameString = rstr.mallocstr(nameLen)
+ j = 0
+ while j < nameLen:
+ nameString.chars[j] = vtable.name[j]
+ j += 1
uid = r_uint(cast_ptr_to_int(i))
- nameLen = len(vtable.name)
- nameString = rstr.mallocstr(nameLen-1)
- i = 0
- while i < nameLen - 1:
- nameString.chars[i] = vtable.name[i]
- i += 1
res = rstr.instance_str_prefix
res = rstr.ll_strconcat(res, nameString)
res = rstr.ll_strconcat(res, rstr.instance_str_infix)
Modified: pypy/branch/unified-rtti/pypy/rpython/lltypesystem/rtagged.py
==============================================================================
--- pypy/branch/unified-rtti/pypy/rpython/lltypesystem/rtagged.py (original)
+++ pypy/branch/unified-rtti/pypy/rpython/lltypesystem/rtagged.py Thu Feb 21 11:35:14 2008
@@ -17,7 +17,6 @@
def _setup_repr(self):
InstanceRepr._setup_repr(self)
flds = self.allinstancefields.keys()
- flds.remove('__class__')
if self.is_parent:
if flds:
raise TyperError("%r is a base class of an UnboxedValue,"
@@ -67,7 +66,7 @@
cunboxedcls = inputconst(CLASSTYPE, unboxedclass_repr.getvtable())
if self.is_parent:
# If the lltype of vinst shows that it cannot be a tagged value,
- # we can directly read the typeptr. Otherwise, call a helper that
+ # we can fall back to gettypeptr(). Otherwise, call a helper that
# checks if the tag bit is set in the pointer.
unboxedinstance_repr = getinstancerepr(self.rtyper,
self.unboxedclassdef)
@@ -75,18 +74,14 @@
lltype.castable(unboxedinstance_repr.lowleveltype,
vinst.concretetype)
except lltype.InvalidCast:
- can_be_tagged = False
+ # cannot be tagged
+ return self.gettypeptr(vinst, llops)
else:
- can_be_tagged = True
- vinst = llops.genop('cast_pointer', [vinst],
- resulttype=self.common_repr())
- if can_be_tagged:
+ # normal case: must check
+ vinst = llops.genop('cast_pointer', [vinst],
+ resulttype=self.common_repr())
return llops.gendirectcall(ll_unboxed_getclass, vinst,
cunboxedcls)
- else:
- ctypeptr = inputconst(lltype.Void, 'typeptr')
- return llops.genop('getfield', [vinst, ctypeptr],
- resulttype = CLASSTYPE)
else:
return cunboxedcls
@@ -145,7 +140,7 @@
if lltype.cast_ptr_to_int(instance) & 1:
return class_if_unboxed
else:
- return instance.typeptr
+ return instance.gettypeptr()
def ll_unboxed_isinstance_const(obj, minid, maxid, answer_if_unboxed):
if not obj:
@@ -153,4 +148,4 @@
if lltype.cast_ptr_to_int(obj) & 1:
return answer_if_unboxed
else:
- return ll_issubclass_const(obj.typeptr, minid, maxid)
+ return ll_issubclass_const(obj.gettypeptr(), minid, maxid)
Modified: pypy/branch/unified-rtti/pypy/rpython/lltypesystem/test/test_lltype.py
==============================================================================
--- pypy/branch/unified-rtti/pypy/rpython/lltypesystem/test/test_lltype.py (original)
+++ pypy/branch/unified-rtti/pypy/rpython/lltypesystem/test/test_lltype.py Thu Feb 21 11:35:14 2008
@@ -385,7 +385,7 @@
S1bis = GcStruct('S1', ('x', Signed))
assert S1bis != S1 # attached runtime type info distinguishes them
- py.test.raises(TypeError, getRuntimeTypeInfo, S1bis)
+ assert getRuntimeTypeInfo(S1bis) is None
cache = {}
assert getRuntimeTypeInfo(S1, cache=cache) == t1.base
Modified: pypy/branch/unified-rtti/pypy/rpython/lltypesystem/test/test_rtagged.py
==============================================================================
--- pypy/branch/unified-rtti/pypy/rpython/lltypesystem/test/test_rtagged.py (original)
+++ pypy/branch/unified-rtti/pypy/rpython/lltypesystem/test/test_rtagged.py Thu Feb 21 11:35:14 2008
@@ -210,7 +210,9 @@
t = interp.typer.annotator.translator
ggraph = graphof(t, g)
- assert summary(ggraph) == {'cast_pointer': 2, 'getfield': 2}
+ s = summary(ggraph)
+ assert s == {'gc_runtime_type_info': 1, 'getfield': 1,
+ 'cast_pointer': s['cast_pointer']} # any number of them is ok
res = interp.eval_graph(graph, [-1000])
assert res == 68
Modified: pypy/branch/unified-rtti/pypy/rpython/memory/gctransform/boehm.py
==============================================================================
--- pypy/branch/unified-rtti/pypy/rpython/memory/gctransform/boehm.py (original)
+++ pypy/branch/unified-rtti/pypy/rpython/memory/gctransform/boehm.py Thu Feb 21 11:35:14 2008
@@ -1,6 +1,6 @@
from pypy.rpython.memory.gctransform.transform import GCTransformer, mallocHelpers
from pypy.rpython.memory.gctransform.support import type_contains_pyobjs, \
- get_rtti, _static_deallocator_body_for_type, LLTransformerOp, ll_call_destructor
+ _static_deallocator_body_for_type, LLTransformerOp, ll_call_destructor
from pypy.rpython.lltypesystem import lltype, llmemory
from pypy.rpython import rmodel
from pypy.rlib.rarithmetic import ovfcheck
Modified: pypy/branch/unified-rtti/pypy/rpython/memory/gctransform/framework.py
==============================================================================
--- pypy/branch/unified-rtti/pypy/rpython/memory/gctransform/framework.py (original)
+++ pypy/branch/unified-rtti/pypy/rpython/memory/gctransform/framework.py Thu Feb 21 11:35:14 2008
@@ -1,6 +1,6 @@
from pypy.rpython.memory.gctransform.transform import GCTransformer
from pypy.rpython.memory.gctransform.support import find_gc_ptrs_in_type, \
- get_rtti, ll_call_destructor, type_contains_pyobjs, var_ispyobj
+ ll_call_destructor, type_contains_pyobjs, var_ispyobj
from pypy.rpython.lltypesystem import lltype, llmemory
from pypy.rpython import rmodel
from pypy.rpython.memory import gctypelayout
Modified: pypy/branch/unified-rtti/pypy/rpython/memory/gctransform/refcounting.py
==============================================================================
--- pypy/branch/unified-rtti/pypy/rpython/memory/gctransform/refcounting.py (original)
+++ pypy/branch/unified-rtti/pypy/rpython/memory/gctransform/refcounting.py Thu Feb 21 11:35:14 2008
@@ -1,7 +1,7 @@
import py
from pypy.rpython.memory.gctransform.transform import GCTransformer, mallocHelpers
from pypy.rpython.memory.gctransform.support import find_gc_ptrs_in_type, \
- get_rtti, _static_deallocator_body_for_type, LLTransformerOp, ll_call_destructor
+ _static_deallocator_body_for_type, LLTransformerOp, ll_call_destructor
from pypy.rpython.lltypesystem import lltype, llmemory
from pypy.rpython.lltypesystem.lloperation import llop
from pypy.translator.backendopt.support import var_needsgc
@@ -31,10 +31,14 @@
## print ' '*i, a, repr(b)[:100-i-len(a)], id(b)
ADDRESS_VOID_FUNC = lltype.FuncType([llmemory.Address], lltype.Void)
+RTTIPTR = lltype.Ptr(lltype.RuntimeTypeInfo)
class RefcountingGCTransformer(GCTransformer):
- HDR = lltype.Struct("header", ("refcount", lltype.Signed))
+ # xxx not all objects need a typeptr, but refcounting is a bit
+ # deprecated now, being not efficient at all
+ HDR = lltype.Struct("header", ("refcount", lltype.Signed),
+ ("typeptr", RTTIPTR))
def __init__(self, translator):
super(RefcountingGCTransformer, self).__init__(translator, inline=True)
@@ -51,21 +55,13 @@
if adr:
gcheader = llmemory.cast_adr_to_ptr(adr - gc_header_offset, HDRPTR)
gcheader.refcount = gcheader.refcount + 1
- def ll_decref(adr, dealloc):
+ def ll_decref(adr):
if adr:
gcheader = llmemory.cast_adr_to_ptr(adr - gc_header_offset, HDRPTR)
refcount = gcheader.refcount - 1
gcheader.refcount = refcount
if refcount == 0:
- dealloc(adr)
- def ll_decref_simple(adr):
- if adr:
- gcheader = llmemory.cast_adr_to_ptr(adr - gc_header_offset, HDRPTR)
- refcount = gcheader.refcount - 1
- if refcount == 0:
- llop.gc_free(lltype.Void, adr)
- else:
- gcheader.refcount = refcount
+ gcheader.typeptr.xxx(adr)
def ll_no_pointer_dealloc(adr):
llop.gc_free(lltype.Void, adr)
@@ -259,7 +255,7 @@
return self.dynamic_deallocator_funcptrs[TYPE]
#print_call_chain(self)
- rtti = get_rtti(TYPE)
+ rtti = lltype.getRuntimeTypeInfo(TYPE)
if rtti is None:
p = self.static_deallocation_funcptr_for_type(TYPE)
self.dynamic_deallocator_funcptrs[TYPE] = p
Modified: pypy/branch/unified-rtti/pypy/rpython/memory/gctransform/support.py
==============================================================================
--- pypy/branch/unified-rtti/pypy/rpython/memory/gctransform/support.py (original)
+++ pypy/branch/unified-rtti/pypy/rpython/memory/gctransform/support.py Thu Feb 21 11:35:14 2008
@@ -47,14 +47,6 @@
else:
return False
-def get_rtti(TYPE):
- if isinstance(TYPE, lltype.RttiStruct):
- try:
- return lltype.getRuntimeTypeInfo(TYPE)
- except ValueError:
- pass
- return None
-
def _static_deallocator_body_for_type(v, TYPE, depth=1):
if isinstance(TYPE, lltype.Array):
inner = list(_static_deallocator_body_for_type('v_%i'%depth, TYPE.OF, depth+1))
Modified: pypy/branch/unified-rtti/pypy/rpython/test/test_exception.py
==============================================================================
--- pypy/branch/unified-rtti/pypy/rpython/test/test_exception.py (original)
+++ pypy/branch/unified-rtti/pypy/rpython/test/test_exception.py Thu Feb 21 11:35:14 2008
@@ -40,21 +40,22 @@
excdata = t.rtyper.getexceptiondata()
getcdef = t.annotator.bookkeeper.getuniqueclassdef
+ class_reprs = t.rtyper.class_reprs
#t.view()
ovferr_inst = excdata.fn_pyexcclass2exc(pyobjectptr(OverflowError))
classdef = getcdef(OverflowError)
- assert ovferr_inst.typeptr == t.rtyper.class_reprs[classdef].getvtable()
+ assert ovferr_inst.gettypeptr() == class_reprs[classdef].getvtable()
taberr_inst = excdata.fn_pyexcclass2exc(pyobjectptr(TabError))
classdef = getcdef(StandardError) # most precise class seen
- assert taberr_inst.typeptr == t.rtyper.class_reprs[classdef].getvtable()
+ assert taberr_inst.gettypeptr() == class_reprs[classdef].getvtable()
myerr_inst = excdata.fn_pyexcclass2exc(pyobjectptr(MyException))
- assert myerr_inst.typeptr == t.rtyper.class_reprs[None].getvtable()
+ assert myerr_inst.gettypeptr() == class_reprs[None].getvtable()
strgerr_inst = excdata.fn_pyexcclass2exc(pyobjectptr(MyStrangeException))
- assert strgerr_inst.typeptr == t.rtyper.class_reprs[None].getvtable()
+ assert strgerr_inst.gettypeptr() == class_reprs[None].getvtable()
class BaseTestException(BaseRtypingTest):
def test_exception_with_arg(self):
Modified: pypy/branch/unified-rtti/pypy/rpython/test/test_llann.py
==============================================================================
--- pypy/branch/unified-rtti/pypy/rpython/test/test_llann.py (original)
+++ pypy/branch/unified-rtti/pypy/rpython/test/test_llann.py Thu Feb 21 11:35:14 2008
@@ -341,18 +341,18 @@
assert s.items[1].const == 3
def test_getRuntimeTypeInfo(self):
- S = GcStruct('s', ('x', Signed))
- attachRuntimeTypeInfo(S)
+ rtti = malloc(RuntimeTypeInfo, immortal=True)
+ S = GcStruct('s', ('x', Signed), runtime_type_info = rtti)
def llf():
return getRuntimeTypeInfo(S)
s = self.annotate(llf, [])
assert isinstance(s, annmodel.SomePtr)
assert s.ll_ptrtype == Ptr(RuntimeTypeInfo)
- assert s.const == getRuntimeTypeInfo(S)
+ assert s.const == getRuntimeTypeInfo(S) == rtti
def test_runtime_type_info(self):
- S = GcStruct('s', ('x', Signed))
- attachRuntimeTypeInfo(S)
+ rtti = malloc(RuntimeTypeInfo, immortal=True)
+ S = GcStruct('s', ('x', Signed), runtime_type_info = rtti)
def llf(p):
return runtime_type_info(p)
s = self.annotate(llf, [annmodel.SomePtr(Ptr(S))])
Modified: pypy/branch/unified-rtti/pypy/rpython/test/test_nongc.py
==============================================================================
--- pypy/branch/unified-rtti/pypy/rpython/test/test_nongc.py (original)
+++ pypy/branch/unified-rtti/pypy/rpython/test/test_nongc.py Thu Feb 21 11:35:14 2008
@@ -66,17 +66,15 @@
assert (Bdef, 'raw') in rtyper.instance_reprs
assert (Bdef, 'gc') not in rtyper.instance_reprs
-def test_unsupported():
- class A:
+def test_nongc_str():
+ class AFooBar:
_alloc_flavor_ = "raw"
def f():
- return str(A())
- a = RPythonAnnotator()
- #does not raise:
- s = a.build_types(f, [])
- assert s.knowntype == str
- rtyper = RPythonTyper(a)
- py.test.raises(TypeError,rtyper.specialize) # results in an invalid cast
+ return str(AFooBar())
+ res = interpret(f, [])
+ res = ''.join(res.chars)
+ print res
+ assert 'AFooBar' in res
def test_isinstance():
class A:
Modified: pypy/branch/unified-rtti/pypy/rpython/test/test_rlist.py
==============================================================================
--- pypy/branch/unified-rtti/pypy/rpython/test/test_rlist.py (original)
+++ pypy/branch/unified-rtti/pypy/rpython/test/test_rlist.py Thu Feb 21 11:35:14 2008
@@ -496,8 +496,6 @@
return None
res = self.interpret(f, [1])
assert self.class_name(res) == 'A'
- #''.join(res.super.typeptr.name) == 'A\00'
-
def test_reverse(self):
def dummyfn():
Modified: pypy/branch/unified-rtti/pypy/rpython/test/tool.py
==============================================================================
--- pypy/branch/unified-rtti/pypy/rpython/test/tool.py (original)
+++ pypy/branch/unified-rtti/pypy/rpython/test/tool.py Thu Feb 21 11:35:14 2008
@@ -73,7 +73,7 @@
return fnptr._obj._callable
def class_name(self, value):
- return "".join(value.super.typeptr.name)[:-1]
+ return "".join(value.super.gettypeptr().name)[:-1]
def read_attr(self, value, attr_name):
value = value._obj
Modified: pypy/branch/unified-rtti/pypy/translator/c/gc.py
==============================================================================
--- pypy/branch/unified-rtti/pypy/translator/c/gc.py (original)
+++ pypy/branch/unified-rtti/pypy/translator/c/gc.py Thu Feb 21 11:35:14 2008
@@ -2,7 +2,7 @@
from pypy.translator.c.support import cdecl
from pypy.translator.c.node import ContainerNode
from pypy.rpython.lltypesystem.lltype import \
- typeOf, Ptr, ContainerType, RttiStruct, \
+ typeOf, Ptr, ContainerType, \
RuntimeTypeInfo, getRuntimeTypeInfo, top_container
from pypy.rpython.memory.gctransform import \
refcounting, boehm, framework, stacklessframework, llvmgcroot, asmgcroot
@@ -140,7 +140,7 @@
def __init__(self, db, T, obj):
assert T == RuntimeTypeInfo
- assert isinstance(obj.about, RttiStruct)
+ assert isinstance(obj.about, GcStruct)
self.db = db
self.T = T
self.obj = obj
@@ -221,7 +221,7 @@
def __init__(self, db, T, obj):
assert T == RuntimeTypeInfo
- assert isinstance(obj.about, RttiStruct)
+ assert isinstance(obj.about, GcStruct)
self.db = db
self.T = T
self.obj = obj
Modified: pypy/branch/unified-rtti/pypy/translator/c/node.py
==============================================================================
--- pypy/branch/unified-rtti/pypy/translator/c/node.py (original)
+++ pypy/branch/unified-rtti/pypy/translator/c/node.py Thu Feb 21 11:35:14 2008
@@ -1,7 +1,7 @@
from __future__ import generators
from pypy.rpython.lltypesystem.lltype import \
Struct, Array, FixedSizeArray, FuncType, PyObjectType, typeOf, \
- GcStruct, GcArray, RttiStruct, ContainerType, \
+ GcStruct, GcArray, ContainerType, \
parentlink, Ptr, PyObject, Void, OpaqueType, Float, \
RuntimeTypeInfo, getRuntimeTypeInfo, Char, _subarray
from pypy.rpython.lltypesystem import llmemory
@@ -95,7 +95,8 @@
self.gcinfo = None # unless overwritten below
rtti = None
STRUCT = self.STRUCT
- if isinstance(STRUCT, RttiStruct):
+ if isinstance(STRUCT, GcStruct):
+ XXX
try:
rtti = getRuntimeTypeInfo(STRUCT)
except ValueError:
More information about the Pypy-commit
mailing list