mirror of
https://github.com/janet-lang/janet
synced 2024-11-17 22:24:49 +00:00
Add length method ffi/jitfn abstract values.
This commit is contained in:
parent
aa60c1f36a
commit
90f212df92
@ -2,10 +2,12 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
## ??? - Unreleased
|
||||
- Add `ffi/jitfn` to allow calling function pointers generated at runtime from machine code.
|
||||
Bring your own assembler, though.
|
||||
- Channels can now be marshalled. Pending state is not saved, only items in the channel.
|
||||
- Use the new `.length` function pointer on abstract types for lengths. Adding
|
||||
a `length` method will still work as well.
|
||||
- Support byte views on abstract types with the `bytes` function pointer.
|
||||
- Support byte views on abstract types with the `.bytes` function pointer.
|
||||
- Add the `u` format specifier to printf family functions.
|
||||
- Allow printing 64 integer types in `printf` and `string/format` family functions.
|
||||
- Allow importing modules from custom directories more easily with the `@` prefix
|
||||
|
@ -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)))
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user