Join-pattern is the distinctive feature of the join-calculus, seen both as a process calculus and as a programming language. On the calculus side, join-calculus can roughly be seen as a functional calculus plus join-patterns, thus achieving the same expressive power as previous name-passing process calculi [11]. Join-definitions are made of several clauses, each clause being a pair of a join-pattern and of a guarded process. A join-pattern expresses a synchronization between several names (or channels). When messages are pending on all the names that appear in a given join-pattern, then the corresponding clause is said to be active and its guarded process may be fired. A definition whose join-patterns share some names expresses sophisticated synchronizations. In such a definition, a message on a name that appears in several active clauses is consumed as soon as one of the corresponding guarded processes is fired.
Join-languages are built on top of the join-calculus taken as a core language. Therefore, names are first-class citizens, computations are first abstracted as collections of asynchronous processes, and join-patterns provide an unique, clear and powerful mechanism for synchronizing these computations. The documentation for the join-language [7] includes a tutorial that shows how join definitions may encode classical synchronization constructs such as locks, barriers, shared counters,…
On the implementation side, join-patterns are meant to be heavily used by programmers, as the only synchronization primitive available. Thus, their compilation requires much care. At the moment, we propose two compilers: the join compiler [7], a language of its own, and the jocaml compiler [8], an extension of the Objective Caml functional language.
Section 2 of this paper succinctly presents the join-calculus syntax and semantics. Then, section 3 introduces the kind of automata we use to compile join-synchronization, while section 4 presents two techniques for implementing them. The first technique directly derives from automata description and is used in our join compiler. The second technique performs some extra runtime tests, this is the technique used in our jocaml compiler. Sections 5 and 6 discuss optimizations and section 7 concludes.