Small finding about NewObjectMemory>>clone:

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

Small finding about NewObjectMemory>>clone:

Dimitry Golubovsky
 
Hi,

I have just spotted that the method NewObjectMemory>>clone as found in
VMMaker-oscog-IgorStasenko.116.mcz (with hyphen):

clone: oop
        "Return a shallow copy of the given object. May cause GC"
        "Assume: Oop is a real object, not a small integer.
         Override to assert it's not a married context"
        self assert: ((coInterpreter isContext: oop) not
                                or: [(coInterpreter isMarriedOrWidowedContext: oop) not]).
        ^super clone: oop

causes compilation error in the interpreter.

It seems that it has been fixed in VMMaker.oscog-eem.116.mcz (with dot)

clone: obj
        "Return a shallow copy of the given object. May cause GC"
        "Assume: Oop is a real object, not a small integer.
         Override to assert it's not a married context"
        self assert: ((coInterpreter isContext: obj) not
                                or: [(coInterpreter isMarriedOrWidowedContext: obj) not]).
        ^super clone: obj

basically s/oop/obj/g - I had to make similar change in my local copy
of VMMaker.

So, Igor: please merge this into the CMMaker-oscog branch.

Thanks.

PS Is this some kind of inliner bug? When super method is inlined,
argument identifier remains the same instead of being substituted.

--
Dimitry Golubovsky

Anywhere on the Web
Reply | Threaded
Open this post in threaded view
|

Re: Small finding about NewObjectMemory>>clone:

Eliot Miranda-2



On Aug 15, 2011, at 6:58 PM, Dimitry Golubovsky <[hidden email]> wrote:

>
> Hi,
>
> I have just spotted that the method NewObjectMemory>>clone as found in
> VMMaker-oscog-IgorStasenko.116.mcz (with hyphen):
>
> clone: oop
>    "Return a shallow copy of the given object. May cause GC"
>    "Assume: Oop is a real object, not a small integer.
>     Override to assert it's not a married context"
>    self assert: ((coInterpreter isContext: oop) not
>                or: [(coInterpreter isMarriedOrWidowedContext: oop) not]).
>    ^super clone: oop
>
> causes compilation error in the interpreter.
>
> It seems that it has been fixed in VMMaker.oscog-eem.116.mcz (with dot)
>
> clone: obj
>    "Return a shallow copy of the given object. May cause GC"
>    "Assume: Oop is a real object, not a small integer.
>     Override to assert it's not a married context"
>    self assert: ((coInterpreter isContext: obj) not
>                or: [(coInterpreter isMarriedOrWidowedContext: obj) not]).
>    ^super clone: obj
>
> basically s/oop/obj/g - I had to make similar change in my local copy
> of VMMaker.
>
> So, Igor: please merge this into the CMMaker-oscog branch.
>
> Thanks.
>
> PS Is this some kind of inliner bug? When super method is inlined,
> argument identifier remains the same instead of being substituted.

yes, bug or limitation.  The super send inliner is a very simple-minded quick hack that can't rename argument names when inlining the superclass method, and so argument names in the super- and sub-class methods must match.  In 115 I didn't notice the bug since it only affected code in an assert.  In 116 I made the argument names match and added an error check to the super inliner.

Eliot (phone)
> --
> Dimitry Golubovsky
>
> Anywhere on the Web
Reply | Threaded
Open this post in threaded view
|

Re: Small finding about NewObjectMemory>>clone:

Igor Stasenko
In reply to this post by Dimitry Golubovsky

On 16 August 2011 03:58, Dimitry Golubovsky <[hidden email]> wrote:

>
> Hi,
>
> I have just spotted that the method NewObjectMemory>>clone as found in
> VMMaker-oscog-IgorStasenko.116.mcz (with hyphen):
>
> clone: oop
>        "Return a shallow copy of the given object. May cause GC"
>        "Assume: Oop is a real object, not a small integer.
>         Override to assert it's not a married context"
>        self assert: ((coInterpreter isContext: oop) not
>                                or: [(coInterpreter isMarriedOrWidowedContext: oop) not]).
>        ^super clone: oop
>
> causes compilation error in the interpreter.
>
> It seems that it has been fixed in VMMaker.oscog-eem.116.mcz (with dot)
>
> clone: obj
>        "Return a shallow copy of the given object. May cause GC"
>        "Assume: Oop is a real object, not a small integer.
>         Override to assert it's not a married context"
>        self assert: ((coInterpreter isContext: obj) not
>                                or: [(coInterpreter isMarriedOrWidowedContext: obj) not]).
>        ^super clone: obj
>
> basically s/oop/obj/g - I had to make similar change in my local copy
> of VMMaker.
>
> So, Igor: please merge this into the CMMaker-oscog branch.
>
Will do.

> Thanks.
>
> PS Is this some kind of inliner bug? When super method is inlined,
> argument identifier remains the same instead of being substituted.
>
> --
> Dimitry Golubovsky
>
> Anywhere on the Web
>



--
Best regards,
Igor Stasenko AKA sig.