From cb1f3c6dfc77c04b05a623dc168d0f4009b8a05b Mon Sep 17 00:00:00 2001 From: Alexey Andreev Date: Thu, 29 Aug 2024 21:14:49 +0200 Subject: [PATCH] wasm gc: fix issue in virtual table generator --- .../backend/wasm/gc/vtable/WasmGCVirtualTableBuilder.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/org/teavm/backend/wasm/gc/vtable/WasmGCVirtualTableBuilder.java b/core/src/main/java/org/teavm/backend/wasm/gc/vtable/WasmGCVirtualTableBuilder.java index 0c2bbdc34..6ef1aa06d 100644 --- a/core/src/main/java/org/teavm/backend/wasm/gc/vtable/WasmGCVirtualTableBuilder.java +++ b/core/src/main/java/org/teavm/backend/wasm/gc/vtable/WasmGCVirtualTableBuilder.java @@ -161,6 +161,7 @@ class WasmGCVirtualTableBuilder { for (var entry : table.entries) { indexes.put(entry.method, entry.index); } + table.currentImplementors.putAll(parent.currentImplementors); } var group = groupedMethodsAtCallSites.get(table.cls.getName()); @@ -170,7 +171,7 @@ class WasmGCVirtualTableBuilder { var entry = new Entry(method, table, table.entries.size()); table.entries.add(entry); indexes.put(method, entry.index); - table.implementors.add(null); + table.implementors.add(table.currentImplementors.get(method)); } } } @@ -187,6 +188,7 @@ class WasmGCVirtualTableBuilder { if (index >= 0) { table.implementors.set(index, method.getReference()); } + table.currentImplementors.put(method.getDescriptor(), method.getReference()); } } } @@ -210,6 +212,7 @@ class WasmGCVirtualTableBuilder { Table parent; List entries = new ArrayList<>(); List implementors = new ArrayList<>(); + Map currentImplementors = new HashMap<>(); private WasmGCVirtualTable buildResult; Table(ClassReader cls, int index) {