Something I don't understand with ImageSegments

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

Something I don't understand with ImageSegments

Mariano Martinez Peck
Hi guys:   I have this little (piece) of test:


    | segment external internal root |

    external := 'mariano'.
    internal := true -> external.
    root := false -> internal.
    internal := nil.

   segment := ImageSegment new
        copyFromRoots: (Array with: root with: external)
        sizeHint: 5000
        areUnique: true.
   
    self assert: segment outPointers size = 2.


And that is green.

However, if I change 'mariano' to Object new, I have that segment outPointers size is 3 instead of 2.

I really don't understand why. Does someone see something ?

Thanks

Mariano


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Something I don't understand with ImageSegments

Martin McClure-2
Mariano Martinez Peck wrote:

> Hi guys:   I have this little (piece) of test:
>
>
>     | segment external internal root |
>
>     external := 'mariano'.
>     internal := true -> external.
>     root := false -> internal.
>     internal := nil.
>
>    segment := ImageSegment new
>         copyFromRoots: (Array with: root with: external)
>         sizeHint: 5000
>         areUnique: true.
>    
>     self assert: segment outPointers size = 2.
>
>
> And that is green.
>
> However, if I change 'mariano' to Object new, I have that segment
> outPointers size is 3 instead of 2.
>
> I really don't understand why. Does someone see something ?
>

What outPointers do you expect to be present?

With my limited understanding of ImageSegment theory I would expect
there to be no outPointers in this example, because there are no
references from objects in the ImageSegment to objects outside the
ImageSegment, except for the well-known objects true and false.

Regards,

-Martin


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Something I don't understand with ImageSegments

Mariano Martinez Peck


On Sat, Jan 9, 2010 at 11:49 PM, Martin McClure <[hidden email]> wrote:
Mariano Martinez Peck wrote:
> Hi guys:   I have this little (piece) of test:
>
>
>     | segment external internal root |
>
>     external := 'mariano'.
>     internal := true -> external.
>     root := false -> internal.
>     internal := nil.
>
>    segment := ImageSegment new
>         copyFromRoots: (Array with: root with: external)
>         sizeHint: 5000
>         areUnique: true.
>
>     self assert: segment outPointers size = 2.
>
>
> And that is green.
>
> However, if I change 'mariano' to Object new, I have that segment
> outPointers size is 3 instead of 2.
>
> I really don't understand why. Does someone see something ?
>

What outPointers do you expect to be present?

Thanks for the answer Martin.

I would expect just true and false.
 

With my limited understanding of ImageSegment theory I would expect
there to be no outPointers in this example, because there are no
references from objects in the ImageSegment to objects outside the
ImageSegment, except for the well-known objects true and false.


Exactly. I would expect to have only false and true in the outPointers, but not also the Object new. In the case of 'mariano' it is correct and only get false and true in the outPointers, but if I put Object new instead of 'mariano', in outPointers I get, true, false and that object I created.

I don't see the difference between creating a string and an object.

Cheers

Mariano
 
Regards,

-Martin


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Something I don't understand with ImageSegments

Martin McClure-2
Mariano Martinez Peck wrote:
>
> Exactly. I would expect to have only false and true in the outPointers,
> but not also the Object new. In the case of 'mariano' it is correct and
> only get false and true in the outPointers, but if I put Object new
> instead of 'mariano', in outPointers I get, true, false and that object
> I created.
>
> I don't see the difference between creating a string and an object.

I tried your example. I see as outPointers true, false, and Object. Not
the object you created, but the class Object.

But I also fail to see why you'd get the class of one of the referenced
objects but not Association.

Regards,

-Martin

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Something I don't understand with ImageSegments

Mariano Martinez Peck


On Sun, Jan 10, 2010 at 12:00 AM, Martin McClure <[hidden email]> wrote:
Mariano Martinez Peck wrote:
>
> Exactly. I would expect to have only false and true in the outPointers,
> but not also the Object new. In the case of 'mariano' it is correct and
> only get false and true in the outPointers, but if I put Object new
> instead of 'mariano', in outPointers I get, true, false and that object
> I created.
>
> I don't see the difference between creating a string and an object.

I tried your example. I see as outPointers true, false, and Object. Not
the object you created, but the class Object.

Uffff yes, you are right. Sorry, it is the class. I am blind at this time. Thanks for the tip Martin.
 

But I also fail to see why you'd get the class of one of the referenced
objects but not Association.

Yes, I don't understand neither.
 

Regards,

-Martin

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Something I don't understand with ImageSegments

