[Vm-dev] Re: SmallInetger as methods was not ready yet....now maybe?

Mariano Martinez Peck marianopeck at gmail.com
Mon Dec 6 09:03:50 UTC 2010


On Fri, Dec 3, 2010 at 11:12 PM, Levente Uzonyi <leves at elte.hu> wrote:

>
> On Fri, 3 Dec 2010, stephane ducasse wrote:
>
>
>>
>> On Dec 3, 2010, at 7:02 PM, Andreas Raab wrote:
>>
>>  maybe supporting SmallInteger as methods was not a good idea :(
>>>>
>>>
>>> FWIW, Objects as methods weren't intended for SmallInts; they were
>>> intended for stuff like method wrappers. Using SmallIntegers for methods is
>>> a hack and I'm not surprised it doesn't work.
>>>
>>
>> Me too. They were worked well for normal objects. This is good and
>> valuable hook.
>>
>>  But it is easy to fix - just wrap your ints into something else and
>>> you're good to go.
>>>
>>
>> It does not work in mariano special need because the idea was to push as
>> far as possible the idea that we do not have to allocate any new objects and
>> avoid any proxy memory allocation cost. So clearly this is may be a too
>> hackish hack. Else a plain simple (but allocating memory proxy works well
>> but we wanted to know what is the lowest boundary).
>>
>
> I have a working package that can swap out CompiledMethods and replace them
> with SmallIntegers in the MethodDictionaries. When the method is about to be
> used by the system, the CompiledMethod is automatically swapped back. It
> uses the existing ObjectsAsMethods implementation, so I say that
> SmallIntegers can be used like any other object in this regard.


Thanks Levente. I did more or less the same. In addition, I did some
modifications to the VM to mark objects usage, in order to be able to
automatically swap out "unused objects".
All these changes, I did it in normal SqueakVM, and this is why I am using
such VM. I was just checking Cog and seems it supports much more these
problems.
For example, what I said in the first mail of this thread: when Interpreter
does the #markAndTraceInterpreterOops:    and tries to do  self
markAndTrace: newMethod.

That, in SqueakVM crash (as explained in my first email). However, in Cog,
it does:


| header lastFieldOffset action |
    self assert: (self addressCouldBeObjWhileForwarding: oop).
    header := self longAt: oop.


notice that assert.  So...I guess Cog is more prepare to supports
non-objects for methods.

Eliot, can you confirm that?

I couldn't even compile Cog but now JB gave me some hints....so maybe I will
try to give it a shoot and see what happens.


Thanks Levente.

Mariano

I didn't test it with SqueakVM, but it definitely works with CogVM.
>
>
> Levente
>
>
>>
>>> Cheers,
>>>  - Andreas
>>>
>>
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20101206/ab795465/attachment.htm


More information about the Vm-dev mailing list