CodeAlloc changes to eliminate dependency on 4K system page size (bug 545295 r=edwsmith+)

--HG--
extra : convert_revision : f1734da5dae9a73cf52692fc8dd72c25d0f12a14
This commit is contained in:
Edwin Smith 2010-04-05 16:17:01 -04:00
parent e802b90f31
commit 8e9b1ee383
2 changed files with 11 additions and 4 deletions

View File

@ -54,14 +54,15 @@ namespace nanojit
#else
static const int pagesPerAlloc = 16;
#endif
static const int bytesPerPage = 4096;
static const int bytesPerAlloc = pagesPerAlloc * bytesPerPage;
CodeAlloc::CodeAlloc()
: heapblocks(0)
, availblocks(0)
, totalAllocated(0)
{}
, bytesPerPage(VMPI_getVMPageSize())
, bytesPerAlloc(pagesPerAlloc * bytesPerPage)
{
}
CodeAlloc::~CodeAlloc() {
reset();

View File

@ -121,6 +121,12 @@ namespace nanojit
CodeList* availblocks;
size_t totalAllocated;
/** Cached value of VMPI_getVMPageSize */
const size_t bytesPerPage;
/** Number of bytes to request from VMPI layer, always a multiple of the page size */
const size_t bytesPerAlloc;
/** remove one block from a list */
static CodeList* removeBlock(CodeList* &list);
@ -137,7 +143,7 @@ namespace nanojit
void sanity_check();
/** find the beginning of the heapblock terminated by term */
static CodeList* firstBlock(CodeList* term);
CodeList* firstBlock(CodeList* term);
//
// CodeAlloc's SPI. Implementations must be defined by nanojit embedder.