[squeak-dev] The Inbox: Kernel-ct.1415.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Oct 18 17:30:10 UTC 2021


A new version of Kernel was added to project The Inbox:
http://source.squeak.org/inbox/Kernel-ct.1415.mcz

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

Name: Kernel-ct.1415
Author: ct
Time: 18 October 2021, 7:30:07.101559 pm
UUID: 46e5ecc6-d349-ce49-983d-3a437a1fd620
Ancestors: Kernel-eem.1414

Fixes CompiledMethod >> #(reads|writes)Ref: to honor nested code literals (i.e. CompiledBlocks) correctly. The literal index needs to be determined for every literal individually.

With this patch, also the "stores into"/"assignments..." button in tools works again. For example, browsing assignments to the variable NextMinorVersion in the class ReleaseBuilder does not report "no stores into" any longer.

For reference, the first attempt of refactoring these methods was made in Kernel-mt.1244.

=============== Diff against Kernel-eem.1414 ===============

Item was added:
+ ----- Method: CompiledCode>>indexOfLiteral: (in category 'literals') -----
+ indexOfLiteral: literal
+ 	"Answer the literal index of the argument, literal, or zero if none."
+ 	2 to: self numLiterals - 1 "exclude selector/properties + methodClass"
+ 	   do:
+ 		[:index |
+ 		literal == (self objectAt: index) ifTrue: [^index - 1]].
+ 	^0!

Item was removed:
- ----- Method: CompiledMethod>>indexOfLiteral: (in category 'literals') -----
- indexOfLiteral: literal
- 	"Answer the literal index of the argument, literal, or zero if none."
- 	2 to: self numLiterals - 1 "exclude selector/properties + methodClass"
- 	   do:
- 		[:index |
- 		literal == (self objectAt: index) ifTrue: [^index - 1]].
- 	^0!

Item was changed:
  ----- Method: CompiledMethod>>readsRef: (in category 'scanning') -----
  readsRef: variableBinding 
  	"Answer whether the receiver reads the value of the argument."
+ 
+ 	self codeLiteralsDo: [:compiledCode |
+ 		| litIndex scanner |
+ 		(litIndex := compiledCode indexOfLiteral: variableBinding) = 0
+ 			ifFalse:
+ 				[scanner := InstructionStream on: compiledCode.
+ 				(scanner scanFor: (compiledCode encoderClass bindingReadScanBlockFor: litIndex - 1 using: scanner))
+ 					ifTrue: [^ true]]].
- 	"eem 5/24/2008 Rewritten to no longer assume the compler uses the
- 	 most compact encoding available (for EncoderForLongFormV3 support)."
  	
- 	| litIndex scanner |
- 	(litIndex := self indexOfLiteral: variableBinding) = 0
- 		ifTrue: [^false].
- 	
- 	self codeLiteralsDo: [:compiledCode | 
- 		scanner := InstructionStream on: compiledCode.
- 		(scanner scanFor: (self encoderClass bindingReadScanBlockFor: litIndex - 1 using: scanner))
- 			ifTrue: [^ true]].
- 	
  	^ false!

Item was changed:
  ----- Method: CompiledMethod>>writesRef: (in category 'scanning') -----
  writesRef: variableBinding 
  	"Answer whether the receiver writes the value of the argument."
- 	"eem 5/24/2008 Rewritten to no longer assume the compler uses the
- 	 most compact encoding available (for EncoderForLongFormV3 support)."
- 	
- 	| litIndex scanner |
- 	(litIndex := self indexOfLiteral: variableBinding) = 0
- 		ifTrue: [^ false].
- 	
- 	self codeLiteralsDo: [:compiledCode | 
- 		scanner := InstructionStream on: compiledCode.
- 		(scanner scanFor: (self encoderClass bindingWriteScanBlockFor: litIndex - 1 using: scanner))
- 			ifTrue: [^ true]].
  
+ 	self codeLiteralsDo: [:compiledCode | 
+ 		| litIndex scanner |
+ 		(litIndex := compiledCode indexOfLiteral: variableBinding) = 0
+ 			ifFalse:
+ 				[scanner := InstructionStream on: compiledCode.
+ 				(scanner scanFor: (compiledCode encoderClass bindingWriteScanBlockFor: litIndex - 1 using: scanner))
+ 					ifTrue: [^ true]]].
+ 	
  	^ false!



More information about the Squeak-dev mailing list