Skip to content

Commit

Permalink
Fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tesonep committed May 2, 2022
1 parent 0c18ab1 commit 8e2eb70
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 53 deletions.
8 changes: 4 additions & 4 deletions smalltalksrc/VMMaker/SpurMemoryManager.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -1971,7 +1971,7 @@ SpurMemoryManager >> allocateMemoryOfSize: memoryBytes initialAddress: initialAd
]
{ #category : #initialization }
SpurMemoryManager >> allocateMemoryOfSize: memoryBytes newSpaceSize: newSpaceBytes stackSize: stackBytes codeSize: codeBytes methodCacheSize: methodCacheSize primitiveTraceLogSize: primitiveLogSize rumpCStackSize: rumpCStackSize initialAddress: initialAddress permSpaceSize: permSpaceSize [
SpurMemoryManager >> allocateMemoryOfSize: memoryBytes newSpaceSize: newSpaceBytes stackSize: stackBytes codeSize: codeBytes methodCacheSize: methodCacheSize primitiveTraceLogSize: primitiveLogSize rumpCStackSize: rumpCStackSize permSpaceSize: permSpaceSize [
"Intialize the receiver for bootsraping an image.
Set up a large oldSpace and an empty newSpace and set-up freeStart and scavengeThreshold
Expand All @@ -1983,14 +1983,14 @@ SpurMemoryManager >> allocateMemoryOfSize: memoryBytes newSpaceSize: newSpaceByt
self assert: (memoryBytes \\ self allocationUnit = 0 and: [
newSpaceBytes \\ self allocationUnit = 0 and: [
codeBytes \\ self allocationUnit = 0 and: [
initialAddress \\ self allocationUnit = 0 ] ] ]).
codeBytes \\ self allocationUnit = 0 ] ]).
memoryManager ifNil: [
memoryManager := SlangMemoryManager new.
memoryManager wordSize: self wordSize ].
coInterpreter movePrimTraceLogToMemoryAt: (memoryManager allocate: primitiveLogSize).
primitiveLogSize ~= 0
ifTrue: [ coInterpreter movePrimTraceLogToMemoryAt: (memoryManager allocate: primitiveLogSize)].
memoryMap
allocationReserve: coInterpreter interpreterAllocationReserveBytes;
Expand Down
14 changes: 7 additions & 7 deletions smalltalksrc/VMMakerTests/VMMachineSimulatorTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ VMMachineSimulatorTest >> testInstructionExceptionHasCorrectInstructionAddress [
cogit JumpNonZero: label.

"This instruction should not be called"
lastInstruction := cogit Call: 16rFFFFF0. ].
lastInstruction := cogit Call: cogit methodZoneBase + 16r1000. ].

[ self machineSimulator
startAt: cogInitialAddress
Expand Down Expand Up @@ -50,7 +50,7 @@ VMMachineSimulatorTest >> testInstructionExceptionIsRaisedAsUnicornError [
cogit JumpNonZero: label.

"This instruction should not be called"
lastInstruction := cogit Call: 16rFFFFF0. ].
lastInstruction := cogit Call: cogit methodZoneBase + 16rFFFFF0. ].

[ self machineSimulator
startAt: cogInitialAddress
Expand All @@ -73,7 +73,7 @@ VMMachineSimulatorTest >> testMemoryAccessExceptionComesWithCorrectAddress [
cogit MoveCq: 16rFFFF0000 R: TempReg.
invalidAccessInstruction := cogit MoveMb: 0 r: TempReg R: ClassReg.
"This instruction should not be called"
lastInstruction := cogit Call: 16rFFFFF0. ].
lastInstruction := cogit Call: cogit methodZoneBase + 16rFFFFF0. ].

invalidAddressHandled := false.

Expand Down Expand Up @@ -364,7 +364,7 @@ VMMachineSimulatorTest >> testMemoryAccessExceptionInstructionPointerInCorrectAd

invalidAccessInstruction := cogit MoveMb: 0 r: TempReg R: ClassReg.
"This instruction should not be called"
lastInstruction := cogit Call: 16rFFFFF0. ].
lastInstruction := cogit Call: cogit methodZoneBase + 16rFFFFF0. ].

invalidAddressHandled := false.

Expand Down Expand Up @@ -401,7 +401,7 @@ VMMachineSimulatorTest >> testNormalExecutionCountIsRespected [
cogit JumpNonZero: label.

"This instruction should not be called"
lastInstruction := cogit Call: 16rFFFFF0. ].
lastInstruction := cogit Call: cogit methodZoneBase + 16rFFFFF0. ].

self machineSimulator
startAt: cogInitialAddress
Expand All @@ -427,7 +427,7 @@ VMMachineSimulatorTest >> testNormalExecutionCountIsRespectedAndHasCorrectInstru
jumpInstruction := cogit JumpNonZero: label.

"This instruction should not be called"
lastInstruction := cogit Call: 16rFFFFF0. ].
lastInstruction := cogit Call: cogit methodZoneBase + 16rFFFFF0. ].

self machineSimulator
startAt: cogInitialAddress
Expand Down Expand Up @@ -498,7 +498,7 @@ VMMachineSimulatorTest >> testNormalExecutionUntilAddressIsRespected [
cogit JumpNonZero: label.

"This instruction should not be called"
lastInstruction := cogit Call: 16rFFFFF0. ].
lastInstruction := cogit Call: cogit methodZoneBase + 16rFFFFF0. ].

self
runFrom: cogInitialAddress
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ VMSimpleStackBasedCogitAbstractTest >> compileTrampoline: aBlock named: aTrampol

cogit methodZoneBase: cogit methodZone freeStart.

cogInitialAddress := cogit methodZoneBase.

^ startAddress
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,7 @@ VMSimpleStackBasedCogitBytecodeTest >> doPopIntoReceiverVariableBytecodeStoresVa
"The object is filled with nils.
Push false into the stack and execute the store and pop bytecode."
self pushAddress: memory falseObject.

"Set an address as store check trampoline.
The bytecode below will jump to it if it is a old -> young store"
cogit objectRepresentation ceStoreCheckTrampoline: memory nilObject.


"The first byte of the push receiver instance variable bytecode family is used to identify which variable (0-based again)"
cogit byte0: instanceVariableToWrite - 1.
self compile: [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Class {
#name : #VMSimpleStackBasedCogitMegamorphicPICTest,
#superclass : #VMSimpleStackBasedCogitAbstractTest,
#pools : [
'VMMethodCacheConstants'
],
#category : #'VMMakerTests-JitTests'
}

Expand All @@ -12,7 +15,8 @@ VMSimpleStackBasedCogitMegamorphicPICTest >> setUp [
self setUpCogMethodEntry.

memory coInterpreter
moveMethodCacheToMemoryAt: environmentBuilder memoryInitialAddress "+ The guard page? memory cogCodeBase" + self initialCodeSize + environmentBuilder stackSpaceSize.
moveMethodCacheToMemoryAt: (memory memoryManager allocate: MethodCacheEntrySize * MethodCacheSize * (interpreter sizeof: #sqInt)).

specialSelectorsArray := self newOldSpaceObjectWithSlots: 2.
memory coInterpreter
specialSelectorArray: specialSelectorsArray;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ VMSimulatedEnvironmentBuilder >> doBuild [
methodCacheSize: methodCacheSize
primitiveTraceLogSize: (self roundToPageSize: primitiveTraceLogSize)
rumpCStackSize: self rumpCStackSize
initialAddress: initialAddress
permSpaceSize: permSpaceSize.

objectMemory initializePostBootstrap.
Expand Down
35 changes: 0 additions & 35 deletions smalltalksrc/VMMakerTests/VMSpurNewSpaceStructureTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -75,41 +75,6 @@ VMSpurNewSpaceStructureTest >> testNewMemoryFutureSurvivorSpaceIsAtFutureSpaceSt
self assert: memory scavenger futureSurvivorStart equals: memory scavenger futureSpace start
]

{ #category : #'tests-1-memory-initialization' }
VMSpurNewSpaceStructureTest >> testNewMemoryLimitIsSumOfSpaces [

self
assert: memory getMemoryMap oldSpaceEnd
equals: oldSpaceSize + environmentBuilder newSpaceSize
+ environmentBuilder rumpCStackSize
+ environmentBuilder stackSpaceSize
+ environmentBuilder memoryInitialAddress
+ self primitiveTraceLogSize + environmentBuilder methodCacheSize
]

{ #category : #'tests-1-memory-initialization' }
VMSpurNewSpaceStructureTest >> testNewMemoryNewSpaceLimitIsNewSpaceStartPlusSize [

self
assert: memory getMemoryMap newSpaceEnd
equals:
environmentBuilder newSpaceSize + environmentBuilder stackSpaceSize
+ environmentBuilder rumpCStackSize
+ environmentBuilder memoryInitialAddress
+ self primitiveTraceLogSize + environmentBuilder methodCacheSize
]

{ #category : #'tests-1-memory-initialization' }
VMSpurNewSpaceStructureTest >> testNewMemoryNewSpaceStartIsStackSize [

self
assert: memory getMemoryMap newSpaceStart
equals: environmentBuilder stackSpaceSize
+ environmentBuilder rumpCStackSize
+ environmentBuilder memoryInitialAddress
+ self primitiveTraceLogSize + environmentBuilder methodCacheSize
]

{ #category : #'tests-1-memory-initialization' }
VMSpurNewSpaceStructureTest >> testNewMemoryPastSpaceEndIsAtTheStartOfFutureSpace [

Expand Down

0 comments on commit 8e2eb70

Please sign in to comment.