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

commits at source.squeak.org commits at source.squeak.org
Tue Sep 21 22:50:02 UTC 2021


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

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

Name: VMMaker.oscog-eem.3073
Author: eem
Time: 21 September 2021, 3:49:51.890577 pm
UUID: 6bfb9c9c-6408-4232-9ea0-6822f0924498
Ancestors: VMMaker.oscog-eem.3072

Slang: add mechanism for an internal plugin to include additional exports, hence allowing the functions in sqFFITestFunctions.c to be exported from SqueakFFIPrims when compiled as an internal plugin.

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

Item was added:
+ ----- Method: CCodeGenerator>>additionalExportsIncludeFileName (in category 'C code generator') -----
+ additionalExportsIncludeFileName
+ 	^nil!

Item was changed:
  ----- Method: CCodeGenerator>>emitExportsNamed:pluginName:on: (in category 'C code generator') -----
  emitExportsNamed: exportsNamePrefix pluginName: pluginName on: aStream
  	"Store all the exported primitives in the form used by the internal named prim system."
  	| nilVMClass excludeMetadata exportsNeedingMetadata |
  	(nilVMClass := vmClass isNil) ifTrue: "We need a vmClass temporarily to compute accessor depths."
  		[vmClass := StackInterpreter].
  	"Don't include the depth in the vm's named primitives if the vm is non-Spur."
  	excludeMetadata := exportsNamePrefix = 'vm'
  					  and: [pluginName isEmpty
  					  and: [vmClass objectMemoryClass hasSpurMemoryManagerAPI not]].
  	aStream cr; cr; nextPutAll: 'static char _m[] = "'; nextPutAll: pluginName; nextPutAll: '";'.
  	aStream cr; nextPutAll: 'void* '; nextPutAll: exportsNamePrefix; nextPutAll: '_exports[][3] = {'; cr.
  	exportsNeedingMetadata := self exportsNeedingMetadata.
  	self sortedExportMethods do:
  		[:method|
  		self withOptionalConditionalDefineFor: method
  			on: aStream
  			do: [| primName depth exportFlags |
  				 primName := self cFunctionNameFor: method selector.
  				 aStream tab; nextPutAll: '{(void*)_m, "'; nextPutAll: primName.
  				 (excludeMetadata not and: [exportsNeedingMetadata includes: method]) ifTrue:
  					[depth := self accessorDepthForMethod: method.
  					 exportFlags := CoInterpreter metadataFlagsForPrimitive: method compiledMethod.
  					 (depth notNil or: [exportFlags > 0]) ifTrue:
  						"store the metadata in two hidden bytes immediately after the primName"
  						[self assert: depth < 128.
  						 aStream
  							nextPutAll: '\000\';
  							nextPutAll: ((depth bitAnd: 255) printStringBase: 8 nDigits: 3);
  							nextPut: $\;
  							nextPutAll: ((exportFlags bitAnd: 255) printStringBase: 8 nDigits: 3)]].
  				 aStream nextPutAll: '", (void*)'; nextPutAll: primName; nextPutAll: '},'; cr]].
+ 	self additionalExportsIncludeFileName ifNotNil:
+ 		[:aeifn|  aStream nextPutAll: '#include "'; nextPutAll: aeifn; nextPut: $"; cr].
  	aStream tab; nextPutAll: '{NULL, NULL, NULL}'; cr; nextPutAll: '};'; cr.
  	nilVMClass ifTrue:
  		[vmClass := nil]!

Item was added:
+ ----- Method: InterpreterPlugin class>>additionalExportsIncludeFileName (in category 'translation') -----
+ additionalExportsIncludeFileName
+ 	^nil!

Item was added:
+ ----- Method: ThreadedFFIPlugin class>>additionalExportsIncludeFileName (in category 'translation') -----
+ additionalExportsIncludeFileName
+ 	"If the ThreadedFFIPlugin is compiled as an internal plugin then it must export the test functions explicitly."
+ 	^'sqFFITestFuncExports.h'!

Item was added:
+ ----- Method: VMPluginCodeGenerator>>additionalExportsIncludeFileName (in category 'C code generator') -----
+ additionalExportsIncludeFileName
+ 	^pluginClass additionalExportsIncludeFileName!



More information about the Vm-dev mailing list