[Vm-dev] VM Maker: VMMaker.oscog-eem.3091.mcz
commits at source.squeak.org
commits at source.squeak.org
Sat Oct 16 02:18:04 UTC 2021
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.3091.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.3091
Author: eem
Time: 15 October 2021, 7:16:26.376829 pm
UUID: 264f2183-0530-4514-8a64-3e03a75335fa
Ancestors: VMMaker.oscog-eem.3090
ARMv8 8.1: fix generateLowLevelTryLock: so that it answers if vmOwner is set to the desired value (i.e. if already set to the desired value, still answer true).
Comment the cack-handed hack in withProcessorHaltedDo: and have the code not destroy a break pc within ceTryLockVMOwner.
firstMappedPCFor: needs a guard.
Fix a couple of comments.
=============== Diff against VMMaker.oscog-eem.3090 ===============
Item was changed:
----- Method: CogARMCompiler>>hasDoublePrecisionFloatingPointSupport (in category 'testing') -----
hasDoublePrecisionFloatingPointSupport
- "might be true, but is for the forseeable future disabled"
^true!
Item was changed:
----- Method: CogARMv8Compiler>>generateLowLevelTryLock: (in category 'multi-threading') -----
generateLowLevelTryLock: vmOwnerLockAddress
"Generate a function that attempts to lock the vmOwnerLock to the argument and answers if it succeeded."
<inline: true>
| lockValueReg vmOwnerLockAddressReg br statusReg ldaxr |
vmOwnerLockAddress = 0 ifTrue:
[cogit
MoveCq: 1 R: ABIResultReg;
RetN: 0.
^self].
"spiffy 8.1 version using CASAL..."
lockValueReg := CArg1Reg. "Holds the value of lock if unlocked (zero), receives the existing value of the lock"
vmOwnerLockAddressReg := CArg2Reg.
self hasAtomicInstructions ifTrue:
[cogit
MoveCq: 0 R: lockValueReg;
MoveCq: vmOwnerLockAddress R: vmOwnerLockAddressReg;
+ gen: CASAL operand: lockValueReg operand: CArg0Reg operand: vmOwnerLockAddressReg.
+ br := cogit gen: CBNZ operand: 0 operand: lockValueReg.
+ cogit
+ MoveCq: 1 R: ABIResultReg;
- gen: CASAL operand: lockValueReg operand: CArg0Reg operand: vmOwnerLockAddressReg;
- CmpCq: 0 R: lockValueReg;
- gen: CCMPNE operand: ABIResultReg operand: lockValueReg operand: 0 "nzcv all false"; "i.e. if NE to 0, then is it already set to the argument?"
- gen: CSET operand: ABIResultReg operand: EQ;
RetN: 0.
+ br jmpTarget: (cogit CmpR: ABIResultReg R: lockValueReg).
+ cogit
+ gen: CSET operand: ABIResultReg operand: EQ; "i.e. if NE to 0, then is it already set to the argument?"
+ RetN: 0.
^self].
"frumpy 8.0 version using LDAXR/STLXR"
cogit MoveCq: vmOwnerLockAddress R: vmOwnerLockAddressReg.
cogit MoveCq: 0 R: (statusReg := CArg3Reg). "STLXR sets a word status register; clearing the top bits means it's a non-issue"
ldaxr := cogit gen: LDAXR operand: lockValueReg operand: vmOwnerLockAddressReg.
br := cogit gen: CBNZ operand: 0 operand: lockValueReg.
cogit gen: STLXR operand: CArg0Reg operand: vmOwnerLockAddressReg operand: statusReg.
cogit gen: CBNZ operand: ldaxr asUnsignedInteger operand: statusReg.
"Since CArg0Reg is never zero, merely returning answers true"
cogit RetN: 0.
br jmpTarget: (cogit gen: CLREX).
cogit CmpR: ABIResultReg R: lockValueReg.
cogit gen: CSET operand: ABIResultReg operand: EQ. "i.e. if NE to 0, then is it already set to the argument?"
cogit RetN: 0.
^self!
Item was changed:
----- Method: CogIA32Compiler>>generateLowLevelTryLock: (in category 'multi-threading') -----
generateLowLevelTryLock: vmOwnerLockAddress
+ "Generate a function that attempts to lock the vmOwnerLock and answers if it succeeded."
- "Generate a function that attempts to lock the vmOwnerLock and answers
- true if it succeeded."
<inline: true>
| valueReg |
vmOwnerLockAddress = 0 ifTrue:
[cogit
MoveCq: 1 R: ABIResultReg;
RetN: 0.
^self].
valueReg := cogit availableRegisterOrNoneIn: (ABICallerSavedRegisterMask bitClear: 1 << EAX).
cogit
MoveMw: 4 r: ESP R: valueReg;
MoveCq: 0 R: EAX;
gen: LOCK;
gen: CMPXCHGRAw operand: valueReg operand: vmOwnerLockAddress;
gen: SETE operand: ABIResultReg; "a.k.a. EAX"
RetN: 0!
Item was changed:
----- Method: Cogit>>firstMappedPCFor: (in category 'method map') -----
firstMappedPCFor: cogMethod
<var: #cogMethod type: #'CogMethod *'>
<inline: true>
+ ^(cogMethod cmType < CMClosedPIC and: [cogMethod cmIsFullBlock])
- ^cogMethod cmIsFullBlock
ifTrue: [cogMethod asUnsignedInteger + cbNoSwitchEntryOffset]
ifFalse: [cogMethod asUnsignedInteger + cmNoCheckEntryOffset]!
Item was changed:
----- Method: Cogit>>withProcessorHaltedDo: (in category 'simulation processor access') -----
withProcessorHaltedDo: aBlock
^processorLock critical:
+ ["This is a kack-handed attempt at stopping all other threads while this routine is running.
+ Anyway, don't set breakPC to true if trying to break within ceTryLockVMOwner"
+ | oldBreakPC oldSingleStep |
- [| oldBreakPC oldSingleStep |
oldBreakPC := breakPC.
oldSingleStep := singleStep.
+ singleStep := true.
+ (breakPC isInteger and: [breakPC between: ceTryLockVMOwner and: ceGetFP - 1]) ifFalse:
+ [breakPC := true].
- breakPC := singleStep := true.
aBlock ensure:
[singleStep := oldSingleStep.
breakPC := oldBreakPC]]!
More information about the Vm-dev
mailing list