[Vm-dev] VM Maker: VMMaker.oscog-eem.2705.mcz
commits at source.squeak.org
commits at source.squeak.org
Tue Feb 4 21:06:11 UTC 2020
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.2705.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.2705
Author: eem
Time: 4 February 2020, 1:05:54.591994 pm
UUID: 35875931-68e1-4c94-a7ec-9cf66d27743d
Ancestors: VMMaker.oscog-eem.2704
Oops, mis-edited two methods.
=============== Diff against VMMaker.oscog-eem.2704 ===============
Item was changed:
----- Method: AbstractInstructionTests>>runCmpRRJumpCond:on: (in category 'running') -----
runCmpRRJumpCond: assertPrintBar on: aStream
"Compile and evaluate as many combinations of CmpR:R: JumpCond: as possible, checking that they produce the
expected result. Answer an array of the number of comparisons and the number of them that succeeded."
"self defaultTester runCmpRRJumpCond: false"
| cogit nTests nGood |
cogit := self cogitForTests.
nTests := nGood := 0.
self concreteCompilerClass dataRegistersWithAccessorsGiven: self processor do:
[:sreg :srgetter :srsetter|
self concreteCompilerClass dataRegistersWithAccessorsGiven: self processor do:
[:dreg :drgetter :drsetter|
(sreg ~= dreg "N.B. We do not expect the backEnd to provide CmpR: SPReg R: reg, only CmpR: reg R: SPReg"
and: [drgetter ~= #sp]) ifTrue:
[#( = ~=
> > >= >=
< < <= <=)
with: #(JumpZero: JumpNonZero:
JumpGreater: JumpAbove: JumpGreaterOrEqual: JumpAboveOrEqual:
JumpLess: JumpBelow: JumpLessOrEqual: JumpBelowOrEqual:)
do: [:comparison :instruction| | unsigned jmp memory |
unsigned := (instruction includesSubstring: 'Above')
or: [instruction includesSubstring: 'Below'].
"(drgetter = #sp or: [srgetter = #sp]) ifTrue: [self halt]."
cogit resetGen.
cogit CmpR: dreg R: sreg.
jmp := cogit perform: instruction with: 0.
cogit
+ MoveCq: 0 R: ABIResultReg;
- MoveCq: 0 R: cogit ABIResultReg;
Jump: 1536.
+ jmp jmpTarget: (cogit MoveCq: 1 R: ABIResultReg).
- jmp jmpTarget: (cogit MoveCq: 1 R: cogit ABIResultReg).
cogit Jump: 1536.
memory := self generatedCodeFrom: cogit.
"self processor disassembleFrom: 1024 to: cogit codeSize - 1024 * 2 + 1024 in: memory ''"
self pairs: { -1 << 30. "-1 << 16." -1 << 8. 0. 1 << 8. "1 << 16." 1 << 30 } do:
[:a :b| | bogus error expected nInsts |
nTests := nTests + 1.
error := false.
nInsts := 0.
self processor
reset;
pc: self defaultCodeStart;
perform: srsetter with: (processor convertIntegerToInternal: a);
perform: drsetter with: (processor convertIntegerToInternal: b).
[[processor pc ~= 1536 and: [nInsts < 16]] whileTrue:
[processor singleStepIn: memory. nInsts := nInsts + 1]]
on: Error
do: [:ex| error := true].
nInsts >= 16 ifTrue: [error := true].
"self processor disassembleInstructionAt: 0 In: memory"
bogus := (processor pc = 1536 and: [#[0 1] includes: processor cResultRegister]) not.
assertPrintBar ifTrue: [self deny: bogus].
expected := unsigned
ifTrue: [(a bitAnd: 1 << 32 - 1) perform: comparison with: (b bitAnd: 1 << 32 - 1)]
ifFalse: [a perform: comparison with: b].
(bogus or: [error or: [self processor cResultRegister = 1 ~= expected]]) ifFalse: [nGood := nGood + 1].
assertPrintBar
ifTrue: [self assert: self processor cResultRegister = 1 equals: expected]
ifFalse:
[self processor cResultRegister = 1 ~= expected ifTrue:
[aStream nextPutAll: srgetter; space; nextPutAll: comparison; space; nextPutAll: drgetter.
unsigned ifTrue: [aStream nextPutAll: ' (unsigned)'].
aStream nextPutAll: (error ifTrue: [' ERRORED'] ifFalse: [' is incorrect']); cr; flush.
bogus ifTrue:
[self processor printRegistersOn: aStream.
aStream nextPutAll: (self processor disassembleInstructionAt: 0 In: memory); cr; flush]]]]]]]].
assertPrintBar ifFalse:
[aStream print: nTests; nextPutAll: ' tests; '; print: nGood; nextPutAll: ' good'; cr].
^{nTests. nGood}!
Item was changed:
----- Method: CogObjectRepresentationForSpur>>genStoreCheckTrampoline (in category 'initialization') -----
genStoreCheckTrampoline
| jumpSC |
<var: #jumpSC type: #'AbstractInstruction *'>
<inline: true>
CheckRememberedInTrampoline ifTrue:
[cogit zeroOpcodeIndex.
+ jumpSC := self genCheckRememberedBitOf: ReceiverResultReg scratch: ABIResultReg.
- jumpSC := self genCheckRememberedBitOf: ReceiverResultReg scratch: cogit ABIResultReg.
self assert: jumpSC opcode = JumpNonZero.
jumpSC opcode: JumpZero.
cogit RetN: 0.
jumpSC jmpTarget: cogit Label].
^cogit
genTrampolineFor: #remember:
called: 'ceStoreCheckTrampoline'
numArgs: 1
arg: ReceiverResultReg
arg: nil
arg: nil
arg: nil
regsToSave: (CallerSavedRegisterMask bitClear: (cogit registerMaskFor: ReceiverResultReg))
pushLinkReg: true
resultReg: cogit returnRegForStoreCheck
appendOpcodes: CheckRememberedInTrampoline!
More information about the Vm-dev
mailing list