Commit 21a427cc by Alex Samuel

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
parent 5ab00e27
...@@ -4494,8 +4494,8 @@ digest_init (type, init, require_constant, constructor_constant) ...@@ -4494,8 +4494,8 @@ digest_init (type, init, require_constant, constructor_constant)
enum tree_code code = TREE_CODE (type); enum tree_code code = TREE_CODE (type);
tree inside_init = init; tree inside_init = init;
if (init == error_mark_node) if (type == error_mark_node || init == error_mark_node)
return init; return error_mark_node;
/* Strip NON_LVALUE_EXPRs since we aren't using as an lvalue. */ /* Strip NON_LVALUE_EXPRs since we aren't using as an lvalue. */
/* Do not use STRIP_NOPS here. We do not want an enumerator /* Do not use STRIP_NOPS here. We do not want an enumerator
......
...@@ -1357,8 +1357,9 @@ ix86_can_use_return_insn_p () ...@@ -1357,8 +1357,9 @@ ix86_can_use_return_insn_p ()
return nregs == 0 || ! frame_pointer_needed; return nregs == 0 || ! frame_pointer_needed;
} }
static char pic_label_name[32]; static char *pic_label_name;
static int pic_label_output; static int pic_label_output;
static char *global_offset_table_name;
/* This function generates code for -fpic that loads %ebx with /* This function generates code for -fpic that loads %ebx with
the return address of the caller and then returns. */ the return address of the caller and then returns. */
...@@ -1402,12 +1403,22 @@ load_pic_register () ...@@ -1402,12 +1403,22 @@ load_pic_register ()
{ {
rtx gotsym, pclab; 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 (TARGET_DEEP_BRANCH_PREDICTION)
{ {
if (pic_label_name[0] == '\0') if (pic_label_name == NULL)
ASM_GENERATE_INTERNAL_LABEL (pic_label_name, "LPR", 0); {
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)); pclab = gen_rtx_MEM (QImode, gen_rtx_SYMBOL_REF (Pmode, pic_label_name));
} }
else else
......
...@@ -48,6 +48,10 @@ ...@@ -48,6 +48,10 @@
#define GGC_ANY_MAGIC ((unsigned int)0xa9bacbdc) #define GGC_ANY_MAGIC ((unsigned int)0xa9bacbdc)
#define GGC_ANY_MAGIC_MARK ((unsigned int)0xa9bacbdc | 1) #define GGC_ANY_MAGIC_MARK ((unsigned int)0xa9bacbdc | 1)
/* Constants for general use. */
char *empty_string;
/* Global lists of roots, rtxs, and trees. */ /* Global lists of roots, rtxs, and trees. */
struct ggc_rtx struct ggc_rtx
...@@ -142,6 +146,9 @@ init_ggc PROTO ((void)) ...@@ -142,6 +146,9 @@ init_ggc PROTO ((void))
dump = fopen ("zgcdump", "w"); dump = fopen ("zgcdump", "w");
setlinebuf (dump); setlinebuf (dump);
#endif #endif
ggc_alloc_string ("", 0);
ggc_add_string_root (&empty_string, 1);
} }
/* Start a new GGC context. Memory allocated in previous contexts /* Start a new GGC context. Memory allocated in previous contexts
......
...@@ -42,6 +42,9 @@ union tree_node; ...@@ -42,6 +42,9 @@ union tree_node;
struct varasm_status; struct varasm_status;
struct varray_head_tag; struct varray_head_tag;
/* Constants for general use. */
extern char *empty_string;
/* Manipulate global roots that are needed between calls to gc. */ /* 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_root PROTO ((void *base, int nelt, int size, void (*)(void *)));
void ggc_add_rtx_root PROTO ((struct rtx_def **, int nelt)); void ggc_add_rtx_root PROTO ((struct rtx_def **, int nelt));
......
...@@ -1540,7 +1540,7 @@ static void ...@@ -1540,7 +1540,7 @@ static void
init_arc_profiler () init_arc_profiler ()
{ {
/* Generate and save a copy of this so it can be shared. */ /* 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); ASM_GENERATE_INTERNAL_LABEL (name, "LPBX", 2);
profiler_label = gen_rtx_SYMBOL_REF (Pmode, name); profiler_label = gen_rtx_SYMBOL_REF (Pmode, name);
ggc_add_rtx_root (&profiler_label, 1); ggc_add_rtx_root (&profiler_label, 1);
...@@ -1678,10 +1678,11 @@ output_func_start_profiler () ...@@ -1678,10 +1678,11 @@ output_func_start_profiler ()
expand_function_start (fndecl, 0); expand_function_start (fndecl, 0);
/* Actually generate the code to call __bb_init_func. */ /* 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); ASM_GENERATE_INTERNAL_LABEL (name, "LPBX", 0);
table_address = force_reg (Pmode, gen_rtx_SYMBOL_REF (Pmode, name)); 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); mode, 1, table_address, Pmode);
expand_function_end (input_filename, lineno, 0); expand_function_end (input_filename, lineno, 0);
......
...@@ -401,6 +401,9 @@ struct stmt_status ...@@ -401,6 +401,9 @@ struct stmt_status
/* Non-zero if we are using EH to handle cleanus. */ /* Non-zero if we are using EH to handle cleanus. */
static int using_eh_for_cleanups_p = 0; 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 int n_occurrences PROTO((int, const char *));
static void expand_goto_internal PROTO((tree, rtx, rtx)); static void expand_goto_internal PROTO((tree, rtx, rtx));
...@@ -592,7 +595,17 @@ mark_stmt_status (p) ...@@ -592,7 +595,17 @@ mark_stmt_status (p)
void void
init_stmt () init_stmt ()
{ {
int i;
gcc_obstack_init (&stmt_obstack); 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 void
...@@ -1547,9 +1560,9 @@ expand_asm_operands (string, outputs, inputs, clobbers, vol, filename, line) ...@@ -1547,9 +1560,9 @@ expand_asm_operands (string, outputs, inputs, clobbers, vol, filename, line)
argvec = rtvec_alloc (ninputs); argvec = rtvec_alloc (ninputs);
constraints = rtvec_alloc (ninputs); constraints = rtvec_alloc (ninputs);
body = gen_rtx_ASM_OPERANDS (VOIDmode, body = gen_rtx_ASM_OPERANDS (VOIDmode, TREE_STRING_POINTER (string),
TREE_STRING_POINTER (string), "", 0, argvec, empty_string, 0, argvec, constraints,
constraints, filename, line); filename, line);
MEM_VOLATILE_P (body) = vol; MEM_VOLATILE_P (body) = vol;
...@@ -1717,14 +1730,12 @@ expand_asm_operands (string, outputs, inputs, clobbers, vol, filename, line) ...@@ -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 in-out operands, copy output rtx to input rtx. */
for (i = 0; i < ninout; i++) 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]; int j = inout_opnum[i];
XVECEXP (body, 3, ninputs - ninout + i) /* argvec */ XVECEXP (body, 3, ninputs - ninout + i) /* argvec */
= output_rtx[j]; = output_rtx[j];
XVECEXP (body, 4, ninputs - ninout + i) /* constraints */ 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 /* Now, for each output, construct an rtx
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment