Branch: refs/heads/Cog
Home: https://github.com/OpenSmalltalk/opensmalltalk-vm
Commit: 17625fc20fa1f55ed11a728329f002e9feddb459
https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/17625fc20fa1f55ed1…
Author: Eliot Miranda <eliot.miranda(a)gmail.com>
Date: 2020-10-28 (Wed, 28 Oct 2020)
Changed paths:
M nsspur64src/vm/cogit.c
M spur64src/vm/cogit.c
M spurlowcode64src/vm/cogit.c
M spursista64src/vm/cogit.c
Log Message:
-----------
CogVM source as per VMMaker.oscog-eem.2859
Allow processor predefined macros to include expressions (i.e. __ARM_ARCH >= 8).
[ci skip]
Eliot Miranda uploaded a new version of Cog to project VM Maker:
http://source.squeak.org/VMMaker/Cog-eem.420.mcz
==================== Summary ====================
Name: Cog-eem.420
Author: eem
Time: 28 October 2020, 7:15:44.003408 pm
UUID: b03ad887-622e-4bf4-9fe4-7470af59aa6c
Ancestors: Cog-eem.419
Fix the stack stitching code. Fix MultiProcessor's desNotUnderstand: handler to return the non-virtual processor to the second trap continuation. ANd no breaks for the wicked...
=============== Diff against Cog-eem.419 ===============
Item was changed:
----- Method: MultiProcessor>>doesNotUnderstand: (in category 'message forwarding') -----
doesNotUnderstand: aMessage
"Forward a message to the actual processor, managing a thread-switch if necessary.
Catch ProcessorSimulationTraps and raise them outside of the critical section to
avoid deadlock when reentering the VM from a trap and switching threads in the run-time."
| selector result trap contextInCritical |
selector := aMessage selector.
(guardedProcessorProtocol includes: selector) ifFalse:
[^(unguardedProcessorProtocol includes: selector)
ifTrue: [processor perform: selector withArguments: aMessage arguments]
ifFalse: [super doesNotUnderstand: aMessage]].
result := [mutex critical:
[contextInCritical := thisContext.
owner ~~ mutex owningProcess ifTrue:
[owner ifNotNil:
[registerState at: owner put: processor registerState].
(registerState at: (owner := mutex owningProcess) ifAbsent: nil)
ifNil: [coInterpreter initializeProcessorForThreadIndex: (threadIndex := threadIndex + 1)]
ifNotNil: [:newState| processor setRegisterState: newState]].
processor perform: selector withArguments: aMessage arguments]]
on: ProcessorSimulationTrap, Error, AssertionFailure
do: [:ex|
ex class == ProcessorSimulationTrap ifFalse:
[ex pass].
"Alas things are not so simple with ARMv8 ldp/stp...
The comments in these two methods explain..."
(self isAboutToReturn: ex signalerContext) ifFalse:
[self saveStackFor: ex signalerContext
above: contextInCritical
homeContext: thisContext home].
trap := ex].
+ ^trap
+ ifNil: [result]
+ ifNotNil: [trap signal ifNotNil:
+ [:resultOfSignal|
+ resultOfSignal == self
+ ifTrue: [processor]
+ ifFalse: [resultOfSignal]]]!
- ^trap ifNil: [result] ifNotNil: [trap signal]!
Item was changed:
----- Method: MultiProcessor>>saveStackFor:above:homeContext: (in category 'private-deep hackery') -----
saveStackFor: signalerContext above: contextInCritical homeContext: doesNotUnderstandContext
"Some processors, notably ARMv8, support load/store pair instructions which may raise two
ProcessorSimulationTraps. To handle this we must preserve the continuation following the
+ raising of the first simulation trap. This cuts up, and restitches the stack so that when the
- raising of the first simulaiton trap. This cuts up, and restitches the stack so that when the
first ProcessorSimulationTrap is raised outside the critical: block in our doesNotUnderstand:
method, control continues to the second trap."
+ | contextAboveContextInCritical contextAboveSignalerContext |
+ "This is the bottom context in the saved continuation, which must be stitched in beneath the doesNotUnderstand: handler."
+ contextAboveContextInCritical := signalerContext findContextSuchThat: [:ctxt| ctxt sender == contextInCritical].
- | contextAboveSignalerContext |
"This is our continuation, which should be changed to continue back into the critical section."
contextAboveSignalerContext := thisContext findContextSuchThat: [:ctxt| ctxt sender == signalerContext].
self deny: contextAboveSignalerContext isNil.
"signalerContext through the context above contextInCritical is the stack that is the continuation
for the trap. This must be inserted between the doesNotUnderstandContext and its sender.
N.B. Context>>cut: cuts above the argument!!!!"
signalerContext cut: contextInCritical.
+ contextAboveContextInCritical privSender: doesNotUnderstandContext sender.
- contextInCritical privSender: doesNotUnderstandContext sender.
doesNotUnderstandContext privSender: signalerContext.
"Now arrange that the handler returns to contextInCritical; and we're done."
contextAboveSignalerContext privSender: contextInCritical!
Item was changed:
----- Method: ProcessorSimulatorPlugin>>singleStepCPU:In:Size:MinAddressRead:Write: (in category 'simulation') -----
singleStepCPU: cpu In: memoryCArray Size: memorySize MinAddressRead: minAddress Write: minWriteMaxExecAddress
<doNotGenerate>
"*now* we need derived pointers. Ho hum...
But all we need is one more level of indirection..."
| result |
- self break.
result := mySimulatorAlien
rawPrimitiveSingleStepInMemory: interpreterProxy memory
offsetBy: memoryCArray ptrAddress
minimumAddress: minAddress
readOnlyBelow: minWriteMaxExecAddress.
^result == mySimulatorAlien
ifTrue: [0]
ifFalse:
[result isPrimitiveError
ifTrue: [result errorCode]
ifFalse: [result]]!
Branch: refs/heads/Cog
Home: https://github.com/OpenSmalltalk/opensmalltalk-vm
Commit: 2fd7f4385ed58a907202954d7ad72b26dba679d8
https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/2fd7f4385ed58a9072…
Author: Eliot Miranda <eliot.miranda(a)gmail.com>
Date: 2020-10-28 (Wed, 28 Oct 2020)
Changed paths:
M .gitignore
M image/BuildSqueakSpurTrunkVMMakerImage.st
Log Message:
-----------
Balloon-Engine-Pools no longer needed for a VMMaker image. Balloon is in trunk.
ignore workspaces in image. [ci skip]
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.2858.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.2858
Author: eem
Time: 28 October 2020, 5:04:18.475277 pm
UUID: a82bc143-8937-4842-8fe8-58e4d9d3ef85
Ancestors: VMMaker.oscog-eem.2857
We need a rump setInterruptCheckChain: to be able to simulate the processor plugins.
=============== Diff against VMMaker.oscog-eem.2857 ===============
Item was added:
+ ----- Method: SpurMemoryManager>>setInterruptCheckChain: (in category 'simulation only') -----
+ setInterruptCheckChain: ignored
+ <doNotGenerate>
+ ^0!
Eliot Miranda uploaded a new version of Cog to project VM Maker:
http://source.squeak.org/VMMaker/Cog-eem.419.mcz
==================== Summary ====================
Name: Cog-eem.419
Author: eem
Time: 28 October 2020, 5:00:42.614467 pm
UUID: 82e5725f-bce2-42a6-a9e0-2c048b5553cb
Ancestors: Cog-eem.418
Add the simulating-the-simulator primitives for the processor aliens. Use these to simulate runCPU:In:Size:MinAddressRead:Write: & singleStepCPU:In:Size:MinAddressRead:Write:.
Fix my misunderstanding of the use of Context>>cut: in MultiProcessor>>saveStackFor:above:homeContext: and consequently the COGMTVM happily simulates more than 1k methods into simulating-the-simulator before an assertt-fail. COGMTVM is officially undead ;-)
=============== Diff against Cog-eem.418 ===============
Item was added:
+ ----- Method: BochsIA32Alien>>rawPrimitiveRunInMemory:offsetBy:minimumAddress:readOnlyBelow: (in category 'primitives-simulation') -----
+ rawPrimitiveRunInMemory: memoryArray offsetBy: offset minimumAddress: minimumAddress readOnlyBelow: minimumWritableAddress
+ "A version of primitiveRunInMemory:offsetBy:minimumAddress:readOnlyBelow: for simulation"
+ <primitive: 'primitiveRunInMemoryOffsetMinimumAddressReadWrite' module: 'BochsIA32Plugin' error: ec>
+ ^ec!
Item was added:
+ ----- Method: BochsIA32Alien>>rawPrimitiveSingleStepInMemory:offsetBy:minimumAddress:readOnlyBelow: (in category 'primitives-simulation') -----
+ rawPrimitiveSingleStepInMemory: memoryArray offsetBy: offset minimumAddress: minimumAddress readOnlyBelow: minimumWritableAddress
+ "A version of primitiveSingleStepInMemory:offsetBy:minimumAddress:readOnlyBelow: for simulation"
+ <primitive: 'primitiveSingleStepInMemoryOffsetMinimumAddressReadWrite' module: 'BochsIA32Plugin' error: ec>
+ ^ec!
Item was added:
+ ----- Method: BochsX64Alien>>rawPrimitiveRunInMemory:offsetBy:minimumAddress:readOnlyBelow: (in category 'primitives-simulation') -----
+ rawPrimitiveRunInMemory: memoryArray offsetBy: offset minimumAddress: minimumAddress readOnlyBelow: minimumWritableAddress
+ "A version of primitiveRunInMemory:offsetBy:minimumAddress:readOnlyBelow: for simulation"
+ <primitive: 'primitiveRunInMemoryOffsetMinimumAddressReadWrite' module: 'BochsX64Plugin' error: ec>
+ ^ec!
Item was added:
+ ----- Method: BochsX64Alien>>rawPrimitiveSingleStepInMemory:offsetBy:minimumAddress:readOnlyBelow: (in category 'primitives-simulation') -----
+ rawPrimitiveSingleStepInMemory: memoryArray offsetBy: offset minimumAddress: minimumAddress readOnlyBelow: minimumWritableAddress
+ "A version of primitiveSingleStepInMemory:offsetBy:minimumAddress:readOnlyBelow: for simulation"
+ <primitive: 'primitiveSingleStepInMemoryOffsetMinimumAddressReadWrite' module: 'BochsX64Plugin' error: ec>
+ ^ec!
Item was added:
+ ----- Method: GdbARMAlien>>rawPrimitiveRunInMemory:offsetBy:minimumAddress:readOnlyBelow: (in category 'primitives-simulation') -----
+ rawPrimitiveRunInMemory: memoryArray offsetBy: offset minimumAddress: minimumAddress readOnlyBelow: minimumWritableAddress
+ "A version of primitiveRunInMemory:offsetBy:minimumAddress:readOnlyBelow: for simulation"
+ <primitive: 'primitiveRunInMemoryOffsetMinimumAddressReadWrite' module: 'GdbARMPlugin' error: ec>
+ ^ec!
Item was added:
+ ----- Method: GdbARMAlien>>rawPrimitiveSingleStepInMemory:offsetBy:minimumAddress:readOnlyBelow: (in category 'primitives-simulation') -----
+ rawPrimitiveSingleStepInMemory: memoryArray offsetBy: offset minimumAddress: minimumAddress readOnlyBelow: minimumWritableAddress
+ "A version of primitiveSingleStepInMemory:offsetBy:minimumAddress:readOnlyBelow: for simulation"
+ <primitive: 'primitiveSingleStepInMemoryOffsetMinimumAddressReadWrite' module: 'GdbARMPlugin' error: ec>
+ ^ec!
Item was changed:
----- Method: MultiProcessor>>saveStackFor:above:homeContext: (in category 'private-deep hackery') -----
saveStackFor: signalerContext above: contextInCritical homeContext: doesNotUnderstandContext
"Some processors, notably ARMv8, support load/store pair instructions which may raise two
ProcessorSimulationTraps. To handle this we must preserve the continuation following the
raising of the first simulaiton trap. This cuts up, and restitches the stack so that when the
first ProcessorSimulationTrap is raised outside the critical: block in our doesNotUnderstand:
method, control continues to the second trap."
+ | contextAboveSignalerContext |
- | contextAboveContextInCritical contextAboveSignalerContext |
- contextAboveContextInCritical := signalerContext findContextSuchThat: [:ctxt| ctxt sender == contextInCritical].
"This is our continuation, which should be changed to continue back into the critical section."
contextAboveSignalerContext := thisContext findContextSuchThat: [:ctxt| ctxt sender == signalerContext].
- self deny: contextAboveContextInCritical isNil.
self deny: contextAboveSignalerContext isNil.
+ "signalerContext through the context above contextInCritical is the stack that is the continuation
+ for the trap. This must be inserted between the doesNotUnderstandContext and its sender.
+ N.B. Context>>cut: cuts above the argument!!!!"
+ signalerContext cut: contextInCritical.
+ contextInCritical privSender: doesNotUnderstandContext sender.
- "signalerContext through contextAboveContextInCritical is the stack that is the continuation
- for the trap. This must be inserted between the doesNotUnderstandContext and its sender."
- signalerContext cut: contextAboveContextInCritical.
- contextAboveContextInCritical privSender: doesNotUnderstandContext sender.
doesNotUnderstandContext privSender: signalerContext.
"Now arrange that the handler returns to contextInCritical; and we're done."
+ contextAboveSignalerContext privSender: contextInCritical!
- contextAboveSignalerContext privSender: contextInCritical.
- self deny: (thisContext findContextSuchThat: [:ctxt| ctxt == signalerContext]) isNil.
- self deny: (thisContext findContextSuchThat: [:ctxt| ctxt == contextInCritical]) isNil.
- self deny: (thisContext findContextSuchThat: [:ctxt| ctxt == doesNotUnderstandContext]) isNil!
Item was changed:
----- Method: ProcessorSimulatorPlugin>>runCPU:In:Size:MinAddressRead:Write: (in category 'simulation') -----
runCPU: cpu In: memoryCArray Size: memorySize MinAddressRead: minAddress Write: minWriteMaxExecAddress
<doNotGenerate>
"*now* we need derived pointers. Ho hum...
But all we need is one more level of indirection..."
+ | result |
+ result := mySimulatorAlien
+ rawPrimitiveRunInMemory: interpreterProxy memory
+ offsetBy: memoryCArray ptrAddress
+ minimumAddress: minAddress
+ readOnlyBelow: minWriteMaxExecAddress.
+ ^result == mySimulatorAlien
+ ifTrue: [0]
+ ifFalse:
+ [result isPrimitiveError
+ ifTrue: [result errorCode]
+ ifFalse: [result]]!
- ^mySimulatorAlien
- primitiveRunInMemory: interpreterProxy memory
- offsetBy: memoryCArray ptrAddress
- minimumAddress: minAddress
- readOnlyBelow: minWriteMaxExecAddress!
Item was changed:
----- Method: ProcessorSimulatorPlugin>>singleStepCPU:In:Size:MinAddressRead:Write: (in category 'simulation') -----
singleStepCPU: cpu In: memoryCArray Size: memorySize MinAddressRead: minAddress Write: minWriteMaxExecAddress
<doNotGenerate>
"*now* we need derived pointers. Ho hum...
But all we need is one more level of indirection..."
+ | result |
+ self break.
+ result := mySimulatorAlien
+ rawPrimitiveSingleStepInMemory: interpreterProxy memory
+ offsetBy: memoryCArray ptrAddress
+ minimumAddress: minAddress
+ readOnlyBelow: minWriteMaxExecAddress.
+ ^result == mySimulatorAlien
+ ifTrue: [0]
+ ifFalse:
+ [result isPrimitiveError
+ ifTrue: [result errorCode]
+ ifFalse: [result]]!
- ^mySimulatorAlien
- primitiveSingleStepInMemory: interpreterProxy memory
- offsetBy: memoryCArray ptrAddress
- minimumAddress: minAddress
- readOnlyBelow: minWriteMaxExecAddress!