Commit ce662eca authored by John van Groningen's avatar John van Groningen
Browse files

fix bug that occurs if the same label name is used for inline code in different system modules

parent 5455f843
...@@ -470,6 +470,7 @@ BEDeclareDclModule (int moduleIndex, CleanString name, CleanString modificationT ...@@ -470,6 +470,7 @@ BEDeclareDclModule (int moduleIndex, CleanString name, CleanString modificationT
dclModule->dm_modification_time = ConvertCleanString (modificationTime); dclModule->dm_modification_time = ConvertCleanString (modificationTime);
dclModule->dm_system_module = isSystemModule; dclModule->dm_system_module = isSystemModule;
dclModule->dm_symbols = gBEState.be_allSymbols; /* ??? too many symbols? */ dclModule->dm_symbols = gBEState.be_allSymbols; /* ??? too many symbols? */
dclModule->dm_system_module_table_kind = FirstSystemModuleTable + moduleIndex;
AddOpenDefinitionModule (moduleNameSymbol, dclModule); AddOpenDefinitionModule (moduleNameSymbol, dclModule);
......
...@@ -91,7 +91,7 @@ void ReadInlineCode (void) ...@@ -91,7 +91,7 @@ void ReadInlineCode (void)
if (symbol!=NULL && d_mod->mod_name->symb_ident->ident_name!=CurrentModule) if (symbol!=NULL && d_mod->mod_name->symb_ident->ident_name!=CurrentModule)
/* Get the inline instructions of all the rules that are defined in this module */ /* Get the inline instructions of all the rules that are defined in this module */
ScanInlineFile (d_mod->mod_name->symb_ident->ident_name); ScanInlineFile (d_mod->mod_name->symb_ident->ident_name,def_mod->dm_system_module_table_kind);
} }
} }
} }
......
...@@ -38,8 +38,6 @@ extern int selector_m_error_lab_used; ...@@ -38,8 +38,6 @@ extern int selector_m_error_lab_used;
extern LabDef selector_m_error_lab; extern LabDef selector_m_error_lab;
extern LabDef *unboxed_cons_label (SymbolP cons_symbol_p); extern LabDef *unboxed_cons_label (SymbolP cons_symbol_p);
extern void ScanInlineFile (char *fname);
extern Bool EqualState (StateS st1, StateS st2); extern Bool EqualState (StateS st1, StateS st2);
extern void DetermineSizeOfArguments (ArgS *args,int *a_offset_p,int *b_offset_p); extern void DetermineSizeOfArguments (ArgS *args,int *a_offset_p,int *b_offset_p);
extern void SubSizeOfState (StateS state,int *a_offset_p,int *b_offset_p); extern void SubSizeOfState (StateS state,int *a_offset_p,int *b_offset_p);
......
...@@ -68,4 +68,4 @@ extern void ScanInitialise (void); ...@@ -68,4 +68,4 @@ extern void ScanInitialise (void);
extern void ScanInitIdentStringTable (void); extern void ScanInitIdentStringTable (void);
extern void ScanInlineFile (char *fname); extern void ScanInlineFile (char *fname,TableKind table_kind);
...@@ -185,7 +185,7 @@ PutKeyWordInTable (KeyWordInfoP keyWord) ...@@ -185,7 +185,7 @@ PutKeyWordInTable (KeyWordInfoP keyWord)
identString->ident = ident; identString->ident = ident;
} /* PutKeyWordInTable */ } /* PutKeyWordInTable */
static IdentP RetrieveFromSymbolTable (char *string) static IdentP RetrieveFromSymbolTable (char *string,TableKind table_kind)
{ {
char *s; char *s;
unsigned long hash; unsigned long hash;
...@@ -222,7 +222,7 @@ static IdentP RetrieveFromSymbolTable (char *string) ...@@ -222,7 +222,7 @@ static IdentP RetrieveFromSymbolTable (char *string)
if (identString != NIL){ if (identString != NIL){
for (ident = identString->ident; ident != NIL; ident = ident->ident_next) for (ident = identString->ident; ident != NIL; ident = ident->ident_next)
if (ident->ident_table == SymbolIdTable) if (ident->ident_table == table_kind)
break; break;
} else } else
ident = NIL; ident = NIL;
...@@ -425,7 +425,7 @@ void clear_inline_cache (void) ...@@ -425,7 +425,7 @@ void clear_inline_cache (void)
} }
#endif #endif
void ScanInlineFile (char *fname) void ScanInlineFile (char *fname,TableKind system_module_table_kind)
{ {
register char *tail, *instr, *importingModule, *importingExtension; register char *tail, *instr, *importingModule, *importingExtension;
IdentP instrid; IdentP instrid;
...@@ -485,7 +485,7 @@ void ScanInlineFile (char *fname) ...@@ -485,7 +485,7 @@ void ScanInlineFile (char *fname)
continue; continue;
*tail = '\0'; *tail = '\0';
if (! (instrid = RetrieveFromSymbolTable (instr))) if (! (instrid = RetrieveFromSymbolTable (instr,system_module_table_kind)))
continue; continue;
if (instrid->ident_environ!=importingModule) if (instrid->ident_environ!=importingModule)
continue; continue;
......
...@@ -51,7 +51,7 @@ typedef enum { ...@@ -51,7 +51,7 @@ typedef enum {
typedef enum { typedef enum {
int_type, bool_type, char_type, real_type, int_type, bool_type, char_type, real_type,
file_type, string_type,world_type, procid_type, file_type, string_type, world_type, procid_type,
redid_type, redid_type,
#ifdef CLEAN2 #ifdef CLEAN2
rational_denot, rational_denot,
...@@ -114,7 +114,7 @@ typedef struct record_state_descr { ...@@ -114,7 +114,7 @@ typedef struct record_state_descr {
} *RecordStateDescr; } *RecordStateDescr;
typedef enum { typedef enum {
SymbolIdTable, TypeSymbolIdTable, TypeVarIdTable, ModuleIdTable, FieldIdTable, KeyWordTable, InternalIdTable SymbolIdTable, TypeSymbolIdTable, ModuleIdTable, KeyWordTable, FirstSystemModuleTable, LastSystemModuleTable=0x7fff
} TableKind; } TableKind;
typedef union symb_value { typedef union symb_value {
...@@ -720,6 +720,7 @@ struct def_repr { ...@@ -720,6 +720,7 @@ struct def_repr {
SynTypes dm_syn_types; SynTypes dm_syn_types;
AbsTypes dm_abs_types; AbsTypes dm_abs_types;
RuleTypes dm_rules; RuleTypes dm_rules;
TableKind dm_system_module_table_kind;
Bool dm_system_module; Bool dm_system_module;
#if WRITE_DCL_MODIFICATION_TIME #if WRITE_DCL_MODIFICATION_TIME
ModuleFileTime dm_modification_time; ModuleFileTime dm_modification_time;
......
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