Eliot Miranda uploaded a new version of ToolsTests to project The Trunk:
http://source.squeak.org/trunk/ToolsTests-eem.47.mcz
==================== Summary ====================
Name: ToolsTests-eem.47
Author: eem
Time: 23 May 2011, 6:12:10.584 pm
UUID: b9c22a05-2c13-4351-8540-d49384b0916e
Ancestors: ToolsTests-ul.46
Add test for allCallsOn: et al discovering references to
Float bindingOf: #NaN.
=============== Diff against ToolsTests-ul.46 ===============
Item was added:
+ ----- Method: BrowseTest>>testFindReferencesToFloatNaN (in category 'testing') -----
+ testFindReferencesToFloatNaN
+ self assert: (SystemNavigation new allCallsOn: (Float bindingOf: #NaN)) notEmpty!
Eliot Miranda uploaded a new version of ToolsTests to project The Trunk:
http://source.squeak.org/trunk/ToolsTests-eem.47.mcz
==================== Summary ====================
Name: ToolsTests-eem.47
Author: eem
Time: 23 May 2011, 6:12:10.584 pm
UUID: b9c22a05-2c13-4351-8540-d49384b0916e
Ancestors: ToolsTests-ul.46
Add test for allCallsOn: et al discovering references to
Float bindingOf: #NaN.
=============== Diff against ToolsTests-ul.46 ===============
Item was added:
+ ----- Method: BrowseTest>>testFindReferencesToFloatNaN (in category 'testing') -----
+ testFindReferencesToFloatNaN
+ self assert: (SystemNavigation new allCallsOn: (Float bindingOf: #NaN)) notEmpty!
Eliot Miranda uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-eem.590.mcz
==================== Summary ====================
Name: Kernel-eem.590
Author: eem
Time: 23 May 2011, 6:10:15.256 pm
UUID: bbcacb44-5bd6-40fe-965a-697b4b126ffd
Ancestors: Kernel-nice.589
Fix whichSelectorsReferTo:special:byte:thorough: for
Float bindingOf: #NaN, so that one can browse references
to the NaN class var.
Use literaslsDo: instead of literals do: in spaceUsed.
=============== Diff against Kernel-nice.589 ===============
Item was changed:
----- Method: Behavior>>spaceUsed (in category 'private') -----
spaceUsed
"Answer a rough estimate of number of bytes used by this class and its metaclass. Does not include space used by class variables."
| space |
space := 0.
self methodsDo: [:method |
space := space + 16. "dict and org'n space"
space := space + (method size + 6 "hdr + avg pad").
+ method literalsDo: [:lit |
- method literals do: [:lit |
(lit isMemberOf: Array) ifTrue: [space := space + ((lit size + 1) * 4)].
(lit isMemberOf: Float) ifTrue: [space := space + 12].
(lit isMemberOf: ByteString) ifTrue: [space := space + (lit size + 6)].
(lit isMemberOf: LargeNegativeInteger) ifTrue: [space := space + ((lit size + 1) * 4)].
(lit isMemberOf: LargePositiveInteger) ifTrue: [space := space + ((lit size + 1) * 4)]]].
^ space!
Item was changed:
----- Method: Behavior>>whichSelectorsReferTo:special:byte:thorough: (in category 'testing method dictionary') -----
whichSelectorsReferTo: literal special: specialFlag byte: specialByte thorough: thorough
"Answer a set of selectors whose methods access the argument as a literal. If thorough is true, then dives into the compact literal notation, making it slow but thorough "
| who |
who := IdentitySet new.
self selectorsAndMethodsDo: [ :selector :method |
(((thorough
ifFalse: [ method hasLiteral: literal ]
ifTrue: [ method hasLiteralThorough: literal ]) or: [
specialFlag and: [ method scanFor: specialByte ] ]) and: [
literal isVariableBinding not or: [
+ "N.B. (method indexOfLiteral: literal) < method numLiterals copes with l;ooking for
+ Float bindingOf: #NaN, since (Float bindingOf: #NaN) ~= (Float bindingOf: #NaN)."
+ (method indexOfLiteral: literal) ~= 0] ]) ifTrue: [
- method literals allButLast includes: literal] ]) ifTrue: [
who add: selector ] ].
^who!
Eliot Miranda uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-eem.590.mcz
==================== Summary ====================
Name: Kernel-eem.590
Author: eem
Time: 23 May 2011, 6:10:15.256 pm
UUID: bbcacb44-5bd6-40fe-965a-697b4b126ffd
Ancestors: Kernel-nice.589
Fix whichSelectorsReferTo:special:byte:thorough: for
Float bindingOf: #NaN, so that one can browse references
to the NaN class var.
Use literaslsDo: instead of literals do: in spaceUsed.
=============== Diff against Kernel-nice.589 ===============
Item was changed:
----- Method: Behavior>>spaceUsed (in category 'private') -----
spaceUsed
"Answer a rough estimate of number of bytes used by this class and its metaclass. Does not include space used by class variables."
| space |
space := 0.
self methodsDo: [:method |
space := space + 16. "dict and org'n space"
space := space + (method size + 6 "hdr + avg pad").
+ method literalsDo: [:lit |
- method literals do: [:lit |
(lit isMemberOf: Array) ifTrue: [space := space + ((lit size + 1) * 4)].
(lit isMemberOf: Float) ifTrue: [space := space + 12].
(lit isMemberOf: ByteString) ifTrue: [space := space + (lit size + 6)].
(lit isMemberOf: LargeNegativeInteger) ifTrue: [space := space + ((lit size + 1) * 4)].
(lit isMemberOf: LargePositiveInteger) ifTrue: [space := space + ((lit size + 1) * 4)]]].
^ space!
Item was changed:
----- Method: Behavior>>whichSelectorsReferTo:special:byte:thorough: (in category 'testing method dictionary') -----
whichSelectorsReferTo: literal special: specialFlag byte: specialByte thorough: thorough
"Answer a set of selectors whose methods access the argument as a literal. If thorough is true, then dives into the compact literal notation, making it slow but thorough "
| who |
who := IdentitySet new.
self selectorsAndMethodsDo: [ :selector :method |
(((thorough
ifFalse: [ method hasLiteral: literal ]
ifTrue: [ method hasLiteralThorough: literal ]) or: [
specialFlag and: [ method scanFor: specialByte ] ]) and: [
literal isVariableBinding not or: [
+ "N.B. (method indexOfLiteral: literal) < method numLiterals copes with l;ooking for
+ Float bindingOf: #NaN, since (Float bindingOf: #NaN) ~= (Float bindingOf: #NaN)."
+ (method indexOfLiteral: literal) ~= 0] ]) ifTrue: [
- method literals allButLast includes: literal] ]) ifTrue: [
who add: selector ] ].
^who!
Eliot Miranda uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-eem.590.mcz
==================== Summary ====================
Name: Kernel-eem.590
Author: eem
Time: 23 May 2011, 6:10:15.256 pm
UUID: bbcacb44-5bd6-40fe-965a-697b4b126ffd
Ancestors: Kernel-nice.589
Fix whichSelectorsReferTo:special:byte:thorough: for
Float bindingOf: #NaN, so that one can browse references
to the NaN class var.
Use literaslsDo: instead of literals do: in spaceUsed.
=============== Diff against Kernel-nice.589 ===============
Item was changed:
----- Method: Behavior>>spaceUsed (in category 'private') -----
spaceUsed
"Answer a rough estimate of number of bytes used by this class and its metaclass. Does not include space used by class variables."
| space |
space := 0.
self methodsDo: [:method |
space := space + 16. "dict and org'n space"
space := space + (method size + 6 "hdr + avg pad").
+ method literalsDo: [:lit |
- method literals do: [:lit |
(lit isMemberOf: Array) ifTrue: [space := space + ((lit size + 1) * 4)].
(lit isMemberOf: Float) ifTrue: [space := space + 12].
(lit isMemberOf: ByteString) ifTrue: [space := space + (lit size + 6)].
(lit isMemberOf: LargeNegativeInteger) ifTrue: [space := space + ((lit size + 1) * 4)].
(lit isMemberOf: LargePositiveInteger) ifTrue: [space := space + ((lit size + 1) * 4)]]].
^ space!
Item was changed:
----- Method: Behavior>>whichSelectorsReferTo:special:byte:thorough: (in category 'testing method dictionary') -----
whichSelectorsReferTo: literal special: specialFlag byte: specialByte thorough: thorough
"Answer a set of selectors whose methods access the argument as a literal. If thorough is true, then dives into the compact literal notation, making it slow but thorough "
| who |
who := IdentitySet new.
self selectorsAndMethodsDo: [ :selector :method |
(((thorough
ifFalse: [ method hasLiteral: literal ]
ifTrue: [ method hasLiteralThorough: literal ]) or: [
specialFlag and: [ method scanFor: specialByte ] ]) and: [
literal isVariableBinding not or: [
+ "N.B. (method indexOfLiteral: literal) < method numLiterals copes with l;ooking for
+ Float bindingOf: #NaN, since (Float bindingOf: #NaN) ~= (Float bindingOf: #NaN)."
+ (method indexOfLiteral: literal) ~= 0] ]) ifTrue: [
- method literals allButLast includes: literal] ]) ifTrue: [
who add: selector ] ].
^who!
Eliot Miranda uploaded a new version of KernelTests to project The Trunk:
http://source.squeak.org/trunk/KernelTests-eem.192.mcz
==================== Summary ====================
Name: KernelTests-eem.192
Author: eem
Time: 23 May 2011, 6:03:03.434 pm
UUID: d45cfe25-d091-4b7f-a9c7-09cb01098771
Ancestors: KernelTests-dtl.191
Use cm literalAt: cm numLiterals instead of cm literals last.
Arguambly should use cm methodClassAssociation
=============== Diff against KernelTests-dtl.191 ===============
Item was changed:
----- Method: MethodPropertiesTest>>testAllMethodsHaveMethodClass (in category 'testing') -----
testAllMethodsHaveMethodClass
Smalltalk garbageCollect.
self assert: (CompiledMethod allInstances
+ reject: [:cm | | lastLiteral |
+ lastLiteral := cm literalAt: cm numLiterals.
+ lastLiteral isVariableBinding
+ and: [lastLiteral value isBehavior
+ or: [lastLiteral value isTrait]]]) isEmpty
- reject: [:cm | cm literals last isVariableBinding
- and: [cm literals last value isBehavior
- or: [cm literals last value isTrait]]]) isEmpty
description: 'CompiledMethods must have methodClass literal'!
Eliot Miranda uploaded a new version of KernelTests to project The Trunk:
http://source.squeak.org/trunk/KernelTests-eem.192.mcz
==================== Summary ====================
Name: KernelTests-eem.192
Author: eem
Time: 23 May 2011, 6:03:03.434 pm
UUID: d45cfe25-d091-4b7f-a9c7-09cb01098771
Ancestors: KernelTests-dtl.191
Use cm literalAt: cm numLiterals instead of cm literals last.
Arguambly should use cm methodClassAssociation
=============== Diff against KernelTests-dtl.191 ===============
Item was changed:
----- Method: MethodPropertiesTest>>testAllMethodsHaveMethodClass (in category 'testing') -----
testAllMethodsHaveMethodClass
Smalltalk garbageCollect.
self assert: (CompiledMethod allInstances
+ reject: [:cm | | lastLiteral |
+ lastLiteral := cm literalAt: cm numLiterals.
+ lastLiteral isVariableBinding
+ and: [lastLiteral value isBehavior
+ or: [lastLiteral value isTrait]]]) isEmpty
- reject: [:cm | cm literals last isVariableBinding
- and: [cm literals last value isBehavior
- or: [cm literals last value isTrait]]]) isEmpty
description: 'CompiledMethods must have methodClass literal'!
Eliot Miranda uploaded a new version of KernelTests to project The Trunk:
http://source.squeak.org/trunk/KernelTests-eem.192.mcz
==================== Summary ====================
Name: KernelTests-eem.192
Author: eem
Time: 23 May 2011, 6:03:03.434 pm
UUID: d45cfe25-d091-4b7f-a9c7-09cb01098771
Ancestors: KernelTests-dtl.191
Use cm literalAt: cm numLiterals instead of cm literals last.
Arguambly should use cm methodClassAssociation
=============== Diff against KernelTests-dtl.191 ===============
Item was changed:
----- Method: MethodPropertiesTest>>testAllMethodsHaveMethodClass (in category 'testing') -----
testAllMethodsHaveMethodClass
Smalltalk garbageCollect.
self assert: (CompiledMethod allInstances
+ reject: [:cm | | lastLiteral |
+ lastLiteral := cm literalAt: cm numLiterals.
+ lastLiteral isVariableBinding
+ and: [lastLiteral value isBehavior
+ or: [lastLiteral value isTrait]]]) isEmpty
- reject: [:cm | cm literals last isVariableBinding
- and: [cm literals last value isBehavior
- or: [cm literals last value isTrait]]]) isEmpty
description: 'CompiledMethods must have methodClass literal'!
Bert Freudenberg uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-bf.543.mcz
==================== Summary ====================
Name: Morphic-bf.543
Author: bf
Time: 23 May 2011, 12:11:27.664 pm
UUID: b8b2ae61-d84f-4f1a-bf36-38ce1f256c7e
Ancestors: Morphic-dtl.542
bullet-proof Morphic drawing error handling
=============== Diff against Morphic-dtl.542 ===============
Item was changed:
----- Method: HandMorph>>fullDrawOn: (in category 'drawing') -----
fullDrawOn: aCanvas
"A HandMorph has unusual drawing requirements:
1. the hand itself (i.e., the cursor) appears in front of its submorphs
2. morphs being held by the hand cast a shadow on the world/morphs below
The illusion is that the hand plucks up morphs and carries them above the world."
"Note: This version caches an image of the morphs being held by the hand for
better performance. This cache is invalidated if one of those morphs changes."
| disableCaching subBnds roundCorners rounded |
self visible ifFalse: [^self].
(aCanvas isVisible: self fullBounds) ifFalse: [^self].
+ (self hasProperty: #errorOnDraw) ifTrue:[^self drawErrorOn: aCanvas].
disableCaching := false.
disableCaching
ifTrue:
[self nonCachingFullDrawOn: aCanvas.
^self].
submorphs isEmpty
ifTrue:
[cacheCanvas := nil.
^self drawOn: aCanvas]. "just draw the hand itself"
subBnds := Rectangle merging: (submorphs collect: [:m | m fullBounds]).
self updateCacheCanvas: aCanvas.
(cacheCanvas isNil
or: [cachedCanvasHasHoles and: [cacheCanvas depth = 1]])
ifTrue:
["could not use caching due to translucency; do full draw"
self nonCachingFullDrawOn: aCanvas.
^self].
"--> begin rounded corners hack <---"
roundCorners := cachedCanvasHasHoles == false
and: [submorphs size = 1 and: [submorphs first wantsRoundedCorners]].
roundCorners
ifTrue:
[rounded := submorphs first.
aCanvas asShadowDrawingCanvas translateBy: self shadowOffset
during:
[:shadowCanvas |
shadowCanvas roundCornersOf: rounded
during:
[(subBnds areasOutside: (rounded boundsWithinCorners
translateBy: self shadowOffset negated))
do: [:r | shadowCanvas fillRectangle: r color: Color black]]].
aCanvas roundCornersOf: rounded
during:
[aCanvas
drawImage: cacheCanvas form
at: subBnds origin
sourceRect: cacheCanvas form boundingBox].
^self drawOn: aCanvas "draw the hand itself in front of morphs"].
"--> end rounded corners hack <---"
"draw the shadow"
aCanvas asShadowDrawingCanvas translateBy: self shadowOffset
during:
[:shadowCanvas |
cachedCanvasHasHoles
ifTrue:
["Have to draw the real shadow of the form"
shadowCanvas paintImage: cacheCanvas form at: subBnds origin]
ifFalse:
["Much faster if only have to shade the edge of a solid rectangle"
(subBnds areasOutside: (subBnds translateBy: self shadowOffset negated))
do: [:r | shadowCanvas fillRectangle: r color: Color black]]].
"draw morphs in front of the shadow using the cached Form"
cachedCanvasHasHoles
ifTrue: [aCanvas paintImage: cacheCanvas form at: subBnds origin]
ifFalse:
[aCanvas
drawImage: cacheCanvas form
at: subBnds origin
sourceRect: cacheCanvas form boundingBox].
self drawOn: aCanvas "draw the hand itself in front of morphs"!
Item was changed:
----- Method: Morph>>drawErrorOn: (in category 'drawing') -----
drawErrorOn: aCanvas
"The morph (or one of its submorphs) had an error in its drawing method."
+ | saneBounds |
+ saneBounds := bounds rounded.
aCanvas
+ frameAndFillRectangle: saneBounds
- frameAndFillRectangle: bounds
fillColor: Color red
borderWidth: 1
borderColor: Color yellow.
+ aCanvas line: saneBounds topLeft to: saneBounds bottomRight width: 1 color: Color yellow.
+ aCanvas line: saneBounds topRight to: saneBounds bottomLeft width: 1 color: Color yellow.!
- aCanvas line: bounds topLeft to: bounds bottomRight width: 1 color: Color yellow.
- aCanvas line: bounds topRight to: bounds bottomLeft width: 1 color: Color yellow.!
Bert Freudenberg uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-bf.543.mcz
==================== Summary ====================
Name: Morphic-bf.543
Author: bf
Time: 23 May 2011, 12:11:27.664 pm
UUID: b8b2ae61-d84f-4f1a-bf36-38ce1f256c7e
Ancestors: Morphic-dtl.542
bullet-proof Morphic drawing error handling
=============== Diff against Morphic-dtl.542 ===============
Item was changed:
----- Method: HandMorph>>fullDrawOn: (in category 'drawing') -----
fullDrawOn: aCanvas
"A HandMorph has unusual drawing requirements:
1. the hand itself (i.e., the cursor) appears in front of its submorphs
2. morphs being held by the hand cast a shadow on the world/morphs below
The illusion is that the hand plucks up morphs and carries them above the world."
"Note: This version caches an image of the morphs being held by the hand for
better performance. This cache is invalidated if one of those morphs changes."
| disableCaching subBnds roundCorners rounded |
self visible ifFalse: [^self].
(aCanvas isVisible: self fullBounds) ifFalse: [^self].
+ (self hasProperty: #errorOnDraw) ifTrue:[^self drawErrorOn: aCanvas].
disableCaching := false.
disableCaching
ifTrue:
[self nonCachingFullDrawOn: aCanvas.
^self].
submorphs isEmpty
ifTrue:
[cacheCanvas := nil.
^self drawOn: aCanvas]. "just draw the hand itself"
subBnds := Rectangle merging: (submorphs collect: [:m | m fullBounds]).
self updateCacheCanvas: aCanvas.
(cacheCanvas isNil
or: [cachedCanvasHasHoles and: [cacheCanvas depth = 1]])
ifTrue:
["could not use caching due to translucency; do full draw"
self nonCachingFullDrawOn: aCanvas.
^self].
"--> begin rounded corners hack <---"
roundCorners := cachedCanvasHasHoles == false
and: [submorphs size = 1 and: [submorphs first wantsRoundedCorners]].
roundCorners
ifTrue:
[rounded := submorphs first.
aCanvas asShadowDrawingCanvas translateBy: self shadowOffset
during:
[:shadowCanvas |
shadowCanvas roundCornersOf: rounded
during:
[(subBnds areasOutside: (rounded boundsWithinCorners
translateBy: self shadowOffset negated))
do: [:r | shadowCanvas fillRectangle: r color: Color black]]].
aCanvas roundCornersOf: rounded
during:
[aCanvas
drawImage: cacheCanvas form
at: subBnds origin
sourceRect: cacheCanvas form boundingBox].
^self drawOn: aCanvas "draw the hand itself in front of morphs"].
"--> end rounded corners hack <---"
"draw the shadow"
aCanvas asShadowDrawingCanvas translateBy: self shadowOffset
during:
[:shadowCanvas |
cachedCanvasHasHoles
ifTrue:
["Have to draw the real shadow of the form"
shadowCanvas paintImage: cacheCanvas form at: subBnds origin]
ifFalse:
["Much faster if only have to shade the edge of a solid rectangle"
(subBnds areasOutside: (subBnds translateBy: self shadowOffset negated))
do: [:r | shadowCanvas fillRectangle: r color: Color black]]].
"draw morphs in front of the shadow using the cached Form"
cachedCanvasHasHoles
ifTrue: [aCanvas paintImage: cacheCanvas form at: subBnds origin]
ifFalse:
[aCanvas
drawImage: cacheCanvas form
at: subBnds origin
sourceRect: cacheCanvas form boundingBox].
self drawOn: aCanvas "draw the hand itself in front of morphs"!
Item was changed:
----- Method: Morph>>drawErrorOn: (in category 'drawing') -----
drawErrorOn: aCanvas
"The morph (or one of its submorphs) had an error in its drawing method."
+ | saneBounds |
+ saneBounds := bounds rounded.
aCanvas
+ frameAndFillRectangle: saneBounds
- frameAndFillRectangle: bounds
fillColor: Color red
borderWidth: 1
borderColor: Color yellow.
+ aCanvas line: saneBounds topLeft to: saneBounds bottomRight width: 1 color: Color yellow.
+ aCanvas line: saneBounds topRight to: saneBounds bottomLeft width: 1 color: Color yellow.!
- aCanvas line: bounds topLeft to: bounds bottomRight width: 1 color: Color yellow.
- aCanvas line: bounds topRight to: bounds bottomLeft width: 1 color: Color yellow.!