[Vm-dev] VM Maker: VMMaker.oscog-eem.1059.mcz
commits at source.squeak.org
commits at source.squeak.org
Thu Feb 12 18:50:18 UTC 2015
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.1059.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.1059
Author: eem
Time: 12 February 2015, 10:48:44.246 am
UUID: 3ab35d11-5ea9-4f1c-b47e-97c792c7a98f
Ancestors: VMMaker.oscog-eem.1058
Add support for <inline: #always> to mark the
generated function as inline for use when Slang
can't inline (it currently doesn't inline multi-
statement functions in conditionals).
=============== Diff against VMMaker.oscog-eem.1058 ===============
Item was changed:
----- Method: Spur64BitMemoryManager>>isSmallFloatZero: (in category 'interpreter access') -----
isSmallFloatZero: aSmallFloat
+ <inline: #always>
- <inline: true>
self assert: (self isImmediateFloat: aSmallFloat).
^aSmallFloat asUnsignedInteger <= self negativeSmallFloatZero!
Item was changed:
----- Method: TMethod>>emitCCodeOn:generator: (in category 'C code generation') -----
emitCCodeOn: aStream generator: aCodeGen
"Emit C code for this method onto the given stream.
All calls to inlined methods should already have been expanded."
aCodeGen currentMethod: self.
self emitCCommentOn: aStream. "place method comment before function"
aStream cr.
+ self emitCFunctionPrototype: aStream generator: aCodeGen isPrototype: false.
- self emitCFunctionPrototype: aStream generator: aCodeGen newlineBeforeName: true.
aStream cr; nextPut: ${.
self emitCLocalsOn: aStream generator: aCodeGen.
aCodeGen
pushScope: declarations
while: [parseTree emitCCodeOn: aStream level: 1 generator: aCodeGen].
aStream nextPut: $}; cr!
Item was changed:
----- Method: TMethod>>emitCFunctionPrototype:generator: (in category 'C code generation') -----
emitCFunctionPrototype: aStream generator: aCodeGen
"Emit a C function header for this method onto the given stream."
properties ifNotNil:
[(properties at: #api: ifAbsent: []) ifNotNil:
[:pragma|
aStream nextPutAll: (pragma argumentAt: 1).
^self]].
+ self emitCFunctionPrototype: aStream generator: aCodeGen isPrototype: true!
- self emitCFunctionPrototype: aStream generator: aCodeGen newlineBeforeName: false!
Item was added:
+ ----- Method: TMethod>>emitCFunctionPrototype:generator:isPrototype: (in category 'C code generation') -----
+ emitCFunctionPrototype: aStream generator: aCodeGen isPrototype: isPrototype "<Boolean>"
+ "Emit a C function header for this method onto the given stream."
+
+ export
+ ifTrue:[aStream nextPutAll: 'EXPORT('; nextPutAll: returnType; nextPut: $)]
+ ifFalse:
+ [self isStatic ifTrue:[aStream nextPutAll: 'static '].
+ (isPrototype or: [inline ~~ #always]) ifFalse: [aStream nextPutAll: 'inline '].
+ aStream nextPutAll: returnType].
+ isPrototype ifTrue: [aStream space] ifFalse: [aStream cr].
+ (returnType last = $)
+ and: [returnType includesSubString: (aCodeGen cFunctionNameFor: selector)]) ifTrue:
+ ["Hack fix for e.g. <returnTypeC: 'void (*setInterruptCheckChain(void (*aFunction)(void)))()'>"
+ ^self].
+ aStream
+ nextPutAll: (aCodeGen cFunctionNameFor: selector);
+ nextPut: $(.
+ args isEmpty
+ ifTrue: [aStream nextPutAll: #void]
+ ifFalse:
+ [args
+ do: [:arg| aStream nextPutAll: (self declarationAt: arg)]
+ separatedBy: [ aStream nextPutAll: ', ' ]].
+ aStream nextPut: $)!
Item was removed:
- ----- Method: TMethod>>emitCFunctionPrototype:generator:newlineBeforeName: (in category 'C code generation') -----
- emitCFunctionPrototype: aStream generator: aCodeGen newlineBeforeName: newlineBeforeName "<Boolean>"
- "Emit a C function header for this method onto the given stream."
-
- export
- ifTrue:[aStream nextPutAll: 'EXPORT('; nextPutAll: returnType; nextPut: $)]
- ifFalse:[self isStatic ifTrue:[aStream nextPutAll: 'static '].
- aStream nextPutAll: returnType].
- newlineBeforeName ifTrue: [aStream cr] ifFalse: [aStream space].
- (returnType last = $)
- and: [returnType includesSubString: (aCodeGen cFunctionNameFor: selector)]) ifTrue:
- ["Hack fix for e.g. <returnTypeC: 'void (*setInterruptCheckChain(void (*aFunction)(void)))()'>"
- ^self].
- aStream
- nextPutAll: (aCodeGen cFunctionNameFor: selector);
- nextPut: $(.
- args isEmpty
- ifTrue: [aStream nextPutAll: #void]
- ifFalse:
- [args
- do: [:arg| aStream nextPutAll: (self declarationAt: arg)]
- separatedBy: [ aStream nextPutAll: ', ' ]].
- aStream nextPut: $)!
Item was changed:
----- Method: TMethod>>extractInlineDirective (in category 'inlining support') -----
extractInlineDirective
"Scan the pragmas (or top-level statements) for an inlining directive of the form:
+ <inline: <boolean|#never|#dontCare|#asSpecified|#always>
- <inline: <boolean|#never|#dontCare|#asSpecified>
Answer a boolean equivalent to the argument of the directive or #dontCare if there is no inlining directive."
sharedCase ifNotNil: [^false]. "don't auto-inline shared code; it gets handled specially"
^self
extractDirective: #inline:
valueBlock:
+ [:sendNode| #(true always) includes: (inline := sendNode args first value)]
- [:sendNode| (inline := sendNode args first value) = true]
default: #dontCare!
More information about the Vm-dev
mailing list