macro_xsb.h File Reference

#include "debug_xsb.h"
#include "table_status_defs.h"
#include "slgdelay.h"

Data Structures

struct  Deleted_Table_Frame
struct  PrRef
struct  Deleted_Clause_Frame
struct  Table_Info_Frame
struct  tif_list
struct  TDispBlk_t
struct  TDispBlkHdr_t
struct  ascc_edge
struct  completion_stack_frame
struct  subgoal_frame
struct  SubsumptiveProducerSubgoalFrame
struct  SubsumedConsumerSubgoalFrame

Defines

#define DELETED_PREDICATE   0
#define DELETED_SUBGOAL   1
#define DTF_Mark(pDTF)   ( (pDTF)->mark )
#define DTF_Type(pDTF)   ( (pDTF)->type )
#define DTF_CallTrie(pDTF)   ( (pDTF)->call_trie )
#define DTF_Subgoals(pDTF)   ( (pDTF)->subgoals )
#define DTF_Subgoal(pDTF)   ( (pDTF)->subgoals )
#define DTF_NextDTF(pDTF)   ( (pDTF)->next_delTF )
#define DTF_NextPredDTF(pDTF)   ( (pDTF)->next_pred_delTF )
#define DTF_PrevDTF(pDTF)   ( (pDTF)->prev_delTF )
#define DTF_PrevPredDTF(pDTF)   ( (pDTF)->prev_pred_delTF )
#define New_Global_DelTF_Pred(pDTF, pTIF)
#define New_Global_DelTF_Subgoal(pDTF, pTIF, pSubgoal)
#define Free_Global_DelTF_Pred(pDTF, pTIF)
#define Free_Global_DelTF_Subgoal(pDTF, pTIF)
#define PrRef_Instr(PRREF)   ( (PRREF)->Instr )
#define PrRef_FirstClRef(PRREF)   ( (PRREF)->FirstClRef )
#define PrRef_LastClRef(PRREF)   ( (PRREF)->LastClRef )
#define PrRef_Psc(PRREF)   ( (PRREF)->psc )
#define PrRef_Mark(PRREF)   ( (PRREF)->mark )
#define PrRef_DelCF(PRREF)   ( (PRREF)->delcf )
#define DELETED_PRREF   0
#define DELETED_CLREF   1
#define DCF_Mark(pDCF)   ( (pDCF)->mark )
#define DCF_Type(pDCF)   ( (pDCF)->type )
#define DCF_PrRef(pDCF)   ( (pDCF)->prref )
#define DCF_ClRef(pDCF)   ( (pDCF)->clref )
#define DCF_PSC(pDCF)   ( (pDCF)->psc )
#define DCF_NextDCF(pDCF)   ( (pDCF)->next_delCF )
#define DCF_PrevDCF(pDCF)   ( (pDCF)->prev_delCF )
#define DCF_NextPredDCF(pDCF)   ( (pDCF)->next_pred_delCF )
#define DCF_PrevPredDCF(pDCF)   ( (pDCF)->prev_pred_delCF )
#define isSharedTIF(pTIF)   (TIF_EvalMethod(pTIF) != DISPATCH_BLOCK)
#define isPrivateTIF(pTIF)   (TIF_EvalMethod(pTIF) == DISPATCH_BLOCK)
#define TIF_PSC(pTIF)   ( (pTIF)->psc_ptr )
#define TIF_DelTF(pTIF)   ( (pTIF)->del_tf_ptr )
#define TIF_EvalMethod(pTIF)   ( (pTIF)->method )
#define TIF_Mark(pTIF)   ( (pTIF)->mark )
#define TIF_CallTrie(pTIF)   ( (pTIF)->call_trie )
#define TIF_Subgoals(pTIF)   ( (pTIF)->subgoals )
#define TIF_NextTIF(pTIF)   ( (pTIF)->next_tif )
#define cps_check_mark_tif(pTIF)   TIF_Mark(pTIF) = 0x1
#define cps_check_unmark_tif(pTIF)   TIF_Mark(pTIF) = 0x0
#define IsVariantPredicate(pTIF)   ( TIF_EvalMethod(pTIF) == VARIANT_EVAL_METHOD )
#define IsSubsumptivePredicate(pTIF)   ( TIF_EvalMethod(pTIF) == SUBSUMPTIVE_EVAL_METHOD )
#define Free_Shared_TIF(pTIF)
#define Free_Private_TIF(pTIF)
#define TIF_DispatchBlock(pTIF)   ((TDBptr) (pTIF)->psc_ptr )
#define TDB_MaxThread(pTDB)   ( (pTDB)->MaxThread )
#define TDB_TIFArray(pTDB)   ( (&(pTDB)->Thread0) )
#define TDB_PrivateTIF(pTDB, tid)   ( TDB_TIFArray(pTDB)[(tid)] )
#define handle_dispatch_block(tip)
#define ASCC_EDGE_SIZE   (sizeof(struct ascc_edge)/sizeof(CPtr))
#define edge_to_node(e)   ((EPtr)(e))->ascc_node_ptr
#define next_edge(e)   ((EPtr)(e))->next
#define DELAYED   -1
#define COMPLFRAMESIZE   (sizeof(struct completion_stack_frame)/sizeof(CPtr))
#define compl_subgoal_ptr(b)   ((ComplStackFrame)(b))->subgoal_ptr
#define compl_level(b)   ((ComplStackFrame)(b))->_level_num
#define compl_del_ret_list(b)   ((ComplStackFrame)(b))->del_ret_list
#define compl_visited(b)   ((ComplStackFrame)(b))->visited
#define compl_DG_edges(b)   ((ComplStackFrame)(b))->DG_edges
#define compl_DGT_edges(b)   ((ComplStackFrame)(b))->DGT_edges
#define prev_compl_frame(b)   (((CPtr)(b))+COMPLFRAMESIZE)
#define next_compl_frame(b)   (((CPtr)(b))-COMPLFRAMESIZE)
#define adjust_level(CS_FRAME)
#define push_completion_frame_common(subgoal)
#define push_completion_frame_batched(subgoal)   compl_DG_edges(openreg) = compl_DGT_edges(openreg) = NULL
#define push_completion_frame(subgoal)
#define compact_completion_frame(cp_frame, cs_frame, subgoal)
#define VARIANT_PRODUCER_SFT   0x02
#define SUBSUMPTIVE_PRODUCER_SFT   0x01
#define SUBSUMED_CONSUMER_SFT   0x00
#define VARIANT_SUBSUMPTION_MASK   0x03
#define SHARED_PRIVATE_MASK   0x04
#define SHARED_SFT   0x04
#define PRIVATE_SFT   0x00
#define subg_sf_type(b)   ((VariantSF)(b))->sf_type
#define subg_is_complete(b)   ((VariantSF)(b))->is_complete
#define subg_is_reclaimed(b)   ((VariantSF)(b))->is_reclaimed
#define subg_prev_subgoal(b)   ((VariantSF)(b))->prev_subgoal
#define subg_next_subgoal(b)   ((VariantSF)(b))->next_subgoal
#define subg_tif_ptr(b)   ((VariantSF)(b))->tif_ptr
#define subg_leaf_ptr(b)   ((VariantSF)(b))->leaf_ptr
#define subg_ans_root_ptr(b)   ((VariantSF)(b))->ans_root_ptr
#define subg_ans_list_ptr(b)   ((VariantSF)(b))->ans_list_ptr
#define subg_ans_list_tail(b)   ((VariantSF)(b))->ans_list_tail
#define subg_cp_ptr(b)   ((VariantSF)(b))->cp_ptr
#define subg_deltf_ptr(b)   ((VariantSF)(b))->deltf_ptr
#define subg_asf_list_ptr(b)   ((VariantSF)(b))->asf_list_ptr
#define subg_compl_stack_ptr(b)   ((VariantSF)(b))->compl_stack_ptr
#define subg_compl_susp_ptr(b)   ((VariantSF)(b))->compl_suspens_ptr
#define subg_nde_list(b)   ((VariantSF)(b))->nde_list
#define subg_tid(b)   ((VariantSF)(b))->tid
#define subg_tag(b)   ((VariantSF)(b))->tag
#define subg_grabbed(b)   ((VariantSF)(b))->grabbed
#define subg_consumers(SF)   ((SubProdSF)(SF))->consumers
#define conssf_producer(SF)   ((SubConsSF)(SF))->producer
#define conssf_timestamp(SF)   ((SubConsSF)(SF))->ts
#define conssf_consumers(SF)   ((SubConsSF)(SF))->consumers
#define subg_answers(subg)   ALN_Next(subg_ans_list_ptr(subg))
#define IsVariantSF(pSF)   ((subg_sf_type(pSF) & VARIANT_SUBSUMPTION_MASK) == VARIANT_PRODUCER_SFT)
#define IsSubProdSF(pSF)   ((subg_sf_type(pSF) & VARIANT_SUBSUMPTION_MASK) == SUBSUMPTIVE_PRODUCER_SFT)
#define IsSubConsSF(pSF)   ((subg_sf_type(pSF) & VARIANT_SUBSUMPTION_MASK) == SUBSUMED_CONSUMER_SFT)
#define IsPrivateSF(pSF)   ((subg_sf_type(pSF) & SHARED_PRIVATE_MASK) == PRIVATE_SFT)
#define IsSharedSF(pSF)   ((subg_sf_type(pSF) & SHARED_PRIVATE_MASK) == SHARED_SFT)
#define IsVariantProducer(pSF)   IsVariantSF(pSF)
#define IsSubsumptiveProducer(pSF)   IsSubProdSF(pSF)
#define IsProperlySubsumed(pSF)   IsSubConsSF(pSF)
#define IsProducingSubgoal(pSF)   ( IsVariantProducer(pSF) || IsSubsumptiveProducer(pSF) )
#define ProducerSubsumesSubgoals(pSF)   ( IsSubsumptiveProducer(pSF) && IsNonNULL(subg_consumers(pSF)) )
#define subg_dll_add_sf(pSF, Chain, NewChain)
#define subg_dll_remove_sf(pSF, Chain, NewChain)
#define empty_return_handle(SF)   empty_return(SF)
#define SF_AppendNewAnswerList(pSF, pAnsList)
#define SF_AppendNewAnswer(pSF, pAns)   SF_AppendToAnswerList(pSF,pAns,pAns)
#define SF_AppendToAnswerList(pSF, pHead, pTail)
#define SUBGOAL_FRAMES_PER_BLOCK   16
#define FreeProducerSF(SF)
#define tstCreateTSIs_handle(Producer)   tstCreateTSIs(Producer)
#define NewSubConsSF(SF, Leaf, TableInfo, Producer)
#define set_min(a, b, c)   if (b < c) a = b; else a = c
#define tab_level(SUBG_PTR)   compl_level((subg_compl_stack_ptr(SUBG_PTR)))
#define next_tab_level(CSF_PTR)   compl_level(prev_compl_frame(CSF_PTR))
#define is_leader(CSF_PTR)   (next_tab_level(CSF_PTR) < compl_level(CSF_PTR))
#define NO_ANSWERS   (ALNptr)0
#define UNCOND_ANSWERS   (ALNptr)1
#define COND_ANSWERS   (ALNptr)2
#define INCOMP_ANSWERS   (ALNptr)3
#define has_answers(SUBG_PTR)   IsNonNULL(subg_answers(SUBG_PTR))
#define has_no_answers(SUBG_PTR)   IsNULL(subg_answers(SUBG_PTR))
#define has_answer_code(SUBG_PTR)
#define subgoal_fails(SUBG_PTR)   ( ! has_answer_code(SUBG_PTR) )
#define subgoal_unconditionally_succeeds(SUBG_PTR)
#define mark_subgoal_failed(SUBG_PTR)   (subg_ans_root_ptr(SUBG_PTR) = NULL)
#define neg_simplif_possible(SUBG_PTR)   ((subgoal_fails(SUBG_PTR)) && (subg_nde_list(SUBG_PTR) != NULL))
#define is_completed(SUBG_PTR)   subg_is_complete(SUBG_PTR)
#define structs_are_reclaimed(SUBG_PTR)   subg_is_reclaimed(SUBG_PTR)
#define mark_as_completed(SUBG_PTR)
#define subgoal_space_has_been_reclaimed(SUBG_PTR, CS_FRAME)   (SUBG_PTR != compl_subgoal_ptr(CS_FRAME))
#define mark_delayed(csf1, csf2, susp)
#define reclaim_incomplete_table_structs(SUBG_PTR)
#define Reset_Demand_Freeze_Registers
#define reset_freeze_registers
#define adjust_freeze_registers(tcp)
#define reclaim_stacks(tcp)
#define pdlpush(cell)   *(pdlreg) = cell; pdlreg--
#define pdlpop   *(++pdlreg)
#define pdlempty   (pdlreg == (CPtr)(pdl.high) - 1)
#define resetpdl
#define remove_incomplete_tables_loop(Endpoint)   remove_incomplete_tries(Endpoint)
#define remove_incomplete_tables()   remove_incomplete_tries(CTXTc COMPLSTACKBOTTOM)
#define get_var_and_attv_nums(var_num, attv_num, tmp_int)

