Nicolas Cellier uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-nice.1390.mcz ==================== Summary ==================== Name: Kernel-nice.1390 Author: nice Time: 19 April 2021, 6:37:54.360183 pm UUID: 3ba56195-f0d4-454c-b3f7-d07e1eadcad7 Ancestors: Kernel-nice.1389 Fixes regression in Context >> #runSimulated:contextAtEachStep: when the message is sent to something else than thisContext. This happens when tallying sends (see MessageTally class >> #tallySendsTo:inBlock:showTree: ) This commit integrates the change poposed in: https://source.squeak.org/treated/Kernel-ct.1363.diff which was a commented version of: https://source.squeak.org/treated/Kernel-ct.1362.diff Thanks Christoph for the fix! Also implement #asContextWithSender: in Context so that testRunSimulatedContextAtEachStep continues to work. Thanks Jaromir for the suggestion. =============== Diff against Kernel-nice.1389 =============== Item was added: + ----- Method: Context>>asContextWithSender: (in category 'closure support') ----- + asContextWithSender: aContext + self privSender: aContext. + ^ self! Item was changed: ----- Method: Context>>runSimulated:contextAtEachStep: (in category 'system simulation') ----- runSimulated: aBlock contextAtEachStep: anotherBlock "Simulate the execution of the argument, aBlock, until it ends or is curtailed. If any exception is signaled during the execution, simulate it being handled on the present caller stack. Evaluate anotherBlock with the current context prior to each instruction executed. Answer the simulated value of aBlock." | current resume ensure | resume := false. + "Affect the context stack of the receiver during the simulation of aBlock." + current := aBlock asContextWithSender: self. + "Insert outer context denoting the end of the simulation." + ensure := (ensure := current) insertSender: (Context contextEnsure: + [resume := true. + ensure privSender: thisContext home sender]). - current := aBlock asContext. - ensure := current insertSender: (Context contextEnsure: [resume := true]). - ensure sender ifNil: [ensure privSender: self]. "For backward compatibility, do not fail if aBlock is dead." (anotherBlock numArgs = 0 ifTrue: ["optimized" [resume]] ifFalse: ["stop execution on time, don't expose simulation details to caller" [current == ensure or: ["Context >> #resume:" current size >= 2 and: [(current at: 2) == ensure]]] ]) whileFalse: [anotherBlock cull: current. current := current step]. + "Continue with the execution in the previous context." ^ current jump! |
Von: Squeak-dev <[hidden email]> im Auftrag von [hidden email] <[hidden email]>
Gesendet: Montag, 19. April 2021 18:38:08 An: [hidden email]; [hidden email] Betreff: [squeak-dev] The Trunk: Kernel-nice.1390.mcz Nicolas Cellier uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-nice.1390.mcz ==================== Summary ==================== Name: Kernel-nice.1390 Author: nice Time: 19 April 2021, 6:37:54.360183 pm UUID: 3ba56195-f0d4-454c-b3f7-d07e1eadcad7 Ancestors: Kernel-nice.1389 Fixes regression in Context >> #runSimulated:contextAtEachStep: when the message is sent to something else than thisContext. This happens when tallying sends (see MessageTally class >> #tallySendsTo:inBlock:showTree: ) This commit integrates the change poposed in: https://source.squeak.org/treated/Kernel-ct.1363.diff which was a commented version of: https://source.squeak.org/treated/Kernel-ct.1362.diff Thanks Christoph for the fix! Also implement #asContextWithSender: in Context so that testRunSimulatedContextAtEachStep continues to work. Thanks Jaromir for the suggestion. =============== Diff against Kernel-nice.1389 =============== Item was added: + ----- Method: Context>>asContextWithSender: (in category 'closure support') ----- + asContextWithSender: aContext + self privSender: aContext. + ^ self! Item was changed: ----- Method: Context>>runSimulated:contextAtEachStep: (in category 'system simulation') ----- runSimulated: aBlock contextAtEachStep: anotherBlock "Simulate the execution of the argument, aBlock, until it ends or is curtailed. If any exception is signaled during the execution, simulate it being handled on the present caller stack. Evaluate anotherBlock with the current context prior to each instruction executed. Answer the simulated value of aBlock." | current resume ensure | resume := false. + "Affect the context stack of the receiver during the simulation of aBlock." + current := aBlock asContextWithSender: self. + "Insert outer context denoting the end of the simulation." + ensure := (ensure := current) insertSender: (Context contextEnsure: + [resume := true. + ensure privSender: thisContext home sender]). - current := aBlock asContext. - ensure := current insertSender: (Context contextEnsure: [resume := true]). - ensure sender ifNil: [ensure privSender: self]. "For backward compatibility, do not fail if aBlock is dead." (anotherBlock numArgs = 0 ifTrue: ["optimized" [resume]] ifFalse: ["stop execution on time, don't expose simulation details to caller" [current == ensure or: ["Context >> #resume:" current size >= 2 and: [(current at: 2) == ensure]]] ]) whileFalse: [anotherBlock cull: current. current := current step]. + "Continue with the execution in the previous context." ^ current jump!
Carpe Squeak!
|
Free forum by Nabble | Edit this page |