5 research outputs found
A Syntactic Model of Mutation and Aliasing
Traditionally, semantic models of imperative languages use an auxiliary
structure which mimics memory. In this way, ownership and other encapsulation
properties need to be reconstructed from the graph structure of such global
memory. We present an alternative "syntactic" model where memory is encoded as
part of the program rather than as a separate resource. This means that
execution can be modelled by just rewriting source code terms, as in semantic
models for functional programs. Formally, this is achieved by the block
construct, introducing local variable declarations, which play the role of
memory when their initializing expressions have been evaluated. In this way, we
obtain a language semantics which directly represents at the syntactic level
constraints on aliasing, allowing simpler reasoning about related properties.
To illustrate this advantage, we consider the issue, widely studied in the
literature, of characterizing an isolated portion of memory, which cannot be
reached through external references. In the syntactic model, closed block
values, called "capsules", provide a simple representation of isolated portions
of memory, and capsules can be safely moved to another location in the memory,
without introducing sharing, by means of "affine' variables. We prove that the
syntactic model can be encoded in the conventional one, hence efficiently
implemented.Comment: In Proceedings DCM 2018 and ITRS 2018 , arXiv:1904.0956
Aliasing control in an imperative pure calculus
We present an imperative object calculus where types are annotated with two modifiers for aliasing control. The lent modifier prevents objects to be aliased, whereas the capsule modifier characterizes expressions that will reduce to isolated portions of store. There are two key novelties w.r.t. similar proposals. First, the expressivity of the type system is greatly enhanced by promotion and swapping rules. The former recognizes as capsule an expression which only uses external references as lent. The latter allows a lent reference to be freely aliased, if all the other references are regarded as lent. Second, execution is modeled in a pure setting, where it is simpler to understand alias control. That is, properties of modifiers can be directly expressed on source terms, rather than as invariants on an auxiliary structure which mimics physical memory. Formally, this is achieved by the block construct, introducing local variable declarations, which play the role of store when evaluated