Skip to content

Commit 3ad9239

Browse files
committed
use low level interop for fi export
1 parent a8c9b2e commit 3ad9239

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

samples/bench/dotnet-llvm/Program.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ public static string EchoStruct ()
2929
return JsonSerializer.Serialize(data, SourceGenerationContext.Default.Data);
3030
}
3131

32-
[JSExport]
33-
public static int Fi (int n) => n <= 1 ? n : Fi(n - 1) + Fi(n - 2);
32+
[UnmanagedCallersOnly(EntryPoint = "fi")]
33+
public static int FiExport (int n) => Fi(n);
34+
private static int Fi (int n) => n <= 1 ? n : Fi(n - 1) + Fi(n - 2);
3435

3536
[DllImport("x", EntryPoint = "getNumber")]
3637
private static extern int GetNumber ();
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
mergeInto(LibraryManager.library, {
2-
// TODO: Figure how to get it from "../fixtures.mjs"
2+
// Figure how to get it from "../fixtures.mjs"
33
getNumber: () => 42,
44
});

samples/bench/dotnet-llvm/init.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ export async function init() {
1616
return {
1717
echoNumber: runtime.Module._echoNumber,
1818
echoStruct: exports.Program.EchoStruct,
19-
fi: exports.Program.Fi
19+
fi: runtime.Module._fi
2020
};
2121
}

0 commit comments

Comments
 (0)