Commit 25661c50 authored by John van Groningen's avatar John van Groningen
Browse files

remove unused field cons_arg_vars,

remove unused field stv_count in STE_BoundTypeVariable,
remove unused argument def_macros of type CollectedDefinitions
parent 888b964b
......@@ -1205,7 +1205,7 @@ instance < FunDef
where
(<) fd1 fd2 = fd1.fun_ident.id_name < fd2.fun_ident.id_name
createCommonDefinitions :: (CollectedDefinitions ClassInstance a) -> .CommonDefs;
createCommonDefinitions :: (CollectedDefinitions ClassInstance) -> .CommonDefs;
createCommonDefinitions {def_types,def_constructors,def_selectors,def_classes,def_members,def_instances, def_generics,def_generic_cases}
= { com_type_defs = { type \\ type <- def_types }
, com_cons_defs = { cons \\ cons <- def_constructors }
......@@ -1262,7 +1262,7 @@ checkCommonDefinitions opt_icl_info module_index common modules heaps cs
com_generic_defs = com_generic_defs, com_gencase_defs = com_gencase_defs}
= (dictionary_info,common, modules, heaps, cs)
collectCommonfinitions :: !(CollectedDefinitions ClassInstance a) -> (!*{# Int}, ![Declaration])
collectCommonfinitions :: !(CollectedDefinitions ClassInstance) -> (!*{# Int}, ![Declaration])
collectCommonfinitions {def_types,def_constructors,def_selectors,def_classes,def_members,def_instances, def_generic_cases, def_generics}
// MW: the order in which the declarations appear in the returned list is essential (explicit imports)
# sizes = createArray cConversionTableSize 0
......@@ -1500,7 +1500,7 @@ renumber_icl_definitions_as_dcl_definitions (Yes icl_to_dcl_index_table) icl_siz
# com_selector_defs=reorder_and_enlarge_array com_selector_defs n_dictionary_selectors icl_to_dcl_index_table.[cSelectorDefs]
{sd_ident=dummy_ident,sd_field=dummy_ident,sd_type=dummy_symbol_type,sd_exi_vars=[],sd_field_nr=0,sd_type_index=0,sd_type_ptr=nilPtr,sd_pos=NoPos}
# com_cons_defs=reorder_and_enlarge_array com_cons_defs n_dictionary_constructors icl_to_dcl_index_table.[cConstructorDefs]
{cons_ident=dummy_ident,cons_type=dummy_symbol_type,cons_arg_vars=[],cons_priority=NoPrio,cons_number= -1,cons_type_index= -1,cons_exi_vars=[],cons_type_ptr=nilPtr,cons_pos=NoPos}
{cons_ident=dummy_ident,cons_type=dummy_symbol_type,cons_priority=NoPrio,cons_number= -1,cons_type_index= -1,cons_exi_vars=[],cons_type_ptr=nilPtr,cons_pos=NoPos}
# com_class_defs=reorder_array com_class_defs icl_to_dcl_index_table.[cClassDefs]
# com_member_defs=reorder_array com_member_defs icl_to_dcl_index_table.[cMemberDefs]
# com_instance_defs=reorder_array com_instance_defs icl_to_dcl_index_table.[cInstanceDefs]
......@@ -1522,8 +1522,8 @@ renumber_icl_definitions_as_dcl_definitions (Yes icl_to_dcl_index_table) icl_siz
# new_array=createArray (size array+n_extra_elements) dummy_element
= {new_array & [index_array.[i]] = e \\ e<-:array & i<-[0..]}
combineDclAndIclModule :: ModuleKind *{#DclModule} [Declaration] (CollectedDefinitions a b) *{#Int} *CheckState
-> (!CopiedDefinitions,!Optional {#{#Int}},!*{#DclModule},![Declaration],!CollectedDefinitions a b, !*{#Int}, !*CheckState);
combineDclAndIclModule :: ModuleKind *{#DclModule} [Declaration] (CollectedDefinitions a) *{#Int} *CheckState
-> (!CopiedDefinitions,!Optional {#{#Int}},!*{#DclModule},![Declaration],!CollectedDefinitions a, !*{#Int}, !*CheckState);
combineDclAndIclModule MK_Main modules icl_decl_symbols icl_definitions icl_sizes cs
= ({ copied_type_defs = {}, copied_class_defs = {}, copied_generic_defs = {}}, No, modules, icl_decl_symbols, icl_definitions, icl_sizes, cs)
combineDclAndIclModule _ modules icl_decl_symbols icl_definitions icl_sizes cs
......@@ -2492,7 +2492,7 @@ check_module1 cdefs icl_global_function_range fun_defs optional_dcl_mod optional
= fill_macro_def_array (i+1) macro_defs {a & [i]=dcl_macro_defs}
check_module2 :: Ident {#Char} [.ImportedObject] .[Import ImportDeclaration] [ParsedForeignExport] .ModuleKind !.IndexRange !.IndexRange !.IndexRange !Int
(Optional (Module a)) [Declaration] Bool *{#FunDef} *{#*{#FunDef}} *{#DclModule} (CollectedDefinitions ClassInstance IndexRange)
(Optional (Module a)) [Declaration] Bool *{#FunDef} *{#*{#FunDef}} *{#DclModule} (CollectedDefinitions ClassInstance)
*{#.Int} *Heaps *CheckState
-> (!Bool,.IclModule,!.{#DclModule},.{!Group},!*{#*{#FunDef}},!Int,!.Heaps,!.{#PredefinedSymbol},!.Heap SymbolTableEntry,!.File,[String]);
check_module2 mod_ident mod_modification_time mod_imported_objects mod_imports mod_foreign_exports mod_type icl_global_function_range icl_instance_range icl_generic_range nr_of_cached_modules optional_pre_def_mod local_defs support_dynamics icl_functions macro_defs init_dcl_modules cdefs sizes heaps cs
......@@ -3402,7 +3402,7 @@ checkInstancesOfDclModule mod_index (nr_of_dcl_functions_and_instances, nr_of_dc
= { instance_defs & [ds_index] = { inst_def & ft_type = makeElemTypeOfArrayFunctionStrict inst_def.ft_type ins_offset offset_table } }
checkPredefinedDclModule :: !NumberSet ![Int] !(IntKeyHashtable SolvedImports) !Int !Bool !LargeBitvect !Bool
!(Module (CollectedDefinitions ClassInstance IndexRange)) !Index !*ExplImpInfos !*{#DclModule} !*{#FunDef} !*{#*{#FunDef}} !*Heaps !*CheckState
!(Module (CollectedDefinitions ClassInstance)) !Index !*ExplImpInfos !*{#DclModule} !*{#FunDef} !*{#*{#FunDef}} !*Heaps !*CheckState
-> (!(!Int,!Index,![FunType]), !(!*ExplImpInfos, !*{#DclModule}, !*{#FunDef},!*{#*{#FunDef}},!*Heaps, !*CheckState))
checkPredefinedDclModule dcl_imported_module_numbers components_importing_module imports_ikh component_nr is_on_cycle modules_in_component_set support_dynamics
mod=:{mod_ident,mod_defs=mod_defs=:{def_macro_indices,def_funtypes}} mod_index expl_imp_info modules icl_functions macro_defs heaps cs
......
......@@ -83,8 +83,7 @@ where
# (var_def, cs_symbol_table) = readPtr id_info cs_symbol_table
cs = { cs & cs_symbol_table = cs_symbol_table }
= case var_def.ste_kind of
STE_BoundTypeVariable bv=:{stv_attribute, stv_info_ptr, stv_count}
# cs = { cs & cs_symbol_table = cs.cs_symbol_table <:= (id_info, { var_def & ste_kind = STE_BoundTypeVariable { bv & stv_count = inc stv_count }})}
STE_BoundTypeVariable bv=:{stv_attribute, stv_info_ptr}
-> ({ tv & tv_info_ptr = stv_info_ptr}, stv_attribute, (ts, ti, cs))
_
-> (tv, TA_Multi, (ts, ti, { cs & cs_error = checkError var_id "undefined" cs.cs_error }))
......@@ -374,35 +373,26 @@ where
# (cons_def, ts) = ts!ts_cons_defs.[ds_index]
# (exi_vars, (ti_type_heaps, cs))
= addExistentionalTypeVariablesToSymbolTable cti_lhs_attribute cons_def.cons_exi_vars ti_type_heaps cs
(st_args, cons_arg_vars, st_attr_env, (ts, ti, cs))
(st_args, st_attr_env, (ts, ti, cs))
= bind_types_of_cons cons_def.cons_type.st_args cti free_vars [] (ts, { ti & ti_type_heaps = ti_type_heaps }, cs)
symbol_table = removeAttributedTypeVarsFromSymbolTable cGlobalScope /* cOuterMostLevel */ exi_vars cs.cs_symbol_table
attr_vars = add_universal_attr_vars st_args free_attrs
cons_type = { cons_def.cons_type & st_vars = free_vars, st_args = st_args, st_result = type_lhs, st_attr_vars = attr_vars, st_attr_env = st_attr_env }
(new_type_ptr, ti_var_heap) = newPtr VI_Empty ti.ti_var_heap
cons_def = { cons_def & cons_type = cons_type, cons_number = cons_index, cons_type_index = cti.cti_type_index, cons_exi_vars = exi_vars,
cons_type_ptr = new_type_ptr, cons_arg_vars = cons_arg_vars }
cons_type_ptr = new_type_ptr }
= ({ ts & ts_cons_defs.[ds_index] = cons_def}, { ti & ti_var_heap = ti_var_heap }, { cs & cs_symbol_table=symbol_table })
where
bind_types_of_cons :: ![AType] !CurrentTypeInfo ![TypeVar] ![AttrInequality] !(!*TypeSymbols, !*TypeInfo, !*CheckState)
-> (![AType], ![[ATypeVar]], ![AttrInequality],!(!*TypeSymbols, !*TypeInfo, !*CheckState))
-> (![AType], ![AttrInequality],!(!*TypeSymbols, !*TypeInfo, !*CheckState))
bind_types_of_cons [] cti free_vars attr_env ts_ti_cs
= ([], [], attr_env, ts_ti_cs)
= ([], attr_env, ts_ti_cs)
bind_types_of_cons [type : types] cti free_vars attr_env ts_ti_cs
# (types, local_vars_list, attr_env, ts_ti_cs)
# (types, attr_env, ts_ti_cs)
= bind_types_of_cons types cti free_vars attr_env ts_ti_cs
(type, type_attr, (ts, ti, cs)) = bindTypes cti type ts_ti_cs
(local_vars, cs_symbol_table) = foldSt retrieve_local_vars free_vars ([], cs.cs_symbol_table)
(attr_env, cs_error) = addToAttributeEnviron type_attr cti.cti_lhs_attribute attr_env cs.cs_error
= ([type : types], [local_vars : local_vars_list], attr_env, (ts, ti , { cs & cs_symbol_table = cs_symbol_table, cs_error = cs_error }))
where
retrieve_local_vars tv=:{tv_ident={id_info}} (local_vars, symbol_table)
# (ste=:{ste_kind = STE_BoundTypeVariable bv=:{stv_attribute, stv_info_ptr, stv_count }}, symbol_table) = readPtr id_info symbol_table
| stv_count == 0
= (local_vars, symbol_table)
= ([{ atv_variable = { tv & tv_info_ptr = stv_info_ptr}, atv_attribute = stv_attribute } : local_vars],
symbol_table <:= (id_info, { ste & ste_kind = STE_BoundTypeVariable { bv & stv_count = 0}}))
= ([type : types], attr_env, (ts, ti , { cs & cs_error = cs_error }))
add_universal_attr_vars [] attr_vars
= attr_vars
......@@ -1288,7 +1278,7 @@ where
atv_variable = { atv_variable & tv_info_ptr = tv_info_ptr }
(atv_attribute, attr_vars, th_attrs, cs_error) = check_attribute (scope == cRankTwoScope) atv_attribute tv_ident.id_name attr_vars th_attrs cs_error
cs_symbol_table = cs_symbol_table <:= (tv_info, {ste_index = NoIndex, ste_kind = STE_BoundTypeVariable {stv_attribute = atv_attribute,
stv_info_ptr = tv_info_ptr, stv_count = 0}, ste_def_level = scope /* cOuterMostLevel */, ste_previous = entry })
stv_info_ptr = tv_info_ptr}, ste_def_level = scope /* cOuterMostLevel */, ste_previous = entry })
heaps = { heaps & th_vars = th_vars, th_attrs = th_attrs }
= ({atv & atv_variable = atv_variable, atv_attribute = atv_attribute},
(attr_vars, heaps, { cs & cs_symbol_table = cs_symbol_table, cs_error = cs_error }))
......@@ -1343,7 +1333,7 @@ where
atv_variable = { atv_variable & tv_info_ptr = tv_info_ptr }
(atv_attribute, th_attrs, cs_error) = check_attribute atv_attribute root_attr tv_ident.id_name th_attrs cs_error
cs_symbol_table = cs_symbol_table <:= (tv_info, {ste_index = NoIndex, ste_kind = STE_BoundTypeVariable {stv_attribute = atv_attribute,
stv_info_ptr = tv_info_ptr, stv_count = 0 }, ste_def_level = cGlobalScope /* cOuterMostLevel */, ste_previous = entry })
stv_info_ptr = tv_info_ptr }, ste_def_level = cGlobalScope /* cOuterMostLevel */, ste_previous = entry })
heaps = { heaps & th_vars = th_vars, th_attrs = th_attrs }
= ({atv & atv_variable = atv_variable, atv_attribute = atv_attribute},
(heaps, { cs & cs_symbol_table = cs_symbol_table, cs_error = cs_error}))
......@@ -1578,7 +1568,6 @@ where
, cons_number = 0
, cons_type_index = index_type
, cons_exi_vars = []
, cons_arg_vars = []
, cons_type_ptr = cons_type_ptr
, cons_pos = NoPos
}
......
......@@ -1128,7 +1128,7 @@ scanModule mod=:{mod_ident,mod_type,mod_defs = pdefs} cached_modules support_gen
= (reorganise_icl_ok && pea_ok && import_dcl_ok && import_dcls_ok, mod, fun_range, fun_defs, optional_dcl_mod, modules, dcl_module_n,hash_table, err_file, files)
where
scan_main_dcl_module :: Ident ModuleKind (ModTimeFunction *Files) *Files *CollectAdmin -> (!Bool,!Optional (Module (CollectedDefinitions (ParsedInstance FunDef) [FunDef])),!Int,![ScannedModule],![Ident],!*Files,!*CollectAdmin)
scan_main_dcl_module :: Ident ModuleKind (ModTimeFunction *Files) *Files *CollectAdmin -> (!Bool,!Optional (Module (CollectedDefinitions (ParsedInstance FunDef))),!Int,![ScannedModule],![Ident],!*Files,!*CollectAdmin)
scan_main_dcl_module mod_ident MK_Main _ files ca
= (True, No,NoIndex,[MakeEmptyModule mod_ident MK_NoMainDcl], cached_modules,files, ca)
scan_main_dcl_module mod_ident MK_None _ files ca
......@@ -1235,7 +1235,7 @@ where
# (strictness_index,strictness,strictness_list) = add_next_not_strict strictness_index strictness strictness_list
= add_strictness_for_arguments fields strictness_index strictness strictness_list
reorganiseDefinitions :: Bool [ParsedDefinition] Index Index Index Index *CollectAdmin -> (![FunDef],!CollectedDefinitions (ParsedInstance FunDef) [FunDef], ![ParsedImport], ![ImportedObject],![ParsedForeignExport],!*CollectAdmin)
reorganiseDefinitions :: Bool [ParsedDefinition] Index Index Index Index *CollectAdmin -> (![FunDef],!CollectedDefinitions (ParsedInstance FunDef), ![ParsedImport], ![ImportedObject],![ParsedForeignExport],!*CollectAdmin)
reorganiseDefinitions icl_module [PD_Function pos name is_infix args rhs fun_kind : defs] cons_count sel_count mem_count type_count ca
# prio = if is_infix (Prio NoAssoc 9) NoPrio
fun_arity = length args
......
......@@ -33,7 +33,7 @@ instance toString Ident
instance == FunctionOrMacroIndex
:: STE_BoundTypeVariable = { stv_count :: !Int, stv_attribute :: !TypeAttribute, stv_info_ptr :: !TypeVarInfoPtr }
:: STE_BoundTypeVariable = { stv_attribute :: !TypeAttribute, stv_info_ptr :: !TypeVarInfoPtr }
:: STE_Kind = STE_FunctionOrMacro ![FunctionOrMacroIndex]
| STE_DclMacroOrLocalMacroFunction ![FunctionOrMacroIndex]
......@@ -52,7 +52,7 @@ instance == FunctionOrMacroIndex
| STE_BoundTypeVariable !STE_BoundTypeVariable
| STE_Imported !STE_Kind !ModuleN
| STE_DclFunction
| STE_Module !(Module (CollectedDefinitions ClassInstance IndexRange))
| STE_Module !(Module (CollectedDefinitions ClassInstance))
| STE_ClosedModule
| STE_ModuleQualifiedImports !SortedQualifiedImports
| STE_Empty
......@@ -118,7 +118,7 @@ instance == FunctionOrMacroIndex
}
:: ParsedModule :== Module [ParsedDefinition]
:: ScannedModule :== Module (CollectedDefinitions (ParsedInstance FunDef) IndexRange)
:: ScannedModule :== Module (CollectedDefinitions (ParsedInstance FunDef))
:: ModuleKind = MK_Main | MK_Module | MK_System | MK_None | MK_NoMainDcl
......@@ -188,7 +188,7 @@ instance == FunctionOrMacroIndex
| EmptyRhs !BITVECT
| AbstractTypeSpec !BITVECT !AType
:: CollectedDefinitions instance_kind def_macros =
:: CollectedDefinitions instance_kind =
{ def_types :: ![TypeDef TypeRhs]
, def_constructors :: ![ConsDef]
, def_selectors :: ![SelectorDef]
......@@ -909,7 +909,6 @@ cNonRecursiveAppl :== False
:: ConsDef =
{ cons_ident :: !Ident
, cons_type :: !SymbolType
, cons_arg_vars :: ![[ATypeVar]]
, cons_priority :: !Priority
, cons_number :: !Index // -2 for newtype constructor
, cons_type_index :: !Index
......@@ -1492,7 +1491,7 @@ ParsedConstructorToConsDef pc :==
{ cons_ident = pc.pc_cons_ident, cons_pos = pc.pc_cons_pos, cons_priority = pc.pc_cons_prio, cons_number = NoIndex, cons_type_index = NoIndex,
cons_type = { st_vars = [], st_args = pc.pc_arg_types, st_args_strictness=pc.pc_args_strictness, st_result = MakeAttributedType TE,
st_arity = pc.pc_cons_arity, st_context = [], st_attr_env = [], st_attr_vars = []},
cons_exi_vars = pc.pc_exi_vars, cons_type_ptr = nilPtr, cons_arg_vars = [] }
cons_exi_vars = pc.pc_exi_vars, cons_type_ptr = nilPtr }
ParsedInstanceToClassInstance pi members :==
{ ins_class = {glob_object = MakeDefinedSymbol pi.pi_class NoIndex (length pi.pi_types), glob_module = NoIndex}, ins_ident = pi.pi_ident,
......
......@@ -730,7 +730,7 @@ instance <<< (Module a) | <<< a
where
(<<<) file {mod_ident,mod_type,mod_defs} = file <<< mod_type <<< mod_ident <<< mod_defs
instance <<< (CollectedDefinitions a b) | <<< a & <<< b
instance <<< (CollectedDefinitions a) | <<< a
where
(<<<) file {def_types,def_constructors,def_selectors,def_macros,def_classes,def_members,def_instances}
= file
......
......@@ -60,7 +60,7 @@ where
instance WriteTypeInfo ConsDef
where
write_type_info {cons_ident,cons_type,cons_arg_vars,cons_priority,cons_number,cons_type_index,cons_exi_vars} tcl_file wtis=:{wtis_n_type_vars}
write_type_info {cons_ident,cons_type,cons_priority,cons_number,cons_type_index,cons_exi_vars} tcl_file wtis=:{wtis_n_type_vars}
// normalize ...
# (th_vars,wtis)
= sel_type_var_heap wtis
......@@ -75,8 +75,7 @@ where
# (tcl_file,wtis)
= write_type_info cons_type tcl_file wtis
# (tcl_file,wtis)
= write_type_info cons_arg_vars tcl_file wtis
# tcl_file = fwritei 0 tcl_file // was cons_arg_vars, not used, write 0 for []
# (tcl_file,wtis)
= write_type_info cons_number tcl_file wtis
......
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