Commit Graph

1451 Commits

Author SHA1 Message Date
Tony Garnock-Jones ca67f9405f Easy access to profiling 2018-05-01 17:34:34 +01:00
Tony Garnock-Jones 007af89325 Care less about exact set ordering in test case 2018-05-01 17:32:03 +01:00
Tony Garnock-Jones 36e4de74ad Change representation of hashsets to avoid actual sets: use hashes-to-#t instead 2018-05-01 17:27:49 +01:00
Tony Garnock-Jones aaea276ec5 Uncomment query-value and friends. May need tweaks. 2018-04-30 22:48:50 +01:00
Tony Garnock-Jones dab13836f7 Clamp `adhoc-retract!` to not drop below zero. 2018-04-30 22:48:27 +01:00
Tony Garnock-Jones 55d13e7569 In case there are no activation-forms, add a gratuitous `(void)` at the end. 2018-04-30 22:47:53 +01:00
Tony Garnock-Jones 47f645d579 Repair incorrect interleaving of actions and scripts 2018-04-30 22:47:25 +01:00
Tony Garnock-Jones bda2ec0566 Switch another in-hash to hash-for-each 2018-04-30 14:46:43 +01:00
Tony Garnock-Jones c22f9f98f8 Avoid sets in the hot path of dataflow repair; also remove (bad) cycle-detection code 2018-04-30 14:29:34 +01:00
Tony Garnock-Jones 9d5213ecf4 Speedup from avoiding uselessly enqueueing an empty work queue 2018-04-30 11:19:03 +01:00
Tony Garnock-Jones 00b7f42335 Eliminate another parameter: now only `current-facet` remains 2018-04-30 11:18:49 +01:00
Tony Garnock-Jones d68bc87da5 Avoid manipulating `in-script?` all the time 2018-04-30 10:44:35 +01:00
Tony Garnock-Jones 77676fca9b Another small speed bump from using hash-for-each over in-hash-keys 2018-04-30 10:04:33 +01:00
Tony Garnock-Jones 1bd410db23 Avoid sets on the hot path (use hashes instead); good speed improvement 2018-04-30 09:32:08 +01:00
Tony Garnock-Jones 2008e66f38 Add in-* annotations to for loops 2018-04-30 09:14:00 +01:00
Tony Garnock-Jones 8bed3d4d4c Add timer/timestate support; this prompted a change to endpoint registration.
The `add-endpoint!` call is changed in two ways:

 - the old `assertion-fn` has become `update-fn`, yielding both
   an assertion *and* an optional handler, because if the handler
   depends on a field which changes, previously the handler wasn't
   being updated

 - a new parameter, `dynamic?`, can be set to #f (it's usually #t)
   to ensure that the assertion and skeleton-interest are calculated
   only once ever, and are not connected to the dataflow machinery.

The first change makes it possible for the `(later-than (deadline))`
pattern, where `deadline` is a field, to work; the second change makes
`during` and `during/spawn` work correctly in the face of field
updates.
2018-04-29 22:27:55 +01:00
Tony Garnock-Jones 63666f4567 Merge branch 'master' into imperative 2018-04-29 21:49:20 +01:00
Tony Garnock-Jones f64ad8389a Update example-during-criterion-snapshotting.rkt 2018-04-29 21:48:49 +01:00
Tony Garnock-Jones 98b7aecd8f External-event and TCP drivers; chat server and stdin echo programs 2018-04-29 18:43:39 +01:00
Tony Garnock-Jones 14bc36c4c5 Extract raw dataspace test to separate file 2018-04-29 16:08:52 +01:00
Tony Garnock-Jones d06acb2b59 Commented-out debug-printing in relay.rkt 2018-04-29 16:08:35 +01:00
Tony Garnock-Jones 768ee57a15 Add `test` make target 2018-04-29 16:08:20 +01:00
Tony Garnock-Jones a13884cbda bag-key-count 2018-04-29 16:08:01 +01:00
Tony Garnock-Jones e3d64677bd Repair scheduling of inner dataspaces, thus allowing e.g. double nesting 2018-04-29 16:07:49 +01:00
Tony Garnock-Jones 70b4bc5e74 Makefile 2018-04-29 14:54:28 +01:00
Tony Garnock-Jones 5a3f89ccf5 Tweak .gitignore 2018-04-29 14:54:22 +01:00
Tony Garnock-Jones 8900eccb1e Nested dataspaces 2018-04-29 14:54:14 +01:00
Tony Garnock-Jones 71756d8d40 First stab at #lang infrastructure 2018-04-29 12:22:12 +01:00
Tony Garnock-Jones 9b6fd1418a Refactor tests 2018-04-29 11:55:32 +01:00
Tony Garnock-Jones 45f401e607 Repair rotten pattern tests 2018-04-29 11:30:26 +01:00
Tony Garnock-Jones f2af7cb20b Box-and-client speed test 2018-04-27 23:59:04 +01:00
Tony Garnock-Jones 897c1aec0a Simple test harness 2018-04-27 23:53:31 +01:00
Tony Garnock-Jones 7199e6be64 Cosmetic notes 2018-04-27 18:23:34 +01:00
Tony Garnock-Jones a22062e043 Remove current-dataspace parameter 2018-04-27 18:05:33 +01:00
Tony Garnock-Jones 2c202d46ad Cosmetic notes 2018-04-27 17:36:43 +01:00
Tony Garnock-Jones 7be0ccf32c More robust approach to cleanup of assertions on actor termination.
We now explicitly track *committed* assertions of each actor in a new
field, `actor-cleanup-changes`. Each time a patch action is
*performed*, `actor-cleanup-changes` is updated. When an actor quits,
it enqueues a special new kind of action, a `quit` action.

