@@ -8315,7 +8315,6 @@ SpurMemoryManager >> markInactiveEphemerons [
8315
8315
8316
8316
{ #category : #' gc - global' }
8317
8317
SpurMemoryManager >> markLoopFrom: objOop [
8318
-
8319
8318
" Scan objOop and all objects on the mark stack, until the mark stack is empty.
8320
8319
N.B. When the incremental GC is written this will probably be refactored as
8321
8320
markLoopFrom: objOop while: aBlock"
@@ -8326,61 +8325,66 @@ SpurMemoryManager >> markLoopFrom: objOop [
8326
8325
objToScan := objOop.
8327
8326
" To avoid overflowing the mark stack when we encounter large objects, we
8328
8327
push the obj, then its numStrongSlots, and then index the object from the stack."
8329
- [
8328
+ [
8330
8329
(self isImmediate: objToScan)
8331
8330
ifTrue: [ scanLargeObject := true ]
8332
8331
ifFalse: [
8333
- numStrongSlots := ((self isEphemeron: objToScan) and : [ self isMarked: (self keyOfEphemeron: objToScan) ])
8334
- ifTrue: [ self numSlotsOf: objToScan ]
8335
- ifFalse: [ self numStrongSlotsOfInephemeral: objToScan ].
8332
+ numStrongSlots := ((self isEphemeron: objToScan) and : [
8333
+ | key |
8334
+ (self isImmediate:
8335
+ (key := self keyOfEphemeron: objToScan)) or : [
8336
+ self isMarked: key ] ])
8337
+ ifTrue: [ self numSlotsOf: objToScan ]
8338
+ ifFalse: [
8339
+ self numStrongSlotsOfInephemeral: objToScan ].
8336
8340
scanLargeObject := numStrongSlots > self traceImmediatelySlotLimit ].
8337
8341
scanLargeObject
8338
8342
ifTrue: [ " scanning a large object. scan until hitting an unmarked object, then switch to it, if any."
8339
8343
(self isImmediate: objToScan)
8340
- ifTrue: [
8344
+ ifTrue: [
8341
8345
index := self integerValueOf: objToScan.
8342
8346
objToScan := self topOfObjStack: markStack ]
8343
- ifFalse: [
8347
+ ifFalse: [
8344
8348
index := numStrongSlots.
8345
8349
self markAndTraceClassOf: objToScan ].
8346
- [ index > 0 ] whileTrue: [
8350
+ [ index > 0 ] whileTrue: [
8347
8351
index := index - 1 .
8348
8352
field := self fetchPointer: index ofObject: objToScan.
8349
- (self isNonImmediate: field) ifTrue: [
8353
+ (self isNonImmediate: field) ifTrue: [
8350
8354
(self isForwarded: field) ifTrue: [ " fixFollowedField: is /not/ inlined"
8351
8355
field := self
8352
8356
fixFollowedField: index
8353
8357
ofObject: objToScan
8354
8358
withInitialValue: field ].
8355
- (self markAndShouldScan: field) ifTrue: [
8356
- index > 0 ifTrue: [
8357
- (self topOfObjStack: markStack) ~= objToScan ifTrue: [
8359
+ (self markAndShouldScan: field) ifTrue: [
8360
+ index > 0 ifTrue: [
8361
+ (self topOfObjStack: markStack) ~= objToScan ifTrue: [
8358
8362
self push: objToScan onObjStack: markStack ].
8359
8363
self push: (self integerObjectOf: index) onObjStack: markStack ].
8360
8364
objToScan := field.
8361
8365
index := - 1 ] ] ].
8362
8366
index >= 0 ifTrue: [ " if loop terminated without finding an unmarked referent, switch to top of stack."
8363
8367
objToScan := self popObjStack: markStack.
8364
- objToScan = objOop ifTrue: [
8368
+ objToScan = objOop ifTrue: [
8365
8369
objToScan := self popObjStack: markStack ] ] ]
8366
8370
ifFalse: [ " scanning a small object. scan, marking, pushing unmarked referents, then switch to the top of the stack."
8367
8371
index := numStrongSlots.
8368
8372
self markAndTraceClassOf: objToScan.
8369
- [ index > 0 ] whileTrue: [
8373
+ [ index > 0 ] whileTrue: [
8370
8374
index := index - 1 .
8371
8375
field := self fetchPointer: index ofObject: objToScan.
8372
- (self isNonImmediate: field) ifTrue: [
8376
+ (self isNonImmediate: field) ifTrue: [
8373
8377
(self isForwarded: field) ifTrue: [ " fixFollowedField: is /not/ inlined"
8374
8378
field := self
8375
8379
fixFollowedField: index
8376
8380
ofObject: objToScan
8377
8381
withInitialValue: field ].
8378
- (self markAndShouldScan: field) ifTrue: [
8382
+ (self markAndShouldScan: field) ifTrue: [
8379
8383
self push: field onObjStack: markStack.
8380
- ((self rawNumSlotsOf: field) > self traceImmediatelySlotLimit
8381
- and : [
8384
+ ((self rawNumSlotsOf: field) > self traceImmediatelySlotLimit
8385
+ and : [
8382
8386
(numStrongSlots := self numStrongSlotsOfInephemeral: field)
8383
- > self traceImmediatelySlotLimit ]) ifTrue: [
8387
+ > self traceImmediatelySlotLimit ]) ifTrue: [
8384
8388
self
8385
8389
push: (self integerObjectOf: numStrongSlots)
8386
8390
onObjStack: markStack ] ] ] ].
@@ -9252,30 +9256,33 @@ SpurMemoryManager >> numStrongSlotsOfInephemeral: objOop [
9252
9256
" Answer the number of strong pointer fields in the given object,
9253
9257
which is expected not to be an active ephemeron.
9254
9258
Works with CompiledMethods, as well as ordinary objects."
9259
+
9255
9260
< inline: true >
9256
- | fmt numSlots contextSize numLiterals header |
9261
+ | fmt numSlots contextSize numLiterals header |
9257
9262
fmt := self formatOf: objOop.
9258
- self assert: (fmt ~= self ephemeronFormat or : [self isMarked: (self keyOfEphemeron: objOop)]).
9259
- fmt <= self lastPointerFormat ifTrue:
9260
- [numSlots := self numSlotsOf: objOop.
9261
- fmt <= self arrayFormat ifTrue:
9262
- [^ numSlots].
9263
- fmt = self indexablePointersFormat ifTrue:
9264
- [(self isContextNonImm: objOop) ifTrue:
9265
- [coInterpreter setTraceFlagOnContextsFramesPageIfNeeded: objOop.
9266
- " contexts end at the stack pointer"
9267
- contextSize := coInterpreter fetchStackPointerOf: objOop.
9268
- ^ CtxtTempFrameStart + contextSize].
9269
- ^ numSlots].
9270
- fmt = self weakArrayFormat ifTrue:
9271
- [^ self fixedFieldsOfClass: (self fetchClassOfNonImm: objOop)]].
9272
- fmt = self forwardedFormat ifTrue: [^ 1 ].
9273
- fmt < self firstCompiledMethodFormat ifTrue: [^ 0 ]. " no pointers"
9263
+ self assert: (fmt ~= self ephemeronFormat or : [
9264
+ | key |
9265
+ (self isImmediate: (key := self keyOfEphemeron: objOop)) or : [
9266
+ self isMarked: key ] ]).
9267
+ fmt <= self lastPointerFormat ifTrue: [
9268
+ numSlots := self numSlotsOf: objOop.
9269
+ fmt <= self arrayFormat ifTrue: [ ^ numSlots ].
9270
+ fmt = self indexablePointersFormat ifTrue: [
9271
+ (self isContextNonImm: objOop) ifTrue: [
9272
+ coInterpreter setTraceFlagOnContextsFramesPageIfNeeded: objOop.
9273
+ " contexts end at the stack pointer"
9274
+ contextSize := coInterpreter fetchStackPointerOf: objOop.
9275
+ ^ CtxtTempFrameStart + contextSize ].
9276
+ ^ numSlots ].
9277
+ fmt = self weakArrayFormat ifTrue: [
9278
+ ^ self fixedFieldsOfClass: (self fetchClassOfNonImm: objOop) ] ].
9279
+ fmt = self forwardedFormat ifTrue: [ ^ 1 ].
9280
+ fmt < self firstCompiledMethodFormat ifTrue: [ ^ 0 ]. " no pointers"
9274
9281
9275
9282
" CompiledMethod: contains both pointers and bytes"
9276
9283
header := self methodHeaderOf: objOop.
9277
9284
numLiterals := self literalCountOfMethodHeader: header.
9278
- ^ numLiterals + LiteralStart
9285
+ ^ numLiterals + LiteralStart
9279
9286
]
9280
9287
9281
9288
{ #category : #' object access' }
0 commit comments