VM Maker: VMMaker-oscog.33.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

VM Maker: VMMaker-oscog.33.mcz

squeak-dev-noreply
 
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://www.squeaksource.com/VMMaker/VMMaker-oscog.33.mcz

==================== Summary ====================

Name: VMMaker-oscog.33
Author: eem
Time: 25 September 2010, 7:13:51 am
UUID: 733b7c50-b973-4ca0-9831-5c84d09032bf
Ancestors: VMMaker-oscog.32

OSCogVM:
  Support object-as-method:
        Eagerly evaluate the interpreter version of a primitive
        to ease the object-as-method implementation and to
        improve interpreter performance.
        Refuse to enter anything that isn't a CompiledMethod
        into the method-lookup cache to avoid open PICs having
        to check for valid compiled methods.
        Have various places check for isOopCOmpiledMethod:
        rather than isCompiledMethod: to allow SmallIntegers to
        be used as methods.
Interpreter:
        Have various places check for isOopCOmpiledMethod:
        rather than isCompiledMethod: to allow SmallIntegers to
        be used as methods.
Slang:
        support super sends by expanding them at translation
        time.  This allows CoInterpreter>>addMethodToCache
        to avoid cacheing non-compiled methods via a super
        send, avoiding duplicating SrackInterpreter's method.

Reply | Threaded
Open this post in threaded view
|

Re: VM Maker: VMMaker-oscog.33.mcz

stephane ducasse-2

Eliot

I wanted to understand what: ' Have various places check for isOopCOmpiledMethod:
rather than isCompiledMethod: to allow SmallIntegers to be used as methods.'
means
        in which circumstances do we want to have smalltalkIntegers used as methods?
        when we put an object instead of a compiled method and that by accident this is an integer?

Stef


>
>
> Name: VMMaker-oscog.33
> Author: eem
> Time: 25 September 2010, 7:13:51 am
> UUID: 733b7c50-b973-4ca0-9831-5c84d09032bf
> Ancestors: VMMaker-oscog.32
>
> OSCogVM:
>  Support object-as-method:
> Eagerly evaluate the interpreter version of a primitive
> to ease the object-as-method implementation and to
> improve interpreter performance.
> Refuse to enter anything that isn't a CompiledMethod
> into the method-lookup cache to avoid open PICs having
> to check for valid compiled methods.
> Have various places check for isOopCOmpiledMethod:
> rather than isCompiledMethod: to allow SmallIntegers to
> be used as methods.
> Interpreter:
> Have various places check for isOopCOmpiledMethod:
> rather than isCompiledMethod: to allow SmallIntegers to
> be used as methods.
> Slang:
> support super sends by expanding them at translation
> time.  This allows CoInterpreter>>addMethodToCache
> to avoid cacheing non-compiled methods via a super
> send, avoiding duplicating SrackInterpreter's method.
>

Reply | Threaded
Open this post in threaded view
|

Re: VM Maker: VMMaker-oscog.33.mcz

Mariano Martinez Peck
 


On Sun, Sep 26, 2010 at 1:45 PM, stephane ducasse <[hidden email]> wrote:

Eliot

I wanted to understand what: '  Have various places check for isOopCOmpiledMethod:
rather than isCompiledMethod: to allow SmallIntegers to be used as methods.'
means
       in which circumstances do we want to have smalltalkIntegers used as methods?
       when we put an object instead of a compiled method and that by accident this is an integer?



Eliot, first of all, thanks A LOT!!!  This is really important for us....wiiii we have TestCoverage again :)

BTW, I think I found something related to what Stef says....In normal squeakVM :

