C:/Users/Dennis/src/lang/Life_start/Life/life-1.02/source/memory.c File Reference

#include <stdlib.h>
#include "extern.h"
#include "print.h"
#include "login.h"
#include "lefun.h"
#include "token.h"
#include "error.h"
#include "xpred.h"
#include "modules.h"

Go to the source code of this file.

Defines

#define LONELY   1
#define ALIGNUP(X)   { (X) = (GENERIC)( ((long) (X) + (ALIGN-1)) & ~(ALIGN-1) ); }
#define assert(N)
#define UNCHECKED(P)   (! *((GENERIC)(P)+delta))

Functions

char * GetStrOption (char *name, char *def)
int GetBoolOption (char *name)
int GetIntOption (char *name, int def)
void pchoices ()
void print_undo_stack ()
long bounds_undo_stack ()
static void check_psi_list ()
static void check_resid_list ()
static void check_choice ()
static void check_undo_stack ()
void fail_all ()
void check_attr ()
void check_psi_term ()
void check_definition ()
void check_resid_block ()
static void compress ()
static long unchecked (GENERIC *p, long len)
static void check_string (GENERIC *s)
static void check_bytedata (GENERIC *s)
static void check_code (ptr_int_list *c)
static void check_pair_list (ptr_pair_list *p)
static void check_triple_list (ptr_triple_list *p)
static void check_kids (ptr_int_list *c)
static void check_operator_data (ptr_operator_data *op)
static void check_module ()
void check_hash_table ()
static void check_keyword ()
static void check_module_list (ptr_int_list *c)
static void check_module_tree (ptr_node *n)
static void check_module (ptr_module *m)
void check_hash_table (ptr_hash_table table)
static void check_keyword (ptr_keyword *k)
void check_definition (ptr_definition *d)
void check_definition_list ()
static void check_def_code (ptr_definition *d)
static void check_def_rest (ptr_definition *d)
static void check_symbol (ptr_node *n)
static void check_type_disj (ptr_int_list *p)
static void check_goal_stack (ptr_goal *g)
static void check_resid (ptr_residuation *r)
void check_resid_block (ptr_resid_block *rb)
void check_psi_term (ptr_psi_term *t)
void check_attr (ptr_node *n)
void check_gamma_code ()
static void check_gamma_rest ()
static void check_undo_stack (ptr_stack *s)
static void check_choice_structs (ptr_choice_point *c)
static void check_choice (ptr_choice_point *c)
static void check_special_addresses ()
static void check_psi_list (ptr_int_list *l)
static void check_resid_list (ptr_resid_list *l)
static void check_var (ptr_node *n)
static void check ()
void print_gc_info (long timeflag)
void garbage ()
GENERIC heap_alloc (long s)
GENERIC stack_alloc (long s)
void init_memory ()
long memory_check ()

Variables

static char vcid [] = "$Id: memory.c,v 1.10 1995/07/27 19:03:24 duchier Exp $"
GENERIC mem_base
GENERIC mem_limit
GENERIC stack_pointer
GENERIC heap_pointer
GENERIC other_base
GENERIC other_limit
GENERIC other_pointer
static long delta
static long pass
static struct tms last_garbage_time
static float gc_time
static float life_time
int mem_size
int alloc_words


Define Documentation

#define ALIGNUP (  )     { (X) = (GENERIC)( ((long) (X) + (ALIGN-1)) & ~(ALIGN-1) ); }

Definition at line 57 of file memory.c.

Referenced by init_memory().

#define assert (  ) 

Definition at line 134 of file memory.c.

Referenced by bfs(), c_eval(), check(), check_psi_term(), compress(), equalize_codes(), garbage(), main(), push_def_ptr_value(), push_psi_ptr_value(), push_ptr_value(), push_window(), unchecked(), unify_real_result(), and WFInit().

#define LONELY   1

Definition at line 45 of file memory.c.

Referenced by check_goal_stack(), check_psi_term(), check_resid(), check_resid_block(), check_special_addresses(), check_string(), compress(), and unchecked().

#define UNCHECKED (  )     (! *((GENERIC)(P)+delta))

Definition at line 328 of file memory.c.


Function Documentation

long bounds_undo_stack (  ) 

