The Inbox: Kernel-ct.1363.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: Kernel-ct.1363.mcz

commits-2
A new version of Kernel was added to project The Inbox:
http://source.squeak.org/inbox/Kernel-ct.1363.mcz

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

Name: Kernel-ct.1363
Author: ct
Time: 7 November 2020, 1:48:48.562191 pm
UUID: 9c029a9b-8356-ad4f-8a0c-dc984dc4573c
Ancestors: Kernel-ct.1362

Refactor and comment Context >> #runSimulated:contextAtEachStep: per request.

Branch commit, depends on Kernel-ct.1362 indeed.

=============== Diff against Kernel-ct.1362 ===============

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:
- current := aBlock asContext.
- current privSender: self.
- ensure := current insertSender: (Context contextEnsure:
  [resume := true.
  ensure privSender: thisContext home sender]).
 
  (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!