Newsgroups: | comp.compilers |
From: | optima!kwalker@cs.arizona.edu (Kenneth Walker) |
Organization: | Compilers Central |
Date: | Tue, 4 Aug 1992 18:46:49 GMT |
Keywords: | C, design |
References: | 92-08-004 |
>From article 92-08-004, the moderator writes:
> [Somebody suggested that it might be possible to define some extensions to
> C that would make it easier to garbage collect. Any thoughts? -John]
While I have not done this for a compiler itermediate language, I have
done it for an implementation language for the Icon language's run-time
system. The implementation langauge is based on C and has a number of
extensions. One of them is a storage class specifier of "tended"
(analogous to "register") that indicates that the garbage collector is
able to locate the variable.
When a function written in the implementation language is translated into
ordinary C, tended variables are gathered together and placed in a
structure. That structure is automatically linked onto a global list when
the function is entered and removed when the function is exited. The
garbage collector locates the variables by traversing the list.
The representation of the variables in the ordinary C code and the layout
of the structure were designed to meet the needs of a particular langauge
and garbage collector. I'm not sure how well this mechanism can be
generized so that one compiler of extended C can be made to work with many
languages and many garbage collectors.
Ken Walker / Computer Science Dept / Univ of Arizona / Tucson, AZ 85721
+1 602 621-4252 kwalker@cs.arizona.edu uunet!arizona!kwalker
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.