When a `quit` action is performed, any remaining contents of
`actor-cleanup-changes` are processed in order to fully remove any
leftover assertions. (Leftover assertions will only arise in
exceptional cases: when some stop-script or facet boot-script raises
an uncaught exception.)

As part of this commit, we undo the effect of commit b207a07.
2018-04-27 17:30:26 +01:00
Tony Garnock-Jones 60a6290bc2 New failing test case. This, plus recent commits, calls for a
different strategy for tracking the retractions necessary at actor
termination.
2018-04-27 10:55:21 +01:00
Tony Garnock-Jones 629b4f8509 Cosmetic 2018-04-27 10:54:58 +01:00
Tony Garnock-Jones c56e5ad547 Switch adhoc-assertions to a bag (from a set).
This repairs a bug regarding crashes in a new actor's boot-proc.

Previously, if boot-proc raised an exception, the initial assertions
would stick around forever. By changing adhoc-assertions to a bag
rather than a set, and putting the initial assertions in the bag, we
put them somewhere they are guaranteed to be processed during actor
termination, even when an exception is signalled during boot.

This is an API change wrt the previous Syndicate implementation:
assert!/retract! now have bag semantics, not set semantics. We can add
set-semantics APIs if we end up needing them, of course, layered on
top of the bag implementation.
2018-04-27 09:59:03 +01:00
Tony Garnock-Jones bcfebeb402 Immutable bags 2018-04-27 09:55:19 +01:00
Tony Garnock-Jones b207a07798 The failing test now passes. The reasons for this are subtle:
The patch here removes a terminated facet from its parent's
`facet-children` set only in a script, and only after all other
scripts enqueued as part of facet termination have executed without an
uncaught exception.

This means that, if (say) a stop script raises an uncaught exception,
it might have happened after some *but not all* scripts resulting from
calls to `retract-facet-assertions-and-subscriptions!` have already
executed. So some endpoints' assertions and subscriptions will have
been removed.

When the uncaught exception is caught by the handler in
`with-current-facet`, a call to `abandon-queued-work!` is made, which
discards queued scripts, including the remaining assertion-cleanup
scripts as well as the scripts for removing dead facets from their
parents' `facet-children` sets. It also (crucially) discards queued
patch actions, including those resulting from already-executed
assertion-cleanup scripts.

At this point, we have a facet tree with some dead facets still in it,
and no queued outbound patches. The assertions for the still-present
dead facets are still logically asserted.

Then, a call to `terminate-actor!` happens, which traverses the whole
tree enqueueing assertion-cleanup scripts. No user code is enqueued,
so (in principle) no exceptions can be signalled.

Once these `terminate-actor!`-enqueued scripts execute, a pending
patch exists that will remove all remaining endpoint assertions.

The remaining sticky point is the calls to `dataspace-unsubscribe!`.
Happily, these are idempotent because of the implementation in
`skeleton.rkt`.

Prior to this patch, terminating facets were removed early from their
parents' `facet-children` sets, meaning there was no way to find them
again to clean up if a failure occurred during a stop script.

Ideally, it'd be easy to see that the code is correct in this respect.
We're not there yet.
2018-04-25 20:43:25 +01:00
Tony Garnock-Jones 18418dfc13 Failing test: an exception in a stop script messes up cleanup 2018-04-25 20:13:54 +01:00
Tony Garnock-Jones 5dd7ec4ae0 Test case showing correct behaviour for old implementation 2018-04-25 20:08:07 +01:00
Tony Garnock-Jones e7f3dab519 Run stop-scripts in one scheduled execution 2018-04-25 19:54:58 +01:00
Tony Garnock-Jones 762d1d4250 Be specific in for-loops 2018-04-25 19:47:18 +01:00
Tony Garnock-Jones 76c0fe03c9 Guard against double-adhoc-assertion 2018-04-25 19:46:08 +01:00
Tony Garnock-Jones d298ad2c66 Remove redundant `facet-live?` test 2018-04-25 19:40:53 +01:00
Tony Garnock-Jones 2878386805 Omit "name" to ctor for dataspace struct - name is/will be a property of the downward relay connection 2018-04-25 19:30:45 +01:00
Tony Garnock-Jones 1b1c598aa0 during/spawn 2018-04-22 21:07:35 +01:00
Tony Garnock-Jones 8cb4e947a5 Correct typo 2018-04-22 21:06:18 +01:00