[Vm-dev] VM Maker: VMMaker-dtl.382.mcz

commits at source.squeak.org commits at source.squeak.org
Sun May 1 14:38:04 UTC 2016


David T. Lewis uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker-dtl.382.mcz

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

Name: VMMaker-dtl.382
Author: dtl
Time: 1 May 2016, 10:11:22.991 am
UUID: c8058d87-c626-4cc5-ad9f-8469e42cd043
Ancestors: VMMaker-dtl.381

VMMaker 4.15.6

Fix export declarations for primitives, and remove the now unnecessary type cast in #primitiveTableString.

The problem was caused by return types being set in TMethods prior to all primitives having been added to the code generator. Move the TMethod return type settings up to InterpreterPrimitives. Issue had been masked by the type casts in primitiveTableString.

=============== Diff against VMMaker-dtl.381 ===============

Item was changed:
  ----- Method: ContextInterpreter class>>declareCVarsIn: (in category 'translation') -----
  declareCVarsIn: aCCodeGenerator 
  	aCCodeGenerator addHeaderFile: '<setjmp.h>'.
  	aCCodeGenerator var: #interpreterProxy type: #'struct VirtualMachine*'.
  	"declare primitiveTable as an array of pointers to a function returning void, taking no arguments"
  	aCCodeGenerator var: #primitiveFunctionPointer declareC: 'void (*primitiveFunctionPointer)(void)'.
- 	"keep this matching the declaration for primitiveTable"
- 	self primitiveTable do:
- 		[:symbolOrNot|
- 		(symbolOrNot isSymbol
- 		 and: [symbolOrNot ~~ #primitiveFail]) ifTrue:
- 			[(aCCodeGenerator methodNamed: symbolOrNot) ifNotNil:
- 				[:tMethod| tMethod returnType: #void]]].
- 	"make sure al the primitves are declared returning void"
  	aCCodeGenerator var: #methodCache declareC: 'long methodCache[' , (MethodCacheSize + 1) printString , ']'.
  	aCCodeGenerator var: #atCache declareC: 'sqInt atCache[' , (AtCacheTotalSize + 1) printString , ']'.
  	aCCodeGenerator var: #statGCTime type: #sqLong.
  	aCCodeGenerator var: #statFullGCMSecs type: #sqLong.
  	aCCodeGenerator var: #statIGCDeltaTime type: #sqLong.
  	aCCodeGenerator var: #statIncrGCMSecs type: #sqLong.
  	aCCodeGenerator var: #localIP type: #'char*'.
  	aCCodeGenerator var: #localSP type: #'char*'.
  	aCCodeGenerator var: #showSurfaceFn type: #'void*'.
  	aCCodeGenerator var: 'semaphoresToSignalA' declareC: 'sqInt semaphoresToSignalA[' , (SemaphoresToSignalSize + 1) printString , ']'.
  	aCCodeGenerator var: 'semaphoresToSignalB' declareC: 'sqInt semaphoresToSignalB[' , (SemaphoresToSignalSize + 1) printString , ']'.
  	aCCodeGenerator var: #compilerHooks declareC: 'sqInt (*compilerHooks[' , (CompilerHooksSize + 1) printString , '])()'.
  	aCCodeGenerator var: #interpreterVersion declareC: 'const char *interpreterVersion = "' , SmalltalkImage current datedVersion , ' [' , SmalltalkImage current lastUpdateString , ']"'.
  	self declareCAsOop: {#instructionPointer. #method. #newMethod. #activeContext. #theHomeContext. #stackPointer} in: aCCodeGenerator.
  	aCCodeGenerator var: #jmpBuf declareC: 'jmp_buf jmpBuf[' , (MaxJumpBuf + 1) printString , ']'.
  	aCCodeGenerator var: #suspendedCallbacks declareC: 'sqInt suspendedCallbacks[' , (MaxJumpBuf + 1) printString , ']'.
  	aCCodeGenerator var: #suspendedMethods declareC: 'sqInt suspendedMethods[' , (MaxJumpBuf + 1) printString , ']'.
  	"Reinitialized at interpreter entry by #initializeImageFormatVersion"
  	aCCodeGenerator var: #imageFormatVersionNumber declareC: 'sqInt imageFormatVersionNumber = 0'.
  	"Declared here to prevent inclusion in foo struct by
  	CCodeGeneratorGlobalStructure"
  	aCCodeGenerator var: #imageFormatInitialVersion declareC: 'sqInt imageFormatInitialVersion = 0'!

Item was changed:
  ----- Method: ContextInterpreter class>>primitiveTableString (in category 'initialization') -----
  primitiveTableString
  	"Interpreter initializePrimitiveTable primitiveTableString"
  	| table |
  	table := self primitiveTable.
  	^ String
  		streamContents: [:s | 
  			s nextPut: ${.
  			table
  				withIndexDo: [:primSpec :index | s cr; tab;
  					nextPutAll: '/* ';
  					nextPutAll: (index - 1) printString;
  					nextPutAll: '*/ ';
- 					nextPutAll: '(void (*)(void))'; "keep this matching the declaration of primitiveTable in Interpreter class>declareCVarsIn:"
  					nextPutAll: primSpec;
  					nextPut: $,].
  			s cr; nextPutAll: ' 0 }']!

Item was added:
+ ----- Method: InterpreterPrimitives class>>declareCVarsIn: (in category 'translation') -----
+ declareCVarsIn: aCCodeGenerator
+ 	"Return types for primitives referenced in primitiveTable must be properly declared as
+ 	functions returning void. Ideally these should be declared with returnTypeC: pragmas
+ 	in the primitive implementations, but for convenience the (possibly missing) declarations
+ 	are overridden here."
+ 
+ 	self primitiveTable do:
+ 		[:symbolOrNot|
+ 		(symbolOrNot isSymbol
+ 		 and: [symbolOrNot ~~ #primitiveFail]) ifTrue:
+ 			[(aCCodeGenerator methodNamed: symbolOrNot) ifNotNil:
+ 				[:tMethod| tMethod returnType: #void]]].
+ !

Item was changed:
  ----- Method: VMMaker class>>versionString (in category 'version testing') -----
  versionString
  
  	"VMMaker versionString"
  
+ 	^'4.15.6'!
- 	^'4.15.5'!



More information about the Vm-dev mailing list