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

commits at source.squeak.org commits at source.squeak.org
Sun Feb 20 02:01:00 UTC 2022


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

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

Name: VMMaker.oscog-eem.3162
Author: eem
Time: 19 February 2022, 6:00:50.097188 pm
UUID: 1c2eddce-e2ba-44a3-852a-8dc1efc56310
Ancestors: VMMaker.oscog-eem.3161

Slang: ...and fix the regression in cogit.h's contents using a hammer.

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

Item was removed:
- ----- Method: CCodeGenerator>>emitCAPIExportHeaderOn: (in category 'C code generator') -----
- emitCAPIExportHeaderOn: aStream 
- 	"Store prototype declarations for all API methods on the given stream."
- 	| exportedAPIMethods usedConstants |
- 	exportedAPIMethods := self sortMethods: (methods select: [:m| m isAPIMethod]).
- 	exportedAPIMethods do:
- 		[:m|
- 		m static ifTrue:
- 			[logger ensureCr; show: m selector, ' excluded from export API because it is static'; cr]].
- 	exportedAPIMethods := exportedAPIMethods reject: [:m| m static].
- 	self emitCFunctionPrototypes: exportedAPIMethods on: aStream.
- 	self emitGlobalCVariablesOn: aStream.
- 	usedConstants := self emitCMacros: exportedAPIMethods on: aStream.	
- 	(vmClass notNil and: [vmClass hasCogit]) ifTrue:
- 		[usedConstants addAll: self commonSharedPoolVariableNames].
- 	self emitCConstants: usedConstants on: aStream!

Item was added:
+ ----- Method: CCodeGenerator>>emitCAPIExportHeaderOn:includePoolDefines: (in category 'C code generator') -----
+ emitCAPIExportHeaderOn: aStream includePoolDefines: includePoolDefines
+ 	"Store prototype declarations for all API methods on the given stream."
+ 	| exportedAPIMethods usedConstants |
+ 	exportedAPIMethods := self sortMethods: (methods select: [:m| m isAPIMethod]).
+ 	exportedAPIMethods do:
+ 		[:m|
+ 		m static ifTrue:
+ 			[logger ensureCr; show: m selector, ' excluded from export API because it is static'; cr]].
+ 	exportedAPIMethods := exportedAPIMethods reject: [:m| m static].
+ 	self emitCFunctionPrototypes: exportedAPIMethods on: aStream.
+ 	self emitGlobalCVariablesOn: aStream.
+ 	usedConstants := self emitCMacros: exportedAPIMethods on: aStream.	
+ 	(vmClass notNil and: [vmClass hasCogit and: [includePoolDefines]]) ifTrue:
+ 		[usedConstants addAll: self commonSharedPoolVariableNames].
+ 	self emitCConstants: usedConstants on: aStream!

Item was removed:
- ----- Method: CCodeGenerator>>storeAPIExportHeader:OnFile: (in category 'public') -----
- storeAPIExportHeader: headerName OnFile: fullHeaderPath
- 	"Store C header code on the given file. Evaluate
- 	 aBlock with the stream to generate its contents."
- 
- 	| header |
- 	header := String streamContents:
- 				[:s|
- 				 s nextPutAll: (self fileHeaderVersionStampForSourceClass: nil); cr.
- 				 self emitCAPIExportHeaderOn: s].
- 	(self needToGenerateHeader: headerName file: fullHeaderPath contents: header) ifTrue:
- 		[self storeHeaderOnFile: fullHeaderPath contents: header]!

Item was added:
+ ----- Method: CCodeGenerator>>storeAPIExportHeader:OnFile:includePoolDefines: (in category 'public') -----
+ storeAPIExportHeader: headerName OnFile: fullHeaderPath includePoolDefines: includePoolDefines
+ 	"Store C header code on the given file. Evaluate
+ 	 aBlock with the stream to generate its contents."
+ 
+ 	| header |
+ 	header := String streamContents:
+ 				[:s|
+ 				 s nextPutAll: (self fileHeaderVersionStampForSourceClass: nil); cr.
+ 				 self emitCAPIExportHeaderOn: s includePoolDefines: includePoolDefines].
+ 	(self needToGenerateHeader: headerName file: fullHeaderPath contents: header) ifTrue:
+ 		[self storeHeaderOnFile: fullHeaderPath contents: header]!

Item was changed:
  ----- Method: VMMaker>>generateCogitFiles (in category 'generate sources') -----
  generateCogitFiles
  	"Translate the Smalltalk description of the virtual machine's JITs into C."
  	| cogitClass cg |
  	(cogitClass := self interpreterClass cogitClass) ifNil: [^nil].
  	self generateCogitIncludeFileFor: cogitClass.
  	cogitClass translateableInstructionSubclassesAndInstalledOptionsDo:
  		[:compilerClass|
  		cg := self generateCogitFileFor: cogitClass].
  	cg vmClass additionalHeadersDo:
  		[:headerName :headerContents| | filePath |
  		 filePath := self coreVMDirectory fullNameFor: headerName.
  		 (cg needToGenerateHeader: headerName file: filePath contents: headerContents) ifTrue:
  			 [cg storeHeaderOnFile: filePath contents: headerContents]].
  	cogitClass apiExportHeaderName ifNotNil:
  		[cg storeAPIExportHeader: cogitClass apiExportHeaderName
+ 			OnFile: (self sourceFilePathFor: cogitClass apiExportHeaderName)
+ 			includePoolDefines: false]!
- 			OnFile: (self sourceFilePathFor: cogitClass apiExportHeaderName)]!

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)
+ 			includePoolDefines: true].
- 			OnFile: (self sourceFilePathFor: self interpreterClass apiExportHeaderName)].
  	(cg methodNamed: #interpret) ifNotNil:
  		[self gnuifyInterpreterFile].
  	self maybeGenerateVariableOrderFiles: cg!



More information about the Vm-dev mailing list