Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mulithreading support - part 1 #3114

Merged

Conversation

WojciechMazur
Copy link
Contributor

The first part of merged multithreading support, based on cherry-picks from the development branch https://github.com/WojciechMazur/scala-native/tree/multithreading/develop

Included minimal functionally:

  • isMultithreadEnabled entry in NativeCofngi in LinktimeInfo
  • NativeThread interface to implement interaction with OS threads, along with PosixThread and WindowsThread implementations
  • Implementation of java.lang.Thread methods and its companions:
    • java.lang.ThreadGroup
    • java.lang.ThreadLocal
    • java.lang.InheritableThreadLocal
  • ScalaNativeGC.h interface used to implement ScalaNative and GC interaction
  • Support for multithreading in GC:
    • None
    • Boehm
    • Immix
  • Generate safepoint polling instructions when using Immix GC and switching thread state
  • Adapt signal config in tests to ignore signals used for GC threads synchronization
  • Setup CI and update tests

Follow-up PRs would include core features, eg. synchronization, atomics, threads parking, and finally implementation of java.util.concurrent / scala.conccurrent

…ScalaNative projects base on system property for easier interaction with CI
…e new threads and conversion between managed/unmanged execution
…ads support. Provide glue code for ThreadLocalStorage of current thread handles
Add NativeThread implementations: PosixThread and WindowsThread
Add missing or fix invalid bindings to pthread/Windows.h types
Implement waiting for termination of non-deamon threads using onExit hook
…ompiling native sources with multithreading support
… between Scala2 and Scala3. Share common implementaiton between the two
Move ThreadUtil.h to GC shared directory. Normalize its API
- Implement StopTheWorld events using combination of signal handlers(unix) / exception filters(windows) triggered by memory access violation on safepoint polling and by modifing mutator thread state upon call to or return from extern function (unmanaged context)
- Implement synchronization mechanism and safepoint arming
- Store references to all mutator threads
…supported. Otherwise LLVM can produce infinite loops
@WojciechMazur WojciechMazur merged commit 4125d73 into scala-native:main Jan 29, 2023
@WojciechMazur WojciechMazur deleted the feature/multithreading-part1 branch January 29, 2023 12:40
@kpodsiad
Copy link
Contributor

This is exciting news @WojciechMazur!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants