From f89540312aa29b41f10e64f018c50627d1e407a5 Mon Sep 17 00:00:00 2001 From: Bad Diode Date: Tue, 2 Jul 2024 23:31:16 +0200 Subject: Add a comment with the AR layout --- src/compiler.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/compiler.c') diff --git a/src/compiler.c b/src/compiler.c index 9b6a458..98a5e7b 100644 --- a/src/compiler.c +++ b/src/compiler.c @@ -907,6 +907,16 @@ chunk_alloc(Chunk *parent) { CompResult compile_function(Chunk *chunk, Node *node) { + // The current activation record procedure for the VM is as follows: + // + // [caller][callee ] + // [ .... ][ RET VAL ][ PARAMS ][ LOCALS ][ REGISTERS ][ RET META ] + // ^ + // frame pointer + // + // The caller is responsible for allocating the return memory and the + // parameter memory and filling the param data before OP_CALL. + // Chunk *func = chunk_alloc(chunk); func->name = node->unique_name; Function fun = (Function){ -- cgit v1.2.1