[Vm-dev] VM Maker: VMMaker.oscog-cb.1943.mcz
commits at source.squeak.org
commits at source.squeak.org
Tue Sep 6 15:12:32 UTC 2016
ClementBera uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-cb.1943.mcz
==================== Summary ====================
Name: VMMaker.oscog-cb.1943
Author: cb
Time: 6 September 2016, 5:10:02.198185 pm
UUID: 3b8e2d0c-b41c-4f15-833d-a56b8d6256bf
Ancestors: VMMaker.oscog-eem.1942
testBcToBc is improved to to test instructions only mapped in blocks.
StackDepthFinder is improved to support nlr in well aligned compiledBlock compiled to machine code (in this case the mcpc to bcpc mapping maps the las bcpc+1 and last mcpc + 1)
Remvoe two type annotations that were not used any more.
=============== Diff against VMMaker.oscog-eem.1942 ===============
Item was changed:
----- Method: Cogit>>testBcToMcPcMappingForCogMethod: (in category 'testing') -----
testBcToMcPcMappingForCogMethod: cogMethod
<doNotGenerate>
"self disassembleMethod: cogMethod"
"self printPCMapPairsFor: cogMethod on: Transcript"
| aMethodObj subMethods bsOffset |
aMethodObj := cogMethod methodObject.
subMethods := self subMethodsAsRangesFor: cogMethod.
subMethods first endPC: (self endPCOf: aMethodObj).
bsOffset := self bytecodeSetOffsetFor: aMethodObj.
self bcpcsAndDescriptorsFor: aMethodObj bsOffset: bsOffset do:
[:bcpc :byte :desc :nExts| | subMethod |
(desc notNil and: [desc isBlockCreation]) ifTrue:
[subMethod := subMethods detect: [:sm| sm startpc = (bcpc + desc numBytes)].
subMethod endPC: bcpc + desc numBytes + (self spanFor: desc at: bcpc exts: -1 in: aMethodObj) - 1]].
subMethods allButFirst do:
[:blockSubMethod| | cogBlockMethod |
cogBlockMethod := self
findMethodForStartBcpc: blockSubMethod startpc
inHomeMethod: cogMethod.
self assert: cogBlockMethod address = (blockSubMethod first - (self sizeof: CogBlockMethod))].
self bcpcsAndDescriptorsFor: aMethodObj bsOffset: bsOffset do:
[:bcpc :byte :desc :nExts| | startBcpc currentSubMethod subCogMethod absMcpc mappedBcpc |
currentSubMethod := self innermostSubMethodFor: bcpc in: subMethods startingAt: 1.
subCogMethod := currentSubMethod cogMethod.
(subCogMethod stackCheckOffset > 0
+ and: [desc isNil or: [desc isMapped
+ or: [ inBlock = InFullBlock and: [desc isMappedInBlock]]]]) ifTrue:
- and: [desc isNil or: [desc isMapped]]) ifTrue:
[startBcpc := subCogMethod = cogMethod
ifTrue: [coInterpreter startPCOfMethod: aMethodObj]
ifFalse: [currentSubMethod startpc].
"The first bytecode and backward branch bytecodes are mapped to their pc.
Other bytecodes map to their following pc."
absMcpc := (desc notNil
and: [desc isBranch
and: [self isBackwardBranch: desc at: bcpc exts: nExts in: aMethodObj]])
ifTrue: "Backward branches have a special mapper"
[mappedBcpc := bcpc.
self
mcPCForBackwardBranch: mappedBcpc
startBcpc: startBcpc
in: subCogMethod]
ifFalse: "All others use the generic mapper"
[mappedBcpc := desc ifNil: [bcpc] ifNotNil: [bcpc + desc numBytes].
self
mcPCFor: mappedBcpc
startBcpc: startBcpc
in: subCogMethod].
self assert: absMcpc >= (subCogMethod asInteger + subCogMethod stackCheckOffset).
self assert: (self bytecodePCFor: absMcpc startBcpc: startBcpc in: subCogMethod) = mappedBcpc]]!
Item was changed:
----- Method: StackDepthFinder>>method:pc: (in category 'private') -----
method: method pc: startpc
super method: method pc: startpc.
+ "The + 1 is there for full blocks ending with non local return,
+ as the following pc is mapped and beyong endPC"
+ joins := Array new: method endPC + 1.
- joins := Array new: method endPC.
stackp := method numTemps!
Item was changed:
----- Method: StackDepthFinder>>stackPointers (in category 'accessing') -----
stackPointers
"Collect the stack depth for each bytecode in the method.
For the convenience of clients, write the stack depth for extended bytecodes
to the bytecode pc, as well as the bytecocdes' extensions' pcs."
| method stackPointers end |
+ "endPC +1 because of full blocks that can end with NLR effectively mapping the pc right after the end PC"
+ stackPointers := Array new: (end := (method := self method) endPC) + 1.
- stackPointers := Array new: (end := (method := self method) endPC).
encoderClass ifNil: [encoderClass := method encoderClass].
[pc <= end] whileTrue:
[stackPointers at: pc put: stackp.
encoderClass extensionsAt: pc in: method into:
[:extA :extB :delta|
delta > 0 ifTrue:
[stackPointers at: pc + delta put: stackp]].
self interpretNextInstructionFor: self].
+ stackPointers at: end + 1 put: (stackPointers at: end).
^stackPointers!
Item was changed:
----- Method: StackToRegisterMappingCogit>>genGenericStorePop:MaybeContextSlotIndex:needsStoreCheck:needsRestoreRcvr:needsImmutabilityCheck: (in category 'bytecode generator stores') -----
genGenericStorePop: popBoolean MaybeContextSlotIndex: slotIndex needsStoreCheck: needsStoreCheck needsRestoreRcvr: needsRestoreReceiver needsImmutabilityCheck: needsImmCheck
"Generates a store into an object that *may* be a context.
Multiple settings:
- needsStoreCheck (young into old object check)
- needRestoreRcvr (ensures the recevier is live across the store)
- needsImmCheck (do the call-back if the receiver is immutable)"
<inline: true>
- <var: #jmpSingle type: #'AbstractInstruction *'>
- <var: #jmpDone type: #'AbstractInstruction *'>
<var: #mutableJump type: #'AbstractInstruction *'>
<var: #immutabilityFailure type: #'AbstractInstruction *'>
| immutabilityFailure mutableJump |
"The reason we need a frame here is that assigning to an inst var of a context may
involve wholesale reorganization of stack pages, and the only way to preserve the
execution state of an activation in that case is if it has a frame."
self assert: needsFrame.
self
cppIf: IMMUTABILITY
ifTrue:
[needsImmCheck
ifTrue:
[mutableJump := objectRepresentation genJumpMutable: ReceiverResultReg scratchReg: TempReg.
objectRepresentation genStoreTrampolineCall: slotIndex.
needsRestoreReceiver ifTrue: [ self putSelfInReceiverResultReg ].
immutabilityFailure := self Jump: 0.
mutableJump jmpTarget: self Label.]].
self ssPop: 1.
self ssAllocateCallReg: ClassReg and: SendNumArgsReg. "for ceStoreContextInstVarTrampoline"
self ssPush: 1.
objectRepresentation
genLoadSlot: SenderIndex
sourceReg: ReceiverResultReg
destReg: TempReg.
self ssStoreAndReplacePop: popBoolean toReg: ClassReg.
self ssFlushTo: simStackPtr.
self MoveCq: slotIndex R: SendNumArgsReg.
self CallRT: ceStoreContextInstVarTrampoline.
self
cppIf: IMMUTABILITY
ifTrue:
[needsImmCheck ifTrue:[immutabilityFailure jmpTarget: self Label]].
^0!
More information about the Vm-dev
mailing list