Hi All,
the following are in Etoys-Squeakland but unsent. Safe to remove?
('*Etoys-Squeakland-source code management' qDecompress:)
('*Etoys-Squeakland-scanning' scanLongLoad: scanLongStore:
scanVeryLongLoad:offset:)
_,,,^..^,,,_
best, Eliot
A new version of Morphic was added to project The Inbox:
http://source.squeak.org/inbox/Morphic-pre.1329.mcz
==================== Summary ====================
Name: Morphic-pre.1329
Author: pre
Time: 15 March 2017, 4:16:07.772309 pm
UUID: bb5c49b1-402a-9443-b129-ae2e0f250f8f
Ancestors: Morphic-edc.1328
Changes the accept dropping behavior of the world to open the morph for a dropped object where it was dropped.
=============== Diff against Morphic-edc.1328 ===============
Item was changed:
----- Method: PasteUpMorph>>acceptDroppingMorph:event: (in category 'dropping/grabbing') -----
acceptDroppingMorph: dropped event: evt
"The supplied morph, known to be acceptable to the receiver, is now to be assimilated; the precipitating event is supplied"
| aMorph |
aMorph := self morphToDropFrom: dropped.
self isWorldMorph
ifTrue:["Add the given morph to this world and start stepping it if it wants to be."
+ aMorph position: evt position.
self addMorphFront: aMorph.
(aMorph fullBounds intersects: self viewBox) ifFalse:
[Beeper beep. aMorph position: self bounds center]]
ifFalse:[super acceptDroppingMorph: aMorph event: evt].
aMorph submorphsDo: [:m | (m isKindOf: HaloMorph) ifTrue: [m delete]].
aMorph allMorphsDo: "Establish any penDown morphs in new world"
[:m | | tfm mm |
m player ifNotNil:
[m player getPenDown ifTrue:
[((mm := m player costume) notNil and: [(tfm := mm owner transformFrom: self) notNil])
ifTrue: [self noteNewLocation: (tfm localPointToGlobal: mm referencePosition)
forPlayer: m player]]]].
self isPartsBin
ifTrue:
[aMorph isPartsDonor: true.
aMorph stopSteppingSelfAndSubmorphs.
aMorph suspendEventHandler]
ifFalse:
[self world startSteppingSubmorphsOf: aMorph].
" self presenter morph: aMorph droppedIntoPasteUpMorph: self."
self griddingOn ifTrue: [aMorph position: (self gridPoint: aMorph position)].
self showingListView ifTrue:
[self sortSubmorphsBy: (self valueOfProperty: #sortOrder).
self currentWorld abandonAllHalos].
self bringTopmostsToFront.
!
Eliot Miranda uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-eem.1072.mcz
==================== Summary ====================
Name: Kernel-eem.1072
Author: eem
Time: 23 March 2017, 6:27:21.701732 pm
UUID: ecabc689-68b4-45ec-9668-a39f089448d0
Ancestors: Kernel-eem.1071
Revert the mistaken fix to needsFrameSize:. It is not the perform:withArguments: context that needs a large frame, but its sender. The arguments are pushed in the sender's context, not the perform:withArguments: context, which doesn't exist at the point the primitive is invoked. If the primitive scceeds then the arguments are pushed on the context which is activated, which will /not/ be perform:withArguments:. If the primitive fails, the arguments will be popped off the stack of the sender's context back into the array.
In the Stack (and Cog) VM this is not an issue because there is ample headroom on stack pages. In a context interpreter the correct solution is to defer pushing the arguments until the new method has been found (which I think is the case anyway). In any case setting the large frame bit in perform:withArguments: is wrong. And if it were right, doing it only for perform:withArguments: and not for withArgs:evaluate:, valueWithArguments: and perform:inSuperclass:withArguments: is wrong too.
Add an argument count check to the inner simulated send machinery.
Nuke isPseudoContext; IIAC it's an obsolete remnant of the old jitter VM.
=============== Diff against Kernel-eem.1071 ===============
Item was changed:
----- Method: CompiledCode>>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
- + ( ((self numTemps + newFrameSize) > SmallFrame or: [ self primitive = 84 "perform:withArguments:"])
ifTrue: [largeFrameBit]
ifFalse: [0])!
Item was changed:
----- Method: ContextPart>>send:to:with:lookupIn: (in category 'controlling') -----
send: selector to: rcvr with: arguments lookupIn: lookupClass
"Simulate the action of sending a message with selector and arguments
to rcvr. The argument, lookupClass, is the class in which to lookup the
message. This is the receiver's class for normal messages, but for super
messages it will be some specific class related to the source method."
| meth primIndex val ctxt |
(meth := lookupClass lookupSelector: selector) ifNil:
[^self send: #doesNotUnderstand:
to: rcvr
with: {Message selector: selector arguments: arguments}
lookupIn: lookupClass].
+ meth numArgs ~= arguments size ifTrue:
+ [^self error: 'Wrong number of arguments in simulated message ', selector printString].
(primIndex := meth primitive) > 0 ifTrue:
[val := self doPrimitive: primIndex method: meth receiver: rcvr args: arguments.
(self isPrimFailToken: val) ifFalse:
[^val]].
(selector == #doesNotUnderstand: and: [lookupClass == ProtoObject]) ifTrue:
[^self error: 'Simulated message ', arguments first selector, ' not understood'].
ctxt := MethodContext sender: self receiver: rcvr method: meth arguments: arguments.
primIndex > 0 ifTrue:
[ctxt failPrimitiveWith: val].
^ctxt!
Item was removed:
- ----- Method: Object>>isPseudoContext (in category 'testing') -----
- isPseudoContext
- ^false!
Eliot Miranda uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-eem.748.mcz
==================== Summary ====================
Name: Tools-eem.748
Author: eem
Time: 23 March 2017, 6:24:29.602375 pm
UUID: af8cdeaa-0777-4ea9-88f3-d89a36ed3d10
Ancestors: Tools-ul.747
Nuke isPseudoCOntext from MethodFinder's approved method list. This class could really do with some love. There are lots of methods it excludes simply because it hasn't been updated.
=============== Diff against Tools-ul.747 ===============
Item was changed:
----- Method: MethodFinder>>initialize (in category 'initialize') -----
(excessive size, no diff calculated)
Eliot Miranda uploaded a new version of KernelTests to project The Trunk:
http://source.squeak.org/trunk/KernelTests-eem.323.mcz
==================== Summary ====================
Name: KernelTests-eem.323
Author: eem
Time: 23 March 2017, 6:22:49.201957 pm
UUID: 25f68fba-22e0-4b18-b3ac-b7ac720f3f81
Ancestors: KernelTests-eem.322
Move all the tests in and class comment of BlockContextTest into BlockClosureTest and nuke BlockContextTest.
Update CompiledMethodTest>>testNew to state that CompiledMehtod>>new /should/ be an error.
Update the context tests to use isCompiledMethod, isContext etc, and to drop use of isPseudoContext.
=============== Diff against KernelTests-eem.322 ===============
Item was changed:
TestCase subclass: #BlockClosureTest
+ instanceVariableNames: 'aBlockClosure homeOfABlockClosure'
- instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'KernelTests-Methods'!
+
+ !BlockClosureTest commentStamp: 'eem 3/23/2017 18:07' prior: 0!
+ I am an SUnit Test of BlockClosure and some of Context's simulation machinery'. See also MethodContextTest.
+
+ My fixtures are:
+ aBlockClosure - just some trivial block, i.e., [100@100 corner: 200@200].
+ homeOfABlockClosure - the home context of the block
+
+ NOTES ABOUT AUTOMATING USER INPUTS
+
+ When executing non-interactive programs you will inevitably run into programs (like SqueakMap or Monticello installation packages -- and other programs, to be fair) that require user input during their execution and these sort of problems shoot the whole non-interactiveness of your enclosing program.
+
+ BlockClosure helper methods have been made available and tests of these helpers are provided in this class to demonstrate that it can intercept PopUpMenu and FillInTheBlankMorph requests for user interaction. Of course, PopUpMenu and FillInTheBlankMorph were modified to first signal a ProvideAnswerNotification and if someone handles that (e.g. the enclosing block) then the user interaction will be circumvented and the provided answer of the enclosing block will be used. The basic syntax looks like:
+
+ [self confirm: 'Install spyware?'] valueSupplyingAnswer: #('Install spyware?' false)
+
+ There a few variants on this theme making it easy to provide a literal list of answers for the block so that you can handle a bunch of questions in a block with appropriate answers.
+
+ Additionally, it is possible to suppress Object>>inform: modal dialog boxes as these get in the way of automating anything. After applying this changeset you should be able to tryout the following code snippets to see the variants on this theme that are available.
+
+ Examples:
+
+ So you don't need any introduction here -- this one works like usual.
+ [self inform: 'hello'. #done] value.
+
+ Now let's suppress all inform: messages.
+ [self inform: 'hello'; inform: 'there'. #done] valueSuppressingAllMessages.
+
+ Here we can just suppress a single inform: message.
+ [self inform: 'hi'; inform: 'there'. #done] valueSuppressingMessages: #('there')
+
+ Here you see how you can suppress a list of messages.
+ [self inform: 'hi'; inform: 'there'; inform: 'bill'. #done] valueSuppressingMessages: #('hi' 'there')
+
+ Enough about inform:, let's look at confirm:. As you see this one works as expected.
+ [self confirm: 'You like Squeak?'] value
+
+ Let's supply answers to one of the questions -- check out the return value.
+ [{self confirm: 'You like Smalltalk?'. self confirm: 'You like Squeak?'}]
+ valueSupplyingAnswer: #('You like Smalltalk?' true)
+
+ Here we supply answers using only substrings of the questions (for simplicity).
+ [{self confirm: 'You like Squeak?'. self confirm: 'You like MVC?'}]
+ valueSupplyingAnswers: #( ('Squeak' true) ('MVC' false) )
+
+ This time let's answer all questions exactly the same way.
+ [{self confirm: 'You like Squeak?'. self confirm: 'You like Morphic?'}]
+ valueSupplyingAnswer: true
+
+ And, of course, we can answer FillInTheBlank questions in the same manner.
+ [FillInTheBlank request: 'What day is it?']
+ valueSupplyingAnswer: 'the first day of the rest of your life'
+
+ We can also return whatever the initialAnswer of the FillInTheBlank was by using the #default answer.
+ [FillInTheBlank request: 'What day is it?' initialAnswer: DateAndTime now dayOfWeekName]
+ valueSupplyingAnswer: #default
+
+ Finally, you can also do regex matches on any of the question text (or inform text) (should you have VB-Regex enhancements in your image).
+ [FillInTheBlank request: 'What day is it?']
+ valueSupplyingAnswers: { {'What day.*\?'. DateAndTime now dayOfWeekName} }
+
+ [Comment taken from BlockContextTest last written by jrp 10/17/2004 12:22]!
Item was added:
+ ----- Method: BlockClosureTest>>setUp (in category 'running') -----
+ setUp
+ super setUp.
+ aBlockClosure := [100@100 corner: 200@200].
+ homeOfABlockClosure := thisContext!
Item was added:
+ ----- Method: BlockClosureTest>>testDecompile (in category 'tests - printing') -----
+ testDecompile
+ self assert: ([3 + 4] decompile printString = '{[3 + 4]}')!
Item was added:
+ ----- Method: BlockClosureTest>>testNew (in category 'tests') -----
+ testNew
+ self should: [ContextPart new: 5] raise: Error.
+ [ContextPart new: 5]
+ on: Error do: [:e|
+ self assert: (e messageText includesSubstring: 'newForMethod:') description: 'Error doesn''t tell you what you did wrong by calling #new:'].
+
+ self should: [ContextPart new] raise: Error.
+ [ContextPart new]
+ on: Error do: [:e|
+ self assert: (e messageText includesSubstring: 'newForMethod:') description: 'Error doesn''t tell you what you did wrong by calling #new']!
Item was added:
+ ----- Method: BlockClosureTest>>testNoArguments (in category 'tests') -----
+ testNoArguments
+ [10
+ timesRepeat: [:arg | 1 + 2]]
+ ifError: [:err :rcvr | self deny: err = 'This block requires 1 arguments.'].
+ [10
+ timesRepeat: [:arg1 :arg2 | 1 + 2]]
+ ifError: [:err :rcvr | self deny: err = 'This block requires 2 arguments.']!
Item was added:
+ ----- Method: BlockClosureTest>>testOneArgument (in category 'tests') -----
+ testOneArgument
+ | c |
+ c := OrderedCollection new.
+ c add: 'hello'.
+ [c
+ do: [1 + 2]]
+ ifError: [:err :rcvr | self deny: err = 'This block requires 0 arguments.'].
+ [c
+ do: [:arg1 :arg2 | 1 + 2]]
+ ifError: [:err :rcvr | self deny: err = 'This block requires 2 arguments.']!
Item was added:
+ ----- Method: BlockClosureTest>>testRunSimulated (in category 'tests') -----
+ testRunSimulated
+ self assert: Rectangle equals: (ContextPart runSimulated: aBlockClosure asContext) class!
Item was added:
+ ----- Method: BlockClosureTest>>testSetUp (in category 'tests') -----
+ testSetUp
+ "Note: In addition to verifying that the setUp worked the way it was expected to, testSetUp is used to illustrate the meaning of the simple access methods, methods that are not normally otherwise 'tested'"
+ self deny: aBlockClosure isContext.
+ self assert: aBlockClosure isClosure.
+ self assert: aBlockClosure home = homeOfABlockClosure.
+ self assert: aBlockClosure receiver = self.
+ self assert: aBlockClosure method isCompiledMethod!
Item was added:
+ ----- Method: BlockClosureTest>>testSupplyAnswerOfFillInTheBlank (in category 'testing') -----
+ testSupplyAnswerOfFillInTheBlank
+
+ self should: ['blue' = ([UIManager default request: 'Your favorite color?']
+ valueSupplyingAnswer: #('Your favorite color?' 'blue'))]!
Item was added:
+ ----- Method: BlockClosureTest>>testSupplyAnswerOfFillInTheBlankUsingDefaultAnswer (in category 'testing') -----
+ testSupplyAnswerOfFillInTheBlankUsingDefaultAnswer
+
+ self should: ['red' = ([UIManager default request: 'Your favorite color?' initialAnswer: 'red']
+ valueSupplyingAnswer: #('Your favorite color?' #default))]!
Item was added:
+ ----- Method: BlockClosureTest>>testSupplyAnswerUsingOnlySubstringOfQuestion (in category 'tests') -----
+ testSupplyAnswerUsingOnlySubstringOfQuestion
+
+ self should: [false = ([self confirm: 'You like Smalltalk?']
+ valueSupplyingAnswer: #('like' false))]!
Item was added:
+ ----- Method: BlockClosureTest>>testSupplyAnswerUsingRegexMatchOfQuestion (in category 'tests') -----
+ testSupplyAnswerUsingRegexMatchOfQuestion
+
+ (String includesSelector: #matchesRegex:) ifFalse: [^ self].
+
+ self should: [true = ([self confirm: 'You like Smalltalk?']
+ valueSupplyingAnswer: #('.*Smalltalk\?' true))]!
Item was added:
+ ----- Method: BlockClosureTest>>testSupplySpecificAnswerToQuestion (in category 'tests') -----
+ testSupplySpecificAnswerToQuestion
+
+ self should: [false = ([self confirm: 'You like Smalltalk?']
+ valueSupplyingAnswer: #('You like Smalltalk?' false))]!
Item was added:
+ ----- Method: BlockClosureTest>>testSuppressInform (in category 'tests') -----
+ testSuppressInform
+
+ self should: [[nil inform: 'Should not see this message or this test failed!!'] valueSuppressingAllMessages isNil]!
Item was added:
+ ----- Method: BlockClosureTest>>testSuppressInformUsingStringMatchOptions (in category 'tests') -----
+ testSuppressInformUsingStringMatchOptions
+
+ self should: [([nil inform: 'Should not see this message or this test failed!!'] valueSuppressingMessages: #('Should not see this message or this test failed!!')) isNil].
+
+ self should: [([nil inform: 'Should not see this message or this test failed!!'] valueSuppressingMessages: #('not see this message')) isNil].
+
+ self should: [([nil inform: 'Should not see this message or this test failed!!'] valueSuppressingMessages: #('*message*failed#')) isNil]!
Item was added:
+ ----- Method: BlockClosureTest>>testTallyInstructions (in category 'tests') -----
+ testTallyInstructions
+ self assert: (ContextPart tallyInstructions: aBlockClosure asContext) size = 15!
Item was added:
+ ----- Method: BlockClosureTest>>testValueWithPossibleArgs (in category 'tests - evaluating') -----
+ testValueWithPossibleArgs
+ | block blockWithArg blockWith2Arg |
+
+ block := [1].
+ blockWithArg := [:arg | arg].
+ blockWith2Arg := [:arg1 :arg2 | {arg1. arg2}].
+
+ self assert: (block valueWithPossibleArgs: #()) = 1.
+ self assert: (block valueWithPossibleArgs: #(1)) = 1.
+
+ self assert: (blockWithArg valueWithPossibleArgs: #()) = nil.
+ self assert: (blockWithArg valueWithPossibleArgs: #(1)) = 1.
+ self assert: (blockWithArg valueWithPossibleArgs: #(1 2)) = 1.
+
+ self assert: (blockWith2Arg valueWithPossibleArgs: #()) = {nil .nil}.
+ self assert: (blockWith2Arg valueWithPossibleArgs: #(1)) = {1 . nil}.
+ self assert: (blockWith2Arg valueWithPossibleArgs: #(1 2)) = #(1 2).
+ self assert: (blockWith2Arg valueWithPossibleArgs: #(1 2 3)) = #(1 2)!
Item was added:
+ ----- Method: BlockClosureTest>>testValueWithPossibleArgument (in category 'tests - evaluating') -----
+ testValueWithPossibleArgument
+ | block blockWithArg blockWith2Arg |
+
+ block := [1].
+ blockWithArg := [:arg | arg].
+ blockWith2Arg := [:arg1 :arg2 | {arg1. arg2}].
+
+ self assert: (block valueWithPossibleArgument: 1) = 1.
+
+ self assert: (blockWithArg valueWithPossibleArgument: 1) = 1.
+
+ self assert: (blockWith2Arg valueWithPossibleArgument: 1) = {1 . nil}!
Item was removed:
- TestCase subclass: #BlockContextTest
- instanceVariableNames: 'aBlockContext contextOfaBlockContext'
- classVariableNames: ''
- poolDictionaries: ''
- category: 'KernelTests-Methods'!
-
- !BlockContextTest commentStamp: 'jrp 10/17/2004 12:22' prior: 0!
- I am an SUnit Test of BlockContext and its supertype ContextPart. See also MethodContextTest.
-
- My fixtures are:
- aBlockContext - just some trivial block, i.e., [100@100 corner: 200@200].
-
- NOTES ABOUT AUTOMATING USER INPUTS
-
- When executing non-interactive programs you will inevitably run into programs (like SqueakMap or Monticello installation packages -- and other programs, to be fair) that require user input during their execution and these sort of problems shoot the whole non-interactiveness of your enclosing program.
-
- BlockContext helper methods have been made available and tests of these helpers are provided in this class to demonstrate that it can intercept PopUpMenu and FillInTheBlankMorph requests for user interaction. Of course, PopUpMenu and FillInTheBlankMorph were modified to first signal a ProvideAnswerNotification and if someone handles that (e.g. the enclosing block) then the user interaction will be circumvented and the provided answer of the enclosing block will be used. The basic syntax looks like:
-
- [self confirm: 'Install spyware?'] valueSupplyingAnswer: #('Install spyware?' false)
-
- There a few variants on this theme making it easy to provide a literal list of answers for the block so that you can handle a bunch of questions in a block with appropriate answers.
-
- Additionally, it is possible to suppress Object>>inform: modal dialog boxes as these get in the way of automating anything. After applying this changeset you should be able to tryout the following code snippets to see the variants on this theme that are available.
-
- Examples:
-
- So you don't need any introduction here -- this one works like usual.
- [self inform: 'hello'. #done] value.
-
- Now let's suppress all inform: messages.
- [self inform: 'hello'; inform: 'there'. #done] valueSuppressingAllMessages.
-
- Here we can just suppress a single inform: message.
- [self inform: 'hi'; inform: 'there'. #done] valueSuppressingMessages: #('there')
-
- Here you see how you can suppress a list of messages.
- [self inform: 'hi'; inform: 'there'; inform: 'bill'. #done] valueSuppressingMessages: #('hi' 'there')
-
- Enough about inform:, let's look at confirm:. As you see this one works as expected.
- [self confirm: 'You like Squeak?'] value
-
- Let's supply answers to one of the questions -- check out the return value.
- [{self confirm: 'You like Smalltalk?'. self confirm: 'You like Squeak?'}]
- valueSupplyingAnswer: #('You like Smalltalk?' true)
-
- Here we supply answers using only substrings of the questions (for simplicity).
- [{self confirm: 'You like Squeak?'. self confirm: 'You like MVC?'}]
- valueSupplyingAnswers: #( ('Squeak' true) ('MVC' false) )
-
- This time let's answer all questions exactly the same way.
- [{self confirm: 'You like Squeak?'. self confirm: 'You like Morphic?'}]
- valueSupplyingAnswer: true
-
- And, of course, we can answer FillInTheBlank questions in the same manner.
- [FillInTheBlank request: 'What day is it?']
- valueSupplyingAnswer: 'the first day of the rest of your life'
-
- We can also return whatever the initialAnswer of the FillInTheBlank was by using the #default answer.
- [FillInTheBlank request: 'What day is it?' initialAnswer: DateAndTime now dayOfWeekName]
- valueSupplyingAnswer: #default
-
- Finally, you can also do regex matches on any of the question text (or inform text) (should you have VB-Regex enhancements in your image).
- [FillInTheBlank request: 'What day is it?']
- valueSupplyingAnswers: { {'What day.*\?'. DateAndTime now dayOfWeekName} }!
Item was removed:
- ----- Method: BlockContextTest>>setUp (in category 'running') -----
- setUp
- super setUp.
- aBlockContext := [100@100 corner: 200@200].
- contextOfaBlockContext := thisContext.!
Item was removed:
- ----- Method: BlockContextTest>>testDecompile (in category 'tests - printing') -----
- testDecompile
- self assert: ([3 + 4] decompile printString = '{[3 + 4]}').!
Item was removed:
- ----- Method: BlockContextTest>>testNew (in category 'tests') -----
- testNew
- self should: [ContextPart new: 5] raise: Error.
- [ContextPart new: 5]
- on: Error do: [:e|
- self assert: (e messageText includesSubstring: 'newForMethod:') description: 'Error doesn''t tell you what you did wrong by calling #new:'].
-
- self should: [ContextPart new] raise: Error.
- [ContextPart new]
- on: Error do: [:e|
- self assert: (e messageText includesSubstring: 'newForMethod:') description: 'Error doesn''t tell you what you did wrong by calling #new'].!
Item was removed:
- ----- Method: BlockContextTest>>testNoArguments (in category 'tests') -----
- testNoArguments
- [10
- timesRepeat: [:arg | 1 + 2]]
- ifError: [:err :rcvr | self deny: err = 'This block requires 1 arguments.'].
- [10
- timesRepeat: [:arg1 :arg2 | 1 + 2]]
- ifError: [:err :rcvr | self deny: err = 'This block requires 2 arguments.'] !
Item was removed:
- ----- Method: BlockContextTest>>testOneArgument (in category 'tests') -----
- testOneArgument
- | c |
- c := OrderedCollection new.
- c add: 'hello'.
- [c
- do: [1 + 2]]
- ifError: [:err :rcvr | self deny: err = 'This block requires 0 arguments.'].
- [c
- do: [:arg1 :arg2 | 1 + 2]]
- ifError: [:err :rcvr | self deny: err = 'This block requires 2 arguments.'] !
Item was removed:
- ----- Method: BlockContextTest>>testRunSimulated (in category 'tests') -----
- testRunSimulated
- self assert: Rectangle equals: (ContextPart runSimulated: aBlockContext) class.!
Item was removed:
- ----- Method: BlockContextTest>>testSetUp (in category 'tests') -----
- testSetUp
- "Note: In addition to verifying that the setUp worked the way it was expected to, testSetUp is used to illustrate the meaning of the simple access methods, methods that are not normally otherwise 'tested'"
- self deny: aBlockContext isMethodContext.
- self deny: aBlockContext isPseudoContext.
- self assert: aBlockContext home = contextOfaBlockContext.
- self assert: aBlockContext receiver = self.
- self assert: (aBlockContext method isKindOf: CompiledMethod).
- !
Item was removed:
- ----- Method: BlockContextTest>>testSupplyAnswerOfFillInTheBlank (in category 'testing') -----
- testSupplyAnswerOfFillInTheBlank
-
- self should: ['blue' = ([UIManager default request: 'Your favorite color?']
- valueSupplyingAnswer: #('Your favorite color?' 'blue'))]!
Item was removed:
- ----- Method: BlockContextTest>>testSupplyAnswerOfFillInTheBlankUsingDefaultAnswer (in category 'testing') -----
- testSupplyAnswerOfFillInTheBlankUsingDefaultAnswer
-
- self should: ['red' = ([UIManager default request: 'Your favorite color?' initialAnswer: 'red']
- valueSupplyingAnswer: #('Your favorite color?' #default))]!
Item was removed:
- ----- Method: BlockContextTest>>testSupplyAnswerUsingOnlySubstringOfQuestion (in category 'tests') -----
- testSupplyAnswerUsingOnlySubstringOfQuestion
-
- self should: [false = ([self confirm: 'You like Smalltalk?']
- valueSupplyingAnswer: #('like' false))]!
Item was removed:
- ----- Method: BlockContextTest>>testSupplyAnswerUsingRegexMatchOfQuestion (in category 'tests') -----
- testSupplyAnswerUsingRegexMatchOfQuestion
-
- (String includesSelector: #matchesRegex:) ifFalse: [^ self].
-
- self should: [true = ([self confirm: 'You like Smalltalk?']
- valueSupplyingAnswer: #('.*Smalltalk\?' true))]!
Item was removed:
- ----- Method: BlockContextTest>>testSupplySpecificAnswerToQuestion (in category 'tests') -----
- testSupplySpecificAnswerToQuestion
-
- self should: [false = ([self confirm: 'You like Smalltalk?']
- valueSupplyingAnswer: #('You like Smalltalk?' false))]!
Item was removed:
- ----- Method: BlockContextTest>>testSuppressInform (in category 'tests') -----
- testSuppressInform
-
- self should: [[nil inform: 'Should not see this message or this test failed!!'] valueSuppressingAllMessages isNil]!
Item was removed:
- ----- Method: BlockContextTest>>testSuppressInformUsingStringMatchOptions (in category 'tests') -----
- testSuppressInformUsingStringMatchOptions
-
- self should: [([nil inform: 'Should not see this message or this test failed!!'] valueSuppressingMessages: #('Should not see this message or this test failed!!')) isNil].
-
- self should: [([nil inform: 'Should not see this message or this test failed!!'] valueSuppressingMessages: #('not see this message')) isNil].
-
- self should: [([nil inform: 'Should not see this message or this test failed!!'] valueSuppressingMessages: #('*message*failed#')) isNil].
- !
Item was removed:
- ----- Method: BlockContextTest>>testTallyInstructions (in category 'tests') -----
- testTallyInstructions
- self assert: (ContextPart tallyInstructions: aBlockContext) size = 15.!
Item was removed:
- ----- Method: BlockContextTest>>testValueWithPossibleArgs (in category 'tests - evaluating') -----
- testValueWithPossibleArgs
- | block blockWithArg blockWith2Arg |
-
- block := [1].
- blockWithArg := [:arg | arg].
- blockWith2Arg := [:arg1 :arg2 | {arg1. arg2}].
-
- self assert: (block valueWithPossibleArgs: #()) = 1.
- self assert: (block valueWithPossibleArgs: #(1)) = 1.
-
- self assert: (blockWithArg valueWithPossibleArgs: #()) = nil.
- self assert: (blockWithArg valueWithPossibleArgs: #(1)) = 1.
- self assert: (blockWithArg valueWithPossibleArgs: #(1 2)) = 1.
-
- self assert: (blockWith2Arg valueWithPossibleArgs: #()) = {nil .nil}.
- self assert: (blockWith2Arg valueWithPossibleArgs: #(1)) = {1 . nil}.
- self assert: (blockWith2Arg valueWithPossibleArgs: #(1 2)) = #(1 2).
- self assert: (blockWith2Arg valueWithPossibleArgs: #(1 2 3)) = #(1 2).
-
-
- !
Item was removed:
- ----- Method: BlockContextTest>>testValueWithPossibleArgument (in category 'tests - evaluating') -----
- testValueWithPossibleArgument
- | block blockWithArg blockWith2Arg |
-
- block := [1].
- blockWithArg := [:arg | arg].
- blockWith2Arg := [:arg1 :arg2 | {arg1. arg2}].
-
- self assert: (block valueWithPossibleArgument: 1) = 1.
-
- self assert: (blockWithArg valueWithPossibleArgument: 1) = 1.
-
- self assert: (blockWith2Arg valueWithPossibleArgument: 1) = {1 . nil}.
-
-
- !
Item was added:
+ ----- Method: CompiledMethodTest>>testNew (in category 'tests') -----
+ testNew
+ "This /should/ throw an exception."
+ self should: [self targetClass new] raise: Error!
Item was changed:
----- Method: MethodContextTest>>testMethodContext (in category 'tests') -----
testMethodContext
- self deny: aMethodContext isPseudoContext.
self assert: aMethodContext home notNil.
self assert: aMethodContext receiver notNil.
+ self assert: aMethodContext method isCompiledMethod.!
- self assert: (aMethodContext method isKindOf: CompiledMethod).!
Item was changed:
----- Method: MethodContextTest>>testSetUp (in category 'tests') -----
testSetUp
"Note: In addition to verifying that the setUp worked the way it was expected to, testSetUp is used to illustrate the meaning of the simple access methods, methods that are not normally otherwise 'tested'"
+ self assert: aMethodContext isContext.
self assert: aMethodContext isMethodContext.
self deny: aMethodContext isClosure.
- self deny: aMethodContext isPseudoContext.
self deny: aMethodContext isDead.
"self assert: aMethodContext home = aReceiver."
"self assert: aMethodContext blockHome = aReceiver."
self assert: aMethodContext receiver = aReceiver.
+ self assert: aMethodContext method isCompiledMethod.
- self assert: (aMethodContext method isKindOf: CompiledMethod).
self assert: aMethodContext method = aCompiledMethod.
self assert: aMethodContext methodNode selector = #rightCenter.
self assert: (aMethodContext methodNodeFormattedAndDecorated: true) selector = #rightCenter.
self assert: aMethodContext client printString = 'MethodContextTest>>#testSetUp'.
!
Eliot Miranda uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-eem.1071.mcz
==================== Summary ====================
Name: Kernel-eem.1071
Author: eem
Time: 23 March 2017, 2:36:33.164059 pm
UUID: afff36e4-2c12-45fc-8f45-519d1970e44a
Ancestors: Kernel-eem.1070
Update CompiledCode's class comment with more accurate description of bit 16, and add the accessors for it.
=============== Diff against Kernel-eem.1070 ===============
Item was changed:
ByteArray variableByteSubclass: #CompiledCode
instanceVariableNames: ''
classVariableNames: 'LargeFrame PrimaryBytecodeSetEncoderClass SecondaryBytecodeSetEncoderClass SmallFrame'
poolDictionaries: ''
category: 'Kernel-Methods'!
+ !CompiledCode commentStamp: 'eem 3/23/2017 14:33' prior: 0!
- !CompiledCode commentStamp: 'eem 3/22/2017 12:14' prior: 0!
CompiledCode instances are methods suitable for execution by the virtual machine. Instances of CompiledCode and its subclasses are the only objects in the system that have both indexable pointer fields and indexable 8-bit integer fields. The first part of a CompiledCode object is pointers, the second part is bytes. CompiledCode inherits from ByteArray to avoid duplicating some of ByteArray's methods, not because a CompiledCode is-a ByteArray.
Instance variables: *indexed* (no named inst vars)
Class variables:
SmallFrame - the number of stack slots in a small frame Context
LargeFrame - the number of stack slots in a large frame Context
PrimaryBytecodeSetEncoderClass - the encoder class that defines the primary instruction set
SecondaryBytecodeSetEncoderClass - the encoder class that defines the secondary instruction set
The current format of a CompiledCode object is as follows:
header (4 or 8 bytes, SmallInteger)
literals (4 or 8 bytes each, Object, see "The last literal..." below)
bytecodes (variable, bytes)
trailer (variable, bytes)
The header is a SmallInteger (which in the 32-bit system has 31 bits, and in the 64-bit system, 61 bits) in the following format:
(index 0) 15 bits: number of literals (#numLiterals)
+ (index 15) 1 bit: jit without counters - reserved for methods that have been optimized by Sista
- (index 15) 1 bit: is optimized - reserved for methods that have been optimized by Sista
(index 16) 1 bit: has primitive
(index 17) 1 bit: whether a large frame size is needed (#frameSize => either SmallFrame or LargeFrame)
(index 18) 6 bits: number of temporary variables (#numTemps)
(index 24) 4 bits: number of arguments to the method (#numArgs)
(index 28) 2 bits: reserved for an access modifier (00-unused, 01-private, 10-protected, 11-public), although accessors for bit 29 exist (see #flag).
sign bit: 1 bit: selects the instruction set, >= 0 Primary, < 0 Secondary (#signFlag)
If the method has a primitive then the first bytecode of the method must be a callPrimitive: bytecode that encodes the primitive index. This bytecode can encode a primitive index from 0 to 65535.
The trailer is an encoding of an instance of CompiledMethodTrailer. It is typically used to encode the index into the source files array of the method's source, but may be used to encode other values, e.g. tempNames, source as a string, etc. See the class CompiledMethodTrailer.
While there are disadvantages to this "flat" representation (it is impossible to add named instance variables to CompiledCode or its subclasses, but it is possible indirectly; see AdditionalMethodState) it is effective for interpreters. It means that both bytecodes and literals can be fetched directly from a single method object, and that only one object, the method, must be saved and restored on activation and return. A more natural representation, in which there are searate instance variables for the bytecode, and (conveniently) the literals, requires either much more work on activation and return setting up references to the literals and bytecodes, or slower access to bytecodes and literals, indirecting on each access.
The last literal of a CompiledCode object is reserved for special use by the kernel and/or the virtual machine. In CompiledMethod instances it must either be the methodClassAssociation, used to implement super sends, or nil, if the method is anonymous. In CompiledBlock it is to be used for a reference to the enclosing method or block object.
By convention, the penultimate literal is reserved for special use by the kernel. CompiledMethod instances it must either be the method selector, or an instance of AdditionalMethodState which holds the selector and any pragmas or properties in the method. In CompiledBlock it is reserved for use for an AdditionalMethodState.
Note that super sends in CompiledBlock instances do not use a methodClass association, but expect a directed supersend bytecode, in which the method class (the subclass of the class in which to start the lookup) is a literal. Logically when we switch to a bytecode set that supports the directed super send bytecode, and discard the old super send bytecodes, we can use the last literal to store the selector or the enclosing method/block or an AdditionalMethodState, and the AdditionalMethodState can hold the selector and/or the enclosing method/block.!
Item was added:
+ ----- Method: CompiledCode>>hasNoCountersFlag (in category 'accessing') -----
+ hasNoCountersFlag
+ "The Cog Sista VMs interpret bit 16 of the method header as suppressing the generation of performance counters."
+ ^self header anyMask: 16r8000!
Item was added:
+ ----- Method: CompiledCode>>setHasNoCountersFlag (in category 'accessing') -----
+ setHasNoCountersFlag
+ "The Cog Sista VMs interpret bit 16 of the method header as suppressing the generation of performance counters."
+ self objectAt: 1 put: (self header bitOr: 16r8000)!
Eliot Miranda uploaded a new version of EToys to project The Trunk:
http://source.squeak.org/trunk/EToys-eem.287.mcz
==================== Summary ====================
Name: EToys-eem.287
Author: eem
Time: 23 March 2017, 11:36:34.533149 am
UUID: 530c827e-a23a-4fa8-94f9-2854080179aa
Ancestors: EToys-edc.286
Stop Etoys from depending on hasNewPropertyFormat (and apologies for getting the commit order right; this should have been committed earlier).
=============== Diff against EToys-edc.286 ===============
Item was changed:
----- Method: CompiledMethod>>who (in category '*Etoys-Squeakland-printing') -----
who
"Answer an Array of the class in which the receiver is defined and the
+ selector to which it corresponds."
- selector to which it corresponds."
+ ^{self methodClass ifNil: [#unknown]. self selector ifNil: [#unknown]}!
- self hasNewPropertyFormat ifTrue:[^{self methodClass. self selector}].
- self systemNavigation allBehaviorsDo:
- [:class |
- (class methodDict keyAtIdentityValue: self ifAbsent: [nil]) ifNotNilDo:
- [:sel| ^Array with: class with: sel]].
- ^Array with: #unknown with: #unknown!
Eliot Miranda uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-eem.1070.mcz
==================== Summary ====================
Name: Kernel-eem.1070
Author: eem
Time: 23 March 2017, 11:32:43.949379 am
UUID: 1b8bfbce-9034-46cb-9ac9-631f9d57ae80
Ancestors: Kernel-eem.1069
Move some source and decompilation related methods up from CompiledMethod to CompiledCode. provide method on CompiledCode to allow simple forwarding to the CompiledMehtod from CompiledBlock via outerCode.
Correct a comment.
=============== Diff against Kernel-eem.1069 ===============
Item was added:
+ ----- Method: CompiledCode>>decompile (in category 'decompiling') -----
+ decompile
+ "Return the decompiled parse tree that represents self"
+
+ | class selector |
+ class := self methodClass ifNil: [Object].
+ selector := self selector ifNil: [self defaultSelector].
+ ^class decompilerClass new decompile: selector in: class method: self methodForDecompile!
Item was added:
+ ----- Method: CompiledCode>>decompileWithTemps (in category 'decompiling') -----
+ decompileWithTemps
+ "Answer the decompiled parse tree that represents self, but with the temp names obtained
+ either by compiling the source code, or directly if the method has temps in its trailer."
+
+ ^self method decompileWithTemps!
Item was added:
+ ----- Method: CompiledCode>>getSource (in category 'source code management') -----
+ getSource
+ ^ self getSourceFor: self selector in:self methodClass.!
Item was added:
+ ----- Method: CompiledCode>>getSourceFor:in: (in category 'source code management') -----
+ getSourceFor: selector in: class
+ "Retrieve or reconstruct the source code for this method."
+
+ ^self method getSourceFor: selector in: class!
Item was added:
+ ----- Method: CompiledCode>>method (in category 'accessing') -----
+ method
+ "Answer the home method associated with the receiver."
+
+ ^self subclassResponsibility!
Item was added:
+ ----- Method: CompiledCode>>printReferenceOn: (in category 'printing') -----
+ printReferenceOn: aStream
+ "Print a string that can be used to access the currently installed method."
+ aStream print: self methodClass;
+ nextPutAll: '>>';
+ nextPutAll: self selector storeString!
Item was added:
+ ----- Method: CompiledCode>>printSignatureOn: (in category 'printing') -----
+ printSignatureOn: aStream
+ "Print a string that can be used to access the currently installed method."
+ aStream print: self methodClass;
+ nextPutAll: '>>';
+ nextPutAll: self selector storeString!
Item was added:
+ ----- Method: CompiledCode>>selector (in category 'accessing') -----
+ selector
+ ^self subclassResponsibility!
Item was removed:
- ----- Method: CompiledMethod>>decompile (in category 'decompiling') -----
- decompile
- "Return the decompiled parse tree that represents self"
-
- | class selector |
- class := self methodClass ifNil: [Object].
- selector := self selector ifNil: [self defaultSelector].
- ^class decompilerClass new decompile: selector in: class method: self methodForDecompile!
Item was removed:
- ----- Method: CompiledMethod>>getSource (in category 'source code management') -----
- getSource
- ^ self getSourceFor: self selector in:self methodClass.!
Item was added:
+ ----- Method: CompiledMethod>>method (in category 'accessing') -----
+ method
+ "Answer the home method associated with the receiver.
+ This is polymorphic with closure, CompiledBlock, Context etc"
+
+ ^self!
Item was removed:
- ----- Method: CompiledMethod>>printReferenceOn: (in category 'printing') -----
- printReferenceOn: aStream
- "Print a string that can be used to access the currently installed method."
- aStream print: self methodClass;
- nextPutAll: '>>';
- nextPutAll: self selector storeString!
Item was removed:
- ----- Method: CompiledMethod>>printSignatureOn: (in category 'printing') -----
- printSignatureOn: aStream
- "Print a string that can be used to access the currently installed method."
- aStream print: self methodClass;
- nextPutAll: '>>';
- nextPutAll: self selector storeString!
Item was changed:
----- Method: CompiledMethod>>selector (in category 'accessing') -----
selector
"Answer a method's selector. This is either the penultimate literal,
or, if the method has any properties or pragmas, the selector of
+ the AdditionalMethodState stored in the penultimate literal."
- the MethodProperties stored in the penultimate literal."
| penultimateLiteral |
^(penultimateLiteral := self penultimateLiteral) isMethodProperties
ifTrue: [penultimateLiteral selector]
ifFalse: [penultimateLiteral]!