[Vm-dev] VM Maker: VMMaker.oscog-eem.526.mcz
commits at source.squeak.org
commits at source.squeak.org
Wed Nov 27 02:06:41 UTC 2013
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.526.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.526
Author: eem
Time: 26 November 2013, 6:03:25.857 pm
UUID: f9b89c93-d691-49b9-a39c-2de1201b301a
Ancestors: VMMaker.oscog-eem.525
Implement following of potentially forwarded literal variables in the Cogit.
=============== Diff against VMMaker.oscog-eem.525 ===============
Item was added:
+ ----- Method: CogObjectRepresentation>>genEnsureRegNotForwarded:scratchReg: (in category 'compile abstract instructions') -----
+ genEnsureRegNotForwarded: reg scratchReg: scratch
+ "Make sure that the obejct in reg is not forwarded. By default there is
+ nothing to do. Subclasses for memory managers that forward will override."
+ ^0!
Item was added:
+ ----- Method: CogObjectRepresentationForSpur>>genEnsureRegNotForwarded:scratchReg: (in category 'compile abstract instructions') -----
+ genEnsureRegNotForwarded: reg scratchReg: scratch
+ "Make sure that the obejct in reg is not forwarded."
+ | loop ok |
+ <var: #ok type: #'AbstractInstruction *'>
+ <var: #loop type: #'AbstractInstruction *'>
+ self assert: reg ~= scratch.
+ loop := cogit Label.
+ self genGetClassIndexOfNonImm: reg into: scratch.
+ cogit CmpCq: objectMemory isForwardedObjectClassIndexPun
+ R: TempReg.
+ ok := cogit JumpNonZero: 0.
+ self genLoadSlot: 0 sourceReg: reg destReg: reg.
+ cogit Jump: loop.
+ ok jmpTarget: cogit Label.
+ ^0!
Item was changed:
----- Method: SimpleStackBasedCogit>>genPushLiteralVariable: (in category 'bytecode generators') -----
genPushLiteralVariable: literalIndex
<inline: false>
| association |
association := self getLiteral: literalIndex.
"N.B. Do _not_ use ReceiverResultReg to avoid overwriting receiver in assignment in frameless methods."
self annotate: (self MoveCw: association R: ClassReg) objRef: association.
+ objectRepresentation genEnsureRegNotForwarded: ClassReg scratchReg: TempReg.
objectRepresentation
genLoadSlot: ValueIndex
sourceReg: ClassReg
destReg: TempReg.
self PushR: TempReg.
^0!
Item was changed:
----- Method: SimpleStackBasedCogit>>genStorePop:LiteralVariable: (in category 'bytecode generators') -----
genStorePop: popBoolean LiteralVariable: litVarIndex
<inline: false>
| association |
self assert: needsFrame.
association := self getLiteral: litVarIndex.
self annotate: (self MoveCw: association R: ReceiverResultReg) objRef: association.
+ objectRepresentation genEnsureRegNotForwarded: ReceiverResultReg scratchReg: TempReg.
popBoolean
ifTrue: [self PopR: ClassReg]
ifFalse: [self MoveMw: 0 r: SPReg R: ClassReg].
traceStores > 0 ifTrue:
[self CallRT: ceTraceStoreTrampoline].
^objectRepresentation
genStoreSourceReg: ClassReg
slotIndex: ValueIndex
destReg: ReceiverResultReg
scratchReg: TempReg!
Item was changed:
----- Method: StackToRegisterMappingCogit>>genPushLiteralVariable: (in category 'bytecode generators') -----
genPushLiteralVariable: literalIndex
<inline: false>
| association freeReg |
freeReg := self ssAllocatePreferredReg: ClassReg.
association := self getLiteral: literalIndex.
"N.B. Do _not_ use ReceiverResultReg to avoid overwriting receiver in assignment in frameless methods."
"So far descriptors are not rich enough to describe the entire dereference so generate the register
load but don't push the result. There is an order-of-evaluation issue if we defer the dereference."
self annotate: (self MoveCw: association R: TempReg) objRef: association.
+ objectRepresentation genEnsureRegNotForwarded: TempReg scratchReg: freeReg.
objectRepresentation
genLoadSlot: ValueIndex
sourceReg: TempReg
destReg: freeReg.
self ssPushRegister: freeReg.
^0!
Item was changed:
----- Method: StackToRegisterMappingCogit>>genStorePop:LiteralVariable: (in category 'bytecode generators') -----
genStorePop: popBoolean LiteralVariable: litVarIndex
<inline: false>
| topReg valueReg association constVal |
self flag: 'with better register allocation this wouldn''t need a frame. e.g. use SendNumArgs instead of ReceiverResultReg'.
self assert: needsFrame.
optStatus isReceiverResultRegLive: false.
"N.B. No need to check the stack for references because we generate code for
literal variable loads that stores the result in a register, deferring only the register push."
association := self getLiteral: litVarIndex.
constVal := self ssTop maybeConstant.
"Avoid store check for immediate values"
(self ssTop type = SSConstant
and: [(objectRepresentation shouldAnnotateObjectReference: constVal) not]) ifTrue:
[self ssAllocateRequiredReg: ReceiverResultReg.
self annotate: (self MoveCw: association R: ReceiverResultReg) objRef: association.
+ objectRepresentation genEnsureRegNotForwarded: ReceiverResultReg scratchReg: TempReg.
self ssStorePop: popBoolean toPreferredReg: TempReg.
traceStores > 0 ifTrue:
[self CallRT: ceTraceStoreTrampoline].
^objectRepresentation
genStoreImmediateInSourceReg: TempReg
slotIndex: ValueIndex
destReg: ReceiverResultReg].
((topReg := self ssTop registerOrNil) isNil
or: [topReg = ReceiverResultReg]) ifTrue:
[topReg := ClassReg].
self ssPop: 1.
self ssAllocateCallReg: topReg. "for the ceStoreCheck call in genStoreSourceReg:... below"
self ssPush: 1.
valueReg := self ssStorePop: popBoolean toPreferredReg: topReg.
valueReg = ReceiverResultReg ifTrue:
[self MoveR: valueReg R: topReg].
self ssAllocateCallReg: ReceiverResultReg.
self annotate: (self MoveCw: association R: ReceiverResultReg) objRef: association.
+ objectRepresentation genEnsureRegNotForwarded: ReceiverResultReg scratchReg: TempReg.
+ traceStores > 0 ifTrue:
- traceStores > 0 ifTrue:
[self MoveR: topReg R: TempReg.
self CallRT: ceTraceStoreTrampoline].
^objectRepresentation
genStoreSourceReg: topReg
slotIndex: ValueIndex
destReg: ReceiverResultReg
scratchReg: TempReg!
More information about the Vm-dev
mailing list