[Vm-dev] VM Maker: VMMaker.oscog-eem.1208.mcz
commits at source.squeak.org
commits at source.squeak.org
Fri Apr 17 18:09:00 UTC 2015
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.1208.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.1208
Author: eem
Time: 17 April 2015, 11:07:16.032 am
UUID: 1d854c26-ef10-420c-bbac-d45a4bb082a6
Ancestors: VMMaker.oscog-cb.1207
Head slap! Fix the copy-paste error that caused
the regression in VMMaker.oscog-eem.1160/3308.
Fix tiny formatting issue.
Don't merge with VMMaker.oscog-cb.1208 yet; it
has changes that lack support from
CogObjectRepresentationForSqueakV3.
=============== Diff against VMMaker.oscog-cb.1207 ===============
Item was changed:
----- Method: Cogit>>markLiteralsAndUnlinkIfUnmarkedSend:pc:method: (in category 'garbage collection') -----
markLiteralsAndUnlinkIfUnmarkedSend: annotation pc: mcpc method: cogMethod
"Mark and trace literals. Unlink sends that have unmarked cache tags or targets."
<var: #mcpc type: #'char *'>
<var: #nsSendCache type: #'NSSendCache *'>
| literal |
annotation = IsObjectReference ifTrue:
[literal := backEnd literalBeforeFollowingAddress: mcpc asUnsignedInteger.
(objectRepresentation
markAndTraceLiteral: literal
in: (self cCoerceSimple: cogMethod to: #'CogMethod *')
atpc: mcpc asUnsignedInteger) ifTrue:
[codeModified := true]].
self cppIf: NewspeakVM ifTrue:
[annotation = IsNSSendCall ifTrue:
[| nsSendCache entryPoint targetMethod sel eo |
nsSendCache := self nsSendCacheFromReturnAddress: mcpc asInteger.
entryPoint := nsSendCache target.
entryPoint ~= 0 ifTrue: "Send is linked"
[targetMethod := entryPoint - cmNoCheckEntryOffset.
(self markAndTraceOrFreeCogMethod: targetMethod
firstVisit: targetMethod asUnsignedInteger > mcpc asUnsignedInteger) ifTrue:
[self voidNSSendCache: nsSendCache]].
sel := nsSendCache selector.
(objectMemory isForwarded: sel)
ifFalse: [objectMemory markAndTrace: sel]
ifTrue: [sel := objectMemory followForwarded: literal.
nsSendCache selector: sel.
self markAndTraceUpdatedLiteral: sel in: (self cCoerceSimple: cogMethod to: #'CogMethod *')].
eo := nsSendCache enclosingObject.
eo ~= 0 ifTrue:
[(objectMemory isForwarded: eo)
ifFalse: [objectMemory markAndTrace: eo]
ifTrue: [eo := objectMemory followForwarded: literal.
nsSendCache enclosingObject: eo.
self markAndTraceUpdatedLiteral: eo in: (self cCoerceSimple: cogMethod to: #'CogMethod *')]]]].
+ (self isPureSendAnnotation: annotation) ifTrue:
- annotation = IsNSSendCall ifTrue:
[self offsetCacheTagAndCouldBeObjectAt: mcpc annotation: annotation into:
[:entryPoint :cacheTag :tagCouldBeObj | | cacheTagMarked |
- self assert: annotation ~= IsNSSendCall.
cacheTagMarked := tagCouldBeObj and: [objectRepresentation cacheTagIsMarked: cacheTag].
entryPoint > methodZoneBase
ifTrue: "It's a linked send."
[self targetMethodAndSendTableFor: entryPoint annotation: annotation into:
[:targetMethod :sendTable|
(cacheTagMarked not
or: [self markAndTraceOrFreeCogMethod: targetMethod
firstVisit: targetMethod asUnsignedInteger > mcpc asUnsignedInteger]) ifTrue:
["Either the cacheTag is unmarked (e.g. new class) or the target
has been freed (because it is unmarked), so unlink the send."
self unlinkSendAt: mcpc targetMethod: targetMethod sendTable: sendTable.
objectRepresentation
markAndTraceLiteral: targetMethod selector
in: targetMethod
at: (self addressOf: targetMethod selector put: [:val| targetMethod selector: val])]]]
ifFalse: "cacheTag is selector"
[(objectRepresentation
markAndTraceCacheTagLiteral: cacheTag
in: cogMethod
atpc: mcpc asUnsignedInteger) ifTrue:
[codeModified := true]]]].
^0 "keep scanning"!
Item was changed:
----- Method: StackToRegisterMappingCogit>>genSpecialSelectorEqualsEquals (in category 'bytecode generators') -----
genSpecialSelectorEqualsEquals
| nextPC postBranchPC targetBytecodePC primDescriptor branchDescriptor nExts
unforwardArg unforwardRcvr jumpEqual jumpNotEqual rcvrReg argReg result |
<var: #jumpEqual type: #'AbstractInstruction *'>
<var: #jumpNotEqual type: #'AbstractInstruction *'>
<var: #primDescriptor type: #'BytecodeDescriptor *'>
<var: #branchDescriptor type: #'BytecodeDescriptor *'>
primDescriptor := self generatorAt: byte0.
"forwarders have been followed in cog:selector:"
(self ssTop type = SSConstant
and: [(self ssValue: 1) type = SSConstant]) ifTrue:
[self assert: primDescriptor isMapped not.
result := self ssTop constant = (self ssValue: 1) constant
ifTrue: [objectMemory trueObject]
ifFalse: [objectMemory falseObject].
self ssPop: 2.
^self ssPushConstant: result].
nextPC := bytecodePC + primDescriptor numBytes.
nExts := 0.
[branchDescriptor := self generatorAt: (objectMemory fetchByte: nextPC ofObject: methodObj) + (byte0 bitAnd: 256).
branchDescriptor isExtension] whileTrue:
[nExts := nExts + 1.
nextPC := nextPC + branchDescriptor numBytes].
"If branching the stack must be flushed for the merge"
(branchDescriptor isBranchTrue or: [branchDescriptor isBranchFalse]) ifTrue:
[self ssFlushTo: simStackPtr - 2].
unforwardRcvr := (self ssValue: 1) type ~= SSConstant
or: [objectRepresentation shouldAnnotateObjectReference: (self ssValue: 1) constant].
unforwardArg := self ssTop type ~= SSConstant
or: [objectRepresentation shouldAnnotateObjectReference: self ssTop constant].
"Don't use ReceiverResultReg for receiver to keep ReceiverResultReg live.
Optimize e.g. rcvr == nil, the common case for ifNil: et al."
needsFrame
ifTrue:
[unforwardArg ifTrue:
[self ssAllocateRequiredReg: (argReg := Arg0Reg) upThrough: simStackPtr - 1].
self ssAllocateRequiredReg: (rcvrReg := Arg1Reg) upThrough: simStackPtr - 2]
ifFalse:
[unforwardArg ifTrue:
[argReg := self ssAllocatePreferredReg: ClassReg].
rcvrReg := self ssAllocatePreferredReg: SendNumArgsReg].
unforwardArg
ifTrue:
[self ssTop popToReg: argReg.
objectRepresentation genEnsureOopInRegNotForwarded: argReg scratchReg: TempReg.
(self ssValue: 1) popToReg: rcvrReg.
unforwardRcvr ifTrue:
[objectRepresentation genEnsureOopInRegNotForwarded: rcvrReg scratchReg: TempReg].
self CmpR: argReg R: rcvrReg]
ifFalse:
[(self ssValue: 1) popToReg: rcvrReg.
unforwardRcvr ifTrue:
[objectRepresentation genEnsureOopInRegNotForwarded: rcvrReg scratchReg: TempReg].
self CmpCq: self ssTop constant R: rcvrReg].
self ssPop: 2.
"If not followed by a branch, resolve to true or false."
(branchDescriptor isBranchTrue or: [branchDescriptor isBranchFalse]) ifFalse:
[jumpNotEqual := self JumpNonZero: 0.
self annotate: (self MoveCw: objectMemory trueObject R: rcvrReg)
objRef: objectMemory trueObject.
jumpEqual := self Jump: 0.
jumpNotEqual jmpTarget: (self annotate: (self MoveCw: objectMemory falseObject R: rcvrReg)
objRef: objectMemory falseObject).
jumpEqual jmpTarget: self Label.
self ssPushRegister: rcvrReg.
^0].
"Further since there is a following conditional jump bytecode, define
non-merge fixups and leave the cond bytecode to set the mergeness."
targetBytecodePC := nextPC
+ branchDescriptor numBytes
+ (self spanFor: branchDescriptor at: nextPC exts: nExts in: methodObj).
postBranchPC := nextPC + branchDescriptor numBytes.
(self fixupAt: nextPC - initialPC) targetInstruction = 0
ifTrue: "The next instruction is dead. we can skip it."
[deadCode := true.
self ensureFixupAt: targetBytecodePC - initialPC.
self ensureFixupAt: postBranchPC - initialPC]
ifFalse:
[self ssPushConstant: objectMemory trueObject]. "dummy value"
self gen: (branchDescriptor isBranchTrue ifTrue: [JumpZero] ifFalse: [JumpNonZero])
operand: (self ensureNonMergeFixupAt: targetBytecodePC - initialPC) asUnsignedInteger.
+ deadCode ifFalse: [self Jump: (self ensureNonMergeFixupAt: postBranchPC - initialPC)].
- deadCode ifFalse: [self Jump: (self ensureNonMergeFixupAt: postBranchPC - initialPC)].
^0!
More information about the Vm-dev
mailing list