mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 08:14:09 -08:00
Fix initial heap grow
This commit is contained in:
parent
daf3a1c192
commit
a33f96b899
|
@ -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());
|
||||||
|
|
||||||
|
int initialGrowAmount = getHeapMinAddr().toInt() >>> 16 - 1;
|
||||||
|
if (initialGrowAmount > 0) {
|
||||||
//TODO: Need to handle error setting the heap to its initial size
|
//TODO: Need to handle error setting the heap to its initial size
|
||||||
growHeapOuter(getHeapMinAddr().toInt() >> 16);
|
growHeapOuter(initialGrowAmount);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue
Block a user