-
Notifications
You must be signed in to change notification settings - Fork 104
Wild Ideas
These are some crazy ideas for enhancing or possibly improving parts of CCL.
The GC is a stop-the-world, single-threaded affair. There are more advanced GC techniques that could be investigated (concurrency, multiple threads and so on).
The current GC can run at any instruction boundary; in other words, every instruction boundary is a GC safepoint. This requires great care. We could consider going back to a strategy where we check whether a GC is needed (e.g., at loop heads and function calls). This would presumably let us avoid the complicated pc-lusering that we have to do when suspending a thread asynchronously. As an extra benefit, it might make dealing with workqueue threads (which ignore signals, and are a part of Darwin's Grand Central Dispatch) more tractable.
Marc Feely wrote https://dl.acm.org/doi/10.1145/165180.165205 titled Polling efficiently on stock hardware.
Java has used an unmapped page in order poll for whether a GC is needed. On x86, one writes test addr
where addr is on a special memory page. The page is normally mapped, but when the runtime wants to suspend the thread, it unmaps the page, causing the access to generate SIGSEGV, which the runtime can then handle.
https://psy-lob-saw.blogspot.com/2014/03/where-is-my-safepoint.html
Might it be possible to reorganize CCL so that it could be linked into other software as a shared library? This seems like it would probably be quite difficult.
Bignums, even on 64-bit ports, use a 32-bit bignum digits. This enables quite a bit of bignum arithmetic to be written in Lisp rather than assembly. It might be worth it, speed-wise, to re-implement this using 64-bit bignum digits.
The PowerPC port implemented a sub-O(n²) bignum multiplication algorithm (namely the Karatsuba algorithm) that pays off for sufficiently long bignums. Adding this to other ports might be worthwhile or at least fun.
Built-in SSL streams.
Fast, built-in SHA-256.
Adhere to ISO/IEC 10967-1:2012 (Language independent arithmetic) standard (including IEEE-754). Marco Antoniotti shows the way in his paper: Why You Cannot (Yet) Write an "Interval Arithmetic" Library in Common Lisp.
Implement a true long-float (C long double, often IEEE-745 quadruple precision. CMUCL has an implementation) and most compilers now support long floats in some form or another.
Make importing C/C++ a seamless experience.
Include all the C23 math functions, where they don't already exist in ANSI-CL. This seems like a no-brainer, since all we have to do is expose the existing libc functions. Examples include tgamma and lgamma.
Implement simple-streams (optional). It really is a better design, SBCL has it partially, maybe provide it as an optional module.