intern symbol names
Symbols in the source file are still limited in length because the rest of the code assumes that strings always fit in NString bytes. Regardless, there is already a benefit because comparing/copying symbol names does not require using strcmp()/strcpy() anymore.
This commit is contained in:
parent
2d02070af0
commit
a3a1451c5f
10 changed files with 143 additions and 87 deletions
13
all.h
13
all.h
|
@ -275,7 +275,7 @@ struct Alias {
|
|||
#define astack(t) ((t) & 1)
|
||||
} type;
|
||||
Ref base;
|
||||
char label[NString];
|
||||
uint32_t label;
|
||||
int64_t offset;
|
||||
Alias *slot;
|
||||
};
|
||||
|
@ -312,7 +312,7 @@ struct Con {
|
|||
CBits,
|
||||
CAddr,
|
||||
} type;
|
||||
char label[NString];
|
||||
uint32_t label;
|
||||
union {
|
||||
int64_t i;
|
||||
double d;
|
||||
|
@ -411,19 +411,22 @@ typedef enum {
|
|||
|
||||
extern Typ *typ;
|
||||
extern Ins insb[NIns], *curi;
|
||||
uint32_t hash(char *);
|
||||
void die_(char *, char *, ...) __attribute__((noreturn));
|
||||
void *emalloc(size_t);
|
||||
void *alloc(size_t);
|
||||
void freeall(void);
|
||||
void *vnew(ulong, size_t, Pool);
|
||||
void vfree(void *);
|
||||
void vgrow(void *, ulong);
|
||||
uint32_t intern(char *);
|
||||
char *str(uint32_t);
|
||||
int argcls(Ins *, int);
|
||||
int iscmp(int, int *, int *);
|
||||
void emit(int, int, Ref, Ref, Ref);
|
||||
void emiti(Ins);
|
||||
void idup(Ins **, Ins *, ulong);
|
||||
Ins *icpy(Ins *, Ins *, ulong);
|
||||
void *vnew(ulong, size_t, Pool);
|
||||
void vfree(void *);
|
||||
void vgrow(void *, ulong);
|
||||
int cmpop(int);
|
||||
int cmpneg(int);
|
||||
int clsmerge(short *, short);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue