diff Paper/src/initContext.c @ 1:a72446879486

Init paper
author soto <soto@cr.ie.u-ryukyu.ac.jp>
date Thu, 12 Jan 2023 20:28:50 +0900
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Paper/src/initContext.c	Thu Jan 12 20:28:50 2023 +0900
@@ -0,0 +1,15 @@
+void initContext(struct Context* context) {
+    context->heapLimit = sizeof(union Data)*ALLOCATE_SIZE;
+    context->code = (__code(**) (struct Context*)) NEWN(ALLOCATE_SIZE, void*);
+    context->data = NEWN(ALLOCATE_SIZE, union Data*);
+    context->heapStart = NEWN(context->heapLimit, char);
+    context->heap = context->heapStart;
+
+    context->code[C_cs1]    = cs1_stub;
+    context->code[C_cs2]    = cs2_stub;
+    context->code[C_exit_code]    = exit_code_stub;
+    context->code[C_start_code]    = start_code_stub;
+
+    ALLOC_DATA(context, Context);
+    ...
+}