Commit cc19bc7f by Janne Blomqvist

Reduce size of pointer_info tree, minor cleanups.

2012-01-29  Janne Blomqvist  <jb@gcc.gnu.org>

	* module.c (pointer_info): Make true_name and module pointers
	rather than arrays, order pointers before other fields.
	(free_pi_tree): free true_name and module as well.
	(mio_read_string): Rename to read_string.
	(mio_write_string): Remove.
	(load_commons): Use read_string.
	(read_module): Use read_string rather than mio_internal_string.
	(write_blank_common): Call write_atom directly.
	(write_symbol): Likewise.

From-SVN: r183681
parent 4ed1b019
2012-01-29 Janne Blomqvist <jb@gcc.gnu.org>
* module.c (pointer_info): Make true_name and module pointers
rather than arrays, order pointers before other fields.
(free_pi_tree): free true_name and module as well.
(mio_read_string): Rename to read_string.
(mio_write_string): Remove.
(load_commons): Use read_string.
(read_module): Use read_string rather than mio_internal_string.
(write_blank_common): Call write_atom directly.
(write_symbol): Likewise.
2012-01-29 Tobias Burnus <burnus@net-b.de> 2012-01-29 Tobias Burnus <burnus@net-b.de>
PR fortran/51972 PR fortran/51972
......
...@@ -155,13 +155,12 @@ typedef struct pointer_info ...@@ -155,13 +155,12 @@ typedef struct pointer_info
struct struct
{ {
gfc_symbol *sym; gfc_symbol *sym;
char true_name[GFC_MAX_SYMBOL_LEN + 1], module[GFC_MAX_SYMBOL_LEN + 1]; char *true_name, *module, *binding_label;
fixup_t *stfixup;
gfc_symtree *symtree;
enum gfc_rsym_state state; enum gfc_rsym_state state;
int ns, referenced, renamed; int ns, referenced, renamed;
module_locus where; module_locus where;
fixup_t *stfixup;
gfc_symtree *symtree;
char* binding_label;
} }
rsym; rsym;
...@@ -229,7 +228,11 @@ free_pi_tree (pointer_info *p) ...@@ -229,7 +228,11 @@ free_pi_tree (pointer_info *p)
free_pi_tree (p->right); free_pi_tree (p->right);
if (iomode == IO_INPUT) if (iomode == IO_INPUT)
{
XDELETEVEC (p->u.rsym.true_name);
XDELETEVEC (p->u.rsym.module);
XDELETEVEC (p->u.rsym.binding_label); XDELETEVEC (p->u.rsym.binding_label);
}
free (p); free (p);
} }
...@@ -1442,6 +1445,19 @@ find_enum (const mstring *m) ...@@ -1442,6 +1445,19 @@ find_enum (const mstring *m)
} }
/* Read a string. The caller is responsible for freeing. */
static char*
read_string (void)
{
char* p;
require_atom (ATOM_STRING);
p = atom_string;
atom_string = NULL;
return p;
}
/**************** Module output subroutines ***************************/ /**************** Module output subroutines ***************************/
/* Output a character to a module file. */ /* Output a character to a module file. */
...@@ -1816,27 +1832,6 @@ mio_internal_string (char *string) ...@@ -1816,27 +1832,6 @@ mio_internal_string (char *string)
} }
/* Read a string. The caller is responsible for freeing. */
static char*
mio_read_string (void)
{
char* p;
require_atom (ATOM_STRING);
p = atom_string;
atom_string = NULL;
return p;
}
/* Write a string. */
static void
mio_write_string (const char* string)
{
write_atom (ATOM_STRING, string);
}
typedef enum typedef enum
{ AB_ALLOCATABLE, AB_DIMENSION, AB_EXTERNAL, AB_INTRINSIC, AB_OPTIONAL, { AB_ALLOCATABLE, AB_DIMENSION, AB_EXTERNAL, AB_INTRINSIC, AB_OPTIONAL,
AB_POINTER, AB_TARGET, AB_DUMMY, AB_RESULT, AB_DATA, AB_POINTER, AB_TARGET, AB_DUMMY, AB_RESULT, AB_DATA,
...@@ -4168,7 +4163,7 @@ load_commons (void) ...@@ -4168,7 +4163,7 @@ load_commons (void)
/* Get whether this was a bind(c) common or not. */ /* Get whether this was a bind(c) common or not. */
mio_integer (&p->is_bind_c); mio_integer (&p->is_bind_c);
/* Get the binding label. */ /* Get the binding label. */
label = mio_read_string (); label = read_string ();
if (strlen (label)) if (strlen (label))
p->binding_label = IDENTIFIER_POINTER (get_identifier (label)); p->binding_label = IDENTIFIER_POINTER (get_identifier (label));
XDELETEVEC (label); XDELETEVEC (label);
...@@ -4531,9 +4526,9 @@ read_module (void) ...@@ -4531,9 +4526,9 @@ read_module (void)
info->type = P_SYMBOL; info->type = P_SYMBOL;
info->u.rsym.state = UNUSED; info->u.rsym.state = UNUSED;
mio_internal_string (info->u.rsym.true_name); info->u.rsym.true_name = read_string ();
mio_internal_string (info->u.rsym.module); info->u.rsym.module = read_string ();
bind_label = mio_read_string (); bind_label = read_string ();
if (strlen (bind_label)) if (strlen (bind_label))
info->u.rsym.binding_label = bind_label; info->u.rsym.binding_label = bind_label;
else else
...@@ -4960,7 +4955,7 @@ write_blank_common (void) ...@@ -4960,7 +4955,7 @@ write_blank_common (void)
mio_integer (&is_bind_c); mio_integer (&is_bind_c);
/* Write out an empty binding label. */ /* Write out an empty binding label. */
mio_write_string (""); write_atom (ATOM_STRING, "");
mio_rparen (); mio_rparen ();
} }
...@@ -5064,7 +5059,7 @@ write_symbol (int n, gfc_symbol *sym) ...@@ -5064,7 +5059,7 @@ write_symbol (int n, gfc_symbol *sym)
mio_pool_string (&label); mio_pool_string (&label);
} }
else else
mio_write_string (""); write_atom (ATOM_STRING, "");
mio_pointer_ref (&sym->ns); mio_pointer_ref (&sym->ns);
......
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