Open TheDan64 opened 7 years ago
What's the current plan for this?
There are currently no plans to support multithreaded LLVM. It's still something that we should explore in the future, but single-threaded LLVM is proving to be difficult and time consuming enough as it is to get right
Do you have any rough idea as to how you would go about it? I'm working on a language right now and may be able to help if there is time.
No clue. I think the first step is information. I have no idea what LLVM's multithreading mode does concretely. Does Context
suddenly become Sync
? (Ie is it being locked by a mutex or something?). Furthermore, it's not clear how we would toggle this functionality. LLVM does provide a runtime check to see if multithreaded is enabled, but we would likely need this information at compile time to mark the type as Sync
...
It seems that it is a compile time gate in llvm https://llvm.org/doxygen/group__LLVMCCoreThreading.html
Is there a work-around at the moment to reuse the jit compiled function from a different thread?
~I don't believe that is thread-safe to do. The functions are raw memory locations, not contained by any sort of locking mechanism~
Edit: It appears EE has its own lock
IIRC LLVM supports multithreading. We should support this at some point, if possible. It will likely have it's own set of obstacles. Any
Rc
types will likely need to be changed toArc
and our existing memory model may or may not need to be further reworked. This is for the far future, so I am marking it as v0.3.0 for now.