[Pharo-project] Ideas for CompiledMethod proxies?
Mariano Martinez Peck
marianopeck at gmail.com
Sat Nov 20 16:51:31 CET 2010
On Sat, Nov 20, 2010 at 12:34 PM, Levente Uzonyi <leves at elte.hu> wrote:
> On Fri, 19 Nov 2010, Mariano Martinez Peck wrote:
> In a 15MB image all CompiledMethods use only ~3MB, so this technique won't
> save much space IMHO.
mmmmm I thought it was muuuch more. How are you measuring those 3mb ? Only
the compiled method bytearray or also the literals? Because if you take into
account all the ByteSymbol instances of literals for example, the size can
> To minimize the space usage, use SmallIntegers as proxies. To avoid the
> (Object >> #hash) literals
#literals was an example, but the same happens with all the methods
implemented in CompiledMethod.
> problem swap back the real method in MethodDictionary >> #at:ifAbsent:.
Yes, actually Luc had this idea too. I should also modify (or implement)
#at: and friends
What I was afraid is if the VM directly access to them and I cannot
interpret them. Is this possible? I think the vm access them but only when
executing them....where in such case, it will end up with a #run:with:in,
which is perfect for me.
A SmallInteger has 31 bits which can easily identify the file index and
> position where the swapped out method is. For example you can use 7 bits for
> index and 24 bits for position. That allows you to have 128 files which can
> hold 16MB data each.
> Or you can store a single method in a file, this way the SmallInteger
> identifies the file.
Yes, exactly :)
Thanks Levente. I like this idea. I've been doing proxies for classes,
normal objects, etc and I never thought about using SmallIntegers. This is
because I usually need to do a #become: between the original object and
the proxy. But in this case this is not needed, since I just need a
methodDict at: put: . And this is a good idea because I don't need an
object header per proxy instance.
I will try to implement this. Thank you very much for all the answers.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Pharo-project