GNU PROLOG with UTF8 support
Data Structures | Macros | Enumerations | Functions | Variables
bc_supp.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include "engine_pl.h"
#include "bips_pl.h"
Include dependency graph for bc_supp.c:

Data Structures

union  BCWord
 
union  C64To32
 

Macros

#define OBJ_INIT   Byte_Code_Initializer
 
#define BC_SUPP_FILE
 
#define MAX_OP   100
 
#define BC_BLOCK_SIZE   1024
 
#define ERR_UNKNOWN_INSTRUCTION   "bc_supp: Unknown WAM instruction: %s"
 
#define BC_EMULATE_CONT   X1_2462635F656D756C6174655F636F6E74
 
#define CALL_INTERNAL_WITH_CUT   X1_2463616C6C5F696E7465726E616C5F776974685F637574
 
#define BC_Op(w)   ((w).t1.code_op)
 
#define BC1_X0(w)   ((w).t1.i8)
 
#define BC1_Arity(w)   ((w).t1.i16)
 
#define BC2_Arity(w)   ((w).t2.i24)
 
#define BC1_XY(w)   ((w).t1.i16)
 
#define BC2_XY(w)   ((w).t2.i24)
 
#define BC1_Atom(w)   ((w).t1.i16)
 
#define BC2_Atom(w)   ((w).t2.i24)
 
#define BC1_Int(w)   ((w).t1.i16)
 
#define BC2_Int(w)   ((w).t2.i24)
 
#define Fit_In_16bits(n)   ((PlULong) (n) < (1 << 16))
 
#define Fit_In_24bits(n)   ((PlULong) (n) < (1 << 24))
 
#define Op_In_Tbl(str, op)   BC_Op(*p) = op; BC2_Atom(*p) = Pl_Create_Atom(str); p++
 
#define ASSEMBLE_INST(bc_sp, op, nb_word, w, w1, w2, w3)
 

Enumerations

enum  BCCodOp {
  GET_X_VARIABLE, GET_Y_VARIABLE, GET_X_VALUE, GET_Y_VALUE,
  GET_ATOM, GET_ATOM_BIG, GET_INTEGER, GET_INTEGER_BIG,
  GET_FLOAT, GET_NIL, GET_LIST, GET_STRUCTURE,
  PUT_X_VARIABLE, PUT_Y_VARIABLE, PUT_VOID, PUT_X_VALUE,
  PUT_Y_VALUE, PUT_Y_UNSAFE_VALUE, PUT_ATOM, PUT_ATOM_BIG,
  PUT_INTEGER, PUT_INTEGER_BIG, PUT_FLOAT, PUT_NIL,
  PUT_LIST, PUT_STRUCTURE, MATH_LOAD_X_VALUE, MATH_LOAD_Y_VALUE,
  UNIFY_X_VARIABLE, UNIFY_Y_VARIABLE, UNIFY_VOID, UNIFY_X_VALUE,
  UNIFY_Y_VALUE, UNIFY_X_LOCAL_VALUE, UNIFY_Y_LOCAL_VALUE, UNIFY_ATOM,
  UNIFY_ATOM_BIG, UNIFY_INTEGER, UNIFY_INTEGER_BIG, UNIFY_NIL,
  UNIFY_LIST, UNIFY_STRUCTURE, ALLOCATE, DEALLOCATE,
  CALL, CALL_NATIVE, EXECUTE, EXECUTE_NATIVE,
  PROCEED, FAIL, GET_CURRENT_CHOICE_X, GET_CURRENT_CHOICE_Y,
  CUT_X, CUT_Y, SOFT_CUT_X, SOFT_CUT_Y
}
 

Functions

static int Find_Inst_Code_Op (int inst)
 
static int Compar_Inst_Code_Op (BCWord *w1, BCWord *w2)
 
static int BC_Arg_X_Or_Y (WamWord arg_word, int *op)
 
static int BC_Arg_Func_Arity (WamWord arg_word, int *arity)
 
WamCont Pl_BC_Emulate_Pred (int func, DynPInf *dyn)
 
static WamCont BC_Emulate_Pred_Alt (DynCInf *clause, WamWord *w)
 
static WamCont BC_Emulate_Clause (DynCInf *clause)
 
static WamCont BC_Emulate_Byte_Code (BCWord *bc)
 
