diff --git a/frontend/frontend.icl b/frontend/frontend.icl index 35b23e31547d1c235febe8cd749100f175b3c084..e7acc3d8f57961ade5d06915836aa43bbd6634e0 100644 --- a/frontend/frontend.icl +++ b/frontend/frontend.icl @@ -53,7 +53,7 @@ frontEndInterface opt_file_dir_time options mod_ident search_paths cached_dcl_mo # (ok, icl_mod, dcl_mods, groups, cached_dcl_macros,main_dcl_module_n,heaps, predef_symbols, symbol_table, error, directly_imported_dcl_modules) = checkModule mod global_fun_range mod_functions support_dynamics dynamic_type_used dcl_module_n_in_cache optional_dcl_mod modules cached_dcl_modules cached_dcl_macros predef_symbols symbol_table error heaps - hash_table = { hash_table & hte_symbol_heap = symbol_table} + hash_table & hte_symbol_heap = symbol_table | not ok = (No,{},dcl_mods,main_dcl_module_n,predef_symbols, hash_table, files, error, io, out, tcl_file, heaps) @@ -123,14 +123,15 @@ frontEndInterface opt_file_dir_time options mod_ident search_paths cached_dcl_mo type_heaps = { type_heaps & th_vars = th_vars } - # heaps = { heaps & hp_type_heaps = type_heaps, hp_expression_heap = hp_expression_heap, hp_generic_heap = gen_heap, hp_var_heap=hp_var_heap } + # heaps & hp_type_heaps = type_heaps, hp_expression_heap = hp_expression_heap, hp_generic_heap = gen_heap, hp_var_heap=hp_var_heap | not error_admin.ea_ok = (No,{},dcl_mods,main_dcl_module_n,predef_symbols, hash_table, files, error_admin.ea_file, io, out, tcl_file, heaps) #! start_index_generic_classes = size icl_common.com_class_defs; - # (saved_main_dcl_common, ti_common_defs) = replace {#dcl_common \\ {dcl_common}<-:dcl_mods} main_dcl_module_n icl_common + # (ti_common_defs,dcl_mods) = copy_common_defs_from_dcl_modules dcl_mods + # (saved_main_dcl_common, ti_common_defs) = replace ti_common_defs main_dcl_module_n icl_common #! (ti_common_defs, groups, fun_defs, td_infos, heaps, hash_table, predef_symbols, dcl_mods, cached_dcl_macros, error_admin) = case options.feo_generics of @@ -140,9 +141,9 @@ frontEndInterface opt_file_dir_time options mod_ident search_paths cached_dcl_mo False -> (ti_common_defs, groups, fun_defs, td_infos, heaps, hash_table, predef_symbols, dcl_mods, cached_dcl_macros, error_admin) - # (icl_common, ti_common_defs) = replace {#x \\ x<-:ti_common_defs} main_dcl_module_n saved_main_dcl_common + # (icl_common, ti_common_defs) = replace ti_common_defs main_dcl_module_n saved_main_dcl_common - # dcl_mods = { {dcl_mod & dcl_common = common} \\ dcl_mod <-: dcl_mods & common <-: ti_common_defs } + # dcl_mods & [module_n].dcl_common = common \\ common <-: ti_common_defs & module_n<-[0..] # icl_mod = {icl_mod & icl_common = icl_common} @@ -306,6 +307,22 @@ frontEndInterface opt_file_dir_time options mod_ident search_paths cached_dcl_mo #! nr_of_dcl_mods = size dcl_mods = arrayCopyBegin dcl_mods nr_of_dcl_mods + copy_common_defs_from_dcl_modules :: !*{#DclModule} -> (!*{#CommonDefs},!*{#DclModule}) + copy_common_defs_from_dcl_modules dcl_mods + # (n_dcl_mods,dcl_mods) = usize dcl_mods + | n_dcl_mods==0 + = ({#},dcl_mods) + # (common_defs_0,dcl_mods) = dcl_mods![0].dcl_common + = copy_common_defs 1 (createArray n_dcl_mods common_defs_0) dcl_mods + + copy_common_defs :: !Int !*{#CommonDefs} !*{#DclModule} -> (!*{#CommonDefs},!*{#DclModule}) + copy_common_defs module_n common_defs dcl_mods + | module_n *{#*{#FunDef}} clear_group_indices_of_macros cached_dcl_macros = clear_group_indices1 0 cached_dcl_macros diff --git a/frontend/generics1.dcl b/frontend/generics1.dcl index 014f0694b6459b06d367592d19c2de59db98832f..8a945cb2e2278df8a59d0d1762babf8319bd0831 100644 --- a/frontend/generics1.dcl +++ b/frontend/generics1.dcl @@ -6,24 +6,24 @@ from transform import ::Group convertGenerics :: !Int !NumberSet - !{#CommonDefs} + !*{#CommonDefs} !{!Group} !*{# FunDef} !*TypeDefInfos !*Heaps !*HashTable !*PredefinedSymbols - !u:{# DclModule} + !*{# DclModule} !*{#*{#FunDef}} !*ErrorAdmin - -> ( !{#CommonDefs} + -> ( !*{#CommonDefs} , !{!Group} , !*{# FunDef} , !*TypeDefInfos , !*Heaps , !*HashTable , !*PredefinedSymbols - , !u:{# DclModule} + , !*{# DclModule} , !*{#*{#FunDef}} , !*ErrorAdmin ) diff --git a/frontend/generics1.icl b/frontend/generics1.icl index 6b54c69996d5675a269213f11e36e3f418d77494..c568de9050d19ace91e70c7dc582b98155f5161d 100644 --- a/frontend/generics1.icl +++ b/frontend/generics1.icl @@ -106,30 +106,28 @@ FIELD_NewType_Mask:==8; convertGenerics :: !Int // index of the main dcl module !NumberSet // set of used modules - !{#CommonDefs} // common definitions of all modules + !*{#CommonDefs} // common definitions of all modules !{!Group} // groups of functions !*{# FunDef} // functions !*TypeDefInfos // type definition information of all modules !*Heaps // all heaps !*HashTable // needed for what creating class dictionaries !*PredefinedSymbols // predefined symbols - !u:{# DclModule} // dcl modules + !*{# DclModule} // dcl modules !*{#*{#FunDef}} // dcl macros !*ErrorAdmin // to report errors - -> ( !{#CommonDefs} // common definitions of all modules + -> ( !*{#CommonDefs} // common definitions of all modules , !{!Group} // groups of functions , !*{# FunDef} // function definitions , !*TypeDefInfos // type definition infos , !*Heaps // all heaps , !*HashTable // needed for creating class dictinaries , !*PredefinedSymbols // predefined symbols - , !u:{# DclModule} // dcl modules + , !*{# DclModule} // dcl modules , !*{#*{#FunDef}} // dcl macros , !*ErrorAdmin // to report errors ) convertGenerics main_dcl_module_n used_module_numbers modules groups funs td_infos heaps hash_table u_predefs dcl_modules dcl_macros error - #! modules = {x \\ x <-: modules} // unique copy - #! dcl_modules = { x \\ x <-: dcl_modules } // unique copy #! size_predefs = size u_predefs #! (predefs, u_predefs) = arrayCopyBegin u_predefs size_predefs // non-unique copy @@ -2006,8 +2004,7 @@ where , ds_arity = 0 , ds_index = NoIndex/*index in the type def table, filled in later*/ } - #! class_def = { - class_ident = class_ident, + = { class_ident = class_ident, class_arity = 1, class_args = [class_var], class_context = [], @@ -2017,7 +2014,6 @@ where class_cons_vars = 0, // dotted class variables class_dictionary = class_dictionary } - = class_def // Convert generic cases @@ -5104,8 +5100,7 @@ where clear_type (CV tv :@: _) th = clear_type_var tv th clear_type (TFA atvs type) th #! th = foldSt clear_attr [atv_attribute \\ {atv_attribute} <- atvs] th - #! th = foldSt clear_type_var [atv_variable \\ {atv_variable} <- atvs] th - = th + = foldSt clear_type_var [atv_variable \\ {atv_variable} <- atvs] th clear_type _ th = th clear_atype {at_attribute} th @@ -5114,7 +5109,7 @@ where clear_attr (TA_Var av) th = clear_attr_var av th clear_attr (TA_RootVar av) th = clear_attr_var av th clear_attr _ th = th - + clear_type_var {tv_info_ptr} th=:{th_vars} = {th & th_vars = writePtr tv_info_ptr TVI_Empty th_vars}