[squeak-dev] The Inbox: Kernel-ct.1359.mcz

Thiede, Christoph Christoph.Thiede at student.hpi.uni-potsdam.de
Fri Nov 20 12:30:12 UTC 2020


Hi Eliot,


I just noticed your request right now only, apparently Marcel has already done the work.


I am never sure about reparenting my proposals' diffs to the original ancestor versus forming my own implicit branch of deltas. The former can be compared more easier to the Trunk, the latter is more helpful to watch how a proposal evolves over time ... This has been discussed a lot of times, ending up with identifying an insufficient tool infrastructure for this domain (at least IMHO). If it's easier for the merger, I will try to use the Reparent button more often, but still, it's an imperfect solution for me. :-)


Best,

Christoph

<http://www.hpi.de/>
________________________________
Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von Eliot Miranda <eliot.miranda at gmail.com>
Gesendet: Sonntag, 1. November 2020 20:02:19
An: The general-purpose Squeak developers list
Betreff: Re: [squeak-dev] The Inbox: Kernel-ct.1359.mcz

Hi Christoph,

    can you please submit a merge of your changes here with Kernel-eem.1359 and then we can move your contribution to trunk.  Always submitting deltas to other inbox versions means one of us has to merge and that could be perceived as a little passive aggressive ;-).

On Sun, Nov 1, 2020 at 10:51 AM <commits at source.squeak.org<mailto:commits at source.squeak.org>> wrote:
A new version of Kernel was added to project The Inbox:
http://source.squeak.org/inbox/Kernel-ct.1359.mcz

==================== Summary ====================

Name: Kernel-ct.1359
Author: ct
Time: 1 November 2020, 7:50:24.183428 pm
UUID: 3b12b316-79f3-de41-8765-8296d964b821
Ancestors: Kernel-mt.1353

Revise and extend Context #runSimulated: implementation. Remove restriction to blocks that do not have a method return. Add support for exception signaling during the execution, which caused unterminated simulation of the calling process in the past. Support argless contextAtEachStep blocks.

Benchmarks:
        code:
                [Context runSimulated: [100 at 100 corner: 200 at 200]] bench
        before:
                16.7 ms/run
        after:
                19.8 ms/run
I think this should be okay, given the fact that the primary purpose of simulation is providing explorability but not efficiency ...

=============== Diff against Kernel-mt.1353 ===============

Item was changed:
  ----- Method: Context class>>runSimulated: (in category 'simulation') -----
  runSimulated: aBlock
+       "Simulate the execution of aBlock, until it ends or is curtailed. Answer the result it returns."
-       "Simulate the execution of the argument, current. Answer the result it
-       returns."

        ^ thisContext sender
                runSimulated: aBlock
+               contextAtEachStep: []
-               contextAtEachStep: [:ignored]

        "Context runSimulated: [Pen new defaultNib: 5; go: 100]"!

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.
- runSimulated: aBlock contextAtEachStep: block2
-       "Simulate the execution of the argument, aBlock, until it ends. aBlock
-       MUST NOT contain an '^'. Evaluate block2 with the current context
-       prior to each instruction executed. Answer the simulated value of aBlock."
-       | current |
-       aBlock hasMethodReturn
-               ifTrue: [self error: 'simulation of blocks with ^ can run loose'].
        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]]]   ])
-       current pushArgs: Array new from: self.
-       [current == self]
                whileFalse:
+                       [anotherBlock cull: current.
-                       [block2 value: current.
                        current := current step].
+
+       ^ current jump!
-       ^self pop!




--
_,,,^..^,,,_
best, Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20201120/15f37e55/attachment.html>


More information about the Squeak-dev mailing list