On 30 November 2010 14:53, Mariano Martinez Peck <marianopeck@gmail.com> wrote:
On Tue, Nov 30, 2010 at 12:52 PM, Levente Uzonyi <leves@elte.hu> wrote:
On Tue, 30 Nov 2010, Mariano Martinez Peck wrote:
On Sun, Nov 21, 2010 at 5:31 PM, Igor Stasenko <siguctua@gmail.com> wrote:
Obviously you can't having a single object representation (a tagged machine word with lowest bit set) and have two different classes for it.
Yes, that's true. The thing is that I have a big problem using SmallInteger as proxies....So far I always used a subclass of ProtoObject for the proxies. This is cool because most of the messages are not understood by ProtoObject, thus I can intercept most messages. Now, the problem using SmallInteger as proxies is that there are several methods that ARE understood by both. This is a big problem because the original CompiledMethod is not installed, and the method answers but with a different value.
For example, suppose I do something like this:
MyClass methodDict at: #foo put: 5. (MyClass >> #foo) size
In this case, I would like that size is NOT understood by the proxy and that loads back the original compiled method. But this is not the case since SmallIngeger DOES understand the message #size. Thus, it answers...and something different than the size of the compiled method...
That's why you should change MethodDictionary >> #at:ifAbsent: to load the CompiledMethod and return that instead of the integer.
Uffff sorry Levente. You are totally right. I forgot we already discussed this... Even more, now I checked my MethodDictionary #at:ifAbsent:Â and I have:
at: key ifAbsent: aBlock
   | index value |    index := self findElementOrNil: key.    (self basicAt: index) == nil ifTrue: [ ^ aBlock value ].    value := array at: index.    "(value isProxy) ifTrue: [value mareaUninstall]."    ^ array at: index
.. and then you need to change #do: , #associationsDo: etc etc..
notice the comment ;)
Thanks!!!
Mariano
Levente
So in summary I have problems with all methods that are understood by both, even all those in Object I think...
Best regards,
Mariano
On 21 November 2010 16:51, Mariano Martinez Peck <marianopeck@gmail.com> wrote:
On Sun, Nov 21, 2010 at 12:13 AM, Levente Uzonyi <leves@elte.hu> wrote:
On Sat, 20 Nov 2010, Mariano Martinez Peck wrote:
On Sat, Nov 20, 2010 at 5:41 PM, Levente Uzonyi <leves@elte.hu> wrote:
The only problem is that you can't swap-out a method that's used by
the
swap-in code.
Yes, but that's easy to solve. Before swapping everything, I "simulate" the swapping of a dummy CompiledMethod. During that, I mark all the CompiledMethods that were used to perform that. And then, I exclude
those
objects from being swapped :)
That won't work, because during the simulation you'll only try a single execution path. Swapping in a real method may invoke methods that
weren't
used during the simulation. For example my implementation uses
#storeString
to serialize the methods and Compiler >> #evaluate: to deserialize them.
So
during deserialization a lot of different methods may be invoked.
Ahhh I got it....
Are you using Cog? Â because with the SmallInteger I have the problem I described with #run:with:in:
Last question....to use SmallIntegers, I need to put some methods in SmallInteger, like #run:with:in: Â , #doesNotUnderstand: , Â and all the methods related to writing and loading back the original compiledMethod.
Of
course I can put all those methods under a category  *MyProxyPackage  ... but I was thinking if there is another way. I would love to have MySmallIntegerProxy that extends from ProtoObject (because I want my
proxy
to understand as less messages as possible) and that is threated by the
VM
like a SmallInetger, I mean, that it directly stores the number value in
the
address, and put the last bit in 1.
Is this possible? how much work can it be?
Thanks in advance,
Mariano
-- Best regards, Igor Stasenko AKA sig.
-- Best regards, Igor Stasenko AKA sig.