logoalt Hacker News

The Fil-C Optimized Calling Convention

120 pointsby pizlonatorlast Saturday at 7:10 PM23 commentsview on HN

Comments

dvtyesterday at 7:06 PM

Great video here by the man himself: https://x.com/filpizlo/status/1976831020566798656

From my cursory glance, the real magic (InvisiCaps) appears to be a unique take on fat pointers to track types, access rights, etc. Pretty clever, and the website is a great technical read.

show 1 reply
aniviacatyesterday at 6:55 PM

> Fil-C is a personal passion project by Filip Pizlo.

Do I understand correctly that this project is based on the work of just one person, Filip Pizlo? If so, that's amazing.

show 2 replies
vlovich123today at 3:38 AM

Are there any examples how to force C/C++ libraries within a Rust build to use Fil-C instead to improve security? Is it just a matter of overriding CC/CXX?

show 1 reply
skissaneyesterday at 10:16 PM

> Where my_thread is a pointer to the current Fil-C thread, which Fil-C passes around as the first argument in all calls.

Does this just mean you reserve a register for the current thread? In which case you could explain it as a reserved register (like FS used for TLS). Describing it as "passes around as the first argument in all calls" makes it sound inefficient–but whether it actually is depends on how you implement it.

show 1 reply
jancsikayesterday at 8:56 PM

So for interpreted languages with types that are written in C, how is the engine supposed to tell C it already checked all the arg types manually in the interpreter? In other words: it's safe to go ahead and dereference this function and invoke it with these args.

Seems like C technically requires function declarations for every possible signature. That quickly explodes into hundreds or thousands of function declarations in the header and switch statement.

Edit: clarification

show 1 reply
ummonkyesterday at 6:18 PM

Interesting project in general. I wonder whether it could be adapted to behave reasonably without relying on threading. E.g. run the GC only when *alloc is called.

show 1 reply
tinesyesterday at 8:00 PM

Pretty interesting, but what’s the reason of being for Fil-C?

show 3 replies