Typedefs

typedef Deleted_Table_FrameDelTFptr
typedef Deleted_Table_Frame DeletedTableFrame
typedef Deleted_Clause_FrameDelCFptr
typedef Deleted_Clause_Frame DeletedClauseFrame
typedef byte TabledEvalMethod
typedef Table_Info_FrameTIFptr
typedef Table_Info_Frame TableInfoFrame
typedef TDispBlk_tTDBptr
typedef ascc_edgeEPtr
typedef completion_stack_frameComplStackFrame
typedef subgoal_frame variant_subgoal_frame
typedef SubsumedConsumerSubgoalFrameSubConsSF
typedef SubsumptiveProducerSubgoalFrameSubProdSF
typedef SubsumptiveProducerSubgoalFrame subsumptive_producer_sf
typedef SubsumedConsumerSubgoalFrame subsumptive_consumer_sf

Enumerations

enum  SubgoalFrameType {
  SHARED_VARIANT_PRODUCER_SFT = 0x06, SHARED_SUBSUMPTIVE_PRODUCER_SFT = 0x05, SHARED_SUBSUMED_CONSUMER_SFT = 0x04, PRIVATE_VARIANT_PRODUCER_SFT = 0x02,
  PRIVATE_SUBSUMPTIVE_PRODUCER_SFT = 0x01, PRIVATE_SUBSUMED_CONSUMER_SFT = 0x00
}

