29.6 Relations of Candidate Executions

29.6.1 agent-order

For a candidate execution execution, execution.[[AgentOrder]] is a Relation on events that satisfies the following.

  • For each pair (E, D) in EventSet(execution), (E, D) is in execution.[[AgentOrder]] if there is some Agent Events Record aer in execution.[[EventsRecords]] such that E and D are in aer.[[EventList]] and E is before D in List order of aer.[[EventList]].
Note

Each agent introduces events in a per-agent strict total order during the evaluation. This is the union of those strict total orders.

29.6.2 reads-bytes-from

For a candidate execution execution, execution.[[ReadsBytesFrom]] is a mathematical function mapping events in SharedDataBlockEventSet(execution) to Lists of events in SharedDataBlockEventSet(execution) that satisfies the following conditions.

29.6.3 reads-from

For a candidate execution execution, execution.[[ReadsFrom]] is the least Relation on events that satisfies the following.

  • For each pair (R, W) in SharedDataBlockEventSet(execution), (R, W) is in execution.[[ReadsFrom]] if W is in execution.[[ReadsBytesFrom]](R).

29.6.4 host-synchronizes-with

For a candidate execution execution, execution.[[HostSynchronizesWith]] is a host-provided strict partial order on host-specific events that satisfies at least the following.

  • If (E, D) is in execution.[[HostSynchronizesWith]], E and D are in HostEventSet(execution).
  • There is no cycle in the union of execution.[[HostSynchronizesWith]] and execution.[[AgentOrder]].
Note 1

For two host-specific events E and D, E host-synchronizes-with D implies E happens-before D.

Note 2

The host-synchronizes-with relation allows the host to provide additional synchronization mechanisms, such as postMessage between HTML workers.

29.6.5 synchronizes-with

For a candidate execution execution, execution.[[SynchronizesWith]] is the least Relation on events that satisfies the following.

  • For each pair (R, W) in execution.[[ReadsFrom]], (W, R) is in execution.[[SynchronizesWith]] if R.[[Order]] is SeqCst, W.[[Order]] is SeqCst, and R and W have equal ranges.
  • For each element eventsRecord of execution.[[EventsRecords]], the following is true.
    • For each pair (S, Sw) in eventsRecord.[[AgentSynchronizesWith]], (S, Sw) is in execution.[[SynchronizesWith]].
  • For each pair (E, D) in execution.[[HostSynchronizesWith]], (E, D) is in execution.[[SynchronizesWith]].
Note 1

Owing to convention, write events synchronizes-with read events, instead of read events synchronizes-with write events.

Note 2

Init events do not participate in synchronizes-with, and are instead constrained directly by happens-before.

Note 3

Not all SeqCst events related by reads-from are related by synchronizes-with. Only events that also have equal ranges are related by synchronizes-with.

Note 4

For Shared Data Block events R and W such that W synchronizes-with R, R may reads-from other writes than W.

29.6.6 happens-before

For a candidate execution execution, execution.[[HappensBefore]] is the least Relation on events that satisfies the following.

  • For each pair (E, D) in execution.[[AgentOrder]], (E, D) is in execution.[[HappensBefore]].
  • For each pair (E, D) in execution.[[SynchronizesWith]], (E, D) is in execution.[[HappensBefore]].
  • For each pair (E, D) in SharedDataBlockEventSet(execution), (E, D) is in execution.[[HappensBefore]] if E.[[Order]] is Init and E and D have overlapping ranges.
  • For each pair (E, D) in EventSet(execution), (E, D) is in execution.[[HappensBefore]] if there is an event F such that the pairs (E, F) and (F, D) are in execution.[[HappensBefore]].
Note

Because happens-before is a superset of agent-order, candidate executions are consistent with the single-thread evaluation semantics of ECMAScript.