Definition at line 151 of file memory.c.

References wl_stack::a, FALSE, mem_base, mem_limit, wl_stack::next, TRUE, wl_stack::type, undo_action, undo_stack, and VALID_ADDRESS.

Referenced by check(), and garbage().

static void check (  )  [static]

Definition at line 1244 of file memory.c.

References aborthooksym, abortsym, add_module1, add_module2, add_module3, aim, alist, and, apply, assert, bi_module, boolpredsym, bounds_undo_stack(), built_in, call_handlersym, check_choice(), check_choice_structs(), check_definition(), check_definition_list(), check_gamma_code(), check_gamma_rest(), check_goal_stack(), check_module(), check_module_tree(), check_psi_term(), check_resid_list(), check_special_addresses(), check_string(), check_sys_definitions(), check_undo_stack(), check_var(), choice_stack, colonsym, commasym, comment, constant, current_module, cut, day_attr, delay_checksym, disj_nil, disjunction, dynamicsym, encodesym, eof, eqsym, error_psi_term, eval_argsym, final_dot, final_question, funcsym, functor, fx_sym, fy_sym, goal_stack, hour_attr, iff, input_state, inputfilesym, integer, life_or, listingsym, loadsym, minus_symbol, minute_attr, module_table, month_attr, nil, no_module, nothing, null_psi_term, nullsym, old_saved_psi_term, old_state, one, opsym, pass, predsym, quote, quoted_string, real, resid_aim, resid_vars, saved_psi_term, second_attr, staticsym, stdin_state, stream, succeed, such_that, syntax_module, sys_module, three, timesym, top, tracesym, TRUE, two, typesym, undo_stack, user_module, var_tree, variable, weekday_attr, x_module, xf_sym, xfx_sym, xfy_sym, year_attr, yf_sym, and yfx_sym.

Referenced by garbage().

void check_attr ( ptr_node n  ) 

Definition at line 1021 of file memory.c.

References check_attr(), check_psi_term(), check_string(), and unchecked().

void check_attr (  ) 

Referenced by check_attr(), and check_psi_term().

static void check_bytedata ( GENERIC s  )  [static]

Definition at line 452 of file memory.c.

References delta, MAX_BUILT_INS, pass, and unchecked().

Referenced by check_psi_term(), and check_resid().

static void check_choice ( ptr_choice_point c  )  [static]

Definition at line 1138 of file memory.c.

References check_goal_stack(), and check_undo_stack().

static void check_choice (  )  [static]

Referenced by check().

static void check_choice_structs ( ptr_choice_point c  )  [static]

Definition at line 1130 of file memory.c.

References unchecked().

Referenced by check().

static void check_code ( ptr_int_list c  )  [static]

Definition at line 484 of file memory.c.

References unchecked().

Referenced by check_def_code(), check_definition(), check_resid(), and check_undo_stack().

static void check_def_code ( ptr_definition d  )  [static]

Definition at line 703 of file memory.c.

References check_code(), and unchecked().

Referenced by check_gamma_code().

static void check_def_rest ( ptr_definition d  )  [static]

Definition at line 718 of file memory.c.

References check_keyword(), check_kids(), check_operator_data(), check_pair_list(), check_triple_list(), and type.

Referenced by check_gamma_rest().

void check_definition ( ptr_definition d  ) 

Definition at line 648 of file memory.c.

References check_code(), check_keyword(), check_kids(), check_operator_data(), check_pair_list(), check_psi_term(), check_triple_list(), type, and unchecked().

void check_definition (  ) 

Referenced by check(), check_definition_list(), check_keyword(), check_kids(), check_psi_term(), check_resid(), check_sys_definitions(), check_triple_list(), check_type_disj(), and check_undo_stack().

void check_definition_list (  ) 

Definition at line 684 of file memory.c.

References check_definition(), and first_definition.

Referenced by check().

void check_gamma_code (  ) 

Definition at line 1044 of file memory.c.

References check_def_code(), gamma_table, type_count, and unchecked().

Referenced by check().

static void check_gamma_rest (  )  [static]

Definition at line 1059 of file memory.c.

References check_def_rest(), gamma_table, and type_count.

Referenced by check().

static void check_goal_stack ( ptr_goal g  )  [static]

