Re: [pypy-svn] r13653 - pypy/dist/pypy/rpython[POSSIBLE SPAM]

Hi Armin,
Not sure if it was this changelist, but you are new generating c with nested comments, which doesn't seem to be allowed by all compilers.
e.g.
/* /* nothing */ = v106238->z_cls_my_method; */
Cheers, Ben
pypy-svn-bounces@codespeak.net wrote on 21/06/2005 12:48:42:
Author: arigo Date: Tue Jun 21 13:48:41 2005 New Revision: 13653
Modified: pypy/dist/pypy/rpython/rpbc.py pypy/dist/pypy/rpython/rtyper.py Log:
- Method calls sanitization, by falling back to function calls code.
- Nicer error message for hop.inputarg() argument count mismatch.
Modified: pypy/dist/pypy/rpython/rpbc.py
==============================================================================
--- pypy/dist/pypy/rpython/rpbc.py (original) +++ pypy/dist/pypy/rpython/rpbc.py Tue Jun 21 13:48:41 2005 @@ -355,30 +355,26 @@ "methods can be found: %r" % ( s_pbc.prebuiltinstances,)) # the low-level representation is just the bound 'self'
argument.
self.r_instance = rclass.getinstancerepr(rtyper, self.classdef)
self.lowleveltype = self.r_instance.lowleveltype
self.s_im_self = annmodel.SomeInstance(self.classdef)
self.r_im_self = rclass.getinstancerepr(rtyper, self.classdef)
self.lowleveltype = self.r_im_self.lowleveltype
def rtype_simple_call(self, hop):
# XXX the graph of functions used as methods may need to be
hacked
# XXX so that its 'self' argument accepts a pointer to an
instance of
# XXX the common base class. This is needed to make the
direct_call
# XXX below well-typed.
r_class = self.r_instance.rclass
r_class = self.r_im_self.rclass mangled_name, r_func = r_class.clsfields[self.methodname] assert isinstance(r_func, FunctionsPBCRepr)
#
# XXX try to unify with FunctionsPBCRepr.rtype_simple_call()
f, rinputs, rresult =
r_func.function_signatures.itervalues().next()
vlist = hop.inputargs(self, *rinputs[1:]) # ignore the
self from r_func
if r_func.lowleveltype == Void:
assert len(r_func.function_signatures) == 1
vfunc = hop.inputconst(typeOf(f), f)
else:
vinst = vlist[0]
vcls = self.r_instance.getfield(vinst, '__class__',
hop.llops)
vfunc = r_class.getclsfield(vcls, self.methodname,
hop.llops)
vlist.insert(0, vfunc)
return hop.genop('direct_call', vlist, resulttype = rresult)
s_func = r_func.s_pbc
hop2 = hop.copy()
hop2.args_s[0] = self.s_im_self # make the 1st arg stand
for 'im_self'
hop2.args_r[0] = self.r_im_self # (same lowleveltype as
'self')
v_im_self = hop.inputarg(self, arg=0)
v_cls = self.r_im_self.getfield(v_im_self, '__class__',
hop.llops)
v_func = r_class.getclsfield(v_cls, self.methodname, hop.llops)
hop2.v_s_insertfirstarg(v_func, s_func) # insert 'function'
# now hop2 looks like simple_call(function, self, args...)
return hop2.dispatch()
# ____________________________________________________________
Modified: pypy/dist/pypy/rpython/rtyper.py
==============================================================================
--- pypy/dist/pypy/rpython/rtyper.py (original) +++ pypy/dist/pypy/rpython/rtyper.py Tue Jun 21 13:48:41 2005 @@ -417,9 +417,10 @@ inputconst = staticmethod(inputconst) # export via the HighLevelOp class
def inputargs(self, *converted_to):
assert len(converted_to) == self.nb_args, (
"operation argument count mismatch: '%s' has %d arguments"
% (
self.spaceop.opname, self.nb_args))
if len(converted_to) != self.nb_args:
raise TyperError("operation argument count mismatch:\n"
"'%s' has %d arguments, rtyper wants %d" %
(
self.spaceop.opname, self.nb_args, len(converted_to))) vars = [] for i in range(len(converted_to)): vars.append(self.inputarg(converted_to[i], i))
pypy-svn mailing list pypy-svn@codespeak.net http://codespeak.net/mailman/listinfo/pypy-svn

Ben.Young@risk.sungard.com wrote:
Hi Armin,
Not sure if it was this changelist, but you are new generating c with nested comments, which doesn't seem to be allowed by all compilers.
e.g.
/* /* nothing */ = v106238->z_cls_my_method; */
this has just been fixed. Some tests failure were indeed provoked by it.
Cheers, Ben
pypy-svn-bounces@codespeak.net wrote on 21/06/2005 12:48:42:
Author: arigo Date: Tue Jun 21 13:48:41 2005 New Revision: 13653
Modified: pypy/dist/pypy/rpython/rpbc.py pypy/dist/pypy/rpython/rtyper.py Log:
- Method calls sanitization, by falling back to function calls code.
- Nicer error message for hop.inputarg() argument count mismatch.
Modified: pypy/dist/pypy/rpython/rpbc.py
==============================================================================
--- pypy/dist/pypy/rpython/rpbc.py (original) +++ pypy/dist/pypy/rpython/rpbc.py Tue Jun 21 13:48:41 2005 @@ -355,30 +355,26 @@ "methods can be found: %r" % ( s_pbc.prebuiltinstances,)) # the low-level representation is just the bound 'self'
argument.
self.r_instance = rclass.getinstancerepr(rtyper, self.classdef)
self.lowleveltype = self.r_instance.lowleveltype
self.s_im_self = annmodel.SomeInstance(self.classdef)
self.r_im_self = rclass.getinstancerepr(rtyper, self.classdef)
self.lowleveltype = self.r_im_self.lowleveltype
def rtype_simple_call(self, hop):
# XXX the graph of functions used as methods may need to be
hacked
# XXX so that its 'self' argument accepts a pointer to an
instance of
# XXX the common base class. This is needed to make the
direct_call
# XXX below well-typed.
r_class = self.r_instance.rclass
r_class = self.r_im_self.rclass mangled_name, r_func = r_class.clsfields[self.methodname] assert isinstance(r_func, FunctionsPBCRepr)
#
# XXX try to unify with FunctionsPBCRepr.rtype_simple_call()
f, rinputs, rresult =
r_func.function_signatures.itervalues().next()
vlist = hop.inputargs(self, *rinputs[1:]) # ignore the
self from r_func
if r_func.lowleveltype == Void:
assert len(r_func.function_signatures) == 1
vfunc = hop.inputconst(typeOf(f), f)
else:
vinst = vlist[0]
vcls = self.r_instance.getfield(vinst, '__class__',
hop.llops)
vfunc = r_class.getclsfield(vcls, self.methodname,
hop.llops)
vlist.insert(0, vfunc)
return hop.genop('direct_call', vlist, resulttype = rresult)
s_func = r_func.s_pbc
hop2 = hop.copy()
hop2.args_s[0] = self.s_im_self # make the 1st arg stand
for 'im_self'
hop2.args_r[0] = self.r_im_self # (same lowleveltype as
'self')
v_im_self = hop.inputarg(self, arg=0)
v_cls = self.r_im_self.getfield(v_im_self, '__class__',
hop.llops)
v_func = r_class.getclsfield(v_cls, self.methodname, hop.llops)
hop2.v_s_insertfirstarg(v_func, s_func) # insert 'function'
# now hop2 looks like simple_call(function, self, args...)
return hop2.dispatch()
# ____________________________________________________________
Modified: pypy/dist/pypy/rpython/rtyper.py
==============================================================================
--- pypy/dist/pypy/rpython/rtyper.py (original) +++ pypy/dist/pypy/rpython/rtyper.py Tue Jun 21 13:48:41 2005 @@ -417,9 +417,10 @@ inputconst = staticmethod(inputconst) # export via the HighLevelOp class
def inputargs(self, *converted_to):
assert len(converted_to) == self.nb_args, (
"operation argument count mismatch: '%s' has %d arguments"
% (
self.spaceop.opname, self.nb_args))
if len(converted_to) != self.nb_args:
raise TyperError("operation argument count mismatch:\n"
"'%s' has %d arguments, rtyper wants %d" %
(
self.spaceop.opname, self.nb_args, len(converted_to))) vars = [] for i in range(len(converted_to)): vars.append(self.inputarg(converted_to[i], i))
pypy-svn mailing list pypy-svn@codespeak.net http://codespeak.net/mailman/listinfo/pypy-svn
pypy-dev@codespeak.net http://codespeak.net/mailman/listinfo/pypy-dev
participants (2)
-
Ben.Young@risk.sungard.com
-
Samuele Pedroni