Commit 5f642a7d authored by John van Groningen's avatar John van Groningen
Browse files

initialise sdef_mark with 0 and remove fields from list of symbols,

to prevent unnecessary imports and double imports of fields in the .abc file
parent f9c36020
...@@ -198,26 +198,35 @@ PredefinedSymbol (SymbKind symbolKind, int arity) ...@@ -198,26 +198,35 @@ PredefinedSymbol (SymbKind symbolKind, int arity)
} /* PredefinedSymbol */ } /* PredefinedSymbol */
static SymbolP static SymbolP
AllocateSymbols (int nSymbols, SymbolP otherSymbols) AllocateSymbols (int nTypeRecordAndConstructorSymbols,int nFieldSymbols, SymbolP allSymbols)
{ {
int i; int nSymbols;
SymbolP symbols;
if (nSymbols > 0) nSymbols=nTypeRecordAndConstructorSymbols+nFieldSymbols;
{
symbols = (SymbolP) ConvertAlloc (nSymbols * sizeof (SymbolS));
for (i = 0; i < nSymbols; i++) if (nSymbols > 0){
{ int i;
SymbolP symbols;
symbols = (SymbolP) ConvertAlloc (nSymbols * sizeof (SymbolS));
for (i = 0; i < nTypeRecordAndConstructorSymbols; i++){
symbols [i].symb_kind = erroneous_symb; symbols [i].symb_kind = erroneous_symb;
symbols [i].symb_next = &symbols [i+1]; symbols [i].symb_next = &symbols [i+1];
} }
symbols [nSymbols-1].symb_next = otherSymbols;
if (nTypeRecordAndConstructorSymbols>0){
symbols [nTypeRecordAndConstructorSymbols-1].symb_next = allSymbols;
allSymbols=symbols;
}
for (i = nTypeRecordAndConstructorSymbols; i < nSymbols; i++){
symbols [i].symb_kind = erroneous_symb;
symbols [i].symb_next = NULL;
}
} }
else
symbols = otherSymbols;
return (symbols); return (allSymbols);
} /* AllocateSymbols */ } /* AllocateSymbols */
static void static void
...@@ -288,7 +297,6 @@ NewGuardNode (NodeP ifNode, NodeP node, NodeDefP nodeDefs, StrictNodeIdP stricts ...@@ -288,7 +297,6 @@ NewGuardNode (NodeP ifNode, NodeP node, NodeDefP nodeDefs, StrictNodeIdP stricts
return (guardNode); return (guardNode);
} /* NewGuardNode */ } /* NewGuardNode */
static void static void
DeclareModule (int moduleIndex, char *name, Bool isSystemModule, int nFunctions, DeclareModule (int moduleIndex, char *name, Bool isSystemModule, int nFunctions,
int nTypes, int nConstructors, int nFields) int nTypes, int nConstructors, int nFields)
...@@ -298,7 +306,7 @@ DeclareModule (int moduleIndex, char *name, Bool isSystemModule, int nFunctions, ...@@ -298,7 +306,7 @@ DeclareModule (int moduleIndex, char *name, Bool isSystemModule, int nFunctions,
allSymbols = gBEState.be_allSymbols; allSymbols = gBEState.be_allSymbols;
allSymbols = AllocateSymbols (nFunctions + nTypes + nConstructors + nFields, allSymbols); allSymbols = AllocateSymbols (nFunctions + nTypes + nConstructors, nFields, allSymbols);
Assert ((unsigned int) moduleIndex < gBEState.be_nModules); Assert ((unsigned int) moduleIndex < gBEState.be_nModules);
module = &gBEState.be_modules [moduleIndex]; module = &gBEState.be_modules [moduleIndex];
...@@ -333,6 +341,7 @@ DeclareModule (int moduleIndex, char *name, Bool isSystemModule, int nFunctions, ...@@ -333,6 +341,7 @@ DeclareModule (int moduleIndex, char *name, Bool isSystemModule, int nFunctions,
SymbDef newSymbDef; SymbDef newSymbDef;
newSymbDef = ConvertAllocType (SymbDefS); newSymbDef = ConvertAllocType (SymbDefS);
newSymbDef->sdef_mark = 0;
newSymbDef->sdef_isused = False; newSymbDef->sdef_isused = False;
symbols [i].symb_def = newSymbDef; symbols [i].symb_def = newSymbDef;
} }
...@@ -747,6 +756,7 @@ BESpecialArrayFunctionSymbol (BEArrayFunKind arrayFunKind, int functionIndex, in ...@@ -747,6 +756,7 @@ BESpecialArrayFunctionSymbol (BEArrayFunKind arrayFunKind, int functionIndex, in
newsdef->sdef_ident = newIdent; newsdef->sdef_ident = newIdent;
newsdef->sdef_module = gBEState.be_icl.beicl_module->im_name->symb_def->sdef_module; /* phew! */ newsdef->sdef_module = gBEState.be_icl.beicl_module->im_name->symb_def->sdef_module; /* phew! */
newsdef->sdef_over_arity = 0; newsdef->sdef_over_arity = 0;
newsdef->sdef_mark = 0;
newsdef->sdef_isused = True; newsdef->sdef_isused = True;
newsdef->sdef_exported = False; newsdef->sdef_exported = False;
newsdef->sdef_arity = newTypeAlt->type_alt_lhs->type_node_arity; newsdef->sdef_arity = newTypeAlt->type_alt_lhs->type_node_arity;
...@@ -2578,6 +2588,7 @@ BEDeclareRuleType (int functionIndex, int moduleIndex, CleanString name) ...@@ -2578,6 +2588,7 @@ BEDeclareRuleType (int functionIndex, int moduleIndex, CleanString name)
newSymbDef->sdef_exported = False; newSymbDef->sdef_exported = False;
newSymbDef->sdef_module = module->bem_name; newSymbDef->sdef_module = module->bem_name;
newSymbDef->sdef_ident = newIdent; newSymbDef->sdef_ident = newIdent;
newSymbDef->sdef_mark = 0;
newSymbDef->sdef_isused = 0; newSymbDef->sdef_isused = 0;
newSymbDef->sdef_line = 0; /* used in PrintSymbolOfIdent */ newSymbDef->sdef_line = 0; /* used in PrintSymbolOfIdent */
...@@ -2676,6 +2687,7 @@ BEDeclareType (int typeIndex, int moduleIndex, CleanString name) ...@@ -2676,6 +2687,7 @@ BEDeclareType (int typeIndex, int moduleIndex, CleanString name)
newSymbDef->sdef_kind = NEWDEFINITION; newSymbDef->sdef_kind = NEWDEFINITION;
newSymbDef->sdef_exported = False; newSymbDef->sdef_exported = False;
newSymbDef->sdef_dcl_icl = NULL; newSymbDef->sdef_dcl_icl = NULL;
newSymbDef->sdef_mark = 0;
newSymbDef->sdef_isused = 0; newSymbDef->sdef_isused = 0;
newSymbDef->sdef_module = module->bem_name; newSymbDef->sdef_module = module->bem_name;
...@@ -2955,6 +2967,7 @@ BEDeclareField (int fieldIndex, int moduleIndex, CleanString name) ...@@ -2955,6 +2967,7 @@ BEDeclareField (int fieldIndex, int moduleIndex, CleanString name)
newSymbDef->sdef_exported = False; newSymbDef->sdef_exported = False;
newSymbDef->sdef_module = module->bem_name; newSymbDef->sdef_module = module->bem_name;
newSymbDef->sdef_ident = newIdent; newSymbDef->sdef_ident = newIdent;
newSymbDef->sdef_mark = 0;
newSymbDef->sdef_isused = 0; newSymbDef->sdef_isused = 0;
fields [fieldIndex].symb_kind = definition; fields [fieldIndex].symb_kind = definition;
...@@ -3038,6 +3051,7 @@ BEDeclareConstructor (int constructorIndex, int moduleIndex, CleanString name) ...@@ -3038,6 +3051,7 @@ BEDeclareConstructor (int constructorIndex, int moduleIndex, CleanString name)
newSymbDef->sdef_exported = False; newSymbDef->sdef_exported = False;
newSymbDef->sdef_module = module->bem_name; newSymbDef->sdef_module = module->bem_name;
newSymbDef->sdef_ident = newIdent; newSymbDef->sdef_ident = newIdent;
newSymbDef->sdef_mark = 0;
newSymbDef->sdef_isused = 0; newSymbDef->sdef_isused = 0;
newSymbDef->sdef_no_sa = False; newSymbDef->sdef_no_sa = False;
......
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