diff --git a/core/src/main/java/org/teavm/backend/wasm/intrinsics/gc/LaxMallocIntrinsic.java b/core/src/main/java/org/teavm/backend/wasm/intrinsics/gc/LaxMallocIntrinsic.java index 9aa6f2ff6..21cc3a764 100644 --- a/core/src/main/java/org/teavm/backend/wasm/intrinsics/gc/LaxMallocIntrinsic.java +++ b/core/src/main/java/org/teavm/backend/wasm/intrinsics/gc/LaxMallocIntrinsic.java @@ -17,7 +17,6 @@ package org.teavm.backend.wasm.intrinsics.gc; import java.util.ArrayList; import java.util.List; - import org.teavm.ast.InvocationExpr; import org.teavm.backend.wasm.model.expression.WasmExpression; import org.teavm.backend.wasm.model.expression.WasmInt32Constant; @@ -72,12 +71,12 @@ public class LaxMallocIntrinsic implements WasmGCIntrinsic { } public void setHeapLocation(int heapLoc) { - for(LaxMallocHeapMapper mapper : addressList) { + for (LaxMallocHeapMapper mapper : addressList) { mapper.setHeapLocation(heapLoc); } } - private static interface LaxMallocHeapMapper { + private interface LaxMallocHeapMapper { void setHeapLocation(int heapLoc); } diff --git a/core/src/main/java/org/teavm/backend/wasm/intrinsics/gc/WasmGCIntrinsics.java b/core/src/main/java/org/teavm/backend/wasm/intrinsics/gc/WasmGCIntrinsics.java index 2d47b68ca..348ee01d0 100644 --- a/core/src/main/java/org/teavm/backend/wasm/intrinsics/gc/WasmGCIntrinsics.java +++ b/core/src/main/java/org/teavm/backend/wasm/intrinsics/gc/WasmGCIntrinsics.java @@ -178,8 +178,10 @@ public class WasmGCIntrinsics implements WasmGCIntrinsicProvider { add(new MethodReference(DirectMalloc.class, "malloc", int.class, Address.class), intrinsic); add(new MethodReference(DirectMalloc.class, "calloc", int.class, Address.class), intrinsic); add(new MethodReference(DirectMalloc.class, "free", Address.class, void.class), intrinsic); - add(new MethodReference(DirectMalloc.class, "memcpy", Address.class, Address.class, int.class, void.class), intrinsic); - add(new MethodReference(DirectMalloc.class, "memset", Address.class, int.class, int.class, void.class), intrinsic); + add(new MethodReference(DirectMalloc.class, "memcpy", Address.class, Address.class, int.class, void.class), + intrinsic); + add(new MethodReference(DirectMalloc.class, "memset", Address.class, int.class, int.class, void.class), + intrinsic); add(new MethodReference(DirectMalloc.class, "zmemset", Address.class, int.class, void.class), intrinsic); } diff --git a/core/src/main/java/org/teavm/runtime/LaxMalloc.java b/core/src/main/java/org/teavm/runtime/LaxMalloc.java index 6f77791c4..ea9480391 100644 --- a/core/src/main/java/org/teavm/runtime/LaxMalloc.java +++ b/core/src/main/java/org/teavm/runtime/LaxMalloc.java @@ -173,7 +173,8 @@ public final class LaxMalloc { if (bucketMask != 0L) { // there is a bucket with a larger chunk int availableLargerBucket = Long.numberOfTrailingZeros(bucketMask); - Address largerBucketStartAddr = addrHeap(ADDR_HEAP_BUCKETS_START).add(availableLargerBucket << SIZEOF_PTR_SH); + Address largerBucketStartAddr = addrHeap(ADDR_HEAP_BUCKETS_START) + .add(availableLargerBucket << SIZEOF_PTR_SH); Address largerChunkPtr = largerBucketStartAddr.getAddress(); int largerChunkSize = readChunkSizeStatus(largerChunkPtr); @@ -279,7 +280,7 @@ public final class LaxMalloc { Address ret = chunkPtr.add(4); // clear if requested - if(cleared) { + if (cleared) { DirectMalloc.zmemset(ret, sizeBytes); } @@ -418,7 +419,7 @@ public final class LaxMalloc { Address bucketStartAddr = addrHeap(ADDR_HEAP_BUCKETS_START).add(bucket << SIZEOF_PTR_SH); // test the bucket mask if the bucket is empty - if ((bucketMask & (1L << bucket)) == 0l) { + if ((bucketMask & (1L << bucket)) == 0L) { // bucket is empty, add the free chunk to the list bucketStartAddr.putAddress(chunkPtr); @@ -426,7 +427,7 @@ public final class LaxMalloc { writeChunkNextFreeAddr(chunkPtr, chunkPtr); // set the free bit in bucket mask - bucketMask |= (1L << bucket); + bucketMask |= 1L << bucket; addrHeap(ADDR_HEAP_BUCKETS_FREE_MASK).putLong(bucketMask); } else {