Functions

xsbBool assert_buff_to_clref_p (prolog_term, byte, PrRef, int, prolog_term, int, ClRef *)
int assert_code_to_buff_p (prolog_term)
ALNptr empty_return (VariantSF)
void tstCreateTSIs (TSTNptr)

Variables

typedef PrRefData
tif_list tif_list
TIFptr New_TIF (Psc)
Structure_Manager smVarSF
Structure_Manager smProdSF
Structure_Manager smConsSF

Define Documentation

#define adjust_freeze_registers tcp   ) 
 

Value:

if (bfreg < tcp_bfreg(tcp)) { bfreg = tcp_bfreg(tcp); }  \
    if (trfreg > tcp_trfreg(tcp)) { trfreg = tcp_trfreg(tcp); }\
    if (hfreg > tcp_hfreg(tcp)) { hfreg = tcp_hfreg(tcp); }      \
    if (efreg < tcp_efreg(tcp)) { efreg = tcp_efreg(tcp); }

#define adjust_level CS_FRAME   ) 
 

Value:

{                                       \
  int new_level = compl_level(CS_FRAME);                                \
  if ( new_level < compl_level(openreg) ) {                             \
    CPtr csf = CS_FRAME;                                                \
    while ( (compl_level(csf) >= new_level) && (csf >= openreg) ) {     \
      compl_level(csf) = new_level;                                     \
      csf = next_compl_frame(csf);                                      \
    }                                                                   \
  }                                                                     \
}

#define ASCC_EDGE_SIZE   (sizeof(struct ascc_edge)/sizeof(CPtr))
 

#define compact_completion_frame cp_frame,
cs_frame,
subgoal   ) 
 

Value:

compl_subgoal_ptr(cp_frame) = subgoal;                  \
  compl_level(cp_frame) = compl_level(cs_frame);                \
  compl_visited(cp_frame) = FALSE;                              \
  compl_DG_edges(cp_frame) = compl_DGT_edges(cp_frame) = NULL;  \
  cp_frame = next_compl_frame(cp_frame)

