-
Notifications
You must be signed in to change notification settings - Fork 65
/
SpurPlanningCompactor.class.st
1119 lines (1007 loc) · 47.5 KB
/
SpurPlanningCompactor.class.st
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
"
SpurPlanningCompactor implements the classic planning compaction algorithm for Spur. It uses the fact that there is room for a forwarding pointer in all objects to store the eventual position of an object in the first field. It therefore first locates a large free chunk, or eden or a memory segment, to use as the savedFirstFieldsSpace, which it uses to store the first fields of objects that will be compacted. It then makes at least three passes through the heap.
The first pass plans where live movable objects will go, copying their first field to the next slot in savedFirstFieldsSpace, and setting their forwarding pointer to point to their eventual location (see planCompactSavingForwarders). The second pass updates all pointers in live pointer objects to point to objects' final destinations, including the fields in savedFirstFieldsSpace (see updatePointers and updatePointersInMobileObjects). The third pass moves objects to their final positions, unmarking objects, and restoring saved first fields as it does so (see copyAndUnmark: and copyAndUnmarkMobileObjects). If the forwarding fields of live objects in the to-be-moved portion of the entire heap won't fit in savedFirstFieldsSpace, then additional passes can be made until the entire heap has been compacted. When snapshotting multiple passes are made, but when doing a normal GC only one pass is made.
Each pass uses a three finger algorithm, a simple extension of the classic two finger algorithm with an extra finger used to identify the lowest pinned object between the to and from fingers. Objects are moved down, starting at the first free object or chunk, provided that they fit below the lowest pinned object above the to finger. When an object won't fit the to finger is moved above the pinned object and the third finger is reset to the next pinned object below the from finger, if any.
Instance Variables
anomaly <Oop>
biasForGC <Boolean>
firstFieldOfRememberedSet <Oop>
firstFreeObject <Oop>
firstMobileObject <Oop>
lastMobileObject <Oop>
mobileStart <Integer address>
objectAfterLastMobileObject <Oop|nil>
savedFirstFieldsSpace <SpurContiguousObjStack>
savedFirstFieldsSpaceWasAllocated <Boolean>
anomaly
- if any bogus object is detected by asserts, etc, it is stored in anomaly
biasForGC
- true if compacting for GC, in which case do only one pass, or false if compacting for snapshot, in which case do as many passes as necessary to compact the entire heap.
firstFieldOfRememberedSet
- the saved first field of the rememberedSet. The rememberedSet must be relocated specially because it is not a pointer object. And hence the first field needs to be extracted for proper relocation.
firstFreeObject
- the first free object in a compaction pass.
firstMobileObject
- the first mobile object in a compaction. Unpinned objects from the firstMobileObject through to the lastMobileObject are implicitly forwarded.
lastMobileObject
- the last mobile object in a compaction. Unpinned objects from the firstMobileObject through to the lastMobileObject are implicitly forwarded.
mobileStart
- the address of the first byte in firstFreeObject
objectAfterLastMobileObject
- the object following the last object that can be moved, used when more than one pass is needed.
savedFirstFieldsSpace
- the space holding the saved first fields, each overwritten by a forwarding pointer, for the objects from firstMobileObject through to lastMobileObject.
savedFirstFieldsSpaceWasAllocated
- if true, the memory for savedFirstFieldsSpace was obtained via a call of sqAllocateMemorySegmentOfSize:Above:AllocatedSizeInto:
"
Class {
#name : #SpurPlanningCompactor,
#superclass : #SpurCompactor,
#instVars : [
'anomaly',
'biasForGC',
'firstFieldOfRememberedSet',
'firstFreeObject',
'firstMobileObject',
'lastMobileObject',
'mobileStart',
'objectAfterLastMobileObject',
'savedFirstFieldsSpace',
'savedFirstFieldsSpaceNotInOldSpace',
'savedFirstFieldSpaceMaxSlots',
'firstFieldOfPermToOldRememberedSet',
'firstFieldOfPermToNewRememberedSet'
],
#pools : [
'VMBytecodeConstants'
],
#category : #'VMMaker-SpurMemoryManager'
}
{ #category : #translation }
SpurPlanningCompactor class >> declareCVarsIn: aCCodeGenerator [
super declareCVarsIn: aCCodeGenerator.
self declareCAsOop: (self instVarNames select: [:iv| iv endsWith: 'Object']) in: aCCodeGenerator.
aCCodeGenerator
var: 'savedFirstFieldsSpace' type: #SpurContiguousObjStack
]
{ #category : #simulation }
SpurPlanningCompactor class >> simulatorClass [
^SpurPlanningCompactorSimulator
]
{ #category : #'compaction - api' }
SpurPlanningCompactor >> biasForGC [
<inline: true>
biasForGC := true
]
{ #category : #'compaction - api' }
SpurPlanningCompactor >> biasForSnapshot [
biasForGC := false
]
{ #category : #private }
SpurPlanningCompactor >> check: obj [
"No-op in the real class."
<inline: true>
]
{ #category : #private }
SpurPlanningCompactor >> coalesceFrom: maybeStartOfFree [
"manager printOopsFrom: maybeStartOfFree to: manager getMemoryMap oldSpaceEnd"
<var: 'maybeStartOfFree' type: #usqInt>
|obj next objBytes nextBytes|
<var: 'obj' type: #usqInt>
<var: 'next' type: #usqInt>
maybeStartOfFree >= manager getMemoryMap oldSpaceEnd ifTrue:
[^self].
obj := manager objectStartingAt: maybeStartOfFree.
[next := manager oldSpaceObjectAfter: obj.
next < manager getMemoryMap oldSpaceEnd] whileTrue:
[((manager isFreeObject: obj) and: [manager isFreeObject: next])
ifTrue:
[objBytes := manager bytesInObject: obj.
nextBytes := manager bytesInObject: next.
manager unlinkFreeChunk: obj chunkBytes: objBytes.
manager unlinkFreeChunk: next chunkBytes: nextBytes.
obj := manager freeChunkWithBytes: objBytes + nextBytes at: (manager startOfObject: obj)]
ifFalse:
[obj := next]]
]
{ #category : #'compaction - api' }
SpurPlanningCompactor >> compact [
"Sweep all of old space, sliding unpinned marked objects down over free and unmarked objects.
Let the segmentManager mark which segments contain pinned objects via notePinned:."
| finalPass firstPass |
<inline: #never> "for profiling"
"Check if compaction is required, and if not, cleanup the heap.
A compaction is not required if the heap is considered compacted already."
self initializeScanCheckingForFullyCompactedHeap ifTrue: [
^self unmarkObjectsInFullyCompactedHeap ].
self initializeCompaction.
firstPass := true.
[finalPass := self planCompactSavingForwarders.
self assert: (self validRelocationPlanInPass: finalPass) = 0.
self updatePointers.
self copyAndUnmark: firstPass.
"Would like to check here, but can't if multi-pass."
false ifTrue: [manager checkFreeSpace: GCModeFull].
"Currently we do only a single pass if a normal GC, assuming that a pass will
always compact plenty of space. But we should perhaps check this assumption
by looking at the large free tree and seeing that the ratio of the largest free
chunk to the total ammount of free space is high."
finalPass or: [biasForGC]] whileFalse:
[firstPass := false.
self reinitializeScanFrom: firstFreeObject.
firstMobileObject > firstFreeObject ifFalse:
["We get here when firstFreeObject is the last object in memory.
firstMobileObject may be random value from previous compaction
in this case, and heap is fully compacted. Abort compaction."
"We set firstFreeObject to firstMobileObject for unmarking."
firstFreeObject := firstMobileObject.
self unmarkObjectsFromFirstFreeObject.
manager checkFreeSpace: GCModeFull.
^self endCompaction].
self updateSavedFirstFieldsSpaceIfNecessary].
manager checkFreeSpace: GCModeFull.
self endCompaction
]
{ #category : #'space management' }
SpurPlanningCompactor >> configureSavedFirstFieldsSpaceStart: theStart limit: theLimit isOldSpace: isOldSpace [
"Use teden to hold the savedFirstFieldsSpace."
<inline: true>
| limit |
limit := theLimit.
savedFirstFieldSpaceMaxSlots ifNotNil: [
limit := limit min:
(theStart + (savedFirstFieldSpaceMaxSlots * manager bytesPerOop)) ].
savedFirstFieldsSpace
start: theStart;
limit: limit.
savedFirstFieldsSpaceNotInOldSpace := isOldSpace not
]
{ #category : #compaction }
SpurPlanningCompactor >> copyAndUnmark: firstPass [
"Sweep the heap, unmarking all objects and moving mobile objects to their correct positions,
restoring their savedFirstFields."
<inline: #never>
| finalPass |
self logPhase: 'copying and unmarking...'.
firstPass ifTrue: [
self unmarkInitialImmobileObjects ].
finalPass := self copyAndUnmarkMobileObjects.
(self thereAreObjectsToMove
and: [finalPass not
and: [biasForGC]]) ifTrue: "only ever one pass if biasForGC is true."
[self unmarkObjectsFromFirstFreeObject]
]
{ #category : #compaction }
SpurPlanningCompactor >> copyAndUnmarkMobileObjects [
"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.
Answer if the end of the heap was reached (savedFirstFieldsSpace has not overflowed).
The enumerations in planCompactSavingForwarders, updatePointersInMobileObjects and copyAndUnmarkMobileObjects
match. We could implement them as a single enumeration method taking several block arguments, but arguably that
would make understanding an already tricky algorithm more difficult. Instead we tolerate the duplication and encourage
the reader to diff the three methods to see where they diverge (e.g. via Cmd-shift-C)."
<inline: #never>
| toFinger top previousPin startOfPreviousPin |
<var: 'o' type: #usqInt>
<var: 'top' type: #usqInt>
<var: 'toFinger' type: #usqInt>
<var: 'previousPin' type: #usqInt>
<var: 'startOfPreviousPin' type: #usqInt>
self deny: (manager isMarked: firstFreeObject).
toFinger := manager startOfObject: firstFreeObject.
top := savedFirstFieldsSpace start.
startOfPreviousPin := 0.
manager allOldSpaceEntitiesForCompactingFrom: firstFreeObject to: (lastMobileObject ifNil: manager nilObject) do:
[:o :n|
self check: o.
self assert: (previousPin
ifNil: [toFinger <= (manager startOfObject: o)]
ifNotNil: [(manager isMarked: previousPin) and: [toFinger <= startOfPreviousPin]]).
self assert: (savedFirstFieldsSpaceNotInOldSpace or: [toFinger < top]).
(manager isMarked: o) ifTrue:
[(manager isPinned: o)
ifTrue:
[previousPin ifNil:
[previousPin := o. startOfPreviousPin := manager startOfObject: o]]
ifFalse:
[| availableSpace bytes |
bytes := manager bytesInObject: o.
[toFinger <= startOfPreviousPin
and: [bytes ~= (availableSpace := startOfPreviousPin - toFinger)
and: [bytes + (2 * manager allocationUnit) > availableSpace]]] whileTrue:
["The object does not fit in the space between toFinger and previousPin.
Move toFinger up to point at the first unmarked or mobile object after
previousPin, or, if previousPin is contiguous with o, to the start of this
object. Update previousPin to be the next pinned object above toFInger
and below this object, or nil if no such pinned object exists.
Any unfillable gaps between adjacent pinned objects will be freed."
availableSpace > 0 ifTrue:
[manager addFreeChunkWithBytes: availableSpace at: toFinger].
[self assert: ((manager isMarked: previousPin) and: [manager isPinned: previousPin]).
self unmarkPinned: previousPin.
toFinger := manager addressAfter: previousPin.
previousPin := manager objectStartingAt: toFinger.
(manager isMarked: previousPin)
and: [(manager isPinned: previousPin)
and: [previousPin < o]]]
whileTrue.
"Now previousPin is either equal to o or mobile.
Move it to the next pinned object below o"
[previousPin >= o
or: [(manager isMarked: previousPin)
and: [manager isPinned: previousPin]]] whileFalse:
[previousPin := manager oldSpaceObjectAfter: previousPin].
previousPin >= o
ifTrue: [previousPin := nil. startOfPreviousPin := 0]
ifFalse: [startOfPreviousPin := manager startOfObject: previousPin]].
self copyAndUnmarkObject: o to: toFinger bytes: bytes firstField: (manager unsignedLongAt: top).
toFinger := toFinger + bytes.
(top := top + manager bytesPerOop) >= savedFirstFieldsSpace limit ifTrue:
[self assert: savedFirstFieldsSpace top = (top - manager bytesPerOop).
self assert: n = objectAfterLastMobileObject.
previousPin ifNil: [previousPin := n. startOfPreviousPin := manager startOfObject: n].
"Create a free object for firstFreeObject to be set to on the next pass, but
do not link it into the free tree as it will be written over in that next pass."
toFinger < startOfPreviousPin
ifTrue:
[firstFreeObject := manager initFreeChunkWithBytes: startOfPreviousPin - toFinger at: toFinger]
ifFalse:
[firstFreeObject := previousPin].
^false]]]].
self freeFrom: toFinger upTo: manager getMemoryMap oldSpaceEnd nextObject: (previousPin ifNil: [objectAfterLastMobileObject ifNil: [manager objectAfter: firstFreeObject]]).
self coalesceFrom: toFinger.
^true
]
{ #category : #compaction }
SpurPlanningCompactor >> copyAndUnmarkObject: o to: toFinger bytes: bytes firstField: firstField [
"Copy the object to toFinger, clearing its mark bit both in the target and the corpse,
and restoring its firstField, which was overwritten with a forwarding pointer."
<inline: true>
| numSlots destObj start |
manager setIsMarkedOf: o to: false.
numSlots := manager rawNumSlotsOf: o.
destObj := (manager objectWithRawSlotsHasOverflowHeader: numSlots)
ifTrue: [toFinger + manager baseHeaderSize]
ifFalse: [toFinger].
start := manager startOfObject: o given: numSlots.
"memmove must be used since the ranges may overlap."
manager
memmove: toFinger asVoidPointer _: start asVoidPointer _: bytes;
storePointerUnchecked: 0 ofObject: destObj withValue: firstField
]
{ #category : #compaction }
SpurPlanningCompactor >> endCompaction [
manager
unmarkSurvivingObjectsForCompact;
endSlidingCompaction.
self repinRememberedSet.
self releaseSavedFirstFieldsSpace
]
{ #category : #'space management' }
SpurPlanningCompactor >> findHighestSuitableFreeBlock: spaceEstimate [
"If a freeBlock of size at least spaceEstimate exists high enough in the heap, choose it.
Ignoring pinned objects for now, the total ammount of shrinkage is expected to be
at least totalFreeOldSpace (because of collected objects). So any free chunk which is
at or above oldSpaceEnd - totalFreeOldSpace should not be corrupted during compaction.
Let's play with this for a while and see how we get on."
<inline: true>
manager findLargestFreeChunk ifNotNil:
[:largestFreeChunk|
((manager bytesInObject: largestFreeChunk) >= spaceEstimate
and: [largestFreeChunk asUnsignedInteger > (manager getMemoryMap oldSpaceEnd - manager freeSize) asUnsignedInteger]) ifTrue:
[^largestFreeChunk]].
^nil
]
{ #category : #private }
SpurPlanningCompactor >> forwardMobileObject: o to: toFinger savedFirstFieldPtr: savedFirstFieldPtr [
"Forward a mobile object to some new location, saving its first field through savedFirstFieldPtr.
Don't use forward:to:; we dont want to alter the object in any way other than by setting the forwarding pointer."
<inline: true>
lastMobileObject := o.
manager
longAt: savedFirstFieldPtr
put: (manager fetchPointer: 0 ofObject: o);
storePointerUnchecked: 0
ofObject: o
withValue: ((manager hasOverflowHeader: o)
ifTrue: [toFinger + manager baseHeaderSize]
ifFalse: [toFinger]).
self recordMovementOf: o to: toFinger savedFirstFieldPtr: savedFirstFieldPtr
]
{ #category : #private }
SpurPlanningCompactor >> freeFrom: initialToFinger upTo: limit nextObject: nextObject [
"Free from toFinger up to limit, dealing with possible intervening pinned objects."
<inline: false>
<var: 'limit' type: #usqInt>
<var: 'initialToFinger' type: #usqInt>
| toFinger obj objStart |
<var: 'objStart' type: #usqInt>
<var: 'toFinger' type: #usqInt>
self cCode: [] inSmalltalk:
[coInterpreter cr; cr; print: 'freeing at '; printHexnp: initialToFinger; print: ' up to '; printHexnp: limit; cr].
toFinger := initialToFinger.
objStart := manager startOfObject: nextObject.
toFinger < objStart ifTrue:
[manager addFreeChunkWithBytes: objStart - toFinger at: toFinger].
toFinger := objStart.
[objStart < limit] whileTrue:
[obj := manager objectStartingAt: objStart.
((manager isMarked: obj) and: [manager isPinned: obj])
ifTrue:
[self unmarkPinned: obj.
toFinger < objStart ifTrue:
[manager addFreeChunkWithBytes: objStart - toFinger at: toFinger].
toFinger := objStart := manager addressAfter: obj]
ifFalse:
[objStart := manager addressAfter: obj]].
limit > toFinger ifTrue:
[manager addFreeChunkWithBytes: limit - toFinger at: toFinger]
]
{ #category : #initialization }
SpurPlanningCompactor >> initialize [
biasForGC := true.
savedFirstFieldsSpace := SpurContiguousObjStack new.
savedFirstFieldsSpaceNotInOldSpace := true.
savedFirstFieldSpaceMaxSlots := nil.
]
{ #category : #compaction }
SpurPlanningCompactor >> initializeCompaction [
manager checkFreeSpace: GCModeFull.
self selectSavedFirstFieldsSpace.
self unpinRememberedSet.
manager
prepareObjStacksForPlanningCompactor;
resetFreeListHeads;
totalFreeOldSpace: 0;
beginSlidingCompaction.
savedFirstFieldsSpace top: savedFirstFieldsSpace start - manager bytesPerOop
]
{ #category : #compaction }
SpurPlanningCompactor >> initializeScanCheckingForFullyCompactedHeap [
"Return if the heap is fully compacted.
That is, if there are no marked objects after some free chunk.
The downside of this definition, is that a heap that has a sequence of objects:
- marked object
- unmarked object
- free space
- end of the heap
Is considered compacted, and thus the unmarked object will not be coallesced with the free space in this pass"
"Scan for firstFreeObject and firstMobileObject from the start of memory.
Answer if the heap is already fully compacted."
firstMobileObject := lastMobileObject := objectAfterLastMobileObject := nil.
self reinitializeScanFrom: manager hiddenRootsObject.
firstFreeObject ifNil:
[self error: 'uncompactable heap; no unmarked objects found'].
^firstMobileObject >= manager getMemoryMap oldSpaceEnd
]
{ #category : #private }
SpurPlanningCompactor >> isMobile: obj [
<inline: true>
^(self oop: obj isGreaterThanOrEqualTo: mobileStart andLessThanOrEqualTo: lastMobileObject)
and: [(manager isPinned: obj) not]
]
{ #category : #private }
SpurPlanningCompactor >> isPostMobile: obj [
"For asserts"
^self oop: obj isGreaterThanOrEqualTo: mobileStart andLessThanOrEqualTo: lastMobileObject
]
{ #category : #private }
SpurPlanningCompactor >> logPhase: phaseName [
<inline: true>
self cCode: '' inSmalltalk: [coInterpreter transcript nextPutAll: phaseName; flush].
]
{ #category : #private }
SpurPlanningCompactor >> numPointerSlotsWhileCompactingOf: obj withFormat: fmt savedFirstFieldPointer: firstFieldPtr [
"This is a version of SpurMemoryManager>>numPointerSlotsOf: that deals with the
possibility of obj being a CompiledMethod whose header is in savedFirstFieldsSpace.
Answer the number of pointer fields in the given object.
Works with CompiledMethods, as well as ordinary objects."
<inline: true>
| contextSize numLiterals header |
self assert: (firstFieldPtr notNil and: [self isMobile: obj]).
fmt <= manager lastPointerFormat ifTrue:
[(fmt = manager indexablePointersFormat
and: [manager isContextNonImm: obj]) ifTrue:
["contexts end at the stack pointer"
contextSize := coInterpreter fetchStackPointerOf: obj.
^CtxtTempFrameStart + contextSize].
^manager numSlotsOf: obj "all pointers"].
self deny: fmt = manager forwardedFormat.
fmt < manager firstCompiledMethodFormat ifTrue: [^0]. "no pointers"
"CompiledMethod: contains both pointers and bytes"
header := manager methodHeaderFromSavedFirstField: (manager longAt: firstFieldPtr).
numLiterals := manager literalCountOfMethodHeader: header.
^numLiterals + LiteralStart
]
{ #category : #compaction }
SpurPlanningCompactor >> 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).
The enumerations in planCompactSavingForwarders, updatePointersInMobileObjects and copyAndUnmarkMobileObjects
match. We could implement them as a single enumeration method taking several block arguments, but arguably that
would make understanding an already tricky algorithm more difficult. Instead we tolerate the duplication and encourage
the reader to diff the three methods to see where they diverge (e.g. via Cmd-shift-C)."
<inline: #never>
| toFinger top previousPin startOfPreviousPin |
<var: 'o' type: #usqInt>
<var: 'top' type: #usqInt>
<var: 'toFinger' type: #usqInt>
<var: 'previousPin' type: #usqInt>
<var: 'startOfPreviousPin' type: #usqInt>
savedFirstFieldsSpace top < savedFirstFieldsSpace start ifTrue:
[self logPhase: 'planning...'].
self deny: (manager isMarked: firstFreeObject).
toFinger := manager startOfObject: firstFreeObject.
top := savedFirstFieldsSpace start.
startOfPreviousPin := 0.
lastMobileObject := nil.
manager allOldSpaceEntitiesFrom: firstFreeObject do:
[:o|
self check: o.
self assert: (previousPin
ifNil: [toFinger <= (manager startOfObject: o)]
ifNotNil: [(manager isMarked: previousPin) and: [toFinger <= startOfPreviousPin]]).
self assert: (savedFirstFieldsSpaceNotInOldSpace or: [toFinger < top]).
(manager isMarked: o) ifTrue:
[(manager isPinned: o)
ifTrue:
[previousPin ifNil:
[previousPin := o. startOfPreviousPin := manager startOfObject: o]]
ifFalse:
[| availableSpace bytes |
bytes := manager bytesInObject: o.
[toFinger <= startOfPreviousPin
and: [bytes ~= (availableSpace := startOfPreviousPin - toFinger)
and: [bytes + (2 * manager allocationUnit) > availableSpace]]] whileTrue:
["The object does not fit in the space between toFinger and previousPin.
Move toFinger up to point at the first unmarked or mobile object after
previousPin, or, if previousPin is contiguous with o, to the start of this
object. Update previousPin to be the next pinned object above toFInger
and below this object, or nil if no such pinned object exists.
Any unfillable gaps between adjacent pinned objects will be freed."
[toFinger := manager addressAfter: previousPin.
previousPin := manager objectStartingAt: toFinger.
(manager isMarked: previousPin)
and: [(manager isPinned: previousPin)
and: [previousPin < o]]]
whileTrue.
"Now previousPin is either equal to o or mobile.
Move it to the next pinned object below o"
[previousPin >= o
or: [(manager isMarked: previousPin)
and: [manager isPinned: previousPin]]] whileFalse:
[previousPin := manager oldSpaceObjectAfter: previousPin].
previousPin >= o
ifTrue: [previousPin := nil. startOfPreviousPin := 0]
ifFalse: [startOfPreviousPin := manager startOfObject: previousPin]].
self forwardMobileObject: o to: toFinger savedFirstFieldPtr: top.
toFinger := toFinger + bytes.
(top := top + manager bytesPerOop) >= savedFirstFieldsSpace limit ifTrue:
[savedFirstFieldsSpace top: top - manager bytesPerOop.
objectAfterLastMobileObject := manager oldSpaceObjectAfter: lastMobileObject.
^false]]]].
"If the heap is already fully compacted there will be no lastMobileObject..."
lastMobileObject ifNotNil:
[savedFirstFieldsSpace top: top - manager bytesPerOop.
objectAfterLastMobileObject := manager oldSpaceObjectAfter: lastMobileObject].
^true
]
{ #category : #'debug support' }
SpurPlanningCompactor >> printTheBogons: aBogon [
<inline: true>
coInterpreter
print: 'bogon '; printHexnp: aBogon; cr;
print: 'anomaly '; printHexnp: anomaly; cr
]
{ #category : #private }
SpurPlanningCompactor >> recordMovementOf: o to: toFinger savedFirstFieldPtr: savedFirstFieldPtr [
"No-op in the real class."
<inline: true>
]
{ #category : #compaction }
SpurPlanningCompactor >> reinitializeScanFrom: initialObject [
"Search for firstFreeObject and firstMobileObject from initialObject, which is the
hiddenRootsObject on the first pass, and the objectAfterLastMobileObject on
subsequent passes)."
firstMobileObject := manager getMemoryMap oldSpaceEnd.
firstFreeObject := self scanForFirstFreeAndFirstMobileObjectFrom: initialObject.
firstFreeObject ifNotNil:
[mobileStart := manager startOfObject: firstFreeObject].
objectAfterLastMobileObject ifNotNil:
[manager allOldSpaceEntitiesFrom: firstFreeObject to: objectAfterLastMobileObject do:
[:o|
((manager isPinned: o)
or: [(manager isMarked: o) not
or: [objectAfterLastMobileObject = o]]) ifFalse:
[manager setIsMarkedOf: o to: false]].
firstMobileObject := objectAfterLastMobileObject]
]
{ #category : #'space management' }
SpurPlanningCompactor >> releaseSavedFirstFieldsSpace [
<inline: true>
self savedFirstFieldsSpaceWasAllocated ifTrue:
[manager
sqDeallocateMemorySegmentAt: savedFirstFieldsSpace start asVoidPointer
OfSize: savedFirstFieldsSpace limit - savedFirstFieldsSpace start]
]
{ #category : #compaction }
SpurPlanningCompactor >> relocateObjectsInHeapEntity: heapEntity from: startIndex to: finishIndex [
"Sweep the fields in some non-pointer heap entity (objStackPage, rememberedSet),
updating all references to mobile objects to their eventual locations. Answer the
heapEntity's eventual location."
<inline: true>
startIndex to: finishIndex do:
[:i| | oop fwd |
oop := manager fetchPointer: i ofObject: heapEntity.
((manager isNonImmediate: oop) and: [self isMobile: oop]) ifTrue:
[self assert: (manager isMarked: oop).
fwd := manager fetchPointer: 0 ofObject: oop.
self assert: (self isPostMobile: fwd).
manager storePointerUnchecked: i ofObject: heapEntity withValue: fwd]].
^(self isMobile: heapEntity)
ifTrue: [manager fetchPointer: 0 ofObject: heapEntity]
ifFalse: [heapEntity]
]
{ #category : #'gc - scavenge/compact' }
SpurPlanningCompactor >> remapObj: objOop [
"Scavenge or simply follow objOop. Answer the new location of objOop.
The send should have been guarded by a send of shouldRemapOop:.
The method is called remapObj: for compatibility with ObjectMemory."
<api>
<inline: false>
^manager slidingCompactionRemapObj: objOop
]
{ #category : #private }
SpurPlanningCompactor >> repinRememberedSet [
<inline: true>
manager getFromOldSpaceRememberedSet rememberedSetSize > 0 ifTrue:
[manager storePointerUnchecked: 0 ofObject: manager oldRememberedSetObj withValue: firstFieldOfRememberedSet].
manager setIsPinnedOf: manager oldRememberedSetObj to: true.
manager getFromOldSpaceRememberedSet relocateRememberedSet.
manager getFromPermToOldSpaceRememberedSet rememberedSetSize > 0 ifTrue:
[manager storePointerUnchecked: 0 ofObject: manager permToOldRememberedSetObj withValue: firstFieldOfPermToOldRememberedSet].
manager setIsPinnedOf: manager permToOldRememberedSetObj to: true.
manager getFromPermToOldSpaceRememberedSet relocateRememberedSet.
manager getFromPermToNewSpaceRememberedSet rememberedSetSize > 0 ifTrue:
[manager storePointerUnchecked: 0 ofObject: manager permToNewRememberedSetObj withValue: firstFieldOfPermToNewRememberedSet].
manager setIsPinnedOf: manager permToNewRememberedSetObj to: true.
manager getFromPermToNewSpaceRememberedSet relocateRememberedSet
]
{ #category : #'space management' }
SpurPlanningCompactor >> savedFirstFieldSpaceMaxSlots: aNumber [
savedFirstFieldSpaceMaxSlots := aNumber
]
{ #category : #'space management' }
SpurPlanningCompactor >> savedFirstFieldsSpaceInFreeChunk [
<inline: true>
^savedFirstFieldsSpaceNotInOldSpace not
and: [self oop: savedFirstFieldsSpace start isGreaterThan: manager nilObject]
]
{ #category : #'space management' }
SpurPlanningCompactor >> savedFirstFieldsSpaceWasAllocated [
<inline: true>
^savedFirstFieldsSpaceNotInOldSpace
and: [self oop: savedFirstFieldsSpace start isGreaterThan: manager nilObject]
]
{ #category : #compaction }
SpurPlanningCompactor >> scanForFirstFreeAndFirstMobileObjectFrom: initialObject [
"Scan from initialObject, setting firstMobileObject to the first marked object after
the first free object found. Answer the first free object found, or nil if none."
<inline: false>
| firstFree |
manager allOldSpaceEntitiesFrom: initialObject do:
[:o|
(manager isMarked: o)
ifTrue:
[firstFree ifNotNil:
[firstMobileObject := o.
^firstFree]]
ifFalse:
[firstFree ifNil:
[firstFree := o]]].
^firstFree
]
{ #category : #'space management' }
SpurPlanningCompactor >> selectSavedFirstFieldsSpace [
"To compact the heap the algorithm must save the first field (used for the forwarding pointer)
of all moved objects. This is done in savedFirstFieldsSpace, a contiguous block of memory borrowed
for the duration of compaction. In a 32-bit system a typical upper bound on the space needed
is about 1/40 of the heap size. The default new space size of 4Mb provides an eden of about
3.6 Mb, which would serve the needs of a 144 Mb heap. The default segment increment of
16 Mb would serve the needs of a 640 Mb heap. Make an estimate of the size needed, and
either use eden, a large free chunk, or a newly-allocated segment, falling back on eden if
the alternatives can't be had."
<inline: true>
| spaceEstimate sizeOfEden |
spaceEstimate := manager getMemoryMap oldSpaceEnd - manager firstObject // 40.
sizeOfEden := scavenger eden limit - scavenger eden start.
spaceEstimate > sizeOfEden ifTrue:
[(self findHighestSuitableFreeBlock: spaceEstimate) ifNotNil:
[:highestSuitableFreeBlock|
(spaceEstimate > (manager sizeOfFree: highestSuitableFreeBlock)
and: [self useSegmentForSavedFirstFieldsSpace: spaceEstimate]) ifTrue:
[^self].
(manager sizeOfFree: highestSuitableFreeBlock) > sizeOfEden ifTrue:
[self useFreeChunkForSavedFirstFieldsSpace: highestSuitableFreeBlock.
^self]].
(self useSegmentForSavedFirstFieldsSpace: spaceEstimate) ifTrue:
[^self]].
self useEdenForSavedFirstFieldsSpace
]
{ #category : #'gc - scavenge/compact' }
SpurPlanningCompactor >> shouldRemapObj: objOop [
"Answer if the obj should be scavenged, or simply followed. Sent via the compactor
from shouldRemapObj:. We test for being already scavenged because mapStackPages
via mapInterpreterOops may be applied twice in the context of a global GC where a
scavenge, followed by a scan-mark-free, and final compaction passes may result in
scavenged fields being visited twice."
<api>
<inline: false>
^manager slidingCompactionShouldRemapObj: objOop
]
{ #category : #private }
SpurPlanningCompactor >> thereAreObjectsToMove [
<inline: true>
^lastMobileObject notNil
]
{ #category : #compaction }
SpurPlanningCompactor >> unmarkInitialImmobileObjects [
self unmarkInitialImmobileObjectsFreeUnmarked: false
]
{ #category : #compaction }
SpurPlanningCompactor >> unmarkInitialImmobileObjectsFreeUnmarked: freeUnmarked [
"Sweep the initial immobile heap, unmarking all objects up to the first mobile object.
Precondition: all used objects are marked.
If freeUnmarked, free unmarked objects as they are found.
If the object is a fixed known object (nil, false, true) we should not free it"
manager allOldSpaceObjectsFrom: manager firstObject do: [:o|
self check: o.
(self oop: o isGreaterThanOrEqualTo: firstMobileObject)
ifTrue: [ ^self ].
(freeUnmarked
and: [ (manager isMarked: o) not
and: [ (manager isFixedKnownObject: o) not ]])
ifTrue: [ manager freeObjectWithoutCoalesce: o ]
ifFalse: [ manager setIsMarkedOf: o to: false ]]
]
{ #category : #compaction }
SpurPlanningCompactor >> unmarkObjectsFromFirstFreeObject [
"Sweep the final immobile heap, freeing and coalescing unmarked and free objects,
and unmarking all marked objects up to the end of memory."
| startOfFree freeBytes |
freeBytes := 0.
manager allOldSpaceEntitiesFrom: firstFreeObject do:
[:o|
self check: o.
(manager isMarked: o)
ifFalse:
[startOfFree ifNil: [startOfFree := manager startOfObject: o].
freeBytes := freeBytes + (manager bytesInObject: o)]
ifTrue:
[startOfFree ifNotNil:
[manager addFreeChunkWithBytes: freeBytes at: startOfFree.
startOfFree := nil.
freeBytes := 0].
(manager isPinned: o)
ifTrue: [self unmarkPinned: o]
ifFalse: [manager setIsMarkedOf: o to: false]]].
startOfFree ifNotNil:
[manager addFreeChunkWithBytes: freeBytes at: startOfFree].
]
{ #category : #compaction }
SpurPlanningCompactor >> unmarkObjectsInFullyCompactedHeap [
self unmarkInitialImmobileObjectsFreeUnmarked: true.
manager unmarkSurvivingObjectsForCompact
]
{ #category : #private }
SpurPlanningCompactor >> unmarkPinned: pinnedObj [
<inline: true>
(manager isSegmentBridge: pinnedObj) ifFalse:
[manager setIsMarkedOf: pinnedObj to: false.
manager segmentManager notePinned: pinnedObj]
]
{ #category : #private }
SpurPlanningCompactor >> unpinRememberedSet [
<inline: true>
firstFieldOfRememberedSet := manager fetchPointer: 0 ofObject: manager oldRememberedSetObj.
manager setIsPinnedOf: manager oldRememberedSetObj to: false.
firstFieldOfPermToOldRememberedSet := manager fetchPointer: 0 ofObject: manager permToOldRememberedSetObj.
manager setIsPinnedOf: manager permToOldRememberedSetObj to: false.
firstFieldOfPermToNewRememberedSet := manager fetchPointer: 0 ofObject: manager permToNewRememberedSetObj.
manager setIsPinnedOf: manager permToNewRememberedSetObj to: false
]
{ #category : #compaction }
SpurPlanningCompactor >> updatePointer: i in: obj [
"Sweep the pointer i-th field in obj, updating its possible reference to a mobile object to its eventual location."
<inline: true>
| oop fwd |
oop := manager fetchPointer: i ofObject: obj.
((manager isNonImmediate: oop) and: [self isMobile: oop]) ifTrue:
[self assert: (manager isMarked: oop).
"If for some reason a hidden root is unmarked at this point, the status of this object is far from clear.
Possibly, the object was created during the GC, so its status related to a possible forward pointer is unknown.
So better just forbids this."
fwd := manager fetchPointer: 0 ofObject: oop.
self assert: (self isPostMobile: fwd).
manager storePointerUnchecked: i ofObject: obj withValue: fwd]
]
{ #category : #compaction }
SpurPlanningCompactor >> updatePointers [
"Sweep the heap, updating all objects to their eventual locations.
Remember to update the savedFirstFields of pointer objects, as these have been forwarded."
<inline: #never>
| onePass |
self logPhase: 'updating pointers...'.
self thereAreObjectsToMove ifFalse:
[^self].
self assert: (manager startOfObject: firstFreeObject) = mobileStart.
coInterpreter mapInterpreterOops.
manager mapExtraRoots.
self updatePointersInManagerHeapEntities.
self updatePointersInSurvivingObjects.
self updatePointersInInitialImmobileObjects.
onePass := self updatePointersInMobileObjects.
onePass ifFalse:
[self updatePointersInObjectsOverflowingSavedFirstFieldsSpace]
]
{ #category : #compaction }
SpurPlanningCompactor >> updatePointersIn: obj [
"Sweep the pointer fields in obj, updating all references to mobile objects to their eventual locations."
<inline: true>
| numPointerSlots |
numPointerSlots := manager numPointerSlotsOf: obj.
0 to: numPointerSlots - 1 do:
[:i| self updatePointer: i in: obj ]
]
{ #category : #compaction }
SpurPlanningCompactor >> updatePointersIn: obj savedFirstFieldPointer: firstFieldPtr [
"Sweep the pointer fields in obj, updating all references to mobile objects to their eventual locations.
firstFieldPtr is supplied for mobile objects so that the saved first field can be updated, and so that
the first field of a compiled method (which is its header, or reference to a CogMethod holding its header)
can be retrieved."
<inline: false>
| fmt numPointerSlots oop fwd |
fmt := manager formatOf: obj.
numPointerSlots := self numPointerSlotsWhileCompactingOf: obj withFormat: fmt savedFirstFieldPointer: firstFieldPtr.
(fmt <= manager lastPointerFormat "excludes CompiledMethod"
and: [numPointerSlots > 0]) ifTrue:
["Relocate the saved first field; Note that CompiledMethods can be excluded since their
first field is either a SmallInteger or a reference to a CogMethod outside of oldSpace."
oop := manager longAt: firstFieldPtr.
((manager isNonImmediate: oop) and: [self isMobile: oop]) ifTrue:
[self assert: (manager isMarked: oop).
fwd := manager fetchPointer: 0 ofObject: oop.
self assert: (self isPostMobile: fwd).
manager longAt: firstFieldPtr put: fwd]].
1 to: numPointerSlots - 1 do:
[:i| self updatePointer: i in: obj ]
]
{ #category : #compaction }
SpurPlanningCompactor >> updatePointersInInitialImmobileObjects [
"Sweep the initial immobile heap, updating all references to mobile objects to their eventual locations."
manager allOldSpaceObjectsFrom: manager firstObject do:
[:o|
self check: o.
(self oop: o isGreaterThanOrEqualTo: firstFreeObject) ifTrue:
[^self].
"would like to assert this, but it isn't true if more than one pass: self assert: (manager isMarked: o)."
self updatePointersIn: o]
]
{ #category : #compaction }
SpurPlanningCompactor >> updatePointersInManagerHeapEntities [
"The special non-pointer objects containing pointers, which are the objStacks and the rememberedSet,
must be updated manually since they will not be recognized as containing pointers in the normal sweep."
<inline: false>
manager relocateObjStacksForPlanningCompactor.
(manager getFromOldSpaceRememberedSet rememberedSetSize > 0
and: [self isMobile: firstFieldOfRememberedSet]) ifTrue:
[firstFieldOfRememberedSet := manager fetchPointer: 0 ofObject: firstFieldOfRememberedSet].
self relocateObjectsInHeapEntity: manager oldRememberedSetObj from: 1 to: manager getFromOldSpaceRememberedSet rememberedSetSize - 1.
"We use the mark bit to avoid duplicates... only in the remembered set"
(manager getFromPermToOldSpaceRememberedSet rememberedSetSize > 0) ifTrue:
[(manager isMarked: firstFieldOfPermToOldRememberedSet) ifFalse:
[ self updatePointersIn: firstFieldOfPermToOldRememberedSet.
manager mark: firstFieldOfPermToOldRememberedSet ] ].
manager getFromPermToOldSpaceRememberedSet
rememberedSetWithIndexDo: [ :oop :index |
(manager isMarked: oop) ifFalse:
[ self updatePointersIn: oop.
manager mark: oop ]] startingAt: 1.
(manager getFromPermToNewSpaceRememberedSet rememberedSetSize > 0) ifTrue:
[(manager isMarked: firstFieldOfPermToNewRememberedSet) ifFalse:
[ self updatePointersIn: firstFieldOfPermToNewRememberedSet.
manager mark: firstFieldOfPermToNewRememberedSet ]].
manager getFromPermToNewSpaceRememberedSet
rememberedSetWithIndexDo: [ :oop :index |
(manager isMarked: oop) ifFalse:
[ self updatePointersIn: oop.
manager mark: oop ]] startingAt: 1.
(manager getFromPermToOldSpaceRememberedSet rememberedSetSize > 0) ifTrue:
[manager setIsMarkedOf: firstFieldOfPermToOldRememberedSet to: false ].
(manager getFromPermToNewSpaceRememberedSet rememberedSetSize > 0) ifTrue:
[manager setIsMarkedOf: firstFieldOfPermToNewRememberedSet to: false].
manager getFromPermToNewSpaceRememberedSet
rememberedSetWithIndexDo: [ :oop :index | manager setIsMarkedOf: oop to: false] startingAt: 1.
manager getFromPermToOldSpaceRememberedSet
rememberedSetWithIndexDo: [ :oop :index | manager setIsMarkedOf: oop to: false] startingAt: 1.
self assert: manager allPermSpaceObjectsUnmarked.
]
{ #category : #compaction }
SpurPlanningCompactor >> updatePointersInMobileObjects [
"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.
Answer if the end of the heap was reached (savedFirstFieldsSpace has not overflowed).
The enumerations in planCompactSavingForwarders, updatePointersInMobileObjects and copyAndUnmarkMobileObjects
match. We could implement them as a single enumeration method taking several block arguments, but arguably that
would make understanding an already tricky algorithm more difficult. Instead we tolerate the duplication and encourage
the reader to diff the three methods to see where they diverge (e.g. via Cmd-shift-C)."
| toFinger top previousPin startOfPreviousPin |
<var: 'o' type: #usqInt>
<var: 'top' type: #usqInt>
<var: 'toFinger' type: #usqInt>
<var: 'previousPin' type: #usqInt>
<var: 'startOfPreviousPin' type: #usqInt>
self deny: (manager isMarked: firstFreeObject).
toFinger := manager startOfObject: firstFreeObject.
top := savedFirstFieldsSpace start.
startOfPreviousPin := 0.
manager allOldSpaceEntitiesFrom: firstFreeObject do:
[:o|
self check: o.
self assert: (previousPin
ifNil: [toFinger <= (manager startOfObject: o)]
ifNotNil: [(manager isMarked: previousPin) and: [toFinger <= startOfPreviousPin]]).
(manager isMarked: o) ifTrue:
[(manager isPinned: o)
ifTrue:
[previousPin ifNil:
[previousPin := o. startOfPreviousPin := manager startOfObject: o].
self updatePointersIn: o]
ifFalse:
[| availableSpace bytes |
bytes := manager bytesInObject: o.
[toFinger <= startOfPreviousPin
and: [bytes ~= (availableSpace := startOfPreviousPin - toFinger)
and: [bytes + (2 * manager allocationUnit) > availableSpace]]] whileTrue:
["The object does not fit in the space between toFinger and previousPin.
Move toFinger up to point at the first unmarked or mobile object after
previousPin, or, if previousPin is contiguous with o, to the start of this
object. Update previousPin to be the next pinned object above toFInger
and below this object, or nil if no such pinned object exists.
Any unfillable gaps between adjacent pinned objects will be freed."
[toFinger := manager addressAfter: previousPin.
previousPin := manager objectStartingAt: toFinger.
(manager isMarked: previousPin)
and: [(manager isPinned: previousPin)
and: [previousPin < o]]]
whileTrue.
"Now previousPin is either equal to o or mobile.
Move it to the next pinned object below o"
[previousPin >= o
or: [(manager isMarked: previousPin)
and: [manager isPinned: previousPin]]] whileFalse:
[previousPin := manager oldSpaceObjectAfter: previousPin].
previousPin >= o
ifTrue: [previousPin := nil. startOfPreviousPin := 0]
ifFalse: [startOfPreviousPin := manager startOfObject: previousPin]].
self updatePointersIn: o savedFirstFieldPointer: top.
toFinger := toFinger + bytes.
(top := top + manager bytesPerOop) >= savedFirstFieldsSpace limit ifTrue:
[self assert: savedFirstFieldsSpace top = (top - manager bytesPerOop).
^false]]]].
self assert: savedFirstFieldsSpace top = (top - manager bytesPerOop).
^true
]
{ #category : #compaction }
SpurPlanningCompactor >> updatePointersInObjectsOverflowingSavedFirstFieldsSpace [
"Sweep the final immobile heap, is any (those objects with no room in savedFirstFieldsSpace