1
0
mirror of https://github.com/janet-lang/janet synced 2024-12-26 08:20:27 +00:00

Add length method ffi/jitfn abstract values.

This commit is contained in:
Calvin Rose 2022-12-04 10:27:28 -06:00
parent aa60c1f36a
commit 12286e4246
2 changed files with 9 additions and 1 deletions

View File

@ -10,3 +10,4 @@
(def signature (ffi/signature :default :void))
(ffi/call f signature)
(print "called a jitted function with FFI!")
(print "machine code: " (describe (string/slice f)))

View File

@ -244,10 +244,17 @@ static JanetByteView janet_ffijit_getbytes(void *p, size_t s) {
return bytes;
}
static size_t janet_ffijit_length(void *p, size_t s) {
(void) s;
JanetFFIJittedFn *fn = p;
return fn->size;
}
const JanetAbstractType janet_type_ffijit = {
.name = "ffi/jitfn",
.gc = janet_ffijit_gc,
.bytes = janet_ffijit_getbytes
.bytes = janet_ffijit_getbytes,
.length = janet_ffijit_length
};
typedef struct {