blob: 3a141f0052d905fd08041354e31f1cbb7cc818fa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#ifndef AMALGAM_BYTECODE_H
#define AMALGAM_BYTECODE_H
#include "../std/defs.h"
#include "../std/misc.h"
#include "../std/buffer.h"
#include "../defs.h"
#include <setjmp.h>
typedef enum {
NOP, /* To allow hot-patching */
} BytecodeInstruction;
typedef u8 BytecodeInstructionType;
typedef struct {
Buffer/*<instruction data>*/ instructions;
} Bytecode;
typedef struct {
jmp_buf env;
Bytecode *bytecode;
Parser *parser; /* borrowed */
} BytecodeCompilerContext;
CHECK_RESULT int bytecode_init(Bytecode *self, ScopedAllocator *allocator);
/* longjump to self->env on failure */
void generate_bytecode_from_ssa(BytecodeCompilerContext *self);
#endif
|