Hacker News new | ask | show | jobs
by skissane 32 days ago
> 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.

1 comments

It is exactly as inefficient as “passing it around as the first argument” implies

There’s a speedup to be had by either reserving a GPR or using one of the segment registers

Lots of obvious stuff like this hasn’t been done yet! If you want to have the satisfaction of landing speedups then Fil-C is a fun thing you could contribute to :-)

From what I understand, on x86 Linux stores a thread-local pointer to its TLS block in %fs. Could that simply be re-used?

https://groups.google.com/g/comp.arch/c/IT2dhS4q2M8?pli=1

Yes it could.

It would require more than zero work. Basically you’d need to unify yolo libc’s internal definition of pthread with libpizlo’s filc_thread