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

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

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

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

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

Name: VMMaker.oscog-eem.2814
Author: eem
Time: 24 September 2020, 2:24:25.855864 pm
UUID: 53654b48-aee6-4a54-81cd-359178c61658
Ancestors: VMMaker.oscog-eem.2813

Use bridges to use a single loop for allObjectsDo: et al.  Install a bridge from freeStart (end of eden) to newSpaceStart and from pastSpaceStart (end of past space) to start of eden as required.
e.g. on MacOS X x86_64 saves 1.6% of the debug VM executable, 0.7% production.

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

Item was added:
+ ----- Method: SpurMemoryManager>>allEntitiesFrom:do: (in category 'object enumeration-private') -----
+ allEntitiesFrom: initialObject do: aBlock
+ <inline: true>
+ | prevObj prevPrevObj objOop |
+ prevPrevObj := prevObj := nil.
+ objOop := initialObject.
+ self enableObjectEnumerationFrom: initialObject.
+ [self assert: objOop \\ self allocationUnit = 0.
+ self oop: objOop isLessThan: endOfMemory] whileTrue:
+ [self assert: (self long64At: objOop) ~= 0.
+ aBlock value: objOop.
+ prevPrevObj := prevObj.
+ prevObj := objOop.
+ objOop := self objectAfter: objOop limit: endOfMemory].
+ self touch: prevPrevObj.
+ self touch: prevObj!

Item was removed:
- ----- Method: SpurMemoryManager>>allExistingNewSpaceObjectsDo: (in category 'object enumeration') -----
- allExistingNewSpaceObjectsDo: aBlock
- <inline: true>
- | prevObj prevPrevObj objOop limit |
- prevPrevObj := prevObj := nil.
- "After a scavenge eden is empty, futureSpace is empty, and all newSpace objects are
-  in pastSpace.  Objects are allocated in eden.  So enumerate only eden and pastSpace."
- objOop := self objectStartingAt: scavenger eden start.
- limit := freeStart.
- [self oop: objOop isLessThan: limit] whileTrue:
- [self assert: (self isEnumerableObjectNoAssert: objOop).
- aBlock value: objOop.
- prevPrevObj := prevObj.
- prevObj := objOop.
- objOop := self objectAfter: objOop limit: freeStart].
- objOop := self objectStartingAt: scavenger pastSpace start.
- limit := pastSpaceStart.
- [self oop: objOop isLessThan: limit] whileTrue:
- [self assert: (self isEnumerableObjectNoAssert: objOop).
- aBlock value: objOop.
- prevPrevObj := prevObj.
- prevObj := objOop.
- objOop := self objectAfter: objOop limit: limit].
- self touch: prevPrevObj.
- self touch: prevObj!

Item was removed:
- ----- Method: SpurMemoryManager>>allExistingObjectsDo: (in category 'object enumeration') -----
- allExistingObjectsDo: aBlock
- "Enumerate all objects, excluding any objects created
- during the execution of allExistingObjectsDo:."
- <inline: true>
- self allExistingNewSpaceObjectsDo: aBlock.
- self allExistingOldSpaceObjectsDo: aBlock!

Item was removed:
- ----- Method: SpurMemoryManager>>allExistingOldSpaceObjectsDo: (in category 'object enumeration') -----
- allExistingOldSpaceObjectsDo: aBlock
- "Enumerate all old space objects, excluding any objects created
- during the execution of allExistingOldSpaceObjectsDo:."
- <inline: true>
- | oldSpaceLimit prevObj prevPrevObj objOop |
- prevPrevObj := prevObj := nil.
- objOop := self firstObject.
- oldSpaceLimit := endOfMemory.
- [self assert: objOop \\ self allocationUnit = 0.
- self oop: objOop isLessThan: oldSpaceLimit] whileTrue:
- [(self isEnumerableObject: objOop) ifTrue:
- [aBlock value: objOop].
- prevPrevObj := prevObj.
- prevObj := objOop.
- objOop := self objectAfter: objOop limit: oldSpaceLimit].
- self touch: prevPrevObj.
- self touch: prevObj!

