comparison 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
comparison
equal deleted inserted replaced
7:d61550e2c001 8:8d74ef7fa357
1 #ifndef _CONTEXT_H_
2 #define _CONTEXT_H_
3
4 #include "thread.h"
5 #include "plat_types.h"
6 #include "func.h"
7
8 #define STACK_CHUNK_SIZE 4096-(sizeof(struct stackchunk *)*2+sizeof(uint32_t))
9
10 typedef struct stackchunk {
11 struct stackchunk * next;
12 struct stackchunk * prev;
13 uint32_t used;
14 char data[STACK_CHUNK_SIZE];
15 } stackchunk;
16
17 typedef struct {
18 rhope_func func;
19 struct calldata *params;
20 } unwind_cell;
21
22 typedef struct context {
23 stackchunk *stack_begin;
24 stackchunk *current_stack;
25 unwind_cell *unwind;
26 } context;
27
28 stackchunk * new_stack();
29 context * new_context();
30 void * alloc_stack(context * ct, uint32_t size);
31 struct calldata * alloc_cdata(context * ct, uint32_t num_params);
32 void free_stack(context * ct, void * data);
33 #endif //_CONTEXT_H_