News for hackers. Stuff that matters.
Re:Zig's Incremental Compilation Internals by pron on Wednesday July 29, 2026 @05:20PM (#49103238)
With FFM you can do unsafe things, such as call native code and directly manipulate memory read from or written to by native code.
Re:Zig's Incremental Compilation Internals by throwaway2037 on Saturday August 01, 2026 @01:31AM (#49131318)
Eh, I don't really count FFM. Would you have said JNI before Java 22? FFM is little more than a convenient wrapper around the same that can be dome with JNI.
Re:Zig's Incremental Compilation Internals by pron on Tuesday August 04, 2026 @01:17PM (#49171884)
Yes, I would have said JNI (and JNI still exists). But FFM is much more than a wrapper. In most situations it offers a significant performance boost over JNI. E.g. see https://github.com/Glavo/java-ffi-benchmark, which is a bit out of date, and FFM is even better now especially in the cases it was behind in those benchmarks.

Also, the integrity story is different for them. JNI is able to arbitrarily call Java methods and read/write variables, bypassing Java's access control. FFM doesn't. So really, the only integrity issue with FFM is the native code's own memory safety. With JNI, there are bigger risks (e.g. JNI can mutate Java strings).