PIPS
Pipsdbm

Macros

#define DB_PUT_MEMORY_RESOURCE(res_name, own_name, res_val)    db_put_or_update_memory_resource(res_name, own_name, (void*) res_val, true)
 conform to old interface. More...
 
#define DB_PUT_FILE_RESOURCE   DB_PUT_MEMORY_RESOURCE
 Put a file resource into the current workspace database. More...
 
#define DB_PUT_NEW_FILE_RESOURCE(res_name, own_name, res_val)    db_put_or_update_memory_resource(res_name, own_name, (void*) res_val, false)
 Put a new file resource into the current workspace database. More...
 
#define DB_PUT_MEMORY_RESOURCE(res_name, own_name, res_val)    db_put_or_update_memory_resource(res_name, own_name, (void*) res_val, true)
 conform to old interface. More...
 
#define DB_PUT_FILE_RESOURCE   DB_PUT_MEMORY_RESOURCE
 Put a file resource into the current workspace database. More...
 
#define DB_PUT_NEW_FILE_RESOURCE(res_name, own_name, res_val)    db_put_or_update_memory_resource(res_name, own_name, (void*) res_val, false)
 Put a new file resource into the current workspace database. More...
 

Functions

string db_get_memory_resource (const char *rname, const char *oname, bool pure)
 Return the pointer to the resource, whatever it is. More...
 
void db_put_or_update_memory_resource (const char *rname, const char *oname, void *p, bool update_is_ok)
 Put a resource into the current workspace database. More...
 
bool db_module_exists_p (const char *name)
 Return whether name is a "valid" module. More...
 
static gen_array_t db_get_module_or_function_list (bool module_p, bool func_p)
 Returns an allocated array a with the sorted list of modules. More...
 
gen_array_t db_get_module_list (void)
 Get an array of all the modules (functions, procedures and compilation units) of a workspace. More...
 
gen_array_t db_get_function_list (void)
 Get an array of all the functions and procedures (not compilation units) of a workspace. More...
 
gen_array_t db_get_compilation_unit_list (void)
 Get an array of all the compilation units of a workspace. More...
 

Detailed Description

Macro Definition Documentation

◆ DB_PUT_FILE_RESOURCE [1/2]

#define DB_PUT_FILE_RESOURCE   DB_PUT_MEMORY_RESOURCE

Put a file resource into the current workspace database.

This function allows to update a file resource already available.

Parameters
rnameis a resource name, such as DBR_CODE for the code of a module. The construction of these aliases are DBB_ + the uppercased name of a resource defined in pipsmake-rc.tex. They are defined automatically in include/resources.h
onameis the resource owner name, typically a module name.
res_valis an opaque pointer to the resource to be stored. Methods defined in methods.h will know how to deal with.

Definition at line 85 of file pipsdbm-local.h.

◆ DB_PUT_FILE_RESOURCE [2/2]

#define DB_PUT_FILE_RESOURCE   DB_PUT_MEMORY_RESOURCE

Put a file resource into the current workspace database.

This function allows to update a file resource already available.

Parameters
rnameis a resource name, such as DBR_CODE for the code of a module. The construction of these aliases are DBB_ + the uppercased name of a resource defined in pipsmake-rc.tex. They are defined automatically in include/resources.h
onameis the resource owner name, typically a module name.
res_valis an opaque pointer to the resource to be stored. Methods defined in methods.h will know how to deal with.

Definition at line 93 of file pipsdbm.h.

◆ DB_PUT_MEMORY_RESOURCE [1/2]

#define DB_PUT_MEMORY_RESOURCE (   res_name,
  own_name,
  res_val 
)     db_put_or_update_memory_resource(res_name, own_name, (void*) res_val, true)

conform to old interface.

Put a memory resource into the current workspace database

This function allows to update a memory resource already available.

Parameters
rnameis a resource name, such as DBR_CODE for the code of a module. The construction of these aliases are DBB_ + the uppercased name of a resource defined in pipsmake-rc.tex. They are defined automatically in include/resources.h
onameis the resource owner name, typically a module name.
res_valis an opaque pointer to the resource to be stored. Methods defined in methods.h will know how to deal with.

Definition at line 66 of file pipsdbm-local.h.

◆ DB_PUT_MEMORY_RESOURCE [2/2]

#define DB_PUT_MEMORY_RESOURCE (   res_name,
  own_name,
  res_val 
)     db_put_or_update_memory_resource(res_name, own_name, (void*) res_val, true)

conform to old interface.

Put a memory resource into the current workspace database

This function allows to update a memory resource already available.

Parameters
rnameis a resource name, such as DBR_CODE for the code of a module. The construction of these aliases are DBB_ + the uppercased name of a resource defined in pipsmake-rc.tex. They are defined automatically in include/resources.h
onameis the resource owner name, typically a module name.
res_valis an opaque pointer to the resource to be stored. Methods defined in methods.h will know how to deal with.

Definition at line 74 of file pipsdbm.h.

◆ DB_PUT_NEW_FILE_RESOURCE [1/2]

#define DB_PUT_NEW_FILE_RESOURCE (   res_name,
  own_name,
  res_val 
)     db_put_or_update_memory_resource(res_name, own_name, (void*) res_val, false)

Put a new file resource into the current workspace database.

This function disallows to update a resource already available.

Parameters
rnameis a resource name, such as DBR_CODE for the code of a module. The construction of these aliases are DBB_ + the uppercased name of a resource defined in pipsmake-rc.tex. They are defined automatically in include/resources.h
onameis the resource owner name, typically a module name.
res_valis an opaque pointer to the resource to be stored. Methods defined in methods.h will know how to deal with.

Definition at line 103 of file pipsdbm-local.h.

◆ DB_PUT_NEW_FILE_RESOURCE [2/2]

#define DB_PUT_NEW_FILE_RESOURCE (   res_name,
  own_name,
  res_val 
)     db_put_or_update_memory_resource(res_name, own_name, (void*) res_val, false)

Put a new file resource into the current workspace database.

This function disallows to update a resource already available.

Parameters
rnameis a resource name, such as DBR_CODE for the code of a module. The construction of these aliases are DBB_ + the uppercased name of a resource defined in pipsmake-rc.tex. They are defined automatically in include/resources.h
onameis the resource owner name, typically a module name.
res_valis an opaque pointer to the resource to be stored. Methods defined in methods.h will know how to deal with.

Definition at line 111 of file pipsdbm.h.

Function Documentation

◆ db_get_compilation_unit_list()

gen_array_t db_get_compilation_unit_list ( void  )

Get an array of all the compilation units of a workspace.

Returns
an array of sorted strdup()ed strings.

Definition at line 1287 of file database.c.

1288 {
1289  return db_get_module_or_function_list(false, false);
1290 }
static gen_array_t db_get_module_or_function_list(bool module_p, bool func_p)
Returns an allocated array a with the sorted list of modules.
Definition: database.c:1231

References db_get_module_or_function_list().

+ Here is the call graph for this function:

◆ db_get_function_list()

gen_array_t db_get_function_list ( void  )

Get an array of all the functions and procedures (not compilation units) of a workspace.

Returns
an array of sorted strdup()ed strings.

Definition at line 1277 of file database.c.

1278 {
1279  return db_get_module_or_function_list(false, true);
1280 }

References db_get_module_or_function_list().

+ Here is the call graph for this function:

◆ db_get_memory_resource()

string db_get_memory_resource ( const char *  rname,
const char *  oname,
bool  pure 
)

Return the pointer to the resource, whatever it is.

Assume that the resource is available.

Parameters
rnameis a resource name, such as DBR_CODE for the code of a module. The construction of these aliases are DBB_ + the uppercased name of a resource defined in pipsmake-rc.tex. They are defined automatically in include/resources.h
onameis the resource owner name, typically a module name.
pureis used to declare the programmer intentions about the future of the resource.
  • If pure is true, the real resource is given as usual. If the programmer use it in a read-only way, this is fine and the good way to go. If it is modified by the programmer in a phase, all subsequent phases that use this resource will access a modified resource in an unnoticed way and use other resources that will be out-of-sync because unnoticed by pipsmake. So in this case, the programmer is assumed to put back the modified in the database later to notify pipsmake.
  • If pure is false, then the resource is saved on disk and/or marked as outdated before being returned. The idea is that we can modify and use this resource as we want in a phase, it is a throwable resource. Next time someone will want to use this resource, it will be read back from disk or recomputed and nobody will seen it has been changed by the first phase. The idea here is to behave as if db_get_memory_resource() return a copy, so you are responsible of its future (garbage collecting for example if you do not want it any longer).

    This feature has been introduced in a time when gen_copy() did not exist to duplicate resources and using persistence as a way to get a copy was a sensible trick. But now we have gen_copy(), it is far more efficient to use it instead of writing it to disk and parsing it again or recomputing it. So in all new phases developed in PIPS, pure should be always true and gen_copy() should be used when necessary.

Returns
an opaque pointer to the resource in memory.

else we have something.

does it unlink the file?

Save if possible to hide side effects.

the pointer is there...

make as stored now...

Mark the resource as lost so next time it will be required, pipsmake will recompute it for example:

Parameters
rnamename
onamename
pureure

Definition at line 755 of file database.c.

756 {
757  db_resource r;
758  void * result;
759  DB_OK;
760 
761  debug_on("PIPSDBM_DEBUG_LEVEL");
762  pips_debug(2, "get %s[%s] (%s)\n", rname, oname, pure? "pure": "not pure");
763 
764  r = get_db_resource(rname, oname);
765  debug_db_resource(9, rname, oname, r);
767  pips_internal_error("requested resource \"%s\" for module \"%s\" not available\n",
768  rname, oname);
769  /* else we have something. */
770 
771  if (db_resource_stored_p(r))
772  db_load_resource(rname, oname, r); /* does it unlink the file? */
773 
774  result = db_resource_pointer(r);
775 
776  if (!pure)
777  {
778  /* Save if possible to hide side effects. */
779  if (dbll_storable_p(rname)) {
780  db_save_resource(rname, oname, r); /* the pointer is there... */
781  /* make as stored now... */
782  db_resource_pointer(r) = NULL;
784  } else
785  /* Mark the resource as lost so next time it will be required,
786  pipsmake will recompute it for example: */
787  db_delete_resource(rname, oname);
788  }
789 
790  ifdebug(7)
791  pips_assert("resource is consistent",
792  dbll_check_resource(rname, oname, result));
793  debug_off();
794  return result;
795 }
static db_resource get_db_resource(const char *rname, const char *oname)
Definition: database.c:247
#define db_resource_required_p(r)
Definition: database.c:54
#define db_resource_stored_p(r)
shorthands
Definition: database.c:52
static void db_load_resource(const char *rname, const char *oname, db_resource r)
Definition: database.c:587
static void db_save_resource(const char *rname, const char *oname, db_resource r)
Definition: database.c:627
#define DB_OK
the pips_database stores pips resources.
Definition: database.c:104
void db_delete_resource(const char *rname, const char *oname)
Delete a resource.
Definition: database.c:353
#define debug_db_resource(l, r, o, p)
Definition: database.c:221
bool dbll_check_resource(const char *rname, const char *oname, void *p)
Internal consistency of the resource, not the global consistency wrt other resources and pipsmake rul...
Definition: lowlevel.c:324
bool dbll_storable_p(const char *rname)
Definition: lowlevel.c:341
#define debug_on(env)
Definition: misc-local.h:157
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
Definition: misc-local.h:145
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
Definition: misc-local.h:172
#define pips_internal_error
Definition: misc-local.h:149
#define debug_off()
Definition: misc-local.h:160
#define db_resource_db_status(x)
#define db_resource_pointer(x)
#define db_status_tag(x)
@ is_db_status_stored
#define db_resource_undefined_p(x)
return(s1)
#define ifdebug(n)
Definition: sg.c:47

References db_delete_resource(), db_load_resource(), DB_OK, db_resource_db_status, db_resource_pointer, db_resource_required_p, db_resource_stored_p, db_resource_undefined_p, db_save_resource(), db_status_tag, dbll_check_resource(), dbll_storable_p(), debug_db_resource, debug_off, debug_on, get_db_resource(), ifdebug, is_db_status_stored, pips_assert, pips_debug, and pips_internal_error.

Referenced by actual_c_parser(), add_alias_lists_callee(), add_alias_lists_callees(), add_alias_pairs_for_this_caller(), add_aliases_for_current_call_site(), add_aliases_for_current_caller(), add_classes_callees(), add_classes_for_this_callee(), add_common_variables_to_hash_table(), add_control_counters(), AddEntityToCompilationUnit(), alias_check(), alias_check_two_variables(), alias_classes(), alias_lists(), alias_pairs(), alias_propagation(), aliases_text(), any_complexities(), array_bound_check_bottom_up(), array_bound_check_interprocedural(), array_bound_check_top_down(), array_dfg(), array_expansion(), atomizer(), bdsc_code_instrumentation(), build_real_resources(), call_site_to_module_precondition_text(), callers_to_statements(), callgraph(), callgraph_module_name(), chains(), check_call_mode_consistency(), check_tiling_legality(), clean_declarations(), clean_labels(), clear_pragma(), comEngine_distribute(), common_is_visible_p(), comp_regions(), compilation_unit_of_module(), compile_body(), computation_intensity(), continuation_conditions(), controlize_distribution(), controlizer(), copy_value_of_write(), copy_value_of_write_with_cumulated_regions(), create_HRE_module(), cumulated_reductions(), db_checkpoint_workspace(), db_get_in_simple_pv(), db_get_initial_simple_pv(), db_get_out_simple_pv(), db_get_program_simple_pv(), db_get_simple_pv(), db_open_workspace(), deatomizer(), delay_communications(), delay_communications_init(), delay_communications_interprocedurally(), delay_load_communications(), delay_store_communications(), do_check_isolate_statement_preconditions_on_call(), do_inlining(), do_it(), do_kernelize(), do_linearize_array_manage_callers(), do_unfolding(), dowhile_to_while(), dsc_code_parallelization(), eliminate_original_variables(), expression_substitution(), fetch_callees_complexities(), filter_file(), filter_proper_effects(), find_code_status(), flag_as_stub(), flag_kernel(), flag_loops(), flatten_code(), flinter(), for_loop_to_do_loop(), for_loop_to_while_loop(), formal_array_resizing_bottom_up(), formal_variable_add_aliases(), forward_substitute(), freia_compiler(), freia_remove_scalar_ww_deps(), freia_unroll_while(), fsm_generation(), fsm_merge_states(), fsm_split_state(), full_control_graph(), full_fsm_generation(), full_spaghettify(), full_unroll(), full_unroll_pragma(), gen_multi_recurse_explorer(), generate_starpu_pragma(), generate_two_addresses_code(), generic_module_initial_pointer_values(), generic_module_name_to_transformers(), generic_module_pointer_values(), generic_points_to_analysis(), generic_print_code_pv(), generic_print_xml_application(), get_any_comp_regions_text(), get_callees(), get_callers(), get_continuation_condition_text(), get_loop_execution_parallel(), get_module_precondition(), get_semantic_text(), get_stubs(), global_parallelization(), gpu_ify(), gpu_ify_statement(), gpu_memory(), gpu_promote_sequential(), gpu_qualify_pointers(), gpu_xml_dump(), group_constants(), guard_elimination(), hbdsc_parallelization(), hpfc_directives_handler(), html_prettyprint(), icm_codegen(), if_conversion(), if_conversion_compact(), if_conversion_init(), ikernel_load_store(), impact_check(), impact_check_two_variables(), in_alias_pairs(), in_regions_of_external(), init_convex_in_out_regions(), init_convex_rw_regions(), init_convex_summary_in_out_regions(), init_convex_summary_rw_regions(), init_use_preconditions(), init_use_proper_effects(), initial_points_to(), initial_precondition(), initialize_global_variables(), inline_calls(), insert_check_alias_before_statement(), insert_flag_before_call_site(), insert_test_before_caller(), insert_test_before_statement(), instruction_selection(), instruction_to_wp65_code(), interactive_loop_transformation(), interprocedural_mapping(), invariant_code_motion(), is_a_kernel(), isolate_statement(), just_show(), kernel_data_mapping(), kernel_load_store_engine(), kernelize(), language_module_p(), linearize_array_generic(), live_in_summary_paths_engine(), live_out_paths_from_caller_to_callee(), live_out_region_engine(), live_out_summary_paths_engine(), live_paths_engine(), load_body_effects(), load_hpfc_status(), load_step_comm(), load_summary_effects(), load_summary_precondition(), load_summary_reductions(), load_summary_total_postcondition(), load_summary_transformer(), loop_auto_unroll(), loop_expansion(), loop_expansion_init(), loop_nest_unswitching(), loop_pragma(), loop_statistics(), main(), main_summary_precondition(), make_start_ru_module(), module_entity_to_compilation_unit_entity(), module_is_called_by_main_program_p(), module_loops(), module_name_to_callees(), module_name_to_input_file_name(), module_name_to_preconditions(), module_name_to_total_preconditions(), module_to_all_declarations(), module_to_value_mappings(), mpi_conversion(), mpi_task_generation(), new_atomizer(), new_controlizer(), node(), normalize_microcode(), normalize_microcode_anotate(), old__gpu_ify(), old_array_bound_check_instrumentation(), old_reductions(), old_summary_precondition(), omp_loop_parallel_threshold_set(), one_thread_parallelize(), openmp_task_generation(), optimize_expressions(), ordinary_summary_precondition(), out_alias_pairs(), out_regions_from_caller_to_callee(), outline(), outliner_independent(), outliner_independent_recursively(), partial_eval(), perform_icm_association(), phrase_comEngine_distributor(), phrase_distributor(), phrase_distributor_control_code(), phrase_distributor_init(), phrase_remove_dependences(), pipsdbm_read_statement_function(), pipsdbm_read_statement_mapping(), pocc_prettyprinter(), pragma_outliner(), preconditions_inter_full_with_points_to(), prgm_mapping(), print_any_reductions(), print_array_dfg(), print_bdt(), print_c_code(), print_code_or_source(), print_code_or_source_comp(), print_code_points_to(), print_code_smalltalk(), print_code_static_control(), print_crough(), print_dependence_or_chains_graph(), print_dot_dependence_or_chains_graph(), print_filtered_dg_or_dvdg(), print_initial_precondition(), print_interface(), print_loopnest_dependence_cone(), print_loops(), print_module_icfg(), print_parallelized_code_common(), print_parallelizedCMF_code(), print_parallelizedCRAFT_code(), print_plc(), print_program_precondition(), print_xml_application_main_with_points_to(), print_xml_application_with_points_to(), print_xml_code(), print_xml_code_with_explicit_motif(), process_reduced_loops(), process_user_file(), ProcessEntry(), program_points_to(), program_precondition(), proper_reductions(), recompile_module(), recursive_append(), reduction_atomization(), reduction_detection(), reduction_propagation(), redundant_load_store_elimination(), refine_transformers_with_points_to(), regions_of_external(), regions_to_loops(), reindexing(), remove_common_variables_from_hash_table(), remove_simple_scalar_pointers(), RemoveEntityFromCompilationUnit(), rename_operator(), restructure_control(), rice_dependence_graph(), rstream_interface(), run_inlining(), safescale_distributor(), safescale_distributor_init(), safescale_module_analysis(), scalar_renaming(), scalopify(), scalopragma(), scheduling(), sequence_dependence_graph(), sesam_buffers_processing(), sesamify(), set_effects(), set_loop_execution_parallel(), set_pattern(), set_resources_for_module(), show(), simd_atomizer(), simd_memory_packing(), simd_remove_reductions(), simd_unroll_as_needed(), simdizer(), simdizer_auto_tile(), simdizer_auto_unroll(), simdizer_init(), simplify_complex(), simplify_constant_address_expressions(), simplify_subscripts(), single_assign(), solve_hardware_constraints(), sort_parameters(), spaghettify(), spear_log_alist(), spire_distributed_unstructured_to_structured(), spire_shared_unstructured_to_structured(), split_initializations(), split_structures(), split_update_operator(), statement_insertion(), statement_insertion_fix_access_in_callers(), static_controlize(), step_analyse(), step_analyse_CHAINS_DG(), step_compile_analysed_module(), step_compile_generated_module(), step_directives_init(), step_install(), step_parser(), step_translate_and_map_step_regions(), storage_formal_offset(), store_step_comm(), string_to_callees(), strip_mine(), summary_complexity(), summary_precondition(), summary_reductions(), summary_total_postcondition(), symbolic_tiling(), task_mapping(), taskify(), terapix_remove_divide(), terapix_warmup(), text_summary_complexity(), tiling_sequence(), transformers_inter_full_with_points_to(), type_checker(), unroll(), unspaghettify(), update_precondition_with_call_site_preconditions(), update_summary_precondition(), used_before_set(), user_call_to_points_to_fast_interprocedural(), user_call_to_points_to_interprocedural(), user_call_to_points_to_interprocedural_binding_set(), variable_replication(), verify_formal_and_common_variables(), wp65(), wrap_kernel_argument(), xml_Chains(), and xml_Task().

