int pagesNeeded = Conversions.bytesToPages(resultEnd.diff(result).toInt());
int pagesNeeded = Conversions.bytesToPages(resultEnd.diff(result).toWord().toExtent());
  public VM_Address alloc(int pages) {    memoryResource.acquire(pages);    lock.acquire();    if (base.isZero()) {      base = vmResource.acquire(pages, null);      top = base.add(Conversions.pagesToBytes(pages));    }    int pageIndex = freeList.alloc(pages);    if (pageIndex == -1) {      Log.writeln("RawPageAllocator: unable to satisfy raw page allocation request");      if (VM_Interface.VerifyAssertions) VM_Interface._assert(false);    }    VM_Address result = base.add(Conversions.pagesToBytes(pageIndex));    VM_Address resultEnd = result.add(Conversions.pagesToBytes(pages));    if (resultEnd.GT(top)) {      int pagesNeeded = Conversions.bytesToPages(resultEnd.diff(result).toInt()); // rounded up      VM_Address tmp = vmResource.acquire(pagesNeeded, null);      top = tmp.add(Conversions.pagesToBytes(pagesNeeded));      if (VM_Interface.VerifyAssertions) VM_Interface._assert(resultEnd.LE(top));    }    lock.release();    return result;  }