Quantcast

VM Maker: VMMaker.oscog-eem.2068.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

VM Maker: VMMaker.oscog-eem.2068.mcz

commits-2
 
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.2068.mcz

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

Name: VMMaker.oscog-eem.2068
Author: eem
Time: 3 January 2017, 7:02:14.747424 pm
UUID: fae06c1b-ef17-4d91-bcba-d9d203c66223
Ancestors: VMMaker.oscog-eem.2067

SpurPlanningCompactor:
Fix the bug in useFreeChunkForSavedFirstFieldsSpace:; the object must not be destroyed when filling it with saved first fields, so skip the first few fields.
(Code that debugged this included in a comment in check:)

Fix edge cases in asserts in the main enumerators.

It seems to be working.

=============== Diff against VMMaker.oscog-eem.2067 ===============

Item was changed:
  ----- Method: SpurPlanningCompactor>>check: (in category 'private') -----
  check: obj
  <inline: true>
+ self cCode: '' inSmalltalk: [obj = interestingObj ifTrue: [self halt]].
+ "this debugged the misuse of the largest free chunk:"
+ "(manager checkForLeaks bitAnd: GCModeFull+GCModeFreeSpace) = GCModeFull ifTrue:
+ [self deny: ((manager isEnumerableObject: obj) and: [(manager heapMapAtWord: obj) = 0])]"!
- self cCode: '' inSmalltalk: [obj = interestingObj ifTrue: [self halt]]!

Item was changed:
  ----- Method: SpurPlanningCompactor>>copyAndUnmarkMobileObjectsWithTop: (in category 'compaction') -----
  copyAndUnmarkMobileObjectsWithTop: initialTop
  "Sweep the mobile portion of the heap, moving objects to their eventual locations, and clearing their marked bits.
  Remember to update the savedFirstFields of pointer objects, as these have been forwarded.
  This enumeration matches those in planCompactSavingForwarders and updatePointersInMobileObjects."
  <var: 'initialTop' type: #usqInt>
  | toFinger top previousPin |
  <var: 'top' type: #usqInt>
  <var: 'toFinger' type: #usqInt>
  toFinger := manager startOfObject: firstFreeObject.
  top := initialTop.
  self deny: (manager isMarked: firstFreeObject).
  manager allOldSpaceEntitiesForCompactingFrom: firstFreeObject do:
  [:o|
  self check: o.
+ self assert: (previousPin isNil or: [(manager isMarked: previousPin) and: [toFinger <= previousPin]]).
- self assert: (previousPin isNil or: [(manager isMarked: previousPin) and: [toFinger < previousPin]]).
  self assert: (savedFirstFieldsSpaceWasAllocated
  or: [savedFirstFieldsSpace limit <= manager firstObject asUnsignedInteger
  or: [toFinger < top]]).
  (manager isMarked: o) ifTrue:
  [(manager isPinned: o)
  ifTrue:
  [(manager isSegmentBridge: o) ifFalse:
  [manager setIsMarkedOf: o to: false.
  manager segmentManager notePinned: o].
  previousPin ifNotNil:
  [| limit |
  limit := manager startOfObject: previousPin.
  manager addFreeChunkWithBytes: limit - toFinger at: toFinger.
  toFinger := manager addressAfter: previousPin.
+ self assert: toFinger <= (manager startOfObject: o)].
- self assert: toFinger < (manager startOfObject: o)].
  previousPin := o]
  ifFalse:
  [| availableSpace bytes next |
  (top := top + manager bytesPerOop) >= savedFirstFieldsSpace limit ifTrue:
  [self freeFrom: toFinger upTo: (manager startOfObject: o) previousPin: previousPin.
  ^false].
  [previousPin notNil
   and: [availableSpace := (manager startOfObject: previousPin) - toFinger.
  bytes := manager bytesInObject: o.
  bytes ~= availableSpace
  and: [bytes + (2 * manager allocationUnit) < availableSpace]]] whileTrue:
  ["The object does not fit in the space between toFinger and previousPin.
   Move toFinger beyond previousPin and update previousPin appropriately."
  availableSpace > 0 ifTrue:
  [manager addFreeChunkWithBytes: availableSpace at: toFinger].
  toFinger := manager addressAfter: previousPin.
  next := manager objectStartingAt: toFinger.
  (self oop: next isGreaterThanOrEqualTo: o) ifTrue:
  [^self continueCopyAndUnmarkMobileObjectsFrom: o withTop: top - manager bytesPerOop].
  previousPin := ((manager isMarked: next) and: [manager isPinned: next]) ifTrue: [next]].
  toFinger := self copyAndUnmarkObject: o to: toFinger firstField: (manager longAt: top)]]].
  self freeFrom: toFinger upTo: manager endOfMemory previousPin: previousPin.
  ^true!

