Mercurial > repos > rhope
comparison runtime/context.h @ 186:ba35ab624ec2
Add support for raw C function output from C backend as well as an option to use Boehm-GC instead of reference counting
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Fri, 07 Oct 2011 00:10:02 -0700 |
parents | f2cb85c53ced |
children |
comparison
equal
deleted
inserted
replaced
185:4580c08fd4e8 | 186:ba35ab624ec2 |
---|---|
5 #include "plat_types.h" | 5 #include "plat_types.h" |
6 #include "func.h" | 6 #include "func.h" |
7 #include "transaction.h" | 7 #include "transaction.h" |
8 | 8 |
9 #define STACK_CHUNK_SIZE 4096-(sizeof(struct stackchunk *)*2+sizeof(char *)) | 9 #define STACK_CHUNK_SIZE 4096-(sizeof(struct stackchunk *)*2+sizeof(char *)) |
10 | |
11 #ifdef RAW_FUNC | |
12 //hack | |
13 typedef int context; | |
14 #else | |
10 | 15 |
11 typedef struct stackchunk { | 16 typedef struct stackchunk { |
12 struct stackchunk * next; | 17 struct stackchunk * next; |
13 struct stackchunk * prev; | 18 struct stackchunk * prev; |
14 char *free_space; | 19 char *free_space; |
21 transaction *transaction; | 26 transaction *transaction; |
22 struct context *runafter; | 27 struct context *runafter; |
23 calldata *resume_cdata; | 28 calldata *resume_cdata; |
24 int32_t resumeable; | 29 int32_t resumeable; |
25 } context; | 30 } context; |
31 #endif | |
26 | 32 |
27 Box(context *,ct,Context); | 33 Box(context *,ct,Context); |
34 #ifndef RAW_FUNC | |
28 stackchunk * new_stack(); | 35 stackchunk * new_stack(); |
29 context * new_context(); | 36 context * new_context(); |
30 void * alloc_stack(context * ct, uint32_t size); | 37 void * alloc_stack(context * ct, uint32_t size); |
31 calldata * alloc_cdata(context * ct, calldata * lastframe, uint32_t num_params); | 38 calldata * alloc_cdata(context * ct, calldata * lastframe, uint32_t num_params); |
32 void free_stack(context * ct, void * data); | 39 void free_stack(context * ct, void * data); |
33 void free_context(context * c); | 40 void free_context(context * c); |
34 void cqueue_init(); | 41 void cqueue_init(); |
35 context * get_cqueue(); | 42 context * get_cqueue(); |
36 int32_t put_cqueue(context * ct); | 43 int32_t put_cqueue(context * ct); |
44 #endif | |
37 object * make_Context(context * ct); | 45 object * make_Context(context * ct); |
38 #endif //_CONTEXT_H_ | 46 #endif //_CONTEXT_H_ |