+ Here is the call graph for this function:

◆ db_get_module_list()

◆ db_get_module_or_function_list()

static gen_array_t db_get_module_or_function_list ( bool  module_p,
bool  func_p 
)
static

Returns an allocated array a with the sorted list of modules.

strings are duplicated.

Compilation units were not added because Fabien Coelho wanted to avoid them in validation files: they do depend on include files varying from machine to machine. Another reason to avoid them could be that they are not real module with a signature and code. However, the semantics of tpips ALL does include them. It's up to the validation designer to avoid including varying stuff in test files. Another possibility would be to regenerate include statements...

Parameters
module_pis used to select all modules, functions and compilation units too. If true, compilation units are included as well as functions.
func_pis used to obtain either functions or compilation units. It is only active if module_p is set to false.

the environment variable PIPS_IGNORE_FUNCTION_RX helps filtering out functions, typically static inlined functions added by some "standard" header files.

Definition at line 1231 of file database.c.

1232 {
1233  gen_array_t a = gen_array_make(0);
1234  string ignore_rx = getenv(IGNORE_RX);
1235  regex_t ignore;
1236 
1237  DB_OK;
1238 
1239  if (ignore_rx && regcomp(&ignore, ignore_rx, 0))
1240  pips_user_error("recomp failed for \"%s\"", ignore_rx);
1241 
1242  DB_RESOURCES_FOREACH(os, or, get_pips_database())
1243  {
1244  string on = db_symbol_name(os);
1245  pips_assert("some symbol name", on);
1246  pips_debug(9, "considering %s -> %p\n", on, or);
1247  bool cu_p = compilation_unit_p(on);
1248  if (!same_string_p(on, "")
1249  && (module_p || (func_p && !cu_p) || (!func_p && cu_p))
1250  && (!ignore_rx || regexec(&ignore, on, 0, NULL, 0)))
1251  gen_array_dupappend(a, on);
1252  }
1253 
1254  gen_array_sort(a);
1255  if (ignore_rx)
1256  regfree(&ignore);
1257  return a;
1258 }
#define IGNORE_RX
Definition: database.c:46
gen_array_t gen_array_make(size_t size)
declarations...
Definition: array.c:40
void gen_array_sort(gen_array_t a)
Definition: array.c:164
void gen_array_dupappend(gen_array_t a, void *what)
Definition: array.c:117
bool compilation_unit_p(const char *module_name)
The names of PIPS entities carry information about their nature.
Definition: entity_names.c:56
#define pips_user_error
Definition: misc-local.h:147
#define same_string_p(s1, s2)
#define db_symbol_name(x)
#define DB_RESOURCES_FOREACH(k, v, f)

