[Vm-dev] VM Maker: VMMaker.oscog-eem.1753.mcz
commits at source.squeak.org
commits at source.squeak.org
Thu Mar 31 19:25:21 UTC 2016
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.1753.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.1753
Author: eem
Time: 1 January 1970, 12:22:37.951321 pm
UUID: c2577253-d843-4791-871d-f5e8ba2106b9
Ancestors: VMMaker.oscog-cb.1752
Make VMMaker.oscog-cb.1752's changes compilable.
Add a class var to hold the number of store trampolines; use 5 trampolines. Initialize the table for simulation in generateObjectRepresentationTrampolines.
Declare ceStoreTrampolines conditionally depending on IMMUTABILITY.
Avoid an extra register load in the store trampoline generator.
=============== Diff against VMMaker.oscog-cb.1752 ===============
Item was changed:
----- Method: CogObjectRepresentation class>>numTrampolines (in category 'accessing') -----
numTrampolines
+ ^1 "ceStoreCheckTrampoline"!
- ^1!
Item was changed:
CogObjectRepresentation subclass: #CogObjectRepresentationForSpur
instanceVariableNames: 'ceScheduleScavengeTrampoline ceSmallActiveContextInMethodTrampoline ceSmallActiveContextInBlockTrampoline ceLargeActiveContextInMethodTrampoline ceLargeActiveContextInBlockTrampoline ceStoreCheckContextReceiverTrampoline ceStoreTrampolines'
+ classVariableNames: 'NumStoreTrampolines'
- classVariableNames: ''
poolDictionaries: 'VMBytecodeConstants VMSqueakClassIndices'
category: 'VMMaker-JIT'!
Item was added:
+ ----- Method: CogObjectRepresentationForSpur class>>declareCVarsIn: (in category 'translation') -----
+ declareCVarsIn: aCodeGen
+ aCodeGen
+ var: #ceStoreTrampolines
+ declareC: ('#if IMMUTABILITY\sqInt ceStoreTrampolines[', NumStoreTrampolines printString, '];\#endif') withCRs!
Item was added:
+ ----- Method: CogObjectRepresentationForSpur class>>initialize (in category 'class initialization') -----
+ initialize
+ "Number of trampolines for the combined IMMUTABILITY/store check instance variable store.
+ Trampolines from 0 to NumStoreTrampolines - 2 are dedicated to an inst var index, the last one is generic."
+ NumStoreTrampolines := 5!
Item was changed:
----- Method: CogObjectRepresentationForSpur class>>numTrampolines (in category 'accessing') -----
numTrampolines
+ ^super numTrampolines
+ + 6 "(small,large)x(method,block) context creation, ceStoreCheckContextReceiverTrampoline and ceScheduleScavengeTrampoline"
+ + ((initializationOptions at: #IMMUTABILITY ifAbsent: [false])
+ ifTrue: [NumStoreTrampolines]
+ ifFalse: [0])!
- (initializationOptions at: #IMMUTABILITY ifAbsent: [false])
- ifTrue: [ ^ super numTrampolines + self new numStoreTrampolines + 7 ]
- ifFalse: [ ^ super numTrampolines + 6 ]!
Item was changed:
----- Method: CogObjectRepresentationForSpur>>genStoreTrampolineCall: (in category 'compile abstract instructions') -----
genStoreTrampolineCall: instVarIndex
<inline: true>
+ instVarIndex >= (NumStoreTrampolines - 1)
- instVarIndex < self numStoreTrampolines
- ifFalse:
- [ cogit MoveCq: instVarIndex R: TempReg.
- cogit CallRT: (ceStoreTrampolines at: self numStoreTrampolines) ]
ifTrue:
+ [ cogit MoveCq: instVarIndex R: TempReg.
+ cogit CallRT: (ceStoreTrampolines at: NumStoreTrampolines - 1) ]
+ ifFalse:
[ cogit CallRT: (ceStoreTrampolines at: instVarIndex) ].
cogit annotateBytecode: cogit Label!
Item was changed:
----- Method: CogObjectRepresentationForSpur>>genStoreTrampolineCalled:instVarIndex: (in category 'initialization') -----
genStoreTrampolineCalled: trampolineName instVarIndex: instVarIndex
"Convention:
- RcvrResultReg holds the object mutated.
If immutability failure:
- TempReg holds the instance variable index mutated
if instVarIndex > numDedicatedStoreTrampoline
- ClassReg holds the value to store
Registers are not lived across this trampoline as the
immutability failure may need new stack frames."
| jumpSC |
<option: #IMMUTABILITY>
<var: #trampolineName type: #'char *'>
<var: #jumpSC type: #'AbstractInstruction *'>
<inline: false>
cogit zeroOpcodeIndex.
+ "SendNumArgsReg is mutated but we don't care as register are not live across the trampoline.
+ There is no reason why registers cannot be saved over the remember: call, but since the
+ immutability check is a suspension point, registers cannot remain live."
+ jumpSC := self genJumpMutable: ReceiverResultReg scratchReg: SendNumArgsReg.
- jumpSC := self genJumpMutable: ReceiverResultReg scratchReg: SendNumArgsReg. "SendNumArgsReg is mutated but we don't care as register are not live across the trampoline"
- instVarIndex = self numStoreTrampolines
- ifFalse: [ cogit MoveCq: instVarIndex R: TempReg ].
cogit
compileTrampolineFor: #ceCannotAssignTo:withIndex:valueToAssign:
numArgs: 3
arg: ReceiverResultReg
+ arg: (instVarIndex < (NumStoreTrampolines - 1)
+ ifTrue: [cogit trampolineArgConstant: instVarIndex]
+ ifFalse: [TempReg])
- arg: TempReg
arg: ClassReg
arg: nil
regsToSave: cogit emptyRegisterMask
pushLinkReg: true
resultReg: NoReg.
"Store check"
jumpSC jmpTarget: cogit Label.
^ cogit genTrampolineFor: #remember:
called: trampolineName
numArgs: 1
arg: ReceiverResultReg
arg: nil
arg: nil
arg: nil
regsToSave: cogit emptyRegisterMask
pushLinkReg: true
resultReg: NoReg
appendOpcodes: true!
Item was changed:
----- Method: CogObjectRepresentationForSpur>>generateObjectRepresentationTrampolines (in category 'initialization') -----
generateObjectRepresentationTrampolines
"Do the store check. Answer the argument for the benefit of the code generator;
ReceiverResultReg may be caller-saved and hence smashed by this call. Answering
it allows the code generator to reload ReceiverResultReg cheaply.
In Spur the only thing we leave to the run-time is adding the receiver to the
remembered set and setting its isRemembered bit."
self
cppIf: IMMUTABILITY
ifTrue:
+ [self cCode: [] inSmalltalk:
+ [ceStoreTrampolines := CArrayAccessor on: (Array new: NumStoreTrampolines)].
+ 0 to: NumStoreTrampolines - 1 do:
+ [:instVarIndex |
+ ceStoreTrampolines
+ at: instVarIndex
+ put: (self
- [ 0 to: self numStoreTrampolines do:
- [ :instVarIndex |
- ceStoreTrampolines
- at: instVarIndex
- put: (self
genStoreTrampolineCalled: (cogit
+ trampolineName: 'ceStoreTrampoline'
+ numArgs: instVarIndex
+ limit: NumStoreTrampolines - 2)
+ instVarIndex: instVarIndex)]].
- trampolineName: 'ceStoreTrampoline'
- numArgs: instVarIndex
- limit: self numStoreTrampolines - 1)
- instVarIndex: instVarIndex ) ] ].
ceStoreCheckTrampoline := cogit
genTrampolineFor: #remember:
called: 'ceStoreCheckTrampoline'
arg: ReceiverResultReg
regsToSave: (cogit callerSavedRegMask bitClear: (cogit registerMaskFor: ReceiverResultReg))
result: cogit returnRegForStoreCheck.
ceStoreCheckContextReceiverTrampoline := self genStoreCheckContextReceiverTrampoline.
ceScheduleScavengeTrampoline := cogit
genTrampolineFor: #ceScheduleScavenge
called: 'ceScheduleScavengeTrampoline'
regsToSave: cogit callerSavedRegMask.
ceSmallActiveContextInMethodTrampoline := self genActiveContextTrampolineLarge: false inBlock: false called: 'ceSmallMethodContext'.
ceSmallActiveContextInBlockTrampoline := self genActiveContextTrampolineLarge: false inBlock: true called: 'ceSmallBlockContext'.
ceLargeActiveContextInMethodTrampoline := self genActiveContextTrampolineLarge: true inBlock: false called: 'ceLargeMethodContext'.
ceLargeActiveContextInBlockTrampoline := self genActiveContextTrampolineLarge: true inBlock: true called: 'ceLargeBlockContext'!
Item was removed:
- ----- Method: CogObjectRepresentationForSpur>>numStoreTrampolines (in category 'initialization') -----
- numStoreTrampolines
- "Number of trampolines for instance variable store. Trampolines from 0 to
- numStoreTrampoline - 1 are dedicated to an inst var index, the last one is generic.
-
- WARNING: Check the C declaration of ceStoreTrampolines if this number is increased."
- ^ 3!
Item was removed:
- ----- Method: CogObjectRepresentationForSpur>>setCogit:methodZone: (in category 'in-line cacheing') -----
- setCogit: aCogit methodZone: aMethodZone
- <doNotGenerate>
- super setCogit: aCogit methodZone: aMethodZone.
- ceStoreTrampolines := CArrayAccessor on: (Array new: self numStoreTrampolines + 1).!
Item was changed:
----- Method: StackToRegisterMappingCogit class>>declareCVarsIn: (in category 'translation') -----
declareCVarsIn: aCodeGen
aCodeGen
- var: #ceStoreTrampolines
- declareC: 'sqint ceStoreTrampolines[4]';
var: #methodAbortTrampolines
declareC: 'sqInt methodAbortTrampolines[4]';
var: #picAbortTrampolines
declareC: 'sqInt picAbortTrampolines[4]';
var: #picMissTrampolines
declareC: 'sqInt picMissTrampolines[4]';
var: 'ceCall0ArgsPIC'
declareC: 'void (*ceCall0ArgsPIC)(void)';
var: 'ceCall1ArgsPIC'
declareC: 'void (*ceCall1ArgsPIC)(void)';
var: 'ceCall2ArgsPIC'
declareC: 'void (*ceCall2ArgsPIC)(void)';
var: #ceCallCogCodePopReceiverArg0Regs
declareC: 'void (*ceCallCogCodePopReceiverArg0Regs)(void)';
var: #realCECallCogCodePopReceiverArg0Regs
declareC: 'void (*realCECallCogCodePopReceiverArg0Regs)(void)';
var: #ceCallCogCodePopReceiverArg1Arg0Regs
declareC: 'void (*ceCallCogCodePopReceiverArg1Arg0Regs)(void)';
var: #realCECallCogCodePopReceiverArg1Arg0Regs
declareC: 'void (*realCECallCogCodePopReceiverArg1Arg0Regs)(void)';
var: 'simStack'
declareC: 'CogSimStackEntry simStack[', ((CoInterpreter bindingOf: #LargeContextSlots) value * 5 // 4) asString, ']';
var: 'simSelf'
type: #CogSimStackEntry;
var: #optStatus
type: #CogSSOptStatus;
var: 'prevBCDescriptor'
type: #'BytecodeDescriptor *'.
self numPushNilsFunction ifNotNil:
[aCodeGen
var: 'numPushNilsFunction'
declareC: 'sqInt (* const numPushNilsFunction)(struct _BytecodeDescriptor *,sqInt,sqInt,sqInt) = ', (aCodeGen cFunctionNameFor: self numPushNilsFunction);
var: 'pushNilSizeFunction'
declareC: 'sqInt (* const pushNilSizeFunction)(sqInt,sqInt) = ', (aCodeGen cFunctionNameFor: self pushNilSizeFunction)].
aCodeGen
addSelectorTranslation: #register to: (aCodeGen cFunctionNameFor: 'registerr');
addSelectorTranslation: #register: to: (aCodeGen cFunctionNameFor: 'registerr:')!
More information about the Vm-dev
mailing list