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

commits at source.squeak.org commits at source.squeak.org
Mon Feb 20 17:57:20 UTC 2012


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

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

Name: VMMaker.oscog-eem.147
Author: eem
Time: 20 February 2012, 9:55:07.958 am
UUID: 9ebc4007-56c3-4a6d-8eec-a3de3e08a1fe
Ancestors: VMMaker.oscog-eem.146

Fix code egneration for the var: #bytecodeSetSelector declareC: '#define bytecodeSetSelector 0' hack hack.
Perhaps var: #bytecodeSetSelector declareC: 'const int bytecodeSetSelector = 0' is better?

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

Item was changed:
  ----- Method: CCodeGenerator>>emitCVariablesOn: (in category 'C code generator') -----
  emitCVariablesOn: aStream 
  	"Store the global variable declarations on the given stream."
  
  	aStream cr; nextPutAll: '/*** Variables ***/'; cr.
  	(self sortStrings: variables) do:
  		[:var | | varString decl |
  		varString := var asString.
  		decl := variableDeclarations at: varString ifAbsent: ['sqInt ' , varString].
+ 		decl first == $# "support cgen var: #bytecodeSetSelector declareC: '#define bytecodeSetSelector 0' hack"
- 		self isGeneratingPluginCode
  			ifTrue:
+ 				[aStream nextPutAll: decl; cr]
- 				[varString = 'interpreterProxy'
- 					ifTrue: ["quite special..."
- 						aStream cr; nextPutAll: '#ifdef SQUEAK_BUILTIN_PLUGIN'.
- 						aStream cr; nextPutAll: 'extern'.
- 						aStream cr; nextPutAll: '#endif'; cr]
- 					ifFalse: [(decl beginsWith: 'static') ifFalse:
- 								[aStream nextPutAll: 'static ']]]
  			ifFalse:
+ 				[self isGeneratingPluginCode
+ 					ifTrue:
+ 						[varString = 'interpreterProxy'
+ 							ifTrue: ["quite special..."
+ 								aStream cr; nextPutAll: '#ifdef SQUEAK_BUILTIN_PLUGIN'.
+ 								aStream cr; nextPutAll: 'extern'.
+ 								aStream cr; nextPutAll: '#endif'; cr]
+ 							ifFalse: [(decl beginsWith: 'static') ifFalse:
+ 										[aStream nextPutAll: 'static ']]]
+ 					ifFalse:
+ 						[(vmClass mustBeGlobal: varString) ifFalse:
+ 							[(decl beginsWith: 'static') ifFalse:
+ 								[aStream nextPutAll: 'static ']]].
+ 				aStream
+ 					nextPutAll: decl;
+ 					nextPut: $;;
+ 					cr]].
- 				[(vmClass mustBeGlobal: varString) ifFalse:
- 					[(decl beginsWith: 'static') ifFalse:
- 						[aStream nextPutAll: 'static ']]].
- 		aStream
- 			nextPutAll: decl;
- 			nextPut: $;;
- 			cr].
  	aStream cr!

Item was changed:
  ----- Method: CCodeGeneratorGlobalStructure>>emitCVariablesOn: (in category 'C code generator') -----
  emitCVariablesOn: aStream
  	"Store the global variable declarations on the given stream.
+ 	 Break logic into vars for structure and vars for non-structure."
- 	break logic into vars for structure and vars for non-structure"
  	| structure nonstruct |
  
  	structure := WriteStream on: (String new: 32768).
  	nonstruct := WriteStream on: (String new: 32768).
  	aStream nextPutAll: '/*** Variables ***/'; cr.
  	structure
  		nextPutAll: '#if SQ_USE_GLOBAL_STRUCT'; cr;
  		nextPutAll: '# define _iss /* define in-struct static as void */'; cr;
  		nextPutAll: 'static struct foo {'; cr;
  		nextPutAll: '#else'; cr;
  		nextPutAll: '# define _iss static'; cr;
  		nextPutAll: '#endif'; cr.
  	self buildSortedVariablesCollection do:
+ 		[ :var | | decl varString inStruct target |
- 		[ :var | | varString inStruct target |
  		target := (inStruct := self placeInStructure: (varString := var asString)) 
  					ifTrue: [structure]
  					ifFalse: [nonstruct].
+ 		decl := variableDeclarations at: varString ifAbsent: ['sqInt ' , varString].
+ 		decl first == $# "support cgen var: #bytecodeSetSelector declareC: '#define bytecodeSetSelector 0' hack"
- 		self isGeneratingPluginCode
  			ifTrue:
+ 				[target nextPutAll: decl; cr]
- 				[varString = 'interpreterProxy'
- 					ifTrue: ["quite special..."
- 						target cr; nextPutAll: '#ifdef SQUEAK_BUILTIN_PLUGIN'.
- 						target cr; nextPutAll: 'extern'.
- 						target cr; nextPutAll: '#endif'; cr]
- 					ifFalse: [target nextPutAll: 'static ']]
  			ifFalse:
+ 				[self isGeneratingPluginCode
+ 					ifTrue:
+ 						[varString = 'interpreterProxy'
+ 							ifTrue: ["quite special..."
+ 								target cr; nextPutAll: '#ifdef SQUEAK_BUILTIN_PLUGIN'.
+ 								target cr; nextPutAll: 'extern'.
+ 								target cr; nextPutAll: '#endif'; cr]
+ 							ifFalse: [target nextPutAll: 'static ']]
+ 					ifFalse:
+ 						[(vmClass mustBeGlobal: varString) ifFalse:
+ 							[target nextPutAll: (inStruct ifTrue: ['_iss '] ifFalse: ['static '])]].
+ 				target nextPutAll: decl; nextPut: $;; cr]].
- 				[(vmClass mustBeGlobal: varString) ifFalse:
- 					[target nextPutAll: (inStruct ifTrue: ['_iss '] ifFalse: ['static '])]].
- 		target
- 			nextPutAll: (variableDeclarations at: varString ifAbsent: ['sqInt ' , varString]);
- 			nextPut: $;;
- 			cr].
  	structure
  		nextPutAll: '#undef _iss'; cr;
  		nextPutAll: '#if SQ_USE_GLOBAL_STRUCT'; cr;
  		nextPutAll: ' } fum;'; cr;
  		nextPutAll: '# define DECL_MAYBE_SQ_GLOBAL_STRUCT register struct foo * foo = &fum;'; cr;
  		nextPutAll: '# define DECL_MAYBE_VOLATILE_SQ_GLOBAL_STRUCT volatile register struct foo * foo = &fum;'; cr;
  		nextPutAll: '# define GIV(interpreterInstVar) (foo->interpreterInstVar)'; cr;
  		nextPutAll: '#else'; cr;
  		nextPutAll: '# define DECL_MAYBE_SQ_GLOBAL_STRUCT /* oh, no mr bill!! */'; cr;
  		nextPutAll: '# define DECL_MAYBE_VOLATILE_SQ_GLOBAL_STRUCT /* oh no, mr bill!! */'; cr;
  		nextPutAll: '# define GIV(interpreterInstVar) interpreterInstVar'; cr;
  		nextPutAll: '#endif'; cr.
  
  	"if the machine needs the fum structure defining locally, do it now"
  	localStructDef ifTrue:
  		[structure
  			nextPutAll: '#if SQ_USE_GLOBAL_STRUCT'; cr;
  			nextPutAll: 'static struct foo * foo = &fum;'; cr;
  			nextPutAll: '#endif'; cr].
  
  	aStream
  		nextPutAll: structure contents;
  		nextPutAll: nonstruct contents;
  		cr!



More information about the Vm-dev mailing list