codeSize += stub.assembler.codeSize() + 8;
}
PageManager pm = PageManager.getInstance();
long npages = (codeSize + pm.pageSize() - 1) / pm.pageSize();
// Allocate some native memory for it
long code = pm.allocatePages((int) npages, PageManager.PROT_READ | PageManager.PROT_WRITE);
if (code == 0) {
throw new OutOfMemoryError("allocatePages failed for codeSize=" + codeSize);
}