/* Simple garbage collection for the GNU compiler.
- Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2001, 2002, 2003
+ Free Software Foundation, Inc.
This file is part of GCC.
#endif
#ifdef ENABLE_VALGRIND_CHECKING
-#include <valgrind.h>
+# ifdef HAVE_MEMCHECK_H
+# include <memcheck.h>
+# else
+# include <valgrind.h>
+# endif
#else
/* Avoid #ifdef:s when we can help it. */
#define VALGRIND_DISCARD(x)
if (*cti->base)
{
ggc_set_mark (*cti->base);
- htab_traverse (*cti->base, ggc_htab_delete, (PTR) cti);
+ htab_traverse_noresize (*cti->base, ggc_htab_delete, (PTR) cti);
ggc_set_mark ((*cti->base)->entries);
}
}
{
if (fwrite (&ptr, sizeof (void *), 1, state->f)
!= 1)
- fatal_io_error ("can't write PCH file");
+ fatal_error ("can't write PCH file: %m");
}
else
{
POINTER_HASH (ptr));
if (fwrite (&new_ptr->new_addr, sizeof (void *), 1, state->f)
!= 1)
- fatal_io_error ("can't write PCH file");
+ fatal_error ("can't write PCH file: %m");
}
}
}
for (rt = gt_pch_scalar_rtab; *rt; rt++)
for (rti = *rt; rti->base != NULL; rti++)
if (fwrite (rti->base, rti->stride, 1, f) != 1)
- fatal_io_error ("can't write PCH file");
+ fatal_error ("can't write PCH file: %m");
/* Write out all the global pointers, after translation. */
write_pch_globals (gt_ggc_rtab, &state);
long o;
o = ftell (state.f) + sizeof (mmi);
if (o == -1)
- fatal_io_error ("can't get position in PCH file");
+ fatal_error ("can't get position in PCH file: %m");
mmi.offset = page_size - o % page_size;
if (mmi.offset == page_size)
mmi.offset = 0;
mmi.offset += o;
}
if (fwrite (&mmi, sizeof (mmi), 1, state.f) != 1)
- fatal_io_error ("can't write PCH file");
+ fatal_error ("can't write PCH file: %m");
if (mmi.offset != 0
&& fseek (state.f, mmi.offset, SEEK_SET) != 0)
- fatal_io_error ("can't write padding to PCH file");
+ fatal_error ("can't write padding to PCH file: %m");
/* Actually write out the objects. */
for (i = 0; i < state.count; i++)
memcpy (state.ptrs[i]->obj, this_object, state.ptrs[i]->size);
}
ggc_pch_finish (state.d, state.f);
+ gt_pch_fixup_stringpool ();
free (state.ptrs);
htab_delete (saving_htab);
for (rt = gt_pch_scalar_rtab; *rt; rt++)
for (rti = *rt; rti->base != NULL; rti++)
if (fread (rti->base, rti->stride, 1, f) != 1)
- fatal_io_error ("can't read PCH file");
+ fatal_error ("can't read PCH file: %m");
/* Read in all the global pointers, in 6 easy loops. */
for (rt = gt_ggc_rtab; *rt; rt++)
for (i = 0; i < rti->nelt; i++)
if (fread ((char *)rti->base + rti->stride * i,
sizeof (void *), 1, f) != 1)
- fatal_io_error ("can't read PCH file");
+ fatal_error ("can't read PCH file: %m");
for (rt = gt_pch_cache_rtab; *rt; rt++)
for (rti = *rt; rti->base != NULL; rti++)
for (i = 0; i < rti->nelt; i++)
if (fread ((char *)rti->base + rti->stride * i,
sizeof (void *), 1, f) != 1)
- fatal_io_error ("can't read PCH file");
+ fatal_error ("can't read PCH file: %m");
if (fread (&mmi, sizeof (mmi), 1, f) != 1)
- fatal_io_error ("can't read PCH file");
+ fatal_error ("can't read PCH file: %m");
#if HAVE_MMAP_FILE
addr = mmap (mmi.preferred_base, mmi.size,
addr = xmalloc (mmi.size);
if (fseek (f, mmi.offset, SEEK_SET) != 0
|| fread (&mmi, mmi.size, 1, f) != 1)
- fatal_io_error ("can't read PCH file");
+ fatal_error ("can't read PCH file: %m");
}
else if (fseek (f, mmi.offset + mmi.size, SEEK_SET) != 0)
- fatal_io_error ("can't read PCH file");
+ fatal_error ("can't read PCH file: %m");
ggc_pch_read (f, addr);
struct rlimit rlim;
# ifdef RLIMIT_RSS
if (getrlimit (RLIMIT_RSS, &rlim) == 0
- && rlim.rlim_cur != RLIM_INFINITY
+ && rlim.rlim_cur != (rlim_t) RLIM_INFINITY
&& rlim.rlim_cur < limit)
limit = rlim.rlim_cur;
# endif
# ifdef RLIMIT_DATA
if (getrlimit (RLIMIT_DATA, &rlim) == 0
- && rlim.rlim_cur != RLIM_INFINITY
+ && rlim.rlim_cur != (rlim_t) RLIM_INFINITY
&& rlim.rlim_cur < limit)
limit = rlim.rlim_cur;
# endif
# ifdef RLIMIT_AS
if (getrlimit (RLIMIT_AS, &rlim) == 0
- && rlim.rlim_cur != RLIM_INFINITY
+ && rlim.rlim_cur != (rlim_t) RLIM_INFINITY
&& rlim.rlim_cur < limit)
limit = rlim.rlim_cur;
# endif
/* Adjust for rlimits. */
min_heap_kbytes = ggc_rlimit_bound (min_heap_kbytes);
- min_heap_kbytes /= 1024; /* convert to Kbytes. */
+ min_heap_kbytes /= 1024; /* convert to Kbytes. */
/* The heuristic is RAM/8, with a lower bound of 4M and an upper
bound of 128M (when RAM >= 1GB). */