Item was changed:
  ----- Method: SpurPlanningCompactor>>planCompactSavingForwarders (in category 'compaction') -----
  planCompactSavingForwarders
  "Sweep the heap from firstFreeObject forwarding marked objects to where they
  can be moved to, saving their forwarding pointer in savedFirstFieldsSpace.
  Continue until either the end of the heap is reached or savedFirstFieldsSpace is full.
  Answer if the end of the heap was reached (savedFirstFieldsSpace has not overflowed).
 
  Note that this method is potentially recursive. If skipping a run of pinned objects
  causes the the algorithm to encounter another run of immobile objects it will
  recurse via continuePlanCompactSavingForwardersFrom:.
 
  This enumeration matches those in updatePointersInMobileObjects and copyAndUnmarkMobileObjects."
 
  | toFinger top previousPin |
  <var: 'top' type: #usqInt>
  <var: 'toFinger' type: #usqInt>
  savedFirstFieldsSpace top < savedFirstFieldsSpace start ifTrue:
  [self logPhase: 'planning...'].
  toFinger := manager startOfObject: firstFreeObject.
  top := savedFirstFieldsSpace top.
  self deny: (manager isMarked: firstFreeObject).
  manager allOldSpaceEntitiesFrom: firstFreeObject do:
  [:o|
  self check: o.
+ self assert: (previousPin isNil or: [(manager isMarked: previousPin) and: [toFinger <= previousPin]]).
- self assert: (previousPin isNil or: [(manager isMarked: previousPin) and: [toFinger < previousPin]]).
  self assert: (savedFirstFieldsSpaceWasAllocated
  or: [savedFirstFieldsSpace limit <= manager firstObject asUnsignedInteger
  or: [toFinger < top]]).
  (manager isMarked: o) ifTrue:
  [(manager isPinned: o)
  ifTrue: "The empty gaps between two adjacent pinned objects (when not filled below) are freed."
  [previousPin ifNotNil:
  [self assert: (manager startOfObject: previousPin) - toFinger >= (manager allocationUnit * 2).
  toFinger := manager addressAfter: previousPin.
+ self assert: toFinger <= (manager startOfObject: o)].
- self assert: toFinger < (manager startOfObject: o)].
  previousPin := o]
  ifFalse:
  [| availableSpace bytes next |
  (top := top + manager bytesPerOop) >= savedFirstFieldsSpace limit ifTrue:
  [savedFirstFieldsSpace top: top - manager bytesPerOop.
  ^false].
  [previousPin notNil
   and: [availableSpace := (manager startOfObject: previousPin) - toFinger.
  bytes := manager bytesInObject: o.
  bytes ~= availableSpace
  and: [bytes + (2 * manager allocationUnit) < availableSpace]]] whileTrue:
  ["The object does not fit in the space between toFinger and previousPin.
   Move toFinger beyond previousPin and update previousPin appropriately."
  toFinger := manager addressAfter: previousPin.
  next := manager objectStartingAt: toFinger.
  (self oop: next isGreaterThanOrEqualTo: o) ifTrue:
  [savedFirstFieldsSpace top: top - manager bytesPerOop.
  ^self continuePlanCompactSavingForwardersFrom: o toFinger: toFinger].
  previousPin := ((manager isMarked: next) and: [manager isPinned: next]) ifTrue: [next]].
  toFinger := self forwardMobileObject: o to: toFinger savedFirstFieldPtr: top]]].
  savedFirstFieldsSpace top: top.
  ^true!

