memory
Fergus Henderson
fjh at cs.mu.OZ.AU
Wed Feb 4 18:37:22 AEDT 1998
On 04-Feb-1998, Peter Schachte <pets at students.cs.mu.OZ.AU> wrote:
> Here's my proposal:
>
> Word MR_make_permanent(Word term, Word type_info);
>
> Returns a copy of term that can safely be stored in C's memory
> somewhere even if it may be accessed after failure. Of
> course, type_info is a type info structure for term.
>
>
> Word MR_make_partially_permanent(Word term, Word type_info,
> Word *limit);
>
> This is the same as MR_make_permanent, except that if limit is an
> address on the heap, parts of term that are "older" than limit will
> not be copied. This is useful when you know that the permanent copy
> of term will not be accessed after the heap pointer has backtracked
> beyond limit. Naturally, this always occurs when the permanent term
> is to be stored in *limit.
>
> I'd like to describe the limit argument without referring to the
> "heap," but don't see how to.
>
> I believe these two functions, as part of the documented standard Mercury
> runtime, should be enough. In conservative GC grades, these functions just
> return term, otherwise they allocate the "global heap" zone if it hasn't
> already been allocated, and copy term there, returning a pointer. The
> resulting pointer could be used as if it were an ordinary heap term. Of
> course, the global heap is never reclaimed so garbage collection is pretty
> important, but I'll leave that for Tyson to worry about. What else is there
> to say? I guess the size of the global heap zone should be handled like the
> solutions heap zone.
>
> Comments? Have I missed something?
That looks OK to me.
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3 | -- the last words of T. S. Garp.
More information about the developers
mailing list