Definition at line 775 of file memory.c.

References check_pair_list(), check_psi_term(), check_resid_block(), check_string(), check_type_disj(), choice_stack, clause, DEFRULES, del_clause, disj, Errorline(), eval, eval_cut, fail, freeze_cut, general_cut, implies_cut, load, LONELY, match, pass, prove, retract, type_disj, unchecked(), unify, unify_noeval, and what_next.

Referenced by check(), check_choice(), check_resid(), check_resid_block(), and check_undo_stack().

void check_hash_table ( ptr_hash_table  table  ) 

Definition at line 612 of file memory.c.

References check_keyword().

void check_hash_table (  ) 

Referenced by check_module().

static void check_keyword ( ptr_keyword k  )  [static]

Definition at line 629 of file memory.c.

References check_definition(), check_module(), check_string(), and unchecked().

static void check_keyword (  )  [static]

Referenced by check_def_rest(), check_definition(), check_hash_table(), and check_symbol().

static void check_kids ( ptr_int_list c  )  [static]

Definition at line 528 of file memory.c.

References check_definition(), and unchecked().

Referenced by check_def_rest(), and check_definition().

static void check_module ( ptr_module m  )  [static]

Definition at line 592 of file memory.c.

References check_hash_table(), check_module_list(), check_string(), and unchecked().

static void check_module (  )  [static]

Referenced by check(), check_keyword(), check_module_list(), and check_module_tree().

static void check_module_list ( ptr_int_list c  )  [static]

Definition at line 561 of file memory.c.

References check_module(), and unchecked().

Referenced by check_module().

static void check_module_tree ( ptr_node n  )  [static]

Definition at line 575 of file memory.c.

References check_module(), check_string(), and unchecked().

Referenced by check().

static void check_operator_data ( ptr_operator_data op  )  [static]

Definition at line 542 of file memory.c.

References unchecked().

Referenced by check_def_rest(), and check_definition().

static void check_pair_list ( ptr_pair_list p  )  [static]

Definition at line 496 of file memory.c.

References check_psi_term(), and unchecked().

Referenced by check_def_rest(), check_definition(), and check_goal_stack().

static void check_psi_list ( ptr_int_list l  )  [static]

Definition at line 1185 of file memory.c.

References check_psi_term(), and unchecked().

static void check_psi_list (  )  [static]

void check_psi_term ( ptr_psi_term t  ) 

Definition at line 956 of file memory.c.

References alist, assert, check_attr(), check_bytedata(), check_definition(), check_resid(), check_string(), choice_stack, cut, Errorline(), heap_pointer, LONELY, mem_limit, NULL, pass, quoted_string, REAL, real, stream, sub_type(), sys_bytedata, unchecked(), and variable.

void check_psi_term (  ) 

Referenced by check(), check_attr(), check_definition(), check_goal_stack(), check_pair_list(), check_psi_list(), check_resid_list(), check_triple_list(), check_undo_stack(), and check_var().

static void check_resid ( ptr_residuation r  )  [static]

Definition at line 887 of file memory.c.

References alist, check_bytedata(), check_code(), check_definition(), check_goal_stack(), check_string(), choice_stack, wl_definition::code, cut, LONELY, pass, quoted_string, REAL, real, sub_CodeType(), sys_bytedata, unchecked(), and variable.

Referenced by check_psi_term(), and check_undo_stack().

void check_resid_block ( ptr_resid_block rb  ) 

Definition at line 936 of file memory.c.

References check_goal_stack(), check_resid_list(), LONELY, and unchecked().

void check_resid_block (  ) 

Referenced by check_goal_stack().

static void check_resid_list ( ptr_resid_list l  )  [static]

Definition at line 1200 of file memory.c.

References check_psi_term(), and unchecked().

static void check_resid_list (  )  [static]

Referenced by check(), and check_resid_block().

static void check_special_addresses (  )  [static]

Definition at line 1155 of file memory.c.

References wl_stack::a, wl_stack::b, choice_stack, cut_ptr, LONELY, wl_stack::next, wl_choice_point::next, wl_choice_point::stack_top, wl_stack::type, unchecked(), undo_action, undo_stack, and VALID_RANGE.

Referenced by check().

static void check_string ( GENERIC s  )  [static]

Definition at line 411 of file memory.c.

References delta, LONELY, MAX_BUILT_INS, pass, and unchecked().

Referenced by check(), check_attr(), check_goal_stack(), check_keyword(), check_module(), check_module_tree(), check_psi_term(), check_resid(), check_symbol(), and check_var().

static void check_symbol ( ptr_node n  )  [static]

Definition at line 743 of file memory.c.

References check_keyword(), check_string(), and unchecked().

static void check_triple_list ( ptr_triple_list p  )  [static]

Definition at line 512 of file memory.c.

References check_definition(), check_psi_term(), and unchecked().

Referenced by check_def_rest(), and check_definition().

static void check_type_disj ( ptr_int_list p  )  [static]

Definition at line 759 of file memory.c.

References check_definition(), and unchecked().

Referenced by check_goal_stack().

static void check_undo_stack ( ptr_stack s  )  [static]

Definition at line 1074 of file memory.c.

References check_code(), check_definition(), check_goal_stack(), check_psi_term(), check_resid(), code_ptr, cut_ptr, def_ptr, destroy_window, goal_ptr, hide_window, int_ptr, psi_term_ptr, resid_ptr, show_window, and unchecked().

static void check_undo_stack (  )  [static]

Referenced by check(), and check_choice().

static void check_var ( ptr_node n  )  [static]

Definition at line 1216 of file memory.c.

References check_psi_term(), check_string(), and unchecked().

Referenced by check().

static void compress (  )  [static]

Definition at line 231 of file memory.c.

References ALIGN, assert, delta, heap_pointer, LONELY, mem_base, mem_limit, other_pointer, stack_pointer, TRUE, and VALID_ADDRESS.

Referenced by garbage().

void fail_all (  ) 

Definition at line 195 of file memory.c.

References abort_life(), choice_stack, goal_stack, NULL, open_input_file(), output_stream, stdin_cleareof(), TRUE, and undo_stack.

Referenced by memory_check().

void garbage (  ) 

Definition at line 1466 of file memory.c.

References assert, bounds_undo_stack(), check(), clear_copy(), compress(), FALSE, garbage_time, gc_time, heap_pointer, ignore_eff, last_garbage_time, life_time, mem_base, mem_limit, NULL, other_base, other_limit, pass, pointer_names, print_gc_info(), printed_pointers, stack_info(), stack_pointer, TRUE, and verbose.

Referenced by memory_check().

int GetBoolOption ( char *  name  ) 

Definition at line 84 of file memory.c.

References GetStrOption().

Referenced by main().

int GetIntOption ( char *  name,
int  def 
)

Definition at line 94 of file memory.c.

References buffer, and GetStrOption().

Referenced by init_memory().

char* GetStrOption ( char *  name,
char *  def 
)

Definition at line 63 of file memory.c.

References arg_c, and arg_v.

Referenced by GetBoolOption(), and GetIntOption().

GENERIC heap_alloc ( long  s  ) 

Definition at line 1562 of file memory.c.

References ALIGN, Errorline(), heap_pointer, and stack_pointer.

void init_memory (  ) 

Definition at line 1616 of file memory.c.

References ALIGNUP, alloc_words, buffer, delta, Errorline(), GetIntOption(), heap_pointer, mem_base, mem_limit, mem_size, other_base, other_limit, other_pointer, PRINT_BUFFER, and stack_pointer.

Referenced by main(), and WFInit().

long memory_check (  ) 

Definition at line 1666 of file memory.c.

References fail_all(), FALSE, garbage(), GC_THRESHOLD, heap_pointer, stack_pointer, TRUE, and verbose.

Referenced by init_system(), and main_prove().

void pchoices (  ) 

Definition at line 111 of file memory.c.

References choice_stack, wl_choice_point::goal_stack, wl_choice_point::next, stack_pointer, wl_choice_point::stack_top, and wl_choice_point::undo_point.

void print_gc_info ( long  timeflag  ) 

Definition at line 1432 of file memory.c.

References gc_time, heap_pointer, life_time, mem_base, mem_limit, mem_size, and stack_pointer.

Referenced by garbage().

void print_undo_stack (  ) 

Definition at line 137 of file memory.c.

References wl_stack::a, wl_stack::b, mem_base, mem_limit, wl_stack::next, wl_stack::type, and undo_stack.

GENERIC stack_alloc ( long  s  ) 

Definition at line 1586 of file memory.c.

References ALIGN, Errorline(), heap_pointer, and stack_pointer.

static long unchecked ( GENERIC p,
long  len 
) [static]

Definition at line 345 of file memory.c.

References assert, delta, Errorline(), FALSE, LONELY, MAX_BUILT_INS, pass, TRUE, and VALID_ADDRESS.

Referenced by check_attr(), check_bytedata(), check_choice_structs(), check_code(), check_def_code(), check_definition(), check_gamma_code(), check_goal_stack(), check_keyword(), check_kids(), check_module(), check_module_list(), check_module_tree(), check_operator_data(), check_pair_list(), check_psi_list(), check_psi_term(), check_resid(), check_resid_block(), check_resid_list(), check_special_addresses(), check_string(), check_symbol(), check_triple_list(), check_type_disj(), check_undo_stack(), and check_var().


Variable Documentation

int alloc_words

Definition at line 55 of file memory.c.

Referenced by init_memory().

long delta [static]

Definition at line 33 of file memory.c.

Referenced by check_bytedata(), check_string(), compress(), init_memory(), and unchecked().

float gc_time [static]

Definition at line 51 of file memory.c.

Referenced by garbage(), and print_gc_info().

GENERIC heap_pointer

Definition at line 27 of file memory.c.

Referenced by bk_mark_quote(), c_assign(), c_bk_assign(), c_global_assign(), c_is_persistent(), c_project(), check_out(), check_psi_term(), compress(), copy(), deref_eval(), deref_rec_body(), display_couple(), garbage(), get_bool_value(), get_real_value(), global_unify(), heap_alloc(), init_global_vars(), init_memory(), main_display_psi_term(), main_pred_write(), main_prove(), memory_check(), persistent_one(), pretty_psi_term(), print_gc_info(), print_resid_message(), print_variables(), push_def_ptr_value(), push_ptr_value(), residuateGoalOnVar(), show_count(), stack_alloc(), and unify_real_result().

struct tms last_garbage_time [static]

Definition at line 48 of file memory.c.

Referenced by garbage().

float life_time [static]

Definition at line 51 of file memory.c.

Referenced by garbage(), and print_gc_info().

GENERIC mem_base

Definition at line 24 of file memory.c.

Referenced by bounds_undo_stack(), clean_trail(), compress(), garbage(), init_memory(), init_system(), main(), print_gc_info(), print_undo_stack(), show_count(), and WFInit().

GENERIC mem_limit

Definition at line 25 of file memory.c.

Referenced by bounds_undo_stack(), check_psi_term(), compress(), garbage(), init_memory(), print_gc_info(), print_undo_stack(), and show_count().

int mem_size

Definition at line 54 of file memory.c.

Referenced by init_memory(), and print_gc_info().

GENERIC other_base

Definition at line 28 of file memory.c.

Referenced by garbage(), init_memory(), main(), and WFInit().

GENERIC other_limit

Definition at line 30 of file memory.c.

Referenced by garbage(), and init_memory().

GENERIC other_pointer

Definition at line 31 of file memory.c.

Referenced by compress(), and init_memory().

long pass [static]

Definition at line 42 of file memory.c.

Referenced by check(), check_bytedata(), check_goal_stack(), check_psi_term(), check_resid(), check_string(), garbage(), and unchecked().

GENERIC stack_pointer

Definition at line 26 of file memory.c.

Referenced by backtrack(), c_freeze_inner(), clean_trail(), compress(), copy(), eval_aim(), garbage(), heap_alloc(), init_memory(), init_system(), main(), main_prove(), memory_check(), pchoices(), print_gc_info(), push2_ptr_value(), push_choice_point(), push_def_ptr_value(), push_psi_ptr_value(), push_ptr_value(), show_count(), stack_alloc(), and WFInit().

char vcid[] = "$Id: memory.c,v 1.10 1995/07/27 19:03:24 duchier Exp $" [static]

Definition at line 7 of file memory.c.


Generated on Sat Jan 26 08:48:09 2008 for WildLife by  doxygen 1.5.4