Rename new_defspace() and defspace_new_loc().

This commit is contained in:
Bill Currie 2011-02-24 13:07:36 +09:00
parent 88cd37a3e2
commit c10a551c84
9 changed files with 22 additions and 23 deletions

View file

@ -47,8 +47,8 @@ typedef struct defspace_s {
int qfo_space; int qfo_space;
} defspace_t; } defspace_t;
defspace_t *new_defspace (void); defspace_t *defspace_new (void);
int defspace_new_loc (defspace_t *space, int size); int defspace_alloc_loc (defspace_t *space, int size);
void defspace_free_loc (defspace_t *space, int ofs, int size); void defspace_free_loc (defspace_t *space, int ofs, int size);
int defspace_add_data (defspace_t *space, pr_type_t *data, int size); int defspace_add_data (defspace_t *space, pr_type_t *data, int size);

View file

@ -130,7 +130,7 @@ new_def (const char *name, type_t *type, defspace_t *space,
error (0, "%s has incomplete type", name); error (0, "%s has incomplete type", name);
size = 1; size = 1;
} }
def->offset = defspace_new_loc (space, size); def->offset = defspace_alloc_loc (space, size);
} }
return def; return def;

View file

@ -78,7 +78,7 @@ grow_space (defspace_t *space)
} }
defspace_t * defspace_t *
new_defspace (void) defspace_new (void)
{ {
defspace_t *space; defspace_t *space;
@ -89,7 +89,7 @@ new_defspace (void)
} }
int int
defspace_new_loc (defspace_t *space, int size) defspace_alloc_loc (defspace_t *space, int size)
{ {
int ofs; int ofs;
locref_t *loc; locref_t *loc;
@ -180,7 +180,7 @@ defspace_add_data (defspace_t *space, pr_type_t *data, int size)
{ {
int loc; int loc;
loc = defspace_new_loc (space, size); loc = defspace_alloc_loc (space, size);
if (data) if (data)
memcpy (space->data + loc, data, size * sizeof (pr_type_t)); memcpy (space->data + loc, data, size * sizeof (pr_type_t));
return loc; return loc;

View file

@ -450,7 +450,7 @@ build_scope (symbol_t *fsym, symtab_t *parent)
symtab = new_symtab (parent, stab_local); symtab = new_symtab (parent, stab_local);
fsym->s.func->symtab = symtab; fsym->s.func->symtab = symtab;
symtab->space = new_defspace (); symtab->space = defspace_new ();
current_symtab = symtab; current_symtab = symtab;
if (fsym->type->t.func.num_params < 0) { if (fsym->type->t.func.num_params < 0) {

View file

@ -253,7 +253,7 @@ emit_value (ex_value_t *value, def_t *def)
} }
} else { } else {
cn = new_def (".imm", type, pr.near_data, st_static); cn = new_def (".imm", type, pr.near_data, st_static);
cn->offset = defspace_new_loc (pr.near_data, type_size (type)); cn->offset = defspace_alloc_loc (pr.near_data, type_size (type));
} }
cn->initialized = cn->constant = 1; cn->initialized = cn->constant = 1;
cn->nosave = 1; cn->nosave = 1;

View file

@ -267,10 +267,10 @@ linker_begin (void)
// the actual space data // the actual space data
work_strings = strpool_new (); work_strings = strpool_new ();
work_code = codespace_new (); work_code = codespace_new ();
work_near_data = new_defspace(); work_near_data = defspace_new ();
work_far_data = new_defspace(); work_far_data = defspace_new ();
work_entity_data = new_defspace(); work_entity_data = defspace_new ();
work_type_data = new_defspace(); work_type_data = defspace_new ();
} }
static void static void

View file

@ -86,7 +86,7 @@ qfo_new_encoding (type_t *type, int size)
size /= sizeof (pr_type_t); size /= sizeof (pr_type_t);
def = new_def (type->encoding, 0, pr.type_data, st_static); def = new_def (type->encoding, 0, pr.type_data, st_static);
def->offset = defspace_new_loc (pr.type_data, size); def->offset = defspace_alloc_loc (pr.type_data, size);
enc = D_POINTER (qfot_type_t, def); enc = D_POINTER (qfot_type_t, def);
enc->ty = type->ty; enc->ty = type->ty;

View file

@ -136,22 +136,22 @@ InitData (void)
pr.strings = strpool_new (); pr.strings = strpool_new ();
pr.num_functions = 1; pr.num_functions = 1;
pr.data = new_defspace (); pr.data = defspace_new ();
pr.far_data = new_defspace (); pr.far_data = defspace_new ();
pr.near_data = new_defspace (); pr.near_data = defspace_new ();
pr.near_data->data = calloc (65536, sizeof (pr_type_t)); pr.near_data->data = calloc (65536, sizeof (pr_type_t));
pr.near_data->max_size = 65536; pr.near_data->max_size = 65536;
pr.near_data->grow = 0; pr.near_data->grow = 0;
pr.type_data = new_defspace (); pr.type_data = defspace_new ();
defspace_new_loc (pr.type_data, 4); // reserve space for a null descriptor defspace_alloc_loc (pr.type_data, 4);// reserve space for a null descriptor
pr.symtab = new_symtab (0, stab_global); pr.symtab = new_symtab (0, stab_global);
pr.symtab->space = pr.near_data; pr.symtab->space = pr.near_data;
pr.entity_data = new_defspace (); pr.entity_data = defspace_new ();
numglobaldefs = 1; numglobaldefs = 1;
numfielddefs = 1; numfielddefs = 1;
@ -434,7 +434,7 @@ finish_compilation (void)
} }
df->parm_start = pr.near_data->size; df->parm_start = pr.near_data->size;
} else { } else {
df->parm_start = defspace_new_loc (pr.near_data, df->parm_start = defspace_alloc_loc (pr.near_data,
f->symtab->space->size); f->symtab->space->size);
num_localdefs += f->symtab->space->size; num_localdefs += f->symtab->space->size;
} }
@ -445,7 +445,7 @@ finish_compilation (void)
} }
} }
if (options.code.local_merging) if (options.code.local_merging)
defspace_new_loc (pr.near_data, num_localdefs); defspace_alloc_loc (pr.near_data, num_localdefs);
if (options.code.progsversion != PROG_ID_VERSION) { if (options.code.progsversion != PROG_ID_VERSION) {
//FIXME better init code //FIXME better init code

View file

@ -21,7 +21,6 @@ options_t options;
int num_linenos; int num_linenos;
pr_lineno_t *linenos; pr_lineno_t *linenos;
pr_info_t pr; pr_info_t pr;
defspace_t *new_defspace (void) {return 0;}
string_t ReuseString (const char *str) {return 0;} string_t ReuseString (const char *str) {return 0;}
void encode_type (struct dstring_s *str, type_t *type) {} void encode_type (struct dstring_s *str, type_t *type) {}
codespace_t *codespace_new (void) {return 0;} codespace_t *codespace_new (void) {return 0;}