translation error on jit.unroll_safe with jit_libffi

I'm in the process of adding FFI to pixie. It translates and runs fine (I'm sure there's still bugs). But the trace is a bit verbose, so I decided I'd unroll the loop that packs the arguments in the exchange buffer. However then I get this error: [translation:info] File "<388-codegen /Users/tim/oss-not-dropbox/externals/pypy/rpython/rtyper/rtyper.py:540>", line 4, in translate_op_call_args [translation:info] return r_arg1.rtype_call_args(hop) [translation:info] File "/Users/tim/oss-not-dropbox/externals/pypy/rpython/rtyper/rpbc.py", line 659, in rtype_call_args [translation:info] return self.redispatch_call(hop, call_args=True) [translation:info] File "/Users/tim/oss-not-dropbox/externals/pypy/rpython/rtyper/rpbc.py", line 686, in redispatch_call [translation:info] hop.llops, hop) [translation:info] File "/Users/tim/oss-not-dropbox/externals/pypy/rpython/rtyper/rclass.py", line 1075, in rtype_new_instance [translation:info] return rinstance.new_instance(llops, classcallhop) [translation:info] File "/Users/tim/oss-not-dropbox/externals/pypy/rpython/rtyper/rclass.py", line 715, in new_instance [translation:info] r.convert_desc_or_const(value)) [translation:info] File "/Users/tim/oss-not-dropbox/externals/pypy/rpython/rtyper/rmodel.py", line 115, in convert_desc_or_const [translation:info] return self.convert_const(desc_or_const.value) [translation:info] File "/Users/tim/oss-not-dropbox/externals/pypy/rpython/rtyper/lltypesystem/rpbc.py", line 158, in convert_const [translation:info] funcdesc = self.rtyper.annotator.bookkeeper.getdesc(value) [translation:info] File "/Users/tim/oss-not-dropbox/externals/pypy/rpython/annotator/bookkeeper.py", line 396, in getdesc [translation:info] raise Exception("%s: %r" % (msg, pyobj)) [translation:ERROR] Exception: unexpected prebuilt constant: <staticmethod object at 0x10a8d5bb0> The line I'm un-commenting is here: https://github.com/pixie-lang/pixie/blob/master/pixie/vm/libs/ffi.py#L150
Timothy

Hi, On 25 October 2014 10:10, Maciej Fijalkowski <fijall@gmail.com> wrote:
I would not be surprised if static methods are simply unsupported by the JIT (but likely for no good reason)
That's not a crash of the JIT:
What is unsupported at all is staticmethod objects in RPython. I have no clue why uncommenting that jit.unroll_safe makes the annotator sees some staticmethod object... You have to figure out what this pyobj is. A bientôt, Armin.

On 25/10/14 14:24, Armin Rigo wrote:
I don't understand what you mean by "staticmethod objects" being unsupported. We use staticmethod a bit everywhere in PyPy, no? Anyway, I tried to run translation of pixie to debug the error, and am getting this problem: https://bpaste.net/show/4eb70f41ce44 (which is unrelated) Cheers, Carl Friedrich

Hi Carl Friedrich, On 25 October 2014 14:42, Carl Friedrich Bolz <cfbolz@gmx.de> wrote:
I don't understand what you mean by "staticmethod objects" being unsupported. We use staticmethod a bit everywhere in PyPy, no?
Unsupported as in "asking the bookkeeper for a desc for a staticmethod object is not supported and will crash as reported". For the common use case of staticmethod objects which come out of classes, and are read as normal functions, there is a special case in description.py. A bientôt, Armin.

Hi Armin, OK, that's a very nice statement for people that know the internals of the annotator, but for not really helpful for people like me who don't ;-). What does that mean on the language level? How do you 'ask the bookkeeper for a desc'? Maybe we can document that somewhere, or improve the error message. Cheers, Carl Friedrich On October 25, 2014 2:55:34 PM CEST, Armin Rigo <arigo@tunes.org> wrote:

Hi Carl Friedrich, On 25 October 2014 15:00, Carl Friedrich Bolz <cfbolz@gmx.de> wrote:
Sorry :-) We have some staticmethod object that comes from somewhere unexpected. That's all I can guess by seeing Timothy's partial traceback. I only mentioned this because Maciej's two-lines message was IMHO mistaken, to avoid that Timothy or someone else spends time looking at the wrong place. I would need to reproduce the crash to know more precisely, but your experience with trying to do so discourages me from trying :-) A bientôt, Armin.

If you get latest, you should be able to get the PBC error on linux now. I mostly develop on OSX so that was an error I needed to fix for the Linux people. Timothy On Sat, Oct 25, 2014 at 7:06 AM, Armin Rigo <arigo@tunes.org> wrote:
-- “One of the main causes of the fall of the Roman Empire was that–lacking zero–they had no way to indicate successful termination of their C programs.” (Robert Firth)

Hi, On 25 October 2014 10:10, Maciej Fijalkowski <fijall@gmail.com> wrote:
I would not be surprised if static methods are simply unsupported by the JIT (but likely for no good reason)
That's not a crash of the JIT:
What is unsupported at all is staticmethod objects in RPython. I have no clue why uncommenting that jit.unroll_safe makes the annotator sees some staticmethod object... You have to figure out what this pyobj is. A bientôt, Armin.

On 25/10/14 14:24, Armin Rigo wrote:
I don't understand what you mean by "staticmethod objects" being unsupported. We use staticmethod a bit everywhere in PyPy, no? Anyway, I tried to run translation of pixie to debug the error, and am getting this problem: https://bpaste.net/show/4eb70f41ce44 (which is unrelated) Cheers, Carl Friedrich

Hi Carl Friedrich, On 25 October 2014 14:42, Carl Friedrich Bolz <cfbolz@gmx.de> wrote:
I don't understand what you mean by "staticmethod objects" being unsupported. We use staticmethod a bit everywhere in PyPy, no?
Unsupported as in "asking the bookkeeper for a desc for a staticmethod object is not supported and will crash as reported". For the common use case of staticmethod objects which come out of classes, and are read as normal functions, there is a special case in description.py. A bientôt, Armin.

Hi Armin, OK, that's a very nice statement for people that know the internals of the annotator, but for not really helpful for people like me who don't ;-). What does that mean on the language level? How do you 'ask the bookkeeper for a desc'? Maybe we can document that somewhere, or improve the error message. Cheers, Carl Friedrich On October 25, 2014 2:55:34 PM CEST, Armin Rigo <arigo@tunes.org> wrote:

Hi Carl Friedrich, On 25 October 2014 15:00, Carl Friedrich Bolz <cfbolz@gmx.de> wrote:
Sorry :-) We have some staticmethod object that comes from somewhere unexpected. That's all I can guess by seeing Timothy's partial traceback. I only mentioned this because Maciej's two-lines message was IMHO mistaken, to avoid that Timothy or someone else spends time looking at the wrong place. I would need to reproduce the crash to know more precisely, but your experience with trying to do so discourages me from trying :-) A bientôt, Armin.

If you get latest, you should be able to get the PBC error on linux now. I mostly develop on OSX so that was an error I needed to fix for the Linux people. Timothy On Sat, Oct 25, 2014 at 7:06 AM, Armin Rigo <arigo@tunes.org> wrote:
-- “One of the main causes of the fall of the Roman Empire was that–lacking zero–they had no way to indicate successful termination of their C programs.” (Robert Firth)
participants (4)
-
Armin Rigo
-
Carl Friedrich Bolz
-
Maciej Fijalkowski
-
Timothy Baldridge