Soar Kernel  9.3.2 08-06-12
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Typedefs | Functions | Variables
recmem.h File Reference
#include "instantiations.h"

Go to the source code of this file.

Typedefs

typedef struct agent_struct agent
typedef char Bool
typedef signed short goal_stack_level
typedef struct instantiation_struct instantiation
typedef struct preference_struct preference
typedef struct wme_struct wme

Functions

void build_prohibits_list (agent *thisAgent, instantiation *inst)
void deallocate_instantiation (agent *thisAgent, instantiation *inst)
void do_preference_phase (agent *thisAgent)
void fill_in_new_instantiation_stuff (agent *thisAgent, instantiation *inst, Bool need_to_do_support_calculations)
preferencefind_clone_for_level (preference *p, goal_stack_level level)
void init_firer (agent *thisAgent)
Symbolinstantiate_rhs_value (agent *thisAgent, rhs_value rv, goal_stack_level new_id_level, char new_id_letter, struct token_struct *tok, wme *w)
void possibly_deallocate_instantiation (agent *thisAgent, instantiation *inst)

Variables

wmeglbDeepCopyWMEs

Typedef Documentation

typedef struct agent_struct agent

Definition at line 39 of file recmem.h.

typedef char Bool

Definition at line 37 of file recmem.h.

typedef signed short goal_stack_level

Definition at line 38 of file recmem.h.

Definition at line 41 of file recmem.h.

typedef struct preference_struct preference

Definition at line 40 of file recmem.h.

typedef struct wme_struct wme

Definition at line 42 of file recmem.h.

Function Documentation

void build_prohibits_list ( agent thisAgent,
instantiation inst 
)
void deallocate_instantiation ( agent thisAgent,
instantiation inst 
)

Definition at line 842 of file recmem.cpp.

References preference_struct::attr, condition_struct::bt, deallocate_condition_list(), deallocate_list_of_nots(), deallocate_preference(), cons_struct::first, free_list(), preference_struct::id, symbol_union::id, instantiation_struct::in_ms, preference_struct::inst, agent_struct::instantiation_pool, instantiation_struct::match_goal, instantiation_struct::match_goal_level, production_struct::name, multi_attributes_struct::next, condition_struct::next, preference_struct::next_clone, NIL, instantiation_struct::nots, preference_struct::on_goal_list, POSITIVE_CONDITION, preference_is_binary(), agent_struct::preference_pool, preference_remove_ref(), identifier_struct::preferences_from_goal, instantiation_struct::preferences_generated, preference_struct::prev_clone, print_with_symbols(), instantiation_struct::prod, production_remove_ref(), bt_info_struct::prohibits, preference_struct::reference_count, preference_struct::referent, remove_from_dll, cons_struct::rest, symbol_remove_ref(), TOP_GOAL_LEVEL, instantiation_struct::top_of_instantiated_conditions, bt_info_struct::trace, preference_struct::type, condition_struct::type, preference_struct::value, preference_struct::wma_o_set, wma_remove_pref_o_set(), bt_info_struct::wme_, and wme_remove_ref().

Referenced by possibly_deallocate_instantiation().

