From f62a80a1d8fa3bb2ea85632c9d4653c485f40f08 Mon Sep 17 00:00:00 2001 From: lax1dude Date: Fri, 1 Nov 2024 22:01:27 -0700 Subject: [PATCH] Make Address class compile to an i32 --- .../generate/gc/classes/WasmGCTypeMapper.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/core/src/main/java/org/teavm/backend/wasm/generate/gc/classes/WasmGCTypeMapper.java b/core/src/main/java/org/teavm/backend/wasm/generate/gc/classes/WasmGCTypeMapper.java index 220d9fdb5..63839993f 100644 --- a/core/src/main/java/org/teavm/backend/wasm/generate/gc/classes/WasmGCTypeMapper.java +++ b/core/src/main/java/org/teavm/backend/wasm/generate/gc/classes/WasmGCTypeMapper.java @@ -24,6 +24,7 @@ import org.teavm.backend.wasm.model.WasmModule; import org.teavm.backend.wasm.model.WasmPackedType; import org.teavm.backend.wasm.model.WasmStorageType; import org.teavm.backend.wasm.model.WasmType; +import org.teavm.interop.Address; import org.teavm.model.ClassReaderSource; import org.teavm.model.MethodDescriptor; import org.teavm.model.ValueType; @@ -127,12 +128,16 @@ public class WasmGCTypeMapper { } } if (result == null) { - var cls = classes.get(className); - if (cls == null) { - className = "java.lang.Object"; + if(className.equals(Address.class.getName())) { + typeCache.put(className, WasmType.INT32); + }else { + var cls = classes.get(className); + if (cls == null) { + className = "java.lang.Object"; + } + result = classInfoProvider.getClassInfo(className).getType(); + typeCache.put(className, result); } - result = classInfoProvider.getClassInfo(className).getType(); - typeCache.put(className, result); } } return result;