Item was changed:
  ----- Method: SpurPlanningCompactor>>updatePointersInMobileObjectsWithTop: (in category 'compaction') -----
  updatePointersInMobileObjectsWithTop: initialTop
  "Sweep the mobile portion of the heap, updating all references to objects to their eventual locations.
  Remember to update the savedFirstFields of pointer objects, as these have been forwarded.
  This enumeration matches that in planCompactSavingForwarders and copyAndUnmarkMobileObjects."
  <var: 'initialTop' type: #usqInt>
  | toFinger top previousPin |
  <var: 'top' type: #usqInt>
  <var: 'toFinger' type: #usqInt>
  toFinger := manager startOfObject: firstFreeObject.
  top := initialTop.
  self deny: (manager isMarked: firstFreeObject).
  manager allOldSpaceEntitiesFrom: firstFreeObject do:
  [:o|
  self check: o.
+ self assert: (previousPin isNil or: [(manager isMarked: previousPin) and: [toFinger <= previousPin]]).
- self assert: (previousPin isNil or: [(manager isMarked: previousPin) and: [toFinger < previousPin]]).
  (manager isMarked: o) ifTrue:
  [(manager isPinned: o)
  ifTrue: "The empty gaps between two adjacent pinned objects (when not filled below) are freed."
  [self updatePointersIn: o.
  previousPin ifNotNil:
  [toFinger := manager addressAfter: previousPin].
  previousPin := o]
  ifFalse:
  [| availableSpace bytes next |
  (top := top + manager bytesPerOop) >= savedFirstFieldsSpace limit ifTrue:
  [^false].
  [previousPin notNil
   and: [availableSpace := (manager startOfObject: previousPin) - toFinger.
  bytes := manager bytesInObject: o.
  bytes ~= availableSpace
  and: [bytes + (2 * manager allocationUnit) < availableSpace]]] whileTrue:
  ["The object does not fit in the space between toFinger and previousPin.
   Move toFinger beyond previousPin and update previousPin appropriately."
  toFinger := manager addressAfter: previousPin.
  next := manager objectStartingAt: toFinger.
  (self oop: next isGreaterThanOrEqualTo: o) ifTrue:
  [^self continueUpdatePointersInMobileObjectsFrom: o withTop: top - manager bytesPerOop].
  previousPin := ((manager isMarked: next) and: [manager isPinned: next]) ifTrue: [next]].
  self updatePointersIn: o savedFirstFieldPointer: top.
  toFinger := toFinger + (manager bytesInObject: o)]]].
  ^true!

Item was changed:
  ----- Method: SpurPlanningCompactor>>useFreeChunkForSavedFirstFieldsSpace: (in category 'space management') -----
  useFreeChunkForSavedFirstFieldsSpace: highestSuitableFreeBlock
+ "Use the supplied free chunk to hold the savedFirstFieldsSpace. Invoked when
+ eden is found not to be big enough for the job. Avoid the first few fields so as
+ not to destroy the free chunk and there by confuse object enumeration."
- "Use the supplied free chunk to hold the savedFirstFieldsSpace.
- Invoked when eden is found not to be big enough for the job."
  <inline: true>
  savedFirstFieldsSpace
+ start: highestSuitableFreeBlock + (manager freeChunkLargerIndex * manager bytesPerOop);
- start: highestSuitableFreeBlock;
  limit: (manager addressAfter: highestSuitableFreeBlock)!

Loading...