[Vm-dev] VM Maker: VMMaker.oscog-eem.1608.mcz
commits at source.squeak.org
commits at source.squeak.org
Thu Dec 17 17:16:17 UTC 2015
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.1608.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.1608
Author: eem
Time: 17 December 2015, 9:14:34.651 am
UUID: bf1e1bd4-7dd4-47e2-bb33-3a988cc4c276
Ancestors: VMMaker.oscog-eem.1607
x64 Cogit:
Refactor genLookupForPerformNumArgs: along the same lines as compileOpenPIC:numArgs: to use a base reg to access the metod dict when outside the MoveMw:r:R: offset range.
=============== Diff against VMMaker.oscog-eem.1607 ===============
Item was changed:
----- Method: CogObjectRepresentationFor64BitSpur>>allImmediate:branchIf:notInstanceOfBehaviors:target: (in category 'sista support') -----
allImmediate: immediateMask branchIf: reg notInstanceOfBehaviors: arrayObj target: targetFixUp
| incorrectTag tag1 tag2 |
<var: #targetFixUp type: #'AbstractInstruction *'>
(self genJumpNotImmediate: reg) jmpTarget: targetFixUp.
immediateMask = objectMemory tagMask ifFalse:
[ "TempReg holds the rcvr tag"
"In this case one immediate tag out of the three is not present in arrayObj.
We look for it, and generate a jump to the fixup if the rcvr tag matches"
tag1 := objectMemory classTagForClass: (objectMemory fetchPointer: 0 ofObject: arrayObj).
tag2 := objectMemory classTagForClass: (objectMemory fetchPointer: 1 ofObject: arrayObj).
incorrectTag := self fetchImmediateTagOtherThanTag1: tag1 tag2: tag2.
cogit CmpCq: incorrectTag R: TempReg.
+ cogit JumpZero: targetFixUp].
+ ^0!
- cogit JumpZero: targetFixUp ].!
Item was changed:
----- Method: SimpleStackBasedCogit>>compileOpenPICMethodCacheProbeFor:withShift:baseRegOrNone: (in category 'in-line cacheing') -----
compileOpenPICMethodCacheProbeFor: selector withShift: shift baseRegOrNone: baseRegOrNone
+ "Compile one method cache probe in an OpenPIC's lookup of selector.
+ Answer the jump taken if the selector probe fails."
- "Compile one method cache probe in an OpenPIC's lookup of selector. Answer the jump taken if the selector probe fails."
<returnTypeC: #'AbstractInstruction *'>
<inline: false>
| jumpSelectorMiss |
<var: 'jumpSelectorMiss' type: #'AbstractInstruction *'>
self MoveR: SendNumArgsReg R: ClassReg.
self annotate: (self XorCw: selector R: ClassReg) objRef: selector.
objectMemory shiftForWord > shift ifTrue:
[self LogicalShiftLeftCq: objectMemory shiftForWord - shift R: ClassReg].
self AndCq: MethodCacheMask << objectMemory shiftForWord R: ClassReg.
baseRegOrNone = NoReg
ifTrue:
[self MoveMw: coInterpreter methodCacheAddress asUnsignedInteger + (MethodCacheSelector << objectMemory shiftForWord)
r: ClassReg
R: TempReg]
ifFalse:
[self AddR: baseRegOrNone R: ClassReg;
MoveMw: MethodCacheSelector << objectMemory shiftForWord r: ClassReg R: TempReg].
self annotate: (self CmpCw: selector R: TempReg) objRef: selector.
jumpSelectorMiss := self JumpNonZero: 0.
baseRegOrNone = NoReg
ifTrue:
[self MoveMw: coInterpreter methodCacheAddress asUnsignedInteger + (MethodCacheClass << objectMemory shiftForWord)
r: ClassReg
R: TempReg]
ifFalse:
[self MoveMw: MethodCacheClass << objectMemory shiftForWord r: ClassReg R: TempReg].
self CmpR: SendNumArgsReg R: TempReg.
^jumpSelectorMiss!
Item was added:
+ ----- Method: SimpleStackBasedCogit>>compilePerformMethodCacheProbeFor:withShift:baseRegOrNone: (in category 'in-line cacheing') -----
+ compilePerformMethodCacheProbeFor: selectorReg withShift: shift baseRegOrNone: baseRegOrNone
+ "Compile one method cache probe in a perform: primitive's lookup of selector.
+ Answer the jump taken if the selector probe fails."
+ <returnTypeC: #'AbstractInstruction *'>
+ <inline: false>
+ | jumpSelectorMiss |
+ <var: 'jumpSelectorMiss' type: #'AbstractInstruction *'>
+ self MoveR: SendNumArgsReg R: ClassReg.
+ self XorR: selectorReg R: ClassReg.
+ objectMemory shiftForWord > shift ifTrue:
+ [self LogicalShiftLeftCq: objectMemory shiftForWord - shift R: ClassReg].
+ self AndCq: MethodCacheMask << objectMemory shiftForWord R: ClassReg.
+ baseRegOrNone = NoReg
+ ifTrue:
+ [self MoveMw: coInterpreter methodCacheAddress asUnsignedInteger + (MethodCacheSelector << objectMemory shiftForWord)
+ r: ClassReg
+ R: TempReg]
+ ifFalse:
+ [self AddR: baseRegOrNone R: ClassReg;
+ MoveMw: MethodCacheSelector << objectMemory shiftForWord r: ClassReg R: TempReg].
+ self CmpR: selectorReg R: TempReg.
+ jumpSelectorMiss := self JumpNonZero: 0.
+ baseRegOrNone = NoReg
+ ifTrue:
+ [self MoveMw: coInterpreter methodCacheAddress asUnsignedInteger + (MethodCacheClass << objectMemory shiftForWord)
+ r: ClassReg
+ R: TempReg]
+ ifFalse:
+ [self MoveMw: MethodCacheClass << objectMemory shiftForWord r: ClassReg R: TempReg].
+ self CmpR: SendNumArgsReg R: TempReg.
+ ^jumpSelectorMiss!
Item was changed:
----- Method: SimpleStackBasedCogit>>genLookupForPerformNumArgs: (in category 'primitive generators') -----
genLookupForPerformNumArgs: numArgs
"Compile the code for a probe of the first-level method cache for a perform primtiive.
The selector is assumed to be in Arg0Reg. Defer to adjustArgumentsForPerform: to
adjust the arguments before the jump to the method."
+ | jumpSelectorMiss jumpClassMiss jumpInterpret itsAHit cacheBaseReg |
- | jumpSelectorMiss jumpClassMiss jumpInterpret itsAHit |
<var: #jumpSelectorMiss type: #'AbstractInstruction *'>
<var: #jumpClassMiss type: #'AbstractInstruction *'>
<var: #jumpInterpret type: #'AbstractInstruction *'>
<var: #itsAHit type: #'AbstractInstruction *'>
"N.B. Can't assume TempReg already contains the tag because a method can
of course be invoked via the unchecked entry-point, e.g. as does perform:."
+ objectRepresentation genGetInlineCacheClassTagFrom: ReceiverResultReg into: SendNumArgsReg forEntry: false.
- objectRepresentation genGetInlineCacheClassTagFrom: ReceiverResultReg into: ClassReg forEntry: false.
- "Do first of three probes. See StackInterpreter>>lookupInMethodCacheSel:classTag:"
self flag: #lookupInMethodCacheSel:classTag:. "so this method shows up as a sender of lookupInMethodCacheSel:class:"
+
+ cacheBaseReg := NoReg.
+ (backEnd isWithinMwOffsetRange: coInterpreter methodCacheAddress) ifFalse:
+ [self MoveCq: coInterpreter methodCacheAddress R: (cacheBaseReg := Scratch0Reg)].
+
+ "Do first of three probes. See CoInterpreter>>lookupInMethodCacheSel:classTag:"
+ jumpSelectorMiss := self compilePerformMethodCacheProbeFor: Arg0Reg withShift: 0 baseRegOrNone: cacheBaseReg.
- self MoveR: ClassReg R: SendNumArgsReg.
- self XorR: Arg0Reg R: ClassReg.
- self LogicalShiftLeftCq: objectMemory shiftForWord R: ClassReg.
- self AndCq: MethodCacheMask << objectMemory shiftForWord R: ClassReg.
- self MoveMw: coInterpreter methodCacheAddress asUnsignedInteger + (MethodCacheSelector << objectMemory shiftForWord)
- r: ClassReg
- R: TempReg.
- self CmpR: Arg0Reg R: TempReg.
- jumpSelectorMiss := self JumpNonZero: 0.
- self MoveMw: coInterpreter methodCacheAddress asUnsignedInteger + (MethodCacheClass << objectMemory shiftForWord)
- r: ClassReg
- R: TempReg.
- self CmpR: SendNumArgsReg R: TempReg.
jumpClassMiss := self JumpNonZero: 0.
+ "Fetch the method, and check if it is cogged."
+ itsAHit := self MoveMw: (cacheBaseReg = NoReg
+ ifTrue: [coInterpreter methodCacheAddress asUnsignedInteger + (MethodCacheMethod << objectMemory shiftForWord)]
+ ifFalse: [MethodCacheMethod << objectMemory shiftForWord])
+ r: ClassReg
+ R: SendNumArgsReg.
- itsAHit := self Label.
- "Fetch the method, and check it is cogged."
- self MoveMw: coInterpreter methodCacheAddress asUnsignedInteger + (MethodCacheMethod << objectMemory shiftForWord)
- r: ClassReg
- R: SendNumArgsReg.
"If the method is not compiled fall back on the interpreter primitive."
objectRepresentation genLoadSlot: HeaderIndex sourceReg: SendNumArgsReg destReg: ClassReg.
jumpInterpret := objectRepresentation genJumpImmediate: ClassReg.
"Adjust arguments and jump to the method's unchecked entry-point."
self AddCq: cmNoCheckEntryOffset R: ClassReg.
self adjustArgumentsForPerform: numArgs.
self JumpR: ClassReg.
"First probe missed. Do second of three probes. Shift hash right one and retry."
jumpSelectorMiss jmpTarget: (jumpClassMiss jmpTarget: self Label).
+ jumpSelectorMiss := self compilePerformMethodCacheProbeFor: Arg0Reg withShift: 1 baseRegOrNone: cacheBaseReg.
- self MoveR: SendNumArgsReg R: ClassReg.
- self XorR: Arg0Reg R: ClassReg.
- self LogicalShiftLeftCq: objectMemory shiftForWord - 1 R: ClassReg.
- self AndCq: MethodCacheMask << objectMemory shiftForWord R: ClassReg.
- self MoveMw: coInterpreter methodCacheAddress asUnsignedInteger + (MethodCacheSelector << objectMemory shiftForWord)
- r: ClassReg
- R: TempReg.
- self CmpR: Arg0Reg R: TempReg.
- jumpSelectorMiss := self JumpNonZero: 0.
- self MoveMw: coInterpreter methodCacheAddress asUnsignedInteger + (MethodCacheClass << objectMemory shiftForWord)
- r: ClassReg
- R: TempReg.
- self CmpR: SendNumArgsReg R: TempReg.
self JumpZero: itsAHit.
"Second probe missed. Do last probe. Shift hash right two and retry."
jumpSelectorMiss jmpTarget: self Label.
+ jumpSelectorMiss := self compilePerformMethodCacheProbeFor: Arg0Reg withShift: 1 baseRegOrNone: cacheBaseReg.
- self MoveR: SendNumArgsReg R: ClassReg.
- self XorR: Arg0Reg R: ClassReg.
- objectMemory shiftForWord > 2 ifTrue:
- [self LogicalShiftLeftCq: objectMemory shiftForWord - 1 R: ClassReg].
- self AndCq: MethodCacheMask << objectMemory shiftForWord R: ClassReg.
- self MoveMw: coInterpreter methodCacheAddress asUnsignedInteger + (MethodCacheSelector << objectMemory shiftForWord)
- r: ClassReg
- R: TempReg.
- self CmpR: Arg0Reg R: TempReg.
- jumpSelectorMiss := self JumpNonZero: 0.
- self MoveMw: coInterpreter methodCacheAddress asUnsignedInteger + (MethodCacheClass << objectMemory shiftForWord)
- r: ClassReg
- R: TempReg.
- self CmpR: SendNumArgsReg R: TempReg.
self JumpZero: itsAHit.
"Last probe missed. Caller will generate the call to fall back on the interpreter primitive."
jumpSelectorMiss jmpTarget:
(jumpInterpret jmpTarget: self Label).
^0!
More information about the Vm-dev
mailing list