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 <tbaldri...@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
_______________________________________________ pypy-dev mailing list pypy-dev@python.org https://mail.python.org/mailman/listinfo/pypy-dev