Files
corelang/bytecode_interpreter_generated.cpp
2022-06-20 22:14:46 +02:00

348 lines
8.0 KiB
C++

//
// Generated using code_generating_script.py
//
force_inline void
ins_push_s64(Bc *b, S64 value){
auto data = b->stack_pointer;
b->stack_pointer += 2*sizeof(U64);
C(S64, data) = value;
data += sizeof(U64);
C(U64, data) = TYPE_S64;
}
force_inline void
emit_push_s64(Bc *bc, S64 emit_value){
U8 *instruction = (U8 *)arena_push_size(&bc->instructions, sizeof(U8)+sizeof(S64));
*instruction = INS_PUSH_S64;
S64 *value = (S64 *)(instruction + 1);
*value = emit_value;
}
force_inline void
emit_add_s64(Bc *bc){
U8 *instruction = (U8 *)arena_push_size(&bc->instructions, sizeof(U8));
*instruction = INS_ADD_S64;
}
force_inline void
emit_sub_s64(Bc *bc){
U8 *instruction = (U8 *)arena_push_size(&bc->instructions, sizeof(U8));
*instruction = INS_SUB_S64;
}
force_inline void
emit_div_s64(Bc *bc){
U8 *instruction = (U8 *)arena_push_size(&bc->instructions, sizeof(U8));
*instruction = INS_DIV_S64;
}
force_inline void
emit_mul_s64(Bc *bc){
U8 *instruction = (U8 *)arena_push_size(&bc->instructions, sizeof(U8));
*instruction = INS_MUL_S64;
}
force_inline void
emit_mod_s64(Bc *bc){
U8 *instruction = (U8 *)arena_push_size(&bc->instructions, sizeof(U8));
*instruction = INS_MOD_S64;
}
force_inline void
emit_shr_s64(Bc *bc){
U8 *instruction = (U8 *)arena_push_size(&bc->instructions, sizeof(U8));
*instruction = INS_SHR_S64;
}
force_inline void
emit_shl_s64(Bc *bc){
U8 *instruction = (U8 *)arena_push_size(&bc->instructions, sizeof(U8));
*instruction = INS_SHL_S64;
}
force_inline void
emit_bitand_s64(Bc *bc){
U8 *instruction = (U8 *)arena_push_size(&bc->instructions, sizeof(U8));
*instruction = INS_BITAND_S64;
}
force_inline void
emit_bitor_s64(Bc *bc){
U8 *instruction = (U8 *)arena_push_size(&bc->instructions, sizeof(U8));
*instruction = INS_BITOR_S64;
}
force_inline void
emit_bitxor_s64(Bc *bc){
U8 *instruction = (U8 *)arena_push_size(&bc->instructions, sizeof(U8));
*instruction = INS_BITXOR_S64;
}
force_inline void
emit_bitnot_s64(Bc *bc){
U8 *instruction = (U8 *)arena_push_size(&bc->instructions, sizeof(U8));
*instruction = INS_BITNOT_S64;
}
force_inline void
emit_eq_s64(Bc *bc){
U8 *instruction = (U8 *)arena_push_size(&bc->instructions, sizeof(U8));
*instruction = INS_EQ_S64;
}
force_inline void
emit_neq_s64(Bc *bc){
U8 *instruction = (U8 *)arena_push_size(&bc->instructions, sizeof(U8));
*instruction = INS_NEQ_S64;
}
force_inline void
emit_gt_s64(Bc *bc){
U8 *instruction = (U8 *)arena_push_size(&bc->instructions, sizeof(U8));
*instruction = INS_GT_S64;
}
force_inline void
emit_lt_s64(Bc *bc){
U8 *instruction = (U8 *)arena_push_size(&bc->instructions, sizeof(U8));
*instruction = INS_LT_S64;
}
force_inline void
emit_or_s64(Bc *bc){
U8 *instruction = (U8 *)arena_push_size(&bc->instructions, sizeof(U8));
*instruction = INS_OR_S64;
}
force_inline void
emit_gte_s64(Bc *bc){
U8 *instruction = (U8 *)arena_push_size(&bc->instructions, sizeof(U8));
*instruction = INS_GTE_S64;
}
force_inline void
emit_lte_s64(Bc *bc){
U8 *instruction = (U8 *)arena_push_size(&bc->instructions, sizeof(U8));
*instruction = INS_LTE_S64;
}
force_inline void
ins_push_u64(Bc *b, U64 value){
auto data = b->stack_pointer;
b->stack_pointer += 2*sizeof(U64);
C(U64, data) = value;
data += sizeof(U64);
C(U64, data) = TYPE_U64;
}
force_inline void
emit_push_u64(Bc *bc, U64 emit_value){
U8 *instruction = (U8 *)arena_push_size(&bc->instructions, sizeof(U8)+sizeof(U64));
*instruction = INS_PUSH_U64;
U64 *value = (U64 *)(instruction + 1);
*value = emit_value;
}
force_inline void
emit_add_u64(Bc *bc){
U8 *instruction = (U8 *)arena_push_size(&bc->instructions, sizeof(U8));
*instruction = INS_ADD_U64;
}
force_inline void
emit_sub_u64(Bc *bc){
U8 *instruction = (U8 *)arena_push_size(&bc->instructions, sizeof(U8));
*instruction = INS_SUB_U64;
}
force_inline void
emit_div_u64(Bc *bc){
U8 *instruction = (U8 *)arena_push_size(&bc->instructions, sizeof(U8));
*instruction = INS_DIV_U64;
}
force_inline void
emit_mul_u64(Bc *bc){
U8 *instruction = (U8 *)arena_push_size(&bc->instructions, sizeof(U8));
*instruction = INS_MUL_U64;
}
force_inline void
emit_mod_u64(Bc *bc){
U8 *instruction = (U8 *)arena_push_size(&bc->instructions, sizeof(U8));
*instruction = INS_MOD_U64;
}
force_inline void
emit_shr_u64(Bc *bc){
U8 *instruction = (U8 *)arena_push_size(&bc->instructions, sizeof(U8));
*instruction = INS_SHR_U64;
}
force_inline void
emit_shl_u64(Bc *bc){
U8 *instruction = (U8 *)arena_push_size(&bc->instructions, sizeof(U8));
*instruction = INS_SHL_U64;
}
force_inline void
emit_bitand_u64(Bc *bc){
U8 *instruction = (U8 *)arena_push_size(&bc->instructions, sizeof(U8));
*instruction = INS_BITAND_U64;
}
force_inline void
emit_bitor_u64(Bc *bc){
U8 *instruction = (U8 *)arena_push_size(&bc->instructions, sizeof(U8));
*instruction = INS_BITOR_U64;
}
force_inline void
emit_bitxor_u64(Bc *bc){
U8 *instruction = (U8 *)arena_push_size(&bc->instructions, sizeof(U8));
*instruction = INS_BITXOR_U64;
}
force_inline void
emit_bitnot_u64(Bc *bc){
U8 *instruction = (U8 *)arena_push_size(&bc->instructions, sizeof(U8));
*instruction = INS_BITNOT_U64;
}
force_inline void
emit_eq_u64(Bc *bc){
U8 *instruction = (U8 *)arena_push_size(&bc->instructions, sizeof(U8));
*instruction = INS_EQ_U64;
}
force_inline void
emit_neq_u64(Bc *bc){
U8 *instruction = (U8 *)arena_push_size(&bc->instructions, sizeof(U8));
*instruction = INS_NEQ_U64;
}
force_inline void
emit_gt_u64(Bc *bc){
U8 *instruction = (U8 *)arena_push_size(&bc->instructions, sizeof(U8));
*instruction = INS_GT_U64;
}
force_inline void
emit_lt_u64(Bc *bc){
U8 *instruction = (U8 *)arena_push_size(&bc->instructions, sizeof(U8));
*instruction = INS_LT_U64;
}
force_inline void
emit_or_u64(Bc *bc){
U8 *instruction = (U8 *)arena_push_size(&bc->instructions, sizeof(U8));
*instruction = INS_OR_U64;
}
force_inline void
emit_gte_u64(Bc *bc){
U8 *instruction = (U8 *)arena_push_size(&bc->instructions, sizeof(U8));
*instruction = INS_GTE_U64;
}
force_inline void
emit_lte_u64(Bc *bc){
U8 *instruction = (U8 *)arena_push_size(&bc->instructions, sizeof(U8));
*instruction = INS_LTE_U64;
}
force_inline void
ins_push_f64(Bc *b, F64 value){
auto data = b->stack_pointer;
b->stack_pointer += 2*sizeof(U64);
C(F64, data) = value;
data += sizeof(U64);
C(U64, data) = TYPE_F64;
}
force_inline void
emit_push_f64(Bc *bc, F64 emit_value){
U8 *instruction = (U8 *)arena_push_size(&bc->instructions, sizeof(U8)+sizeof(F64));
*instruction = INS_PUSH_F64;
F64 *value = (F64 *)(instruction + 1);
*value = emit_value;
}
force_inline void
emit_add_f64(Bc *bc){
U8 *instruction = (U8 *)arena_push_size(&bc->instructions, sizeof(U8));
*instruction = INS_ADD_F64;
}
force_inline void
emit_sub_f64(Bc *bc){
U8 *instruction = (U8 *)arena_push_size(&bc->instructions, sizeof(U8));
*instruction = INS_SUB_F64;
}
force_inline void
emit_div_f64(Bc *bc){
U8 *instruction = (U8 *)arena_push_size(&bc->instructions, sizeof(U8));
*instruction = INS_DIV_F64;
}
force_inline void
emit_mul_f64(Bc *bc){
U8 *instruction = (U8 *)arena_push_size(&bc->instructions, sizeof(U8));
*instruction = INS_MUL_F64;
}
force_inline void
emit_eq_f64(Bc *bc){
U8 *instruction = (U8 *)arena_push_size(&bc->instructions, sizeof(U8));
*instruction = INS_EQ_F64;
}
force_inline void
emit_neq_f64(Bc *bc){
U8 *instruction = (U8 *)arena_push_size(&bc->instructions, sizeof(U8));
*instruction = INS_NEQ_F64;
}
force_inline void
emit_gt_f64(Bc *bc){
U8 *instruction = (U8 *)arena_push_size(&bc->instructions, sizeof(U8));
*instruction = INS_GT_F64;
}
force_inline void
emit_lt_f64(Bc *bc){
U8 *instruction = (U8 *)arena_push_size(&bc->instructions, sizeof(U8));
*instruction = INS_LT_F64;
}
force_inline void
emit_gte_f64(Bc *bc){
U8 *instruction = (U8 *)arena_push_size(&bc->instructions, sizeof(U8));
*instruction = INS_GTE_F64;
}
force_inline void
emit_lte_f64(Bc *bc){
U8 *instruction = (U8 *)arena_push_size(&bc->instructions, sizeof(U8));
*instruction = INS_LTE_F64;
}
//
// **End** of generated using code_generating_script.py
//