aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjohnvg2016-06-06 13:03:37 +0000
committerjohnvg2016-06-06 13:03:37 +0000
commita24a86835136c77cd126dd9f39565b2c00b11efe (patch)
treea557d3cccf7b9b453bc72956f4bdcfd0c63a9f23
parentmake RetrieveFromSymbolTable static, (diff)
fix bug that occurs if the same label name is used for inline code in different system modules
git-svn-id: https://svn.cs.ru.nl/repos/clean-compiler/trunk@2722 1f8540f1-abd5-4d5b-9d24-4c5ce8603e2d
-rw-r--r--backendC/CleanCompilerSources/backend.c1
-rw-r--r--backendC/CleanCompilerSources/checker_2.c2
-rw-r--r--backendC/CleanCompilerSources/codegen2.h2
-rw-r--r--backendC/CleanCompilerSources/scanner.h2
-rw-r--r--backendC/CleanCompilerSources/scanner_2.c8
-rw-r--r--backendC/CleanCompilerSources/syntaxtr.t5
6 files changed, 10 insertions, 10 deletions
diff --git a/backendC/CleanCompilerSources/backend.c b/backendC/CleanCompilerSources/backend.c
index 32d2172..01b4b0e 100644
--- a/backendC/CleanCompilerSources/backend.c
+++ b/backendC/CleanCompilerSources/backend.c
@@ -470,6 +470,7 @@ BEDeclareDclModule (int moduleIndex, CleanString name, CleanString modificationT
dclModule->dm_modification_time = ConvertCleanString (modificationTime);
dclModule->dm_system_module = isSystemModule;
dclModule->dm_symbols = gBEState.be_allSymbols; /* ??? too many symbols? */
+ dclModule->dm_system_module_table_kind = FirstSystemModuleTable + moduleIndex;
AddOpenDefinitionModule (moduleNameSymbol, dclModule);
diff --git a/backendC/CleanCompilerSources/checker_2.c b/backendC/CleanCompilerSources/checker_2.c
index 41b3219..c59e2ee 100644
--- a/backendC/CleanCompilerSources/checker_2.c
+++ b/backendC/CleanCompilerSources/checker_2.c
@@ -91,7 +91,7 @@ void ReadInlineCode (void)
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 */
- 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);
}
}
}
diff --git a/backendC/CleanCompilerSources/codegen2.h b/backendC/CleanCompilerSources/codegen2.h
index 37922ee..8cfca19 100644
--- a/backendC/CleanCompilerSources/codegen2.h
+++ b/backendC/CleanCompilerSources/codegen2.h
@@ -38,8 +38,6 @@ extern int selector_m_error_lab_used;
extern LabDef selector_m_error_lab;
extern LabDef *unboxed_cons_label (SymbolP cons_symbol_p);
-extern void ScanInlineFile (char *fname);
-
extern Bool EqualState (StateS st1, StateS st2);
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);
diff --git a/backendC/CleanCompilerSources/scanner.h b/backendC/CleanCompilerSources/scanner.h
index 45d6532..659100e 100644
--- a/backendC/CleanCompilerSources/scanner.h
+++ b/backendC/CleanCompilerSources/scanner.h
@@ -68,4 +68,4 @@ extern void ScanInitialise (void);
extern void ScanInitIdentStringTable (void);
-extern void ScanInlineFile (char *fname);
+extern void ScanInlineFile (char *fname,TableKind table_kind);
diff --git a/backendC/CleanCompilerSources/scanner_2.c b/backendC/CleanCompilerSources/scanner_2.c
index dd377e8..f630539 100644
--- a/backendC/CleanCompilerSources/scanner_2.c
+++ b/backendC/CleanCompilerSources/scanner_2.c
@@ -185,7 +185,7 @@ PutKeyWordInTable (KeyWordInfoP keyWord)
identString->ident = ident;
} /* PutKeyWordInTable */
-static IdentP RetrieveFromSymbolTable (char *string)
+static IdentP RetrieveFromSymbolTable (char *string,TableKind table_kind)
{
char *s;
unsigned long hash;
@@ -222,7 +222,7 @@ static IdentP RetrieveFromSymbolTable (char *string)
if (identString != NIL){
for (ident = identString->ident; ident != NIL; ident = ident->ident_next)
- if (ident->ident_table == SymbolIdTable)
+ if (ident->ident_table == table_kind)
break;
} else
ident = NIL;
@@ -425,7 +425,7 @@ void clear_inline_cache (void)
}
#endif
-void ScanInlineFile (char *fname)
+void ScanInlineFile (char *fname,TableKind system_module_table_kind)
{
register char *tail, *instr, *importingModule, *importingExtension;
IdentP instrid;
@@ -485,7 +485,7 @@ void ScanInlineFile (char *fname)
continue;
*tail = '\0';
- if (! (instrid = RetrieveFromSymbolTable (instr)))
+ if (! (instrid = RetrieveFromSymbolTable (instr,system_module_table_kind)))
continue;
if (instrid->ident_environ!=importingModule)
continue;
diff --git a/backendC/CleanCompilerSources/syntaxtr.t b/backendC/CleanCompilerSources/syntaxtr.t
index ee088dd..d0aad22 100644
--- a/backendC/CleanCompilerSources/syntaxtr.t
+++ b/backendC/CleanCompilerSources/syntaxtr.t
@@ -51,7 +51,7 @@ typedef enum {
typedef enum {
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,
#ifdef CLEAN2
rational_denot,
@@ -114,7 +114,7 @@ typedef struct record_state_descr {
} *RecordStateDescr;
typedef enum {
- SymbolIdTable, TypeSymbolIdTable, TypeVarIdTable, ModuleIdTable, FieldIdTable, KeyWordTable, InternalIdTable
+ SymbolIdTable, TypeSymbolIdTable, ModuleIdTable, KeyWordTable, FirstSystemModuleTable, LastSystemModuleTable=0x7fff
} TableKind;
typedef union symb_value {
@@ -720,6 +720,7 @@ struct def_repr {
SynTypes dm_syn_types;
AbsTypes dm_abs_types;
RuleTypes dm_rules;
+ TableKind dm_system_module_table_kind;
Bool dm_system_module;
#if WRITE_DCL_MODIFICATION_TIME
ModuleFileTime dm_modification_time;