Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding test to test Ephemerons in the Old Space #702

Open
wants to merge 12 commits into
base: pharo-12
Choose a base branch
from
Open
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,38 @@ VMSpurOldSpaceGarbageCollectorTest >> testEphemeronWithImmediateKeyShouldNotFail
equals: 15
]

{ #category : 'tests' }
VMSpurOldSpaceGarbageCollectorTest >> testEphemeronsWithSameKeyNewSpaceOldSpace [

| ephemeronObjectOopOne ephemeronObjectOopTwo nonEphemeronObjectOop |
"set up"
memory initializeMournQueue.
self createEphemeronClass.

ephemeronObjectOopOne := self newEphemeronObject.
ephemeronObjectOopTwo := self newEphemeronObject.
nonEphemeronObjectOop := self newOldSpaceObjectWithSlots: 0.

"Both ephemerons share the same key"
memory storePointer: 0
ofObject: ephemeronObjectOopOne
withValue: nonEphemeronObjectOop.
memory storePointer: 0
ofObject: ephemeronObjectOopTwo
withValue: nonEphemeronObjectOop.

self keepObjectInVMVariable1: ephemeronObjectOopOne.
self keepObjectInVMVariable2: ephemeronObjectOopTwo.

"Collect non ephemeron object"
memory fullGC.
ephemeronObjectOopOne := memory remapObj: ephemeronObjectOopOne.
ephemeronObjectOopTwo := memory remapObj: ephemeronObjectOopTwo.

self assert: ({ ephemeronObjectOopOne. ephemeronObjectOopTwo } includes: memory dequeueMourner).
self assert: ({ ephemeronObjectOopOne. ephemeronObjectOopTwo } includes: memory dequeueMourner)
]

{ #category : 'tests' }
VMSpurOldSpaceGarbageCollectorTest >> testGrowOldSpace [

Expand Down