Item was changed:
+ ----- Method: SpurMemoryManager>>allHeapEntitiesDo: (in category 'object enumeration-private') -----
- ----- Method: SpurMemoryManager>>allHeapEntitiesDo: (in category 'object enumeration') -----
  allHeapEntitiesDo: aBlock
  "N.B. e.g. allObjects relies on the old/new order here."
  <inline: true>
  self allOldSpaceEntitiesDo: aBlock.
  self allNewSpaceEntitiesDo: aBlock!

Item was changed:
+ ----- Method: SpurMemoryManager>>allNewSpaceEntitiesDo: (in category 'object enumeration-private') -----
- ----- Method: SpurMemoryManager>>allNewSpaceEntitiesDo: (in category 'object enumeration') -----
  allNewSpaceEntitiesDo: aBlock
  "Enumerate all new space objects, including free objects."
  <inline: true>
+ | prevObj prevPrevObj objOop |
- | prevObj prevPrevObj objOop limit |
  prevPrevObj := prevObj := nil.
  "After a scavenge eden is empty, futureSpace is empty, and all newSpace objects are
   in pastSpace.  Objects are allocated in eden.  So enumerate only pastSpace and eden."
  self assert: (scavenger pastSpace start < scavenger eden start).
  objOop := self objectStartingAt: scavenger pastSpace start.
+ self enableNewSpaceObjectEnumerationFrom: objOop.
- limit := pastSpaceStart.
- [self oop: objOop isLessThan: limit] whileTrue:
- [aBlock value: objOop.
- prevPrevObj := prevObj.
- prevObj := objOop.
- objOop := self objectAfter: objOop limit: limit].
- objOop := self objectStartingAt: scavenger eden start.
  [self oop: objOop isLessThan: freeStart] whileTrue:
  [aBlock value: objOop.
  prevPrevObj := prevObj.
  prevObj := objOop.
  objOop := self objectAfter: objOop limit: freeStart].
  self touch: prevPrevObj.
  self touch: prevObj!

Item was changed:
  ----- Method: SpurMemoryManager>>allNewSpaceObjectsDo: (in category 'object enumeration') -----
  allNewSpaceObjectsDo: aBlock
  "Enumerate all new space objects, excluding free objects."
  <inline: true>
  self allNewSpaceEntitiesDo:
  [:objOop|
+ self assert: (self isBridgeOrEnumerableObjectNoAssert: objOop).
- self assert: (self isEnumerableObjectNoAssert: objOop).
  aBlock value: objOop]!

Item was changed:
  ----- Method: SpurMemoryManager>>allObjectsDo: (in category 'object enumeration') -----
  allObjectsDo: aBlock
  <inline: true>
+ | firstObject |
+ firstObject := self objectStartingAt: scavenger pastSpace start.
+ self enableObjectEnumerationFrom: firstObject.
+ self allEntitiesFrom: firstObject
+ do: [:objOop|
+ (self isEnumerableObject: objOop) ifTrue:
+ [aBlock value: objOop]]!
- self allNewSpaceObjectsDo: aBlock.
- self allOldSpaceObjectsDo: aBlock!

Item was added:
+ ----- Method: SpurMemoryManager>>allObjectsFrom:do: (in category 'object enumeration') -----
+ allObjectsFrom: initialObject do: aBlock
+ "Enumerate all objects (i.e. exclude bridges, forwarders and free chunks)
+ in oldSpace starting at initialObject."
+ <inline: true>
+ self allEntitiesFrom: initialObject
+ do: [:objOop|
+ (self isEnumerableObject: objOop) ifTrue:
+ [aBlock value: objOop]]!

Item was changed:
+ ----- Method: SpurMemoryManager>>allOldSpaceEntitiesDo: (in category 'object enumeration-private') -----
- ----- Method: SpurMemoryManager>>allOldSpaceEntitiesDo: (in category 'object enumeration') -----
  allOldSpaceEntitiesDo: aBlock
  <inline: true>
  self allOldSpaceEntitiesFrom: self firstObject do: aBlock!

Item was changed:
+ ----- Method: SpurMemoryManager>>allOldSpaceEntitiesFrom:do: (in category 'object enumeration-private') -----
- ----- Method: SpurMemoryManager>>allOldSpaceEntitiesFrom:do: (in category 'object enumeration') -----
  allOldSpaceEntitiesFrom: initialObject do: aBlock
  <inline: true>
  | prevObj prevPrevObj objOop |
  self assert: (self isOldObject: initialObject).
  prevPrevObj := prevObj := nil.
  objOop := initialObject.
  [self assert: objOop \\ self allocationUnit = 0.
  self oop: objOop isLessThan: endOfMemory] whileTrue:
  [self assert: (self long64At: objOop) ~= 0.
  aBlock value: objOop.
  prevPrevObj := prevObj.
  prevObj := objOop.
  objOop := self objectAfter: objOop limit: endOfMemory].
  self touch: prevPrevObj.
  self touch: prevObj!

Item was changed:
+ ----- Method: SpurMemoryManager>>allPastSpaceEntitiesDo: (in category 'object enumeration-private') -----
- ----- Method: SpurMemoryManager>>allPastSpaceEntitiesDo: (in category 'object enumeration') -----
  allPastSpaceEntitiesDo: aBlock
  "Enumerate all past space objects, including free objects."
  <inline: true>
  | prevObj prevPrevObj objOop |
  prevPrevObj := prevObj := nil.
  objOop := self objectStartingAt: scavenger pastSpace start.
  [self oop: objOop isLessThan: pastSpaceStart] whileTrue:
  [aBlock value: objOop.
  prevPrevObj := prevObj.
  prevObj := objOop.
  objOop := self objectAfter: objOop limit: pastSpaceStart].
  self touch: prevPrevObj.
  self touch: prevObj!

Item was added:
+ ----- Method: SpurMemoryManager>>enableNewSpaceObjectEnumerationFrom: (in category 'object enumeration-private') -----
+ enableNewSpaceObjectEnumerationFrom: initialObject
+ "We use bridges to stitch segments together to make it appear that the heap is one contiguous space.
+ Bridges at the end of oldSpace segments are maintained.  Bridges at the end of pastSpace and eden
+ are temporary, and are established here, depending on the current sizes of pastSpace end eden."
+ <inline: #always>
+ ((self oop: initialObject isLessThan: scavenger eden start)
+ and: [scavenger eden start > pastSpaceStart]) ifTrue:
+ [self initSegmentBridgeWithBytes: scavenger eden start - pastSpaceStart at: pastSpaceStart]!

Item was added:
+ ----- Method: SpurMemoryManager>>enableObjectEnumerationFrom: (in category 'object enumeration-private') -----
+ enableObjectEnumerationFrom: initialObject
+ "We use bridges to stitch segments together to make it appear that the heap is one contiguous space.
+ Bridges at the end of oldSpace segments are maintained.  Bridges at the end of pastSpace and eden
+ are temporary, and are established here, depending on the current sizes of pastSpace end eden."
+ <inline: #always>
+ (self oop: initialObject isLessThan: oldSpaceStart) ifTrue:
+ [self initSegmentBridgeWithBytes: oldSpaceStart - freeStart at: freeStart.
+ self enableNewSpaceObjectEnumerationFrom: initialObject]!

Item was added:
+ ----- Method: SpurMemoryManager>>isBridgeOrEnumerableObjectNoAssert: (in category 'object enumeration') -----
+ isBridgeOrEnumerableObjectNoAssert: objOop
+ "Answer if objOop should be included in an allObjects...Do: enumeration.
+ This is for assert-checking only."
+ | classIndex |
+ classIndex := self classIndexOf: objOop.
+ ^classIndex >= self isForwardedObjectClassIndexPun
+   ifTrue: [classIndex < (numClassTablePages * self classTablePageSize)]
+ ifFalse: [classIndex = self segmentBridgePun]!