I'm in the process of tuning my JIT, and thus far it's going pretty well. However I can't mark the args in my Frame object a virtualizable array, because doing so throws this exception: [translation:info] File "/Users/tim/Dropbox/oss/pypy/rpython/jit/metainterp/warmspot.py", line 477, in make_virtualizable_infos [translation:info] vinfos[VTYPEPTR] = VirtualizableInfo(self, VTYPEPTR) [translation:info] File "/Users/tim/Dropbox/oss/pypy/rpython/jit/metainterp/virtualizable.py", line 52, in __init__ [translation:info] assert isinstance(ARRAY, lltype.GcArray) Digging into it I see that ARRAY is: <GcStruct list { length, items }>-- That makes me think that there's something I'm doing to my list of args that's flagging it as a list instead of a GcArray? Before I go and rework how args are handled in my interpreter I'd like a bit more information about what could be going on here. For the record, I make sure that every access to my args array is inside the valid range of the array, and is always a positive value. I'm then marking it as "args[*]" in my virtualizables. If I remove the [*] it translates fine, but then allocates a list on every invocation of an interpreter function. Thanks for all the help this far, my interpreter is coming along nicely. Timothy Baldridge
Lists are resizable, GcArray are not. A Python "list" object will become a GcArray automatically if you never call a method that can resize it, such as append. Basically for it to be a GcArray you should allocate it with [None] * n, and then only use __setitem__ and __getitem__. Cheers, Alex On Sat, Oct 11, 2014 at 8:08 AM, Timothy Baldridge <tbaldridge@gmail.com> wrote:
I'm in the process of tuning my JIT, and thus far it's going pretty well. However I can't mark the args in my Frame object a virtualizable array, because doing so throws this exception:
[translation:info] File "/Users/tim/Dropbox/oss/pypy/rpython/jit/metainterp/warmspot.py", line 477, in make_virtualizable_infos [translation:info] vinfos[VTYPEPTR] = VirtualizableInfo(self, VTYPEPTR) [translation:info] File "/Users/tim/Dropbox/oss/pypy/rpython/jit/metainterp/virtualizable.py", line 52, in __init__ [translation:info] assert isinstance(ARRAY, lltype.GcArray)
Digging into it I see that ARRAY is: <GcStruct list { length, items }>--
That makes me think that there's something I'm doing to my list of args that's flagging it as a list instead of a GcArray? Before I go and rework how args are handled in my interpreter I'd like a bit more information about what could be going on here.
For the record, I make sure that every access to my args array is inside the valid range of the array, and is always a positive value. I'm then marking it as "args[*]" in my virtualizables.
If I remove the [*] it translates fine, but then allocates a list on every invocation of an interpreter function.
Thanks for all the help this far, my interpreter is coming along nicely.
Timothy Baldridge
_______________________________________________ pypy-dev mailing list pypy-dev@python.org https://mail.python.org/mailman/listinfo/pypy-dev
-- "I disapprove of what you say, but I will defend to the death your right to say it." -- Evelyn Beatrice Hall (summarizing Voltaire) "The people's good is the highest law." -- Cicero GPG Key fingerprint: 125F 5C67 DFE9 4084
Awesome, thanks, that's exactly what I was thinking. I'll audit my code for such usages and see if that helps. Timothy On Sat, Oct 11, 2014 at 9:14 AM, Alex Gaynor <alex.gaynor@gmail.com> wrote:
Lists are resizable, GcArray are not. A Python "list" object will become a GcArray automatically if you never call a method that can resize it, such as append. Basically for it to be a GcArray you should allocate it with [None] * n, and then only use __setitem__ and __getitem__.
Cheers, Alex
On Sat, Oct 11, 2014 at 8:08 AM, Timothy Baldridge <tbaldridge@gmail.com> wrote:
I'm in the process of tuning my JIT, and thus far it's going pretty well. However I can't mark the args in my Frame object a virtualizable array, because doing so throws this exception:
[translation:info] File "/Users/tim/Dropbox/oss/pypy/rpython/jit/metainterp/warmspot.py", line 477, in make_virtualizable_infos [translation:info] vinfos[VTYPEPTR] = VirtualizableInfo(self, VTYPEPTR) [translation:info] File "/Users/tim/Dropbox/oss/pypy/rpython/jit/metainterp/virtualizable.py", line 52, in __init__ [translation:info] assert isinstance(ARRAY, lltype.GcArray)
Digging into it I see that ARRAY is: <GcStruct list { length, items }>--
That makes me think that there's something I'm doing to my list of args that's flagging it as a list instead of a GcArray? Before I go and rework how args are handled in my interpreter I'd like a bit more information about what could be going on here.
For the record, I make sure that every access to my args array is inside the valid range of the array, and is always a positive value. I'm then marking it as "args[*]" in my virtualizables.
If I remove the [*] it translates fine, but then allocates a list on every invocation of an interpreter function.
Thanks for all the help this far, my interpreter is coming along nicely.
Timothy Baldridge
_______________________________________________ pypy-dev mailing list pypy-dev@python.org https://mail.python.org/mailman/listinfo/pypy-dev
-- "I disapprove of what you say, but I will defend to the death your right to say it." -- Evelyn Beatrice Hall (summarizing Voltaire) "The people's good is the highest law." -- Cicero GPG Key fingerprint: 125F 5C67 DFE9 4084
-- “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 Timothy, On 11 October 2014 17:18, Timothy Baldridge <tbaldridge@gmail.com> wrote:
Awesome, thanks, that's exactly what I was thinking. I'll audit my code for such usages and see if that helps.
An automated way to do that is to use rpython.rlib.debug.make_sure_not_resized() on the frame's attribute. Maybe we should automatically add such a call early, for any list in _virtualizable_, instead of crashing later as you reported. A bientôt, Armin.
participants (3)
-
Alex Gaynor
-
Armin Rigo
-
Timothy Baldridge