use a new struct for symbols

Symbols are a useful abstraction
that occurs in both Con and Alias.
In this patch they get their own
struct. This new struct packages
a symbol name and a type; the type
tells us where the symbol name
must be interpreted (currently, in
gobal memory or in thread-local
storage).

The refactor fixed a bug in
addcon(), proving the value of
packaging symbol names with their
type.
This commit is contained in:
Quentin Carbonneaux 2022-11-22 21:44:44 +01:00
parent 04e2640901
commit cbee74bdb4
12 changed files with 68 additions and 58 deletions

4
load.c
View file

@ -152,7 +152,9 @@ load(Slice sl, bits msk, Loc *l)
break;
case ACon:
case ASym:
c = curf->con[a->u.sym.con];
memset(&c, 0, sizeof c);
c.type = CAddr;
c.sym = a->u.sym;
c.bits.i = a->offset;
r = newcon(&c, curf);
break;