static void Prep_Debug_Call (int func, int arity, int caller_func, int caller_arity)
 
 Prolog_Prototype (BC_EMULATE_CONT, 0)
 
 Prolog_Prototype (CALL_INTERNAL_WITH_CUT, 3)
 
static void Byte_Code_Initializer (void)
 
void Pl_BC_Start_Pred_8 (WamWord func_word, WamWord arity_word, WamWord pl_file_word, WamWord pl_line_word, WamWord sta_dyn_word, WamWord pub_priv_word, WamWord mono_multi_word, WamWord us_blp_bfd_word)
 
void Pl_BC_Start_Emit_0 (void)
 
void Pl_BC_Stop_Emit_0 (void)
 
void Pl_BC_Emit_Inst_1 (WamWord inst_word)
 
void Pl_BC_Emit_Inst_Execute_Native (int func, int arity, PlLong *codep)
 
WamCont Pl_BC_Call_Terminal_Pred_3 (WamWord pred_word, WamWord call_info_word, WamWord first_call_word)
 
WamCont Pl_BC_Emulate_Cont_0 (void)
 

Variables

static BCWord op_tbl [MAX_OP]
 
static int nb_op
 
static BCWordbc
 
static BCWordbc_sp
 
static int bc_nb_block
 
static int atom_dynamic
 
static int atom_public
 
static int atom_multifile
 
static int atom_built_in
 
static int atom_built_in_fd
 
static int atom_fail
 
static int caller_func
 
static int caller_arity
 
static int glob_func
 
static DynPInfglob_dyn
 
static Bool debug_call
 
WamCont pl_debug_call_code
 

Macro Definition Documentation

#define ASSEMBLE_INST (   bc_sp,
  op,
  nb_word,
  w,
  w1,
  w2,
  w3 
)
Value:
BC_Op(w) = op; \
*bc_sp++ = w; \
if (nb_word >= 2) \
{ \
bc_sp->word = w1; \
bc_sp++; \
\
if (nb_word >= 3) \
{ \
bc_sp->word = w2; \
bc_sp++; \
if (nb_word >= 4) \
{ \
bc_sp->word = w3; \
bc_sp++; \
} \
} \
}
#define BC_Op(w)
Definition: bc_supp.c:245
unsigned word
Definition: bc_supp.c:160
static BCWord * bc_sp
Definition: bc_supp.c:189
#define BC1_Arity (   w)    ((w).t1.i16)
#define BC1_Atom (   w)    ((w).t1.i16)
#define BC1_Int (   w)    ((w).t1.i16)
#define BC1_X0 (   w)    ((w).t1.i8)
#define BC1_XY (   w)    ((w).t1.i16)
#define BC2_Arity (   w)    ((w).t2.i24)
#define BC2_Atom (   w)    ((w).t2.i24)
#define BC2_Int (   w)    ((w).t2.i24)
#define BC2_XY (   w)    ((w).t2.i24)
#define BC_BLOCK_SIZE   1024
#define BC_EMULATE_CONT   X1_2462635F656D756C6174655F636F6E74
#define BC_Op (   w)    ((w).t1.code_op)
#define BC_SUPP_FILE
#define CALL_INTERNAL_WITH_CUT   X1_2463616C6C5F696E7465726E616C5F776974685F637574
#define ERR_UNKNOWN_INSTRUCTION   "bc_supp: Unknown WAM instruction: %s"
#define Fit_In_16bits (   n)    ((PlULong) (n) < (1 << 16))
#define Fit_In_24bits (   n)    ((PlULong) (n) < (1 << 24))
#define MAX_OP   100
#define OBJ_INIT   Byte_Code_Initializer
#define Op_In_Tbl (   str,
  op 
)    BC_Op(*p) = op; BC2_Atom(*p) = Pl_Create_Atom(str); p++

Enumeration Type Documentation

