Skip to content

Commit f260924

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

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
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 ();

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)