#define compl_del_ret_list b   )     ((ComplStackFrame)(b))->del_ret_list
 

#define compl_DG_edges b   )     ((ComplStackFrame)(b))->DG_edges
 

#define compl_DGT_edges b   )     ((ComplStackFrame)(b))->DGT_edges
 

#define compl_level b   )     ((ComplStackFrame)(b))->_level_num
 

#define compl_subgoal_ptr b   )     ((ComplStackFrame)(b))->subgoal_ptr
 

#define compl_visited b   )     ((ComplStackFrame)(b))->visited
 

#define COMPLFRAMESIZE   (sizeof(struct completion_stack_frame)/sizeof(CPtr))
 

#define COND_ANSWERS   (ALNptr)2
 

#define conssf_consumers SF   )     ((SubConsSF)(SF))->consumers
 

#define conssf_producer SF   )     ((SubConsSF)(SF))->producer
 

#define conssf_timestamp SF   )     ((SubConsSF)(SF))->ts
 

#define cps_check_mark_tif pTIF   )     TIF_Mark(pTIF) = 0x1
 

#define cps_check_unmark_tif pTIF   )     TIF_Mark(pTIF) = 0x0
 

#define DCF_ClRef pDCF   )     ( (pDCF)->clref )
 

#define DCF_Mark pDCF   )     ( (pDCF)->mark )
 

#define DCF_NextDCF pDCF   )     ( (pDCF)->next_delCF )
 

#define DCF_NextPredDCF pDCF   )     ( (pDCF)->next_pred_delCF )
 

#define DCF_PrevDCF pDCF   )     ( (pDCF)->prev_delCF )
 

#define DCF_PrevPredDCF pDCF   )     ( (pDCF)->prev_pred_delCF )
 

#define DCF_PrRef pDCF   )     ( (pDCF)->prref )
 

#define DCF_PSC pDCF   )     ( (pDCF)->psc )
 

#define DCF_Type pDCF   )     ( (pDCF)->type )
 

#define DELAYED   -1
 

#define DELETED_CLREF   1
 

#define DELETED_PREDICATE   0
 

#define DELETED_PRREF   0
 

#define DELETED_SUBGOAL   1
 

#define DTF_CallTrie pDTF   )     ( (pDTF)->call_trie )
 

#define DTF_Mark pDTF   )     ( (pDTF)->mark )
 

#define DTF_NextDTF pDTF   )     ( (pDTF)->next_delTF )
 

#define DTF_NextPredDTF pDTF   )     ( (pDTF)->next_pred_delTF )
 

#define DTF_PrevDTF pDTF   )     ( (pDTF)->prev_delTF )
 

#define DTF_PrevPredDTF pDTF   )     ( (pDTF)->prev_pred_delTF )
 

#define DTF_Subgoal pDTF   )     ( (pDTF)->subgoals )
 

#define DTF_Subgoals pDTF   )     ( (pDTF)->subgoals )
 

#define DTF_Type pDTF   )     ( (pDTF)->type )
 

#define edge_to_node  )     ((EPtr)(e))->ascc_node_ptr
 

#define empty_return_handle SF   )     empty_return(SF)
 

#define Free_Global_DelTF_Pred pDTF,
pTIF   ) 
 

Value:

{                               \
  if (DTF_PrevDTF(pDTF) == 0) {                                         \
    deltf_chain_begin = DTF_NextDTF(pDTF);                              \
  }                                                                     \
  else {                                                                \
    DTF_NextDTF(DTF_PrevDTF(pDTF)) = DTF_NextDTF(pDTF);                 \
  }                                                                     \
  if (DTF_NextDTF(pDTF) != 0) {                                         \
    DTF_PrevDTF(DTF_NextDTF(pDTF)) = DTF_PrevDTF(pDTF);                 \
  }                                                                     \
  if (DTF_PrevPredDTF(pDTF) == 0) {                                     \
    TIF_DelTF(pTIF) = DTF_NextDTF(pDTF);                                \
  }                                                                     \
  else {                                                                \
    DTF_NextPredDTF(DTF_PrevPredDTF(pDTF)) = DTF_NextPredDTF(pDTF);     \
  }                                                                     \
  if (DTF_NextPredDTF(pDTF) != 0) {                                     \
    DTF_PrevPredDTF(DTF_NextPredDTF(pDTF)) = DTF_PrevPredDTF(pDTF);     \
  }                                                                     \
  mem_dealloc(pDTF,sizeof(DeletedTableFrame),TABLE_SPACE);              \
}

#define Free_Global_DelTF_Subgoal pDTF,
pTIF   ) 
 

Value:

{                               \
  if (DTF_PrevDTF(pDTF) == 0) {                                         \
    deltf_chain_begin = DTF_NextDTF(pDTF);                              \
  }                                                                     \
  else {                                                                \
    DTF_NextDTF(DTF_PrevDTF(pDTF)) = DTF_NextDTF(pDTF);                 \
  }                                                                     \
  if (DTF_NextDTF(pDTF) != 0) {                                         \
    DTF_PrevDTF(DTF_NextDTF(pDTF)) = DTF_PrevDTF(pDTF);                 \
  }                                                                     \
  if (DTF_PrevPredDTF(pDTF) == 0) {                                     \
    TIF_DelTF(pTIF) = DTF_NextDTF(pDTF);                                \
  }                                                                     \
  if (DTF_PrevPredDTF(pDTF) != 0) {                                     \
    DTF_NextPredDTF(DTF_PrevPredDTF(pDTF)) = DTF_NextPredDTF(pDTF);     \
  }                                                                     \
  if (DTF_NextPredDTF(pDTF) != 0) {                                     \
    DTF_PrevPredDTF(DTF_NextPredDTF(pDTF)) = DTF_PrevPredDTF(pDTF);     \
  }                                                                     \
  mem_dealloc(pDTF,sizeof(DeletedTableFrame),TABLE_SPACE);              \
}

