[Vm-dev] VM Maker: VMMaker.oscog-cb.1283.mcz

Clément Bera bera.clement at gmail.com
Tue May 5 10:57:21 UTC 2015


Ok this fix the bug the SistaCogit now runs fine.

It could be better to put some values on stack instead of using registers
when calling some trampolines but I am a bit confused by which registers a
trampoline can used in its implementation so I postpone that for later.

2015-05-05 11:48 GMT+02:00 <commits at source.squeak.org>:

>
> Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
> http://source.squeak.org/VMMaker/VMMaker.oscog-cb.1283.mcz
>
> ==================== Summary ====================
>
> Name: VMMaker.oscog-cb.1283
> Author: cb
> Time: 5 May 2015, 11:48:13.804 am
> UUID: 3000cd43-f84f-4b75-9fdf-aff579a5105b
> Ancestors: VMMaker.oscog-eem.1282
>
> Fixed a bug in SistaCogit where a trampoline needed a specific register
> instead of an allocated one.
>
> =============== Diff against VMMaker.oscog-eem.1282 ===============
>
> Item was removed:
> - ----- Method:
> SistaStackToRegisterMappingCogit>>allocateRegPreferringCalleeSavedNotConflictingWith:
> (in category 'simulation stack') -----
> - allocateRegPreferringCalleeSavedNotConflictingWith: regMask
> -       "If there are multiple free registers, choose one which is callee
> saved,
> -       else just allocate a register not conflicting with regMask"
> -       | reg |
> -       reg := backEnd availableRegisterOrNilFor: ((self liveRegisters
> bitOr: regMask) bitOr: callerSavedRegMask).
> -       ^ reg
> -               ifNil: [ self allocateRegNotConflictingWith: regMask ]
> -               ifNotNil: [ reg ]!
>
> Item was changed:
>   ----- Method: SistaStackToRegisterMappingCogit>>genJumpIf:to: (in
> category 'bytecode generator support') -----
>   genJumpIf: boolean to: targetBytecodePC
>         "The heart of performance counting in Sista.  Conditional branches
> are 6 times less
>          frequent than sends and can provide basic block frequencies (send
> counters can't).
>          Each conditional has a 32-bit counter split into an upper 16 bits
> counting executions
>          and a lower half counting untaken executions of the branch.
> Executing the branch
>          decrements the upper half, tripping if the count goes negative.
> Not taking the branch
>          decrements the lower half.  N.B. We *do not* eliminate dead
> branches (true ifTrue:/true ifFalse:)
>          so that scanning for send and branch data is simplified and that
> branch data is correct."
>         <inline: false>
> +       | desc ok counterAddress countTripped retry |
> -       | desc ok counterAddress countTripped retry counterReg |
>         <var: #ok type: #'AbstractInstruction *'>
>         <var: #desc type: #'CogSimStackEntry *'>
>         <var: #retry type: #'AbstractInstruction *'>
>         <var: #countTripped type: #'AbstractInstruction *'>
>
>         (coInterpreter isOptimizedMethod: methodObj) ifTrue: [ ^ super
> genJumpIf: boolean to: targetBytecodePC ].
>
>         self ssFlushTo: simStackPtr - 1.
>         desc := self ssTop.
>         self ssPop: 1.
>         desc popToReg: TempReg.
>
> +       "We need SendNumArgsReg because of the mustBeBooleanTrampoline"
> +       self ssAllocateRequiredReg: SendNumArgsReg.
> +
> -       "We prefer calleeSaved to avoid saving it across the trap trip
> trampoline"
> -       counterReg := self
> allocateRegPreferringCalleeSavedNotConflictingWith: 0.
>         retry := self Label.
>         self
>                 genExecutionCountLogicInto: [ :cAddress :countTripBranch |
>                         counterAddress := cAddress.
>                         countTripped := countTripBranch ]
> +               counterReg: SendNumArgsReg.
> -               counterReg: counterReg.
>         counterIndex := counterIndex + 1.
>
>         "Cunning trick by LPD.  If true and false are contiguous subtract
> the smaller.
>          Correct result is either 0 or the distance between them.  If
> result is not 0 or
>          their distance send mustBeBoolean."
>         self assert: (objectMemory objectAfter: objectMemory falseObject)
> = objectMemory trueObject.
>         self annotate: (self SubCw: boolean R: TempReg) objRef: boolean.
>         self JumpZero: (self ensureFixupAt: targetBytecodePC - initialPC).
>
> +       self genFallsThroughCountLogicCounterReg: SendNumArgsReg
> counterAddress: counterAddress.
> -       self genFallsThroughCountLogicCounterReg: counterReg
> counterAddress: counterAddress.
>
>         self CmpCq: (boolean == objectMemory falseObject
>                                         ifTrue: [objectMemory trueObject -
> objectMemory falseObject]
>                                         ifFalse: [objectMemory falseObject
> - objectMemory trueObject])
>                 R: TempReg.
>         ok := self JumpZero: 0.
> +       self MoveCq: 0 R: SendNumArgsReg. "if counterReg is 0 this is a
> mustBeBoolean, not a counter trip."
> -       self MoveCq: 0 R: counterReg. "if counterReg is 0 this is a
> mustBeBoolean, not a counter trip."
>
>         countTripped jmpTarget:
>                 (self CallRT: (boolean == objectMemory falseObject
>                                                 ifTrue:
> [ceSendMustBeBooleanAddFalseTrampoline]
>                                                 ifFalse:
> [ceSendMustBeBooleanAddTrueTrampoline])).
>
>         "If we're in an image which hasn't got the Sista code loaded then
> the ceCounterTripped:
>          trampoline will return directly to machine code, returning the
> boolean.  So the code should
>          jump back to the retry point. The trampoline makes sure that
> TempReg has been reloaded."
>         self annotateBytecode: self Label.
>
>         self Jump: retry.
>
>         ok jmpTarget: self Label.
>         ^0!
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20150505/35bff520/attachment-0001.htm


More information about the Vm-dev mailing list