mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-08 04:08:32 +00:00
Optimize memory layout
Compared to b69f3d2488
, old windows specific fd, zipos and nsync memory ranges in libc/runtime/memtrack.internal.h were kept.
This commit is contained in:
parent
0740e68ea0
commit
555260d2e5
41 changed files with 381 additions and 345 deletions
|
@ -17,10 +17,10 @@
|
|||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/assert.h"
|
||||
#include "libc/intrin/likely.h"
|
||||
#include "libc/intrin/weaken.h"
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/dce.h"
|
||||
#include "libc/intrin/likely.h"
|
||||
#include "libc/intrin/weaken.h"
|
||||
#include "libc/limits.h"
|
||||
#include "libc/log/log.h"
|
||||
#include "libc/macros.internal.h"
|
||||
|
@ -35,8 +35,8 @@
|
|||
#include "libc/sysv/consts/prot.h"
|
||||
#include "libc/sysv/errfuns.h"
|
||||
|
||||
#define BASE 0x50000000
|
||||
#define SIZE 0x2ffe0000
|
||||
#define BASE 0x50040000
|
||||
#define SIZE 0x2ff80000
|
||||
#define P(i) ((void *)(intptr_t)(i))
|
||||
#define EXCHANGE(HOOK, SLOT) \
|
||||
__arena_hook((intptr_t *)weaken(HOOK), (intptr_t *)(&(SLOT)))
|
||||
|
|
|
@ -20,7 +20,10 @@
|
|||
#include "libc/mem/mem.h"
|
||||
|
||||
/**
|
||||
* Equivalent to memalign(PAGESIZE, ROUNDUP(n, PAGESIZE)).
|
||||
* Allocates granular aligned memory of granular size, i.e.
|
||||
*
|
||||
* memalign(sysconf(_SC_PAGESIZE),
|
||||
* ROUNDUP(n, sysconf(_SC_PAGESIZE)));
|
||||
*
|
||||
* @param n number of bytes needed
|
||||
* @return memory address, or NULL w/ errno
|
||||
|
@ -28,5 +31,5 @@
|
|||
* @threadsafe
|
||||
*/
|
||||
void *pvalloc(size_t n) {
|
||||
return memalign(PAGESIZE, ROUNDUP(n, PAGESIZE));
|
||||
return memalign(FRAMESIZE, ROUNDUP(n, FRAMESIZE));
|
||||
}
|
||||
|
|
|
@ -19,7 +19,9 @@
|
|||
#include "libc/mem/mem.h"
|
||||
|
||||
/**
|
||||
* Equivalent to memalign(PAGESIZE, n).
|
||||
* Allocates granular aligned memory, i.e.
|
||||
*
|
||||
* memalign(sysconf(_SC_PAGESIZE), n);
|
||||
*
|
||||
* @param n number of bytes needed
|
||||
* @return memory address, or NULL w/ errno
|
||||
|
@ -27,5 +29,5 @@
|
|||
* @threadsafe
|
||||
*/
|
||||
void *valloc(size_t n) {
|
||||
return memalign(PAGESIZE, n);
|
||||
return memalign(FRAMESIZE, n);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue