Eliot Miranda uploaded a new version of Kernel to project The Trunk: http://source.squeak.org/trunk/Kernel-eem.1486.mcz
==================== Summary ====================
Name: Kernel-eem.1486 Author: eem Time: 5 July 2022, 4:08:05.255241 pm UUID: a9406e26-5f92-40fe-a876-a151252043e1 Ancestors: Kernel-eem.1485
Slightly faster implementations of CompiledMethod>>reads/writesField:. SImilarly neater CompiledCode>>sendsToSuper. Corrected CompiledCode>>hasMethodReturn; needs Compiler-eem.479
=============== Diff against Kernel-eem.1485 ===============
Item was changed: ----- Method: CompiledCode>>hasMethodReturn (in category 'testing') ----- hasMethodReturn "Answer whether the receiver has a method-return ('^') in its code."
+ self codeLiteralsDo: [:compiledCode | | scanner | - | scanner | - self codeLiteralsDo: [:compiledCode | scanner := InstructionStream on: compiledCode. + (scanner scanFor: + [:x | + scanner willReturn + and: [scanner willBlockReturn not + "ignore any final ^self in the home method" + and: [compiledCode isCompiledBlock + or: [(compiledCode encoderClass isReturnSelfFromMethodAt: scanner pc in: compiledCode) + ifTrue: [scanner pc < compiledCode endPC] + ifFalse: [true]]]]]) - (scanner scanFor: [:x | (scanner willReturn - and: [scanner willBlockReturn not]) - "and: [scanner willReturnTopFromMethod not]" "-> Not supported in EncoderForSistaV1"]) ifTrue: [^ true]]. ^ false!
Item was changed: ----- Method: CompiledCode>>sendsToSuper (in category 'testing') ----- sendsToSuper "Answer whether the receiver sends any message to super."
+ self codeLiteralsDo: + [:compiledCode | | scanner | - | scanner | - self codeLiteralsDo: [:compiledCode | scanner := InstructionStream on: compiledCode. + (scanner scanFor: (self encoderClass superSendScanBlockUsing: scanner)) ifTrue: + [^ true]]. - (scanner scanFor: (self encoderClass superSendScanBlockUsing: scanner)) - ifTrue: [^ true]]. ^ false!
Item was changed: ----- Method: CompiledMethod>>readsField: (in category 'scanning') ----- readsField: varIndex + "Answer whether the receiver loads the instance variable whose index is the argument." - "Answer whether the receiver loads the instance variable indexed by the argument."
+ | scanBlock scanner | + self isQuick ifTrue: + [^ self isReturnField and: [varIndex - 1 = self returnField]]. - | varIndexCode scanner | - varIndexCode := varIndex - 1. - self isQuick ifTrue: [^ self isReturnField and: [self returnField = varIndexCode]]. - - self codeLiteralsDo: [:compiledCode | - scanner := InstructionStream on: compiledCode. - (scanner scanFor: (self encoderClass instVarReadScanBlockFor: varIndexCode using: scanner)) - ifTrue: [^ true]].
+ scanner := InstructionStream new. + scanBlock := self encoderClass instVarReadScanBlockFor: varIndex - 1 using: scanner. + self codeLiteralsDo: [:compiledCode | + scanner method: compiledCode pc: compiledCode initialPC. + (scanner scanFor: scanBlock) ifTrue: + [^ true]]. + ^ false!
Item was changed: ----- Method: CompiledMethod>>writesField: (in category 'scanning') ----- writesField: varIndex "Answer whether the receiver stores into the instance variable indexed by the argument."
+ self isQuick ifFalse: + [| scanner scanBlock | + scanner := InstructionStream new. + scanBlock := self encoderClass instVarWriteScanBlockFor: varIndex - 1 using: scanner. + self codeLiteralsDo: + [:compiledCode | + scanner method: compiledCode pc: compiledCode initialPC. + (scanner scanFor: scanBlock) ifTrue: + [^ true]]]. - | varIndexCode scanner | - self isQuick ifTrue: [^ false]. - varIndexCode := varIndex - 1. - self codeLiteralsDo: [:compiledCode | - scanner := InstructionStream on: compiledCode. - (scanner scanFor: (self encoderClass instVarWriteScanBlockFor: varIndex - 1 using: scanner)) - ifTrue: [^ true]]. - ^ false!
squeak-dev@lists.squeakfoundation.org