Mercurial > repos > rhope
annotate runtime/block_alloc.h @ 189:d0e3a13c1bd9 default tip
Remove old calculator example
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Fri, 07 Oct 2011 00:24:04 -0700 |
parents | 3e20ed8959c4 |
children |
rev | line source |
---|---|
41
1b86a1ee500a
Added faster allocator for small objects
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1 #ifndef BLOCK_ALLOC_H_ |
1b86a1ee500a
Added faster allocator for small objects
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
2 #define BLOCK_ALLOC_H_ |
1b86a1ee500a
Added faster allocator for small objects
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
3 |
1b86a1ee500a
Added faster allocator for small objects
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
4 #ifdef _WIN32 |
1b86a1ee500a
Added faster allocator for small objects
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
5 #define BLOCK_SIZE 1024*16 |
1b86a1ee500a
Added faster allocator for small objects
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
6 #include <windows.h> |
1b86a1ee500a
Added faster allocator for small objects
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
7 |
1b86a1ee500a
Added faster allocator for small objects
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
8 #define block_alloc(size) VirtualAlloc(NULL, size, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); |
48
a24eb366195c
Fixed some bugs introduced in previous commit and moved definition of integer methods out of runtime and into the compiler
Mike Pavone <pavone@retrodev.com>
parents:
41
diff
changeset
|
9 #define block_free(block,size) VirtualFree(block, size, MEM_RELEASE) |
a24eb366195c
Fixed some bugs introduced in previous commit and moved definition of integer methods out of runtime and into the compiler
Mike Pavone <pavone@retrodev.com>
parents:
41
diff
changeset
|
10 |
a24eb366195c
Fixed some bugs introduced in previous commit and moved definition of integer methods out of runtime and into the compiler
Mike Pavone <pavone@retrodev.com>
parents:
41
diff
changeset
|
11 #else |
49
3e20ed8959c4
Added initial FFI implementation, Array type and 64-bit integers
Mike Pavone <pavone@retrodev.com>
parents:
48
diff
changeset
|
12 #define BLOCK_SIZE 1024*4 |
48
a24eb366195c
Fixed some bugs introduced in previous commit and moved definition of integer methods out of runtime and into the compiler
Mike Pavone <pavone@retrodev.com>
parents:
41
diff
changeset
|
13 #include <sys/mman.h> |
a24eb366195c
Fixed some bugs introduced in previous commit and moved definition of integer methods out of runtime and into the compiler
Mike Pavone <pavone@retrodev.com>
parents:
41
diff
changeset
|
14 |
a24eb366195c
Fixed some bugs introduced in previous commit and moved definition of integer methods out of runtime and into the compiler
Mike Pavone <pavone@retrodev.com>
parents:
41
diff
changeset
|
15 #define block_alloc(size) mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0) |
a24eb366195c
Fixed some bugs introduced in previous commit and moved definition of integer methods out of runtime and into the compiler
Mike Pavone <pavone@retrodev.com>
parents:
41
diff
changeset
|
16 #define block_free(block,size) munmap(block, size) |
41
1b86a1ee500a
Added faster allocator for small objects
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
17 |
1b86a1ee500a
Added faster allocator for small objects
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
18 #endif |
1b86a1ee500a
Added faster allocator for small objects
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
19 |
1b86a1ee500a
Added faster allocator for small objects
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
20 #endif //BLOCK_ALLOC_H_ |