view runtime/block_alloc.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 3e20ed8959c4
children
line wrap: on
line source

#ifndef BLOCK_ALLOC_H_
#define BLOCK_ALLOC_H_

#ifdef _WIN32
#define BLOCK_SIZE 1024*16
#include <windows.h>

#define block_alloc(size)      VirtualAlloc(NULL, size, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
#define block_free(block,size) VirtualFree(block, size, MEM_RELEASE)

#else
#define BLOCK_SIZE 1024*4
#include <sys/mman.h>

#define block_alloc(size)      mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0)
#define block_free(block,size) munmap(block, size)

#endif

#endif //BLOCK_ALLOC_H_