[Vm-dev] VM Maker: VMMaker.oscog-eem.1726.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Mar 14 19:53:02 UTC 2016

Eliot Miranda uploaded a new version of VMMaker to project VM Maker:

==================== Summary ====================

Name: VMMaker.oscog-eem.1726
Author: eem
Time: 14 March 2016, 11:51:18.700159 am
UUID: 6a968923-b541-4573-bc4f-64fb95e6462d
Ancestors: VMMaker.oscog-EstebanLorenzano.1725

Fix nasty regression in picData:'s populate:withPICInfoFor:firstCacheTag: from Tim's new Closed PIC organization (mea culpa).

Fix slip in Sista mustBeBoolean/counter-tripped trampoline generation that only shows up in simulation but would byte in the C VM.  We can't use putSelfInReceiverResultReg when generating trampolines because simSelf has not yet been initialized.

=============== Diff against VMMaker.oscog-EstebanLorenzano.1725 ===============

Item was changed:
  ----- Method: SistaStackToRegisterMappingCogit>>genMustBeBooleanTrampolineFor:called: (in category 'initialization') -----
  genMustBeBooleanTrampolineFor: boolean called: trampolineName
  	"This can be entered in one of two states, depending on SendNumArgsReg. See
  	 e.g. genJumpIf:to:.  If SendNumArgsReg is non-zero then this has been entered via
  	 the initial test of the counter in the jump executed count (i.e. the counter has
  	 tripped).  In this case TempReg contains the boolean to be tested and should not
  	 be offset, and ceCounterTripped should be invoked with the unoffset TempReg.
  	 If SendNumArgsReg is zero then this has been entered for must-be-boolean
  	 processing. TempReg has been offset by boolean and must be corrected and
  	 ceSendMustBeBoolean: invoked with the corrected value."
  	<var: #trampolineName type: #'char *'>
  	| jumpMBB |
  	<var: #jumpMBB type: #'AbstractInstruction *'>
  	<inline: false>
  	self zeroOpcodeIndex.
  	self CmpCq: 0 R: SendNumArgsReg.
  	jumpMBB := self JumpZero: 0.
  	"Open-code self compileTrampolineFor: #ceCounterTripped: numArgs: 1 arg: TempReg ...
  	 so we can restore ResultReceiverReg."
  	self genSmalltalkToCStackSwitch: true.
  		compileCallFor: #ceCounterTripped:
  		numArgs: 1
  		arg: TempReg
  		arg: nil
  		arg: nil
  		arg: nil
  		resultReg: TempReg "(*)"
  		regsToSave: self emptyRegisterMask.
  	"(*) For the case where the ceCounterTripped: call returns (e.g. because there's no callback selector
  	 installed), the call to the ceSendMustBeBooleanAddTrue/FalseTrampoline is followed by a jump
  	 back to the start of the counter/condition test sequence.  For this case copy the C result to
  	 TempReg (the register that is tested), to reload it with the boolean to be tested."
  	backEnd genLoadStackPointers.
  	backEnd hasLinkRegister ifTrue:
  		[self PopR: LinkReg].
  	"To keep ResultReceiverReg live if optStatus thought it was, simply reload it
  	 from the frame pointer.  This avoids having to reload it in the common case
+ 	 (counter does not trip) if it was live.  Note we can't use putSelfInReceiverResultReg
+ 	 when generating trampolines because simSelf has not yet been initialized."
+ 	self MoveMw: FoxMFReceiver r: FPReg R: ReceiverResultReg.
- 	 (counter does not trip) if it was live."
- 	self putSelfInReceiverResultReg.
  	self RetN: 0.
  	"If the objectRepresentation does want true & false to be mobile then we need to record these addresses."
  	self assert: (objectRepresentation shouldAnnotateObjectReference: boolean) not.
  	jumpMBB jmpTarget: (self AddCq: boolean R: TempReg).
  	^self genTrampolineFor: #ceSendMustBeBoolean:
  		called: trampolineName
  		numArgs: 1
  		arg: TempReg
  		arg: nil
  		arg: nil
  		arg: nil
  		regsToSave: self emptyRegisterMask
  		pushLinkReg: true
  		resultReg: NoReg
  		appendOpcodes: true!

Item was changed:
  ----- Method: SistaStackToRegisterMappingCogit>>populate:withPICInfoFor:firstCacheTag: (in category 'method introspection') -----
  populate: tuple withPICInfoFor: cPIC firstCacheTag: firstCacheTag
  	"Populate tuple (which must be large enough) with the ClosedPIC's target method class pairs.
  	 The first entry in tuple contains the bytecode pc for the send, so skip the tuple's first field."
  	<var: #cPIC type: #'CogMethod *'>
  	| pc cacheTag classOop entryPoint targetMethod value |
  	<var: #targetMethod type: #'CogMethod *'>
  	1 to: cPIC cPICNumCases do:
  		pc := self addressOfEndOfCase: i inCPIC: cPIC.
  		cacheTag := i = 1
  						ifTrue: [firstCacheTag]
+ 						ifFalse: [backEnd literalBeforeFollowingAddress: pc - backEnd jumpLongConditionalByteSize].
- 						ifFalse: [backEnd literalBeforeFollowingAddress: pc
- 																		- backEnd jumpLongConditionalByteSize
- 																		- backEnd loadLiteralByteSize].
  		classOop := objectRepresentation classForInlineCacheTag: cacheTag.
  		objectMemory storePointer: i * 2 - 1 ofObject: tuple withValue: classOop.
  		entryPoint := i = 1
  						ifTrue: [backEnd jumpLongTargetBeforeFollowingAddress: pc]
  						ifFalse: [backEnd jumpLongConditionalTargetBeforeFollowingAddress: pc].
  		"Find target from jump.  A jump to the MNU entry-point should collect #doesNotUnderstand:"
  		(cPIC containsAddress: entryPoint)
  				[value := objectMemory splObj: SelectorDoesNotUnderstand]
  				[targetMethod := self cCoerceSimple: entryPoint - cmNoCheckEntryOffset to: #'CogMethod *'.
  				 self assert: targetMethod cmType = CMMethod.
  				 value := targetMethod methodObject].
  		objectMemory storePointer: i * 2 ofObject: tuple withValue: value]!

More information about the Vm-dev mailing list