Author: Alex Gaynor <alex.gay...@gmail.com> Branch: precise-instantiate Changeset: r65362:73b667a788ed Date: 2013-07-12 12:29 +1000 http://bitbucket.org/pypy/pypy/changeset/73b667a788ed/
Log: Try to generate an indirect call with known graphs for instantiate on a ClassesPBC. diff --git a/rpython/jit/codewriter/test/test_effectinfo.py b/rpython/jit/codewriter/test/test_effectinfo.py --- a/rpython/jit/codewriter/test/test_effectinfo.py +++ b/rpython/jit/codewriter/test/test_effectinfo.py @@ -132,7 +132,6 @@ fgraph = graphof(t, func) return VirtualizableAnalyzer(t).analyze(fgraph.startblock.operations[0]) - @pytest.mark.xfail def test_constructor(self): class A(object): x = 1 diff --git a/rpython/rtyper/lltypesystem/rpbc.py b/rpython/rtyper/lltypesystem/rpbc.py --- a/rpython/rtyper/lltypesystem/rpbc.py +++ b/rpython/rtyper/lltypesystem/rpbc.py @@ -394,9 +394,12 @@ # no __init__ here, AbstractClassesPBCRepr.__init__ is good enough def _instantiate_runtime_class(self, hop, vtypeptr, r_instance): - from rpython.rtyper.lltypesystem.rbuiltin import ll_instantiate - v_inst1 = hop.gendirectcall(ll_instantiate, vtypeptr) - return hop.genop('cast_pointer', [v_inst1], resulttype = r_instance) + v_instantiate = hop.genop('getfield', [vtypeptr, hop.inputconst(Void, "instantiate")], resulttype=vtypeptr.concretetype.TO.instantiate) + possible_graphs = hop.inputconst(Void, + [desc.getclassdef(None).my_instantiate_graph for desc in self.s_pbc.descriptions] + ) + v_inst = hop.genop('indirect_call', [v_instantiate, possible_graphs], resulttype=vtypeptr.concretetype.TO.instantiate.TO.RESULT) + return hop.genop('cast_pointer', [v_inst], resulttype=r_instance) def getlowleveltype(self): return rclass.CLASSTYPE _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit