aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2024-07-02 23:31:16 +0200
committerBad Diode <bd@badd10de.dev>2024-07-02 23:31:16 +0200
commitf89540312aa29b41f10e64f018c50627d1e407a5 (patch)
tree1df49933990d92e355d6534a1f3f3d001f042b94
parent203e955a38fbb1321571444463eeac8ab2d31437 (diff)
downloadbdl-f89540312aa29b41f10e64f018c50627d1e407a5.tar.gz
bdl-f89540312aa29b41f10e64f018c50627d1e407a5.zip
Add a comment with the AR layout
-rw-r--r--src/compiler.c10
1 files changed, 10 insertions, 0 deletions
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) {
907 907
908CompResult 908CompResult
909compile_function(Chunk *chunk, Node *node) { 909compile_function(Chunk *chunk, Node *node) {
910 // The current activation record procedure for the VM is as follows:
911 //
912 // [caller][callee ]
913 // [ .... ][ RET VAL ][ PARAMS ][ LOCALS ][ REGISTERS ][ RET META ]
914 // ^
915 // frame pointer
916 //
917 // The caller is responsible for allocating the return memory and the
918 // parameter memory and filling the param data before OP_CALL.
919 //
910 Chunk *func = chunk_alloc(chunk); 920 Chunk *func = chunk_alloc(chunk);
911 func->name = node->unique_name; 921 func->name = node->unique_name;
912 Function fun = (Function){ 922 Function fun = (Function){