Files
corelang/bytecode_interpreter_generated.cpp
2022-06-20 19:27:22 +02:00

235 lines
5.4 KiB
C++

//
// Generated using code_generating_script.py
//
force_inline void
stack_push_s64(Bc *b, S64 value){
U64 allocation_size = 2*sizeof(U64);
auto data = (U8 *)arena_push_size(&b->stack, allocation_size);
C(S64, data) = value;
data += sizeof(U64);
C(U64, data) = TYPE_S64;
b->stack_pointer += allocation_size;
}
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
stack_push_s32(Bc *b, S32 value){
U64 allocation_size = 2*sizeof(U64);
auto data = (U8 *)arena_push_size(&b->stack, allocation_size);
C(S32, data) = value;
data += sizeof(U64);
C(U64, data) = TYPE_S32;
b->stack_pointer += allocation_size;
}
force_inline void
emit_push_s32(Bc *bc, S32 emit_value){
U8 *instruction = (U8 *)arena_push_size(&bc->instructions, sizeof(U8)+sizeof(S32));
*instruction = INS_PUSH_S32;
S32 *value = (S32 *)(instruction + 1);
*value = emit_value;
}
force_inline void
stack_push_s16(Bc *b, S16 value){
U64 allocation_size = 2*sizeof(U64);
auto data = (U8 *)arena_push_size(&b->stack, allocation_size);
C(S16, data) = value;
data += sizeof(U64);
C(U64, data) = TYPE_S16;
b->stack_pointer += allocation_size;
}
force_inline void
emit_push_s16(Bc *bc, S16 emit_value){
U8 *instruction = (U8 *)arena_push_size(&bc->instructions, sizeof(U8)+sizeof(S16));
*instruction = INS_PUSH_S16;
S16 *value = (S16 *)(instruction + 1);
*value = emit_value;
}
force_inline void
stack_push_s8(Bc *b, S8 value){
U64 allocation_size = 2*sizeof(U64);
auto data = (U8 *)arena_push_size(&b->stack, allocation_size);
C(S8, data) = value;
data += sizeof(U64);
C(U64, data) = TYPE_S8;
b->stack_pointer += allocation_size;
}
force_inline void
emit_push_s8(Bc *bc, S8 emit_value){
U8 *instruction = (U8 *)arena_push_size(&bc->instructions, sizeof(U8)+sizeof(S8));
*instruction = INS_PUSH_S8;
S8 *value = (S8 *)(instruction + 1);
*value = emit_value;
}
force_inline void
stack_push_u64(Bc *b, U64 value){
U64 allocation_size = 2*sizeof(U64);
auto data = (U8 *)arena_push_size(&b->stack, allocation_size);
C(U64, data) = value;
data += sizeof(U64);
C(U64, data) = TYPE_U64;
b->stack_pointer += allocation_size;
}
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
stack_push_u32(Bc *b, U32 value){
U64 allocation_size = 2*sizeof(U64);
auto data = (U8 *)arena_push_size(&b->stack, allocation_size);
C(U32, data) = value;
data += sizeof(U64);
C(U64, data) = TYPE_U32;
b->stack_pointer += allocation_size;
}
force_inline void
emit_push_u32(Bc *bc, U32 emit_value){
U8 *instruction = (U8 *)arena_push_size(&bc->instructions, sizeof(U8)+sizeof(U32));
*instruction = INS_PUSH_U32;
U32 *value = (U32 *)(instruction + 1);
*value = emit_value;
}
force_inline void
stack_push_u16(Bc *b, U16 value){
U64 allocation_size = 2*sizeof(U64);
auto data = (U8 *)arena_push_size(&b->stack, allocation_size);
C(U16, data) = value;
data += sizeof(U64);
C(U64, data) = TYPE_U16;
b->stack_pointer += allocation_size;
}
force_inline void
emit_push_u16(Bc *bc, U16 emit_value){
U8 *instruction = (U8 *)arena_push_size(&bc->instructions, sizeof(U8)+sizeof(U16));
*instruction = INS_PUSH_U16;
U16 *value = (U16 *)(instruction + 1);
*value = emit_value;
}
force_inline void
stack_push_u8(Bc *b, U8 value){
U64 allocation_size = 2*sizeof(U64);
auto data = (U8 *)arena_push_size(&b->stack, allocation_size);
C(U8, data) = value;
data += sizeof(U64);
C(U64, data) = TYPE_U8;
b->stack_pointer += allocation_size;
}
force_inline void
emit_push_u8(Bc *bc, U8 emit_value){
U8 *instruction = (U8 *)arena_push_size(&bc->instructions, sizeof(U8)+sizeof(U8));
*instruction = INS_PUSH_U8;
U8 *value = (U8 *)(instruction + 1);
*value = emit_value;
}
force_inline void
stack_push_f32(Bc *b, F32 value){
U64 allocation_size = 2*sizeof(U64);
auto data = (U8 *)arena_push_size(&b->stack, allocation_size);
C(F32, data) = value;
data += sizeof(U64);
C(U64, data) = TYPE_F32;
b->stack_pointer += allocation_size;
}
force_inline void
emit_push_f32(Bc *bc, F32 emit_value){
U8 *instruction = (U8 *)arena_push_size(&bc->instructions, sizeof(U8)+sizeof(F32));
*instruction = INS_PUSH_F32;
F32 *value = (F32 *)(instruction + 1);
*value = emit_value;
}
force_inline void
stack_push_f64(Bc *b, F64 value){
U64 allocation_size = 2*sizeof(U64);
auto data = (U8 *)arena_push_size(&b->stack, allocation_size);
C(F64, data) = value;
data += sizeof(U64);
C(U64, data) = TYPE_F64;
b->stack_pointer += allocation_size;
}
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;
}