-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode.h
More file actions
30 lines (24 loc) · 760 Bytes
/
code.h
File metadata and controls
30 lines (24 loc) · 760 Bytes
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
#ifndef clox_code_h
#define clox_code_h
#include "common.h"
#include "object.h"
/* Number of instruction slots to have between functions in JIT memory.
* The red zone is guaranteed to consist of invalid instructions.
*/
#define JIT_RED_ZONE 1
typedef struct {
void *start;
void *end;
void *free;
void *writable; // Start of writable pages.
size_t available;
ObjFunction **functions; // Sorted by code start address.
size_t functionCount;
size_t functionCapacity;
} Code;
void initCode(Code *code);
void freeCode(Code *code);
void codePushFunctions(Code *code, ObjFunction **functions, size_t count, size_t combinedSize, bool isREPL);
void codeExtend(Code *code, size_t newSize);
void codeRemoveWhite(Code *code);
#endif