GPC ALPHA 20050331 released
Waldek Hebisch
hebisch at math.uni.wroc.pl
Fri Apr 1 21:01:18 CEST 2005
Frank Heckenbach wrote:
> > +#ifndef EGCS97
> > newlevel->shared_decl_lang_specific = (struct lang_decl *) xmalloc (sizeof (*(newlevel->shared_decl_lang_specific)));
> > #else
> > newlevel->shared_decl_lang_specific = (struct lang_decl *) ggc_alloc (sizeof (*(newlevel->shared_decl_lang_specific)));
>
> BTW, the same change could perhaps be made in line 315 above. But as
> I can't test it ATM, I better no do it. It's probably not very
> important there, and if 3.2 is dropped after integrating the
> preprocessor, it won't matter much in the long run anyway.
>
AFAICS the code is correct (for 3.2) now: we allocate binding level with
xmalloc in pushlevel and we free it in poplevel. We could use `ggc_alloc',
mark it and forget free. The patch below is doing that and apparently works,
but I do not know if it worth switching to garbage collector here (if
you would like to install the patch I can do more testing).
--- p.pp/declarations.c Fri Apr 1 20:57:29 2005
+++ p/declarations.c Fri Apr 1 20:53:30 2005
@@ -312,7 +312,7 @@
void
pushlevel (int transparent)
{
-#ifndef GCC_3_3
+#ifndef EGCS97
struct binding_level *newlevel = (struct binding_level *) xmalloc (sizeof (*newlevel));
#else
struct binding_level *newlevel = (struct binding_level *) ggc_alloc (sizeof (*newlevel));
@@ -328,7 +328,7 @@
}
else
{
-#ifndef GCC_3_3
+#ifndef EGCS97
newlevel->shared_decl_lang_specific = (struct lang_decl *) xmalloc (sizeof (*(newlevel->shared_decl_lang_specific)));
#else
newlevel->shared_decl_lang_specific = (struct lang_decl *) ggc_alloc (sizeof (*(newlevel->shared_decl_lang_specific)));
@@ -455,7 +455,7 @@
else if (level->blocks)
current_binding_level->blocks = chainon (current_binding_level->blocks, level->blocks);
-#ifndef GCC_3_3
+#ifndef EGCS97
free (level);
#endif
@@ -1585,6 +1585,7 @@
ggc_mark_tree (level->blocks);
ggc_mark_tree (level->this_block);
ggc_mark (level->shared_decl_lang_specific);
+ ggc_mark (level);
}
}
#endif
--
Waldek Hebisch
hebisch at math.uni.wroc.pl
More information about the Gpc
mailing list