[pypy-svn] r20303 - in pypy/branch/somepbc-refactoring/pypy/rpython: . lltypesystem test
pedronis at codespeak.net
pedronis at codespeak.net
Sun Nov 27 03:41:12 CET 2005
Author: pedronis
Date: Sun Nov 27 03:41:10 2005
New Revision: 20303
Modified:
pypy/branch/somepbc-refactoring/pypy/rpython/lltypesystem/rclass.py
pypy/branch/somepbc-refactoring/pypy/rpython/rmodel.py
pypy/branch/somepbc-refactoring/pypy/rpython/rtyper.py
pypy/branch/somepbc-refactoring/pypy/rpython/test/test_nongc.py
pypy/branch/somepbc-refactoring/pypy/rpython/test/test_rptr.py
Log:
re-enable attachRuntimeTypeInfoFunc
fixes to pass entirely test_nongc and test_rptr
Modified: pypy/branch/somepbc-refactoring/pypy/rpython/lltypesystem/rclass.py
==============================================================================
--- pypy/branch/somepbc-refactoring/pypy/rpython/lltypesystem/rclass.py (original)
+++ pypy/branch/somepbc-refactoring/pypy/rpython/lltypesystem/rclass.py Sun Nov 27 03:41:10 2005
@@ -340,7 +340,7 @@
return getinstancerepr(self.rtyper, None, nogc=not self.needsgc)
def getflavor(self):
- return self.classdef.classdesc.read_attribute('_alloc_flavor', Constant('gc')).value
+ return self.classdef.classdesc.read_attribute('_alloc_flavor_', Constant('gc')).value
def convert_const(self, value):
if value is None:
Modified: pypy/branch/somepbc-refactoring/pypy/rpython/rmodel.py
==============================================================================
--- pypy/branch/somepbc-refactoring/pypy/rpython/rmodel.py (original)
+++ pypy/branch/somepbc-refactoring/pypy/rpython/rmodel.py Sun Nov 27 03:41:10 2005
@@ -341,7 +341,7 @@
return not nogc
else:
classdesc = classdef.classdesc
- alloc_flavor = classdesc.read_attribute('_alloc_flavor',
+ alloc_flavor = classdesc.read_attribute('_alloc_flavor_',
Constant('gc')).value
return alloc_flavor.startswith('gc')
Modified: pypy/branch/somepbc-refactoring/pypy/rpython/rtyper.py
==============================================================================
--- pypy/branch/somepbc-refactoring/pypy/rpython/rtyper.py (original)
+++ pypy/branch/somepbc-refactoring/pypy/rpython/rtyper.py Sun Nov 27 03:41:10 2005
@@ -552,18 +552,18 @@
return self.getfunctionptr(spec_function)
def attachRuntimeTypeInfoFunc(self, GCSTRUCT, func, ARG_GCSTRUCT=None):
- return # FIXME
self.call_all_setups() # compute ForwardReferences now
if ARG_GCSTRUCT is None:
ARG_GCSTRUCT = GCSTRUCT
args_s = [annmodel.SomePtr(Ptr(ARG_GCSTRUCT))]
- s, spec_function = annotate_lowlevel_helper(self.annotator,
- func, args_s)
+ graph = annotate_lowlevel_helper(self.annotator,
+ func, args_s)
+ s = self.annotator.binding(graph.getreturnvar())
if (not isinstance(s, annmodel.SomePtr) or
s.ll_ptrtype != Ptr(RuntimeTypeInfo)):
raise TyperError("runtime type info function %r returns %r, "
"excepted Ptr(RuntimeTypeInfo)" % (func, s))
- funcptr = self.getfunctionptr(spec_function)
+ funcptr = self.getcallable(graph)
attachRuntimeTypeInfo(GCSTRUCT, funcptr)
# ____________________________________________________________
Modified: pypy/branch/somepbc-refactoring/pypy/rpython/test/test_nongc.py
==============================================================================
--- pypy/branch/somepbc-refactoring/pypy/rpython/test/test_nongc.py (original)
+++ pypy/branch/somepbc-refactoring/pypy/rpython/test/test_nongc.py Sun Nov 27 03:41:10 2005
@@ -35,10 +35,10 @@
a = RPythonAnnotator()
#does not raise:
s = a.build_types(f, [])
- assert s.knowntype == A
+ Adef = a.bookkeeper.getuniqueclassdef(A)
+ assert s.knowntype == Adef
rtyper = RPythonTyper(a)
rtyper.specialize()
- Adef = rtyper.annotator.getuserclasses()[A]
assert (Adef, False) in rtyper.instance_reprs
assert (Adef, True) not in rtyper.instance_reprs
@@ -53,13 +53,13 @@
a = RPythonAnnotator()
#does not raise:
s = a.build_types(f, [])
- assert s.knowntype == B
+ Adef = a.bookkeeper.getuniqueclassdef(A)
+ Bdef = a.bookkeeper.getuniqueclassdef(B)
+ assert s.knowntype == Bdef
rtyper = RPythonTyper(a)
rtyper.specialize()
- Adef = rtyper.annotator.getuserclasses()[A]
assert (Adef, False) in rtyper.instance_reprs
assert (Adef, True) not in rtyper.instance_reprs
- Bdef = rtyper.annotator.getuserclasses()[B]
assert (Bdef, False) in rtyper.instance_reprs
assert (Bdef, True) not in rtyper.instance_reprs
Modified: pypy/branch/somepbc-refactoring/pypy/rpython/test/test_rptr.py
==============================================================================
--- pypy/branch/somepbc-refactoring/pypy/rpython/test/test_rptr.py (original)
+++ pypy/branch/somepbc-refactoring/pypy/rpython/test/test_rptr.py Sun Nov 27 03:41:10 2005
@@ -9,7 +9,8 @@
def ll_rtype(llfn, argtypes=[]):
a = RPythonAnnotator()
- s, dontcare = annotate_lowlevel_helper(a, llfn, argtypes)
+ graph = annotate_lowlevel_helper(a, llfn, argtypes)
+ s = a.binding(graph.getreturnvar())
t = a.translator
typer = RPythonTyper(a)
typer.specialize()
More information about the Pypy-commit
mailing list