enum BCCodOp
Enumerator
GET_X_VARIABLE 
GET_Y_VARIABLE 
GET_X_VALUE 
GET_Y_VALUE 
GET_ATOM 
GET_ATOM_BIG 
GET_INTEGER 
GET_INTEGER_BIG 
GET_FLOAT 
GET_NIL 
GET_LIST 
GET_STRUCTURE 
PUT_X_VARIABLE 
PUT_Y_VARIABLE 
PUT_VOID 
PUT_X_VALUE 
PUT_Y_VALUE 
PUT_Y_UNSAFE_VALUE 
PUT_ATOM 
PUT_ATOM_BIG 
PUT_INTEGER 
PUT_INTEGER_BIG 
PUT_FLOAT 
PUT_NIL 
PUT_LIST 
PUT_STRUCTURE 
MATH_LOAD_X_VALUE 
MATH_LOAD_Y_VALUE 
UNIFY_X_VARIABLE 
UNIFY_Y_VARIABLE 
UNIFY_VOID 
UNIFY_X_VALUE 
UNIFY_Y_VALUE 
UNIFY_X_LOCAL_VALUE 
UNIFY_Y_LOCAL_VALUE 
UNIFY_ATOM 
UNIFY_ATOM_BIG 
UNIFY_INTEGER 
UNIFY_INTEGER_BIG 
UNIFY_NIL 
UNIFY_LIST 
UNIFY_STRUCTURE 
ALLOCATE 
DEALLOCATE 
CALL 
CALL_NATIVE 
EXECUTE 
EXECUTE_NATIVE 
PROCEED 
FAIL 
GET_CURRENT_CHOICE_X 
GET_CURRENT_CHOICE_Y 
CUT_X 
CUT_Y 
SOFT_CUT_X 
SOFT_CUT_Y 

Function Documentation

static int BC_Arg_Func_Arity ( WamWord  arg_word,
int *  arity 
)
static

Here is the caller graph for this function:

static int BC_Arg_X_Or_Y ( WamWord  arg_word,
int *  op 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static WamCont BC_Emulate_Byte_Code ( BCWord bc)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static WamCont BC_Emulate_Clause ( DynCInf clause)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static WamCont BC_Emulate_Pred_Alt ( DynCInf clause,
WamWord w 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static void Byte_Code_Initializer ( void  )
static

Here is the call graph for this function:

static int Compar_Inst_Code_Op ( BCWord w1,
BCWord w2 
)
static

Here is the caller graph for this function:

static int Find_Inst_Code_Op ( int  inst)
static

Here is the call graph for this function:

Here is the caller graph for this function:

WamCont Pl_BC_Call_Terminal_Pred_3 ( WamWord  pred_word,
WamWord  call_info_word,
WamWord  first_call_word 
)

Here is the call graph for this function:

void Pl_BC_Emit_Inst_1 ( WamWord  inst_word)

Here is the call graph for this function:

void Pl_BC_Emit_Inst_Execute_Native ( int  func,
int  arity,
PlLong codep 
)

Here is the caller graph for this function:

WamCont Pl_BC_Emulate_Cont_0 ( void  )

Here is the call graph for this function:

WamCont Pl_BC_Emulate_Pred ( int  func,
DynPInf dyn 
)

Here is the call graph for this function:

Here is the caller graph for this function:

void Pl_BC_Start_Emit_0 ( void  )

Here is the caller graph for this function:

void Pl_BC_Start_Pred_8 ( WamWord  func_word,
WamWord  arity_word,
WamWord  pl_file_word,
WamWord  pl_line_word,
WamWord  sta_dyn_word,
WamWord  pub_priv_word,
WamWord  mono_multi_word,
WamWord  us_blp_bfd_word 
)

Here is the call graph for this function:

void Pl_BC_Stop_Emit_0 ( void  )

Here is the caller graph for this function:

static void Prep_Debug_Call ( int  func,
int  arity,
int  caller_func,
int  caller_arity 
)
static

Here is the caller graph for this function:

Prolog_Prototype ( BC_EMULATE_CONT  ,
 
)
Prolog_Prototype ( CALL_INTERNAL_WITH_CUT  ,
 
)

Variable Documentation

int atom_built_in
static
int atom_built_in_fd
static
int atom_dynamic
static
int atom_fail
static
int atom_multifile
static
int atom_public
static
BCWord* bc
static
int bc_nb_block
static
BCWord* bc_sp
static
int caller_arity
static
int caller_func
static
Bool debug_call
static
DynPInf* glob_dyn
static
int glob_func
static
int nb_op
static
BCWord op_tbl[MAX_OP]
static
WamCont pl_debug_call_code