{
condition *cond;
/* mvp 5-17-94 */
list *c, *c_old;
preference *pref;
#ifdef USE_MEM_POOL_ALLOCATORS
#else
cond_mpool_list cond_stack;
inst_mpool_list inst_list;
#endif
inst_list.push_back(inst);
inst_mpool_list::iterator next_iter = inst_list.begin();
while ( next_iter != inst_list.end() )
{
inst = *next_iter;
assert(inst);
++next_iter;
#ifdef DEBUG_INSTANTIATIONS
if (inst->prod)
print_with_symbols (thisAgent, "\nDeallocate instantiation of %y",inst->prod->name);
#endif
level = inst->match_goal_level;
for (cond=inst->top_of_instantiated_conditions; cond!=NIL; cond=cond->next)
{
if (cond->type==POSITIVE_CONDITION)
{
/* mvp 6-22-94, modified 94.01.17 by AGR with lotsa help from GAP */
if (cond->bt.prohibits)
{
c_old = c = cond->bt.prohibits;
cond->bt.prohibits = NIL;
for (; c!=NIL; c=c->rest)
{
pref = static_cast<preference *>(c->first);
#ifdef DO_TOP_LEVEL_REF_CTS
if (level > TOP_GOAL_LEVEL)
#endif
{
preference_remove_ref (thisAgent, pref);
}
}
free_list (thisAgent, c_old);
}
/* mvp done */
/* voigtjr, nlderbin:
We flattened out the following recursive loop in order to prevent a stack
overflow that happens when the chain of backtrace instantiations is very long:
retract_instantiation
possibly_deallocate_instantiation
loop start:
deallocate_instantiation (here)
preference_remove_ref
possibly_deallocate_preferences_and_clones
deallocate_preference
possibly_deallocate_instantiation
goto loop start
*/
#ifndef DO_TOP_LEVEL_REF_CTS
if (level > TOP_GOAL_LEVEL)
#endif
{
wme_remove_ref (thisAgent, cond->bt.wme_);
if (cond->bt.trace)
{
if (cond->bt.trace->reference_count == 0)
{
preference *clone;
if (cond->bt.trace->reference_count)
{
continue;
}
bool has_active_clones = false;
for (clone=cond->bt.trace->next_clone; clone!=NIL; clone=clone->next_clone)
{
if ( clone->reference_count )
{
has_active_clones = true;
}
}
if ( has_active_clones )
{
continue;
}
for ( clone = cond->bt.trace->prev_clone; clone != NIL; clone = clone->prev_clone )
{
if ( clone->reference_count )
{
has_active_clones = true;
}
}
if ( has_active_clones )
{
continue;
}
// The clones are hopefully a simple case so we just call deallocate_preference on them.
// Someone needs to create a test case to push this boundary...
{
preference* clone = cond->bt.trace->next_clone;
preference* next;
while (clone) {
next = clone->next_clone;
deallocate_preference (thisAgent, clone);
clone = next;
}
clone = cond->bt.trace->prev_clone;
while (clone) {
next = clone->prev_clone;
deallocate_preference (thisAgent, clone);
clone = next;
}
}
/* --- deallocate pref --- */
/* --- remove it from the list of bt.trace's for its match goal --- */
if ( cond->bt.trace->on_goal_list )
{
cond->bt.trace, all_of_goal_next, all_of_goal_prev );
}
/* --- remove it from the list of bt.trace's from that instantiation --- */
remove_from_dll( cond->bt.trace->inst->preferences_generated, cond->bt.trace, inst_next, inst_prev );
if ( ( !cond->bt.trace->inst->preferences_generated ) && ( !cond->bt.trace->inst->in_ms ) )
{
next_iter = inst_list.insert( next_iter, cond->bt.trace->inst );
}
cond_stack.push_back( cond );
} // if
} // if
} // if
/* voigtjr, nlderbin end */
} // if
} // for
} // while
// free condition symbols and pref
while( !cond_stack.empty() )
{
condition* temp = cond_stack.back();
cond_stack.pop_back();
/* --- dereference component symbols --- */
symbol_remove_ref( thisAgent, temp->bt.trace->id );
symbol_remove_ref( thisAgent, temp->bt.trace->attr );
symbol_remove_ref( thisAgent, temp->bt.trace->value );
if ( preference_is_binary( temp->bt.trace->type ) )
{
symbol_remove_ref( thisAgent, temp->bt.trace->referent );
}
if ( temp->bt.trace->wma_o_set )
{
wma_remove_pref_o_set( thisAgent, temp->bt.trace );
}
/* --- free the memory --- */
free_with_pool( &thisAgent->preference_pool, temp->bt.trace );
}
// free instantiations in the reverse order
inst_mpool_list::reverse_iterator riter = inst_list.rbegin();
while( riter != inst_list.rend() )
{
instantiation* temp = *riter;
++riter;
deallocate_list_of_nots( thisAgent, temp->nots );
if ( temp->prod )
{
production_remove_ref( thisAgent, temp->prod );
}
free_with_pool( &thisAgent->instantiation_pool, temp );
}
}
void do_preference_phase ( agent thisAgent)

Definition at line 1293 of file recmem.cpp.

References agent_struct::active_goal, agent_struct::active_level, AFTER_HALT_SOAR_CALLBACK, APPLY_PHASE, assert_new_preferences(), agent_struct::change_level, consume_last_postponed_assertion(), create_instantiation(), agent_struct::current_phase, FALSE, agent_struct::FIRING_TYPE, get_next_nil_goal_retraction(), get_next_retraction(), agent_struct::highest_active_goal, highest_active_goal_apply(), highest_active_goal_propose(), agent_struct::highest_active_level, symbol_union::id, IE_PRODS, agent_struct::inner_e_cycle_count, JUSTIFICATION_PRODUCTION_TYPE, identifier_struct::level, identifier_struct::lower_goal, agent_struct::max_chunks_reached, agent_struct::newly_created_instantiations, agent_struct::next_change_level, NIL, agent_struct::nil_goal_retractions, PE_PRODS, postpone_assertion(), preference_remove_ref(), print(), print_with_symbols(), PROPOSE_PHASE, restore_postponed_assertions(), retract_instantiation(), shouldCreateInstantiation(), soar_invoke_callbacks(), agent_struct::sysparams, agent_struct::system_halted, TRACE_PHASES_SYSPARAM, TRACE_WATERFALL_SYSPARAM, TRUE, production_struct::type, token_struct::w, wma_activate_wmes_tested_in_prods(), wma_enabled(), xml_att_val(), xml_begin_tag(), and xml_end_tag().

Referenced by do_one_top_level_phase(), and reinitialize_soar().

{
instantiation *inst = 0;
/* AGR 617/634: These are 2 bug reports that report the same problem,
namely that when 2 chunk firings happen in succession, there is an
extra newline printed out. The simple fix is to monitor
get_printer_output_column and see if it's at the beginning of a line
or not when we're ready to print a newline. 94.11.14 */
if (thisAgent->sysparams[TRACE_PHASES_SYSPARAM]) {
if (thisAgent->current_phase == APPLY_PHASE) { /* it's always IE for PROPOSE */
xml_begin_tag( thisAgent, kTagSubphase );
xml_att_val( thisAgent, kPhase_Name, kSubphaseName_FiringProductions );
switch (thisAgent->FIRING_TYPE) {
case PE_PRODS:
print (thisAgent, "\t--- Firing Productions (PE) For State At Depth %d ---\n", thisAgent->active_level); // SBW 8/4/2008: added active_level
xml_att_val( thisAgent, kPhase_FiringType, kPhaseFiringType_PE );
break;
case IE_PRODS:
print (thisAgent, "\t--- Firing Productions (IE) For State At Depth %d ---\n", thisAgent->active_level); // SBW 8/4/2008: added active_level
xml_att_val( thisAgent, kPhase_FiringType, kPhaseFiringType_IE );
break;
}
std::string levelString;
to_string(thisAgent->active_level, levelString);
xml_att_val( thisAgent, kPhase_LevelNum, levelString.c_str()); // SBW 8/4/2008: active_level for XML output mode
xml_end_tag( thisAgent, kTagSubphase );
}
}
if ( wma_enabled( thisAgent ) )
{
}
/* New waterfall model: */
// Save previous active level for usage on next elaboration cycle.
thisAgent->highest_active_level = thisAgent->active_level;
thisAgent->highest_active_goal = thisAgent->active_goal;
thisAgent->change_level = thisAgent->highest_active_level;
thisAgent->next_change_level = thisAgent->highest_active_level;
// Temporary list to buffer deallocation of some preferences until
// the inner elaboration loop is over.
#ifdef USE_MEM_POOL_ALLOCATORS
#else
pref_buffer_list bufdeallo;
#endif
// inner elaboration cycle
for (;;) {
thisAgent->change_level = thisAgent->next_change_level;
print (thisAgent, "\n--- Inner Elaboration Phase, active level %d", thisAgent->active_level);
if (thisAgent->active_goal) {
print_with_symbols (thisAgent, " (%y)", thisAgent->active_goal);
}
print (thisAgent, " ---\n");
}
Bool assertionsExist = FALSE;
production *prod = 0;
struct token_struct *tok = 0;
wme *w = 0;
Bool once = TRUE;
while (postpone_assertion (thisAgent, &prod, &tok, &w)) {
assertionsExist = TRUE;
if (thisAgent->max_chunks_reached) {
thisAgent->system_halted = TRUE;
0);
return;
}
// don't fire justifications
continue;
}
if (shouldCreateInstantiation(thisAgent, prod, tok, w)) {
once = FALSE;
create_instantiation (thisAgent, prod, tok, w);
}
}
// New waterfall model: something fired or is pending to fire at this level,
// so this active level becomes the next change level.
if (assertionsExist) {
if (thisAgent->active_level > thisAgent->next_change_level) {
thisAgent->next_change_level = thisAgent->active_level;
}
}
// New waterfall model: push unfired matches back on to the assertion lists
assert_new_preferences (thisAgent, bufdeallo);
// Update accounting
thisAgent->inner_e_cycle_count++;
if (thisAgent->active_goal == NIL) {
print(thisAgent, " inner elaboration loop doesn't have active goal.\n");
}
break;
}
if (thisAgent->active_goal->id.lower_goal == NIL) {
print(thisAgent, " inner elaboration loop at bottom goal.\n");
}
break;
}
if (thisAgent->current_phase == APPLY_PHASE) {
thisAgent->active_goal = highest_active_goal_apply(thisAgent, thisAgent->active_goal->id.lower_goal, TRUE);
} else {
assert(thisAgent->current_phase == PROPOSE_PHASE);
thisAgent->active_goal = highest_active_goal_propose(thisAgent, thisAgent->active_goal->id.lower_goal, TRUE);
}
if (thisAgent->active_goal != NIL)
{
thisAgent->active_level = thisAgent->active_goal->id.level;
} else {
print(thisAgent, " inner elaboration loop finished but not at quiescence.\n");
}
break;
}
} // end inner elaboration loop
// Deallocate preferences delayed during inner elaboration loop.
for ( pref_buffer_list::iterator iter=bufdeallo.begin(); iter!=bufdeallo.end(); ++iter )
{
preference_remove_ref( thisAgent, *iter );
}
// Restore previous active level
thisAgent->active_level = thisAgent->highest_active_level;
thisAgent->active_goal = thisAgent->highest_active_goal;
/* End new waterfall model */
while (get_next_retraction (thisAgent, &inst))
retract_instantiation (thisAgent, inst);
/* REW: begin 08.20.97 */
/* In Waterfall, if there are nil goal retractions, then we want to
retract them as well, even though they are not associated with any
particular goal (because their goal has been deleted). The
functionality of this separate routine could have been easily
combined in get_next_retraction but I wanted to highlight the
distinction between regualr retractions (those that can be
mapped onto a goal) and nil goal retractions that require a
special data strucutre (because they don't appear on any goal)
REW. */
if (thisAgent->nil_goal_retractions) {
while (get_next_nil_goal_retraction (thisAgent, &inst))
retract_instantiation (thisAgent, inst);
}
/* REW: end 08.20.97 */
}
void fill_in_new_instantiation_stuff ( agent thisAgent,
instantiation inst,
Bool  need_to_do_support_calculations 
)

Definition at line 418 of file recmem.cpp.

References instantiation_struct::backtrace_number, condition_struct::bt, calculate_support_for_instantiation_preferences(), DECLARED_I_SUPPORT, DECLARED_O_SUPPORT, production_struct::declared_support, destructively_reverse_list(), dougs_calculate_support_for_instantiation_preferences(), FALSE, find_clone_for_level(), find_match_goal(), cons_struct::first, free_cons(), symbol_union::id, insert_at_head_of_dll, preference_struct::inst, preference_struct::inst_next, instantiation_struct::match_goal, instantiation_struct::match_goal_level, production_struct::name, condition_struct::next, NIL, agent_struct::o_support_calculation_type, preference_struct::o_supported, preference_struct::on_goal_list, POSITIVE_CONDITION, preference_add_ref(), identifier_struct::preferences_from_goal, instantiation_struct::preferences_generated, print_with_symbols(), instantiation_struct::prod, production_add_ref(), push(), cons_struct::rest, TOP_GOAL_LEVEL, instantiation_struct::top_of_instantiated_conditions, bt_info_struct::trace, TRUE, condition_struct::type, bt_info_struct::wme_, and wme_add_ref().

Referenced by chunk_instantiation(), and create_instantiation().

{
condition *cond;
level = inst->match_goal_level;
/* Note: since we'll never backtrace through instantiations at the top
level, it might make sense to not increment the reference counts
on the wmes and preferences here if the instantiation is at the top
level. As it stands now, we could gradually accumulate garbage at
the top level if we have a never-ending sequence of production
firings at the top level that chain on each other's results. (E.g.,
incrementing a counter on every decision cycle.) I'm leaving it this
way for now, because if we go to S-Support, we'll (I think) need to
save these around (maybe). */
/* KJC 6/00: maintaining all the top level ref cts does have a big
impact on memory pool usage and also performance (due to malloc).
(See tests done by Scott Wallace Fall 99.) Therefore added
preprocessor macro so that by unsetting macro the top level ref cts are not
incremented. It's possible that in some systems, these ref cts may
be desireable: they can be added by defining DO_TOP_LEVEL_REF_CTS
*/
for (cond=inst->top_of_instantiated_conditions; cond!=NIL; cond=cond->next)
if (cond->type==POSITIVE_CONDITION) {
#ifdef DO_TOP_LEVEL_REF_CTS
wme_add_ref (cond->bt.wme_);
#else
if (level > TOP_GOAL_LEVEL) wme_add_ref (cond->bt.wme_);
#endif
/* --- if trace is for a lower level, find one for this level --- */
if (cond->bt.trace) {
if (cond->bt.trace->inst->match_goal_level > level) {
cond->bt.trace = find_clone_for_level (cond->bt.trace, level);
}
#ifdef DO_TOP_LEVEL_REF_CTS
if (cond->bt.trace) preference_add_ref (cond->bt.trace);
#else
if ((cond->bt.trace) && (level > TOP_GOAL_LEVEL))
#endif
}
}
if (inst->match_goal) {
for (p=inst->preferences_generated; p!=NIL; p=p->inst_next) {
all_of_goal_next, all_of_goal_prev);
}
}
inst->backtrace_number = 0;
if ((thisAgent->o_support_calculation_type == 0) ||
(thisAgent->o_support_calculation_type == 3) ||
(thisAgent->o_support_calculation_type == 4)) {
/* --- do calc's the normal Soar 6 way --- */
if (need_to_do_support_calculations)
} else if (thisAgent->o_support_calculation_type == 1) {
if (need_to_do_support_calculations)
/* --- do calc's both ways, warn on differences --- */
/* --- At this point, we've done them the normal way. To look for
differences, save o-support flags on a list, then do Doug's
calculations, then compare and restore saved flags. --- */
list *saved_flags;
preference *pref;
Bool difference_found;
saved_flags = NIL;
for (pref=inst->preferences_generated; pref!=NIL; pref=pref->inst_next)
push (thisAgent, (pref->o_supported ? pref : NIL), saved_flags);
saved_flags = destructively_reverse_list (saved_flags);
difference_found = FALSE;
for (pref=inst->preferences_generated; pref!=NIL; pref=pref->inst_next){
cons *c; Bool b;
c = saved_flags; saved_flags = c->rest;
b = (c->first ? TRUE : FALSE); free_cons (thisAgent, c);
if (pref->o_supported != b) difference_found = TRUE;
pref->o_supported = b;
}
if (difference_found) {
print_with_symbols(thisAgent, "\n*** O-support difference found in production %y",
inst->prod->name);
}
}
}
else {
/* --- do calc's Doug's way --- */
}
}
}
preference* find_clone_for_level ( preference p,
goal_stack_level  level 
)

Definition at line 123 of file recmem.cpp.

References preference_struct::inst, instantiation_struct::match_goal_level, preference_struct::next_clone, NIL, and preference_struct::prev_clone.

Referenced by build_prohibits_list(), fill_in_new_instantiation_stuff(), trace_locals(), and trace_ungrounded_potentials().

{
preference *clone;
if (! p) {
/* --- if the wme doesn't even have a preference on it, we can't backtrace
at all (this happens with I/O and some architecture-created wmes --- */
return NIL;
}
/* --- look at pref and all of its clones, find one at the right level --- */
if (p->inst->match_goal_level == level) return p;
for (clone=p->next_clone; clone!=NIL; clone=clone->next_clone)
if (clone->inst->match_goal_level==level) return clone;
for (clone=p->prev_clone; clone!=NIL; clone=clone->prev_clone)
if (clone->inst->match_goal_level==level) return clone;
/* --- if none was at the right level, we can't backtrace at all --- */
return NIL;
}
void init_firer ( agent thisAgent)

Definition at line 552 of file recmem.cpp.

References init_memory_pool(), and agent_struct::instantiation_pool.

Referenced by init_soar_agent().

{
init_memory_pool (thisAgent, &thisAgent->instantiation_pool, sizeof(instantiation),
"instantiation");
}
Symbol* instantiate_rhs_value ( agent thisAgent,
rhs_value  rv,
goal_stack_level  new_id_level,
char  new_id_letter,
struct token_struct tok,
wme w 
)

Definition at line 208 of file recmem.cpp.

{
list *fl;
list *arglist;
cons *c, *prev_c, *arg_cons;
Symbol *result;
Bool nil_arg_found;
result = rhs_value_to_symbol(rv);
/*
Long-Winded Case-by-Case [Hopeful] Explanation
This has to do with long-term identifiers (LTIs) that exist within productions (including chunks/justifications).
The real issue is that identifiers, upon creation, require a goal level (used for promotion/demotion/garbage collection).
At the time of parsing a rule, we don't have this information, so we give it an invalid "unknown" value.
This is OK on the condition side of a rule, since the rete (we think) will just consider it another symbol used for matching.
However, it becomes hairy when LTIs are on the action side of a rule, with respect to the state of the LTI in working memory and the rule LHS.
Consider the following cases:
1. Identifier is LTI, does NOT exist as a LHS symbol
- we do NOT support this!!! bad things will likely happen due to potential for adding an identifier to working memory
with an unknown goal level.
2. Attribute/Value is LTI, does NOT exist as a LHS symbol (!!!!!IMPORTANT CASE!!!!!)
- the caller of this function will supply new_id_level (probably based upon the level of the id).
- if this is valid (i.e. greater than 0), we use it. else, ignore.
- we have a huge assert on add_wme_to_wm that will kill soar if we try to add an identifier to working memory with an invalid level.
3. Identifier/Attribute/Value is LTI, DOES exist as LHS symbol
- in this situation, we are *guaranteed* that the resulting LTI (since it is in WM) has a valid goal level.
- it should be noted that if a value, the level of the LTI may change during promotion/demotion/garbage collection,
but this is natural Soar behavior and outside our perview.
*/
( result->id.smem_lti != NIL ) &&
( result->id.level == SMEM_LTI_UNKNOWN_LEVEL ) &&
( new_id_level > 0 ) )
{
result->id.level = new_id_level;
result->id.promotion_level = new_id_level;
}
symbol_add_ref (result);
return result;
}
int64_t index;
Symbol *sym;
index = static_cast<int64_t>(rhs_value_to_unboundvar(rv));
if (thisAgent->firer_highest_rhs_unboundvar_index < index)
sym = *(thisAgent->rhs_variable_bindings+index);
if (!sym) {
sym = make_new_identifier (thisAgent, new_id_letter, new_id_level);
*(thisAgent->rhs_variable_bindings+index) = sym;
return sym;
} else if (sym->common.symbol_type==VARIABLE_SYMBOL_TYPE) {
new_id_letter = *(sym->var.name + 1);
sym = make_new_identifier (thisAgent, new_id_letter, new_id_level);
*(thisAgent->rhs_variable_bindings+index) = sym;
return sym;
} else {
return sym;
}
}
tok, w);
symbol_add_ref (result);
return result;
}
rf = static_cast<rhs_function_struct *>(fl->first);
/* --- build up a list of the argument values --- */
prev_c = NIL;
nil_arg_found = FALSE;
arglist = NIL; /* unnecessary, but gcc -Wall warns without it */
for (arg_cons=fl->rest; arg_cons!=NIL; arg_cons=arg_cons->rest) {
allocate_cons (thisAgent, &c);
c->first = instantiate_rhs_value (thisAgent,
static_cast<char *>(arg_cons->first),
new_id_level, new_id_letter, tok, w);
if (! c->first) nil_arg_found = TRUE;
if (prev_c) prev_c->rest = c; else arglist = c;
prev_c = c;
}
if (prev_c) prev_c->rest = NIL; else arglist = NIL;
/* --- if all args were ok, call the function --- */
if (!nil_arg_found) {
// stop the kernel timer while doing RHS funcalls KJC 11/04
// the total_cpu timer needs to be updated in case RHS fun is statsCmd
#ifndef NO_TIMING_STUFF
thisAgent->timers_kernel.stop();
thisAgent->timers_cpu.stop();
thisAgent->timers_total_kernel_time.update(thisAgent->timers_kernel);
thisAgent->timers_total_cpu_time.update(thisAgent->timers_cpu);
thisAgent->timers_cpu.start();
#endif
result = (*(rf->f))(thisAgent, arglist, rf->user_data);
#ifndef NO_TIMING_STUFF // restart the kernel timer
thisAgent->timers_kernel.start();
#endif
} else
result = NIL;
/* --- scan through arglist, dereference symbols and deallocate conses --- */
for (c=arglist; c!=NIL; c=c->rest)
if (c->first) symbol_remove_ref (thisAgent, static_cast<Symbol *>(c->first));
free_list (thisAgent, arglist);
return result;
}
void possibly_deallocate_instantiation ( agent thisAgent,
instantiation inst 
)
inline

Definition at line 65 of file recmem.h.

References deallocate_instantiation().

Referenced by deallocate_preference(), and retract_instantiation().

{
if ((! (inst)->preferences_generated) &&
(! (inst)->in_ms))
deallocate_instantiation (thisAgent, inst);
}

Variable Documentation

wme* glbDeepCopyWMEs

Definition at line 76 of file recmem.cpp.

Referenced by create_instantiation(), and recursive_wme_copy().