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

commits at source.squeak.org commits at source.squeak.org
Sat Feb 13 21:03:23 UTC 2016


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

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

Name: VMMaker.oscog-eem.1678
Author: eem
Time: 13 February 2016, 1:01:06.083634 pm
UUID: 34356cdc-f0b4-47bc-a22d-60f6030890f9
Ancestors: VMMaker.oscog-eem.1677

The plugin export table also needs to use conditional inclusion of conditionally compiled functions.
Use cFunctionNameFor: in computing the function names for the export table.

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

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 excludeDepth |
+ 	(nilVMClass := vmClass isNil) ifTrue: "We need a vmClass temporarily to compute accessor depths."
- 	(nilVMClass := vmClass isNil) ifTrue:
  		[vmClass := StackInterpreter].
  	"Don't include the depth in the vm's named primitives if the vm is non-Spur."
  	excludeDepth := exportsNamePrefix = 'vm'
  					  and: [pluginName isEmpty
  					  and: [vmClass objectMemoryClass hasSpurMemoryManagerAPI not]].
+ 	aStream cr; cr; nextPutAll: 'void* '; nextPutAll: exportsNamePrefix; nextPutAll: '_exports[][3] = {'; cr.
+ 	((methods select: [:m| m export]) asSortedCollection: [:a :b| a selector < b selector]) do:
+ 		[:method| | compileTimeOptionPragmas primName |
+ 		(compileTimeOptionPragmas := method compileTimeOptionPragmas) notEmpty ifTrue:
+ 			[method outputConditionalDefineFor: compileTimeOptionPragmas on: aStream].
+ 		 primName := self cFunctionNameFor: method selector.
+ 		 aStream tab; nextPutAll: '{"'; nextPutAll: pluginName; nextPutAll: '", "'; nextPutAll: primName.
- 	aStream cr; cr; nextPutAll: 'void* '; nextPutAll: exportsNamePrefix; nextPutAll: '_exports[][3] = {'.
- 	(self sortStrings: self exportedPrimitiveNames) do:
- 		[:primName|
- 		 aStream cr; tab;
- 			nextPutAll: '{"'; 
- 			nextPutAll: pluginName; 
- 			nextPutAll: '", "'; 
- 			nextPutAll: primName.
  		 excludeDepth ifFalse:
  			[(self accessorDepthForSelector: primName asSymbol) ifNotNil:
  				[:depth| "store the accessor depth in a hidden byte immediately after the primName"
  				self assert: depth < 128.
  				aStream
  					nextPutAll: '\000\';
  					nextPutAll: ((depth bitAnd: 255) printStringBase: 8 nDigits: 3)]].
+ 		 aStream nextPutAll: '", (void*)'; nextPutAll: primName; nextPutAll: '},'; cr.
+ 		 method terminateConditionalDefineFor: compileTimeOptionPragmas on: aStream].
+ 	aStream tab; nextPutAll: '{NULL, NULL, NULL}'; cr; nextPutAll: '};'; cr.
- 		 aStream
- 			nextPutAll: '", (void*)'; 
- 			nextPutAll: primName;
- 			nextPutAll: '},'].
- 	aStream cr; tab; nextPutAll: '{NULL, NULL, NULL}'; cr; nextPutAll: '};'; cr.
  	nilVMClass ifTrue:
  		[vmClass := nil]!

Item was changed:
  ----- Method: CCodeGenerator>>exportedPrimitiveNames (in category 'public') -----
  exportedPrimitiveNames
  	"Return an array of all exported primitives"
+ 	^methods select:[:m| m export] thenCollect:[:m| self cFunctionNameFor: m selector].
- 	^methods select:[:m| m export] thenCollect:[:m| m selector copyWithout: $:].
  !



More information about the Vm-dev mailing list