use of org.graalvm.wasm.Linker.ResolutionDag.ElemSym in project graal by oracle.
the class Linker method resolveElemSegment.
void resolveElemSegment(WasmContext context, WasmInstance instance, int elemSegmentId, int offsetAddress, int offsetGlobalIndex, int[] functionsIndices) {
final Runnable resolveAction = () -> immediatelyResolveElemSegment(context, instance, elemSegmentId, offsetAddress, offsetGlobalIndex, functionsIndices);
final ArrayList<Sym> dependencies = new ArrayList<>();
if (instance.symbolTable().importedTable() != null) {
dependencies.add(new ImportTableSym(instance.name(), instance.symbolTable().importedTable()));
}
if (elemSegmentId > 0) {
dependencies.add(new ElemSym(instance.name(), elemSegmentId - 1));
}
if (offsetGlobalIndex != -1) {
dependencies.add(new InitializeGlobalSym(instance.name(), offsetGlobalIndex));
}
for (final int functionIndex : functionsIndices) {
final WasmFunction function = instance.module().function(functionIndex);
if (function.importDescriptor() != null) {
dependencies.add(new ImportFunctionSym(instance.name(), function.importDescriptor(), function.index()));
}
}
resolutionDag.resolveLater(new ElemSym(instance.name(), elemSegmentId), dependencies.toArray(new Sym[dependencies.size()]), resolveAction);
}
Aggregations