#define Free_Private_TIF pTIF   ) 
 

Value:

{                                       \
    TIFptr tTIF = private_tif_list.first;                               \
    if (tTIF ==  (pTIF)) {                                              \
      private_tif_list.first = TIF_NextTIF((pTIF));                     \
      if  (private_tif_list.last == (pTIF)) private_tif_list.last = NULL; \
    }                                                                   \
    else {                                                              \
      while  (tTIF != NULL && TIF_NextTIF(tTIF) != (pTIF))              \
        tTIF =  TIF_NextTIF(tTIF);                                      \
      if (!tTIF) xsb_exit("Trying to free nonexistent TIF");            \
      if ((pTIF) == private_tif_list.last) private_tif_list.last = tTIF; \
      TIF_NextTIF(tTIF) = TIF_NextTIF((pTIF));                          \
    }                                                                   \
    delete_predicate_table(CTXTc pTIF);                                 \
    mem_dealloc((pTIF),sizeof(TableInfoFrame),TABLE_SPACE);             \
  }

#define Free_Shared_TIF pTIF   ) 
 

Value:

{                                               \
    TIFptr tTIF;                                                        \
    SYS_MUTEX_LOCK( MUTEX_TABLE );                                      \
    tTIF = tif_list.first;                                              \
    if (tTIF ==  (pTIF)) {                                              \
      tif_list.first = TIF_NextTIF((pTIF));                             \
      if  (tif_list.last == (pTIF)) tif_list.last = NULL;               \
    }                                                                   \
    else {                                                              \
      while  (tTIF != NULL && TIF_NextTIF(tTIF) != (pTIF))              \
        tTIF =  TIF_NextTIF(tTIF);                                      \
      if (!tTIF) xsb_exit("Trying to free nonexistent TIF");            \
      if ((pTIF) == tif_list.last) tif_list.last = tTIF;                \
      TIF_NextTIF(tTIF) = TIF_NextTIF((pTIF));                          \
    }                                                                   \
    SYS_MUTEX_UNLOCK( MUTEX_TABLE );                                    \
    delete_predicate_table(CTXTc pTIF);                                 \
    mem_dealloc((pTIF),sizeof(TableInfoFrame),TABLE_SPACE);             \
  }

#define FreeProducerSF SF   ) 
 

Value:

#define get_var_and_attv_nums var_num,
attv_num,
tmp_int   ) 
 

Value:

var_num = tmp_int & 0xffff;                                     \
  attv_num = tmp_int >> 16

#define handle_dispatch_block tip   ) 
 

Value:

if ( isPrivateTIF(tip) ) {                                              \
    TDBptr tdispblk;                                                    \
    tdispblk = (TDBptr) tip;                                            \
    if (th->tid > TDB_MaxThread(tdispblk))                              \
      xsb_abort("Table Dispatch block too small");                      \
    tip = TDB_PrivateTIF(tdispblk,th->tid);                             \
    if (!tip) {                                                         \
      /* this may not be possible, as it may always be initted in get_tip? */\
      tip = New_TIF(CTXTc tdispblk->psc_ptr);                   \
      TDB_PrivateTIF(tdispblk,th->tid) = tip;                           \
    }                                                                   \
  }

#define has_answer_code SUBG_PTR   ) 
 

Value:

#define has_answers SUBG_PTR   )     IsNonNULL(subg_answers(SUBG_PTR))
 

#define has_no_answers SUBG_PTR   )     IsNULL(subg_answers(SUBG_PTR))
 

#define INCOMP_ANSWERS   (ALNptr)3
 

#define is_completed SUBG_PTR   )     subg_is_complete(SUBG_PTR)
 

#define is_leader CSF_PTR   )     (next_tab_level(CSF_PTR) < compl_level(CSF_PTR))
 

#define IsPrivateSF pSF   )     ((subg_sf_type(pSF) & SHARED_PRIVATE_MASK) == PRIVATE_SFT)
 

#define isPrivateTIF pTIF   )     (TIF_EvalMethod(pTIF) == DISPATCH_BLOCK)
 

#define IsProducingSubgoal pSF   )     ( IsVariantProducer(pSF) || IsSubsumptiveProducer(pSF) )
 

#define IsProperlySubsumed pSF   )     IsSubConsSF(pSF)
 

#define IsSharedSF pSF   )     ((subg_sf_type(pSF) & SHARED_PRIVATE_MASK) == SHARED_SFT)
 

#define isSharedTIF pTIF   )     (TIF_EvalMethod(pTIF) != DISPATCH_BLOCK)
 

#define IsSubConsSF pSF   )     ((subg_sf_type(pSF) & VARIANT_SUBSUMPTION_MASK) == SUBSUMED_CONSUMER_SFT)
 

#define IsSubProdSF pSF   )     ((subg_sf_type(pSF) & VARIANT_SUBSUMPTION_MASK) == SUBSUMPTIVE_PRODUCER_SFT)
 

#define IsSubsumptivePredicate pTIF   )     ( TIF_EvalMethod(pTIF) == SUBSUMPTIVE_EVAL_METHOD )
 

#define IsSubsumptiveProducer pSF   )     IsSubProdSF(pSF)
 

#define IsVariantPredicate pTIF   )     ( TIF_EvalMethod(pTIF) == VARIANT_EVAL_METHOD )
 

