[Vm-dev] VM Maker: VMMaker.oscog-eem.2305.mcz
commits at source.squeak.org
commits at source.squeak.org
Wed Jan 3 23:43:55 UTC 2018
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.2305.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.2305
Author: eem
Time: 3 January 2018, 3:43:22.401651 pm
UUID: 53846f73-e426-46b6-9fad-ff6de733cee5
Ancestors: VMMaker.oscog-eem.2304
Slang for Plugins
Make sure the comparison of types of the reference implementation and the declarative implementation in InterpreterProxy is made once types have been assigned.
Consequently fix the return type of InterpreterProxy>>positive32BitIntegerFor:
=============== Diff against VMMaker.oscog-eem.2304 ===============
Item was changed:
----- Method: InterpreterProxy>>positive32BitIntegerFor: (in category 'converting') -----
positive32BitIntegerFor: integerValue
+ <returnTypeC: #sqInt>
<var: 'integerValue' type: #'unsigned int'>
integerValue isInteger ifFalse:[self error:'Not an Integer object'].
^integerValue > 0
ifTrue:[integerValue]
ifFalse:[ (1 bitShift: 32) + integerValue]!
Item was changed:
----- Method: VMPluginCodeGenerator>>preDeclareInterpreterProxyOn: (in category 'C code generator') -----
preDeclareInterpreterProxyOn: aStream
"Put the necessary #defines needed before interpreterProxy. Basically
internal plugins use the VM's interpreterProxy variable and external plugins
use their own. Override to keep local copies of all functions in external
prims, and link directly in internal plugins."
"| pcc |
pcc := self new.
(InterpreterProxy selectors reject: [:s| #(initialize private) includes: (InterpreterProxy whichCategoryIncludesSelector: s)]) do:
[:s| pcc noteUsedPluginFunction: s].
pcc preDeclareInterpreterProxyOn: Transcript.
Transcript flush"
| pluginFuncs interpreterClass objectMemoryClass |
self notePluginFunctionsUsedByMacros.
(pluginFuncs := self pluginFunctionsToClone) isEmpty ifTrue:
[^super preDeclareInterpreterProxyOn: aStream].
(pluginFuncs includesAnyOf: self selectorsThatAreGeneratedAsMacros) ifTrue:
[self preDeclareMacrosForFastClassCheckingOn: aStream].
pluginFuncs := pluginFuncs copyWithoutAll: self selectorsThatAreGeneratedAsMacros.
pluginFuncs isEmpty ifTrue:
[^self].
- aStream cr; nextPutAll: '#if !!defined(SQUEAK_BUILTIN_PLUGIN)'; cr.
interpreterClass := self referenceInterpreterClass.
objectMemoryClass := self referenceObjectMemoryClass.
pluginFuncs := pluginFuncs collect:
[:selector| | reference actual |
reference := self compileToTMethodSelector: selector
in: ((interpreterClass whichClassIncludesSelector: selector) ifNil:
[(objectMemoryClass whichClassIncludesSelector: selector) ifNil:
[InterpreterProxy]]).
actual := self compileToTMethodSelector: selector in: InterpreterProxy.
+ { actual. reference } do:
+ [:tMethod|
+ tMethod recordDeclarationsIn: self.
+ tMethod returnType ifNil:
+ [tMethod inferReturnTypeIn: self]].
(reference returnType ~= actual returnType
or: [(1 to: reference args size) anySatisfy:
[:i| (reference typeFor: (reference args at: i) in: self)
~= (actual typeFor: (actual args at: i) in: self)]]) ifTrue:
[self logger
nextPutAll: 'warning, signature of InterpreterProxy>>';
nextPutAll: selector;
nextPutAll: ' does not match reference implementation.';
cr].
actual].
+ aStream cr; nextPutAll: '#if !!defined(SQUEAK_BUILTIN_PLUGIN)'; cr.
pluginFuncs do:
- [:tMethod|
- tMethod recordDeclarationsIn: self.
- tMethod returnType ifNil:
- [tMethod inferReturnTypeIn: self]].
- pluginFuncs do:
[:tMethod| | functionName |
functionName := self cFunctionNameFor: tMethod selector.
aStream nextPutAll:
((String streamContents:
[:s|
tMethod
static: true;
emitCFunctionPrototype: s generator: self])
copyReplaceAll: functionName
with: '(*', functionName, ')'
tokenish: [:ch| ch = $_ or: [ch isAlphaNumeric]])].
aStream nextPutAll: '#else /* !!defined(SQUEAK_BUILTIN_PLUGIN) */'; cr.
pluginFuncs do:
[:tMethod|
self withGuardAgainstDefinitionOf: tMethod selector on: aStream do:
[self withOptionalVerbiageFor: tMethod selector
on: aStream
do: [tMethod static: false; export: false; emitCFunctionPrototype: aStream generator: self]
ifOptionalDo:
[aStream nextPutAll: '# define '.
(TSendNode new
setSelector: tMethod selector
receiver: (TVariableNode new setName: 'interpreterProxy')
arguments: (tMethod args collect: [:a| TVariableNode new setName: a]))
emitCCodeAsArgumentOn: aStream
level: 0
generator: self.
aStream nextPutAll: ' 0'; cr]]].
aStream nextPutAll: 'extern'; cr; nextPutAll: '#endif'; cr!
More information about the Vm-dev
mailing list