Eliot Miranda uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-eem.483.mcz
==================== Summary ====================
Name: System-eem.483
Author: eem
Time: 30 April 2012, 4:34:10.236 pm
UUID: 597c950a-a419-4668-a234-cb1ffd613232
Ancestors: System-eem.482
Sort the results of browse references... for inst vars.
=============== Diff against System-eem.482 ===============
Item was changed:
----- Method: SystemNavigation>>browseAllAccessesTo:from: (in category 'browse') -----
browseAllAccessesTo: instVarName from: aClass
"Create and schedule a Message Set browser for all the receiver's methods or any methods of a subclass/superclass that refer to the instance variable name."
"self new browseAllAccessesTo: 'contents' from: Collection."
^ self
+ browseMessageList: [ (self allAccessesTo: instVarName from: aClass) sort ]
- browseMessageList: [ self allAccessesTo: instVarName from: aClass ]
name: 'Accesses to ' , instVarName
autoSelect: instVarName!
Eliot Miranda uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-eem.483.mcz
==================== Summary ====================
Name: System-eem.483
Author: eem
Time: 30 April 2012, 4:34:10.236 pm
UUID: 597c950a-a419-4668-a234-cb1ffd613232
Ancestors: System-eem.482
Sort the results of browse references... for inst vars.
=============== Diff against System-eem.482 ===============
Item was changed:
----- Method: SystemNavigation>>browseAllAccessesTo:from: (in category 'browse') -----
browseAllAccessesTo: instVarName from: aClass
"Create and schedule a Message Set browser for all the receiver's methods or any methods of a subclass/superclass that refer to the instance variable name."
"self new browseAllAccessesTo: 'contents' from: Collection."
^ self
+ browseMessageList: [ (self allAccessesTo: instVarName from: aClass) sort ]
- browseMessageList: [ self allAccessesTo: instVarName from: aClass ]
name: 'Accesses to ' , instVarName
autoSelect: instVarName!
Eliot Miranda uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-eem.483.mcz
==================== Summary ====================
Name: System-eem.483
Author: eem
Time: 30 April 2012, 4:34:10.236 pm
UUID: 597c950a-a419-4668-a234-cb1ffd613232
Ancestors: System-eem.482
Sort the results of browse references... for inst vars.
=============== Diff against System-eem.482 ===============
Item was changed:
----- Method: SystemNavigation>>browseAllAccessesTo:from: (in category 'browse') -----
browseAllAccessesTo: instVarName from: aClass
"Create and schedule a Message Set browser for all the receiver's methods or any methods of a subclass/superclass that refer to the instance variable name."
"self new browseAllAccessesTo: 'contents' from: Collection."
^ self
+ browseMessageList: [ (self allAccessesTo: instVarName from: aClass) sort ]
- browseMessageList: [ self allAccessesTo: instVarName from: aClass ]
name: 'Accesses to ' , instVarName
autoSelect: instVarName!
Eliot Miranda uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-eem.473.mcz
==================== Summary ====================
Name: Collections-eem.473
Author: eem
Time: 28 April 2012, 5:02:56.235 pm
UUID: 6fa8cab9-1079-4bba-9fe4-0a96fcd47256
Ancestors: Collections-eem.472
A reimplementation of Travis Griggs' piecesCutWhere:[do:]
=============== Diff against Collections-eem.472 ===============
Item was added:
+ ----- Method: SequenceableCollection>>piecesCutWhere: (in category 'enumerating') -----
+ piecesCutWhere: binaryBlock
+ "Answer substrings of the receiver derived from cutting the receiver
+ at points where binaryBlock answers true for adjacent elements."
+
+ | pieces |
+ pieces := OrderedCollection new.
+ self piecesCutWhere: binaryBlock
+ do: [:piece|
+ pieces add: piece].
+ ^pieces
+
+ "'Now is the time for all good people to come to the aid of the cause of world peace. It is just fine, even desirable, to love your country, if that means wanting it to play a beneficial role in the course of world events and be the best possible example of a good society. But if it means wanting dominion over the rest of the world, it is not love but defensiveness or self-glorification, and will lead only to oblivion.'
+ piecesCutWhere: [:a :b| a = $. and: [b isSeparator]]"!
Item was added:
+ ----- Method: SequenceableCollection>>piecesCutWhere:do: (in category 'enumerating') -----
+ piecesCutWhere: binaryBlock do: pieceBlock
+ "Evaluate pieceBlock with substrings of the receiver derived from cutting the
+ receiver at points where binaryBlock answers true for adjacent elements."
+
+ | size lastCut this next |
+ (size := self size) <= 1 ifTrue:
+ [size = 1 ifTrue:
+ [pieceBlock value: self].
+ ^self].
+ lastCut := 1.
+ this := self at: 1.
+ 2 to: size do:
+ [:i|
+ next := self at: i.
+ (binaryBlock value: this value: next) ifTrue:
+ [pieceBlock value: (self copyFrom: lastCut to: i - 1).
+ lastCut := i].
+ this := next].
+ pieceBlock value: (self copyFrom: lastCut to: size)!
Eliot Miranda uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-eem.473.mcz
==================== Summary ====================
Name: Collections-eem.473
Author: eem
Time: 28 April 2012, 5:02:56.235 pm
UUID: 6fa8cab9-1079-4bba-9fe4-0a96fcd47256
Ancestors: Collections-eem.472
A reimplementation of Travis Griggs' piecesCutWhere:[do:]
=============== Diff against Collections-eem.472 ===============
Item was added:
+ ----- Method: SequenceableCollection>>piecesCutWhere: (in category 'enumerating') -----
+ piecesCutWhere: binaryBlock
+ "Answer substrings of the receiver derived from cutting the receiver
+ at points where binaryBlock answers true for adjacent elements."
+
+ | pieces |
+ pieces := OrderedCollection new.
+ self piecesCutWhere: binaryBlock
+ do: [:piece|
+ pieces add: piece].
+ ^pieces
+
+ "'Now is the time for all good people to come to the aid of the cause of world peace. It is just fine, even desirable, to love your country, if that means wanting it to play a beneficial role in the course of world events and be the best possible example of a good society. But if it means wanting dominion over the rest of the world, it is not love but defensiveness or self-glorification, and will lead only to oblivion.'
+ piecesCutWhere: [:a :b| a = $. and: [b isSeparator]]"!
Item was added:
+ ----- Method: SequenceableCollection>>piecesCutWhere:do: (in category 'enumerating') -----
+ piecesCutWhere: binaryBlock do: pieceBlock
+ "Evaluate pieceBlock with substrings of the receiver derived from cutting the
+ receiver at points where binaryBlock answers true for adjacent elements."
+
+ | size lastCut this next |
+ (size := self size) <= 1 ifTrue:
+ [size = 1 ifTrue:
+ [pieceBlock value: self].
+ ^self].
+ lastCut := 1.
+ this := self at: 1.
+ 2 to: size do:
+ [:i|
+ next := self at: i.
+ (binaryBlock value: this value: next) ifTrue:
+ [pieceBlock value: (self copyFrom: lastCut to: i - 1).
+ lastCut := i].
+ this := next].
+ pieceBlock value: (self copyFrom: lastCut to: size)!
Eliot Miranda uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-eem.473.mcz
==================== Summary ====================
Name: Collections-eem.473
Author: eem
Time: 28 April 2012, 5:02:56.235 pm
UUID: 6fa8cab9-1079-4bba-9fe4-0a96fcd47256
Ancestors: Collections-eem.472
A reimplementation of Travis Griggs' piecesCutWhere:[do:]
=============== Diff against Collections-eem.472 ===============
Item was added:
+ ----- Method: SequenceableCollection>>piecesCutWhere: (in category 'enumerating') -----
+ piecesCutWhere: binaryBlock
+ "Answer substrings of the receiver derived from cutting the receiver
+ at points where binaryBlock answers true for adjacent elements."
+
+ | pieces |
+ pieces := OrderedCollection new.
+ self piecesCutWhere: binaryBlock
+ do: [:piece|
+ pieces add: piece].
+ ^pieces
+
+ "'Now is the time for all good people to come to the aid of the cause of world peace. It is just fine, even desirable, to love your country, if that means wanting it to play a beneficial role in the course of world events and be the best possible example of a good society. But if it means wanting dominion over the rest of the world, it is not love but defensiveness or self-glorification, and will lead only to oblivion.'
+ piecesCutWhere: [:a :b| a = $. and: [b isSeparator]]"!
Item was added:
+ ----- Method: SequenceableCollection>>piecesCutWhere:do: (in category 'enumerating') -----
+ piecesCutWhere: binaryBlock do: pieceBlock
+ "Evaluate pieceBlock with substrings of the receiver derived from cutting the
+ receiver at points where binaryBlock answers true for adjacent elements."
+
+ | size lastCut this next |
+ (size := self size) <= 1 ifTrue:
+ [size = 1 ifTrue:
+ [pieceBlock value: self].
+ ^self].
+ lastCut := 1.
+ this := self at: 1.
+ 2 to: size do:
+ [:i|
+ next := self at: i.
+ (binaryBlock value: this value: next) ifTrue:
+ [pieceBlock value: (self copyFrom: lastCut to: i - 1).
+ lastCut := i].
+ this := next].
+ pieceBlock value: (self copyFrom: lastCut to: size)!
Eliot Miranda uploaded a new version of Tests to project The Trunk:
http://source.squeak.org/trunk/Tests-eem.151.mcz
==================== Summary ====================
Name: Tests-eem.151
Author: eem
Time: 26 April 2012, 12:02:22.807 pm
UUID: d1afe8a4-9721-4e74-a3f3-b2fc1057d51b
Ancestors: Tests-ul.150
Add tests for BlockClosure>isClean
=============== Diff against Tests-ul.150 ===============
Item was added:
+ ----- Method: ClosureTests>>testIsClean (in category 'testing') -----
+ testIsClean
+ | local |
+ local := #testIsClean.
+
+ self assert: [] isClean. "closes over nothing at all"
+ self assert: [:a :b| a < b] isClean. "accesses only arguments"
+ self assert: [:a :b| | s | s := a + b. s even] isClean. "accesses only local variables"
+
+ self deny: [^nil] isClean. "closes over home (^-return)"
+ self deny: [self] isClean. "closes over the receiver"
+ self deny: [collection] isClean. "closes over the receiver (to access the inst var collection)"
+ self deny: [local] isClean. "closes over local variable of outer context"!
Eliot Miranda uploaded a new version of Tests to project The Trunk:
http://source.squeak.org/trunk/Tests-eem.151.mcz
==================== Summary ====================
Name: Tests-eem.151
Author: eem
Time: 26 April 2012, 12:02:22.807 pm
UUID: d1afe8a4-9721-4e74-a3f3-b2fc1057d51b
Ancestors: Tests-ul.150
Add tests for BlockClosure>isClean
=============== Diff against Tests-ul.150 ===============
Item was added:
+ ----- Method: ClosureTests>>testIsClean (in category 'testing') -----
+ testIsClean
+ | local |
+ local := #testIsClean.
+
+ self assert: [] isClean. "closes over nothing at all"
+ self assert: [:a :b| a < b] isClean. "accesses only arguments"
+ self assert: [:a :b| | s | s := a + b. s even] isClean. "accesses only local variables"
+
+ self deny: [^nil] isClean. "closes over home (^-return)"
+ self deny: [self] isClean. "closes over the receiver"
+ self deny: [collection] isClean. "closes over the receiver (to access the inst var collection)"
+ self deny: [local] isClean. "closes over local variable of outer context"!
Eliot Miranda uploaded a new version of Tests to project The Trunk:
http://source.squeak.org/trunk/Tests-eem.151.mcz
==================== Summary ====================
Name: Tests-eem.151
Author: eem
Time: 26 April 2012, 12:02:22.807 pm
UUID: d1afe8a4-9721-4e74-a3f3-b2fc1057d51b
Ancestors: Tests-ul.150
Add tests for BlockClosure>isClean
=============== Diff against Tests-ul.150 ===============
Item was added:
+ ----- Method: ClosureTests>>testIsClean (in category 'testing') -----
+ testIsClean
+ | local |
+ local := #testIsClean.
+
+ self assert: [] isClean. "closes over nothing at all"
+ self assert: [:a :b| a < b] isClean. "accesses only arguments"
+ self assert: [:a :b| | s | s := a + b. s even] isClean. "accesses only local variables"
+
+ self deny: [^nil] isClean. "closes over home (^-return)"
+ self deny: [self] isClean. "closes over the receiver"
+ self deny: [collection] isClean. "closes over the receiver (to access the inst var collection)"
+ self deny: [local] isClean. "closes over local variable of outer context"!
Eliot Miranda uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-eem.684.mcz
==================== Summary ====================
Name: Kernel-eem.684
Author: eem
Time: 26 April 2012, 11:07:37.737 am
UUID: e838a325-27ec-4a62-a907-d4059451a046
Ancestors: Kernel-nice.683
Implement endPC numArgs and numTemps for closures
and contexts (both block and method activations).
Provide CompiledMethod>abstractBytecodeMessagesDo:
et al.
Implement BlockClosure>isClean to identify self-contained blocks.
=============== Diff against Kernel-nice.683 ===============
Item was added:
+ ----- Method: BlockClosure>>abstractBytecodeMessagesDo: (in category 'scanning') -----
+ abstractBytecodeMessagesDo: aBlock
+ "Evaluate aBlock with the sequence of abstract bytecodes in the receiver."
+ self method
+ abstractBytecodeMessagesFrom: startpc
+ to: self endPC
+ do: aBlock
+
+ "| msgs |
+ msgs := OrderedCollection new.
+ (SortedCollection sortBlock: [:a :b| a compare: b caseSensitive: false]) sortBlock
+ abstractBytecodeMessagesDo: [:msg| msgs add: msg selector].
+ msgs"!
Item was added:
+ ----- Method: BlockClosure>>blockCreationBytecodeMessage (in category 'scanning') -----
+ blockCreationBytecodeMessage
+ "Answer the abstract bytecode message that created the receiver."
+ | blockCreationBytecodeSize |
+ ^self method abstractBytecodeMessageAt: startpc - (blockCreationBytecodeSize := 4)
+
+ "(SortedCollection sortBlock: [:a :b| a compare: b caseSensitive: false]) sortBlock blockCreationBytecodeMessage"!
Item was added:
+ ----- Method: BlockClosure>>endPC (in category 'accessing') -----
+ endPC
+ ^self blockCreationBytecodeMessage arguments last + startpc - 1!
Item was changed:
----- Method: BlockClosure>>hasMethodReturn (in category 'testing') -----
hasMethodReturn
"Answer whether the receiver has a method-return ('^') in its code."
+ | scanner endpc |
+ scanner := InstructionStream new method: outerContext method pc: startpc.
+ endpc := self endPC.
+ scanner scanFor: [:byte | (byte between: 120 and: 124) or: [scanner pc > endpc]].
+ ^scanner pc <= endpc!
- | myMethod scanner preceedingBytecodeMessage end |
- "Determine end of block from the instruction preceding it.
- Find the instruction by using an MNU handler to capture
- the instruction message sent by the scanner."
- myMethod := outerContext method.
- scanner := InstructionStream new method: myMethod pc: myMethod initialPC.
- [scanner pc < startpc] whileTrue:
- [[scanner interpretNextInstructionFor: nil]
- on: MessageNotUnderstood
- do: [:ex| preceedingBytecodeMessage := ex message]].
- end := preceedingBytecodeMessage arguments last + startpc - 1.
- scanner method: myMethod pc: startpc.
- scanner scanFor: [:byte | (byte between: 120 and: 124) or: [scanner pc > end]].
- ^scanner pc <= end!
Item was added:
+ ----- Method: BlockClosure>>isClean (in category 'testing') -----
+ isClean
+ "Answer if the receiver does not close-over any variables other than globals, and does
+ not ^-return (does not close over the home context). Clean blocks are amenable to
+ being created at compile-time."
+ self numCopiedValues > 0 ifTrue:
+ [^false].
+ self abstractBytecodeMessagesDo:
+ [:msg|
+ (#( pushReceiver
+ pushReceiverVariable: popIntoReceiverVariable: storeIntoReceiverVariable:
+ methodReturnConstant: methodReturnReceiver methodReturnTop)
+ includes: msg selector) ifTrue:
+ [^false]].
+ ^true
+
+ "clean:"
+ "[] isClean"
+ "[:a :b| a < b] isClean"
+ "unclean"
+ "[^nil] isClean"
+ "[self class] isClean"
+ "| v | v := 0.
+ [v class] isClean"!
Item was added:
+ ----- Method: BlockClosure>>numTemps (in category 'accessing') -----
+ numTemps
+ "Answer the number of temporaries for the receiver; this includes
+ the number of arguments and the number of copied values."
+ | blockCreationBytecodeSize |
+ ^self numCopiedValues
+ + self numArgs
+ + (BlockLocalTempCounter
+ tempCountForBlockAt: startpc - (blockCreationBytecodeSize := 4)
+ in: self method)!
Item was added:
+ ----- Method: CompiledMethod>>abstractBytecodeMessageAt: (in category 'scanning') -----
+ abstractBytecodeMessageAt: pc
+ "Answer the abstract bytecode message at pc in the receiver."
+ ^[(InstructionStream new method: self pc: pc) interpretNextInstructionFor: nil]
+ on: MessageNotUnderstood
+ do: [:ex| ex message]!
Item was added:
+ ----- Method: CompiledMethod>>abstractBytecodeMessagesDo: (in category 'scanning') -----
+ abstractBytecodeMessagesDo: aBlock
+ "Evaluate aBlock with the sequence of abstract bytecodes in the receiver"
+ self abstractBytecodeMessagesFrom: self initialPC
+ to: self endPC
+ do: aBlock
+
+ "| msgs |
+ msgs := OrderedCollection new.
+ CompiledMethod >> #abstractBytecodeMessagesFrom:to: abstractBytecodeMessagesDo:
+ [:msg| msgs add: msg selector].
+ msgs"!
Item was added:
+ ----- Method: CompiledMethod>>abstractBytecodeMessagesFrom:to:do: (in category 'scanning') -----
+ abstractBytecodeMessagesFrom: startpc to: endpc do: aBlock
+ "Evaluate aBlock with the sequence of abstract bytecodes from startpc through endpc in the receiver"
+ | scanner |
+ scanner := InstructionStream new method: self pc: startpc.
+ [scanner pc <= endpc] whileTrue:
+ [[scanner interpretNextInstructionFor: nil]
+ on: MessageNotUnderstood
+ do: [:ex| aBlock value: ex message]]
+
+ "| m msgs |
+ msgs := OrderedCollection new.
+ (m := CompiledMethod >> #abstractBytecodeMessagesFrom:to:)
+ abstractBytecodeMessagesFrom: m initialPC
+ to: m endPC
+ do: [:msg| msgs add: msg selector].
+ msgs"!
Item was added:
+ ----- Method: MethodContext>>endPC (in category 'private') -----
+ endPC
+ ^closureOrNil
+ ifNil: [self method endPC]
+ ifNotNil: [closureOrNil endPC]!
Item was added:
+ ----- Method: MethodContext>>numArgs (in category 'accessing') -----
+ numArgs
+ "Answer the number of arguments for this activation."
+ ^closureOrNil
+ ifNil: [method numArgs]
+ ifNotNil: [closureOrNil numArgs]!
Item was added:
+ ----- Method: MethodContext>>numTemps (in category 'accessing') -----
+ numTemps
+ "Answer the number of temporaries for this activation; this includes
+ the number of arguments, and for blocks, the number of copied values."
+ ^closureOrNil
+ ifNil: [method numTemps]
+ ifNotNil: [closureOrNil numTemps]!