On Tue, Jul 30, 2013 at 3:53 PM, David Jeske <[email protected]> wrote:
> On Tue, Jul 30, 2013 at 3:28 PM, Jonathan S. Shapiro <[email protected]>wrote: > >> Consider strpos(), where you want to return an interior pointer to a >> C-style string. A region system lets you say that the liveness of the >> returned pointer has to match the liveness of the argument. Absent that, a >> memory-safe language is required to allocate a new string. >> > > I'll have to read up on regions-research to understand why the term region > is used here. > The intuition is that the pointer returned by strpos points to an object in the same region as the input object. In particular that it does *not* point to something allocated in the GC heap. There are a bunch of idioms where this allows you to avoid a deep copy entirely, and others where it lets you defer the deep copy to a higher point in the call stack, possibly resulting in a deep copied graph that is smaller. Ah. I found it. It was strdup(), strcpy() and friends rather than strpos(). The paper is Region-Based Memory Management in Cyclone<http://www.eecs.harvard.edu/~greg/cyclone/papers/cyclone-regions.pdf> The discussion you want is associated with Figure 1 at the top of page 3. And note in particular rstrdup() in that figure, which exploits first-class regions. shap
_______________________________________________ bitc-dev mailing list [email protected] http://www.coyotos.org/mailman/listinfo/bitc-dev
