Remove weird tag flags.
This commit is contained in:
parent
63e5ab18ff
commit
6db4f31a10
@ -524,16 +524,15 @@ typedef enum s_optmark {
|
|||||||
|
|
||||||
#define suSLEEP_INSTR 0x01 /* the "sleep" instruction was used */
|
#define suSLEEP_INSTR 0x01 /* the "sleep" instruction was used */
|
||||||
|
|
||||||
#define PUBLICTAG 0x80000000Lu
|
|
||||||
#define FIXEDTAG 0x40000000Lu
|
#define FIXEDTAG 0x40000000Lu
|
||||||
#define FUNCTAG 0x20000000Lu
|
#define FUNCTAG 0x20000000Lu
|
||||||
#define OBJECTTAG 0x10000000Lu
|
#define OBJECTTAG 0x10000000Lu
|
||||||
#define ENUMTAG 0x08000000Lu
|
#define ENUMTAG 0x08000000Lu
|
||||||
#define METHODMAPTAG 0x04000000Lu
|
#define METHODMAPTAG 0x04000000Lu
|
||||||
#define STRUCTTAG 0x02000000Lu
|
#define STRUCTTAG 0x02000000Lu
|
||||||
#define TAGMASK (~PUBLICTAG)
|
|
||||||
#define TAGTYPEMASK (FUNCTAG | OBJECTTAG | ENUMTAG | METHODMAPTAG | STRUCTTAG)
|
#define TAGTYPEMASK (FUNCTAG | OBJECTTAG | ENUMTAG | METHODMAPTAG | STRUCTTAG)
|
||||||
#define TAGFLAGMASK (FIXEDTAG | TAGTYPEMASK)
|
#define TAGFLAGMASK (FIXEDTAG | TAGTYPEMASK)
|
||||||
|
#define TAGID(tag) ((tag) & ~(TAGFLAGMASK))
|
||||||
#define CELL_MAX (((ucell)1 << (sizeof(cell)*8-1)) - 1)
|
#define CELL_MAX (((ucell)1 << (sizeof(cell)*8-1)) - 1)
|
||||||
|
|
||||||
|
|
||||||
@ -591,7 +590,6 @@ constvalue *append_constval(constvalue *table,const char *name,cell val,int inde
|
|||||||
constvalue *find_constval(constvalue *table,char *name,int index);
|
constvalue *find_constval(constvalue *table,char *name,int index);
|
||||||
void delete_consttable(constvalue *table);
|
void delete_consttable(constvalue *table);
|
||||||
symbol *add_constant(const char *name,cell val,int vclass,int tag);
|
symbol *add_constant(const char *name,cell val,int vclass,int tag);
|
||||||
void exporttag(int tag);
|
|
||||||
void sc_attachdocumentation(symbol *sym);
|
void sc_attachdocumentation(symbol *sym);
|
||||||
constvalue *find_tag_byval(int tag);
|
constvalue *find_tag_byval(int tag);
|
||||||
int get_actual_compound(symbol *sym);
|
int get_actual_compound(symbol *sym);
|
||||||
|
@ -617,7 +617,7 @@ const char *pc_tagname(int tag)
|
|||||||
{
|
{
|
||||||
constvalue *ptr=tagname_tab.next;
|
constvalue *ptr=tagname_tab.next;
|
||||||
for (; ptr; ptr=ptr->next) {
|
for (; ptr; ptr=ptr->next) {
|
||||||
if ((int)(ptr->value & TAGMASK) == (tag & TAGMASK))
|
if (TAGID(ptr->value) == TAGID(tag))
|
||||||
return ptr->name;
|
return ptr->name;
|
||||||
}
|
}
|
||||||
return "__unknown__";
|
return "__unknown__";
|
||||||
@ -638,7 +638,7 @@ int pc_findtag(const char *name)
|
|||||||
constvalue *ptr=tagname_tab.next;
|
constvalue *ptr=tagname_tab.next;
|
||||||
for (; ptr; ptr=ptr->next) {
|
for (; ptr; ptr=ptr->next) {
|
||||||
if (strcmp(name,ptr->name)==0)
|
if (strcmp(name,ptr->name)==0)
|
||||||
return (int)(ptr->value & TAGMASK);
|
return ptr->value;
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -667,27 +667,25 @@ int pc_addtag(const char *name)
|
|||||||
int pc_addtag_flags(const char *name, int flags)
|
int pc_addtag_flags(const char *name, int flags)
|
||||||
{
|
{
|
||||||
constvalue *ptr;
|
constvalue *ptr;
|
||||||
int last,tag;
|
int last;
|
||||||
|
|
||||||
assert((flags & FUNCTAG) || strchr(name,':')==NULL); /* colon should already have been stripped */
|
assert((flags & FUNCTAG) || strchr(name,':')==NULL); /* colon should already have been stripped */
|
||||||
last=0;
|
last=0;
|
||||||
ptr=tagname_tab.next;
|
ptr=tagname_tab.next;
|
||||||
while (ptr!=NULL) {
|
while (ptr!=NULL) {
|
||||||
tag=(int)(ptr->value & TAGMASK);
|
|
||||||
if (strcmp(name,ptr->name)==0) {
|
if (strcmp(name,ptr->name)==0) {
|
||||||
|
// Update the flag set.
|
||||||
ptr->value |= flags;
|
ptr->value |= flags;
|
||||||
return ptr->value & TAGMASK;
|
return ptr->value;
|
||||||
}
|
}
|
||||||
tag &= ~TAGFLAGMASK;
|
if (TAGID(ptr->value) > last)
|
||||||
if (tag>last)
|
last = TAGID(ptr->value);
|
||||||
last=tag;
|
ptr = ptr->next;
|
||||||
ptr=ptr->next;
|
|
||||||
} /* while */
|
} /* while */
|
||||||
|
|
||||||
/* tagname currently unknown, add it */
|
/* tagname currently unknown, add it */
|
||||||
tag=last+1; /* guaranteed not to exist already */
|
int tag = (last + 1) | flags;
|
||||||
tag|=flags;
|
append_constval(&tagname_tab, name, (cell)tag, 0);
|
||||||
append_constval(&tagname_tab,name,(cell)tag,0);
|
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3942,13 +3940,7 @@ static void domethodmap(LayoutSpec spec)
|
|||||||
if (matchtoken(tNULLABLE) || (parent && parent->nullable))
|
if (matchtoken(tNULLABLE) || (parent && parent->nullable))
|
||||||
map->nullable = TRUE;
|
map->nullable = TRUE;
|
||||||
} else {
|
} else {
|
||||||
constvalue *tagptr = pc_tagptr(mapname);
|
map->tag = pc_addtag_flags(mapname, FIXEDTAG | OBJECTTAG);
|
||||||
if (!tagptr) {
|
|
||||||
map->tag = pc_addtag_flags(mapname, FIXEDTAG | OBJECTTAG);
|
|
||||||
} else {
|
|
||||||
tagptr->value |= OBJECTTAG;
|
|
||||||
map->tag = (tagptr->value & TAGMASK);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
methodmap_add(map);
|
methodmap_add(map);
|
||||||
|
|
||||||
@ -4907,7 +4899,6 @@ static int check_operatortag(int opertok,int resulttag,char *opername)
|
|||||||
|
|
||||||
static char *tag2str(char *dest,int tag)
|
static char *tag2str(char *dest,int tag)
|
||||||
{
|
{
|
||||||
tag &= TAGMASK;
|
|
||||||
assert(tag>=0);
|
assert(tag>=0);
|
||||||
sprintf(dest,"0%x",tag);
|
sprintf(dest,"0%x",tag);
|
||||||
return isdigit(dest[1]) ? &dest[1] : dest;
|
return isdigit(dest[1]) ? &dest[1] : dest;
|
||||||
@ -4956,11 +4947,7 @@ static int parse_funcname(char *fname,int *tag1,int *tag2,char *opname)
|
|||||||
|
|
||||||
constvalue *find_tag_byval(int tag)
|
constvalue *find_tag_byval(int tag)
|
||||||
{
|
{
|
||||||
constvalue *tagsym;
|
return find_constval_byval(&tagname_tab, tag);
|
||||||
tagsym=find_constval_byval(&tagname_tab,tag & ~PUBLICTAG);
|
|
||||||
if (tagsym==NULL)
|
|
||||||
tagsym=find_constval_byval(&tagname_tab,tag | PUBLICTAG);
|
|
||||||
return tagsym;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char *funcdisplayname(char *dest,char *funcname)
|
char *funcdisplayname(char *dest,char *funcname)
|
||||||
@ -7586,20 +7573,6 @@ static void docont(void)
|
|||||||
jumplabel(ptr[wqLOOP]);
|
jumplabel(ptr[wqLOOP]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void exporttag(int tag)
|
|
||||||
{
|
|
||||||
/* find the tag by value in the table, then set the top bit to mark it
|
|
||||||
* "public"
|
|
||||||
*/
|
|
||||||
if (tag!=0 && (tag & PUBLICTAG)==0) {
|
|
||||||
constvalue *ptr;
|
|
||||||
for (ptr=tagname_tab.next; ptr!=NULL && tag!=(int)(ptr->value & TAGMASK); ptr=ptr->next)
|
|
||||||
/* nothing */;
|
|
||||||
if (ptr!=NULL)
|
|
||||||
ptr->value |= PUBLICTAG;
|
|
||||||
} /* if */
|
|
||||||
}
|
|
||||||
|
|
||||||
static void doexit(void)
|
static void doexit(void)
|
||||||
{
|
{
|
||||||
int tag=0;
|
int tag=0;
|
||||||
@ -7611,7 +7584,6 @@ static void doexit(void)
|
|||||||
ldconst(0,sPRI);
|
ldconst(0,sPRI);
|
||||||
} /* if */
|
} /* if */
|
||||||
ldconst(tag,sALT);
|
ldconst(tag,sALT);
|
||||||
exporttag(tag);
|
|
||||||
destructsymbols(&loctab,0); /* call destructor for *all* locals */
|
destructsymbols(&loctab,0); /* call destructor for *all* locals */
|
||||||
ffabort(xEXIT);
|
ffabort(xEXIT);
|
||||||
}
|
}
|
||||||
@ -7627,7 +7599,6 @@ static void dosleep(void)
|
|||||||
ldconst(0,sPRI);
|
ldconst(0,sPRI);
|
||||||
} /* if */
|
} /* if */
|
||||||
ldconst(tag,sALT);
|
ldconst(tag,sALT);
|
||||||
exporttag(tag);
|
|
||||||
ffabort(xSLEEP);
|
ffabort(xSLEEP);
|
||||||
|
|
||||||
/* for stack usage checking, mark the use of the sleep instruction */
|
/* for stack usage checking, mark the use of the sleep instruction */
|
||||||
|
@ -1135,7 +1135,6 @@ static int command(void)
|
|||||||
} /* if */
|
} /* if */
|
||||||
/* add the tag (make it public) and check the values */
|
/* add the tag (make it public) and check the values */
|
||||||
i=pc_addtag(name);
|
i=pc_addtag(name);
|
||||||
exporttag(i);
|
|
||||||
if (sc_rationaltag==0 || (sc_rationaltag==i && rational_digits==(int)digits)) {
|
if (sc_rationaltag==0 || (sc_rationaltag==i && rational_digits==(int)digits)) {
|
||||||
sc_rationaltag=i;
|
sc_rationaltag=i;
|
||||||
rational_digits=(int)digits;
|
rational_digits=(int)digits;
|
||||||
|
@ -1806,10 +1806,9 @@ static int hier2(value *lval)
|
|||||||
else if (level==sym->dim.array.level+1 && idxsym!=NULL)
|
else if (level==sym->dim.array.level+1 && idxsym!=NULL)
|
||||||
tag= idxsym->x.tags.index;
|
tag= idxsym->x.tags.index;
|
||||||
} /* if */
|
} /* if */
|
||||||
exporttag(tag);
|
|
||||||
clear_value(lval);
|
clear_value(lval);
|
||||||
lval->ident=iCONSTEXPR;
|
lval->ident=iCONSTEXPR;
|
||||||
lval->constval=tag | PUBLICTAG;
|
lval->constval=tag;
|
||||||
ldconst(lval->constval,sPRI);
|
ldconst(lval->constval,sPRI);
|
||||||
while (paranthese--)
|
while (paranthese--)
|
||||||
needtoken(')');
|
needtoken(')');
|
||||||
@ -2899,8 +2898,7 @@ static int nesting=0;
|
|||||||
asz=find_constval(&taglst,arg[argidx].defvalue.size.symname,
|
asz=find_constval(&taglst,arg[argidx].defvalue.size.symname,
|
||||||
arg[argidx].defvalue.size.level);
|
arg[argidx].defvalue.size.level);
|
||||||
if (asz != NULL) {
|
if (asz != NULL) {
|
||||||
exporttag(asz->value);
|
array_sz=asz->value; /* must be set, because it just was exported */
|
||||||
array_sz=asz->value | PUBLICTAG; /* must be set, because it just was exported */
|
|
||||||
} else {
|
} else {
|
||||||
array_sz=0;
|
array_sz=0;
|
||||||
} /* if */
|
} /* if */
|
||||||
|
Loading…
Reference in New Issue
Block a user