[Vm-dev] VM Maker: VMMaker.oscog-cb.2486.mcz

commits at source.squeak.org commits at source.squeak.org
Tue Nov 27 10:42:40 UTC 2018


ClementBera uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-cb.2486.mcz

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

Name: VMMaker.oscog-cb.2486
Author: cb
Time: 27 November 2018, 11:41:29.222312 am
UUID: 38ce095a-ec39-4d1d-b8c7-096335f5b687
Ancestors: VMMaker.oscog-eem.2485

Based on Eliot's suggestion, SelectiveCompactor just abort compaction when it fails to find a segment to compact into or to allocate one, instead of crashing the VM with the error 'no segment to compact into'

Mostly added comments.

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

Item was removed:
- ----- Method: SpurSelectiveCompactor>>allocateSegmentToFill (in category 'segment to fill') -----
- allocateSegmentToFill
- 	| res |
- 	res := manager growOldSpaceByAtLeast: manager growHeadroom.
- 	res ifNil: [self error: 'not enough memory for selective compaction'].!

Item was changed:
  ----- Method: SpurSelectiveCompactor>>computeSegmentsToCompact (in category 'compaction') -----
  computeSegmentsToCompact
  	"Compute segments to compact: least occupied.
+ 	 Answers true if compaction should be done 
+ 	 (at least 1 segment is being compacted and
+ 	 there is a segment to compact into)."
- 	 Answers true if at least 1 segment is being compacted."
  	| canStillClaim aboutToClaim aboutToClaimSegment atLeastOneSegmentToCompact |
  	<var: 'aboutToClaimSegment' type: #'SpurSegmentInfo *'>
  	atLeastOneSegmentToCompact := false.
  	aboutToClaimSegment := self findNextSegmentToCompact.
  	"Segment to fill is one of the segment compacted last GC. 
  	 If no segment were compacted last GC, and that there is 
  	 at least one segment to compact, allocate a new one."
  	aboutToClaimSegment ifNil: [^false].
+ 	segmentToFill ifNil:
+ 		[self findOrAllocateSegmentToFill.
+ 		 segmentToFill ifNil: ["Abort compaction"^false]].
- 	segmentToFill ifNil: [self findOrAllocateSegmentToFill].
  	canStillClaim := segmentToFill segSize - manager bridgeSize.
  	[aboutToClaimSegment ifNil: [^atLeastOneSegmentToCompact].
  	 aboutToClaim := self sizeClaimedIn: aboutToClaimSegment.
  	 aboutToClaim < canStillClaim ] whileTrue: 
  		[self markSegmentAsBeingCompacted: aboutToClaimSegment.
  		 atLeastOneSegmentToCompact := true.
  		 canStillClaim := canStillClaim - aboutToClaim.
  		 aboutToClaimSegment := self findNextSegmentToCompact].
  	^atLeastOneSegmentToCompact!

Item was changed:
  ----- Method: SpurSelectiveCompactor>>findOrAllocateSegmentToFill (in category 'segment to fill') -----
  findOrAllocateSegmentToFill
  	"There was no compacted segments from past GC that we can directly re-use.
  	 We need either to find an empty segment or allocate a new one."
  	| segIndex |
  	self findAndSetSegmentToFill.
  	segmentToFill ifNotNil: [^0].
  	"No empty segment. We need to allocate a new one"
+ 	(manager growOldSpaceByAtLeast: manager growHeadroom) ifNil: ["failed to allocate"^0].
- 	self allocateSegmentToFill.
  	"We don't know which segment it is that we've just allocated... So we look for it... This is a bit dumb."
  	segIndex := self findAndSetSegmentToFill.
  	"Lilliputian performance hack management... Last lilliputian of new segment is same as prev because no lilliputian in new segment"
  	self setLastLilliputianChunkAtindex: segIndex to: (self lastLilliputianChunkAtIndex: segIndex - 1).
  	self assert: segmentToFill ~~ nil.
+ 	
  	!

Item was changed:
  ----- Method: SpurSelectiveCompactor>>selectiveCompaction (in category 'compaction') -----
  selectiveCompaction
  	"Figures out which segments to compact and compact them into segmentToFill"
+ 	| shouldCompact |
- 	| atLeastOneSegmentToCompact |
  	<inline: #never> "profiling"
  	self assertNoSegmentBeingCompacted.
+ 	"Should compact only if there is at least 1 segment to compact 
+ 	 and there is a segment to compact into"
+ 	shouldCompact := self computeSegmentsToCompact.
- 	atLeastOneSegmentToCompact := self computeSegmentsToCompact.
  	"If no compaction we don't pay forwarding cost (stack scan, cache scan, etc.)
  	 and we don't allocate segmentToFill if none available."
+ 	shouldCompact ifTrue:
+ 		[self assert: segmentToFill ~~ nil.
+ 		 self compactSegmentsToCompact].
- 	atLeastOneSegmentToCompact 
- 		ifTrue:
- 			[self assert: segmentToFill ~~ nil.
- 		 	 self compactSegmentsToCompact].
  	manager checkFreeSpace: GCModeFull.!

Item was removed:
- ----- Method: SpurSelectiveCompactorSimulator>>allocateSegmentToFill (in category 'freeing') -----
- allocateSegmentToFill
- 	self talk: 'Allocation of new segment to fill (none available)'.
- 	super allocateSegmentToFill!



More information about the Vm-dev mailing list