view runtime/context.h @ 58:4c22fe798779

Some small optimizations
author Mike Pavone <pavone@retrodev.com>
date Thu, 08 Oct 2009 03:03:48 -0400
parents d2f9b0a9403d
children 04baa003de5a
line wrap: on
line source

#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 context {
	stackchunk   *stack_begin;
	stackchunk   *current_stack;
} context;

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