Commit 597e5e94 authored by John van Groningen's avatar John van Groningen

store predefined identifiers in CAF

parent d9780ce1
......@@ -462,7 +462,7 @@ backEndConvertModulesH predefs {fe_icl =
#! backEnd
= adjustStrictListFunctions fe_arrayInstances.ali_list_first_instance_indices fe_arrayInstances.ali_tail_strict_list_first_instance_indices predefs fe_dcls icl_used_module_numbers main_dcl_module_n backEnd;
#! (rules, backEnd)
= convertRules [(index, icl_functions.[index]) \\ (_, index) <- functionIndices] main_dcl_module_n predefs.[PD_DummyForStrictAliasFun].pds_ident (backEnd -*-> "convertRules")
= convertRules [(index, icl_functions.[index]) \\ (_, index) <- functionIndices] main_dcl_module_n predefined_idents.[PD_DummyForStrictAliasFun] (backEnd -*-> "convertRules")
#! backEnd
= appBackEnd (BEDefineRules rules) (backEnd -*-> "BEDefineRules")
#! backEnd
......
......@@ -47,7 +47,7 @@ backEndInterface outputFileName commandLineArgs listTypes typesPath predef_symbo
| not compatible
= (False, var_heap, attrHeap, errorFile, files)
# varHeap
= backEndPreprocess predef_symbols.[PD_DummyForStrictAliasFun].pds_ident functionIndices fe_icl var_heap
= backEndPreprocess predefined_idents.[PD_DummyForStrictAliasFun] functionIndices fe_icl var_heap
with
functionIndices
= flatten [[member \\ member <- group.group_members] \\ group <-: fe_components]
......
......@@ -1487,23 +1487,17 @@ checkDclModules imports_of_icl_mod dcl_modules icl_functions macro_defs heaps cs
= foldSt restoreHeap expl_imp_symbols cs_symbol_table
= ((reverse expl_imp_symbols, reverse expl_imp_indices), (dcl_modules, cs_symbol_table))
get_expl_imp_symbols_of_module imports_of_icl_mod mod_index
(expl_imp_symbols_accu, nr_of_expl_imp_symbols, expl_imp_indices_accu, dcl_modules, cs_symbol_table)
#! siz
= size dcl_modules
get_expl_imp_symbols_of_module imports_of_icl_mod mod_index (expl_imp_symbols_accu, nr_of_expl_imp_symbols, expl_imp_indices_accu, dcl_modules, cs_symbol_table)
#! siz = size dcl_modules
# (mod_imports, dcl_modules, cs_symbol_table)
= get_mod_imports (mod_index==siz) imports_of_icl_mod dcl_modules cs_symbol_table
(expl_imp_symbols_accu, nr_of_expl_imp_symbols, expl_imp_indices, cs_symbol_table)
= foldSt get_expl_imp_symbols mod_imports
(expl_imp_symbols_accu, nr_of_expl_imp_symbols, [], cs_symbol_table)
= (expl_imp_symbols_accu, nr_of_expl_imp_symbols, [expl_imp_indices:expl_imp_indices_accu],
dcl_modules, cs_symbol_table)
= foldSt get_expl_imp_symbols mod_imports (expl_imp_symbols_accu, nr_of_expl_imp_symbols, [], cs_symbol_table)
= (expl_imp_symbols_accu, nr_of_expl_imp_symbols, [expl_imp_indices:expl_imp_indices_accu],dcl_modules, cs_symbol_table)
where
get_mod_imports is_icl_mod=:False _ dcl_modules cs_symbol_table
# ({dcl_name}, dcl_modules)
= dcl_modules![mod_index]
({ste_kind}, cs_symbol_table)
= readPtr dcl_name.id_info cs_symbol_table
# ({dcl_name}, dcl_modules) = dcl_modules![mod_index]
({ste_kind}, cs_symbol_table) = readPtr dcl_name.id_info cs_symbol_table
= case ste_kind of
STE_Module {mod_imports}
-> (mod_imports, dcl_modules, cs_symbol_table)
......@@ -1511,16 +1505,12 @@ checkDclModules imports_of_icl_mod dcl_modules icl_functions macro_defs heaps cs
-> ([], dcl_modules, cs_symbol_table)
get_mod_imports _ imports_of_icl_mod dcl_modules cs_symbol_table
= (imports_of_icl_mod, dcl_modules, cs_symbol_table)
get_expl_imp_symbols {import_module, import_symbols, import_file_position}
(expl_imp_symbols_accu, nr_of_expl_imp_symbols, expl_imp_indices_accu, cs_symbol_table)
get_expl_imp_symbols {import_module, import_symbols, import_file_position} (expl_imp_symbols_accu, nr_of_expl_imp_symbols, expl_imp_indices_accu, cs_symbol_table)
# (expl_imp_symbols_accu, nr_of_expl_imp_symbols, expl_imp_indices, cs_symbol_table)
= foldSt get_expl_imp_symbol import_symbols
(expl_imp_symbols_accu, nr_of_expl_imp_symbols, [], cs_symbol_table)
({ste_index}, cs_symbol_table)
= readPtr import_module.id_info cs_symbol_table
= (expl_imp_symbols_accu, nr_of_expl_imp_symbols,
[(ste_index, import_file_position, expl_imp_indices):expl_imp_indices_accu], cs_symbol_table)
= foldSt get_expl_imp_symbol import_symbols (expl_imp_symbols_accu, nr_of_expl_imp_symbols, [], cs_symbol_table)
({ste_index}, cs_symbol_table) = readPtr import_module.id_info cs_symbol_table
= (expl_imp_symbols_accu, nr_of_expl_imp_symbols, [(ste_index, import_file_position, expl_imp_indices):expl_imp_indices_accu], cs_symbol_table)
get_expl_imp_symbol imp_decl=:(ID_OldSyntax idents) state
= foldSt (get_symbol imp_decl) idents state
......@@ -1658,8 +1648,7 @@ checkDclComponent components_array super_components expl_imp_indices mod_indices
# (changed_symbols, (expl_imp_infos, cs_symbol_table))
= markExplImpSymbols component_nr (expl_imp_infos, cs.cs_symbol_table)
(expl_imp_infos, dcl_modules, cs_symbol_table)
= foldSt collect_expl_imp_info_per_module mod_indices
(expl_imp_infos, dcl_modules, cs_symbol_table)
= foldSt collect_expl_imp_info_per_module mod_indices (expl_imp_infos, dcl_modules, cs_symbol_table)
cs_symbol_table
= foldSt restoreHeap changed_symbols cs_symbol_table
= (expl_imp_infos, dcl_modules, { cs & cs_symbol_table = cs_symbol_table })
......@@ -1671,8 +1660,7 @@ checkDclComponent components_array super_components expl_imp_indices mod_indices
= foldlArraySt ((switch_import_syntax
update_expl_imp_for_marked_symbol
update_expl_imp_for_marked_local_symbol) mod_index)
dcls_local_for_import
(dcl_modules, expl_imp_infos, cs_symbol_table)
dcls_local_for_import (dcl_modules, expl_imp_infos, cs_symbol_table)
= (expl_imp_infos, dcl_modules, cs_symbol_table)
just_update_expl_imp_info components_array super_components mod_index (expl_imp_infos, dcl_modules, cs_symbol_table)
......@@ -1888,7 +1876,7 @@ check_module1 {mod_type,mod_name,mod_imports,mod_imported_objects,mod_defs = cde
adjust_predefined_module_symbol :: !Index !(!*PredefinedSymbols, !*SymbolTable) -> (!*PredefinedSymbols, !*SymbolTable)
adjust_predefined_module_symbol predef_index (pre_def_symbols, symbol_table)
# (mod_symb, pre_def_symbols) = pre_def_symbols![predef_index]
# (mod_entry, symbol_table) = readPtr mod_symb.pds_ident.id_info symbol_table
# (mod_entry, symbol_table) = readPtr predefined_idents.[predef_index].id_info symbol_table
= case mod_entry.ste_kind of
STE_Module _
-> ({ pre_def_symbols & [predef_index] = { mod_symb & pds_module = cs_x.x_main_dcl_module_n, pds_def = mod_entry.ste_index }}, symbol_table)
......@@ -1900,7 +1888,7 @@ check_module1 {mod_type,mod_name,mod_imports,mod_imported_objects,mod_defs = cde
(mods, macro_defs, cs) = add_modules_to_symbol_table mods (inc mod_index) cs
= ([mod_sizes_and_defs:mods],[dcl_macro_defs:macro_defs], cs)
add_module_to_symbol_table mod=:{mod_defs} mod_index cs=:{cs_predef_symbols,cs_symbol_table, cs_error}
add_module_to_symbol_table mod=:{mod_defs} mod_index cs=:{cs_symbol_table, cs_error}
# def_instances = convert_class_instances mod_defs.def_instances
mod_defs = { mod_defs & def_instances = def_instances }
sizes_and_defs = collectFunctionTypes mod_defs.def_funtypes (collectCommonfinitions mod_defs)
......@@ -2109,25 +2097,24 @@ check_module2 mod_name mod_modification_time mod_imported_objects mod_imports mo
icl_import = icl_imported ,icl_modification_time = mod_modification_time}
= (False, icl_mod, dcl_modules, {}, {}, cs_x.x_main_dcl_module_n,heaps, cs_predef_symbols, cs_symbol_table, cs_error.ea_file, directly_imported_dcl_modules)
where
check_start_rule mod_kind mod_name icl_global_functions_ranges cs=:{cs_predef_symbols,cs_symbol_table,cs_x}
# (pre_symb, cs_predef_symbols) = cs_predef_symbols![PD_Start]
({ste_kind, ste_index}, cs_symbol_table) = readPtr pre_symb.pds_ident.id_info cs_symbol_table
cs = { cs & cs_predef_symbols = cs_predef_symbols, cs_symbol_table = cs_symbol_table }
check_start_rule mod_kind mod_name icl_global_functions_ranges cs=:{cs_symbol_table,cs_x}
# ({ste_kind, ste_index}, cs_symbol_table) = readPtr predefined_idents.[PD_Start].id_info cs_symbol_table
cs = { cs & cs_symbol_table = cs_symbol_table }
= case ste_kind of
STE_FunctionOrMacro _
| index_in_ranges ste_index icl_global_functions_ranges
-> { cs & cs_predef_symbols = { cs.cs_predef_symbols & [PD_Start] = { pre_symb & pds_def = ste_index, pds_module = cs_x.x_main_dcl_module_n }}}
-> { cs & cs_predef_symbols.[PD_Start] = { pds_def = ste_index, pds_module = cs_x.x_main_dcl_module_n }}
where
index_in_ranges index [{ir_from, ir_to}:ranges]
= (index>=ir_from && index < ir_to) || index_in_ranges index ranges;
index_in_ranges index []
= False
STE_Imported STE_DclFunction mod_index
-> { cs & cs_predef_symbols = { cs.cs_predef_symbols & [PD_Start] = { pre_symb & pds_def = ste_index, pds_module = mod_index }}}
-> { cs & cs_predef_symbols.[PD_Start] = { pds_def = ste_index, pds_module = mod_index }}
_
-> case mod_kind of
MK_Main
# pos = newPosition pre_symb.pds_ident (LinePos (mod_name.id_name+++".icl") 1)
# pos = newPosition predefined_idents.[PD_Start] (LinePos (mod_name.id_name+++".icl") 1)
-> { cs & cs_error = checkErrorWithIdentPos pos " has not been declared" cs.cs_error }
_
-> cs
......@@ -2275,10 +2262,10 @@ check_needed_modules_are_imported mod_name extension cs=:{cs_x={x_needed_modules
_ -> check_it PD_StdStrictLists mod_name " (needed for strict lists)" extension cs
= cs
where
check_it pd mod_name explanation extension cs=:{cs_predef_symbols, cs_symbol_table}
# (pds_ident, cs_predef_symbols) = cs_predef_symbols![pd].pds_ident
check_it pd mod_name explanation extension cs=:{cs_symbol_table}
# pds_ident = predefined_idents.[pd]
# ({ste_kind}, cs_symbol_table) = readPtr pds_ident.id_info cs_symbol_table
cs = { cs & cs_symbol_table = cs_symbol_table, cs_predef_symbols = cs_predef_symbols }
cs = { cs & cs_symbol_table = cs_symbol_table }
= case ste_kind of
STE_ClosedModule
-> cs
......@@ -2290,13 +2277,13 @@ check_needed_modules_are_imported mod_name extension cs=:{cs_x={x_needed_modules
-> { cs & cs_error = cs_error }
// MV ...
switched_off_Clean_feature pd mod_name explanation extension cs=:{cs_predef_symbols, cs_symbol_table}
# (ident,cs_predef_symbols) = cs_predef_symbols![pd].pds_ident
# error_location = { ip_ident = mod_name, ip_line = 1, ip_file = mod_name.id_name+++extension}
switched_off_Clean_feature pd mod_name explanation extension cs=:{cs_symbol_table}
# ident = predefined_idents.[pd]
# error_location = { ip_ident = mod_name, ip_line = 1, ip_file = mod_name.id_name+++extension}
cs_error = pushErrorAdmin error_location cs.cs_error
cs_error = checkError ident ("not supported"+++explanation) cs_error
cs_error = popErrorAdmin cs_error
= { cs & cs_error = cs_error, cs_predef_symbols = cs_predef_symbols }
= { cs & cs_error = cs_error}
// ... MV
arrayFunOffsetToPD_IndexTable :: !w:{# MemberDef} !v:{# PredefinedSymbol} -> (!{# Index}, !x:{#MemberDef}, !v:{#PredefinedSymbol}) , [w<=x]
......@@ -2461,6 +2448,7 @@ addImportedSymbolsToSymbolTable importing_mod opt_macro_range modules_in_compone
| is_new
= ([declaration:declarations_accu], dcl_modules, cs)
= (declarations_accu, dcl_modules, cs)
add_member importing_mod mod_index {ds_ident, ds_index} (declarations_accu, dcl_modules, cs)
# (sd=:{me_symb, me_pos}, dcl_modules)
= dcl_modules![mod_index].dcl_common.com_member_defs.[ds_index]
......@@ -2478,11 +2466,9 @@ add_declaration_to_symbol_table opt_dcl_macro_range (Declaration {decl_kind=STE_
add_declaration_to_symbol_table yes_for_icl_module (Declaration {decl_kind=decl_kind=:STE_Imported def_kind def_mod, decl_ident, decl_index, decl_pos}) importing_mod cs
= addSymbol yes_for_icl_module decl_ident decl_pos decl_kind def_kind decl_index def_mod importing_mod cs
updateExplImpInfo :: [Int] Index {!Declaration} {!Declaration} u:{#DclModule}
{!{!*ExplImpInfo}} *SymbolTable
updateExplImpInfo :: [Int] Index {!Declaration} {!Declaration} u:{#DclModule} {!{!*ExplImpInfo}} *SymbolTable
-> (u:{#DclModule},!{!{!.ExplImpInfo}},.SymbolTable)
updateExplImpInfo super_components mod_index dcls_import dcls_local_for_import
dcl_modules expl_imp_infos cs_symbol_table
updateExplImpInfo super_components mod_index dcls_import dcls_local_for_import dcl_modules expl_imp_infos cs_symbol_table
# (changed_symbols, (expl_imp_infos, cs_symbol_table))
= mapSt markExplImpSymbols super_components (expl_imp_infos, cs_symbol_table)
......@@ -2500,8 +2486,7 @@ updateExplImpInfo super_components mod_index dcls_import dcls_local_for_import
(dcl_modules, expl_imp_infos, cs_symbol_table)
= update_expl_imp_for_marked_symbols mod_index dcls_import (dcl_modules, expl_imp_infos, cs_symbol_table)
cs_symbol_table
= foldSt (\l cs_symbol_table->foldSt restoreHeap l cs_symbol_table)
changed_symbols cs_symbol_table
= foldSt (\l cs_symbol_table->foldSt restoreHeap l cs_symbol_table) changed_symbols cs_symbol_table
= (dcl_modules, expl_imp_infos, cs_symbol_table)
updateExplImpInfoForCachedModule :: [Int] Index {!Declaration} {!Declaration} {!{!*ExplImpInfo}} u:{#DclModule} *SymbolTable
......@@ -2683,30 +2668,25 @@ update_expl_imp_for_marked_symbol mod_index decl=:(Declaration {decl_ident}) (dc
update_expl_imp_for_marked_local_symbol mod_index decl=:(Declaration {decl_ident}) (dcl_modules, expl_imp_infos, cs_symbol_table)
# (ste, cs_symbol_table) = readPtr decl_ident.id_info cs_symbol_table
= updateExplImpForMarkedLocalSymbol mod_index decl ste dcl_modules expl_imp_infos cs_symbol_table
updateExplImpForMarkedLocalSymbol :: !Index Declaration !SymbolTableEntry !u:{#DclModule} !{!{!*ExplImpInfo}} !*SymbolTable
-> (!u:{#DclModule}, !{!{!.ExplImpInfo}}, !.SymbolTable)
updateExplImpForMarkedLocalSymbol mod_index decl {ste_kind=STE_ExplImpComponentNrs component_numbers inst_indices}
dcl_modules expl_imp_infos cs_symbol_table
= foldSt (addExplImpInfo mod_index decl) component_numbers
(dcl_modules, expl_imp_infos, cs_symbol_table)
where
addExplImpInfo :: !Index Declaration !ComponentNrAndIndex !(!u:{#DclModule}, !{!{!*ExplImpInfo}}, !v:SymbolTable)
-> (!u:{#DclModule}, !{!{!.ExplImpInfo}}, !v:SymbolTable)
addExplImpInfo mod_index decl { cai_component_nr, cai_index } (dcl_modules, expl_imp_infos, cs_symbol_table)
# (ExplImpInfo eii_ident eii_declaring_modules, expl_imp_infos)
= replaceTwoDimArrElt cai_component_nr cai_index TemporarilyFetchedAway expl_imp_infos
(all_belongs, dcl_modules)
= getBelongingSymbols decl dcl_modules
di_belonging
= nsFromTo (nrOfBelongingSymbols all_belongs)
di
= { di_decl = decl, di_instances = [], di_belonging = di_belonging }
new_expl_imp_info
= ExplImpInfo eii_ident (ikhInsert` False mod_index di eii_declaring_modules)
= (dcl_modules, { expl_imp_infos & [cai_component_nr,cai_index] = new_expl_imp_info }, cs_symbol_table)
updateExplImpForMarkedLocalSymbol _ _ entry dcl_modules expl_imp_infos cs_symbol_table
= (dcl_modules, expl_imp_infos, cs_symbol_table)
where
updateExplImpForMarkedLocalSymbol :: !Index Declaration !SymbolTableEntry !u:{#DclModule} !{!{!*ExplImpInfo}} !*SymbolTable
-> (!u:{#DclModule}, !{!{!.ExplImpInfo}}, !.SymbolTable)
updateExplImpForMarkedLocalSymbol mod_index decl {ste_kind=STE_ExplImpComponentNrs component_numbers inst_indices}
dcl_modules expl_imp_infos cs_symbol_table
= foldSt (addExplImpInfo mod_index decl) component_numbers (dcl_modules, expl_imp_infos, cs_symbol_table)
where
addExplImpInfo :: !Index Declaration !ComponentNrAndIndex !(!u:{#DclModule}, !{!{!*ExplImpInfo}}, !v:SymbolTable)
-> (!u:{#DclModule}, !{!{!.ExplImpInfo}}, !v:SymbolTable)
addExplImpInfo mod_index decl { cai_component_nr, cai_index } (dcl_modules, expl_imp_infos, cs_symbol_table)
# (ExplImpInfo eii_ident eii_declaring_modules, expl_imp_infos)
= replaceTwoDimArrElt cai_component_nr cai_index TemporarilyFetchedAway expl_imp_infos
(all_belongs, dcl_modules) = getBelongingSymbols decl dcl_modules
di_belonging = nsFromTo (nrOfBelongingSymbols all_belongs)
di = { di_decl = decl, di_instances = [], di_belonging = di_belonging }
new_expl_imp_info = ExplImpInfo eii_ident (ikhInsert` False mod_index di eii_declaring_modules)
= (dcl_modules, { expl_imp_infos & [cai_component_nr,cai_index] = new_expl_imp_info }, cs_symbol_table)
updateExplImpForMarkedLocalSymbol _ _ entry dcl_modules expl_imp_infos cs_symbol_table
= (dcl_modules, expl_imp_infos, cs_symbol_table)
checkInstancesOfDclModule :: !.Int !(!.Int,.Int,.[FunType]) !(!*{#DclModule},!*Heaps,!*CheckState)
-> (!.{#DclModule},!.Heaps,!.CheckState);
......@@ -2902,13 +2882,13 @@ where
<=< adjustPredefSymbol PD_ModuleID mod_index STE_Constructor)
// AA..
# (pre_mod, cs_predef_symbols) = cs_predef_symbols![PD_StdGeneric]
# (pd_type_iso, cs_predef_symbols) = cs_predef_symbols![PD_TypeISO]
# type_iso_ident = predefined_idents.[PD_TypeISO]
| pre_mod.pds_def == mod_index
= (class_members, class_instances, fun_types, { cs & cs_predef_symbols = cs_predef_symbols}
<=< adjustPredefSymbol PD_TypeISO mod_index STE_Type
<=< adjustPredefSymbol PD_ConsISO mod_index STE_Constructor
<=< adjustPredefSymbol PD_iso_from mod_index (STE_Field pd_type_iso.pds_ident)
<=< adjustPredefSymbol PD_iso_to mod_index (STE_Field pd_type_iso.pds_ident)
<=< adjustPredefSymbol PD_iso_from mod_index (STE_Field type_iso_ident)
<=< adjustPredefSymbol PD_iso_to mod_index (STE_Field type_iso_ident)
<=< adjustPredefSymbol PD_TypeUNIT mod_index STE_Type
<=< adjustPredefSymbol PD_ConsUNIT mod_index STE_Constructor
<=< adjustPredefSymbol PD_TypePAIR mod_index STE_Type
......@@ -2941,7 +2921,7 @@ where
unused
= { id_name = "unused", id_info = nilPtr }
adjust_predef_symbols next_symb last_symb mod_index symb_kind cs=:{cs_predef_symbols, cs_symbol_table, cs_error}
adjust_predef_symbols next_symb last_symb mod_index symb_kind cs
| next_symb > last_symb
= cs
= cs
......@@ -2961,13 +2941,12 @@ where
= getClassDef ins_class mod_index com_class_defs modules
= (size class_members + sum, com_class_defs, modules)
adjustPredefSymbol predef_index mod_index symb_kind cs=:{cs_predef_symbols,cs_symbol_table,cs_error}
# (pre_symb, cs_predef_symbols) = cs_predef_symbols![predef_index]
# pre_id = pre_symb.pds_ident
adjustPredefSymbol predef_index mod_index symb_kind cs=:{cs_symbol_table,cs_error}
# pre_id = predefined_idents.[predef_index]
#! pre_index = determine_index_of_symbol (sreadPtr pre_id.id_info cs_symbol_table) symb_kind
| pre_index <> NoIndex
= { cs & cs_predef_symbols = {cs_predef_symbols & [predef_index] = { pre_symb & pds_def = pre_index, pds_module = mod_index }}}
= { cs & cs_predef_symbols = cs_predef_symbols, cs_error = checkError pre_id " function not defined" cs_error }
= { cs & cs_predef_symbols.[predef_index] = { pds_def = pre_index, pds_module = mod_index }}
= { cs & cs_error = checkError pre_id " function not defined" cs_error }
where
determine_index_of_symbol {ste_kind, ste_index} symb_kind
| ste_kind == symb_kind
......@@ -2976,9 +2955,6 @@ where
NewEntry symbol_table symb_ptr def_kind def_index level previous :==
symbol_table <:= (symb_ptr,{ ste_kind = def_kind, ste_index = def_index, ste_def_level = level, ste_previous = previous })
file_and_status {ea_file,ea_ok}
= (ea_file, ea_ok)
instance <<< AuxiliaryPattern
where
......@@ -3097,11 +3073,6 @@ groupify { dag_nr_of_nodes, dag_get_children } component_numbers nr_of_component
= ({ visited_array & [child_component_number] = True }, [child_component_number : visited_list],
{ node_to_components & [node_nr] = [child_component_number:current_components] })
array_to_list a = [el\\el<-:a]
dummy_decl
=: { decl_ident = { id_name = "", id_info = nilPtr }, decl_pos = NoPos, decl_kind = STE_Empty, decl_index = cUndef }
arg_string 0 = "result"
arg_string arg_nr = toString arg_nr+++". arg"
......
......@@ -62,7 +62,7 @@ get_unboxed_list_indices_and_decons_u_ident cs=:{cs_predef_symbols,cs_x}
# decons_u_index=decons_u_symbol.pds_def
# (nil_u_index,cs_predef_symbols)=cs_predef_symbols![PD_nil_u].pds_def
# cs={cs & cs_predef_symbols=cs_predef_symbols,cs_x.x_needed_modules=cs_x.x_needed_modules bitor cNeedStdStrictLists}
= (stdStrictLists_index,cons_u_index,decons_u_index,nil_u_index,decons_u_symbol.pds_ident,cs)
= (stdStrictLists_index,cons_u_index,decons_u_index,nil_u_index,predefined_idents.[PD_decons_u],cs)
make_unboxed_list type_symbol expr_heap cs
# (stdStrictLists_index,cons_u_index,decons_u_index,nil_u_index,decons_u_ident,cs) = get_unboxed_list_indices_and_decons_u_ident cs
......@@ -79,7 +79,7 @@ get_unboxed_tail_strict_list_indices_and_decons_u_ident cs=:{cs_predef_symbols,c
# decons_uts_index=decons_uts_symbol.pds_def
# (nil_uts_index,cs_predef_symbols)=cs_predef_symbols![PD_nil_uts].pds_def
# cs={cs & cs_predef_symbols=cs_predef_symbols,cs_x.x_needed_modules=cs_x.x_needed_modules bitor cNeedStdStrictLists}
= (stdStrictLists_index,cons_uts_index,decons_uts_index,nil_uts_index,decons_uts_symbol.pds_ident,cs)
= (stdStrictLists_index,cons_uts_index,decons_uts_index,nil_uts_index,predefined_idents.[PD_decons_uts],cs)
make_unboxed_tail_strict_list type_symbol expr_heap cs
# (stdStrictLists_index,cons_uts_index,decons_uts_index,nil_uts_index,decons_uts_ident,cs) = get_unboxed_tail_strict_list_indices_and_decons_u_ident cs
......@@ -96,7 +96,7 @@ get_overloaded_list_indices_and_decons_ident cs=:{cs_predef_symbols,cs_x}
# decons_index=decons_symbol.pds_def
# (nil_index,cs_predef_symbols)=cs_predef_symbols![PD_nil].pds_def
# cs={cs & cs_predef_symbols=cs_predef_symbols,cs_x.x_needed_modules=cs_x.x_needed_modules bitor cNeedStdStrictLists}
= (stdStrictLists_index,cons_index,decons_index,nil_index,decons_symbol.pds_ident,cs)
= (stdStrictLists_index,cons_index,decons_index,nil_index,predefined_idents.[PD_decons],cs)
make_overloaded_list type_symbol expr_heap cs
# (stdStrictLists_index,cons_index,decons_index,nil_index,decons_ident,cs) = get_overloaded_list_indices_and_decons_ident cs
......@@ -795,11 +795,13 @@ where
| glob_module==cPredefinedModuleIndex
# index=glob_object.ds_index+FirstConstructorPredefinedSymbolIndex
| index==PD_OverloadedConsSymbol
# ({pds_ident,pds_def},cs) = cs!cs_predef_symbols.[pd_cons_symbol]
# ({pds_def},cs) = cs!cs_predef_symbols.[pd_cons_symbol]
# pds_ident = predefined_idents.[pd_cons_symbol]
# glob_object = {glob_object & ds_index=pds_def,ds_ident=pds_ident}
= ({pattern & ap_symbol.glob_object=glob_object},cs)
| index==PD_OverloadedNilSymbol
# ({pds_ident,pds_def},cs) = cs!cs_predef_symbols.[pd_nil_symbol]
# ({pds_def},cs) = cs!cs_predef_symbols.[pd_nil_symbol]
# pds_ident = predefined_idents.[pd_nil_symbol]
# glob_object = {glob_object & ds_index=pds_def,ds_ident=pds_ident}
= ({pattern & ap_symbol.glob_object=glob_object},cs)
= abort "replace_overloaded_symbol_in_pattern"
......@@ -1239,26 +1241,28 @@ where
-> (!Expression, ![FreeVar], !*ExpressionState, !u:ExpressionInfo, !*CheckState)
check_id_expression {ste_kind = STE_Empty} is_expr_list free_vars id e_input e_state e_info cs=:{cs_error,cs_predef_symbols,cs_x}
# ({pds_ident=from_ident}) = cs_predef_symbols.[PD_From]
({pds_ident=from_then_ident}) = cs_predef_symbols.[PD_FromThen]
({pds_ident=from_to_ident}) = cs_predef_symbols.[PD_FromTo]
({pds_ident=from_then_to_ident}) = cs_predef_symbols.[PD_FromThenTo]
# local_predefined_idents = predefined_idents
# from_ident = local_predefined_idents.[PD_From]
from_then_ident = local_predefined_idents.[PD_FromThen]
from_to_ident = local_predefined_idents.[PD_FromTo]
from_then_to_ident = local_predefined_idents.[PD_FromThenTo]
| id==from_ident || id==from_then_ident || id==from_to_ident || id==from_then_to_ident
= (EE, free_vars, e_state, e_info, { cs & cs_x.x_needed_modules = cs_x.x_needed_modules bitor cNeedStdEnum})
// instead of giving an error message remember that StdEnum should have been imported.
// Error will be given in function check_needed_modules_are_imported
# ({pds_ident=createArray_ident}) = cs_predef_symbols.[PD__CreateArrayFun]
({pds_ident=uselect_ident}) = cs_predef_symbols.[PD_UnqArraySelectFun]
({pds_ident=update_ident}) = cs_predef_symbols.[PD_ArrayUpdateFun]
({pds_ident=usize_ident}) = cs_predef_symbols.[PD_UnqArraySizeFun]
# createArray_ident = local_predefined_idents.[PD__CreateArrayFun]
uselect_ident = local_predefined_idents.[PD_UnqArraySelectFun]
update_ident = local_predefined_idents.[PD_ArrayUpdateFun]
usize_ident = local_predefined_idents.[PD_UnqArraySizeFun]
| id==createArray_ident || id==uselect_ident || id==update_ident || id==usize_ident
= (EE, free_vars, e_state, e_info, { cs & cs_x.x_needed_modules = cs_x.x_needed_modules bitor cNeedStdArray})
// instead of giving an error message remember that StdArray should have been be imported.
// Error will be given in function check_needed_modules_are_imported
| id==cs_predef_symbols.[PD_cons].pds_ident || id==cs_predef_symbols.[PD_decons].pds_ident
|| id==cs_predef_symbols.[PD_cons_u].pds_ident || id==cs_predef_symbols.[PD_decons_u].pds_ident
|| id==cs_predef_symbols.[PD_cons_uts].pds_ident || id==cs_predef_symbols.[PD_decons_uts].pds_ident
|| id==cs_predef_symbols.[PD_nil].pds_ident || id==cs_predef_symbols.[PD_nil_u].pds_ident || id==cs_predef_symbols.[PD_nil_uts].pds_ident
| id==local_predefined_idents.[PD_cons] || id==local_predefined_idents.[PD_decons]
|| id==local_predefined_idents.[PD_cons_u] || id==local_predefined_idents.[PD_decons_u]
|| id==local_predefined_idents.[PD_cons_uts] || id==local_predefined_idents.[PD_decons_uts]
|| id==local_predefined_idents.[PD_nil] || id==local_predefined_idents.[PD_nil_u] || id==local_predefined_idents.[PD_nil_uts]
= (EE, free_vars, e_state, e_info, { cs & cs_x.x_needed_modules = cs_x.x_needed_modules bitor cNeedStdStrictLists})
// instead report that StdStrictLists should be imported in function check_needed_modules_are_imported
= (EE, free_vars, e_state, e_info, { cs & cs_error = checkError id "undefined" cs_error })
......@@ -2249,8 +2253,7 @@ buildPattern mod_index (APK_Macro is_dcl_macro) {glob_module,glob_object} args o
getPredefinedGlobalSymbol :: !Index !Index !STE_Kind !Int !*CheckState -> (!Global DefinedSymbol, !*CheckState)
getPredefinedGlobalSymbol symb_index module_index req_ste_kind arity cs=:{cs_predef_symbols,cs_symbol_table}
# (pre_def_mod, cs_predef_symbols) = cs_predef_symbols![module_index]
# mod_id = pre_def_mod.pds_ident
# mod_id = predefined_idents.[module_index]
# (mod_entry, cs_symbol_table) = readPtr mod_id.id_info cs_symbol_table
| mod_entry.ste_kind == STE_ClosedModule
# (glob_object, cs) = get_predefined_symbol symb_index req_ste_kind arity mod_entry.ste_index
......@@ -2261,8 +2264,7 @@ getPredefinedGlobalSymbol symb_index module_index req_ste_kind arity cs=:{cs_pre
where
get_predefined_symbol :: !Index !STE_Kind !Int !Index !*CheckState -> (!DefinedSymbol,!*CheckState)
get_predefined_symbol symb_index req_ste_kind arity mod_index cs=:{cs_predef_symbols,cs_symbol_table,cs_error}
# (pre_def_symb, cs_predef_symbols) = cs_predef_symbols![symb_index]
symb_id = pre_def_symb.pds_ident
# symb_id = predefined_idents.[symb_index]
(symb_entry, cs_symbol_table) = readPtr symb_id.id_info cs_symbol_table
cs = { cs & cs_predef_symbols = cs_predef_symbols, cs_symbol_table = cs_symbol_table }
| symb_entry.ste_kind == req_ste_kind
......
......@@ -138,11 +138,13 @@ convertDynamicPatternsIntoUnifyAppls global_type_instances common_defs main_dcl_
True
# arity = 2
// get tuple arity 2 constructor
# ({pds_module, pds_def, pds_ident}, predefined_symbols) = predefined_symbols![GetTupleConsIndex arity]
# ({pds_module, pds_def}, predefined_symbols) = predefined_symbols![GetTupleConsIndex arity]
# pds_ident = predefined_idents.[GetTupleConsIndex arity]
# twoTuple_symb = { symb_name = pds_ident, symb_kind = SK_Constructor { glob_module = pds_module, glob_object = pds_def}, symb_arity = arity }
// get tuple, type and value selectors
# ({pds_def, pds_ident}, predefined_symbols) = predefined_symbols![GetTupleConsIndex arity]
# ({pds_def}, predefined_symbols) = predefined_symbols![GetTupleConsIndex arity]
# pds_ident = predefined_idents.[GetTupleConsIndex arity]
# twotuple = {ds_ident = pds_ident, ds_arity = arity, ds_index = pds_def}
# type_selector = TupleSelect twotuple 1
# value_selector = TupleSelect twotuple 0
......@@ -933,7 +935,8 @@ where
# (ci=:{ci_predef_symb})
= ci;
# ({pds_module, pds_def, pds_ident}, ci_predef_symb) = ci_predef_symb![PD_ModuleConsSymbol]
# ({pds_module, pds_def}, ci_predef_symb) = ci_predef_symb![PD_ModuleConsSymbol]
# pds_ident = predefined_idents.[PD_ModuleConsSymbol]
# module_symb1 = { symb_name = pds_ident, symb_kind = SK_Constructor { glob_module = pds_module, glob_object = pds_def}, symb_arity = 0 }
# ci
= { ci & ci_predef_symb = ci_predef_symb };
......@@ -1187,13 +1190,15 @@ getResultType case_info_ptr ci=:{ci_expr_heap}
getSymbol :: Index ((Global Index) -> SymbKind) Int !*ConversionInfo -> (SymbIdent, !*ConversionInfo)
getSymbol index symb_kind arity ci=:{ci_predef_symb}
# ({pds_module, pds_def, pds_ident}, ci_predef_symb) = ci_predef_symb![index]
# ({pds_module, pds_def}, ci_predef_symb) = ci_predef_symb![index]
# pds_ident = predefined_idents.[index]
ci = {ci & ci_predef_symb = ci_predef_symb}
symbol = { symb_name = pds_ident, symb_kind = symb_kind { glob_module = pds_module, glob_object = pds_def}, symb_arity = arity }
= (symbol, ci)
getTupleSymbol arity ci=:{ci_predef_symb}
# ({pds_def, pds_ident}, ci_predef_symb) = ci_predef_symb![GetTupleConsIndex arity]
# ({pds_def}, ci_predef_symb) = ci_predef_symb![GetTupleConsIndex arity]
# pds_ident = predefined_idents.[GetTupleConsIndex arity]
= ( {ds_ident = pds_ident, ds_arity = arity, ds_index = pds_def}, {ci & ci_predef_symb = ci_predef_symb })
getGlobalIndex :: Index !*ConversionInfo -> (Global Index, !*ConversionInfo)
......@@ -1203,7 +1208,8 @@ getGlobalIndex index ci=:{ci_predef_symb}
getConstructor :: Index Int !*ConversionInfo -> (Global DefinedSymbol, !*ConversionInfo)
getConstructor index arity ci=:{ci_predef_symb}
# ({pds_module, pds_def, pds_ident}, ci_predef_symb) = ci_predef_symb![index]
# ({pds_module, pds_def}, ci_predef_symb) = ci_predef_symb![index]
# pds_ident = predefined_idents.[index]
defined_symbol = { ds_ident = pds_ident, ds_arity = arity, ds_index = pds_def}
= ( {glob_object = defined_symbol, glob_module = pds_module} , {ci & ci_predef_symb = ci_predef_symb} )
......@@ -1274,14 +1280,16 @@ where
get_module_id_app :: !*PredefinedSymbols -> (App,Expression,!*PredefinedSymbols)
get_module_id_app predef_symbols
// get module id symbol
# ({pds_module, pds_def, pds_ident}, predef_symbols) = predef_symbols![PD_ModuleConsSymbol]
# ({pds_module, pds_def}, predef_symbols) = predef_symbols![PD_ModuleConsSymbol]
# pds_ident = predefined_idents.[PD_ModuleConsSymbol]
# module_symb =
{ app_symb = { symb_name = pds_ident, symb_kind = SK_Constructor { glob_module = pds_module, glob_object = pds_def}, symb_arity = 0 }
, app_args = []
, app_info_ptr = nilPtr
}
# ({pds_module, pds_def, pds_ident}, predef_symbols) = predef_symbols![PD_ModuleID]
# ({pds_module, pds_def}, predef_symbols) = predef_symbols![PD_ModuleID]
# pds_ident = predefined_idents.[PD_ModuleID]
# module_id_symb =
{ app_symb = { symb_name = pds_ident, symb_kind = SK_Constructor { glob_module = pds_module, glob_object = pds_def}, symb_arity = 1 }
, app_args = [App module_symb]
......
......@@ -19,12 +19,11 @@ markExplImpSymbols :: !Int !*(!*{!*{!u:ExplImpInfo}}, !*SymbolTable)
updateExplImpForMarkedSymbol :: !Index !Declaration !SymbolTableEntry !u:{#DclModule} !{!{!*ExplImpInfo}} !*SymbolTable
-> (!u:{#DclModule}, !{!{!.ExplImpInfo}}, !.SymbolTable)
optStoreInstanceWithClassSymbol :: Declaration !Ident !*SymbolTable
-> .SymbolTable
optStoreInstanceWithClassSymbol :: Declaration !Ident !*SymbolTable -> .SymbolTable
solveExplicitImports :: !(IntKeyHashtable [(Int,Position,[ImportNrAndIdents])]) !{#Int} !Index
!*(!v:{#DclModule},!*{#Int},!{!*ExplImpInfo},!*CheckState)
-> (!.SolvedImports,!(!v:{#DclModule},!.{#Int},!{!.ExplImpInfo},!.CheckState))
!*(!v:{#DclModule},!*{#Int},!{!*ExplImpInfo},!*CheckState)
-> (!.SolvedImports,! (!v:{#DclModule},!.{#Int},!{!.ExplImpInfo},!.CheckState))
checkExplicitImportCompleteness :: ![([Declaration], Position)] !*{#DclModule} !*{#FunDef} !*{#*{#FunDef}} !*ExpressionHeap !*CheckState
-> (!.{#DclModule},!.{#FunDef},!*{#*{#FunDef}},!.ExpressionHeap,!.CheckState)
......
......@@ -42,13 +42,11 @@ markExplImpSymbols component_nr (expl_imp_info, cs_symbol_table)
# (eii, expl_imp_info) = replaceTwoDimArrElt component_nr i TemporarilyFetchedAway expl_imp_info
(eii_ident, eii) = get_eei_ident eii
= (eii_ident, { expl_imp_info & [component_nr, i] = eii })
updateExplImpForMarkedSymbol :: !Index !Declaration !SymbolTableEntry !u:{#DclModule} !{!{!*ExplImpInfo}} !*SymbolTable
-> (!u:{#DclModule}, !{!{!.ExplImpInfo}}, !.SymbolTable)
updateExplImpForMarkedSymbol mod_index decl {ste_kind=STE_ExplImpComponentNrs component_numbers inst_indices}
dcl_modules expl_imp_infos cs_symbol_table
= foldSt (addExplImpInfo mod_index decl inst_indices) component_numbers
(dcl_modules, expl_imp_infos, cs_symbol_table)
updateExplImpForMarkedSymbol mod_index decl {ste_kind=STE_ExplImpComponentNrs component_numbers inst_indices} dcl_modules expl_imp_infos cs_symbol_table
= foldSt (addExplImpInfo mod_index decl inst_indices) component_numbers (dcl_modules, expl_imp_infos, cs_symbol_table)
updateExplImpForMarkedSymbol _ _ entry dcl_modules expl_imp_infos cs_symbol_table
= (dcl_modules, expl_imp_infos, cs_symbol_table)
......@@ -59,19 +57,15 @@ addExplImpInfo mod_index decl instances { cai_component_nr, cai_index } (dcl_mod
= replaceTwoDimArrElt cai_component_nr cai_index TemporarilyFetchedAway expl_imp_infos
(di_belonging, dcl_modules, cs_symbol_table)
= get_belonging_symbol_nrs decl dcl_modules cs_symbol_table
di
= { di_decl = decl, di_instances = instances, di_belonging = di_belonging }
new_expl_imp_info
= ExplImpInfo eii_ident (ikhInsert` False mod_index di eii_declaring_modules)
di = { di_decl = decl, di_instances = instances, di_belonging = di_belonging }
new_expl_imp_info = ExplImpInfo eii_ident (ikhInsert` False mod_index di eii_declaring_modules)
= (dcl_modules, { expl_imp_infos & [cai_component_nr,cai_index] = new_expl_imp_info }, cs_symbol_table)
where
get_belonging_symbol_nrs :: !Declaration !v:{#DclModule} !u:(Heap SymbolTableEntry)
-> (!.NumberSet,!v:{#DclModule},!u:Heap SymbolTableEntry)
-> (!.NumberSet,!v:{#DclModule},!u: Heap SymbolTableEntry)
get_belonging_symbol_nrs decl dcl_modules cs_symbol_table
# (all_belonging_symbols, dcl_modules)
= getBelongingSymbols decl dcl_modules
nr_of_belongs
= nrOfBelongingSymbols all_belonging_symbols
# (all_belonging_symbols, dcl_modules) = getBelongingSymbols decl dcl_modules
nr_of_belongs = nrOfBelongingSymbols all_belonging_symbols
(_, belonging_bitvect, cs_symbol_table)
= foldlBelongingSymbols set_bit all_belonging_symbols (0, bitvectCreate nr_of_belongs, cs_symbol_table)
= (bitvectToNumberSet belonging_bitvect, dcl_modules, cs_symbol_table)
......@@ -131,15 +125,12 @@ getBelongingSymbolsFromID (ID_Record _ x) = x
getBelongingSymbolsFromID _ = No
solveExplicitImports :: !(IntKeyHashtable [(Int,Position,[ImportNrAndIdents])]) !{#Int} !Index
!*(!v:{#DclModule},!*{#Int},!{!*ExplImpInfo},!*CheckState)
-> (!.SolvedImports,!(!v:{#DclModule},!.{#Int},!{!.ExplImpInfo},!.CheckState))