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

commits at source.squeak.org commits at source.squeak.org
Tue Jul 26 21:18:35 UTC 2022


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

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

Name: VMMaker.oscog-eem.3223
Author: eem
Time: 26 July 2022, 2:18:20.973227 pm
UUID: 26a1e5de-8a04-4964-8ecf-aaa2c3a3c3d5
Ancestors: VMMaker.oscog-eem.3222

Fix primitiveSocketListenWithOrWithoutBacklog not having its accessor depth computed.

Add a breakpoint to the accessorDepth calculation.  This pointsa to the Slang selector breakpoints needing to be properly typed, e.g.
    (breakpoints
		at: aTMethodSelector
		ifPresent: [:coll| coll includes: #accessorDepth]
		ifAbsent: [false]) 
etc

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

Item was changed:
  ----- Method: CCodeGenerator>>accessorDepthForMethod: (in category 'spur primitive compilation') -----
  accessorDepthForMethod: method "TMethod"
  	"Compute the depth the method traverses object structure, assuming it is a primitive.
  	 This is in support of Spur's lazy become.  A primitive may fail in argument validation
  	 because it encounters a forwarder.  The primitive failure code needs to know to what
  	 depth it must follow arguments to find forwarders, so that if any are found, they can
  	 be followed and the primitive retried.
  
  	 This method determines that depth. It starts by collecting references to the stack and
  	 then follows these through assignments to variables and use of accessor methods
  	 such as fetchPointer:ofObject:. For example
  		| obj field  |
  		obj := self stackTop.
  		field := objectMemory fetchPointer: 1 ofObject: obj.
  		self storePointer: 1 ofObject: field withValue: (self stackValue: 1)
  	has depth 2, since field is accessed, and field is an element of obj.
  
  	The information is cached since it needs to be computed *before* inlining."
  	^accessorDepthCache
  		at: method smalltalkSelector
  		ifAbsentPut:
+ 			[self maybeBreakForTestToInline: method smalltalkSelector in: method.
+ 			 beganInlining
- 			[beganInlining
  				ifTrue:
  					[(method export
  					 or: [vmClass notNil or: [vmClass primitiveTable includes: method smalltalkSelector]])
  						ifTrue: [-1]
  						ifFalse: [self error: 'it is too late to compute accessor depths!!']]
  				ifFalse:
  					 [((method definingClass includesSelector: method smalltalkSelector) ifTrue:
  							[(method definingClass >> method smalltalkSelector) pragmaAt: #accessorDepth:])
  						ifNotNil: [:pragma| pragma arguments first]
  						ifNil:
  							["Deal with clichés of the form
  									primitiveFoo
  										objectMemory hasSpurMemoryManagerAPI
  											ifTrue: [self primitiveFooSpur]
  											ifFalse: [self primitiveFooV3]
  							  and
  									primitiveFoo
  										interpreterProxy methodArgumentCount = M
  											ifTrue: [self primitiveFooM]
  											ifFalse: [self primitiveFooN]
  							 etc..."
  							method
  								isIfThenElseClicheGiven: self
  								IfTrue:
  									[:ifTrueCliche :ifFalseCliche|
  									method extractSpurPrimitiveSelector
  										ifNotNil:
  											[:actualSelector| | subMethod |
  											(subMethod := self methodNamed: actualSelector) ifNil:
  												[subMethod := self compileToTMethodSelector: actualSelector in: method definingClass].
  											self accessorDepthForMethod: subMethod]
  										ifNil:
  											[(self accessorDepthForMethod: (self methodNamed: ifTrueCliche))
  												max: (self accessorDepthForMethod: (self methodNamed: ifFalseCliche))]]
  								ifFalse:
  									[self accessorDepthForMethod: method interpreterClass: (vmClass ifNil: [StackInterpreter])]]]]!

Item was changed:
  ----- Method: CCodeGenerator>>exportsNeedingMetadata (in category 'spur primitive compilation') -----
  exportsNeedingMetadata
+ 	^self sortedExportMethods select: [:m| self methodNeedsMetadata: m]!
- 	^self sortedExportMethods reject:
- 		[:m| | selector |
- 		selector := m smalltalkSelector.
- 		selector = #initialiseModule
- 		or: [(InterpreterPlugin includesSelector: selector)
- 		or: [vmClass notNil and: [(selector beginsWith: 'prim') not]]]]!

Item was added:
+ ----- Method: CCodeGenerator>>methodNeedsMetadata: (in category 'spur primitive compilation') -----
+ methodNeedsMetadata: aTMethod
+ 	"Answer if aTMethod really needs primitive metadata.  This is a hack to filter out some functions that definitely don't need metadata."
+ 	| selector |
+ 	selector := aTMethod smalltalkSelector.
+ 	(#(initialiseModule shutdownModule moduleUnloaded:) includes: selector) ifTrue:
+ 		[^false].
+ 	(InterpreterPlugin includesSelector: selector) ifTrue:
+ 		[^false].
+ 	vmClass ifNotNil:
+ 		[(selector beginsWith: 'prim') ifFalse:
+ 			[^false]].
+ 	^true
+ 
+ !

Item was added:
+ ----- Method: SmartSyntaxPluginTMethod>>prepareMethodIn: (in category 'transformations') -----
+ prepareMethodIn: aCodeGen
+ 	"Override to ensure accessor depth is calculated for plugin primitives."
+ 	super prepareMethodIn: aCodeGen.
+ 	(self export
+ 	 and: [aCodeGen methodNeedsMetadata: self]) ifTrue:
+ 		[aCodeGen accessorDepthForMethod: self]!



More information about the Vm-dev mailing list