Fix max heap size and hugeAlloc

This commit is contained in:
lax1dude 2024-11-09 20:19:37 -08:00
parent 07293886db
commit 2fcaaa5313
2 changed files with 2 additions and 3 deletions

View File

@ -439,8 +439,7 @@ public class WasmGCTarget implements TeaVMTarget, TeaVMWasmGCHost {
if (enableDirectMallocSupport) {
var minPages = (memorySize - 1) / WasmHeap.PAGE_SIZE + 1;
var maxPages = (memorySize - directMallocMinHeapSize + directMallocMaxHeapSize - 1)
/ WasmHeap.PAGE_SIZE + 1;
var maxPages = (memorySize + directMallocMaxHeapSize - WasmHeap.PAGE_SIZE - 1) / WasmHeap.PAGE_SIZE + 1;
module.setMinMemorySize(minPages);
module.setMaxMemorySize(maxPages);
} else {

View File

@ -283,7 +283,7 @@ public final class LaxMalloc {
allocateMemoryFromChunk(addrIterator, chunkSize, sizeBytes);
// +4 bytes to skip size int
Address ret = chunkPtr.add(4);
Address ret = addrIterator.add(4);
// clear if requested
if (cleared) {