diff runtime/context.h @ 8:8d74ef7fa357

Improved helper macros and added separate Rhope stack in runtime
author Mike Pavone <pavone@retrodev.com>
date Wed, 13 May 2009 23:37:19 -0400
parents
children 079200bc3e75 d2f9b0a9403d
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/runtime/context.h	Wed May 13 23:37:19 2009 -0400
@@ -0,0 +1,33 @@
+#ifndef _CONTEXT_H_
+#define _CONTEXT_H_
+
+#include "thread.h"
+#include "plat_types.h"
+#include "func.h"
+
+#define STACK_CHUNK_SIZE 4096-(sizeof(struct stackchunk *)*2+sizeof(uint32_t))
+
+typedef struct stackchunk {
+	struct    stackchunk * next;
+	struct    stackchunk * prev;
+	uint32_t  used;
+	char      data[STACK_CHUNK_SIZE];
+} stackchunk;
+
+typedef struct {
+	rhope_func       func;
+	struct calldata  *params;
+} unwind_cell;
+
+typedef struct context {
+	stackchunk   *stack_begin;
+	stackchunk   *current_stack;
+	unwind_cell  *unwind;
+} context;
+
+stackchunk * new_stack();
+context * new_context();
+void * alloc_stack(context * ct, uint32_t size);
+struct calldata * alloc_cdata(context * ct, uint32_t num_params);
+void free_stack(context * ct, void * data);
+#endif //_CONTEXT_H_