diff --git a/src/.gitignore b/src/.gitignore index c098f6a121..7768dc95c1 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -11,9 +11,6 @@ pl-atom.ic pl-atom.ih pl-funct.ic pl-funct.ih -pl-codetable.ic -pl-jumptable.ic -pl-vmi.h defatom mkvmi vmi diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9e0d1de0a2..88273c0ed1 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -217,13 +217,17 @@ else() ) endif() -# FIXME: we should create these in the build directory add_custom_target( vmi-metadata - COMMAND ${PROG_MKVMI} ${CMAKE_CURRENT_SOURCE_DIR} - BYPRODUCTS pl-vmi.h pl-codetable.ic pl-jumptable.ic - DEPENDS ${PROG_MKVMI} pl-vmi.c - COMMENT "Generating VMI metadata" + DEPENDS pl-vmi.ih.stamp +) +add_custom_command( + COMMAND ${PROG_MKVMI} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} + COMMAND ${CMAKE_COMMAND} -E touch pl-vmi.ih.stamp + OUTPUT pl-vmi.ih.stamp + DEPENDS ${PROG_MKVMI} pl-vmi.c pl-vmi.ih + COMMENT "Generating VMI metadata into pl-vmi.ih" + VERBATIM ) add_custom_target( diff --git a/src/mkvmi.c b/src/mkvmi.c index 455eaaaaf3..708e66437f 100644 --- a/src/mkvmi.c +++ b/src/mkvmi.c @@ -55,16 +55,16 @@ #include "pl-hash.c" /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -This program creates pl-codetable.c, pl-jumptable.ic and pl-vmi.h from -pl-vmi.c. +This program updates the autogenerated section of pl-vmi.ih from +pl-vmi.c and (the rest of) pl-vmi.ih. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ const char *program; int verbose = 0; const char *vmi_file = "pl-vmi.c"; -const char *ctable_file = "pl-codetable.ic"; -const char *jump_table = "pl-jumptable.ic"; -const char *vmi_hdr = "pl-vmi.h"; +const char *vmi_hdr = "pl-vmi.ih"; +const char auto_begin[] = "/* AUTOGENERATED CONTENT FOLLOWS */"; +const char auto_end[] = "/* AUTOGENERATED CONTENT ABOVE */"; #define MAX_VMI 1000 @@ -276,102 +276,43 @@ mystrlwr(char *to, const char *from) /* my*: Windows name conflict */ return to; } - static int -emit_code_table(const char *to) -{ const char *tmp = "vmi.tmp"; +emit_vmi_hdr(const char *to) +{ const char *tmp = "vmi.tmp"; + FILE *in = fopen(to, "r"); FILE *out = fopen(tmp, "w"); int i; + char buf[1024]; - fprintf(out, "/* File: %s\n\n", to); - fprintf(out, " This file provides a description of the virtual machine instructions\n"); - fprintf(out, " and their arguments. It is used by pl-comp.c to facilitate the\n"); - fprintf(out, " compiler and decompiler, as well as pl-wic.c to save/reload sequences\n"); - fprintf(out, " of virtual machine instructions.\n"); + while (fgets(buf, sizeof(buf), in)) + { fputs(buf, out); + if (strncmp(buf, auto_begin, sizeof(auto_begin) - 1) == 0) + break; + } fprintf(out, "\n"); - fprintf(out, " Note: this file is generated by %s from %s. DO NOT EDIT", program, vmi_file); - fprintf(out, " \n"); - fprintf(out, "*/\n\n"); - fprintf(out, "#include \"pl-incl.h\"\n\n"); - fprintf(out, "const code_info codeTable[] = {\n"); - fprintf(out, " /* {name, ID, flags, #args, argtype} */\n"); + fprintf(out, "#define VM_SIGNATURE 0x%x\n\n", MurmurHashAligned2(synopsis, syn_size, 0x12345678)); + fprintf(out, "/* Lowercase instruction names */\n\n"); for(i=0; i= 1 ) snprintf(buf, sizeof(buf), "%s/%s", argv[0], vmi_file); else snprintf(buf, sizeof(buf), "%s", vmi_file); @@ -401,9 +342,13 @@ main(int argc, char **argv) if ( verbose ) fprintf(stderr, "Found %d VMs\n", vmi_count); - if ( emit_code_table(ctable_file) == 0 && - emit_jump_table(jump_table) == 0 && - emit_code_defs(vmi_hdr) == 0 ) + if ( argc >= 2 ) + { snprintf(buf, sizeof(buf), "%s/%s", argv[1], vmi_hdr); + } else + { snprintf(buf, sizeof(buf), "%s", vmi_hdr); + } + + if ( emit_vmi_hdr(buf) == 0 ) return 0; else return 1; diff --git a/src/pl-codetable.ic b/src/pl-codetable.ic new file mode 100644 index 0000000000..b7c783a6df --- /dev/null +++ b/src/pl-codetable.ic @@ -0,0 +1,16 @@ +/* File: pl-codetable.ic + + This file provides a description of the virtual machine instructions + and their arguments. It is used by pl-comp.c to facilitate the + compiler and decompiler, as well as pl-wic.c to save/reload sequences + of virtual machine instructions. +*/ + +#include "pl-incl.h" + +const code_info codeTable[] = { + /* {name, ID, flags, #args, argtype} */ +#define _VMI(Name, flags, nargs, argtypes) {VM_STRLOWER(Name), Name, flags, nargs, {VM_DEPAREN(argtypes)}}, +#include "pl-vmi.ih" + { NULL, 0, 0, 0, {0} } +}; diff --git a/src/pl-jumptable.ic b/src/pl-jumptable.ic new file mode 100644 index 0000000000..b750c77f4d --- /dev/null +++ b/src/pl-jumptable.ic @@ -0,0 +1,12 @@ +/* File: pl-jumptable.ic + + This file provides the GCC-2 jump-labels to exploit GCC's + support for threaded code. +*/ + +static void *jmp_table[] = +{ +#define _VMI(Name,...) &&Name ## _LBL, +#include "pl-vmi.ih" + NULL +}; diff --git a/src/pl-vmi.h b/src/pl-vmi.h new file mode 100644 index 0000000000..b2ca8b06fc --- /dev/null +++ b/src/pl-vmi.h @@ -0,0 +1,14 @@ +/* File: pl-vmi.h + + This file provides the definition of type code. +*/ + +typedef enum +{ +#define _VMI(Name,...) Name, +#include "pl-vmi.ih" + VMI_END_LIST +} vmi; + +#define I_HIGHEST ((int)VMI_END_LIST) +/* VM_SIGNATURE is defined in pl-vmi.h */ \ No newline at end of file diff --git a/src/pl-vmi.ih b/src/pl-vmi.ih new file mode 100644 index 0000000000..96ed96610b --- /dev/null +++ b/src/pl-vmi.ih @@ -0,0 +1,511 @@ +/* File: pl-vmi.ih + + This file contains the raw prototypes of the virtual machine instructions + defined in pl-vmi.c. It is partially autogenerated; the top section is + handwritten and can be modified, while everything after the text + "AUTOGENERATED CONTENT FOLLOWS" is generated by the mkvmi.c code, reading + from pl-vmi.c. Since nothing in this file will change unless VM instructions + are added, removed, or have their signatures changed, the intent is that + anyone making such a change to pl-vmi.c should also commit the new version + of pl-vmi.h, which will automatically get built during the build process. + + Note that there are no include guards around this file. This is intentional, + as this file is polymorphic and can produce other outputs depending on + what preprocessor macros are defined going in. See also these include files: + + - pl-codetable.ic + - pl-jumptable.ic + - pl-vmi.h +*/ + +#ifndef _VMI +# error "Do not include this file directly!" +#endif + +#ifndef _VMI_SEP +#define _VMI_SEP /* Empty */ +#endif + +#define VM_LOWER(n) VMLCASE_ ## n +#define VM_STRLOWER(n) _VM_STR1(VM_LOWER(n)) +#define _VM_STR1(n) _VM_STR2(n) +#define _VM_STR2(n) #n +#define VM_DEPAREN(parenargs) _VM_DEPAREN2 parenargs +#define _VM_DEPAREN2(args...) args + +/* AUTOGENERATED CONTENT FOLLOWS */ + +#define VM_SIGNATURE 0x9fa44fc5 + +/* Lowercase instruction names */ + +#define VMLCASE_D_BREAK d_break +#define VMLCASE_I_NOP i_nop +#define VMLCASE_H_ATOM h_atom +#define VMLCASE_H_SMALLINT h_smallint +#define VMLCASE_H_NIL h_nil +#define VMLCASE_H_INTEGER h_integer +#define VMLCASE_H_INT64 h_int64 +#define VMLCASE_H_FLOAT h_float +#define VMLCASE_H_MPZ h_mpz +#define VMLCASE_H_MPQ h_mpq +#define VMLCASE_H_STRING h_string +#define VMLCASE_H_VOID h_void +#define VMLCASE_H_VOID_N h_void_n +#define VMLCASE_H_VAR h_var +#define VMLCASE_H_FIRSTVAR h_firstvar +#define VMLCASE_H_FUNCTOR h_functor +#define VMLCASE_H_RFUNCTOR h_rfunctor +#define VMLCASE_H_LIST h_list +#define VMLCASE_H_RLIST h_rlist +#define VMLCASE_H_POP h_pop +#define VMLCASE_H_LIST_FF h_list_ff +#define VMLCASE_B_ATOM b_atom +#define VMLCASE_B_SMALLINT b_smallint +#define VMLCASE_B_NIL b_nil +#define VMLCASE_B_INTEGER b_integer +#define VMLCASE_B_INT64 b_int64 +#define VMLCASE_B_FLOAT b_float +#define VMLCASE_B_MPZ b_mpz +#define VMLCASE_B_MPQ b_mpq +#define VMLCASE_B_STRING b_string +#define VMLCASE_B_ARGVAR b_argvar +#define VMLCASE_B_VAR0 b_var0 +#define VMLCASE_B_VAR1 b_var1 +#define VMLCASE_B_VAR2 b_var2 +#define VMLCASE_B_VAR b_var +#define VMLCASE_B_UNIFY_FIRSTVAR b_unify_firstvar +#define VMLCASE_B_UNIFY_VAR b_unify_var +#define VMLCASE_B_UNIFY_EXIT b_unify_exit +#define VMLCASE_B_UNIFY_FF b_unify_ff +#define VMLCASE_B_UNIFY_VF b_unify_vf +#define VMLCASE_B_UNIFY_FV b_unify_fv +#define VMLCASE_B_UNIFY_VV b_unify_vv +#define VMLCASE_B_UNIFY_FC b_unify_fc +#define VMLCASE_B_UNIFY_VC b_unify_vc +#define VMLCASE_B_EQ_VV b_eq_vv +#define VMLCASE_B_EQ_VC b_eq_vc +#define VMLCASE_B_NEQ_VV b_neq_vv +#define VMLCASE_B_NEQ_VC b_neq_vc +#define VMLCASE_B_ARG_CF b_arg_cf +#define VMLCASE_B_ARG_VF b_arg_vf +#define VMLCASE_B_ARGFIRSTVAR b_argfirstvar +#define VMLCASE_B_FIRSTVAR b_firstvar +#define VMLCASE_B_VOID b_void +#define VMLCASE_B_FUNCTOR b_functor +#define VMLCASE_B_RFUNCTOR b_rfunctor +#define VMLCASE_B_LIST b_list +#define VMLCASE_B_RLIST b_rlist +#define VMLCASE_B_POP b_pop +#define VMLCASE_I_CHP i_chp +#define VMLCASE_I_SSU_CHOICE i_ssu_choice +#define VMLCASE_I_SSU_COMMIT i_ssu_commit +#define VMLCASE_I_ENTER i_enter +#define VMLCASE_I_CONTEXT i_context +#define VMLCASE_I_CALL i_call +#define VMLCASE_I_DEPART i_depart +#define VMLCASE_I_DEPARTATM i_departatm +#define VMLCASE_I_DEPARTM i_departm +#define VMLCASE_I_EXIT i_exit +#define VMLCASE_I_EXITFACT i_exitfact +#define VMLCASE_I_EXITQUERY i_exitquery +#define VMLCASE_I_YIELD i_yield +#define VMLCASE_L_NOLCO l_nolco +#define VMLCASE_L_VAR l_var +#define VMLCASE_L_VOID l_void +#define VMLCASE_L_ATOM l_atom +#define VMLCASE_L_NIL l_nil +#define VMLCASE_L_SMALLINT l_smallint +#define VMLCASE_I_LCALL i_lcall +#define VMLCASE_I_TCALL i_tcall +#define VMLCASE_I_DET i_det +#define VMLCASE_I_CUT i_cut +#define VMLCASE_C_JMP c_jmp +#define VMLCASE_C_OR c_or +#define VMLCASE_C_SOFTIFTHEN c_softifthen +#define VMLCASE_C_IFTHEN c_ifthen +#define VMLCASE_C_DET c_det +#define VMLCASE_C_DETTRUE c_dettrue +#define VMLCASE_C_DETFALSE c_detfalse +#define VMLCASE_C_NOT c_not +#define VMLCASE_C_IFTHENELSE c_ifthenelse +#define VMLCASE_C_FASTCOND c_fastcond +#define VMLCASE_C_FASTCUT c_fastcut +#define VMLCASE_C_VAR c_var +#define VMLCASE_C_VAR_N c_var_n +#define VMLCASE_C_LSCUT c_lscut +#define VMLCASE_C_LCUT c_lcut +#define VMLCASE_I_CUTCHP i_cutchp +#define VMLCASE_C_SCUT c_scut +#define VMLCASE_C_LCUTIFTHEN c_lcutifthen +#define VMLCASE_C_CUT c_cut +#define VMLCASE_C_SOFTIF c_softif +#define VMLCASE_C_SOFTCUT c_softcut +#define VMLCASE_C_END c_end +#define VMLCASE_C_FAIL c_fail +#define VMLCASE_I_FAIL i_fail +#define VMLCASE_I_TRUE i_true +#define VMLCASE_I_VAR i_var +#define VMLCASE_I_NONVAR i_nonvar +#define VMLCASE_I_INTEGER i_integer +#define VMLCASE_I_RATIONAL i_rational +#define VMLCASE_I_FLOAT i_float +#define VMLCASE_I_NUMBER i_number +#define VMLCASE_I_ATOMIC i_atomic +#define VMLCASE_I_ATOM i_atom +#define VMLCASE_I_STRING i_string +#define VMLCASE_I_COMPOUND i_compound +#define VMLCASE_I_CALLABLE i_callable +#define VMLCASE_S_VIRGIN s_virgin +#define VMLCASE_S_UNDEF s_undef +#define VMLCASE_S_STATIC s_static +#define VMLCASE_S_DYNAMIC s_dynamic +#define VMLCASE_S_THREAD_LOCAL s_thread_local +#define VMLCASE_S_INCR_DYNAMIC s_incr_dynamic +#define VMLCASE_S_WRAP s_wrap +#define VMLCASE_S_MULTIFILE s_multifile +#define VMLCASE_S_TRUSTME s_trustme +#define VMLCASE_S_CALLWRAPPER s_callwrapper +#define VMLCASE_S_ALLCLAUSES s_allclauses +#define VMLCASE_S_NEXTCLAUSE s_nextclause +#define VMLCASE_S_LIST s_list +#define VMLCASE_S_MQUAL s_mqual +#define VMLCASE_S_LMQUAL s_lmqual +#define VMLCASE_S_SSU_DET s_ssu_det +#define VMLCASE_S_DET s_det +#define VMLCASE_A_ENTER a_enter +#define VMLCASE_A_INTEGER a_integer +#define VMLCASE_A_INT64 a_int64 +#define VMLCASE_A_MPZ a_mpz +#define VMLCASE_A_MPQ a_mpq +#define VMLCASE_A_DOUBLE a_double +#define VMLCASE_A_VAR a_var +#define VMLCASE_A_VAR0 a_var0 +#define VMLCASE_A_VAR1 a_var1 +#define VMLCASE_A_VAR2 a_var2 +#define VMLCASE_A_FUNC0 a_func0 +#define VMLCASE_A_FUNC1 a_func1 +#define VMLCASE_A_FUNC2 a_func2 +#define VMLCASE_A_FUNC a_func +#define VMLCASE_A_ROUNDTOWARDS_A a_roundtowards_a +#define VMLCASE_A_ROUNDTOWARDS_V a_roundtowards_v +#define VMLCASE_A_ADD a_add +#define VMLCASE_A_MUL a_mul +#define VMLCASE_A_ADD_FC a_add_fc +#define VMLCASE_A_LT a_lt +#define VMLCASE_A_LE a_le +#define VMLCASE_A_GT a_gt +#define VMLCASE_A_GE a_ge +#define VMLCASE_A_EQ a_eq +#define VMLCASE_A_NE a_ne +#define VMLCASE_A_IS a_is +#define VMLCASE_A_FIRSTVAR_IS a_firstvar_is +#define VMLCASE_I_FOPEN i_fopen +#define VMLCASE_I_FCALLDETVA i_fcalldetva +#define VMLCASE_I_FCALLDET0 i_fcalldet0 +#define VMLCASE_I_FCALLDET1 i_fcalldet1 +#define VMLCASE_I_FCALLDET2 i_fcalldet2 +#define VMLCASE_I_FCALLDET3 i_fcalldet3 +#define VMLCASE_I_FCALLDET4 i_fcalldet4 +#define VMLCASE_I_FCALLDET5 i_fcalldet5 +#define VMLCASE_I_FCALLDET6 i_fcalldet6 +#define VMLCASE_I_FCALLDET7 i_fcalldet7 +#define VMLCASE_I_FCALLDET8 i_fcalldet8 +#define VMLCASE_I_FCALLDET9 i_fcalldet9 +#define VMLCASE_I_FCALLDET10 i_fcalldet10 +#define VMLCASE_I_FEXITDET i_fexitdet +#define VMLCASE_I_FOPENNDET i_fopenndet +#define VMLCASE_I_FCALLNDETVA i_fcallndetva +#define VMLCASE_I_FCALLNDET0 i_fcallndet0 +#define VMLCASE_I_FCALLNDET1 i_fcallndet1 +#define VMLCASE_I_FCALLNDET2 i_fcallndet2 +#define VMLCASE_I_FCALLNDET3 i_fcallndet3 +#define VMLCASE_I_FCALLNDET4 i_fcallndet4 +#define VMLCASE_I_FCALLNDET5 i_fcallndet5 +#define VMLCASE_I_FCALLNDET6 i_fcallndet6 +#define VMLCASE_I_FCALLNDET7 i_fcallndet7 +#define VMLCASE_I_FCALLNDET8 i_fcallndet8 +#define VMLCASE_I_FCALLNDET9 i_fcallndet9 +#define VMLCASE_I_FCALLNDET10 i_fcallndet10 +#define VMLCASE_I_FEXITNDET i_fexitndet +#define VMLCASE_I_FREDO i_fredo +#define VMLCASE_I_CALLCLEANUP i_callcleanup +#define VMLCASE_I_EXITCLEANUP i_exitcleanup +#define VMLCASE_I_CATCH i_catch +#define VMLCASE_I_EXITCATCH i_exitcatch +#define VMLCASE_B_THROW b_throw +#define VMLCASE_I_CALLATM i_callatm +#define VMLCASE_I_DEPARTATMV i_departatmv +#define VMLCASE_I_CALLATMV i_callatmv +#define VMLCASE_I_CALLM i_callm +#define VMLCASE_I_USERCALL0 i_usercall0 +#define VMLCASE_I_USERCALLN i_usercalln +#define VMLCASE_I_RESET i_reset +#define VMLCASE_I_EXITRESET i_exitreset +#define VMLCASE_I_CALLCONT i_callcont +#define VMLCASE_I_SHIFT i_shift +#define VMLCASE_I_SHIFTCP i_shiftcp +#define VMLCASE_S_TRIE_GEN s_trie_gen +#define VMLCASE_T_TRIE_GEN2 t_trie_gen2 +#define VMLCASE_T_TRIE_GEN3 t_trie_gen3 +#define VMLCASE_T_VALUE t_value +#define VMLCASE_T_DELAY t_delay +#define VMLCASE_T_TRY_FUNCTOR t_try_functor +#define VMLCASE_T_FUNCTOR t_functor +#define VMLCASE_T_POP t_pop +#define VMLCASE_T_POPN t_popn +#define VMLCASE_T_TRY_VAR t_try_var +#define VMLCASE_T_VAR t_var +#define VMLCASE_T_TRY_INTEGER t_try_integer +#define VMLCASE_T_INTEGER t_integer +#define VMLCASE_T_TRY_INT64 t_try_int64 +#define VMLCASE_T_INT64 t_int64 +#define VMLCASE_T_TRY_FLOAT t_try_float +#define VMLCASE_T_FLOAT t_float +#define VMLCASE_T_TRY_MPZ t_try_mpz +#define VMLCASE_T_MPZ t_mpz +#define VMLCASE_T_TRY_STRING t_try_string +#define VMLCASE_T_STRING t_string +#define VMLCASE_T_TRY_ATOM t_try_atom +#define VMLCASE_T_ATOM t_atom +#define VMLCASE_T_TRY_SMALLINT t_try_smallint +#define VMLCASE_T_SMALLINT t_smallint + +/* Instruction definitions */ + +_VMI(D_BREAK, 0, 0, ()) _VMI_SEP +_VMI(I_NOP, 0, 0, ()) _VMI_SEP +_VMI(H_ATOM, 0, 1, (CA1_DATA)) _VMI_SEP +_VMI(H_SMALLINT, 0, 1, (CA1_DATA)) _VMI_SEP +_VMI(H_NIL, 0, 0, ()) _VMI_SEP +_VMI(H_INTEGER, 0, 1, (CA1_INTEGER)) _VMI_SEP +_VMI(H_INT64, 0, WORDS_PER_INT64, (CA1_INT64)) _VMI_SEP +_VMI(H_FLOAT, 0, WORDS_PER_DOUBLE, (CA1_FLOAT)) _VMI_SEP +_VMI(H_MPZ, 0, VM_DYNARGC, (CA1_MPZ)) _VMI_SEP +_VMI(H_MPQ, 0, VM_DYNARGC, (CA1_MPQ)) _VMI_SEP +_VMI(H_STRING, 0, VM_DYNARGC, (CA1_STRING)) _VMI_SEP +_VMI(H_VOID, 0, 0, ()) _VMI_SEP +_VMI(H_VOID_N, 0, 1, (CA1_INTEGER)) _VMI_SEP +_VMI(H_VAR, 0, 1, (CA1_VAR)) _VMI_SEP +_VMI(H_FIRSTVAR, 0, 1, (CA1_FVAR)) _VMI_SEP +_VMI(H_FUNCTOR, 0, 1, (CA1_FUNC)) _VMI_SEP +_VMI(H_RFUNCTOR, 0, 1, (CA1_FUNC)) _VMI_SEP +_VMI(H_LIST, 0, 0, ()) _VMI_SEP +_VMI(H_RLIST, 0, 0, ()) _VMI_SEP +_VMI(H_POP, 0, 0, ()) _VMI_SEP +_VMI(H_LIST_FF, 0, 2, (CA1_FVAR,CA1_FVAR)) _VMI_SEP +_VMI(B_ATOM, VIF_LCO, 1, (CA1_DATA)) _VMI_SEP +_VMI(B_SMALLINT, VIF_LCO, 1, (CA1_DATA)) _VMI_SEP +_VMI(B_NIL, VIF_LCO, 0, ()) _VMI_SEP +_VMI(B_INTEGER, 0, 1, (CA1_INTEGER)) _VMI_SEP +_VMI(B_INT64, 0, WORDS_PER_INT64, (CA1_INT64)) _VMI_SEP +_VMI(B_FLOAT, 0, WORDS_PER_DOUBLE, (CA1_FLOAT)) _VMI_SEP +_VMI(B_MPZ, 0, VM_DYNARGC, (CA1_MPZ)) _VMI_SEP +_VMI(B_MPQ, 0, VM_DYNARGC, (CA1_MPQ)) _VMI_SEP +_VMI(B_STRING, 0, VM_DYNARGC, (CA1_STRING)) _VMI_SEP +_VMI(B_ARGVAR, 0, 1, (CA1_VAR)) _VMI_SEP +_VMI(B_VAR0, VIF_LCO, 0, ()) _VMI_SEP +_VMI(B_VAR1, VIF_LCO, 0, ()) _VMI_S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R, 0, 1, (CA1_FUNC)) _VMI_SEP +_VMI(B_RFUNCTOR, 0, 1, (CA1_FUNC)) _VMI_SEP +_VMI(B_LIST, 0, 0, ()) _VMI_SEP +_VMI(B_RLIST, 0, 0, ()) _VMI_SEP +_VMI(B_POP, 0, 0, ()) _VMI_SEP +_VMI(I_CHP, 0, 0, ()) _VMI_SEP +_VMI(I_SSU_CHOICE, 0, 0, ()) _VMI_SEP +_VMI(I_SSU_COMMIT, 0, 0, ()) _VMI_SEP +_VMI(I_ENTER, VIF_BREAK, 0, ()) _VMI_SEP +_VMI(I_CONTEXT, 0, 1, (CA1_MODULE)) _VMI_SEP +_VMI(I_CALL, VIF_BREAK, 1, (CA1_PROC)) _VMI_SEP +_VMI(I_DEPART, VIF_BREAK, 1, (CA1_PROC)) _VMI_SEP +_VMI(I_DEPARTATM, VIF_BREAK, 3, (CA1_MODULE, CA1_MODULE, CA1_PROC)) _VMI_SEP +_VMI(I_DEPARTM, VIF_BREAK, 2, (CA1_MODULE, CA1_PROC)) _VMI_SEP +_VMI(I_EXIT, VIF_BREAK, 0, ()) _VMI_SEP +_VMI(I_EXITFACT, 0, 0, ()) _VMI_SEP +_VMI(I_EXITQUERY, 0, 0, ()) _VMI_SEP +_VMI(I_YIELD, VIF_BREAK, 0, ()) _VMI_SEP +_VMI(L_NOLCO, 0, 1, (CA1_JUMP)) _VMI_SEP +_VMI(L_VAR, 0, 2, (CA1_FVAR,CA1_VAR)) _VMI_SEP +_VMI(L_VOID, 0, 1, (CA1_FVAR)) _VMI_SEP +_VMI(L_ATOM, 0, 2, (CA1_FVAR,CA1_DATA)) _VMI_SEP +_VMI(L_NIL, 0, 1, (CA1_FVAR)) _VMI_SEP +_VMI(L_SMALLINT, 0, 2, (CA1_FVAR,CA1_DATA)) _VMI_SEP +_VMI(I_LCALL, 0, 1, (CA1_PROC)) _VMI_SEP +_VMI(I_TCALL, 0, 0, ()) _VMI_SEP +_VMI(I_DET, 0, 0, ()) _VMI_SEP +_VMI(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(CA1_VAR)) _VMI_SEP +_VMI(I_NONVAR, VIF_BREAK, 1, (CA1_VAR)) _VMI_SEP +_VMI(I_INTEGER, VIF_BREAK, 1, (CA1_VAR)) _VMI_SEP +_VMI(I_RATIONAL, VIF_BREAK, 1, (CA1_VAR)) _VMI_SEP +_VMI(I_FLOAT, VIF_BREAK, 1, (CA1_VAR)) _VMI_SEP +_VMI(I_NUMBER, VIF_BREAK, 1, (CA1_VAR)) _VMI_SEP +_VMI(I_ATOMIC, VIF_BREAK, 1, (CA1_VAR)) _VMI_SEP +_VMI(I_ATOM, VIF_BREAK, 1, (CA1_VAR)) _VMI_SEP +_VMI(I_STRING, VIF_BREAK, 1, (CA1_VAR)) _VMI_SEP +_VMI(I_COMPOUND, VIF_BREAK, 1, (CA1_VAR)) _VMI_SEP +_VMI(I_CALLABLE, VIF_BREAK, 1, (CA1_VAR)) _VMI_SEP +_VMI(S_VIRGIN, 0, 0, ()) _VMI_SEP +_VMI(S_UNDEF, 0, 0, ()) _VMI_SEP +_VMI(S_STATIC, 0, 0, ()) _VMI_SEP +_VMI(S_DYNAMIC, 0, 0, ()) _VMI_SEP +_VMI(S_THREAD_LOCAL, 0, 0, ()) _VMI_SEP +_VMI(S_INCR_DYNAMIC, 0, 0, ()) _VMI_SEP +_VMI(S_WRAP, 0, 0, ()) _VMI_SEP +_VMI(S_MULTIFILE, 0, 0, ()) _VMI_SEP +_VMI(S_TRUSTME, 0, 1, (CA1_CLAUSEREF)) _VMI_SEP +_VMI(S_CALLWRAPPER, 0, 3, (CA1_CLAUSEREF,CA1_DATA,CA1_DATA)) _VMI_SEP +_VMI(S_ALLCLAUSES, 0, 0, ()) _VMI_SEP +_VMI(S_NEXTCLAUSE, 0, 0, ()) _VMI_SEP +_VMI(S_LIST, 0, 2, (CA1_CLAUSEREF, CA1_CLAUSEREF)) _VMI_SEP +_VMI(S_MQUAL, 0, 1, (CA1_VAR)) _VMI_SEP +_VMI(S_LMQUAL, 0, 1, (CA1_VAR)) _VMI_SEP +_VMI(S_SSU_DET, 0, 0, ()) _VMI_SEP +_VMI(S_DET, 0, 0, ()) _VMI_SEP +_VMI(A_ENTER, 0, 0, ()) _VMI_SEP +_VMI(A_INTEGER, 0, 1, (CA1_INTEGER)) _VMI_SEP +_VMI(A_INT64, 0, WORDS_PER_INT64, (CA1_INT64)) _VMI_SEP +_VMI(A_MPZ, 0, VM_DYNARGC, (CA1_MPZ)) _VMI_SEP +_VMI(A_MPQ, 0, VM_DYNARGC, (CA1_MPQ)) _VMI_SEP +_VMI(A_DOUBLE, 0, WORDS_PER_DOUBLE, (CA1_FLOAT)) _VMI_SEP +_VMI(A_VAR, 0, 1, (CA1_VAR)) _VMI_SEP +_VMI(A_VAR0, 0, 0, ()) _VMI_SEP +_VMI(A_VAR1, 0, 0, ()) _VMI_SEP +_VMI(A_VAR2, 0, 0, ()) _VMI_SEP +_VMI(A_FUNC0, 0, 1, (CA1_AFUNC)) _VMI_SEP +_VMI(A_FUNC1, 0, 1, (CA1_AFUNC)) _VMI_SEP +_VMI(A_FUNC2, 0, 1, (CA1_AFUNC)) _VMI_SEP +_VMI(A_FUNC, 0, 2, (CA1_AFUNC, CA1_INTEGER)) _VMI_SEP +_VMI(A_ROUNDTOWARDS_A, 0, 1, (CA1_INTEGER)) _VMI_SEP +_VMI(A_ROUNDTOWARDS_V, 0, 1, (CA1_VAR)) _VMI_SEP +_VMI(A_ADD, 0, 0, ()) _VMI_SEP +_VMI(A_MUL, 0, 0, ()) _VMI_SEP +_VMI(A_ADD_FC, VIF_BREAK, 3, (CA1_FVAR, CA1_VAR, CA1_INTEGER)) _VMI_SEP +_VMI(A_LT, VIF_BREAK, 0, ()) _VMI_SEP +_VMI(A_LE, VIF_BREAK, 0, ()) _VMI_SEP +_VMI(A_GT, VIF_BREAK, 0, ()) _VMI_SEP +_VMI(A_GE, VIF_BREAK, 0, ()) _VMI_SEP +_VMI(A_EQ, VIF_BREAK, 0, ()) _VMI_SEP +_VMI(A_NE, VIF_BREAK, 0, ()) _VMI_SEP +_VMI(A_IS, VIF_BREAK, 0, ()) _VMI_SEP +_VMI(A_FIRSTVAR_IS, VIF_BREAK, 1, (CA1_FVAR)) _VMI_SEP +_VMI(I_FOPEN, 0, 0, ()) _VMI_SEP +_VMI(I_FCALLDETVA, 0, 1, (CA1_FOREIGN)) _VMI_SEP +_VMI(I_FCALLDET0, 0, 1, (CA1_FOREIGN)) _VMI_SEP +_VMI(I_FCALLDET1, 0, 1, (CA1_FOREIGN)) _VMI_SEP +_VMI(I_FCALLDET2, 0, 1, (CA1_FOREIGN)) _VMI_SEP +_VMI(I_FCALLDET3, 0, 1, (CA1_FOREIGN)) _VMI_SEP +_VMI(I_FCALLDET4, 0, 1, (CA1_FOREIGN)) _VMI_SEP +_VMI(I_FCALLDET5, 0, 1, (CA1_FOREIGN)) _VMI_SEP +_VMI(I_FCALLDET6, 0, 1, (CA1_FOREIGN)) _VMI_SEP +_VMI(I_FCALLDET7, 0, 1, (CA1_FOREIGN)) _VMI_SEP +_VMI(I_FCALLDET8, 0, 1, (CA1_FOREIGN)) _VMI_SEP +_VMI(I_FCALLDET9, 0, 1, (CA1_FOREIGN)) _VMI_SEP +_VMI(I_FCALLDET10, 0, 1, (CA1_FOREIGN)) _VMI_SEP +_VMI(I_FEXITDET, 0, 0, ()) _VMI_SEP +_VMI(I_FOPENNDET, 0, 0, ()) _VMI_SEP +_VMI(I_FCALLNDETVA, 0, 1, (CA1_FOREIGN)) _VMI_SEP +_VMI(I_FCALLNDET0, 0, 1, (CA1_FOREIGN)) _VMI_SEP +_VMI(I_FCALLNDET1, 0, 1, (CA1_FOREIGN)) _VMI_SEP +_VMI(I_FCALLNDET2, 0, 1, (CA1_FOREIGN)) _VMI_SEP +_VMI(I_FCALLNDET3, 0, 1, (CA1_FOREIGN)) _VMI_SEP +_VMI(I_FCALLNDET4, 0, 1, (CA1_FOREIGN)) _VMI_SEP +_VMI(I_FCALLNDET5, 0, 1, (CA1_FOREIGN)) _VMI_SEP +_VMI(I_FCALLNDET6, 0, 1, (CA1_FOREIGN)) _VMI_SEP +_VMI(I_FCALLNDET7, 0, 1, (CA1_FOREIGN)) _VMI_SEP +_VMI(I_FCALLNDET8, 0, 1, (CA1_FOREIGN)) _VMI_SEP +_VMI(I_FCALLNDET9, 0, 1, (CA1_FOREIGN)) _VMI_SEP +_VMI(I_FCALLNDET10, 0, 1, (CA1_FOREIGN)) _VMI_SEP +_VMI(I_FEXITNDET, 0, 0, ()) _VMI_SEP +_VMI(I_FREDO, 0, 0, ()) _VMI_SEP +_VMI(I_CALLCLEANUP, 0, 0, ()) _VMI_SEP +_VMI(I_EXITCLEANUP, 0, 0, ()) _VMI_SEP +_VMI(I_CATCH, 0, 0, ()) _VMI_SEP +_VMI(I_EXITCATCH, 0, 0, ()) _VMI_SEP +_VMI(B_THROW, 0, 0, ()) _VMI_SEP +_VMI(I_CALLATM, VIF_BREAK, 3, (CA1_MODULE, CA1_MODULE, CA1_PROC)) _VMI_SEP +_VMI(I_DEPARTATMV, VIF_BREAK, 3, (CA1_MODULE, CA1_VAR, CA1_PROC)) _VMI_SEP +_VMI(I_CALLATMV, VIF_BREAK, 3, (CA1_MODULE, CA1_VAR, CA1_PROC)) _VMI_SEP +_VMI(I_CALLM, VIF_BREAK, 2, (CA1_MODULE, CA1_PROC)) _VMI_SEP +_VMI(I_USERCALL0, VIF_BREAK, 0, ()) _VMI_SEP +_VMI(I_USERCALLN, VIF_BREAK, 1, (CA1_INTEGER)) _VMI_SEP +_VMI(I_RESET, 0, 0, ()) _VMI_SEP +_VMI(I_EXITRESET, 0, 0, ()) _VMI_SEP +_VMI(I_CALLCONT, 0, 1, (CA1_VAR)) _VMI_SEP +_VMI(I_SHIFT, 0, 1, (CA1_VAR)) _VMI_SEP +_VMI(I_SHIFTCP, 0, 1, (CA1_VAR)) _VMI_SEP +_VMI(S_TRIE_GEN, 0, 0, ()) _VMI_SEP +_VMI(T_TRIE_GEN2, 0, 0, ()) _VMI_SEP +_VMI(T_TRIE_GEN3, 0, 0, ()) _VMI_SEP +_VMI(T_VALUE, 0, 0, ()) _VMI_SEP +_VMI(T_DELAY, 0, 1, (CA1_TRIE_NODE)) _VMI_SEP +_VMI(T_TRY_FUNCTOR, 0, 2, (CA1_JUMP,CA1_FUNC)) _VMI_SEP +_VMI(T_FUNCTOR, 0, 1, (CA1_FUNC)) _VMI_SEP +_VMI(T_POP, 0, 0, ()) _VMI_SEP +_VMI(T_POPN, 0, 1, (CA1_INTEGER)) _VMI_SEP +_VMI(T_TRY_VAR, 0, 2, (CA1_JUMP,CA1_INTEGER)) _VMI_SEP +_VMI(T_VAR, 0, 1, (CA1_INTEGER)) _VMI_SEP +_VMI(T_TRY_INTEGER, 0, 2, (CA1_JUMP,CA1_INTEGER)) _VMI_SEP +_VMI(T_INTEGER, 0, 1, (CA1_INTEGER)) _VMI_SEP +_VMI(T_TRY_INT64, 0, 1+WORDS_PER_INT64, (CA1_JUMP,CA1_INT64)) _VMI_SEP +_VMI(T_INT64, 0, WORDS_PER_INT64, (CA1_INT64)) _VMI_SEP +_VMI(T_TRY_FLOAT, 0, 1+WORDS_PER_DOUBLE, (CA1_JUMP,CA1_FLOAT)) _VMI_SEP +_VMI(T_FLOAT, 0, WORDS_PER_DOUBLE, (CA1_FLOAT)) _VMI_SEP +_VMI(T_TRY_MPZ, 0, VM_DYNARGC, (CA1_JUMP,CA1_MPZ)) _VMI_SEP +_VMI(T_MPZ, 0, VM_DYNARGC, (CA1_MPZ)) _VMI_SEP +_VMI(T_TRY_STRING, 0, VM_DYNARGC, (CA1_JUMP,CA1_STRING)) _VMI_SEP +_VMI(T_STRING, 0, VM_DYNARGC, (CA1_STRING)) _VMI_SEP +_VMI(T_TRY_ATOM, 0, 2, (CA1_JUMP,CA1_DATA)) _VMI_SEP +_VMI(T_ATOM, 0, 1, (CA1_DATA)) _VMI_SEP +_VMI(T_TRY_SMALLINT, 0, 2, (CA1_JUMP,CA1_DATA)) _VMI_SEP +_VMI(T_SMALLINT, 0, 1, (CA1_DATA)) _VMI_SEP + +/* AUTOGENERATED CONTENT ABOVE */ + +#undef _VMI +#undef _VMI_SEP diff --git a/src/pl-wam.c b/src/pl-wam.c index a183d3bb46..8dd9398db3 100644 --- a/src/pl-wam.c +++ b/src/pl-wam.c @@ -2921,7 +2921,7 @@ pl-comp.c #include "pentium.h" #if VMCODE_IS_ADDRESS -#include +#include "pl-jumptable.ic" #define VMI(Name,f,na,a) Name ## _LBL: \ count(Name, PC); \