From d27143250ac87f53b0083a3a1cc3fb2190fb0015 Mon Sep 17 00:00:00 2001 From: johnvg Date: Thu, 6 Sep 2001 15:30:01 +0000 Subject: remove 'dcl_is_cashed' git-svn-id: https://svn.cs.ru.nl/repos/clean-compiler/trunk@758 1f8540f1-abd5-4d5b-9d24-4c5ce8603e2d --- frontend/check.icl | 3 +-- frontend/checkKindCorrectness.dcl | 6 +++--- frontend/checkKindCorrectness.icl | 34 +++++++++++---------------------- frontend/checksupport.dcl | 1 - frontend/checksupport.icl | 1 - frontend/containers.dcl | 3 ++- frontend/containers.icl | 18 +++++++++++++++--- frontend/frontend.icl | 40 +++++++++++++++++---------------------- 8 files changed, 49 insertions(+), 57 deletions(-) diff --git a/frontend/check.icl b/frontend/check.icl index a85f158..3bbd300 100644 --- a/frontend/check.icl +++ b/frontend/check.icl @@ -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_dcl_modules = { if (i (!u:{# FunDef}, !*{#DclModule}, !*TypeVarHeap, !*TypeDefInfos, !*ErrorAdmin) +checkKindCorrectness :: !Index IndexRange !{#CommonDefs} !Int !u:{# FunDef} !*{#DclModule} !*TypeVarHeap !*TypeDefInfos !*ErrorAdmin + -> (!u:{# FunDef}, !*{#DclModule}, !*TypeVarHeap, !*TypeDefInfos, !*ErrorAdmin) diff --git a/frontend/checkKindCorrectness.icl b/frontend/checkKindCorrectness.icl index 8516eb3..a11d692 100644 --- a/frontend/checkKindCorrectness.icl +++ b/frontend/checkKindCorrectness.icl @@ -3,22 +3,16 @@ implementation module checkKindCorrectness import StdEnv import syntax, containers, checksupport, utilities -// import RWSDebug +//import RWSDebug -checkKindCorrectness :: !Index IndexRange !u:{# FunDef} !{#CommonDefs} !*{#DclModule} !*TypeVarHeap !*TypeDefInfos !*ErrorAdmin - -> (!u:{# FunDef}, !*{#DclModule}, !*TypeVarHeap, !*TypeDefInfos, !*ErrorAdmin) -checkKindCorrectness main_dcl_module_n icl_instances fun_defs common_defs - dcl_mods th_vars td_infos error_admin - #! n_fun_defs - = size fun_defs - 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) +checkKindCorrectness :: !Index IndexRange !{#CommonDefs} !Int !u:{# FunDef} !*{#DclModule} !*TypeVarHeap !*TypeDefInfos !*ErrorAdmin + -> (!u:{# FunDef}, !*{#DclModule}, !*TypeVarHeap, !*TypeDefInfos, !*ErrorAdmin) +checkKindCorrectness main_dcl_module_n icl_instances common_defs n_cached_dcl_modules fun_defs dcl_mods th_vars td_infos error_admin + #! n_fun_defs = size fun_defs + size_dcl_mods = size dcl_mods + # (dcl_mods, th_vars, td_infos, error_admin) = iFoldSt (\mod_index state - -> if (bitvectSelect mod_index bv_cashed_modules) + -> if (mod_index if (bitvectSelect mod_index bv_cashed_modules) + -> if (mod_index if (bitvectSelect mod_index bv_cashed_modules || mod_index==main_dcl_module_n) + -> if (mod_index .NumberSet :: LargeBitvect :== {#Int} +bitvectCreate :: !Int -> .LargeBitvect bitvectSelect :: !Int !LargeBitvect -> Bool bitvectSet :: !Int !*LargeBitvect -> .LargeBitvect bitvectReset :: !Int !*LargeBitvect -> .LargeBitvect -bitvectCreate :: !Int -> .LargeBitvect +bitvectSetFirstN :: !Int !*LargeBitvect -> .LargeBitvect bitvectResetAll :: !*LargeBitvect -> .LargeBitvect :: IntKey :== Int diff --git a/frontend/containers.icl b/frontend/containers.icl index 1056c3f..13f0fe1 100644 --- a/frontend/containers.icl +++ b/frontend/containers.icl @@ -127,6 +127,10 @@ BITNUMBER index :== index bitand 31 :: LargeBitvect :== {#Int} +bitvectCreate :: !Int -> .LargeBitvect +bitvectCreate 0 = {} +bitvectCreate n_elements = createArray ((BITINDEX (n_elements-1)+1)) 0 + bitvectSelect :: !Int !LargeBitvect -> Bool bitvectSelect index a = a.[BITINDEX index] bitand (1 << BITNUMBER index) <> 0 @@ -143,9 +147,17 @@ bitvectReset index a a_bit_index = a.[bit_index] = { a & [bit_index] = a_bit_index bitand (bitnot (1 << BITNUMBER index))} -bitvectCreate :: !Int -> .LargeBitvect -bitvectCreate 0 = {} -bitvectCreate n_elements = createArray ((BITINDEX (n_elements-1)+1)) 0 +bitvectSetFirstN :: !Int !*LargeBitvect -> .LargeBitvect +bitvectSetFirstN n_bits a + = 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)< .LargeBitvect bitvectResetAll arr diff --git a/frontend/frontend.icl b/frontend/frontend.icl index 32815ff..67ebfc3 100644 --- a/frontend/frontend.icl +++ b/frontend/frontend.icl @@ -3,6 +3,8 @@ implementation module frontend import scanner, parse, postparse, check, type, trans, convertcases, overloading, utilities, convertDynamics, convertimportedtypes, checkKindCorrectness, compilerSwitches, analtypes, generics +SwitchGenerics on off :== off + :: FrontEndOptions = { feo_up_to_phase :: !FrontEndPhase , feo_generics :: !Bool @@ -77,10 +79,9 @@ frontSyntaxTree cached_functions_and_macros n_functions_and_macros_in_dcl_module //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 -> ( !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 # (ok, mod, hash_table, error, predef_symbols, files) @@ -88,7 +89,7 @@ frontEndInterface options mod_ident search_paths dcl_modules functions_and_macro | not ok = (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) = scanModule (mod -*-> "Scanning") cached_module_idents (size functions_and_macros) options.feo_generics hash_table error search_paths predef_symbols files /* JVG: */ @@ -98,8 +99,9 @@ frontEndInterface options mod_ident search_paths dcl_modules functions_and_macro | not ok = (No,{},0,0,predef_symbols, hash_table, files, error, io, out, tcl_file, heaps) # 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) - = 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 + #! n_cached_dcl_modules=size cached_dcl_modules + # (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} | not ok @@ -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 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 /* (_,f,files) = fopen "components" FWriteText files @@ -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 = { 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 - (fun_defs, dcl_mods, th_vars, td_infos, error_admin) - = checkKindCorrectness main_dcl_module_n icl_instances - fun_defs ti_common_defs dcl_mods type_heaps.th_vars td_infos error_admin + (fun_defs, dcl_mods, th_vars, td_infos, error_admin) + = 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 type_heaps = { type_heaps & th_vars = th_vars } # 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 @@ -145,23 +145,17 @@ frontEndInterface options mod_ident search_paths dcl_modules functions_and_macro dcl_common_defs 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) = -/* SwitchGenerics - (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) + (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) + ) (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 with copied_ti_common_defs :: !.{#CommonDefs} // needed for Clean 2.0 to disambiguate overloading of replace -- cgit v1.2.3