diff options
author | johnvg | 2001-09-06 15:30:01 +0000 |
---|---|---|
committer | johnvg | 2001-09-06 15:30:01 +0000 |
commit | d27143250ac87f53b0083a3a1cc3fb2190fb0015 (patch) | |
tree | 49d48418e4315d0da58d354ff2074862fff8ddd5 | |
parent | added command line flag to enable generics (diff) |
remove 'dcl_is_cashed'
git-svn-id: https://svn.cs.ru.nl/repos/clean-compiler/trunk@758 1f8540f1-abd5-4d5b-9d24-4c5ce8603e2d
-rw-r--r-- | frontend/check.icl | 3 | ||||
-rw-r--r-- | frontend/checkKindCorrectness.dcl | 6 | ||||
-rw-r--r-- | frontend/checkKindCorrectness.icl | 34 | ||||
-rw-r--r-- | frontend/checksupport.dcl | 1 | ||||
-rw-r--r-- | frontend/checksupport.icl | 1 | ||||
-rw-r--r-- | frontend/containers.dcl | 3 | ||||
-rw-r--r-- | frontend/containers.icl | 18 | ||||
-rw-r--r-- | 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<size dcl_modules) - { dcl_modules.[i] & dcl_is_cashed = True } + dcl_modules.[i] init_new_dcl_modules.[i-size dcl_modules] \\ 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) @@ -2226,7 +2226,6 @@ initialDclModule ({mod_name, mod_defs=mod_defs=:{def_funtypes,def_macros}, mod_t , dcl_module_kind = mod_type // ... RWS , dcl_imported_module_numbers = EndNumbers - , dcl_is_cashed = False } addImportedSymbolsToSymbolTable importing_mod opt_macro_range modules_in_component_set imports_ikh dcl_modules cs diff --git a/frontend/checkKindCorrectness.dcl b/frontend/checkKindCorrectness.dcl index 26ebb28..72ee63e 100644 --- a/frontend/checkKindCorrectness.dcl +++ b/frontend/checkKindCorrectness.dcl @@ -1,6 +1,6 @@ definition module checkKindCorrectness -import syntax, checksupport, containers +import syntax, checksupport -checkKindCorrectness :: !Index IndexRange !u:{# FunDef} !{#CommonDefs} !*{#DclModule} !*TypeVarHeap !*TypeDefInfos !*ErrorAdmin - -> (!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<n_cached_dcl_modules) state (check_classes mod_index state)) 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 = foldrArraySt (check_class icl_common_defs.com_member_defs) icl_common_defs.com_class_defs ([], th_vars, td_infos, error_admin) - bv_uninitialized_mods - = {el\\el<-:bv_cashed_modules} + bv_uninitialized_mods = bitvectSetFirstN n_cached_dcl_modules (bitvectCreate size_dcl_mods) (bv_uninitialized_mods, th_vars, td_infos, error_admin) = iFoldSt (\mod_index state - -> if (bitvectSelect mod_index bv_cashed_modules) + -> if (mod_index<n_cached_dcl_modules) state (check_instances_and_class_and_member_contexts common_defs common_defs.[mod_index] state)) @@ -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 (dcl_mods, bv_uninitialized_mods, th_vars, td_infos, error_admin) = 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 (check_dcl_functions common_defs mod_index state)) 0 size_dcl_mods (dcl_mods, bv_uninitialized_mods, th_vars, td_infos, error_admin) = (fun_defs, dcl_mods, th_vars, td_infos, error_admin) 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) # (dcl_mod, dcl_mods) = dcl_mods![mod_index] diff --git a/frontend/checksupport.dcl b/frontend/checksupport.dcl index a5fa34c..76e10ee 100644 --- a/frontend/checksupport.dcl +++ b/frontend/checksupport.dcl @@ -109,7 +109,6 @@ cConversionTableSize :== 9 // AA , dcl_module_kind :: !ModuleKind // ... RWS , dcl_imported_module_numbers :: !NumberSet - , dcl_is_cashed :: !Bool } class Erroradmin state diff --git a/frontend/checksupport.icl b/frontend/checksupport.icl index 90e8880..3824d6f 100644 --- a/frontend/checksupport.icl +++ b/frontend/checksupport.icl @@ -124,7 +124,6 @@ where , dcl_module_kind :: !ModuleKind // ... RWS , dcl_imported_module_numbers :: !NumberSet - , dcl_is_cashed :: !Bool } class Erroradmin state // PK... diff --git a/frontend/containers.dcl b/frontend/containers.dcl index 3156ae8..abb6752 100644 --- a/frontend/containers.dcl +++ b/frontend/containers.dcl @@ -14,10 +14,11 @@ bitvectToNumberSet :: !LargeBitvect -> .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)<<n_bits))} + = set_bits (index+1) (n_bits-32) {a & [index]= -1} bitvectResetAll :: !*LargeBitvect -> .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 |