Fix assertion (#243)

This commit is contained in:
qwreey 2024-10-22 04:44:48 +00:00
parent ddf0c4c2dc
commit 886d555ab8
No known key found for this signature in database
GPG key ID: D28DB79297A214BD
3 changed files with 22 additions and 18 deletions

View file

@ -49,30 +49,34 @@ int add(int a, int b) {
bench_scale = 1000000
**Lune ffi call function**
**Lune ffi**
> cargo run run tests/ffi/benchmark/external_call
> cargo run --profile=release run tests/ffi/benchmark/external_call
Command: `cargo run run tests/ffi/benchmark/external_call`
Command: `cargo run --profile=release run tests/ffi/benchmark/external_call`
Lune release target: 0.205127 (sec)
Lune dev target: 1.556489 (sec)
- Device1
Lune release target: 0.205127 (sec)
Lune dev target: 1.556489 (sec)
> Commit: ddf0c4c
**LuaJit ffi call function**
**LuaJit ffi**
> luajit tests/ffi/benchmark/external_call/luajit.lua
Command: `luajit tests/ffi/benchmark/external_call/luajit.lua`
LuaJIT 2.1.1727870382: 0.001682 (sec)
flags = JIT ON SSE3 SSE4.1 BMI2 fold cse dce fwd dse narrow loop abc sink fuse
- Device1: 0.001682 (sec)
> LuaJIT 2.1.1727870382
> (flags = JIT ON SSE3 SSE4.1 BMI2 fold cse dce fwd dse narrow loop abc sink fuse)
**Deno ffi call function**
**Deno ffi**
> deno run --unstable-ffi --allow-ffi ./tests/ffi/benchmark/external_call/deno.ts
Command: `deno run --unstable-ffi --allow-ffi ./tests/ffi/benchmark/external_call/deno.ts`
Deno 1.46.3: 0.006384 (sec)
v8 = 12.9.202.5-rusty
- Device1: 0.006384 (sec)
> Deno 1.46.3 (v8 = 12.9.202.5-rusty)
**Sysinformation**
> CPU: AMD Ryzen 5 7600 (12) @ 5.1
> MEM: 61898MiB 5600 MT/s
> KERNEL: 6.8.12-2-pve (Proxmox VE 8.2.7 x86_64)
- Device1
> CPU: AMD Ryzen 5 7600 (12) @ 5.1
> MEM: 61898MiB 5600 MT/s
> KERNEL: 6.8.12-2-pve (Proxmox VE 8.2.7 x86_64)

View file

@ -1,3 +1,3 @@
void pointer(int *a) {
void pointer_write(int *a) {
*a = 123;
}

View file

@ -14,7 +14,7 @@ assert(tostring(c.int:ptr():arr(5)) == " <CPtr(int)>, length = 5 ")
assert(typeof(c.fn({ c.int }, c.int)) :: string == "CFn")
assert(tostring(c.fn({ c.int }, c.int)) == " (int) -> int ")
assert(tostring(c.fn({ c.int, c.double }, c.int)) == " (int, double) -> int ")
assert(tostring(c.fn({ c.int, ffi.f32 }, c.int)) == " (int, f32) -> int ")
assert(tostring(c.fn({ c.int:ptr() }, c.int)) == " (<CPtr(int)>) -> int ")
assert(tostring(c.fn({ c.int }, c.int:ptr())) == " (int) -> <CPtr(int)> ")
assert(tostring(c.fn({ c.int:ptr() }, c.int:ptr())) == " (<CPtr(int)>) -> <CPtr(int)> ")