Lukas Renggli
>> But I also fail to see why you'd get the class of one of the referenced
>> objects but not Association.
>
> Yes, I don't understand neither.

I would expect everything to be in the outPointers. All involved
objects are referenced from the outside through the stack frame that
is still active while creating the segment.

Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Something I don't understand with ImageSegments

Martin McClure-2
Lukas Renggli wrote:
>>> But I also fail to see why you'd get the class of one of the referenced
>>> objects but not Association.
>> Yes, I don't understand neither.
>
> I would expect everything to be in the outPointers. All involved
> objects are referenced from the outside through the stack frame that
> is still active while creating the segment.

No, only the roots are referenced by the stack frame, and that shouldn't
change the outcome.

Regards,

-Martin

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Something I don't understand with ImageSegments

Sheridan Mahoney
Hi all,

I've been catching up on ImageSegment news, and came across this old post from January,
and got interested in discovering the mindset behind the outPointers array.  I re-ran
Mariano's original test code, with a small change:  turned 'Object new' into TestOutPointers, a new
subclass of Object, with 2 inst vars and one method.  I'd be interested in getting feedback on
whether my guesses (in quotes below) are in the ball park.  The results seem to explain why
Association is not in outPointers - what is captured there in the case of adding a class
is a lot like what you would need for filling in a class template.  If you add an instance of a class,
you just need the name of the class.

Some comments I have gleaned from the ImageSegment class on outPointers :
This array contains:
        - OOPs of all objects outside the segment that are pointed to from inside segment.
        - outPointers that are necessary to turn the bits in the file into objects.

Here's the code:

| segment external internal root |

     external := TestOutpointers.
     internal := true -> external.
     root := false -> internal.
     internal := nil.

    segment := ImageSegment new
         copyFromRoots: (Array with: root with: external)
         sizeHint: 5000
         areUnique: true.
 ^ (segment outPointers ) -> (segment arrayOfRoots )  

====== result =================
{ false.                              "object outside the segment that is pointed to from inside segment."
Object.                              "superclass of TestOutpointers"
a MethodDictionary(#tryList->a CompiledMethod(1725: TestOutpointers>>tryList) )       "MethodDictionary"
#('iv1' 'iv2')                         "inst var names"
('testing' tryList)                  "method category"
nil.                                    "object outside the segment that is pointed to from inside segment."
#TestOutpointers.               "symbol representing name of new class"
Smalltalk.                          "environment that TestOutpointers is assigned to"
#'IST-outPointers'.              "category name for TestOutpointers"
true.                                  "object outside the segment that is pointed to from inside segment."
Metaclass.                         "for initializing class variables and instance creation messages particular to a class."
Object class.                      "class of TestOutpointers superclass"
ClassOrganizer.                  "need this in order to determine whether TestOutpointers has been changed in the local env"
#'as yet unclassified'.          "??"
}
->
{false->true->TestOutpointers. TestOutpointers}



Any feedback would be very welcome...

Cheers,
Sheri
Reply | Threaded
Open this post in threaded view
|

Re: Something I don't understand with ImageSegments

Stéphane Ducasse
Sheridan mariano can send you the document he wrote about image segment.
I can help you.

Stef

On Feb 19, 2010, at 12:35 AM, Sheridan Mahoney wrote:

>
> Hi all,
>
> I've been catching up on ImageSegment news, and came across this old post
> from January,
> and got interested in discovering the mindset behind the outPointers array.
> I re-ran
> Mariano's original test code, with a small change:  turned 'Object new' into
> TestOutPointers, a new
> subclass of Object, with 2 inst vars and one method.  I'd be interested in
> getting feedback on
> whether my guesses (in quotes below) are in the ball park.  The results seem
> to explain why
> Association is not in outPointers - what is captured there in the case of
> adding a class
> is a lot like what you would need for filling in a class template.  If you
> add an instance of a class,
> you just need the name of the class.
>
> Some comments I have gleaned from the ImageSegment class on outPointers :
> This array contains:
>        - OOPs of all objects outside the segment that are pointed to from
> inside segment.
> - outPointers that are necessary to turn the bits in the file into objects.
>
> Here's the code:
>
> | segment external internal root |
>
>     external := TestOutpointers.
>     internal := true -> external.
>     root := false -> internal.
>     internal := nil.
>
>    segment := ImageSegment new
>         copyFromRoots: (Array with: root with: external)
>         sizeHint: 5000
>         areUnique: true.
> ^ (segment outPointers ) -> (segment arrayOfRoots )  
>
> ====== result =================
> { false.                              "object outside the segment that is
> pointed to from inside segment."
> Object.                              "superclass of TestOutpointers"
> a MethodDictionary(#tryList->a CompiledMethod(1725:
> TestOutpointers>>tryList) )       "MethodDictionary"
> #('iv1' 'iv2')                         "inst var names"
> ('testing' tryList)                  "method category"
> nil.                                    "object outside the segment that is
> pointed to from inside segment."
> #TestOutpointers.               "symbol representing name of new class"
> Smalltalk.                          "environment that TestOutpointers is
> assigned to"
> #'IST-outPointers'.              "category name for TestOutpointers"
> true.                                  "object outside the segment that is
> pointed to from inside segment."
> Metaclass.                         "for initializing class variables and
> instance creation messages particular to a class."
> Object class.                      "class of TestOutpointers superclass"
> ClassOrganizer.                  "need this in order to determine whether
> TestOutpointers has been changed in the local env"
> #'as yet unclassified'.          "??"
> }
> ->
> {false->true->TestOutpointers. TestOutpointers}
>
>
>
> Any feedback would be very welcome...
>
> Cheers,
> Sheri
>
> --
> View this message in context: http://n4.nabble.com/Something-I-don-t-understand-with-ImageSegments-tp1296982p1560990.html
> Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Something I don't understand with ImageSegments