#define IsVariantProducer pSF   )     IsVariantSF(pSF)
 

#define IsVariantSF pSF   )     ((subg_sf_type(pSF) & VARIANT_SUBSUMPTION_MASK) == VARIANT_PRODUCER_SFT)
 

#define mark_as_completed SUBG_PTR   ) 
 

Value:

{               \
          subg_is_complete(SUBG_PTR) = TRUE;    \
          reclaim_del_ret_list(SUBG_PTR);       \
        }

#define mark_delayed csf1,
csf2,
susp   ) 
 

Value:

{ \
          compl_visited(csf1) = DELAYED; \
          compl_visited(csf2) = DELAYED; \
  /* do not put TRUE but some !0 value that GC can recognize as int tagged */\
          csf_neg_loop(susp) = XSB_INT; \
        }

#define mark_subgoal_failed SUBG_PTR   )     (subg_ans_root_ptr(SUBG_PTR) = NULL)
 

#define neg_simplif_possible SUBG_PTR   )     ((subgoal_fails(SUBG_PTR)) && (subg_nde_list(SUBG_PTR) != NULL))
 

#define New_Global_DelTF_Pred pDTF,
pTIF   ) 
 

Value:

{                               \
   pDTF = (DelTFptr)mem_alloc(sizeof(DeletedTableFrame),TABLE_SPACE);   \
   if ( IsNULL(pDTF) )                                                  \
     xsb_abort("Ran out of memory in allocation of DeletedTableFrame"); \
   DTF_CallTrie(pDTF) = TIF_CallTrie(pTIF);                             \
   DTF_Subgoals(pDTF) = TIF_Subgoals(pTIF);                             \
   DTF_Type(pDTF) = DELETED_PREDICATE;                                  \
   DTF_Mark(pDTF) = 0;                                                  \
   DTF_PrevDTF(pDTF) = 0;                                               \
   DTF_PrevPredDTF(pDTF) = 0;                                           \
   DTF_NextDTF(pDTF) = deltf_chain_begin;                               \
   DTF_NextPredDTF(pDTF) = TIF_DelTF(pTIF);                             \
   if (deltf_chain_begin) DTF_PrevDTF(deltf_chain_begin) = pDTF;        \
   if (TIF_DelTF(pTIF))  DTF_PrevPredDTF(TIF_DelTF(pTIF)) = pDTF;       \
   deltf_chain_begin = pDTF;                                            \
   TIF_DelTF(pTIF) = pDTF;                                              \
  }

#define New_Global_DelTF_Subgoal pDTF,
pTIF,
pSubgoal   ) 
 

Value:

{                       \
   pDTF = (DelTFptr)mem_alloc(sizeof(DeletedTableFrame),TABLE_SPACE);   \
   if ( IsNULL(pDTF) )                                                  \
     xsb_abort("Ran out of memory in allocation of DeletedTableFrame"); \
   DTF_CallTrie(pDTF) = NULL;                                           \
   DTF_Subgoal(pDTF) = pSubgoal;                                        \
   DTF_Type(pDTF) = DELETED_SUBGOAL;                                            \
   DTF_Mark(pDTF) = 0;                                                  \
   DTF_PrevDTF(pDTF) = 0;                                               \
   DTF_PrevPredDTF(pDTF) = 0;                                           \
   DTF_NextDTF(pDTF) = deltf_chain_begin;                               \
   DTF_NextPredDTF(pDTF) = TIF_DelTF(pTIF);                             \
   if (deltf_chain_begin) DTF_PrevDTF(deltf_chain_begin) = pDTF;        \
   if (TIF_DelTF(pTIF))  DTF_PrevPredDTF(TIF_DelTF(pTIF)) = pDTF;       \
   deltf_chain_begin = pDTF;                                            \
   TIF_DelTF(pTIF) = pDTF;                                              \
  }

#define NewSubConsSF SF,
Leaf,
TableInfo,
Producer   ) 
 

Value:

{               \
                                                                \
   void *pNewSF;                                                \
                                                                \
   SM_AllocateStruct(smConsSF,pNewSF);                          \
   pNewSF = memset(pNewSF,0,sizeof(subsumptive_consumer_sf));   \
   subg_sf_type(pNewSF) = SUBSUMED_CONSUMER_SFT;                \
   subg_tif_ptr(pNewSF) = TableInfo;                            \
   subg_leaf_ptr(pNewSF) = Leaf;                                \
   CallTrieLeaf_SetSF(Leaf,pNewSF);                             \
   conssf_producer(pNewSF) = (SubProdSF)Producer;               \
   if ( ! ProducerSubsumesSubgoals(Producer) )                  \
     tstCreateTSIs_handle((TSTNptr)subg_ans_root_ptr(Producer));                \
   subg_ans_list_ptr(pNewSF) = empty_return_handle(pNewSF);             \
   conssf_timestamp(pNewSF) = CONSUMER_SF_INITIAL_TS;           \
   conssf_consumers(pNewSF) = subg_consumers(Producer);         \
   subg_consumers(Producer) = (SubConsSF)pNewSF;                \
   SF = (VariantSF)pNewSF;                                      \
}

#define next_compl_frame b   )     (((CPtr)(b))-COMPLFRAMESIZE)
 

#define next_edge  )     ((EPtr)(e))->next
 

#define next_tab_level CSF_PTR   )     compl_level(prev_compl_frame(CSF_PTR))
 

#define NO_ANSWERS   (ALNptr)0
 

#define pdlempty   (pdlreg == (CPtr)(pdl.high) - 1)
 

#define pdlpop   *(++pdlreg)
 

