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

commits at source.squeak.org commits at source.squeak.org
Thu Jul 8 18:13:17 UTC 2021


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

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

Name: VMMaker.oscog-eem.2982
Author: eem
Time: 8 July 2021, 11:13:08.369309 am
UUID: 0b4d8d13-650d-4001-9ddc-d2232c9eb605
Ancestors: VMMaker.oscog-eem.2981

Generate a variable order file of variables accessed by the JIT (potentially via VarBaseReg) to guide linkers in clustering these variables (close to the var base).

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

Item was changed:
  ----- Method: CoInterpreter class>>clusteredVariableNames (in category 'translation') -----
  clusteredVariableNames
  	"Insist that these variables are present early in the list of variables, and in this order,
  	 so that e.g. they are conveniently accessed via the VarBaseReg if it is available."
  	^#(stackLimitFromMachineCode "ensures zero offset in simulation" stackLimit "stackLimit is e.g. lowest using the clang toolchain on MacOS X"
  		stackPointer framePointer CStackPointer CFramePointer CReturnAddress
  		scavengeThreshold freeStart needGCFlag specialObjectsOop
+ 		primFailCode primTraceLogIndex primitiveFunctionPointer
+ 		newMethod instructionPointer argumentCount nextProfileTick
+ 		nativeSP nativeStackPointer shadowCallStackPointer
+ 		primTraceLog "should be last because it is large") "reject: [:n| self allInstVarNames includes: n]"!
- 		primFailCode newMethod instructionPointer argumentCount nextProfileTick
- 		nativeSP nativeStackPointer shadowCallStackPointer)!

Item was added:
+ ----- Method: CoInterpreterMT class>>clusteredVariableNames (in category 'translation') -----
+ clusteredVariableNames
+ 	"Insist that these variables are present early in the list of variables, and in this order,
+ 	 so that e.g. they are conveniently accessed via the VarBaseReg if it is available."
+ 	^#(vmOwner), super clusteredVariableNames "reject: [:n| self allInstVarNames includes: n]"!

Item was changed:
  ----- Method: VMMaker>>generateInterpreterFile (in category 'generate sources') -----
  generateInterpreterFile
  	"Translate the Smalltalk description of the virtual machine into C.  If 'self doInlining' is true, small method bodies are inlined to reduce procedure call overhead.  On the PPC, this results in a factor of three speedup with only 30% increase in code size.  Subclasses can use specialised versions of CCodeGenerator and interpreterClass."
  
  	| cg vmHeaderContents |
  	cg := [self buildCodeGeneratorForInterpreter]
  			on: Notification
  			do: [:ex|
  				ex tag == #getVMMaker
  					ifTrue: [ex resume: self]
  					ifFalse: [(ex respondsTo: #rearmHandlerDuring:)
  								ifTrue: [ex rearmHandlerDuring: [ex pass]]
  								ifFalse: [ex pass]]].
  	self reinitializeWordSizeFrom: cg.
  
  	self interpreterClass additionalHeadersDo:
  		[:headerName :headerContents| | filePath |
  		 filePath := self coreVMDirectory fullNameFor: headerName.
  		 (cg needToGenerateHeader: headerName file: filePath contents: headerContents) ifTrue:
  			 [cg storeHeaderOnFile: filePath contents: headerContents]].
  
  	self needsToRegenerateInterpreterFile ifFalse: [^nil].
  
  	cg inferTypesForImplicitlyTypedVariablesAndMethods.
  
  	self interpreterClass preGenerationHook: cg.
  	vmHeaderContents := cg vmHeaderContentsWithBytesPerWord: self wordSize.
  	(cg needToGenerateHeader: self interpreterHeaderName file: self interpreterHeaderPath contents: vmHeaderContents) ifTrue:
  		[cg storeHeaderOnFile: self interpreterHeaderPath contents: vmHeaderContents].
  	cg storeCodeOnFile: (self sourceFilePathFor: self interpreterClass sourceFileName) doInlining: self doInlining.
  	self interpreterClass apiExportHeaderName ifNotNil:
  		[cg storeAPIExportHeader: self interpreterClass apiExportHeaderName
  			OnFile: (self sourceFilePathFor: self interpreterClass apiExportHeaderName)].
  	(cg methodNamed: #interpret) ifNotNil:
+ 		[self gnuifyInterpreterFile].
+ 	self maybeGenerateVariableOrderFiles: cg!
- 		[self gnuifyInterpreterFile]!

Item was added:
+ ----- Method: VMMaker>>maybeGenerateVariableOrderFiles: (in category 'generate sources') -----
+ maybeGenerateVariableOrderFiles: cg
+ 	| order |
+ 	(self interpreterClass respondsTo: #clusteredVariableNames) ifFalse: [^self].
+ 	"First find the longest order. These files can contain false positives.
+ 	 So e.g. it's preferrable to generate the list for CoInterpreterMT
+ 	 instead of two lists, one each for CoInterpreterMT and CoInterpreter."
+ 	order := self interpreterClass allSubclasses
+ 				inject: self interpreterClass clusteredVariableNames
+ 				into: [:o :sc| sc clusteredVariableNames size > o size ifTrue: [sc clusteredVariableNames] ifFalse: [o]].
+ 	"now generate versions for the different symbol formats in use."
+ 	#('variable_order' '_variable_order')
+ 		with: #(nil $_)
+ 		do: [:file :prefix| | contents filePath |
+ 			contents := String streamContents:
+ 							[:s|
+ 							order do:
+ 								[:name| prefix ifNotNil: [s nextPut: prefix]. s nextPutAll: name; cr]].
+ 			filePath := self coreVMDirectory fullNameFor: file.
+ 			(cg needToGenerateHeader: file file: filePath contents: contents) ifTrue:
+ 				[(self class forceNewFileNamed: filePath)
+ 					nextPutAll: contents;
+ 					close]]!



More information about the Vm-dev mailing list