Soar Kernel
9.3.2 08-06-12
|
#include <portability.h>
#include <stdlib.h>
#include "mem.h"
#include "kernel.h"
#include "agent.h"
#include "init_soar.h"
#include "print.h"
#include <assert.h>
Go to the source code of this file.
Macros | |
#define | DEFAULT_BLOCK_SIZE 0x7FF0 /* about 32K bytes per block */ |
#define | DEFAULT_INTERLEAVE_FACTOR 1 |
#define | INITIAL_GROWABLE_STRING_SIZE 100 |
Variables | |
uint32_t | masks_for_n_low_order_bits [33] |
#define DEFAULT_BLOCK_SIZE 0x7FF0 /* about 32K bytes per block */ |
Definition at line 222 of file mem.cpp.
Referenced by init_memory_pool().
#define DEFAULT_INTERLEAVE_FACTOR 1 |
Definition at line 218 of file mem.cpp.
Referenced by add_block_to_memory_pool().
#define INITIAL_GROWABLE_STRING_SIZE 100 |
Definition at line 157 of file mem.cpp.
Referenced by make_blank_growable_string().
void add_block_to_memory_pool | ( | agent * | thisAgent, |
memory_pool * | p | ||
) |
Definition at line 224 of file mem.cpp.
References allocate_memory(), DEFAULT_INTERLEAVE_FACTOR, memory_pool_struct::first_block, memory_pool_struct::free_list, memory_pool_struct::item_size, memory_pool_struct::items_per_block, memory_pool_struct::num_blocks, and POOL_MEM_USAGE.
Definition at line 362 of file mem.cpp.
References allocate_cons(), cons_struct::first, NIL, and cons_struct::rest.
Referenced by collect_vars_tested_by_test_that_are_bound().
void add_to_growable_string | ( | agent * | thisAgent, |
growable_string * | gs, | ||
const char * | string_to_add | ||
) |
Definition at line 170 of file mem.cpp.
References allocate_memory(), free_memory(), length_of_growable_string(), memsize_of_growable_string(), STRING_MEM_USAGE, and text_of_growable_string().
Referenced by add_trace_for_attribute_path(), add_trace_for_wme(), add_values_of_attribute_path(), calculate_support_for_instantiation_preferences(), collect_root_variables(), object_to_trace_string(), p_node_left_addition(), parse_head_of_conds_for_one_id(), print_action_list(), print_condition_list(), reorder_simplified_conditions(), restore_and_deallocate_saved_tests(), trace_format_list_to_string(), and write_rhs_function_code().
void add_to_hash_table | ( | agent * | thisAgent, |
struct hash_table_struct * | ht, | ||
void * | item | ||
) |
Definition at line 581 of file mem.cpp.
References hash_table_struct::buckets, hash_table_struct::count, hash_table_struct::h, hash_table_struct::log2size, item_in_hash_table_struct::next, resize_hash_table(), hash_table_struct::size, and uint32_t().
Referenced by add_trace_format(), find_or_make_alpha_mem(), make_float_constant(), make_int_constant(), make_new_identifier(), make_sym_constant(), and make_variable().
Definition at line 44 of file mem.cpp.
References abort_with_fatal_error(), BUFFER_MSG_SIZE, fill_with_garbage, agent_struct::memory_for_usage, and STATS_OVERHEAD_MEM_USAGE.
Referenced by add_block_to_memory_pool(), add_rhs_function(), add_to_growable_string(), add_trace_format(), allocate_memory_and_zerofill(), make_blank_growable_string(), make_hash_table(), make_memory_block_for_string(), parse_item_from_format_string(), print_match_set(), read_rest_of_floating_point_number(), reteload_all_symbols(), reteload_alpha_memories(), start_lex_from_file(), and xml_match_set().
Definition at line 73 of file mem.cpp.
References allocate_memory().
Referenced by init_rete(), make_hash_table(), resize_hash_table(), and update_max_rhs_unbound_variables().
Definition at line 453 of file mem.cpp.
References cons_struct::first.
Referenced by remove_existing_context_and_descendents().
Definition at line 340 of file mem.cpp.
References NIL, and cons_struct::rest.
Referenced by add_production_to_rete(), copy_test_removing_goal_impasse_tests(), fill_in_new_instantiation_stuff(), parse_attribute_path_in_brackets(), parse_disjunction_test(), parse_test(), reteload_node_and_children(), reteload_rete_test(), reteload_rhs_value(), and reteload_varnames().
void do_for_all_items_in_hash_bucket | ( | struct hash_table_struct * | ht, |
hash_table_callback_fn | f, | ||
uint32_t | hash_value | ||
) |
Definition at line 610 of file mem.cpp.
References hash_table_struct::buckets, hash_table_struct::log2size, masks_for_n_low_order_bits, item_in_hash_table_struct::next, and NIL.
void do_for_all_items_in_hash_table | ( | agent * | thisAgent, |
struct hash_table_struct * | ht, | ||
hash_table_callback_fn2 | f, | ||
void * | userdata | ||
) |
Definition at line 595 of file mem.cpp.
References hash_table_struct::buckets, item_in_hash_table_struct::next, NIL, hash_table_struct::size, and uint32_t().
Referenced by print_all_trace_formats(), print_all_trace_formats_tcl(), print_internal_symbols(), reset_id_and_variable_tc_numbers(), reset_id_counters(), reset_variable_gensym_numbers(), retesave_alpha_memories(), and retesave_symbol_table().
dl_list* extract_dl_list_elements | ( | agent * | thisAgent, |
dl_list ** | header, | ||
dl_cons_test_fn | f | ||
) |
Definition at line 419 of file mem.cpp.
References dl_cons_struct::next, NIL, dl_cons_struct::prev, and remove_from_dll.
Referenced by print_action_list(), print_condition_list(), and xml_condition_list().
list* extract_list_elements | ( | agent * | thisAgent, |
list ** | header, | ||
cons_test_fn | f, | ||
void * | data | ||
) |
Definition at line 383 of file mem.cpp.
References NIL, and cons_struct::rest.
Referenced by remove_existing_context_and_descendents(), and remove_pwatch().
void free_growable_string | ( | agent * | thisAgent, |
growable_string | gs | ||
) |
Definition at line 191 of file mem.cpp.
References free_memory(), and STRING_MEM_USAGE.
Referenced by add_trace_for_attribute_path(), add_trace_for_wme(), add_values_of_attribute_path(), calculate_support_for_instantiation_preferences(), collect_root_variables(), p_node_left_addition(), parse_head_of_conds_for_one_id(), print_action_list(), print_condition_list(), print_object_trace(), print_object_trace_using_provided_format_string(), print_stack_trace(), reorder_simplified_conditions(), restore_and_deallocate_saved_tests(), trace_format_list_to_string(), and write_rhs_function_code().
void free_hash_table | ( | agent * | thisAgent, |
struct hash_table_struct * | ht | ||
) |
Definition at line 548 of file mem.cpp.
References hash_table_struct::buckets, free_memory(), and HASH_TABLE_MEM_USAGE.
Referenced by destroy_soar_agent().
Definition at line 373 of file mem.cpp.
References free_cons(), and cons_struct::rest.
Referenced by backtrace_through_instantiation(), calculate_compile_time_o_support(), chunk_instantiation(), deallocate_instantiation(), deallocate_rhs_value(), find_compile_time_match_goal(), find_thing_off_goal(), instantiate_rhs_value(), remove_existing_context_and_descendents(), remove_pwatch(), remove_vars_requiring_bindings(), reorder_lhs(), reorder_simplified_conditions(), report_local_negation(), and reset_variable_generator().
Definition at line 81 of file mem.cpp.
References fill_with_garbage, agent_struct::memory_for_usage, and STATS_OVERHEAD_MEM_USAGE.
Referenced by add_to_growable_string(), deallocate_trace_format_list(), destroy_soar_agent(), free_growable_string(), free_hash_table(), free_memory_block_for_string(), free_memory_pool(), print_match_set(), remove_rhs_function(), remove_trace_format(), resize_hash_table(), reteload_free_am_table(), reteload_free_symbol_table(), stop_lex_from_file(), update_max_rhs_unbound_variables(), and xml_match_set().
void free_memory_block_for_string | ( | agent * | thisAgent, |
char * | p | ||
) |
Definition at line 153 of file mem.cpp.
References free_memory(), and STRING_MEM_USAGE.
Referenced by deallocate_production(), deallocate_symbol(), deallocate_trace_format_list(), destroy_soar_agent(), parse_production(), read_rest_of_floating_point_number(), rl_perform_update(), and stop_lex_from_file().
void free_memory_pool | ( | agent * | thisAgent, |
memory_pool * | p | ||
) |
Definition at line 274 of file mem.cpp.
References memory_pool_struct::first_block, free_memory(), memory_pool_struct::num_blocks, and POOL_MEM_USAGE.
Referenced by destroy_soar_agent().
void init_memory_pool | ( | agent * | thisAgent, |
memory_pool * | p, | ||
size_t | item_size, | ||
const char * | name | ||
) |
Definition at line 287 of file mem.cpp.
References abort_with_fatal_error(), DEFAULT_BLOCK_SIZE, memory_pool_struct::first_block, memory_pool_struct::free_list, memory_pool_struct::item_size, memory_pool_struct::items_per_block, MAX_POOL_NAME_LENGTH, agent_struct::memory_pools_in_use, memory_pool_struct::name, memory_pool_struct::next, NIL, memory_pool_struct::num_blocks, and memory_pool_struct::used_count.
Referenced by soar_module::get_memory_pool(), init_chunker(), init_decider(), init_firer(), init_memory_utilities(), init_production_utilities(), init_reorderer(), init_rete(), init_soar_agent(), init_soar_io(), and init_symbol_tables().
void init_memory_utilities | ( | agent * | thisAgent | ) |
Definition at line 629 of file mem.cpp.
References agent_struct::cons_cell_pool, agent_struct::dl_cons_pool, init_memory_pool(), agent_struct::memory_for_usage, and NUM_MEM_USAGE_CODES.
Referenced by create_soar_agent().
growable_string make_blank_growable_string | ( | agent * | thisAgent | ) |
Definition at line 159 of file mem.cpp.
References allocate_memory(), INITIAL_GROWABLE_STRING_SIZE, length_of_growable_string(), memsize_of_growable_string(), STRING_MEM_USAGE, and text_of_growable_string().
Referenced by add_trace_for_attribute_path(), calculate_support_for_instantiation_preferences(), collect_root_variables(), object_to_trace_string(), p_node_left_addition(), parse_head_of_conds_for_one_id(), print_action_list(), print_condition_list(), reorder_simplified_conditions(), restore_and_deallocate_saved_tests(), selection_to_trace_string(), trace_format_list_to_string(), and write_rhs_function_code().
|
read |
Definition at line 502 of file mem.cpp.
References allocate_memory(), allocate_memory_and_zerofill(), hash_table_struct::buckets, hash_table_struct::count, hash_table_struct::h, HASH_TABLE_MEM_USAGE, hash_table_struct::log2size, hash_table_struct::minimum_log2size, hash_table_struct::size, and uint32_t().
Referenced by init_rete(), init_symbol_tables(), and init_tracing().
char* make_memory_block_for_string | ( | agent * | thisAgent, |
char const * | s | ||
) |
Definition at line 142 of file mem.cpp.
References allocate_memory(), and STRING_MEM_USAGE.
Referenced by make_sym_constant(), make_variable(), parse_item_from_format_string(), parse_production(), reteload_node_and_children(), rl_perform_update(), and start_lex_from_file().
Definition at line 354 of file mem.cpp.
References FALSE, cons_struct::first, cons_struct::rest, and TRUE.
Referenced by dont_learn_rhs_function_code(), find_compile_time_match_goal(), force_learn_rhs_function_code(), should_variablize(), test_covered_by_bound_vars(), test_is_for_symbol(), and test_tests_for_root().
void print_memory_statistics | ( | agent * | thisAgent | ) |
Definition at line 96 of file mem.cpp.
References HASH_TABLE_MEM_USAGE, agent_struct::memory_for_usage, MISCELLANEOUS_MEM_USAGE, NUM_MEM_USAGE_CODES, POOL_MEM_USAGE, print(), STATS_OVERHEAD_MEM_USAGE, and STRING_MEM_USAGE.
void remove_from_hash_table | ( | agent * | thisAgent, |
struct hash_table_struct * | ht, | ||
void * | item | ||
) |
Definition at line 553 of file mem.cpp.
References hash_table_struct::buckets, hash_table_struct::count, hash_table_struct::h, hash_table_struct::log2size, hash_table_struct::minimum_log2size, item_in_hash_table_struct::next, NIL, resize_hash_table(), hash_table_struct::size, and uint32_t().
Referenced by deallocate_symbol(), remove_ref_to_alpha_mem(), and remove_trace_format().
void resize_hash_table | ( | agent * | thisAgent, |
hash_table * | ht, | ||
short | new_log2size | ||
) |
Definition at line 519 of file mem.cpp.
References allocate_memory_and_zerofill(), hash_table_struct::buckets, free_memory(), hash_table_struct::h, HASH_TABLE_MEM_USAGE, hash_table_struct::log2size, item_in_hash_table_struct::next, NIL, hash_table_struct::size, and uint32_t().
Referenced by add_to_hash_table(), and remove_from_hash_table().
uint32_t masks_for_n_low_order_bits[33] |
Definition at line 492 of file mem.cpp.
Referenced by add_wme_to_aht(), alpha_hash_value(), compress(), do_for_all_items_in_hash_bucket(), hash_name_restriction(), and make_chunk_cond_for_condition().