The Trunk: Kernel-eem.1362.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Kernel-eem.1362.mcz

commits-2
Eliot Miranda uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-eem.1362.mcz

==================== Summary ====================

Name: Kernel-eem.1362
Author: eem
Time: 2 December 2020, 9:54:15.943794 pm
UUID: c9a9d41d-b1f3-443d-94bd-916e18b2ccba
Ancestors: Kernel-eem.1361

Provide CompiledMethod>>anyAndAllSelectors[Do:] that includes unsent symbols that might be selectors.  e.g. HaloMorph>>#addRotateHandle: really does send
#startRot:with: and #doRot:with:, albeit indirectly via perform:.

=============== Diff against Kernel-eem.1361 ===============

Item was added:
+ ----- Method: CompiledMethod>>anyAndAllMessages (in category 'literals') -----
+ anyAndAllMessages
+ "Answer a Set of all the message selectors sent by this method, and all literals that look like message selectors."
+
+ | result |
+ result := Set new.
+ self anyAndAllSelectorsDo: [:selector | result add: selector].
+ ^result!

Item was added:
+ ----- Method: CompiledMethod>>anyAndAllSelectorsDo: (in category 'literals') -----
+ anyAndAllSelectorsDo: workBlock
+ "Evaluate aBlock with all the message selectors sent by me, including
+ my literals that look like selectors, and selectors in my pragmas.
+ Duplicate selectors are possible."
+
+ | encoderClass selectorLiteralCollector |
+ encoderClass := self encoderClass.
+ selectorLiteralCollector := [:literal|
+ literal isCollection ifTrue:
+ [literal isSymbol
+ ifTrue:
+ [literal isMessageSelector ifTrue:
+ [workBlock value: literal]]
+ ifFalse:
+ [literal isArray ifTrue:
+ [literal do: selectorLiteralCollector]]]].
+ self pragmas do:
+ [:pragma|
+ selectorLiteralCollector
+ value: pragma keyword;
+ value: pragma arguments].
+ self isQuick ifTrue: [^self].
+ self codeLiteralsDo:
+ [:compiledCode | | scanner limit |
+ limit := compiledCode size - 1.
+ (scanner := InstructionStream on: compiledCode) scanFor:
+ [:byte| | selector |
+ (selector := scanner selectorToSendOrSelf) ~~ scanner ifTrue:
+ [workBlock value: selector].
+ ((encoderClass isExtension: byte)
+ and: [scanner pc < limit]) ifTrue:
+ [scanner pc: scanner pc + (encoderClass bytecodeSize: (compiledCode at: scanner pc + 2))].
+ false "keep scanning"].
+ compiledCode literalsDo: selectorLiteralCollector]!