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

commits at source.squeak.org commits at source.squeak.org
Sun Jun 26 21:44:30 UTC 2022


Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.3201.mcz

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

Name: VMMaker.oscog-eem.3201
Author: eem
Time: 26 June 2022, 2:44:14.120574 pm
UUID: eeca3935-f3e3-4c20-943f-14c88ff73857
Ancestors: VMMaker.oscog-eem.3200

Comment the hasMovableLiteral/cmHasMovableLiteral scheme.

=============== Diff against VMMaker.oscog-eem.3200 ===============

Item was changed:
  ----- Method: Cogit>>setHasMovableLiteral: (in category 'accessing') -----
  setHasMovableLiteral: boolean
+ 	"Record whether a method has a moveable literal.  This is for Spur to avoid a tead barrier on
+ 	 accessing literal variables. After a become (or GC) methods with the cmHasMovableLiteral flag
+ 	 set are scanned and any forwarded literals fixed up.  This means that any literal variable accessed
+ 	 in machine code can be accessed directly without a read barrier to check for a forwarder."
  	"Written this way to allow break-pointing in the simulator."
  	<cmacro: '(b) (hasMovableLiteral = (b))'>
+ 	hasMovableLiteral := boolean
+ 
+ 	"Should the cmHasMovableLiteral be set only for methods that access literal variables?
+ 	 Or should the unused flag bit be used for e.g. cmHasLiteralVariable.
+ 	 About 60% methods contain moveable literals ; only 15% of methods contain literal variables.
+ 	 So post-become machine code scanning might be 3x faster if cmHasMovableLiteral is more selective.
+ 	 Before doing this one would need to determine how much of become time goes into scanning machine code.
+ 	 Here's a couple of doits on methodZone that count methods referring to moveable literals or literal variables:
+ 	[| n |
+ 	n := 0.
+ 	self methodsDo: [:cm| (cm cmType ~= CMFree and: [cm cmHasMovableLiteral]) ifTrue: [n := n + 1]].
+ 	n. 2602 / 4126.0 = 0.631].
+ 	[| n m |
+ 	n := 0.
+ 	self methodsDo: [:cm| (cm cmType = CMMethod and: [cm cmHasMovableLiteral]) ifTrue: [m := cm methodObject.
+ 	((1 to: (objectMemory literalCountOf: m) - (cm cmUsesPenultimateLit ifTrue: [1] ifFalse: [2])) anySatisfy:
+ 		[:index| | lit |
+ 		lit := objectMemory fetchPointer: index ofObject: m.
+ 		(objectMemory isPointers: lit)
+ 		and: [(objectMemory isArray: lit) not]]) ifTrue:
+ 		[n := n + 1]]].
+ 	n. 647 / 4126.0 = 0.157]."!
- 	hasMovableLiteral := boolean!

Item was changed:
  ----- Method: SimpleStackBasedCogit>>genPushLiteralVariable: (in category 'bytecode generator support') -----
  genPushLiteralVariable: literalIndex
  	<inline: false>
+ 	"Note for Spur, please read the comment in Cogit>>#setHasMovableLiteral: for avoiding a forwarding check."
  	| association |
  	association := self getLiteral: literalIndex.
  	"If followed by a directed super send bytecode, avoid generating any code yet.
  	 The association will be passed to the directed send trampoline in a register
  	 and fully dereferenced only when first linked.  It will be ignored in later sends."
  	BytecodeSetHasDirectedSuperSend ifTrue:
  		[self deny: directedSendUsesBinding.
  		 self nextDescriptorExtensionsAndNextPCInto:
  			[:descriptor :exta :extb :followingPC|
  			(self isDirectedSuper: descriptor extA: exta extB: extb) ifTrue:
  				[tempOop := association.
  				 directedSendUsesBinding := true.
  				 ^0]]].
  	"N.B. Do _not_ use ReceiverResultReg to avoid overwriting receiver in assignment in frameless methods."
  	self genMoveConstant: association R: ClassReg.
  	objectRepresentation
  		genLoadSlot: ValueIndex
  		sourceReg: ClassReg
  		destReg: TempReg.
  	self PushR: TempReg.
  	^0!

Item was changed:
  ----- Method: SimpleStackBasedCogit>>genStorePop:LiteralVariable: (in category 'bytecode generator support') -----
  genStorePop: popBoolean LiteralVariable: litVarIndex
  	<inline: false>
+ 	"Note for Spur, please read the comment in Cogit>>#setHasMovableLiteral: for avoiding a forwarding check."
  	| association |
  	"The only reason we assert needsFrame here is that in a frameless method
  	 ReceiverResultReg must and does contain only self, but the ceStoreCheck
  	 trampoline expects the target of the store to be in ReceiverResultReg.  So
  	 in a frameless method we would have a conflict between the receiver and
  	 the literal store, unless we we smart enough to realise that ReceiverResultReg
  	 was unused after the literal variable store, unlikely given that methods
  	 return self by default."
  	self assert: needsFrame.
  	association := self getLiteral: litVarIndex.
  	self genMoveConstant: association R: ReceiverResultReg.
  	popBoolean
  		ifTrue: [self PopR: ClassReg]
  		ifFalse: [self MoveMw: 0 r: SPReg R: ClassReg].
  	self
  		genStoreSourceReg: ClassReg 
  		slotIndex: ValueIndex 
  		destReg: ReceiverResultReg 
  		scratchReg: TempReg 
  		inFrame: needsFrame.
  	^0!

Item was changed:
  ----- Method: StackToRegisterMappingCogit>>genStorePop:LiteralVariable: (in category 'bytecode generator stores') -----
  genStorePop: popBoolean LiteralVariable: litVarIndex
  	<inline: true>
+ 	"Note for Spur, please read the comment in Cogit>>#setHasMovableLiteral: for avoiding a forwarding check."
  	^self 
  		genStorePop: popBoolean 
  		LiteralVariable: litVarIndex 
  		needsStoreCheck: self ssTopNeedsStoreCheck
  		needsImmutabilityCheck: true "The generic store checks for IMMUTABILITY flag"
  		!



More information about the Vm-dev mailing list