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

commits at source.squeak.org commits at source.squeak.org
Thu Sep 24 17:43:27 UTC 2015


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

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

Name: VMMaker.oscog-eem.1467
Author: eem
Time: 24 September 2015, 10:37:16.727 am
UUID: 79c4a282-1c32-4d20-a323-f931cdd7a05c
Ancestors: VMMaker.oscog-eem.1466

Slang:
Fix the NoDbgRegParams and NeverInline attributes.  These need to be emitted immediately before the function name, not after the parameter list.  After the parameter list was legal in older gcc's but as of about 4.7 or 4.8 gcc insists that funciton attributes preceed the name and are emitted both for forward declaration and definition.

Nuke the unused emitExportPragma code.

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

Item was changed:
  ----- Method: CCodeGenerator>>emitCFunctionPrototypes:on: (in category 'C code generator') -----
  emitCFunctionPrototypes: methodList on: aStream 
+ 	"Store prototype declarations for all non-inlined methods on the given stream.
+ 	 Add a define for a NoDbgRegParms attribute for static functions used for debugging.
- 	"Store prototype declarations for all non-inlined methods on the given stream."
- 	| exporting |
- 	aStream cr; nextPutAll: '/*** Function Prototypes ***/'; cr.
- 	"Add a define for a NoDbgRegParms attribute for static functions used for debugging.
  	 gcc and other compilers will use non-standard calling conventions for static functions
+ 	 when optimizing.  The optimization can render the functions unusable in gdb.  The sqConfig.h
+ 	 file for the platform should define PlatformNoDbgRegParms suitably for the platform's
+ 	 compiler, if the compiler can be persuaded not to generate such functions.
+ 	 Add a define for a NeverInline attribute that tells the compiler never to inline functions
- 	 when optimizing.  This can render the functions unusable in gdb.  The sqConfig.h file
- 	 for the platform should define PlatformNoDbgRegParms suitably for the platform's
- 	 compiler, if the compiler can be persuaded not to generate such functions."
- 	"Add a define for a NeverInline attribute that tells the compiler never to inline functions
  	 with the attribute.  We mark functions we want to observe in a profiler as NeverInline.
  	 The sqConfig.h file for the platform should define NeverInline suitably for the platform's
  	 compiler, if the compiler can be persuaded not to inline certain functions."
+ 	aStream cr; nextPutAll: '/*** Function Prototypes ***/'; cr.
+ 	vmClass ifNotNil:
- 	vmClass notNil ifTrue:
  		[NoRegParmsInAssertVMs ifTrue:
  			[aStream nextPutAll: '\\#if !!PRODUCTION && defined(PlatformNoDbgRegParms)\# define NoDbgRegParms PlatformNoDbgRegParms\#endif' withCRs.
  			 aStream nextPutAll: '\\#if !!defined(NoDbgRegParms)\# define NoDbgRegParms /*empty*/\#endif\\' withCRs].
  		 aStream nextPutAll: '\\#if !!defined(NeverInline)\# define NeverInline /*empty*/\#endif\\' withCRs].
