'From Squeak2.7alpha of 8 December 1999 [latest update: #1698] on 3 January 2000 at 10:30:53 pm'! "Change Set: ForceInline-JMM Date: 3 January 2000 Author: John M McIntosh This change enables one to force inlining of a method. In many places the success: method is used, but the inline logic decides it's not safe to inline the argument due to use of a global or other restriction. This means the argument is evaluated then assigned to a temp, then & with successFlag and the result assigned to successFlag. This requires an extra variable and assignment and of course the success: method is used a lot. The isForcedInline: aTargetMeth method allows you to override the decision and force inlining of arguments. Currently success: is choosen, other perhaps are #storePointer:ofObject;withValue: #makePointwithxValue:yValue: #push: #jump: I have built a VM with these candidates, but more testing and review is required before commiting them as safe choices."! !CCodeGenerator methodsFor: 'inlining' stamp: 'JMM 1/3/2000 22:14'! isForcedInline: aTargetMeth "JMM Jan 2000, added to allow forced inline calls" "Other perhaps are #storePointer:ofObject;withValue: #makePointwithxValue:yValue: #push: #jump:" ^#(#success: ) includes: aTargetMeth selector. ! ! !TMethod methodsFor: 'inlining' stamp: 'jmm 1/3/2000 13:17'! isSubstitutableNode: aNode intoMethod: targetMeth in: aCodeGen "Answer true if the given parameter node is either a constant, a local variable, or a formal parameter of the receiver. Such parameter nodes may be substituted directly into the body of the method during inlining. Note that global variables cannot be subsituted into methods with possible side effects (i.e., methods that may assign to global variables) because the inlined method might depend on having the value of the global variable captured when it is passed in as an argument. JMM Jan 2000, Add forced inline check" | var | aNode isConstant ifTrue: [ ^ true ]. aNode isVariable ifTrue: [ var _ aNode name. ((locals includes: var) or: [args includes: var]) ifTrue: [ ^ true ]. (#(self true false nil) includes: var) ifTrue: [ ^ true ]. (targetMeth maySubstituteGlobal: var in: aCodeGen) ifTrue: [ ^ true ]. ]. "scan expression tree; must contain only constants, builtin ops, and inlineable vars" aNode nodesDo: [ :node | node isSend ifTrue: [ node isBuiltinOperator ifFalse: [^aCodeGen isForcedInline: targetMeth]. ]. node isVariable ifTrue: [ var _ node name. ((locals includes: var) or: [(args includes: var) or: [(#(self true false nil) includes: var) or: [targetMeth maySubstituteGlobal: var in: aCodeGen]]]) ifFalse: [^aCodeGen isForcedInline: targetMeth]. ]. (node isConstant or: [node isVariable or: [node isSend]]) ifFalse: [^aCodeGen isForcedInline: targetMeth]. ]. ^ true! !