References compilation_unit_p(), DB_OK, DB_RESOURCES_FOREACH, db_symbol_name, gen_array_dupappend(), gen_array_make(), gen_array_sort(), IGNORE_RX, pips_assert, pips_debug, pips_user_error, and same_string_p.

Referenced by db_get_compilation_unit_list(), db_get_function_list(), and db_get_module_list().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ db_module_exists_p()

bool db_module_exists_p ( const char *  name)

Return whether name is a "valid" module.

As FI points out to me (FC), it just means that the name has been used by some-one, some-where, some-time...

It just checks that an non empty resource table is associated to this name. The table may be created when resources are marked as required by pipsmake, and is never destroyed?

Parameters
nameame

Definition at line 1129 of file database.c.

1130 {
1131  bool ok = false;
1132 
1133  if (!pips_database_undefined_p()) // some database?
1134  {
1136  if (!db_symbol_undefined_p(s)) // some symbol?
1137  {
1138  db_resources dbr = get_pips_database();
1139  if (bound_db_resources_p(dbr, s)) // some resource table?
1140  {
1142  // some actual resource?
1144  }
1145  }
1146  }
1147 
1148  return ok;
1149 }
db_owned_resources apply_db_resources(db_resources f, db_symbol k)
bool bound_db_resources_p(db_resources f, db_symbol k)
int hash_table_entry_count(hash_table htp)
now we define observers in order to hide the hash_table type...
Definition: hash.c:818
void * gen_find_tabulated(const char *, int)
Definition: tabulated.c:218
#define db_symbol_undefined_p(x)
#define db_symbol_domain
newgen_db_status_domain_defined
#define db_owned_resources_hash_table(x)
static bool ok