Mariano Martinez Peck
In reply to this post by Sheridan Mahoney


On Fri, Feb 19, 2010 at 12:35 AM, Sheridan Mahoney <[hidden email]> wrote:

Hi all,

I've been catching up on ImageSegment news, and came across this old post
from January,
and got interested in discovering the mindset behind the outPointers array.
I re-ran
Mariano's original test code, with a small change:  turned 'Object new' into
TestOutPointers, a new
subclass of Object, with 2 inst vars and one method.  I'd be interested in
getting feedback on
whether my guesses (in quotes below) are in the ball park.  The results seem
to explain why
Association is not in outPointers - what is captured there in the case of
adding a class
is a lot like what you would need for filling in a class template.  If you
add an instance of a class,
you just need the name of the class.

Some comments I have gleaned from the ImageSegment class on outPointers :
This array contains:
       - OOPs of all objects outside the segment that are pointed to from
inside segment.
       - outPointers that are necessary to turn the bits in the file into objects.

Here's the code:

| segment external internal root |

    external := TestOutpointers.
    internal := true -> external.
    root := false -> internal.
    internal := nil.

   segment := ImageSegment new
        copyFromRoots: (Array with: root with: external)
        sizeHint: 5000
        areUnique: true.

ok
 
 ^ (segment outPointers ) -> (segment arrayOfRoots )

I don't understand what is this return and why the association.

 

====== result =================
{ false.                              "object outside the segment that is
pointed to from inside segment."
Object.                              "superclass of TestOutpointers"
a MethodDictionary(#tryList->a CompiledMethod(1725:
TestOutpointers>>tryList) )       "MethodDictionary"
#('iv1' 'iv2')                         "inst var names"
('testing' tryList)                  "method category"
nil.                                    "object outside the segment that is
pointed to from inside segment."
#TestOutpointers.               "symbol representing name of new class"
Smalltalk.                          "environment that TestOutpointers is
assigned to"
#'IST-outPointers'.              "category name for TestOutpointers"
true.                                  "object outside the segment that is
pointed to from inside segment."
Metaclass.                         "for initializing class variables and
instance creation messages particular to a class."
Object class.                      "class of TestOutpointers superclass"
ClassOrganizer.                  "need this in order to determine whether
TestOutpointers has been changed in the local env"
#'as yet unclassified'.          "??"
}


For me this is ok. #'as yet unclassified'.          "??"   in my case shows:

('as yet unclassified' xxxMethod)

where xxxMethod is the method I defined in TestOutPointers and 'as yet unclassified'  is because you didn't define any category to that method.

If you inspect ('as yet unclassified' xxxMethod) you will see it is a ClassOrganizer

I also attach a pdf I wrote about ImageSegment (is much more updated than the one I sent you months before).

Cheers

Mariano

 
->
{false->true->TestOutpointers. TestOutpointers}



Any feedback would be very welcome...

Cheers,
Sheri

--
View this message in context: http://n4.nabble.com/Something-I-don-t-understand-with-ImageSegments-tp1296982p1560990.html
Sent from the Pharo Smalltalk mailing list archive at Nabble.com.

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

imageSegments.pdf (529K) Download Attachment