#define pdlpush cell   )     *(pdlreg) = cell; pdlreg--
 

#define prev_compl_frame b   )     (((CPtr)(b))+COMPLFRAMESIZE)
 

#define PRIVATE_SFT   0x00
 

#define ProducerSubsumesSubgoals pSF   )     ( IsSubsumptiveProducer(pSF) && IsNonNULL(subg_consumers(pSF)) )
 

#define PrRef_DelCF PRREF   )     ( (PRREF)->delcf )
 

#define PrRef_FirstClRef PRREF   )     ( (PRREF)->FirstClRef )
 

#define PrRef_Instr PRREF   )     ( (PRREF)->Instr )
 

#define PrRef_LastClRef PRREF   )     ( (PRREF)->LastClRef )
 

#define PrRef_Mark PRREF   )     ( (PRREF)->mark )
 

#define PrRef_Psc PRREF   )     ( (PRREF)->psc )
 

#define push_completion_frame subgoal   ) 
 

Value:

#define push_completion_frame_batched subgoal   )     compl_DG_edges(openreg) = compl_DGT_edges(openreg) = NULL
 

#define push_completion_frame_common subgoal   ) 
 

Value:

#define reclaim_incomplete_table_structs SUBG_PTR   ) 
 

Value:

{       \
   if ( ! structs_are_reclaimed(SUBG_PTR) ) {           \
     table_complete_entry(SUBG_PTR);                    \
     structs_are_reclaimed(SUBG_PTR) = TRUE;            \
   }                                                    \
 }

#define reclaim_stacks tcp   ) 
 

Value:

if (tcp == root_address) { \
    reset_freeze_registers; \
    /* xsb_dbgmsg("reset registers...."); */ \
  } \
  else { \
    adjust_freeze_registers(tcp); \
    /* xsb_dbgmsg(adjust registers...."); */ \
  }

 
#define remove_incomplete_tables  )     remove_incomplete_tries(CTXTc COMPLSTACKBOTTOM)
 

#define remove_incomplete_tables_loop Endpoint   )     remove_incomplete_tries(Endpoint)
 

#define Reset_Demand_Freeze_Registers
 

#define reset_freeze_registers
 

Value:

#define resetpdl
 

Value:

if (pdlreg < (CPtr) pdl.low) \
     xsb_exit("pdlreg grew too much"); \
   else (pdlreg = (CPtr)(pdl.high) - 1)

#define set_min a,
b,
 )     if (b < c) a = b; else a = c
 

#define SF_AppendNewAnswer pSF,
pAns   )     SF_AppendToAnswerList(pSF,pAns,pAns)
 

#define SF_AppendNewAnswerList pSF,
pAnsList   ) 
 

Value:

{       \
                                                \
   ALNptr pLast;                                \
                                                \
   pLast = pAnsList;                            \
   while ( IsNonNULL(ALN_Next(pLast)) )         \
     pLast = ALN_Next(pLast);                   \
   SF_AppendToAnswerList(pSF,pAnsList,pLast);   \
 }

#define SF_AppendToAnswerList pSF,
pHead,
pTail   ) 
 

Value:

{                       \
   if ( has_answers(pSF) )                                              \
     /*
      *  Insert new answer at the end of the answer list.
      */                                                                \
     ALN_Next(subg_ans_list_tail(pSF)) = pHead;                         \
   else                                                                 \
     /*
      * The dummy answer list node is the only node currently in the list.
      * It's pointed to by the head ptr, but the tail ptr is NULL.
      */                                                                \
     ALN_Next(subg_ans_list_ptr(pSF)) = pHead;                          \
   subg_ans_list_tail(pSF) = pTail;                                     \
 }

#define SHARED_PRIVATE_MASK   0x04
 

#define SHARED_SFT   0x04
 

#define structs_are_reclaimed SUBG_PTR   )     subg_is_reclaimed(SUBG_PTR)
 

#define subg_ans_list_ptr b   )     ((VariantSF)(b))->ans_list_ptr
 

#define subg_ans_list_tail b   )     ((VariantSF)(b))->ans_list_tail
 

#define subg_ans_root_ptr b   )     ((VariantSF)(b))->ans_root_ptr
 

#define subg_answers subg   )     ALN_Next(subg_ans_list_ptr(subg))
 

#define subg_asf_list_ptr b   )     ((VariantSF)(b))->asf_list_ptr
 

#define subg_compl_stack_ptr b   )     ((VariantSF)(b))->compl_stack_ptr
 

#define subg_compl_susp_ptr b   )     ((VariantSF)(b))->compl_suspens_ptr
 

#define subg_consumers SF   )     ((SubProdSF)(SF))->consumers
 

#define subg_cp_ptr b   )     ((VariantSF)(b))->cp_ptr
 

#define subg_deltf_ptr b   )     ((VariantSF)(b))->deltf_ptr
 

#define subg_dll_add_sf pSF,
Chain,
NewChain   ) 
 

Value:

{       \
   subg_prev_subgoal(pSF) = NULL;               \
   subg_next_subgoal(pSF) = Chain;              \
   if ( IsNonNULL(Chain) )                      \
     subg_prev_subgoal(Chain) = pSF;            \
   NewChain = (VariantSF)pSF;                           \
 }

#define subg_dll_remove_sf pSF,
Chain,
NewChain   ) 
 

Value:

