Commit 22ccafc9 authored by John van Groningen's avatar John van Groningen
Browse files

remove 'dcl_is_cashed'

parent f8d9a6cb
...@@ -1606,7 +1606,7 @@ check_module1 {mod_type,mod_name,mod_imports,mod_imported_objects,mod_defs = cde ...@@ -1606,7 +1606,7 @@ check_module1 {mod_type,mod_name,mod_imports,mod_imported_objects,mod_defs = cde
init_new_dcl_modules = gimme_a_strict_array_type { initialDclModule scanned_module module_n \\ scanned_module <- scanned_modules & module_n<-[size dcl_modules..]} init_new_dcl_modules = gimme_a_strict_array_type { initialDclModule scanned_module module_n \\ scanned_module <- scanned_modules & module_n<-[size dcl_modules..]}
init_dcl_modules = { if (i<size dcl_modules) init_dcl_modules = { if (i<size dcl_modules)
{ dcl_modules.[i] & dcl_is_cashed = True } dcl_modules.[i]
init_new_dcl_modules.[i-size dcl_modules] init_new_dcl_modules.[i-size dcl_modules]
\\ i<-[0..size dcl_modules+size init_new_dcl_modules-1]} \\ i<-[0..size dcl_modules+size init_new_dcl_modules-1]}
= (mod_name,mod_imported_objects,mod_imports,mod_type,icl_global_function_range,nr_of_functions,first_inst_index,local_defs,icl_functions,init_dcl_modules,main_dcl_module_n,cdefs,sizes,cs) = (mod_name,mod_imported_objects,mod_imports,mod_type,icl_global_function_range,nr_of_functions,first_inst_index,local_defs,icl_functions,init_dcl_modules,main_dcl_module_n,cdefs,sizes,cs)
...@@ -2226,7 +2226,6 @@ initialDclModule ({mod_name, mod_defs=mod_defs=:{def_funtypes,def_macros}, mod_t ...@@ -2226,7 +2226,6 @@ initialDclModule ({mod_name, mod_defs=mod_defs=:{def_funtypes,def_macros}, mod_t
, dcl_module_kind = mod_type , dcl_module_kind = mod_type
// ... RWS // ... RWS
, dcl_imported_module_numbers = EndNumbers , dcl_imported_module_numbers = EndNumbers
, dcl_is_cashed = False
} }
addImportedSymbolsToSymbolTable importing_mod opt_macro_range modules_in_component_set imports_ikh dcl_modules cs addImportedSymbolsToSymbolTable importing_mod opt_macro_range modules_in_component_set imports_ikh dcl_modules cs
......
definition module checkKindCorrectness definition module checkKindCorrectness
import syntax, checksupport, containers import syntax, checksupport
checkKindCorrectness :: !Index IndexRange !u:{# FunDef} !{#CommonDefs} !*{#DclModule} !*TypeVarHeap !*TypeDefInfos !*ErrorAdmin checkKindCorrectness :: !Index IndexRange !{#CommonDefs} !Int !u:{# FunDef} !*{#DclModule} !*TypeVarHeap !*TypeDefInfos !*ErrorAdmin
-> (!u:{# FunDef}, !*{#DclModule}, !*TypeVarHeap, !*TypeDefInfos, !*ErrorAdmin) -> (!u:{# FunDef}, !*{#DclModule}, !*TypeVarHeap, !*TypeDefInfos, !*ErrorAdmin)
...@@ -3,22 +3,16 @@ implementation module checkKindCorrectness ...@@ -3,22 +3,16 @@ implementation module checkKindCorrectness
import StdEnv import StdEnv
import syntax, containers, checksupport, utilities import syntax, containers, checksupport, utilities
// import RWSDebug //import RWSDebug
checkKindCorrectness :: !Index IndexRange !u:{# FunDef} !{#CommonDefs} !*{#DclModule} !*TypeVarHeap !*TypeDefInfos !*ErrorAdmin checkKindCorrectness :: !Index IndexRange !{#CommonDefs} !Int !u:{# FunDef} !*{#DclModule} !*TypeVarHeap !*TypeDefInfos !*ErrorAdmin
-> (!u:{# FunDef}, !*{#DclModule}, !*TypeVarHeap, !*TypeDefInfos, !*ErrorAdmin) -> (!u:{# FunDef}, !*{#DclModule}, !*TypeVarHeap, !*TypeDefInfos, !*ErrorAdmin)
checkKindCorrectness main_dcl_module_n icl_instances fun_defs common_defs checkKindCorrectness main_dcl_module_n icl_instances common_defs n_cached_dcl_modules fun_defs dcl_mods th_vars td_infos error_admin
dcl_mods th_vars td_infos error_admin #! n_fun_defs = size fun_defs
#! n_fun_defs size_dcl_mods = size dcl_mods
= size fun_defs # (dcl_mods, th_vars, td_infos, error_admin)
size_dcl_mods
= size dcl_mods
# (bv_cashed_modules, dcl_mods)
= iFoldSt mark_cashed_module
0 size_dcl_mods (bitvectCreate size_dcl_mods, dcl_mods)
(dcl_mods, th_vars, td_infos, error_admin)
= iFoldSt (\mod_index state = iFoldSt (\mod_index state
-> if (bitvectSelect mod_index bv_cashed_modules) -> if (mod_index<n_cached_dcl_modules)
state state
(check_classes mod_index state)) (check_classes mod_index state))
0 size_dcl_mods (dcl_mods, th_vars, td_infos, error_admin) 0 size_dcl_mods (dcl_mods, th_vars, td_infos, error_admin)
...@@ -28,11 +22,10 @@ checkKindCorrectness main_dcl_module_n icl_instances fun_defs common_defs ...@@ -28,11 +22,10 @@ checkKindCorrectness main_dcl_module_n icl_instances fun_defs common_defs
= foldrArraySt (check_class icl_common_defs.com_member_defs) = foldrArraySt (check_class icl_common_defs.com_member_defs)
icl_common_defs.com_class_defs icl_common_defs.com_class_defs
([], th_vars, td_infos, error_admin) ([], th_vars, td_infos, error_admin)
bv_uninitialized_mods bv_uninitialized_mods = bitvectSetFirstN n_cached_dcl_modules (bitvectCreate size_dcl_mods)
= {el\\el<-:bv_cashed_modules}
(bv_uninitialized_mods, th_vars, td_infos, error_admin) (bv_uninitialized_mods, th_vars, td_infos, error_admin)
= iFoldSt (\mod_index state = iFoldSt (\mod_index state
-> if (bitvectSelect mod_index bv_cashed_modules) -> if (mod_index<n_cached_dcl_modules)
state state
(check_instances_and_class_and_member_contexts (check_instances_and_class_and_member_contexts
common_defs common_defs.[mod_index] state)) common_defs common_defs.[mod_index] state))
...@@ -45,18 +38,13 @@ checkKindCorrectness main_dcl_module_n icl_instances fun_defs common_defs ...@@ -45,18 +38,13 @@ checkKindCorrectness main_dcl_module_n icl_instances fun_defs common_defs
= iFoldSt (check_icl_function common_defs) icl_instances.ir_to n_fun_defs state = iFoldSt (check_icl_function common_defs) icl_instances.ir_to n_fun_defs state
(dcl_mods, bv_uninitialized_mods, th_vars, td_infos, error_admin) (dcl_mods, bv_uninitialized_mods, th_vars, td_infos, error_admin)
= iFoldSt (\mod_index state = iFoldSt (\mod_index state
-> if (bitvectSelect mod_index bv_cashed_modules || mod_index==main_dcl_module_n) -> if (mod_index<n_cached_dcl_modules || mod_index==main_dcl_module_n)
state state
(check_dcl_functions common_defs mod_index state)) (check_dcl_functions common_defs mod_index state))
0 size_dcl_mods 0 size_dcl_mods
(dcl_mods, bv_uninitialized_mods, th_vars, td_infos, error_admin) (dcl_mods, bv_uninitialized_mods, th_vars, td_infos, error_admin)
= (fun_defs, dcl_mods, th_vars, td_infos, error_admin) = (fun_defs, dcl_mods, th_vars, td_infos, error_admin)
where where
mark_cashed_module mod_index (bitvect, dcl_mods)
| dcl_mods.[mod_index].dcl_is_cashed
= (bitvectSet mod_index bitvect, dcl_mods)
= (bitvect, dcl_mods)
check_classes mod_index (dcl_mods, th_vars, td_infos, error_admin) check_classes mod_index (dcl_mods, th_vars, td_infos, error_admin)
# (dcl_mod, dcl_mods) # (dcl_mod, dcl_mods)
= dcl_mods![mod_index] = dcl_mods![mod_index]
......
...@@ -109,7 +109,6 @@ cConversionTableSize :== 9 // AA ...@@ -109,7 +109,6 @@ cConversionTableSize :== 9 // AA
, dcl_module_kind :: !ModuleKind , dcl_module_kind :: !ModuleKind
// ... RWS // ... RWS
, dcl_imported_module_numbers :: !NumberSet , dcl_imported_module_numbers :: !NumberSet
, dcl_is_cashed :: !Bool
} }
class Erroradmin state class Erroradmin state
......
...@@ -124,7 +124,6 @@ where ...@@ -124,7 +124,6 @@ where
, dcl_module_kind :: !ModuleKind , dcl_module_kind :: !ModuleKind
// ... RWS // ... RWS
, dcl_imported_module_numbers :: !NumberSet , dcl_imported_module_numbers :: !NumberSet
, dcl_is_cashed :: !Bool
} }
class Erroradmin state // PK... class Erroradmin state // PK...
......
...@@ -14,10 +14,11 @@ bitvectToNumberSet :: !LargeBitvect -> .NumberSet ...@@ -14,10 +14,11 @@ bitvectToNumberSet :: !LargeBitvect -> .NumberSet
:: LargeBitvect :== {#Int} :: LargeBitvect :== {#Int}
bitvectCreate :: !Int -> .LargeBitvect
bitvectSelect :: !Int !LargeBitvect -> Bool bitvectSelect :: !Int !LargeBitvect -> Bool
bitvectSet :: !Int !*LargeBitvect -> .LargeBitvect bitvectSet :: !Int !*LargeBitvect -> .LargeBitvect
bitvectReset :: !Int !*LargeBitvect -> .LargeBitvect bitvectReset :: !Int !*LargeBitvect -> .LargeBitvect
bitvectCreate :: !Int -> .LargeBitvect bitvectSetFirstN :: !Int !*LargeBitvect -> .LargeBitvect
bitvectResetAll :: !*LargeBitvect -> .LargeBitvect bitvectResetAll :: !*LargeBitvect -> .LargeBitvect
:: IntKey :== Int :: IntKey :== Int
......
...@@ -127,6 +127,10 @@ BITNUMBER index :== index bitand 31 ...@@ -127,6 +127,10 @@ BITNUMBER index :== index bitand 31
:: LargeBitvect :== {#Int} :: LargeBitvect :== {#Int}
bitvectCreate :: !Int -> .LargeBitvect
bitvectCreate 0 = {}
bitvectCreate n_elements = createArray ((BITINDEX (n_elements-1)+1)) 0
bitvectSelect :: !Int !LargeBitvect -> Bool bitvectSelect :: !Int !LargeBitvect -> Bool
bitvectSelect index a bitvectSelect index a
= a.[BITINDEX index] bitand (1 << BITNUMBER index) <> 0 = a.[BITINDEX index] bitand (1 << BITNUMBER index) <> 0
...@@ -143,9 +147,17 @@ bitvectReset index a ...@@ -143,9 +147,17 @@ bitvectReset index a
a_bit_index = a.[bit_index] a_bit_index = a.[bit_index]
= { a & [bit_index] = a_bit_index bitand (bitnot (1 << BITNUMBER index))} = { a & [bit_index] = a_bit_index bitand (bitnot (1 << BITNUMBER index))}
bitvectCreate :: !Int -> .LargeBitvect bitvectSetFirstN :: !Int !*LargeBitvect -> .LargeBitvect
bitvectCreate 0 = {} bitvectSetFirstN n_bits a
bitvectCreate n_elements = createArray ((BITINDEX (n_elements-1)+1)) 0 = set_bits 0 n_bits a
where
set_bits index n_bits a
| n_bits<=0
= a
| n_bits<32
# (a_index,a) = a![index]
= {a & [index]=a_index bitor (bitnot ((-1)<<n_bits))}
= set_bits (index+1) (n_bits-32) {a & [index]= -1}
bitvectResetAll :: !*LargeBitvect -> .LargeBitvect bitvectResetAll :: !*LargeBitvect -> .LargeBitvect
bitvectResetAll arr bitvectResetAll arr
......
...@@ -3,6 +3,8 @@ implementation module frontend ...@@ -3,6 +3,8 @@ implementation module frontend
import scanner, parse, postparse, check, type, trans, convertcases, overloading, utilities, convertDynamics, import scanner, parse, postparse, check, type, trans, convertcases, overloading, utilities, convertDynamics,
convertimportedtypes, checkKindCorrectness, compilerSwitches, analtypes, generics convertimportedtypes, checkKindCorrectness, compilerSwitches, analtypes, generics
SwitchGenerics on off :== off
:: FrontEndOptions :: FrontEndOptions
= { feo_up_to_phase :: !FrontEndPhase = { feo_up_to_phase :: !FrontEndPhase
, feo_generics :: !Bool , feo_generics :: !Bool
...@@ -77,10 +79,9 @@ frontSyntaxTree cached_functions_and_macros n_functions_and_macros_in_dcl_module ...@@ -77,10 +79,9 @@ frontSyntaxTree cached_functions_and_macros n_functions_and_macros_in_dcl_module
//import StdDebug //import StdDebug
//frontEndInterface :: !FrontEndPhase !Ident !SearchPaths !{#DclModule} !{#FunDef} !(Optional Bool) !*PredefinedSymbols !*HashTable !*Files !*File !*File !*File !*File !*Heaps -> ( !Optional *FrontEndSyntaxTree,!.{# FunDef },!Int,!Int,!*PredefinedSymbols, !*HashTable, !*Files, !*File !*File, !*File, !*File, !*Heaps)
frontEndInterface :: !FrontEndOptions !Ident !SearchPaths !{#DclModule} !{#FunDef} !(Optional Bool) !*PredefinedSymbols !*HashTable !*Files !*File !*File !*File (!Optional !*File) !*Heaps frontEndInterface :: !FrontEndOptions !Ident !SearchPaths !{#DclModule} !{#FunDef} !(Optional Bool) !*PredefinedSymbols !*HashTable !*Files !*File !*File !*File (!Optional !*File) !*Heaps
-> ( !Optional *FrontEndSyntaxTree,!.{# FunDef },!Int,!Int,!*PredefinedSymbols, !*HashTable, !*Files, !*File, !*File, !*File, !Optional !*File, !*Heaps) -> ( !Optional *FrontEndSyntaxTree,!.{# FunDef },!Int,!Int,!*PredefinedSymbols, !*HashTable, !*Files, !*File, !*File, !*File, !Optional !*File, !*Heaps)
frontEndInterface options mod_ident search_paths dcl_modules functions_and_macros list_inferred_types predef_symbols hash_table files error io out tcl_file heaps frontEndInterface options mod_ident search_paths cached_dcl_modules functions_and_macros list_inferred_types predef_symbols hash_table files error io out tcl_file heaps
// # files = trace_n ("Compiling "+++mod_ident.id_name) files // # files = trace_n ("Compiling "+++mod_ident.id_name) files
# (ok, mod, hash_table, error, predef_symbols, files) # (ok, mod, hash_table, error, predef_symbols, files)
...@@ -88,7 +89,7 @@ frontEndInterface options mod_ident search_paths dcl_modules functions_and_macro ...@@ -88,7 +89,7 @@ frontEndInterface options mod_ident search_paths dcl_modules functions_and_macro
| not ok | not ok
= (No,{},0,0,predef_symbols, hash_table, files, error, io, out, tcl_file, heaps) = (No,{},0,0,predef_symbols, hash_table, files, error, io, out, tcl_file, heaps)
# cached_module_idents = [dcl_mod.dcl_name \\ dcl_mod<-:dcl_modules] # cached_module_idents = [dcl_mod.dcl_name \\ dcl_mod<-:cached_dcl_modules]
# (ok, mod, global_fun_range, mod_functions, optional_dcl_mod, modules, dcl_module_n_in_cache,n_functions_and_macros_in_dcl_modules,hash_table, error, predef_symbols, files) # (ok, mod, global_fun_range, mod_functions, optional_dcl_mod, modules, dcl_module_n_in_cache,n_functions_and_macros_in_dcl_modules,hash_table, error, predef_symbols, files)
= scanModule (mod -*-> "Scanning") cached_module_idents (size functions_and_macros) options.feo_generics hash_table error search_paths predef_symbols files = scanModule (mod -*-> "Scanning") cached_module_idents (size functions_and_macros) options.feo_generics hash_table error search_paths predef_symbols files
/* JVG: */ /* JVG: */
...@@ -98,8 +99,9 @@ frontEndInterface options mod_ident search_paths dcl_modules functions_and_macro ...@@ -98,8 +99,9 @@ frontEndInterface options mod_ident search_paths dcl_modules functions_and_macro
| not ok | not ok
= (No,{},0,0,predef_symbols, hash_table, files, error, io, out, tcl_file, heaps) = (No,{},0,0,predef_symbols, hash_table, files, error, io, out, tcl_file, heaps)
# symbol_table = hash_table.hte_symbol_heap # symbol_table = hash_table.hte_symbol_heap
(ok, icl_mod, dcl_mods, components, optional_dcl_icl_conversions,cached_functions_and_macros,main_dcl_module_n,heaps, predef_symbols, symbol_table, error /* TD */, directly_imported_dcl_modules) #! n_cached_dcl_modules=size cached_dcl_modules
= checkModule mod global_fun_range mod_functions n_functions_and_macros_in_dcl_modules dcl_module_n_in_cache optional_dcl_mod modules dcl_modules functions_and_macros predef_symbols (symbol_table -*-> "Checking") error heaps # (ok, icl_mod, dcl_mods, components, optional_dcl_icl_conversions,cached_functions_and_macros,main_dcl_module_n,heaps, predef_symbols, symbol_table, error /* TD */, directly_imported_dcl_modules)
= checkModule mod global_fun_range mod_functions n_functions_and_macros_in_dcl_modules dcl_module_n_in_cache optional_dcl_mod modules cached_dcl_modules functions_and_macros predef_symbols (symbol_table -*-> "Checking") error heaps
hash_table = { hash_table & hte_symbol_heap = symbol_table} hash_table = { hash_table & hte_symbol_heap = symbol_table}
| not ok | not ok
...@@ -110,7 +112,6 @@ frontEndInterface options mod_ident search_paths dcl_modules functions_and_macro ...@@ -110,7 +112,6 @@ frontEndInterface options mod_ident search_paths dcl_modules functions_and_macro
select_and_remove_icl_functions_from_record :: !*IclModule -> (!.{#FunDef},!.IclModule) select_and_remove_icl_functions_from_record :: !*IclModule -> (!.{#FunDef},!.IclModule)
select_and_remove_icl_functions_from_record icl_mod=:{icl_functions} = (icl_functions,{icl_mod & icl_functions={}}) select_and_remove_icl_functions_from_record icl_mod=:{icl_functions} = (icl_functions,{icl_mod & icl_functions={}})
// # {icl_functions,icl_instances,icl_specials,icl_common,icl_import} = icl_mod
# {icl_instances,icl_specials,icl_common,icl_import,icl_name,icl_imported_objects,icl_used_module_numbers} = icl_mod # {icl_instances,icl_specials,icl_common,icl_import,icl_name,icl_imported_objects,icl_used_module_numbers} = icl_mod
/* /*
(_,f,files) = fopen "components" FWriteText files (_,f,files) = fopen "components" FWriteText files
...@@ -134,9 +135,8 @@ frontEndInterface options mod_ident search_paths dcl_modules functions_and_macro ...@@ -134,9 +135,8 @@ frontEndInterface options mod_ident search_paths dcl_modules functions_and_macro
# (ti_common_defs, dcl_mods) = get_common_defs dcl_mods # (ti_common_defs, dcl_mods) = get_common_defs dcl_mods
ti_common_defs = { ti_common_defs & [main_dcl_module_n] = icl_common } ti_common_defs = { ti_common_defs & [main_dcl_module_n] = icl_common }
# (td_infos, type_heaps, error_admin) = analTypeDefs ti_common_defs icl_used_module_numbers type_heaps error_admin # (td_infos, type_heaps, error_admin) = analTypeDefs ti_common_defs icl_used_module_numbers type_heaps error_admin
(fun_defs, dcl_mods, th_vars, td_infos, error_admin) (fun_defs, dcl_mods, th_vars, td_infos, error_admin)
= checkKindCorrectness main_dcl_module_n icl_instances = checkKindCorrectness main_dcl_module_n icl_instances ti_common_defs n_cached_dcl_modules fun_defs dcl_mods type_heaps.th_vars td_infos error_admin
fun_defs ti_common_defs dcl_mods type_heaps.th_vars td_infos error_admin
type_heaps = { type_heaps & th_vars = th_vars } type_heaps = { type_heaps & th_vars = th_vars }
# heaps = { heaps & hp_type_heaps = type_heaps } # heaps = { heaps & hp_type_heaps = type_heaps }
# (saved_main_dcl_common, ti_common_defs) = replace (dcl_common_defs dcl_mods) main_dcl_module_n icl_common # (saved_main_dcl_common, ti_common_defs) = replace (dcl_common_defs dcl_mods) main_dcl_module_n icl_common
...@@ -145,23 +145,17 @@ frontEndInterface options mod_ident search_paths dcl_modules functions_and_macro ...@@ -145,23 +145,17 @@ frontEndInterface options mod_ident search_paths dcl_modules functions_and_macro
dcl_common_defs dcl_mods dcl_common_defs dcl_mods
= {dcl_common \\ {dcl_common} <-: dcl_mods } = {dcl_common \\ {dcl_common} <-: dcl_mods }
#! (components, ti_common_defs, fun_defs, generic_range, td_infos, heaps, hash_table, predef_symbols, dcl_mods, optional_dcl_icl_conversions, error_admin) = #! (components, ti_common_defs, fun_defs, generic_range, td_infos, heaps, hash_table, predef_symbols, dcl_mods, optional_dcl_icl_conversions, error_admin) =
/*
SwitchGenerics SwitchGenerics
(convertGenerics (case options.feo_generics of
components main_dcl_module_n ti_common_defs fun_defs td_infos True ->
heaps hash_table predef_symbols dcl_mods optional_dcl_icl_conversions error_admin) convertGenerics
components main_dcl_module_n ti_common_defs fun_defs td_infos
heaps hash_table predef_symbols dcl_mods optional_dcl_icl_conversions error_admin
False ->
(components, ti_common_defs, fun_defs, {ir_to=0,ir_from=0}, td_infos, heaps, hash_table, predef_symbols, dcl_mods, optional_dcl_icl_conversions, error_admin)
)
(components, ti_common_defs, fun_defs, {ir_to=0,ir_from=0}, td_infos, heaps, hash_table, predef_symbols, dcl_mods, optional_dcl_icl_conversions, error_admin) (components, ti_common_defs, fun_defs, {ir_to=0,ir_from=0}, td_infos, heaps, hash_table, predef_symbols, dcl_mods, optional_dcl_icl_conversions, error_admin)
*/
case options.feo_generics of
True ->
convertGenerics
components main_dcl_module_n ti_common_defs fun_defs td_infos
heaps hash_table predef_symbols dcl_mods optional_dcl_icl_conversions error_admin
False ->
(components, ti_common_defs, fun_defs, {ir_to=0,ir_from=0}, td_infos, heaps, hash_table, predef_symbols, dcl_mods, optional_dcl_icl_conversions, error_admin)
# (icl_common, ti_common_defs) = replace copied_ti_common_defs main_dcl_module_n saved_main_dcl_common # (icl_common, ti_common_defs) = replace copied_ti_common_defs main_dcl_module_n saved_main_dcl_common
with with
copied_ti_common_defs :: !.{#CommonDefs} // needed for Clean 2.0 to disambiguate overloading of replace copied_ti_common_defs :: !.{#CommonDefs} // needed for Clean 2.0 to disambiguate overloading of replace
......
Supports Markdown
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