[m-dev.] Exposing stack frames
Fergus Henderson
fjh at cs.mu.OZ.AU
Wed May 9 23:11:15 AEST 2001
On 09-May-2001, Ralph Becket <rbeck at microsoft.com> wrote:
> It occurred to me that if we had some way of exposing stack frames
> and so forth via some (possibly unsafe) interface, we might be able
> to implement stuff like coroutining, exceptions and native GC purely
> in Mercury.
>
> Is this a sensible thing to ask for?
Yes. Not as a standard Mercury library, but as an implementation-specific
interface, definitely.
I've been arguing for this kind of thing (Mercury level interfaces to
the low-level RTTI-related stuff) for a while now, in particular in
connection with the implementation of deep_copy (a major part of the
native GC) and the debugger.
We've discussed this at some of the previous Mercury meetings, although
I don't know whether it made it into the minutes. I think the concensus
was that this would be a good idea, but that it would be quite a bit of
effort to implement.
There's actually already some support for low-level RTTI in std_util.m:
| % The rest of the interface is for use by
| % implementors only.
|
| :- type functor_tag_info
| ---> functor_integer(int)
| ; functor_float(float)
| ; functor_string(string)
| ; functor_enum(int)
| ; functor_local(int, int)
| ; functor_remote(int, int, list(univ))
| ; functor_unshared(int, list(univ))
| ; functor_notag(univ)
| ; functor_equiv(univ).
|
| % get_functor_info is a variant of deconstruct for use by the compiler,
| % specifically prog_rep.m and static_term.m. It differs from
| % deconstruct in two main ways. First, instead of returning the
| % function symbol, it returns implementation information about
| % its tag. Second, it succeeds for just the kinds of terms needed
| % to represent procedure bodies for ordinary procedures. For the time
| % being, these are procedures that do not involve higher order code
| % or tabling.
| :- pred get_functor_info(univ::in, functor_tag_info::out) is semidet.
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
| of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to: mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions: mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------
More information about the developers
mailing list