RE: Re[2]: Mutable Bytes
"Mark Hahn" <[email protected]> Mon, 26 Jul 2004 21:35:03 -0700
| Newsgroups | gmane.comp.lang.prothon.user |
|---|---|
| Message-ID | <000301c47393$16580330$0d01a8c0@MarkVaio> |
Lenard Lindstrom wrote: > > By the way, I think you are getting your wish. I am in the > middle of > > restructuring my objects for the new copying garbage collector and > > binary-data is stored directly inside objects now instead of being > > linked to in a separate malloc. Every function is copied > before it is > > called and my old way of storing the bytecodes in the binary-data > > section of an object is now inefficient because the > bytecodes would be > > copied on every call. Having the bytcodes in a separate > Bytes object > > would mean the shallow function copy wouldn't have to copy the > > bytecodes on every call. So I'm moving the bytecodes to an > attrbiute > > of the function like you have always said it should be. > > > It was only a suggestion so the disassembler can be written > in Prothon. Beyond that unless one can actually execute > custom created bytecode strings it is of little use. If you can stuff the bytecodes into an attribute of a function and call the function then you would be executing the bytecodes. > > Another change I am mentioning in my talk is on my to-do list. The > > scope object for functions will now be the actual function object > > itself. So all local variables will be attributes of the function > > also. This means every attribute like fParams_ better have the > > trailing underbar. :-) > > > What if the function is called recursively or from more than > one thread at the same time? Each call gets it's own unique shallow copy of the function so it would start fresh with just the fParams_, name_, prevScope_, and actual params. Functions have been copied when called for some time. Greg asked why and I cannot remember. I'm trying to find the old messages.