annotate runtime/context.h @ 139:a68e6828d896

Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
author Mike Pavone <pavone@retrodev.com>
date Fri, 19 Nov 2010 04:04:14 -0500
parents d1569087348f
children c14698c512f1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8
8d74ef7fa357 Improved helper macros and added separate Rhope stack in runtime
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1 #ifndef _CONTEXT_H_
8d74ef7fa357 Improved helper macros and added separate Rhope stack in runtime
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
2 #define _CONTEXT_H_
8d74ef7fa357 Improved helper macros and added separate Rhope stack in runtime
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
3
8d74ef7fa357 Improved helper macros and added separate Rhope stack in runtime
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
4 #include "thread.h"
8d74ef7fa357 Improved helper macros and added separate Rhope stack in runtime
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
5 #include "plat_types.h"
8d74ef7fa357 Improved helper macros and added separate Rhope stack in runtime
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
6 #include "func.h"
139
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 67
diff changeset
7 #include "transaction.h"
8
8d74ef7fa357 Improved helper macros and added separate Rhope stack in runtime
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
8
67
d1569087348f Some small optimizations
Mike Pavone <pavone@retrodev.com>
parents: 66
diff changeset
9 #define STACK_CHUNK_SIZE 4096-(sizeof(struct stackchunk *)*2+sizeof(char *))
8
8d74ef7fa357 Improved helper macros and added separate Rhope stack in runtime
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
10
8d74ef7fa357 Improved helper macros and added separate Rhope stack in runtime
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
11 typedef struct stackchunk {
8d74ef7fa357 Improved helper macros and added separate Rhope stack in runtime
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
12 struct stackchunk * next;
8d74ef7fa357 Improved helper macros and added separate Rhope stack in runtime
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
13 struct stackchunk * prev;
67
d1569087348f Some small optimizations
Mike Pavone <pavone@retrodev.com>
parents: 66
diff changeset
14 char *free_space;
8
8d74ef7fa357 Improved helper macros and added separate Rhope stack in runtime
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
15 char data[STACK_CHUNK_SIZE];
8d74ef7fa357 Improved helper macros and added separate Rhope stack in runtime
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
16 } stackchunk;
8d74ef7fa357 Improved helper macros and added separate Rhope stack in runtime
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
17
8d74ef7fa357 Improved helper macros and added separate Rhope stack in runtime
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
18 typedef struct context {
8d74ef7fa357 Improved helper macros and added separate Rhope stack in runtime
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
19 stackchunk *stack_begin;
8d74ef7fa357 Improved helper macros and added separate Rhope stack in runtime
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
20 stackchunk *current_stack;
139
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 67
diff changeset
21 transaction *transaction;
8
8d74ef7fa357 Improved helper macros and added separate Rhope stack in runtime
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
22 } context;
8d74ef7fa357 Improved helper macros and added separate Rhope stack in runtime
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
23
8d74ef7fa357 Improved helper macros and added separate Rhope stack in runtime
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
24 stackchunk * new_stack();
8d74ef7fa357 Improved helper macros and added separate Rhope stack in runtime
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
25 context * new_context();
8d74ef7fa357 Improved helper macros and added separate Rhope stack in runtime
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
26 void * alloc_stack(context * ct, uint32_t size);
66
d4b44ae2e34a New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents: 63
diff changeset
27 calldata * alloc_cdata(context * ct, calldata * lastframe, uint32_t num_params);
d4b44ae2e34a New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents: 63
diff changeset
28 void free_stack(context * ct, void * data);
52
079200bc3e75 String literals almost working. Print moved out of C runtime.
Mike Pavone <pavone@retrodev.com>
parents: 8
diff changeset
29 void free_context(context * c);
8
8d74ef7fa357 Improved helper macros and added separate Rhope stack in runtime
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
30 #endif //_CONTEXT_H_