Various fixes for problems discovered stress-testing GC.

* config/i386/i386.c (pic_label_name): Change to char pointer.
	(global_offset_table): New variable.
	(load_pic_register): Fill global_offset_table if it hasn't
	already been done.  Allocate pic_label_name dynamically.
	* ggc.h (empty_string): New variable.
	* ggc-simple.c (empty_string): Likewise.
	(init_ggc): Allocate empty_string and add as root.
	* stmt.c (digit_strings): New variable.
	(init_stmt): Add last_block_end_note as root.  Allocate and
	initialize digit_strings.
	(expand_asm_operands): Use empty_string and digit_string instead
	of string constants.
	* profile.c (init_arc_profiler): Allocate with ggc_alloc_string
	instead of xmalloc.
	(output_func_start_profiler): Likewise.
	* c-typeck.c (digest_init): Check if init is error_mark_node.

From-SVN: r29575
This commit is contained in:
Alex Samuel 1999-09-22 05:51:44 +00:00
parent 5ab00e275b
commit 21a427cca1
6 changed files with 48 additions and 15 deletions

View File

@ -4494,8 +4494,8 @@ digest_init (type, init, require_constant, constructor_constant)
enum tree_code code = TREE_CODE (type);
tree inside_init = init;
if (init == error_mark_node)
return init;
if (type == error_mark_node || init == error_mark_node)
return error_mark_node;
/* Strip NON_LVALUE_EXPRs since we aren't using as an lvalue. */
/* Do not use STRIP_NOPS here. We do not want an enumerator

View File

@ -1357,8 +1357,9 @@ ix86_can_use_return_insn_p ()
return nregs == 0 || ! frame_pointer_needed;
}
static char pic_label_name[32];
static char *pic_label_name;
static int pic_label_output;
static char *global_offset_table_name;
/* This function generates code for -fpic that loads %ebx with
the return address of the caller and then returns. */
@ -1402,12 +1403,22 @@ load_pic_register ()
{
rtx gotsym, pclab;
gotsym = gen_rtx_SYMBOL_REF (Pmode, "_GLOBAL_OFFSET_TABLE_");
if (global_offset_table_name == NULL)
{
global_offset_table_name =
ggc_alloc_string ("_GLOBAL_OFFSET_TABLE_", 21);
ggc_add_string_root (&global_offset_table_name, 1);
}
gotsym = gen_rtx_SYMBOL_REF (Pmode, global_offset_table_name);
if (TARGET_DEEP_BRANCH_PREDICTION)
{
if (pic_label_name[0] == '\0')
ASM_GENERATE_INTERNAL_LABEL (pic_label_name, "LPR", 0);
if (pic_label_name == NULL)
{
pic_label_name = ggc_alloc_string (NULL, 32);
ggc_add_string_root (&pic_label_name, 1);
ASM_GENERATE_INTERNAL_LABEL (pic_label_name, "LPR", 0);
}
pclab = gen_rtx_MEM (QImode, gen_rtx_SYMBOL_REF (Pmode, pic_label_name));
}
else

View File

@ -48,6 +48,10 @@
#define GGC_ANY_MAGIC ((unsigned int)0xa9bacbdc)
#define GGC_ANY_MAGIC_MARK ((unsigned int)0xa9bacbdc | 1)
/* Constants for general use. */
char *empty_string;
/* Global lists of roots, rtxs, and trees. */
struct ggc_rtx
@ -142,6 +146,9 @@ init_ggc PROTO ((void))
dump = fopen ("zgcdump", "w");
setlinebuf (dump);
#endif
ggc_alloc_string ("", 0);
ggc_add_string_root (&empty_string, 1);
}
/* Start a new GGC context. Memory allocated in previous contexts

View File

@ -42,6 +42,9 @@ union tree_node;
struct varasm_status;
struct varray_head_tag;
/* Constants for general use. */
extern char *empty_string;
/* Manipulate global roots that are needed between calls to gc. */
void ggc_add_root PROTO ((void *base, int nelt, int size, void (*)(void *)));
void ggc_add_rtx_root PROTO ((struct rtx_def **, int nelt));

View File

@ -1540,7 +1540,7 @@ static void
init_arc_profiler ()
{
/* Generate and save a copy of this so it can be shared. */
char *name = xmalloc (20);
char *name = ggc_alloc_string (NULL, 20);
ASM_GENERATE_INTERNAL_LABEL (name, "LPBX", 2);
profiler_label = gen_rtx_SYMBOL_REF (Pmode, name);
ggc_add_rtx_root (&profiler_label, 1);
@ -1678,10 +1678,11 @@ output_func_start_profiler ()
expand_function_start (fndecl, 0);
/* Actually generate the code to call __bb_init_func. */
name = xmalloc (20);
name = ggc_alloc_string (NULL, 20);
ASM_GENERATE_INTERNAL_LABEL (name, "LPBX", 0);
table_address = force_reg (Pmode, gen_rtx_SYMBOL_REF (Pmode, name));
emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__bb_init_func"), 0,
emit_library_call (gen_rtx_SYMBOL_REF
(Pmode, ggc_alloc_string ("__bb_init_func", 14)), 0,
mode, 1, table_address, Pmode);
expand_function_end (input_filename, lineno, 0);

View File

@ -401,6 +401,9 @@ struct stmt_status
/* Non-zero if we are using EH to handle cleanus. */
static int using_eh_for_cleanups_p = 0;
/* Character strings, each containing a single decimal digit. */
static char *digit_strings[10];
static int n_occurrences PROTO((int, const char *));
static void expand_goto_internal PROTO((tree, rtx, rtx));
@ -592,7 +595,17 @@ mark_stmt_status (p)
void
init_stmt ()
{
int i;
gcc_obstack_init (&stmt_obstack);
ggc_add_rtx_root (&last_block_end_note, 1);
for (i = 0; i < 10; i++)
{
digit_strings[i] = ggc_alloc_string (NULL, 1);
digit_strings[i][0] = '0' + i;
}
ggc_add_string_root (digit_strings, 10);
}
void
@ -1547,9 +1560,9 @@ expand_asm_operands (string, outputs, inputs, clobbers, vol, filename, line)
argvec = rtvec_alloc (ninputs);
constraints = rtvec_alloc (ninputs);
body = gen_rtx_ASM_OPERANDS (VOIDmode,
TREE_STRING_POINTER (string), "", 0, argvec,
constraints, filename, line);
body = gen_rtx_ASM_OPERANDS (VOIDmode, TREE_STRING_POINTER (string),
empty_string, 0, argvec, constraints,
filename, line);
MEM_VOLATILE_P (body) = vol;
@ -1717,14 +1730,12 @@ expand_asm_operands (string, outputs, inputs, clobbers, vol, filename, line)
/* For in-out operands, copy output rtx to input rtx. */
for (i = 0; i < ninout; i++)
{
static char match[9+1][2]
= {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"};
int j = inout_opnum[i];
XVECEXP (body, 3, ninputs - ninout + i) /* argvec */
= output_rtx[j];
XVECEXP (body, 4, ninputs - ninout + i) /* constraints */
= gen_rtx_ASM_INPUT (inout_mode[i], match[j]);
= gen_rtx_ASM_INPUT (inout_mode[i], digit_strings[j]);
}
/* Now, for each output, construct an rtx