Fix initial heap grow

This commit is contained in:
lax1dude 2024-11-09 16:57:15 -08:00
parent daf3a1c192
commit a33f96b899

View File

@ -63,7 +63,7 @@ public final class LaxMalloc {
private static native Address addrHeap(int offset); private static native Address addrHeap(int offset);
// Intrinsic function to grow the heap segment // Intrinsic function to grow the heap segment
private static native int growHeapOuter(int bytes); private static native int growHeapOuter(int chunks);
// Intrinsic function to get the minimum direct malloc heap segment ending address // Intrinsic function to get the minimum direct malloc heap segment ending address
private static native Address getHeapMinAddr(); private static native Address getHeapMinAddr();
@ -81,8 +81,11 @@ public final class LaxMalloc {
addrHeap(ADDR_HEAP_INNER_LIMIT).putAddress(addrHeap(ADDR_HEAP_DATA_START)); addrHeap(ADDR_HEAP_INNER_LIMIT).putAddress(addrHeap(ADDR_HEAP_DATA_START));
addrHeap(ADDR_HEAP_OUTER_LIMIT).putAddress(getHeapMinAddr()); addrHeap(ADDR_HEAP_OUTER_LIMIT).putAddress(getHeapMinAddr());
//TODO: Need to handle error setting the heap to its initial size int initialGrowAmount = getHeapMinAddr().toInt() >>> 16 - 1;
growHeapOuter(getHeapMinAddr().toInt() >> 16); if (initialGrowAmount > 0) {
//TODO: Need to handle error setting the heap to its initial size
growHeapOuter(initialGrowAmount);
}
} }
/** /**