[Pkg] The Trunk: Kernel-nice.543.mcz

commits at source.squeak.org commits at source.squeak.org
Sun Feb 13 19:47:30 UTC 2011

Nicolas Cellier uploaded a new version of Kernel to project The Trunk:

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

Name: Kernel-nice.543
Author: nice
Time: 13 February 2011, 8:46:54.829 pm
UUID: 3643fbe2-52ce-4d82-80d9-1399706937f3
Ancestors: Kernel-nice.542

Cherry pick some changes from Pharo:

avoid inlining #selectors #classVarNames
use #cull:cull: instead of #valueWithPossibleArgs:
patch needsFrameSize: for the case of perform:withArguments: (required by old VM, not Cog)
better comment for Fraction hash

=============== Diff against Kernel-nice.542 ===============

Item was changed:
  ----- Method: BlockClosure>>asContextWithSender: (in category 'private') -----
  asContextWithSender: aContext
  	"Inner private support method for evaluation.  Do not use unless you know what you're doing."
+ 	^(MethodContext newForMethod: outerContext method)
- 	^((MethodContext newForMethod: outerContext method)
  		setSender: aContext
  		receiver: outerContext receiver
  		method: outerContext method
  		closure: self
+ 		startpc: startpc;
+ 		privRefresh!
- 		startpc: startpc) privRefresh!

Item was changed:
  ----- Method: BlockContext>>ifError: (in category 'evaluating') -----
  ifError: errorHandlerBlock
  	"Evaluate the block represented by the receiver, and normally return it's value.  If an error occurs, the errorHandlerBlock is evaluated, and it's value is instead returned.  The errorHandlerBlock must accept zero, one, or two parameters (the error message and the receiver)."
  		[1 whatsUpDoc] ifError: [:err :rcvr | 'huh?'].
  		[1 / 0] ifError: [:err :rcvr |
  			'ZeroDivide' = err
  				ifTrue: [Float infinity]
  				ifFalse: [self error: err]]
  	^ self on: Error do: [:ex |
+ 		errorHandlerBlock cull: ex description cull: ex receiver]!
- 		errorHandlerBlock valueWithPossibleArgs: {ex description. ex receiver}]!

Item was changed:
  ----- Method: ClassDescription>>classVariablesString (in category 'printing') -----
  	"Answer a string of my class variable names separated by spaces."
  	^String streamContents: [ :stream | 
+ 		self classVarNames 
- 		self classPool keys asArray sort 
  			do: [ :each | stream nextPutAll: each ]
  			separatedBy: [ stream space ] ]!

Item was changed:
+ ----- Method: ClassDescription>>moveChangesWithVersionsTo: (in category 'filein/out') -----
- ----- Method: ClassDescription>>moveChangesWithVersionsTo: (in category 'fileIn/Out') -----
  moveChangesWithVersionsTo: newFile 
  	"Used in the process of condensing changes, this message requests that 
  	the source code of all methods of the receiver that have been changed 
  	should be moved to newFile."
  	| changes |
+ 	changes := self selectors select: [:sel | (self methodDict at: sel) fileIndex > 1].
- 	changes := self methodDict keys select: [:sel | (self methodDict at: sel) fileIndex > 1].
  	self fileOutChangedMessagesHistorically: changes
  		on: newFile
  		moveSource: true
  		toFile: 2!

Item was changed:
  ----- Method: CompiledMethod>>needsFrameSize: (in category 'initialize-release') -----
  needsFrameSize: newFrameSize
  	"Set the largeFrameBit to accomodate the newFrameSize"
  	| largeFrameBit header |
  	largeFrameBit := 16r20000.
  	(self numTemps + newFrameSize) > LargeFrame ifTrue:
  		[^ self error: 'Cannot compile -- stack including temps is too deep'].
  	header := self objectAt: 1.
  	(header bitAnd: largeFrameBit) ~= 0
  		ifTrue: [header := header - largeFrameBit].
  	self objectAt: 1 put: header
+ 			+ ( ((self numTemps + newFrameSize) > SmallFrame or: [ self primitive = 84 "perform:withArguments:"])
- 			+ ((self numTemps + newFrameSize) > SmallFrame
  					ifTrue: [largeFrameBit]
  					ifFalse: [0])!

Item was changed:
  ----- Method: Fraction>>hash (in category 'comparing') -----
  	"Hash is reimplemented because = is implemented.
  	Care is taken that a Fraction equal to a Float also have an equal hash"
  	| tmp |
  	denominator isPowerOfTwo ifTrue: [
+ 		"If denominator is a power of two, I can be exactly equal to a Float"
- 		"If denominator is a power of two, I can be exactly equal to a Float
- 		Assume the fraction is already reduced"
  		tmp := self asFloat.
  		tmp isFinite ifTrue: [^tmp hash]].
+ 	"Else, I cannot be exactly equal to a Float, use own hash algorithm.
+ 	(Assume the fraction is already reduced)"
  	^numerator hash bitXor: denominator hash!

More information about the Packages mailing list