[squeak-dev] The Inbox: Kernel-ct.1359.mcz
Eliot Miranda
eliot.miranda at gmail.com
Sun Nov 1 19:02:19 UTC 2020
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> 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/20201101/c8b635f4/attachment.html>
More information about the Squeak-dev
mailing list
|