testAddNumbers
    self assert: (self add: 3 with: 4) = 7.
    self assert: (self perform: #add:with: withArguments: #(3 4)) = 7.

this is ok, since (self perform: #add:with: withArguments: #(3 4))  answers 7.
But with this new CogVM, there is a primitiveError.

so...we can update the test to:

    self should: (self perform: #add:with: withArguments: #(3 4)) rise: Error.

or something like that....but this test will fail with normal VM..

what we should do?

thanks

mariano
 
Stef


>
>
> Name: VMMaker-oscog.33
> Author: eem
> Time: 25 September 2010, 7:13:51 am
> UUID: 733b7c50-b973-4ca0-9831-5c84d09032bf
> Ancestors: VMMaker-oscog.32
>
> OSCogVM:
>  Support object-as-method:
>       Eagerly evaluate the interpreter version of a primitive
>       to ease the object-as-method implementation and to
>       improve interpreter performance.
>       Refuse to enter anything that isn't a CompiledMethod
>       into the method-lookup cache to avoid open PICs having
>       to check for valid compiled methods.
>       Have various places check for isOopCOmpiledMethod:
>       rather than isCompiledMethod: to allow SmallIntegers to
>       be used as methods.
> Interpreter:
>       Have various places check for isOopCOmpiledMethod:
>       rather than isCompiledMethod: to allow SmallIntegers to
>       be used as methods.
> Slang:
>       support super sends by expanding them at translation
>       time.  This allows CoInterpreter>>addMethodToCache
>       to avoid cacheing non-compiled methods via a super
>       send, avoiding duplicating SrackInterpreter's method.
>


Reply | Threaded
Open this post in threaded view
|

Re: VM Maker: VMMaker-oscog.33.mcz

Eliot Miranda-2
 


On Sun, Sep 26, 2010 at 5:59 AM, Mariano Martinez Peck <[hidden email]> wrote:
 


On Sun, Sep 26, 2010 at 1:45 PM, stephane ducasse <[hidden email]> wrote:

Eliot

I wanted to understand what: '  Have various places check for isOopCOmpiledMethod:
rather than isCompiledMethod: to allow SmallIntegers to be used as methods.'
means
       in which circumstances do we want to have smalltalkIntegers used as methods?
       when we put an object instead of a compiled method and that by accident this is an integer?



Eliot, first of all, thanks A LOT!!!  This is really important for us....wiiii we have TestCoverage again :)

BTW, I think I found something related to what Stef says....In normal squeakVM :

testAddNumbers
    self assert: (self add: 3 with: 4) = 7.
    self assert: (self perform: #add:with: withArguments: #(3 4)) = 7.

this is ok, since (self perform: #add:with: withArguments: #(3 4))  answers 7.
But with this new CogVM, there is a primitiveError.

so...we can update the test to:

    self should: (self perform: #add:with: withArguments: #(3 4)) rise: Error.

or something like that....but this test will fail with normal VM..

what we should do?

Leave the test be.  The test should not fail.  I should fix Cog.  Now I have the difficult part done fixing related should not take as long.

But I don't see this failure in the Squeak tests.  Can you email me the Pharo version of Tests-ObjectsAsMethods?

TIA
 

thanks

mariano
 
Stef


>
>
> Name: VMMaker-oscog.33
> Author: eem
> Time: 25 September 2010, 7:13:51 am
> UUID: 733b7c50-b973-4ca0-9831-5c84d09032bf
> Ancestors: VMMaker-oscog.32
>
> OSCogVM:
>  Support object-as-method:
>       Eagerly evaluate the interpreter version of a primitive
>       to ease the object-as-method implementation and to
>       improve interpreter performance.
>       Refuse to enter anything that isn't a CompiledMethod
>       into the method-lookup cache to avoid open PICs having
>       to check for valid compiled methods.
>       Have various places check for isOopCOmpiledMethod:
>       rather than isCompiledMethod: to allow SmallIntegers to
>       be used as methods.
> Interpreter:
>       Have various places check for isOopCOmpiledMethod:
>       rather than isCompiledMethod: to allow SmallIntegers to
>       be used as methods.
> Slang:
>       support super sends by expanding them at translation
>       time.  This allows CoInterpreter>>addMethodToCache
>       to avoid cacheing non-compiled methods via a super
>       send, avoiding duplicating SrackInterpreter's method.
>




Reply | Threaded
Open this post in threaded view
|

Re: VM Maker: VMMaker-oscog.33.mcz

Eliot Miranda-2
In reply to this post by stephane ducasse-2
 


On Sun, Sep 26, 2010 at 4:45 AM, stephane ducasse <[hidden email]> wrote:

Eliot

I wanted to understand what: '  Have various places check for isOopCOmpiledMethod:
rather than isCompiledMethod: to allow SmallIntegers to be used as methods.'
means
       in which circumstances do we want to have smalltalkIntegers used as methods?
       when we put an object instead of a compiled method and that by accident this is an integer?

Looking at the code for the standard Interpreter, if anyone tried

    self class addSelector: #foo withMethod: 0.
    self foo.

then the VM would crash trying to determine if 0 was a compiled method because the VM uses isCompiledMethod: and isCompiledMethod: does not (and should not, because it is used elsewhere) guard against a tagged object.  isOopCompiledMethod: does guard against a tagged object:

isOopCompiledMethod: oop
    ^(self isNonIntegerObject: oop) and: [self isCompiledMethod: oop]

isCompiledMethod: obj
    ^(self formatOf: obj) >= 12

So in practice it's not an issue; presumably no-one is using SmallIntegers as methods ("Doctor it hurts when I...").  But if the VM provides a facility it is nice for it to provide that facility robustly (if there is no significant impact on performance).

HTH
Eliot

 

Stef


>
>
> Name: VMMaker-oscog.33
> Author: eem
> Time: 25 September 2010, 7:13:51 am
> UUID: 733b7c50-b973-4ca0-9831-5c84d09032bf
> Ancestors: VMMaker-oscog.32
>
> OSCogVM:
>  Support object-as-method:
>       Eagerly evaluate the interpreter version of a primitive
>       to ease the object-as-method implementation and to
>       improve interpreter performance.
>       Refuse to enter anything that isn't a CompiledMethod
>       into the method-lookup cache to avoid open PICs having
>       to check for valid compiled methods.
>       Have various places check for isOopCOmpiledMethod:
>       rather than isCompiledMethod: to allow SmallIntegers to
>       be used as methods.
> Interpreter:
>       Have various places check for isOopCOmpiledMethod:
>       rather than isCompiledMethod: to allow SmallIntegers to
>       be used as methods.
> Slang:
>       support super sends by expanding them at translation
>       time.  This allows CoInterpreter>>addMethodToCache
>       to avoid cacheing non-compiled methods via a super
>       send, avoiding duplicating SrackInterpreter's method.
>


Reply | Threaded
Open this post in threaded view
|

Re: VM Maker: VMMaker-oscog.33.mcz

Igor Stasenko

On 26 September 2010 18:07, Eliot Miranda <[hidden email]> wrote:

>
>
>
> On Sun, Sep 26, 2010 at 4:45 AM, stephane ducasse <[hidden email]> wrote:
>>
>> Eliot
>>
>> I wanted to understand what: '  Have various places check for isOopCOmpiledMethod:
>> rather than isCompiledMethod: to allow SmallIntegers to be used as methods.'
>> means
>>        in which circumstances do we want to have smalltalkIntegers used as methods?
>>        when we put an object instead of a compiled method and that by accident this is an integer?
>
> Looking at the code for the standard Interpreter, if anyone tried
>     self class addSelector: #foo withMethod: 0.
>     self foo.
> then the VM would crash trying to determine if 0 was a compiled method because the VM uses isCompiledMethod: and isCompiledMethod: does not (and should not, because it is used elsewhere) guard against a tagged object.  isOopCompiledMethod: does guard against a tagged object:
> isOopCompiledMethod: oop
>     ^(self isNonIntegerObject: oop) and: [self isCompiledMethod: oop]
> isCompiledMethod: obj
>     ^(self formatOf: obj) >= 12
> So in practice it's not an issue; presumably no-one is using SmallIntegers as methods ("Doctor it hurts when I...").  But if the VM provides a facility it is nice for it to provide that facility robustly (if there is no significant impact on performance).

Squeak VM sends #run:with:in: to object-as-method.
In theory, if someone wants to use smallintegers as methods, he just
needs to implement this method.
But if it could impact performance, i'll vote for disabling this
feature for smallints, but not the rest of objects.
And of course VM should not crash when meeting badly-formed method dicts.

> HTH
> Eliot
>
>>
>> Stef
>>
>>
>> >
>> >
>> > Name: VMMaker-oscog.33
>> > Author: eem
>> > Time: 25 September 2010, 7:13:51 am
>> > UUID: 733b7c50-b973-4ca0-9831-5c84d09032bf
>> > Ancestors: VMMaker-oscog.32
>> >
>> > OSCogVM:
>> >  Support object-as-method:
>> >       Eagerly evaluate the interpreter version of a primitive
>> >       to ease the object-as-method implementation and to
>> >       improve interpreter performance.
>> >       Refuse to enter anything that isn't a CompiledMethod
>> >       into the method-lookup cache to avoid open PICs having
>> >       to check for valid compiled methods.
>> >       Have various places check for isOopCOmpiledMethod:
>> >       rather than isCompiledMethod: to allow SmallIntegers to
>> >       be used as methods.
>> > Interpreter:
>> >       Have various places check for isOopCOmpiledMethod:
>> >       rather than isCompiledMethod: to allow SmallIntegers to
>> >       be used as methods.
>> > Slang:
>> >       support super sends by expanding them at translation
>> >       time.  This allows CoInterpreter>>addMethodToCache
>> >       to avoid cacheing non-compiled methods via a super
>> >       send, avoiding duplicating SrackInterpreter's method.
>> >
>>
>
>
>



--
Best regards,
Igor Stasenko AKA sig.
Reply | Threaded
Open this post in threaded view
|

Re: VM Maker: VMMaker-oscog.33.mcz

Mariano Martinez Peck
In reply to this post by Eliot Miranda-2
 


On Sun, Sep 26, 2010 at 4:59 PM, Eliot Miranda <[hidden email]> wrote:
 


On Sun, Sep 26, 2010 at 5:59 AM, Mariano Martinez Peck <[hidden email]> wrote:
 


On Sun, Sep 26, 2010 at 1:45 PM, stephane ducasse <[hidden email]> wrote:

Eliot

I wanted to understand what: '  Have various places check for isOopCOmpiledMethod:
rather than isCompiledMethod: to allow SmallIntegers to be used as methods.'
means
       in which circumstances do we want to have smalltalkIntegers used as methods?
       when we put an object instead of a compiled method and that by accident this is an integer?



Eliot, first of all, thanks A LOT!!!  This is really important for us....wiiii we have TestCoverage again :)

BTW, I think I found something related to what Stef says....In normal squeakVM :

testAddNumbers
    self assert: (self add: 3 with: 4) = 7.
    self assert: (self perform: #add:with: withArguments: #(3 4)) = 7.

this is ok, since (self perform: #add:with: withArguments: #(3 4))  answers 7.
But with this new CogVM, there is a primitiveError.

so...we can update the test to:

    self should: (self perform: #add:with: withArguments: #(3 4)) rise: Error.

or something like that....but this test will fail with normal VM..

what we should do?

Leave the test be.  The test should not fail.  I should fix Cog.  Now I have the difficult part done fixing related should not take as long.


Ok, perfect.
 
But I don't see this failure in the Squeak tests.  Can you email me the Pharo version of Tests-ObjectsAsMethods?


O attach it here.

Thanks

Mariano

 
TIA
 

thanks

mariano
 
Stef


>
>
> Name: VMMaker-oscog.33
> Author: eem
> Time: 25 September 2010, 7:13:51 am
> UUID: 733b7c50-b973-4ca0-9831-5c84d09032bf
> Ancestors: VMMaker-oscog.32
>
> OSCogVM:
>  Support object-as-method:
>       Eagerly evaluate the interpreter version of a primitive
>       to ease the object-as-method implementation and to
>       improve interpreter performance.
>       Refuse to enter anything that isn't a CompiledMethod
>       into the method-lookup cache to avoid open PICs having
>       to check for valid compiled methods.
>       Have various places check for isOopCOmpiledMethod:
>       rather than isCompiledMethod: to allow SmallIntegers to
>       be used as methods.
> Interpreter:
>       Have various places check for isOopCOmpiledMethod:
>       rather than isCompiledMethod: to allow SmallIntegers to
>       be used as methods.
> Slang:
>       support super sends by expanding them at translation
>       time.  This allows CoInterpreter>>addMethodToCache
>       to avoid cacheing non-compiled methods via a super
>       send, avoiding duplicating SrackInterpreter's method.
>







TestObjectsAsMethods.st (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: VM Maker: VMMaker-oscog.33.mcz

stephane ducasse-2
In reply to this post by Eliot Miranda-2

> Eliot
>
> I wanted to understand what: '  Have various places check for isOopCOmpiledMethod:
> rather than isCompiledMethod: to allow SmallIntegers to be used as methods.'
> means
>        in which circumstances do we want to have smalltalkIntegers used as methods?
>        when we put an object instead of a compiled method and that by accident this is an integer?
>
> Looking at the code for the standard Interpreter, if anyone tried
>
>     self class addSelector: #foo withMethod: 0.
>     self foo.
>
> then the VM would crash trying to determine if 0 was a compiled method because the VM uses isCompiledMethod: and isCompiledMethod: does not (and should not, because it is used elsewhere) guard against a tagged object.  isOopCompiledMethod: does guard against a tagged object:
>
> isOopCompiledMethod: oop
>     ^(self isNonIntegerObject: oop) and: [self isCompiledMethod: oop]
>
> isCompiledMethod: obj
>     ^(self formatOf: obj) >= 12
>
> So in practice it's not an issue; presumably no-one is using SmallIntegers as methods ("Doctor it hurts when I...").  But if the VM provides a facility it is nice for it to provide that facility robustly (if there is no significant impact on performance).

Thanks for the explanation. I have to stop writing papers and learn new stuff.

Stef

Reply | Threaded
Open this post in threaded view
|

Re: VM Maker: VMMaker-oscog.33.mcz

stephane ducasse-2
In reply to this post by Eliot Miranda-2

should I conclude that before your change even the default old vm would crash when we put a SmallInteger in a methodDict?
Because if I would have know I would not ask my question. I thought it was for something else you had in mind.

Stef

>
> Eliot
>
> I wanted to understand what: '  Have various places check for isOopCOmpiledMethod:
> rather than isCompiledMethod: to allow SmallIntegers to be used as methods.'
> means
>        in which circumstances do we want to have smalltalkIntegers used as methods?
>        when we put an object instead of a compiled method and that by accident this is an integer?
>
> Looking at the code for the standard Interpreter, if anyone tried
>
>     self class addSelector: #foo withMethod: 0.
>     self foo.
>
> then the VM would crash trying to determine if 0 was a compiled method because the VM uses isCompiledMethod: and isCompiledMethod: does not (and should not, because it is used elsewhere) guard against a tagged object.  isOopCompiledMethod: does guard against a tagged object:
>
> isOopCompiledMethod: oop
>     ^(self isNonIntegerObject: oop) and: [self isCompiledMethod: oop]
>
> isCompiledMethod: obj
>     ^(self formatOf: obj) >= 12
>
> So in practice it's not an issue; presumably no-one is using SmallIntegers as methods ("Doctor it hurts when I...").  But if the VM provides a facility it is nice for it to provide that facility robustly (if there is no significant impact on performance).
>
>

Reply | Threaded
Open this post in threaded view
|

Re: VM Maker: VMMaker-oscog.33.mcz

Eliot Miranda-2
 


On Sun, Sep 26, 2010 at 1:15 PM, stephane ducasse <[hidden email]> wrote:

should I conclude that before your change even the default old vm would crash when we put a SmallInteger in a methodDict?

Yes.
 
Because if I would have know I would not ask my question. I thought it was for something else you had in mind.

Stef

>
> Eliot
>
> I wanted to understand what: '  Have various places check for isOopCOmpiledMethod:
> rather than isCompiledMethod: to allow SmallIntegers to be used as methods.'
> means
>        in which circumstances do we want to have smalltalkIntegers used as methods?
>        when we put an object instead of a compiled method and that by accident this is an integer?
>
> Looking at the code for the standard Interpreter, if anyone tried
>
>     self class addSelector: #foo withMethod: 0.
>     self foo.
>
> then the VM would crash trying to determine if 0 was a compiled method because the VM uses isCompiledMethod: and isCompiledMethod: does not (and should not, because it is used elsewhere) guard against a tagged object.  isOopCompiledMethod: does guard against a tagged object:
>
> isOopCompiledMethod: oop
>     ^(self isNonIntegerObject: oop) and: [self isCompiledMethod: oop]
>
> isCompiledMethod: obj
>     ^(self formatOf: obj) >= 12
>
> So in practice it's not an issue; presumably no-one is using SmallIntegers as methods ("Doctor it hurts when I...").  But if the VM provides a facility it is nice for it to provide that facility robustly (if there is no significant impact on performance).
>
>