91961bcec5
1. (list ...) 2. string-* functions 3. (native str) to resolve native functions at runtime 4. Memory fuckups in compiler core unit loading 5. Now can call non-identifiers in compiler
36 lines
682 B
C
36 lines
682 B
C
#pragma once
|
|
#include <stdint.h>
|
|
|
|
#include "vector.h"
|
|
|
|
#define REF_NATIVE (1 << 0)
|
|
struct vm_ref_entry {
|
|
size_t unit_index;
|
|
int flags;
|
|
union {
|
|
size_t ref_index;
|
|
uintptr_t ref_native;
|
|
};
|
|
};
|
|
|
|
struct vm_func_entry {
|
|
size_t argc, local_count;
|
|
uint32_t *bytecode;
|
|
};
|
|
|
|
struct vm_unit {
|
|
struct vector ref_table;
|
|
struct vector functions;
|
|
struct vector strtab;
|
|
|
|
uint64_t *global_pool;
|
|
size_t global_pool_size;
|
|
|
|
int is_loaded;
|
|
};
|
|
|
|
char **unit_add_string(struct vm_unit *u);
|
|
struct vm_func_entry *unit_add_function(struct vm_unit *u);
|
|
struct vm_ref_entry *unit_add_ref(struct vm_unit *u);
|
|
void unit_free(struct vm_unit *u);
|