+ 	(methodList select: [:m| m isRealMethod and: [self shouldGenerateMethod: m]]) do:
- 	exporting := false.
- 	(methodList select: [:m| m isRealMethod
- 							 and: [self shouldGenerateMethod: m]]) do:
  		[:m |
+ 		vmClass ifNotNil:
+ 			[(NoRegParmsInAssertVMs and: [m export not and: [m isStatic and: [m args notEmpty]]]) ifTrue:
+ 				[m addFunctionAttribute: 'NoDbgRegParms'].
+ 			 m inline == #never ifTrue:
+ 				[m addFunctionAttribute: 'NeverInline']].
- 		self emitExportPragma ifTrue:
- 			[m export
- 				ifTrue: [exporting ifFalse: 
- 							[aStream nextPutAll: '#pragma export on'; cr.
- 							exporting := true]]
- 				ifFalse: [exporting ifTrue: 
- 							[aStream nextPutAll: '#pragma export off'; cr.
- 							exporting := false]]].
  		m emitCFunctionPrototype: aStream generator: self.
- 		(NoRegParmsInAssertVMs and: [vmClass notNil and: [m export not and: [m isStatic and: [m args notEmpty]]]]) ifTrue:
- 			[aStream nextPutAll: ' NoDbgRegParms'].
- 		(vmClass notNil and: [m inline == #never]) ifTrue:
- 			[aStream nextPutAll: ' NeverInline'].
  		aStream nextPut: $; ; cr].
- 	exporting ifTrue: [aStream nextPutAll: '#pragma export off'; cr].
  	aStream cr!

Item was removed:
- ----- Method: CCodeGenerator>>emitExportPragma (in category 'C code generator') -----
- emitExportPragma
- 	"Controls emission of  #pragma export on / #pragma export off,
- 	 which is not relevant to any current platform that anyone could name."
- 	^[vmClass emitExportPragma]
- 		on: MessageNotUnderstood
- 		do: [:ex| false]!

Item was changed:
  Object subclass: #TMethod
+ 	instanceVariableNames: 'args comment complete declarations definingClass export extraVariableNumber globalStructureBuildMethodHasFoo inline labels locals parseTree primitive properties returnType selector sharedCase sharedLabel static writtenToGlobalVarsCache functionAttributes'
- 	instanceVariableNames: 'selector returnType args locals declarations primitive parseTree labels writtenToGlobalVarsCache complete export static inline sharedLabel sharedCase comment definingClass globalStructureBuildMethodHasFoo properties extraVariableNumber'
  	classVariableNames: 'CaseStatements'
  	poolDictionaries: ''
  	category: 'VMMaker-Translation to C'!

Item was added:
+ ----- Method: TMethod>>addFunctionAttribute: (in category 'accessing') -----
+ addFunctionAttribute: aString
+ 	functionAttributes := functionAttributes
+ 							ifNil: [aString]
+ 							ifNotNil: [functionAttributes, ' ', aString]!

Item was changed:
  ----- Method: TMethod>>emitCFunctionPrototype:generator:isPrototype: (in category 'C code generation') -----
  emitCFunctionPrototype: aStream generator: aCodeGen isPrototype: isPrototype "<Boolean>"
  	"Emit a C function header for this method onto the given stream."
  
  	export 
  		ifTrue:[aStream nextPutAll: 'EXPORT('; nextPutAll: returnType; nextPut: $)]
  		ifFalse:
  			[self isStatic
  				ifTrue: [aStream nextPutAll: 'static ']
  				ifFalse:
  					[isPrototype ifTrue:
  						[aStream nextPutAll: 'extern ']].
  			 (isPrototype or: [inline ~~ #always]) ifFalse: [aStream nextPutAll: 'inline '].
  			 aStream nextPutAll: returnType].
+ 	functionAttributes ifNotNil:
+ 		[aStream space; nextPutAll: functionAttributes].
  	isPrototype ifTrue: [aStream space] ifFalse: [aStream cr].
  	(returnType last = $)
  	and: [returnType includesSubString: (aCodeGen cFunctionNameFor: selector)]) ifTrue:
  		["Hack fix for e.g. <returnTypeC: 'void (*setInterruptCheckChain(void (*aFunction)(void)))()'>"
  		 ^self].
  	aStream
  		nextPutAll: (aCodeGen cFunctionNameFor: selector);
  		nextPut: $(.
  	args isEmpty
  		ifTrue: [aStream nextPutAll: #void]
  		ifFalse:
  			[args
  				do: [:arg| aStream nextPutAll: (self declarationAt: arg)]
  				separatedBy: [ aStream nextPutAll: ', ' ]].
  	aStream nextPut: $)!

Item was added:
+ ----- Method: TMethod>>functionAttributes (in category 'accessing') -----
+ functionAttributes
+ 	^functionAttributes!

Item was added:
+ ----- Method: TMethod>>functionAttributes: (in category 'accessing') -----
+ functionAttributes: aString
+ 	functionAttributes := aString!

Item was removed:
- ----- Method: VMClass class>>emitExportPragma (in category 'translation') -----
- emitExportPragma	
- 	"#pragma export -- seems only to have been for CodeWarrior on Mac."
- 	^false!



More information about the Vm-dev mailing list