[squeak-dev] The Trunk: Kernel-tpr.1497.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Jan 16 00:40:48 UTC 2023


tim Rowledge uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-tpr.1497.mcz

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

Name: Kernel-tpr.1497
Author: tpr
Time: 15 January 2023, 4:40:44.508752 pm
UUID: 88b6b837-6df9-4e70-851b-1666f00316a3
Ancestors: Kernel-eem.1496

Remove some variable shadowing. Be nice to Levente's beautiful code

=============== Diff against Kernel-eem.1496 ===============

Item was changed:
  ----- Method: Context>>directedSuperSend:numArgs: (in category 'instruction decoding') -----
  directedSuperSend: selector numArgs: numArgs
  	"Simulate the action of bytecodes that send a message with selector, selector,
  	 starting the message lookup in the superclass of the class on top of stack.
  	 The arguments of the message are found in the next numArgs locations on
  	 the stack and the receiver just below them."
  
+ 	| class newReceiver arguments |
- 	| class receiver arguments |
  	class := self pop.
  	arguments := Array new: numArgs.
  	numArgs to: 1 by: -1 do: [ :i | arguments at: i put: self pop].
+ 	newReceiver := self pop.
- 	receiver := self pop.
  	QuickStep == self ifTrue:
  		[QuickStep := nil.
+ 		^self quickSend: selector to: newReceiver with: arguments lookupIn: class superclass].
+ 	^self send: selector to: newReceiver with: arguments lookupIn: class superclass!
- 		^self quickSend: selector to: receiver with: arguments lookupIn: class superclass].
- 	^self send: selector to: receiver with: arguments lookupIn: class superclass!

Item was changed:
  ----- Method: Random>>hashSeed: (in category 'private') -----
  hashSeed: anInteger
  	"Use the 32-bit version of the FNV-1a algorithm to hash the seed, and return a 32-bit unsigned integer."
  
  	| fnvPrime hash |
  	fnvPrime := 16777619 " 32-bit FVN prime ".
  	hash := anInteger negative
  		ifTrue: [  3490449840 "  mix in the sign as (2166136261 bitXor: 2r1010101) * 16777619 bitAnd: 16rFFFFFFFF "]
  		ifFalse: [ 2166136261 " 32-bit FVN offset basis "].
+ 	1 to: anInteger digitLength do: [ :digitIndex |
+ 		hash := 16rFFFFFFFF bitAnd: (hash bitXor: (anInteger digitAt: digitIndex)) * fnvPrime ].
- 	1 to: anInteger digitLength do: [ :index |
- 		hash := 16rFFFFFFFF bitAnd: (hash bitXor: (anInteger digitAt: index)) * fnvPrime ].
  	^hash!

Item was changed:
  ----- Method: Random>>next:into: (in category 'accessing') -----
  next: anInteger into: anArray
+ 	1 to: anInteger do:
+ 		[:i |
+ 		anArray at: i put: self next].
- 	1 to: anInteger do: [:index | anArray at: index put: self next].
  	^ anArray!

Item was changed:
  ----- Method: Random>>nextBytes:into:startingAt: (in category 'accessing') -----
  nextBytes: anInteger into: aBytesObject startingAt: startIndex
  	"Fill aBytesObject, an object with indexable byte fields, with anInteger number of random bytes starting from startIndex. Assume that MTw is at least 8."
  
+ 	| randomValue remainingBits byteIndex endIndex |
- 	| randomValue remainingBits index endIndex |
  	randomValue := remainingBits := 0.
+ 	byteIndex := startIndex.
- 	index := startIndex.
  	endIndex := startIndex + anInteger - 1.
+ 	[ byteIndex <= endIndex ] whileTrue: [
- 	[ index <= endIndex ] whileTrue: [
  		remainingBits >= 8
  			ifTrue: [
+ 				aBytesObject basicAt: byteIndex put: (randomValue bitAnd: 16rFF).
- 				aBytesObject basicAt: index put: (randomValue bitAnd: 16rFF).
  				randomValue := randomValue bitShift: -8.
  				remainingBits := remainingBits - 8.
+ 				byteIndex := byteIndex + 1 ]
- 				index := index + 1 ]
  			ifFalse: [
  				remainingBits = 0
  					ifTrue: [ randomValue := self nextValue ]
  					ifFalse: [
  						| newRandomValue |
  						newRandomValue := self nextValue.
+ 						aBytesObject basicAt: byteIndex put: (randomValue bitShift: 8 - remainingBits) + 
- 						aBytesObject basicAt: index put: (randomValue bitShift: 8 - remainingBits) + 
  							(newRandomValue bitAnd: (1 bitShift: 8 - remainingBits) - 1).
  						randomValue := newRandomValue bitShift: 0 - remainingBits.
+ 						byteIndex := byteIndex + 1 ].
- 						index := index + 1 ].
  				remainingBits := MTw - remainingBits ] ]!



More information about the Squeak-dev mailing list