{                        \
   if ( IsNonNULL(subg_prev_subgoal(pSF)) ) {                            \
     subg_next_subgoal(subg_prev_subgoal(pSF)) = subg_next_subgoal(pSF); \
     NewChain = Chain;                                                   \
   }                                                                     \
   else                                                                  \
     NewChain = (VariantSF)subg_next_subgoal(pSF);                       \
   if ( IsNonNULL(subg_next_subgoal(pSF)) )                              \
     subg_prev_subgoal(subg_next_subgoal(pSF)) = subg_prev_subgoal(pSF); \
   subg_prev_subgoal(pSF) = subg_next_subgoal(pSF) = NULL;               \
 }

#define subg_grabbed b   )     ((VariantSF)(b))->grabbed
 

#define subg_is_complete b   )     ((VariantSF)(b))->is_complete
 

#define subg_is_reclaimed b   )     ((VariantSF)(b))->is_reclaimed
 

#define subg_leaf_ptr b   )     ((VariantSF)(b))->leaf_ptr
 

#define subg_nde_list b   )     ((VariantSF)(b))->nde_list
 

#define subg_next_subgoal b   )     ((VariantSF)(b))->next_subgoal
 

#define subg_prev_subgoal b   )     ((VariantSF)(b))->prev_subgoal
 

#define subg_sf_type b   )     ((VariantSF)(b))->sf_type
 

#define subg_tag b   )     ((VariantSF)(b))->tag
 

#define subg_tid b   )     ((VariantSF)(b))->tid
 

#define subg_tif_ptr b   )     ((VariantSF)(b))->tif_ptr
 

#define subgoal_fails SUBG_PTR   )     ( ! has_answer_code(SUBG_PTR) )
 

#define SUBGOAL_FRAMES_PER_BLOCK   16
 

#define subgoal_space_has_been_reclaimed SUBG_PTR,
CS_FRAME   )     (SUBG_PTR != compl_subgoal_ptr(CS_FRAME))
 

#define subgoal_unconditionally_succeeds SUBG_PTR   ) 
 

Value:

#define SUBSUMED_CONSUMER_SFT   0x00
 

#define SUBSUMPTIVE_PRODUCER_SFT   0x01
 

#define tab_level SUBG_PTR   )     compl_level((subg_compl_stack_ptr(SUBG_PTR)))
 

#define TDB_MaxThread pTDB   )     ( (pTDB)->MaxThread )
 

#define TDB_PrivateTIF pTDB,
tid   )     ( TDB_TIFArray(pTDB)[(tid)] )
 

#define TDB_TIFArray pTDB   )     ( (&(pTDB)->Thread0) )
 

#define TIF_CallTrie pTIF   )     ( (pTIF)->call_trie )
 

#define TIF_DelTF pTIF   )     ( (pTIF)->del_tf_ptr )
 

#define TIF_DispatchBlock pTIF   )     ((TDBptr) (pTIF)->psc_ptr )
 

#define TIF_EvalMethod pTIF   )     ( (pTIF)->method )
 

#define TIF_Mark pTIF   )     ( (pTIF)->mark )
 

#define TIF_NextTIF pTIF   )     ( (pTIF)->next_tif )
 

#define TIF_PSC pTIF   )     ( (pTIF)->psc_ptr )
 

#define TIF_Subgoals pTIF   )     ( (pTIF)->subgoals )
 

#define tstCreateTSIs_handle Producer   )     tstCreateTSIs(Producer)
 

#define UNCOND_ANSWERS   (ALNptr)1
 

#define VARIANT_PRODUCER_SFT   0x02
 

#define VARIANT_SUBSUMPTION_MASK   0x03
 


Typedef Documentation

typedef struct completion_stack_frame* ComplStackFrame
 

typedef struct Deleted_Clause_Frame* DelCFptr
 

typedef struct Deleted_Clause_Frame DeletedClauseFrame
 

typedef struct Deleted_Table_Frame DeletedTableFrame
 

typedef struct Deleted_Table_Frame* DelTFptr
 

typedef struct ascc_edge* EPtr
 

typedef struct SubsumedConsumerSubgoalFrame* SubConsSF
 

typedef struct SubsumptiveProducerSubgoalFrame* SubProdSF
 

typedef struct SubsumedConsumerSubgoalFrame subsumptive_consumer_sf
 

typedef struct SubsumptiveProducerSubgoalFrame subsumptive_producer_sf
 

typedef byte TabledEvalMethod
 

typedef struct Table_Info_Frame TableInfoFrame
 

typedef struct TDispBlk_t* TDBptr
 

typedef struct Table_Info_Frame* TIFptr
 

typedef struct subgoal_frame variant_subgoal_frame
 


Enumeration Type Documentation

enum SubgoalFrameType
 

Enumerator:
SHARED_VARIANT_PRODUCER_SFT 
SHARED_SUBSUMPTIVE_PRODUCER_SFT 
SHARED_SUBSUMED_CONSUMER_SFT 
PRIVATE_VARIANT_PRODUCER_SFT 
PRIVATE_SUBSUMPTIVE_PRODUCER_SFT 
PRIVATE_SUBSUMED_CONSUMER_SFT 


Function Documentation

xsbBool assert_buff_to_clref_p prolog_term  ,
byte  ,
PrRef  ,
int  ,
prolog_term  ,
int  ,
ClRef
 

int assert_code_to_buff_p prolog_term   ) 
 

ALNptr empty_return VariantSF   ) 
 

void tstCreateTSIs TSTNptr   ) 
 


Variable Documentation

TIFptr New_TIF(Psc)
 

typedef PrRefData
 

struct Structure_Manager smConsSF
 

struct Structure_Manager smProdSF
 

struct Structure_Manager smVarSF
 

struct tif_list tif_list
 


Generated on Wed Jul 26 13:26:54 2006 for XSB by  doxygen 1.4.5