fix style violations

This commit is contained in:
lax1dude 2024-11-02 21:37:48 -07:00
parent fec6caa10f
commit 5c5c92e104
3 changed files with 11 additions and 9 deletions

View File

@ -17,7 +17,6 @@ package org.teavm.backend.wasm.intrinsics.gc;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.teavm.ast.InvocationExpr; import org.teavm.ast.InvocationExpr;
import org.teavm.backend.wasm.model.expression.WasmExpression; import org.teavm.backend.wasm.model.expression.WasmExpression;
import org.teavm.backend.wasm.model.expression.WasmInt32Constant; import org.teavm.backend.wasm.model.expression.WasmInt32Constant;
@ -72,12 +71,12 @@ public class LaxMallocIntrinsic implements WasmGCIntrinsic {
} }
public void setHeapLocation(int heapLoc) { public void setHeapLocation(int heapLoc) {
for(LaxMallocHeapMapper mapper : addressList) { for (LaxMallocHeapMapper mapper : addressList) {
mapper.setHeapLocation(heapLoc); mapper.setHeapLocation(heapLoc);
} }
} }
private static interface LaxMallocHeapMapper { private interface LaxMallocHeapMapper {
void setHeapLocation(int heapLoc); void setHeapLocation(int heapLoc);
} }

View File

@ -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, "malloc", int.class, Address.class), intrinsic);
add(new MethodReference(DirectMalloc.class, "calloc", 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, "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, "memcpy", Address.class, Address.class, int.class, void.class),
add(new MethodReference(DirectMalloc.class, "memset", Address.class, int.class, int.class, void.class), intrinsic); 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); add(new MethodReference(DirectMalloc.class, "zmemset", Address.class, int.class, void.class), intrinsic);
} }

View File

@ -173,7 +173,8 @@ public final class LaxMalloc {
if (bucketMask != 0L) { if (bucketMask != 0L) {
// there is a bucket with a larger chunk // there is a bucket with a larger chunk
int availableLargerBucket = Long.numberOfTrailingZeros(bucketMask); 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(); Address largerChunkPtr = largerBucketStartAddr.getAddress();
int largerChunkSize = readChunkSizeStatus(largerChunkPtr); int largerChunkSize = readChunkSizeStatus(largerChunkPtr);
@ -279,7 +280,7 @@ public final class LaxMalloc {
Address ret = chunkPtr.add(4); Address ret = chunkPtr.add(4);
// clear if requested // clear if requested
if(cleared) { if (cleared) {
DirectMalloc.zmemset(ret, sizeBytes); DirectMalloc.zmemset(ret, sizeBytes);
} }
@ -418,7 +419,7 @@ public final class LaxMalloc {
Address bucketStartAddr = addrHeap(ADDR_HEAP_BUCKETS_START).add(bucket << SIZEOF_PTR_SH); Address bucketStartAddr = addrHeap(ADDR_HEAP_BUCKETS_START).add(bucket << SIZEOF_PTR_SH);
// test the bucket mask if the bucket is empty // 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 // bucket is empty, add the free chunk to the list
bucketStartAddr.putAddress(chunkPtr); bucketStartAddr.putAddress(chunkPtr);
@ -426,7 +427,7 @@ public final class LaxMalloc {
writeChunkNextFreeAddr(chunkPtr, chunkPtr); writeChunkNextFreeAddr(chunkPtr, chunkPtr);
// set the free bit in bucket mask // set the free bit in bucket mask
bucketMask |= (1L << bucket); bucketMask |= 1L << bucket;
addrHeap(ADDR_HEAP_BUCKETS_FREE_MASK).putLong(bucketMask); addrHeap(ADDR_HEAP_BUCKETS_FREE_MASK).putLong(bucketMask);
} else { } else {