Marcel Taeumel uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-mt.1253.mcz
==================== Summary ====================
Name: System-mt.1253
Author: mt
Time: 25 November 2021, 2:32:49.237354 pm
UUID: 6ef62b9e-a8df-614a-b378-4c876e2d16a8
Ancestors: System-ct.1252
Complements Morphic-mt.1802.
Here is the original comment, I forgot to append to 1802:
This changeset complements the refactoring from System-mt.1240 intended to decouple the base system from Shout. In various places, there were still hard-coded references to SHTextStylerST80 that did not use the new TextStyler abstraction. These accesses are redirected correctly with this changeset. Furthermore, the TextStyler interface is updated to not automatically set a styler if it has been set to nil manually. This makes it possible to opt-out to styling via ShoutCore-ct.88.
=============== Diff against System-ct.1252 ===============
Item was changed:
----- Method: AppRegistry class>>default (in category 'accessing') -----
default
+ "Maybe interactive. Answer the default app in this registry. Ask the user for a new default if none was set."
+
^ default ifNil: [self askForDefault]!
Item was changed:
----- Method: TextStyler class>>default (in category 'accessing - Smalltalk') -----
default
+ "Overwritten to lookup a styler for #Smalltalk syntax. See #defaultFor:. Maybe interactive."
^ self defaultFor: #Smalltalk!
Item was changed:
----- Method: TextStyler class>>defaultFor: (in category 'accessing') -----
defaultFor: syntax
+ "Syntax-specifc version of #default. Still maybe interactive. Answer the default styler for syntax. Ask the user for a new default if no styler was set."
^ default
at: syntax
ifAbsent: [self askForDefaultFor: syntax]!
Christoph Thiede uploaded a new version of Kernel to project The Treated Inbox:
http://source.squeak.org/treated/Kernel-ct.1339.mcz
==================== Summary ====================
Name: Kernel-ct.1339
Author: ct
Time: 4 September 2020, 9:09:14.713421 pm
UUID: edc35a82-ce03-014c-85de-13d68c7fc46f
Ancestors: Kernel-ct.1338
Implement missing simulation of objects as methods.
In the past, it was not possible to debug/simulate code that used objects as methods properly. (Thanks to Marcel for the hint!) This very simple commit adds support of the OaM protocol [1] to the simulation machinery. Now you can debug all tests in TestObjectsAsMethods as you would expect, instead of crashing your image!
Update: Uploaded again, this time with additional documentation comment, reformatted code, and multilingual support/fix of typös. Replaces Kernel-ct.1306, which can be moved to the treated inbox.
[1] "The [Objects as Methods] contract is that, when the VM encounters an ordinary object (rather than a compiled method) in the method dictionary during lookup, it sends it the special selector #run:with:in: providing the original selector, arguments, and receiver.". DOI: 10.1145/2991041.2991062.
=============== Diff against Kernel-ct.1338 ===============
Item was changed:
----- Method: Context>>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."
- "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) lookupClass: lookupClass}
+ lookupIn: lookupClass].
+
+ meth isCompiledMethod ifFalse: [
+ "Object as Methods (OaM) protocol: 'The contract is that, when the VM encounters an ordinary object (rather than a compiled method) in the method dictionary during lookup, it sends it the special selector #run:with:in: providing the original selector, arguments, and receiver.'. DOI: 10.1145/2991041.2991062."
+ ^ self send: #run:with:in:
+ to: meth
+ with: {selector. arguments. rcvr}].
+
+ meth numArgs ~= arguments size ifTrue: [
+ ^ self error: ('Wrong number of arguments in simulated message {1}' translated format: {selector})].
+ (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 {1} not understood' translated format: {arguments first selector})].
+
- (meth := lookupClass lookupSelector: selector) ifNil:
- [^self send: #doesNotUnderstand:
- to: rcvr
- with: {(Message selector: selector arguments: arguments) lookupClass: lookupClass}
- 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 := Context sender: self receiver: rcvr method: meth arguments: arguments.
+ (primIndex notNil and: [primIndex > 0]) ifTrue: [
+ ctxt failPrimitiveWith: val].
+
+ ^ ctxt!
- primIndex > 0 ifTrue:
- [ctxt failPrimitiveWith: val].
- ^ctxt!
Christoph Thiede uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-ct.1358.mcz
==================== Summary ====================
Name: Kernel-ct.1358
Author: ct
Time: 28 October 2020, 11:37:24.817544 pm
UUID: c9af6acb-61cf-af42-b5fa-3afa8451bb24
Ancestors: Kernel-mt.1353
Fixes a simulation bug that occurs when executing ProtoObject >> #doesNotUnderstand:. See KernelTests-ct.388.
=============== Diff against Kernel-mt.1353 ===============
Item was changed:
----- Method: Context>>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:
+ [selector == #doesNotUnderstand: ifTrue:
+ [self error: ('Simulated message {1} not understood' translated format: {selector})].
+ ^self send: #doesNotUnderstand:
- [^self send: #doesNotUnderstand:
to: rcvr
with: {(Message selector: selector arguments: arguments) lookupClass: lookupClass}
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 := Context sender: self receiver: rcvr method: meth arguments: arguments.
primIndex > 0 ifTrue:
[ctxt failPrimitiveWith: val].
^ctxt!
Christoph Thiede uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-ct.1425.mcz
==================== Summary ====================
Name: Kernel-ct.1425
Author: ct
Time: 25 November 2021, 12:09:56.072633 pm
UUID: 79791158-a822-1642-ade5-514751d0a407
Ancestors: Kernel-ct.1358, Kernel-mt.1424
Fixes simulation of sending #doesNotUnderstand:. See ContextTest >> #testRecursiveMessageNotUnderstood (KernelTests-ct.410).
This revises the implementation from Kernel-eem.1359 which still caused a superfluous simulator error even before #doesNotUnderstand: could arrive at ProtoObject. Also, we now do not hard-code #ProtoObject any longer in the simulator.
Merges Kernel-ct.1358.
=============== Diff against Kernel-mt.1424 ===============
Item was changed:
----- Method: Context>>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:
[selector == #doesNotUnderstand: ifTrue:
[self error: 'Recursive message not understood!!' translated].
^self send: #doesNotUnderstand:
to: rcvr
with: {(Message selector: selector arguments: arguments) lookupClass: lookupClass}
lookupIn: lookupClass].
meth isCompiledMethod ifFalse:
["Object as Methods (OaM) protocol: 'The contract is that, when the VM encounters an ordinary object (rather than a compiled method) in the method dictionary during lookup, it sends it the special selector #run:with:in: providing the original selector, arguments, and receiver.'. DOI: 10.1145/2991041.2991062."
^self send: #run:with:in:
to: meth
with: {selector. arguments. rcvr}].
meth numArgs = arguments size ifFalse:
[^ self error: ('Wrong number of arguments in simulated message {1}' translated format: {selector})].
(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 {1} not understood' translated format: {arguments first selector})].
-
ctxt := Context sender: self receiver: rcvr method: meth arguments: arguments.
(primIndex isInteger and: [primIndex > 0]) ifTrue:
[ctxt failPrimitiveWith: val].
^ctxt!
Christoph Thiede uploaded a new version of KernelTests to project The Trunk:
http://source.squeak.org/trunk/KernelTests-ct.410.mcz
==================== Summary ====================
Name: KernelTests-ct.410
Author: ct
Time: 25 November 2021, 11:57:10.610633 am
UUID: 38dd07bd-928a-a24f-b3d3-eab992734a0a
Ancestors: KernelTests-mt.408, KernelTests-ct.388
Merges and revises KernelTests-ct.388 (simulator tests for #doesNotUnderstand:).
=============== Diff against KernelTests-mt.408 ===============
Item was added:
+ ----- Method: ContextTest>>testMessageNotUnderstood (in category 'tests') -----
+ testMessageNotUnderstood
+
+ "A simulation error (recursive message not understood) occurs that cannot be handled by the simulated code"
+ self
+ should:
+ [Context runSimulated:
+ [[TestEmptyClass new foo]
+ on: Error do: [:ex | ex]]]
+ raise: Error.
+
+ "The simulator sends #doesNotUnderstand: to the receiver even if the lookup class has no superclass."
+ self assert:
+ [Context runSimulated:
+ [self
+ executeShould: [ProtoObject new foo]
+ inScopeOf: MessageNotUnderstood]].
+ self assert:
+ [Context runSimulated:
+ [self
+ executeShould: [Compiler evaluate: 'super foo' for: Object new]
+ inScopeOf: MessageNotUnderstood]].!
Item was added:
+ nil subclass: #TestEmptyClass
+ instanceVariableNames: ''
+ classVariableNames: ''
+ poolDictionaries: ''
+ category: 'KernelTests-Methods'!
+
+ !TestEmptyClass commentStamp: 'ct 11/25/2021 11:49' prior: 0!
+ I do not even understand #doesNotUnderstand:!! Sending any non-inlined message to me should crash the executor.!