[Vm-dev] VM Maker: VMMaker.oscog-eem.821.mcz
commits at source.squeak.org
commits at source.squeak.org
Tue Jul 15 23:41:04 UTC 2014
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.821.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.821
Author: eem
Time: 15 July 2014, 4:37:19.192 pm
UUID: a5ed6e52-7e25-4c02-878b-8de8dceeac7b
Ancestors: VMMaker.oscog-eem.820
Add support for not inlining in gcc under optimization (for
profiling). Sort out the backward jump variables now we've
fixed global variable determination.
=============== Diff against VMMaker.oscog-eem.820 ===============
Item was changed:
----- Method: CCodeGenerator>>emitCFunctionPrototypes:on: (in category 'C code generator') -----
emitCFunctionPrototypes: methodList on: aStream
"Store prototype declarations for all non-inlined methods on the given stream."
| exporting |
aStream cr; nextPutAll: '/*** Function Prototypes ***/'; cr.
"Hmm, this should be in the sqConfig.h files. For now put it here..."
+ "Feel free to add equivalents for other compilers"
+ vmClass notNil ifTrue:
+ [NoRegParmsInAssertVMs ifTrue:
+ [aStream nextPutAll: '\\#if !!PRODUCTION && defined(__GNUC__) && !!defined(NoDbgRegParms)\# define NoDbgRegParms __attribute__ ((regparm (0)))\#endif' withCRs.
+ aStream nextPutAll: '\\#if !!defined(NoDbgRegParms)\# define NoDbgRegParms /*empty*/\#endif\\' withCRs].
+ aStream nextPutAll: '\\#if defined(__GNUC__) && !!defined(NeverInline)\# define NeverInline __attribute__ ((noinline))\#endif' withCRs.
+ aStream nextPutAll: '\\#if !!defined(NeverInline)\# define NeverInline /*empty*/\#endif\\' withCRs].
- (NoRegParmsInAssertVMs and: [vmClass notNil]) ifTrue:
- [aStream cr; cr; nextPutAll: '#if defined(PRODUCTION) && !!PRODUCTION && defined(__GNUC__) && !!defined(NoDbgRegParms)\# define NoDbgRegParms __attribute__ ((regparm (0)))\#endif' withCRs.
- aStream cr; cr; nextPutAll: '#if !!defined(NoDbgRegParms)\# define NoDbgRegParms /*empty*/\#endif' withCRs.
- aStream cr; cr].
exporting := false.
(methodList select: [:m| m isRealMethod]) do:
[:m |
self emitExportPragma ifTrue:
[m export
ifTrue: [exporting ifFalse:
[aStream nextPutAll: '#pragma export on'; cr.
exporting := true]]
ifFalse: [exporting ifTrue:
[aStream nextPutAll: '#pragma export off'; cr.
exporting := false]]].
m emitCFunctionPrototype: aStream generator: self.
(NoRegParmsInAssertVMs and: [vmClass notNil and: [m export not and: [m isStatic and: [m args notEmpty]]]]) ifTrue:
[aStream nextPutAll: ' NoDbgRegParms'].
+ (vmClass notNil and: [m inline == #never]) ifTrue:
+ [aStream nextPutAll: ' NeverInline'].
aStream nextPut: $; ; cr].
exporting ifTrue: [aStream nextPutAll: '#pragma export off'; cr].
aStream cr!
Item was changed:
----- Method: CoInterpreter>>attemptToSwitchToMachineCode: (in category 'jump bytecodes') -----
attemptToSwitchToMachineCode: bcpc
| cogMethod pc |
+ <inline: false>
- <inline: #false>
<var: #cogMethod type: #'CogMethod *'>
(self methodHasCogMethod: method) ifFalse:
[cogit cog: method selector: objectMemory nilObject].
(self methodHasCogMethod: method) ifTrue:
[cogMethod := self cogMethodOf: method.
pc := self convertToMachineCodeFrame: cogMethod bcpc: bcpc.
self assertValidMachineCodeFrame: pc.
self push: pc.
self push: objectMemory nilObject.
cogit ceEnterCogCodePopReceiverReg]!
Item was changed:
----- Method: CoInterpreter>>ifBackwardsCheckForEvents: (in category 'jump bytecodes') -----
ifBackwardsCheckForEvents: offset
"Backward jump means we're in a loop.
- check for possible interrupts.
- check for long-running loops and JIT if appropriate."
| switched |
<inline: true>
offset < 0 ifTrue:
[localSP < stackLimit ifTrue:
[self externalizeIPandSP.
switched := self checkForEventsMayContextSwitch: true.
self returnToExecutive: true postContextSwitch: switched.
self browserPluginReturnIfNeeded.
self internalizeIPandSP].
method = lastBackwardJumpMethod
ifTrue:
[(backwardJumpCount := backwardJumpCount - 1) <= 0 ifTrue:
[(self methodWithHeaderShouldBeCogged: (self headerOf: method))
ifTrue:
[self externalizeFPandSP.
- self resetBackwardJumpVariables. "only to force variables to be global"
self attemptToSwitchToMachineCode: (self oopForPointer: localIP) - offset - method - BaseHeaderSize - 1]
ifFalse: "don't ask if one should compile a second time..."
[backwardJumpCount := 1 << (BytesPerWord * 8 - 2)]]]
ifFalse:
[lastBackwardJumpMethod := method.
backwardJumpCount := minBackwardJumpCountForCompile]]!
Item was added:
+ ----- Method: CoInterpreter>>initialize (in category 'initialization') -----
+ initialize
+ super initialize.
+ "Assign to these two to avoid them being inlined into #interpret"
+ lastBackwardJumpMethod := backwardJumpCount := 0!
Item was removed:
- ----- Method: CoInterpreter>>resetBackwardJumpVariables (in category 'jump bytecodes') -----
- resetBackwardJumpVariables
- "Reference these variables from outside interpret to avoid them being localised to interpret.
- Oh the hacks we commit for Slang..."
- <cmacro: '() /* nada */'>
- <inline: #false>
- lastBackwardJumpMethod := lastBackwardJumpMethod.
- backwardJumpCount := backwardJumpCount!
Item was changed:
Object subclass: #TMethod
+ instanceVariableNames: 'selector returnType args locals declarations primitive parseTree labels writtenToGlobalVarsCache complete export static inline sharedLabel sharedCase comment definingClass globalStructureBuildMethodHasFoo canAsmLabel mustAsmLabel properties extraVariableNumber'
- instanceVariableNames: 'selector returnType args locals declarations primitive parseTree labels writtenToGlobalVarsCache complete export static sharedLabel sharedCase comment definingClass globalStructureBuildMethodHasFoo canAsmLabel mustAsmLabel properties extraVariableNumber'
classVariableNames: 'CaseStatements'
poolDictionaries: ''
category: 'VMMaker-Translation to C'!
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:
- "Scan the top-level statements for an inlining directive of the form:
+ <inline: <boolean|#never|#dontCare|#asSpecified>
- self inline: <boolean>
+ Answer a boolean equivalent to the argument of the directive or #dontCare if there is no inlining directive."
- and remove the directive from the method body. Return 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| (inline := sendNode args first value) = true]
- valueBlock: [:sendNode| sendNode args first value = true]
default: #dontCare!
Item was added:
+ ----- Method: TMethod>>inline (in category 'accessing') -----
+ inline
+ ^inline!
More information about the Vm-dev
mailing list