On 3 juin 2010, at 18:55, Eliot Miranda wrote: > Hi Mariano, Hi All, > > response below. But does anyone have any tests for the image segment > primitives? I'm refactoring them and would like some tests. > I don't have tests, but it's cool that you take care of this. The code I saw was really ugly with huge methods.
Noury > 2010/6/3 Mariano Martinez Peck <[email protected]> > Hi. ImageSegment uses GC to compute the out pointers. Basically, to a given > array of roots (a graph) it does: > > 1) It marks the rootArray and all root objects by turning on the Garbage > Collector bit in the object header of those particular objects. > 2) Then does a mark pass over all objects. This will stop at our marked > roots leaving our segment unmarked in their shadow. > 3) Finally, it unmarks the rootArray and all root objects. > 4) Only external objects are now marked. > > The unmarked objects in the graph of objects of the arrays are those who will > be put in the WordArray (the segment) and those who are marked to the > outPointers. > > However, I don't see where step 2) is done in Interpreter >> > primitiveStoreImageSegment > > In a piece of such method it does: > > > "Then do a mark pass over all objects. This will stop at our marked roots, > thus leaving our segment unmarked in their shadow." > savedYoungStart := youngStart. > youngStart := self startOfMemory. "process all of memory" > "clear the recycled context lists" > freeContexts := NilContext. > freeLargeContexts := NilContext. > self markAndTraceInterpreterOops. "and special objects array" > youngStart := savedYoungStart. > > "Finally unmark the rootArray and all root objects." > self longAt: arrayOfRoots put: ((self longAt: arrayOfRoots) bitAnd: > AllButMarkBit). > ......continue....... > > But here I see it is only marking Interpreter oops, not all objects. And I > don't see where all objects are marked even in the code that follows this > little piece. > > markInterpreterOops marks all objects accessible from the interpreter oops, > including the specialObjectsArray, recursively marking any unmarked objects > and their referents. i.e. it marks all objects reachable from the roots of > the system. This would mark all objects in the system were it not for the > fact that the primitive marks the rootArray and so markInterpreterOops does > not marl objects /only/ reachable from the rootArray. So once the rootArray > objects have been unmarked, only those objects that should go in the image > segment are unmarked. > > So the primitive works by > - marking the objects in rootArray, preventing marking of objects reachable > from them in the next step > - recursively marking all objects reachable from the roots (except those > already marked) > - unmarking root objects, leaving the transitive closure of objects > accessible from the roots and no where else unmarked > - writing the unmarked objects to an image segment > > > HTH > Eliot > > > You can see the comment: "Then do a mark pass over all objects" and even > without the comment it makes sense to mark all objects in order to detect > outPointers. > > Does anyone has a hint? > > Thanks > > Mariano > > _______________________________________________ > Pharo-project mailing list > [email protected] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > > _______________________________________________ > Pharo-project mailing list > [email protected] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project _______________________________________________ Pharo-project mailing list [email protected] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
