diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-04-14 15:08:54 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-04-14 15:08:54 +0000 |
commit | 3d3ea6400d6c880f6e066e13e5f06a3d200f682d (patch) | |
tree | 32e00562534a3de115dc2c0e05b0ef14f00b8232 /gcc | |
parent | 620dfbcde6abff24936fcf96ea626a21ebf0cce3 (diff) | |
download | gcc-3d3ea6400d6c880f6e066e13e5f06a3d200f682d.tar.gz |
2008-04-14 Basile Starynkevitch <basile@starynkevitch.net>
* basilys.h: (basilys_allocatereserved) removed the call
fatal_error and wrapped it into
basilys_reserved_allocation_failure.
* basilys.c: (basilys_reserved_allocation_failure) new function
which should never be called.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@134274 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog.melt | 7 | ||||
-rw-r--r-- | gcc/basilys.c | 14 | ||||
-rw-r--r-- | gcc/basilys.h | 20 |
3 files changed, 36 insertions, 5 deletions
diff --git a/gcc/ChangeLog.melt b/gcc/ChangeLog.melt index dba6295abd7..c2958abc63b 100644 --- a/gcc/ChangeLog.melt +++ b/gcc/ChangeLog.melt @@ -1,4 +1,11 @@ +2008-04-14 Basile Starynkevitch <basile@starynkevitch.net> + * basilys.h: (basilys_allocatereserved) removed the call + fatal_error and wrapped it into + basilys_reserved_allocation_failure. + * basilys.c: (basilys_reserved_allocation_failure) new function + which should never be called. + 2008-04-05 Basile Starynkevitch <basile@starynkevitch.net> MELT branch merged with trunk r133937 diff --git a/gcc/basilys.c b/gcc/basilys.c index b837ce18978..d16507d3a8b 100644 --- a/gcc/basilys.c +++ b/gcc/basilys.c @@ -627,6 +627,20 @@ basilys_garbcoll (size_t wanted, bool needfull) } +/* the inline function basilys_allocatereserved is the only one + calling this basilys_reserved_allocation_failure function, which + should never be called. If it is indeed called, you've been bitten + by a severe bug. In principle basilys_allocatereserved should have + been called with a suitable previous call to basilysgc_reserve such + that all the reserved allocations fits into the reserved size */ +void basilys_reserved_allocation_failure(long siz) { + /* this function should never really be called */ + fatal_error("memory corruption in basilys reserved allocation: " + "requiring %ld bytes but only %ld available in young zone", + siz, (long) ((char *) basilys_storalz - (char *) basilys_curalz)); +} + +/* cheney like forwarding */ static basilys_ptr_t forwarded_copy (basilys_ptr_t p) { diff --git a/gcc/basilys.h b/gcc/basilys.h index 9cedd61f469..c973815df30 100644 --- a/gcc/basilys.h +++ b/gcc/basilys.h @@ -122,6 +122,12 @@ union basilysparam_un basic_block *bp_bbptr; /* for results */ #define BPAR_BB 'b' #define BPARSTR_BB "b" + + /* readonly constant strings - not in GP nor in heap */ + const char *bp_cstring; /* letter S */ + const char **bp_cstringptr; /* for results */ +#define BPAR_CSTRING 'S' +#define BPARSTR_CSTRING "S" }; /*** the closures contain routines which are called by applying @@ -1006,6 +1012,13 @@ basilysgc_reserve(size_t wanted) basilys_garbcoll (wanted, BASILYS_MINOR_OR_FULL); } +/* we need a function to detect failure in reserved allocation; this + basilys_reserved_allocation_failure function should never be + called; we do not want to use fatal_error which requires toplev.h + inclusion; never call this function outside of + basilys_allocatereserved */ +void basilys_reserved_allocation_failure(long siz); + /* allocates a previously reserved zone of BASESZ with extra GAP; this should never trigger the GC, because space was reserved earlier */ @@ -1014,9 +1027,6 @@ basilys_allocatereserved (size_t basesz, size_t gap) { size_t wanted; void *ptr; - /* @@@ we need fatal_error, declared in toplev.h; but we want to - avoid including it in the generated gtype-desc.c file; */ - extern void fatal_error (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2); if (basesz < sizeof (struct basilysforward_st)) basesz = sizeof (struct basilysforward_st); if ((basesz % BASILYS_ALIGN) != 0) @@ -1027,8 +1037,8 @@ basilys_allocatereserved (size_t basesz, size_t gap) gcc_assert (wanted >= sizeof (struct basilysforward_st)); if (BASILYS_UNLIKELY (basilys_curalz + wanted + 2 * BASILYS_ALIGN >= (char *) basilys_storalz)) - fatal_error("allocatereserved out of space for %ld wanted bytes", - (long) wanted); + /* this should never happen */ + basilys_reserved_allocation_failure((long) wanted); ptr = basilys_curalz; #if ENABLE_CHECKING if (ptr == tracedptr1) |