[Pkg] The Trunk: Kernel-ul.1060.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Feb 27 01:17:13 UTC 2017


Levente Uzonyi uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-ul.1060.mcz

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

Name: Kernel-ul.1060
Author: ul
Time: 27 February 2017, 2:16:28.275956 am
UUID: e510449a-9899-41a3-9bc9-a41290fdc64e
Ancestors: Kernel-tonyg.1059, Kernel-ul.1059

- omit ifAbsent from #index* sends when the default value, 0 would used
- merged Kernel-ul.1059

=============== Diff against Kernel-tonyg.1059 ===============

Item was changed:
  ----- Method: ClassDescription>>instVarIndexFor:ifAbsent: (in category 'instance variables') -----
  instVarIndexFor: instVarName ifAbsent: aBlock
  	"Answer the index of the named instance variable."
  
  	| index |
+ 	index := instanceVariables
+ 		ifNil: [ 0 ]
+ 		ifNotNil: [ instanceVariables indexOf: instVarName ].
+ 	index = 0 ifTrue: [
+ 		^superclass
+ 			ifNil: [ aBlock value ]
+ 			ifNotNil: [ superclass instVarIndexFor: instVarName ifAbsent: aBlock ] ].
+ 	^superclass 
+ 		ifNil: [ index ]
+ 		ifNotNil: [ index + superclass instSize ]!
- 	index := instanceVariables == nil 
- 				ifTrue: [0]
- 				ifFalse: [instanceVariables indexOf: instVarName ifAbsent: [0]].
- 	index = 0 ifTrue: 
- 		[^superclass == nil 
- 			ifTrue: [aBlock value]
- 			ifFalse: [superclass instVarIndexFor: instVarName ifAbsent: aBlock]].
- 	^superclass == nil 	
- 		ifTrue: [index]
- 		ifFalse: [index + superclass instSize]!

Item was changed:
  ----- Method: CompiledMethod>>getPreambleFrom:at: (in category 'source code management') -----
  getPreambleFrom: aFileStream at: endPosition
  	"This method is an ugly hack. This method assumes that source files have ASCII-compatible encoding and that preambles contain no non-ASCII characters."
  
  	| chunkSize chunk |
  	chunkSize := 160 min: endPosition.
  	[
  		| index |
  		chunk := aFileStream
  			position: (endPosition - chunkSize + 1 max: 0);
  			basicNext: chunkSize.
+ 		(index := chunk lastIndexOf: $!! startingAt: chunk size) ~= 0 ifTrue: [
- 		(index := chunk lastIndexOf: $!! startingAt: chunk size ifAbsent: 0) ~= 0 ifTrue: [
  			^chunk copyFrom: index + 1 to: chunk size ].
  		chunkSize := chunkSize * 2.
  		chunkSize <= endPosition ] whileTrue.
  	^chunk!

Item was changed:
  ----- Method: CompiledMethodTrailer>>qCompress: (in category 'private') -----
  qCompress: string
  	"A very simple text compression routine designed for method temp names.
  	 Most common 11 chars get values 1-11 packed in one 4-bit nibble;
  	 the next most common get values 12-15 (2 bits) * 16 plus next nibble;
  	 unusual ones get three nibbles, the first being the escape nibble 0.
  
  	Answer the write stream with compressed data inside"
  
  	| utf8str stream oddNibble |
  
  	string isEmpty ifTrue:
  		[^self qCompress: ' '].
  	utf8str := string convertToEncoding: 'utf8'.
  
  	stream := WriteStream on: (ByteArray new: utf8str size).
  	oddNibble := nil.
  
  	utf8str do:	[:char | | ix |
  		ix := 'ear tonsilcmbdfghjkpquvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ012345[]()'
+ 			indexOf: char.
- 			indexOf: char ifAbsent: 0.
  		(ix = 0
  			ifTrue:
  				[{ 0. char asInteger // 16. char asInteger \\ 16 }]
  			ifFalse:
  				[ix <= 11
  					ifTrue: [{ ix }]
  					ifFalse: [{ ix//16+12. ix\\16 }]])
  				do: [:nibble |
  					oddNibble
  						ifNotNil: [stream nextPut: oddNibble*16 + nibble. oddNibble := nil]
  						ifNil: [oddNibble := nibble]]].
  	oddNibble ifNotNil: "4 = 'ear tonsil' indexOf: Character space"
  		[stream nextPut: oddNibble * 16 + 4].
  	^ stream
  !

Item was changed:
  ----- Method: False>>& (in category 'logical operations') -----
  & aBoolean 
+ 	"Evaluating conjunction -- answer false since receiver is false, but let the VM quickly check the type of the argument first."
- 	"Evaluating conjunction -- answer false since receiver is false."
  
+ 	aBoolean ifFalse: [ ^false ].
+ 	^false!
- 	^self!

Item was changed:
  ----- Method: False>>| (in category 'logical operations') -----
  | aBoolean 
+ 	"Evaluating disjunction (OR) -- could  answer aBoolean since receiver is false, but let the VM quickly check the type of the argument instead."
- 	"Evaluating disjunction (OR) -- answer with the argument, aBoolean."
  
+ 	aBoolean ifTrue: [ ^true ].
+ 	^false!
- 	^aBoolean!

Item was changed:
  ----- Method: True>>& (in category 'logical operations') -----
  & aBoolean 
+ 	"Evaluating conjunction -- could answer aBoolean since receiver is true, but let the VM quickly check the type of the argument instead."
- 	"Evaluating conjunction -- answer aBoolean since receiver is true."
  
+ 	aBoolean ifFalse: [ ^false ].
+ 	^true!
- 	^aBoolean!

Item was changed:
  ----- Method: True>>| (in category 'logical operations') -----
  | aBoolean 
+ 	"Evaluating disjunction (OR) -- answer true since the receiver is true, but let the VM quickly check the type of the argument first."
- 	"Evaluating disjunction (OR) -- answer true since the receiver is true."
  
+ 	aBoolean ifTrue: [ ^true ].
+ 	^true!
- 	^self!



More information about the Packages mailing list