work on method wrapper and native function support

This commit is contained in:
William Bell
2025-08-09 06:40:16 +01:00
parent 38e2cad507
commit 0635ba8517
23 changed files with 404 additions and 324 deletions

View File

@@ -11,22 +11,38 @@
#include "internals/dynamic_array_armem/darray_armem.h"
#include "internals/hashmap/hashmap.h"
extern ArgonObject *ARGON_METHOD_TYPE;
extern Stack *Global_Scope;
typedef struct StackFrame StackFrame;
typedef struct RuntimeState RuntimeState;
typedef struct SourceLocation {
uint64_t line;
uint64_t column;
uint64_t length;
} SourceLocation;
typedef struct call_instance {
struct call_instance *previous;
ArgonObject *to_call;
ArgonObject **args;
size_t args_length;
} call_instance;
typedef struct ErrorCatch {
size_t jump_to;
Stack *stack;
StackFrame *stackFrame;
} ErrorCatch;
} ErrorCatch;
typedef struct RuntimeState {
ArgonObject **registers;
size_t head;
char *path;
call_instance *call_instance;
StackFrame **currentStackFramePointer;
ArgonObject*** call_args;
size_t* call_args_length;
SourceLocation source_location;
DArray catch_errors; // ErrorCatch[]
} RuntimeState;
@@ -46,6 +62,8 @@ extern struct hashmap *runtime_hash_table;
uint64_t runtime_hash(const void *data, size_t len, uint64_t prehash);
void bootstrap_globals();
uint8_t pop_byte(Translated *translated, RuntimeState *state);
uint64_t pop_bytecode(Translated *translated, RuntimeState *state);