[Vm-dev] VM Maker: VMMaker.oscog-eem.893.mcz
commits at source.squeak.org
commits at source.squeak.org
Tue Oct 7 17:43:13 UTC 2014
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.893.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.893
Author: eem
Time: 7 October 2014, 10:40:35.144 am
UUID: 1db16930-a6b8-419b-bedc-83dfe3c6f277
Ancestors: VMMaker.oscog-eem.892
Further work to rescue the SimpleStackBasedCogit.
=============== Diff against VMMaker.oscog-eem.892 ===============
Item was changed:
----- Method: CoInterpreter>>callRegisterArgCogMethod:at:receiver: (in category 'enilopmarts') -----
callRegisterArgCogMethod: cogMethod at: entryOffset receiver: rcvr
"convert
rcvr base
arg(s)
retpc <- sp
to
retpc base
entrypc
rcvr
arg(s) <- sp
and then enter at either the checked or the unchecked entry-point."
+ <option: #StackToRegisterMappingCogit>
<var: #cogMethod type: #'CogMethod *'>
self assert: (cogit numRegArgs > 0 and: [cogit numRegArgs <= 2 and: [cogMethod cmNumArgs <= cogit numRegArgs]]).
cogMethod cmNumArgs = 2 ifTrue:
[self stackValue: 3 put: self stackTop. "retpc"
self push: (self stackValue: 1). "last arg"
self stackValue: 1 put: (self stackValue: 3). "first arg"
self stackValue: 2 put: rcvr.
self stackValue: 3 put: cogMethod asInteger + entryOffset.
cogit ceCallCogCodePopReceiverArg1Arg0Regs
"NOTREACHED"].
cogMethod cmNumArgs = 1 ifTrue:
[self stackValue: 2 put: self stackTop. "retpc"
self push: (self stackValue: 1). "arg"
self stackValue: 1 put: rcvr.
self stackValue: 2 put: cogMethod asInteger + entryOffset.
cogit ceCallCogCodePopReceiverArg0Regs
"NOTREACHED"].
self assert: cogMethod cmNumArgs = 0.
self stackValue: 1 put: self stackTop. "retpc"
self stackValue: 0 put: cogMethod asInteger + entryOffset.
self push: rcvr.
cogit ceCallCogCodePopReceiverReg
"NOTREACHED"!
Item was changed:
----- Method: SimpleStackBasedCogit>>compileOpenPIC:numArgs: (in category 'in-line cacheing') -----
compileOpenPIC: selector numArgs: numArgs
"Compile the code for an open PIC. Perform a probe of the first-level method
lookup cache followed by a call of ceSendFromInLineCacheMiss: if the probe fails."
| jumpSelectorMiss jumpClassMiss itsAHit jumpBCMethod |
<var: #jumpSelectorMiss type: #'AbstractInstruction *'>
<var: #jumpClassMiss type: #'AbstractInstruction *'>
<var: #itsAHit type: #'AbstractInstruction *'>
<var: #jumpBCMethod type: #'AbstractInstruction *'>
self compilePICProlog: numArgs.
self cppIf: NewspeakVM ifTrue:
[self Nop. "1st nop differentiates dynSuperEntry from no-check entry if using nextMethod"
dynSuperEntry := self Nop].
entry := objectRepresentation genGetClassTagOf: ReceiverResultReg into: ClassReg scratchReg: TempReg.
"Do first of three probes. See CoInterpreter>>lookupInMethodCacheSel:classTag:"
self flag: #lookupInMethodCacheSel:classTag:. "so this method shows up as a sender of lookupInMethodCacheSel:class:"
self MoveR: ClassReg R: SendNumArgsReg.
self annotate: (self XorCw: selector R: ClassReg) objRef: selector.
self LogicalShiftLeftCq: ShiftForWord R: ClassReg.
self AndCq: MethodCacheMask << ShiftForWord R: ClassReg.
self MoveMw: coInterpreter methodCacheAddress asUnsignedInteger + (MethodCacheSelector << ShiftForWord)
r: ClassReg
R: TempReg.
self annotate: (self CmpCw: selector R: TempReg) objRef: selector.
jumpSelectorMiss := self JumpNonZero: 0.
self MoveMw: coInterpreter methodCacheAddress asUnsignedInteger + (MethodCacheClass << ShiftForWord)
r: ClassReg
R: TempReg.
self CmpR: SendNumArgsReg R: TempReg.
jumpClassMiss := self JumpNonZero: 0.
itsAHit := self Label.
"Fetch the method. The interpret trampoline requires the bytecoded method in SendNumArgsReg"
self MoveMw: coInterpreter methodCacheAddress asUnsignedInteger + (MethodCacheMethod << ShiftForWord)
r: ClassReg
R: SendNumArgsReg.
"If the method is compiled jump to its unchecked entry-point, otherwise interpret it."
objectRepresentation
genLoadSlot: HeaderIndex sourceReg: SendNumArgsReg destReg: TempReg.
self MoveR: TempReg R: ClassReg.
jumpBCMethod := objectRepresentation genJumpSmallIntegerInScratchReg: TempReg.
jumpBCMethod jmpTarget: interpretLabel.
self AddCq: cmNoCheckEntryOffset R: ClassReg.
self JumpR: ClassReg.
"First probe missed. Do second of three probes. Shift hash right one and retry."
jumpSelectorMiss jmpTarget: (jumpClassMiss jmpTarget: self Label).
self MoveR: SendNumArgsReg R: ClassReg.
self annotate: (self XorCw: selector R: ClassReg) objRef: selector.
self LogicalShiftLeftCq: ShiftForWord - 1 R: ClassReg.
self AndCq: MethodCacheMask << ShiftForWord R: ClassReg.
self MoveMw: coInterpreter methodCacheAddress asUnsignedInteger + (MethodCacheSelector << ShiftForWord)
r: ClassReg
R: TempReg.
self annotate: (self CmpCw: selector R: TempReg) objRef: selector.
jumpSelectorMiss := self JumpNonZero: 0.
self MoveMw: coInterpreter methodCacheAddress asUnsignedInteger + (MethodCacheClass << 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.
self MoveR: SendNumArgsReg R: ClassReg.
self annotate: (self XorCw: selector R: ClassReg) objRef: selector.
ShiftForWord > 2 ifTrue:
[self LogicalShiftLeftCq: ShiftForWord - 1 R: ClassReg].
self AndCq: MethodCacheMask << ShiftForWord R: ClassReg.
self MoveMw: coInterpreter methodCacheAddress asUnsignedInteger + (MethodCacheSelector << ShiftForWord)
r: ClassReg
R: TempReg.
self annotate: (self CmpCw: selector R: TempReg) objRef: selector.
jumpSelectorMiss := self JumpNonZero: 0.
self MoveMw: coInterpreter methodCacheAddress asUnsignedInteger + (MethodCacheClass << ShiftForWord)
r: ClassReg
R: TempReg.
self CmpR: SendNumArgsReg R: TempReg.
self JumpZero: itsAHit.
"Last probe missed. Call ceSendFromInLineCacheMiss: to do the full lookup."
jumpSelectorMiss jmpTarget: self Label.
+ backEnd genSaveStackPointers.
+ backEnd genLoadCStackPointers.
- self genSaveStackPointers.
- self genLoadCStackPointers.
methodLabel addDependent: (self annotateAbsolutePCRef: (self MoveCw: methodLabel asInteger R: SendNumArgsReg)).
self
compileCallFor: #ceSendFromInLineCacheMiss:
numArgs: 1
arg: SendNumArgsReg
arg: nil
arg: nil
arg: nil
resultReg: nil
saveRegs: false
"Note that this call does not return."!
More information about the Vm-dev
mailing list