Skip to content

Commit

Permalink
Added tests for the new primitiveNewOldSpace
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanmontt committed Oct 5, 2023
1 parent 89f4766 commit 2fd313f
Showing 1 changed file with 68 additions and 0 deletions.
68 changes: 68 additions & 0 deletions smalltalksrc/VMMakerTests/VMPrimitiveTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2692,6 +2692,74 @@ VMPrimitiveTest >> testPrimitiveNewIsNotPinned [
self deny: (memory isPinned: interpreter stackTop)
]

{ #category : #'tests - primitiveNewOldSpace' }
VMPrimitiveTest >> testPrimitiveNewOldCreatesTheObjectInOldSpace [
| class |
class := self newClassInOldSpaceWithSlots: 0 instSpec: memory nonIndexablePointerFormat.

interpreter push: class.
interpreter primitiveNewOldSpace.

self deny: interpreter failed.
self deny: (memory isYoung: interpreter stackTop).
self assert: (memory isOld: interpreter stackTop)
]

{ #category : #'tests - primitiveNewOldSpace' }
VMPrimitiveTest >> testPrimitiveNewOldSpaceObjectInFullNewSpaceIsSchedulingGC [
| class |
class := self newClassInOldSpaceWithSlots: 3 instSpec: memory nonIndexablePointerFormat.

self fillNewSpace.

self deny: memory needGCFlag.

interpreter push: class.
interpreter primitiveNewOldSpace.

self deny: interpreter failed.
self assert: memory needGCFlag
]

{ #category : #'tests - primitiveNewOldSpace' }
VMPrimitiveTest >> testPrimitiveNewOldSpaceObjectIsNotSchedulingGC [
| class |
class := self newClassInOldSpaceWithSlots: 0 instSpec: memory nonIndexablePointerFormat.

interpreter push: class.
interpreter primitiveNewOldSpace.

self deny: interpreter failed.
self deny: memory needGCFlag
]

{ #category : #'tests - primitiveNewOldSpace' }
VMPrimitiveTest >> testPrimitiveNewOldSpaceWithArgsCreatesTheObjectInOldSpace [
| class |
class := self newClassInOldSpaceWithSlots: 0 instSpec: memory arrayFormat.

interpreter push: class.
interpreter push: (memory integerObjectOf: 7).
interpreter primitiveNewWithArgOldSpace.

self deny: interpreter failed.
self deny: (memory isYoung: interpreter stackTop).
self assert: (memory isOld: interpreter stackTop)
]

{ #category : #'tests - primitiveNewOldSpace' }
VMPrimitiveTest >> testPrimitiveNewOldSpaceWithArgsObjectIsNotSchedulingGC [
| class |
class := self newClassInOldSpaceWithSlots: 0 instSpec: memory arrayFormat.

interpreter push: class.
interpreter push: (memory integerObjectOf: 7).
interpreter primitiveNewWithArgOldSpace.

self deny: interpreter failed.
self deny: memory needGCFlag
]

{ #category : #'tests - primitiveNewPinned' }
VMPrimitiveTest >> testPrimitiveNewPinnedCreatesTheObjectInOldSpace [
| class |
Expand Down

0 comments on commit 2fd313f

Please sign in to comment.