view 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
line wrap: on
line source

#ifndef _CONTEXT_H_
#define _CONTEXT_H_

#include "thread.h"
#include "plat_types.h"
#include "func.h"
#include "transaction.h"

#define STACK_CHUNK_SIZE 4096-(sizeof(struct stackchunk *)*2+sizeof(char *))

typedef struct stackchunk {
	struct    stackchunk * next;
	struct    stackchunk * prev;
	char      *free_space;
	char      data[STACK_CHUNK_SIZE];
} stackchunk;

typedef struct context {
	stackchunk   *stack_begin;
	stackchunk   *current_stack;
	transaction  *transaction;
} context;

stackchunk * new_stack();
context * new_context();
void * alloc_stack(context * ct, uint32_t size);
calldata * alloc_cdata(context * ct, calldata * lastframe, uint32_t num_params);
void free_stack(context * ct, void * data);
void free_context(context * c);
#endif //_CONTEXT_H_