view runtime/context.h @ 75:0083b2f7b3c7

Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
author Mike Pavone <pavone@retrodev.com>
date Tue, 06 Jul 2010 07:52:59 -0400
parents d1569087348f
children a68e6828d896
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(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;
} 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_