References apply_db_resources(), bound_db_resources_p(), db_owned_resources_hash_table, db_symbol_domain, db_symbol_undefined_p, gen_find_tabulated(), hash_table_entry_count(), and ok.

Referenced by open_module().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ db_put_or_update_memory_resource()

void db_put_or_update_memory_resource ( const char *  rname,
const char *  oname,
void *  p,
bool  update_is_ok 
)

Put a resource into the current workspace database.

Parameters
rnameis a resource name, such as DBR_CODE for the code of a module. The construction of these aliases are DBB_ + the uppercased name of a resource defined in pipsmake-rc.tex. They are defined automatically in include/resources.h
onameis the resource owner name, typically a module name.
pis an opaque pointer to the resource to be stored. Methods defined in methods.h will know how to deal with.
update_is_okis a parameter to allow updating a resource.
  • If false and a resource is valid and not marked as required, this function will fail
  • If true, even if a resource is valid and not marked as required, this function will succeed to update it.

Check the database coherency:

Get the database resource associated to the given resource:

The resource does not exist: it was just created, so mark it as loaded into memory:

The resource already exists...

If the resource is not required and we do not want to update it:

Store data

< ??? memory leak? depends?

Mark the resource as loaded into memory:

Timestamp the resource with the current logical time:

If there is a text file associated to the resource, get its modification time:

< Or what else?

Parameters
rnamename
onamename
update_is_okpdate_is_ok

Definition at line 854 of file database.c.

855  {
856  db_resource r;
857  /* Check the database coherency: */
858  DB_OK;
859 
860  debug_on("PIPSDBM_DEBUG_LEVEL");
861  pips_debug(2, "putting or updating %s[%s]\n", rname, oname);
862  ifdebug(7) pips_assert("resource is consistent",
863  dbll_check_resource(rname, oname, p));
864 
865  /* Get the database resource associated to the given resource: */
866  r = find_or_create_db_resource(rname, oname);
868  /* The resource does not exist: it was just created, so mark it as
869  loaded into memory: */
871  else
872  /* The resource already exists... */
873  if (!update_is_ok && !db_resource_required_p(r))
874  /* If the resource is not required and we do not want to update it: */
875  pips_internal_error("resource %s[%s] already there\n",
876  rname, oname);
877 
878  /* Store data */
879  db_resource_pointer(r) = p; /**< ??? memory leak? depends? */
880  /* Mark the resource as loaded into memory: */
882  /* Timestamp the resource with the current logical time: */
884 
885  if (displayable_file_p(rname))
886  /* If there is a text file associated to the resource, get its
887  modification time: */
890  else
891  db_resource_file_time(r) = 0; /**< Or what else? */
892 
893  debug_db_resource(9, rname, oname, r);
894  debug_off();
895 }
db_status make_db_status_loaded(void)
static db_resource find_or_create_db_resource(const char *rname, const char *oname)
Definition: database.c:267
if(!(yy_init))
Definition: genread_lex.c:1029
int dbll_stat_local_file(const char *file_name, bool okifnotthere)
It is impportant that the workspace directory does not appear in the file name so as to allow workspa...
Definition: lowlevel.c:251
bool displayable_file_p(const char *name)
rather approximated.
Definition: lowlevel.c:361
#define false
Definition: newgen_types.h:80
int db_get_logical_time(void)
Definition: workspace.c:112
#define db_status_undefined_p(x)
@ is_db_status_loaded
#define db_resource_time(x)
#define db_resource_file_time(x)
else
Definition: set.c:239

References db_get_logical_time(), DB_OK, db_resource_db_status, db_resource_file_time, db_resource_pointer, db_resource_required_p, db_resource_time, db_status_tag, db_status_undefined_p, dbll_check_resource(), dbll_stat_local_file(), debug_db_resource, debug_off, debug_on, displayable_file_p(), find_or_create_db_resource(), ifdebug, is_db_status_loaded, make_db_status_loaded(), pips_assert, pips_debug, and pips_internal_error.

Referenced by AddEntityToCompilationUnit(), kernel_load_store_engine(), and RemoveEntityFromCompilationUnit().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: