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

Multithreading/develop #23

Open
wants to merge 281 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
281 commits
Select commit Hold shift + click to select a range
4e6ef0c
Scalafmt fixes
WojciechMazur Jun 25, 2021
f0365b7
Do not ignore scala.collection.parallel in build.sbt/scalalib
WojciechMazur Jun 25, 2021
d6d1ff7
Cleanup Thread/NativeThread
WojciechMazur Jun 30, 2021
4021352
Allow to use parallel collections, implement CountedCompleter and Rec…
WojciechMazur Jun 30, 2021
a7fd23b
Sync with JSR-166
WojciechMazur Jun 30, 2021
1f3e8c0
Allow to compile on Scala 2.11/2.13
WojciechMazur Jun 30, 2021
98fcd2c
Add missing thread/nativeThread C sources
WojciechMazur Jun 30, 2021
186cc82
Implement j.u.c.Semaphore, working ForkJoinPool on Scala 2.13
WojciechMazur Jun 30, 2021
cea0c4a
Remove not needed deprecation on finalize
WojciechMazur Jun 30, 2021
d6b667b
Scalafmt fixes
WojciechMazur Jun 30, 2021
e1c8e13
Add support for multithreading on Windows [WIP]
WojciechMazur Jul 3, 2021
15fa3ea
Backport scala.concurrent.forkjoin package override from Scala 2.12 t…
WojciechMazur Jul 1, 2021
890ac61
Remove invalid tests, should be restored in the future
WojciechMazur Jul 9, 2021
5e49ebc
Fix compilation issues on Unix
WojciechMazur Jul 9, 2021
0105d72
Rerun scalafmt with new config (3.0.0-RC6)
WojciechMazur Jul 9, 2021
7946845
Fix deadlocks after moving LockSupport logic to NativeThread
WojciechMazur Jul 9, 2021
e12eef4
Fix deadlocks when using Windows
WojciechMazur Jul 9, 2021
f838d9f
Squashed cherry pick of feature/multithreading-switch
WojciechMazur Jun 21, 2021
74aa01b
Squashed cherry-pick of windows/develop branch
WojciechMazur Aug 4, 2021
b126d07
util/ThreadUtil
WojciechMazur Aug 12, 2021
ad6930a
Add GC multithreading methods to immix/commix.
WojciechMazur Aug 12, 2021
cf83199
Restore ExecutionContext override s and QueuedExecutionContext usages…
WojciechMazur Aug 12, 2021
fa0619e
Fix failling Immix/Commix GC (ajust Object fields offsets)
WojciechMazur Aug 17, 2021
55a4449
Remove debug snippet
WojciechMazur Aug 17, 2021
91680ef
Add GC stubs for Immix/Commix GC
WojciechMazur Aug 17, 2021
1a5a346
Mark object locks in Immix GC
WojciechMazur Aug 17, 2021
aa663c8
Merge remote-tracking branch 'origin/master' into multithreading/develop
WojciechMazur Oct 19, 2021
62c15eb
Merge remote-tracking branch 'upstream/main' into multithreading/develop
WojciechMazur Feb 10, 2022
c35a2e4
Merge remote-tracking branch 'upstream/main' into multithreading/develop
WojciechMazur Mar 13, 2022
cb2bb23
after rebase fixes
WojciechMazur Mar 13, 2022
c705359
Fix Scala3 compilation errors after rebase
WojciechMazur Apr 30, 2022
05d4ab2
Disabe handlering SIGXCPU which is used by Boehm GC
WojciechMazur Apr 30, 2022
eda97f1
Always recompile scalalib/javalib sources on change
WojciechMazur Apr 30, 2022
e8ca9d1
Merge remote-tracking branch 'upstream/main' into multithreading/develop
WojciechMazur Apr 30, 2022
80a4b91
Change synchronized handling in nscplugin - handle exception and non-…
WojciechMazur May 2, 2022
22a1217
Make object instance Var instead of Const to workaround memory access…
WojciechMazur May 2, 2022
91ea04b
Handle entering monitor when exceeding recursion limit
WojciechMazur May 2, 2022
6894597
Fix typos and sync tests body with main branch
WojciechMazur May 2, 2022
fbead18
Revert spourious changes
WojciechMazur May 2, 2022
6510ab1
Fix usage of the old state when inflating monitor
WojciechMazur May 3, 2022
6e531c0
WIP - Multithreading aware Immix
WojciechMazur Jun 15, 2022
f8c08be
Merge remote-tracking branch 'upstream/main' into multithreading/develop
WojciechMazur Jun 16, 2022
f446a0d
Fixes to thrads synchronization + clenaup
WojciechMazur Jun 18, 2022
dd5c331
Fix memory layout of constant modules, make sure their object monitor…
WojciechMazur Jun 18, 2022
199e23f
Use classFieldRawPtr to access underlying fields of atomics
WojciechMazur Jun 18, 2022
cfa8407
Debug logs clenaup
WojciechMazur Jun 18, 2022
9292362
Start porting JSR166 tests with ForkJoinPoolTests
WojciechMazur Jun 20, 2022
875200f
clenaup c atomics template generate files
WojciechMazur Jun 20, 2022
8c9b6e8
Replace Atomics with volatiles in ForkJoinPool
WojciechMazur Jun 20, 2022
5c2db3c
Run scalafmt
WojciechMazur Jun 20, 2022
58dedf7
Partially port ForkJoinPoolTests
WojciechMazur Jun 27, 2022
5e23137
Continue porting AbstractQueedSynchronizer and it's tests
WojciechMazur Jul 10, 2022
244384d
Fix park nanos
WojciechMazur Jul 10, 2022
ca0deed
NativeThread changes
WojciechMazur Jul 10, 2022
3a80205
Revert "NativeThread changes"
WojciechMazur Jul 10, 2022
2875cb0
Fix most of the AbstractQueuedSynchronizer tests
WojciechMazur Jul 10, 2022
1925119
Move atomics to clib, cleanup bindings
WojciechMazur Jul 13, 2022
d8880e0
Port Atomic tests and fix issues
WojciechMazur Jul 16, 2022
81818c6
Add Int/Long Binary/Unary operators
WojciechMazur Jul 16, 2022
15a3cab
Port ThreadLocal tests
WojciechMazur Jul 16, 2022
7ecb99f
Port BlockingQueue tests
WojciechMazur Jul 16, 2022
253f563
Add missing TimeUnit methods
WojciechMazur Jul 18, 2022
369c91e
Port part of ThreadPoolExecutor it's dependenices and some of the tests
WojciechMazur Jul 19, 2022
5490e98
Port LockSupport test
WojciechMazur Jul 19, 2022
141b129
Port reentrant lock tests
WojciechMazur Jul 19, 2022
fc1c81e
Fix lowering of Store ClassOf
WojciechMazur Jul 21, 2022
3aaa7af
Make Thread.sleep interruptible using eventd polling
WojciechMazur Jul 21, 2022
9385fc1
New LockSupport park mechanism
WojciechMazur Aug 18, 2022
b7d8bf6
Port j.u.concurrent.locks.ReentrantReadWriteLock
WojciechMazur Aug 19, 2022
bbf9c22
Fix possible stack buffer overflow in currentStackTrace
WojciechMazur Aug 29, 2022
5a486db
Fix ForkJoinTask invokation + other bugs
WojciechMazur Aug 29, 2022
2541a96
Try imporve Immix GC
WojciechMazur Aug 29, 2022
8279bb4
Bugfixes to FJP and SynchronousQueue
WojciechMazur Sep 23, 2022
a7e7153
Fix Posix sleep error check
WojciechMazur Sep 25, 2022
1b7a1c8
Port Executors and ScheduledThreadPoolExecutors
WojciechMazur Sep 25, 2022
9970717
Add missing volatile annotation to VolatilePrimitiveRefs
WojciechMazur Oct 12, 2022
aa0b184
New implementation of object monitors
WojciechMazur Oct 13, 2022
d15521c
Fixes to ArrayBlockingQueue
WojciechMazur Oct 13, 2022
a450815
Merge remote-tracking branch 'upstream/main' into multithreading/develop
WojciechMazur Oct 14, 2022
407445b
Get rid of warnings/compile errors in tests using Scala 3 excluding n…
WojciechMazur Oct 14, 2022
ce77d05
Run scalafmt + clangfmt
WojciechMazur Oct 14, 2022
ae3a683
Implement multithreading safe LazyVals for Scala3
WojciechMazur Oct 14, 2022
2b64278
Fix handling of volatiles in scala3
WojciechMazur Oct 14, 2022
d402d92
Cleanup implemention of NativeThread, Thread and ThreadGroup
WojciechMazur Oct 17, 2022
9dd6e75
Fix thread impl
WojciechMazur Oct 19, 2022
ed08617
Cleanup and stabliiize multithreaded immix implementation
WojciechMazur Oct 21, 2022
d7bc0c3
Initialization fixes
WojciechMazur Oct 22, 2022
be2dbf8
Remove no longer used ThreadState
WojciechMazur Oct 27, 2022
ab1dd87
Implement waiting for nonDaemon thrads using atExit hook
WojciechMazur Oct 31, 2022
8956d66
Fix handling thread uncought exception
WojciechMazur Nov 12, 2022
24d9849
Don't allow to override terminated state of NativeThread
WojciechMazur Nov 17, 2022
d62eddb
Fix ArrayBlockingQueue and cleanup
WojciechMazur Nov 17, 2022
59e4028
Introduce active pooling for lock in ObjectMonitor
WojciechMazur Nov 19, 2022
1392f09
Fix inheritance of thread local values
WojciechMazur Nov 19, 2022
0591a7a
Don't use synchronization in NativeThread.Registry as it could lead t…
WojciechMazur Nov 19, 2022
d7e5bca
Use nativeThread directly in LockSupport
WojciechMazur Nov 19, 2022
41c628c
Cleanup JSR166 tests
WojciechMazur Nov 19, 2022
78d22b7
Ignore unpark if nativeThread was not yet assigned to thread
WojciechMazur Nov 19, 2022
e48b10a
Disable signal handlers in threads if multithreading i s enabled
WojciechMazur Nov 19, 2022
5ceb05e
Cleanup sandbox
WojciechMazur Nov 19, 2022
5a5b24a
Cleanup ImmixGC impl - use only global blockAllocator
WojciechMazur Nov 19, 2022
a730756
Merge branch 'multithreading/develop' of github.com:WojciechMazur/sca…
WojciechMazur Nov 19, 2022
943aa76
Get rid of non-local returns in Scala 3.2.x builds
WojciechMazur Nov 20, 2022
103bcc0
Allow for cross-compilation with Scala 2.12 + cleanup
WojciechMazur Nov 25, 2022
680700f
Make volatile load/store used acquire/release memory order instead of…
WojciechMazur Nov 25, 2022
e36ea18
ImmixGC - get rid of blockMeta owner - redistribute blocks using roun…
WojciechMazur Dec 16, 2022
9db7b24
Protect Immix Heap from concurrent grow
WojciechMazur Dec 19, 2022
fbcbc7c
Stablizize stopping the world and fix sporious data races
WojciechMazur Dec 22, 2022
008f2f0
Fix thread inheritable thread locals
WojciechMazur Dec 22, 2022
b855fdb
Make array store/load atomic
WojciechMazur Dec 22, 2022
4b91aba
Generate null guards for this value
WojciechMazur Dec 23, 2022
f680be4
Adapt failing test to execution on the JVM and in the multithreaded env
WojciechMazur Dec 23, 2022
052df6d
Merge remote-tracking branch 'upstream/main' into multithreading/develop
WojciechMazur Dec 23, 2022
fa1ec74
Run clangfmt
WojciechMazur Dec 23, 2022
8cb1325
Merge remote-tracking branch 'upstream/main' into multithreading/develop
WojciechMazur Dec 23, 2022
8b012f8
Use integer value for ping -i argument
WojciechMazur Dec 23, 2022
ba2945f
Adapt failing tools test
WojciechMazur Dec 23, 2022
3242ec3
Allow usage of @{Before,After}Class annotations defined in parents
WojciechMazur Dec 27, 2022
3dea975
Restore running junitOutput tests
WojciechMazur Dec 27, 2022
a1f18c8
Restore removed deprecated org.junit.Assert methods
WojciechMazur Dec 27, 2022
5e3a7cf
Don't run test needing multiple threads in single threaded runtime
WojciechMazur Dec 27, 2022
1520c3b
cleanup
WojciechMazur Dec 27, 2022
8cabbb4
Try setup CI for linux/macos
WojciechMazur Dec 27, 2022
552a521
Fix CI problems
WojciechMazur Dec 27, 2022
6e6c346
Adapt junit-async module to work in multithreaded runtime
WojciechMazur Dec 27, 2022
93d53d7
Fix typo
WojciechMazur Dec 27, 2022
22fd963
Try fix errors in LinktimeConditionSpec
WojciechMazur Dec 27, 2022
dd3f94d
Replace implementation of sleep to use pipe instead of eventfd to wai…
WojciechMazur Dec 28, 2022
17c4ff6
Don't use interactive sbt mode in the CI
WojciechMazur Dec 28, 2022
bd23995
Don't require non empty list of arguemnts for guard this not null
WojciechMazur Dec 28, 2022
540829e
Allow to cross compile on Windows
WojciechMazur Dec 28, 2022
807b305
Use quoted paths to allow for safe usage of paths containing spaces
WojciechMazur Dec 28, 2022
c6f1db4
Merge branch 'multithreading/develop' of github.com:WojciechMazur/sca…
WojciechMazur Dec 28, 2022
0cb0470
Revert "Revert changes to skiping build on no changes"
WojciechMazur Dec 29, 2022
b6add54
Fix parking mechanism on Windows
WojciechMazur Dec 29, 2022
d659c5d
Use thread-local charset encoders/decoders
WojciechMazur Dec 29, 2022
9a5e82a
Revert "Use quoted paths to allow for safe usage of paths containing …
WojciechMazur Dec 29, 2022
21c222a
Make loading System.properties lazy operation
WojciechMazur Dec 29, 2022
6dd305a
Fix typos and formating
WojciechMazur Dec 29, 2022
bb86d56
Revert changes in MyScalaNativePlugin
WojciechMazur Dec 29, 2022
52723cd
Try fix issues with parking/sleeping windows threads
WojciechMazur Dec 29, 2022
2f1c05d
Skip wait when inflating object monitor
WojciechMazur Dec 29, 2022
4e66ca6
Merge branch 'multithreading/develop' of https://github.com/WojciechM…
WojciechMazur Dec 29, 2022
a34518b
Try fix CI workflows
WojciechMazur Dec 29, 2022
43c93c7
try fix windows ci workflows
WojciechMazur Dec 29, 2022
fd60235
Disable JSR166 tests failing in JDK8
WojciechMazur Dec 29, 2022
b58557a
Fix typos in workflows
WojciechMazur Dec 30, 2022
0af3b88
Don't require scalanative pthread_create_thread/CreateThread in singl…
WojciechMazur Dec 30, 2022
bd38724
Handle whitespaces in the files passed to the clang when linking
WojciechMazur Dec 29, 2022
aa78312
Handle whitespaces in the files passed to the clang when linking
WojciechMazur Dec 29, 2022
e592c1b
Don't require scalanative pthread_create_thread/CreateThread in singl…
WojciechMazur Dec 30, 2022
4b247ca
Get rid of usages of usleep
WojciechMazur Dec 30, 2022
0b8ac37
Fix signature of scalantive_CreateThread in none gc
WojciechMazur Dec 30, 2022
76b84c9
Fix missing symbols when linking in lto full on windows
WojciechMazur Dec 30, 2022
e7570d6
Don't use `pthread_condattr_setclock` onMacos
WojciechMazur Dec 30, 2022
7beb2df
Temporally disable parallel execution of tests
WojciechMazur Dec 30, 2022
921fc84
Try fix windows workflow
WojciechMazur Dec 30, 2022
6803598
try fix windows CI
WojciechMazur Dec 30, 2022
60a74df
Fix linktimeconditonspec
WojciechMazur Dec 30, 2022
205616d
try fix windows ci
WojciechMazur Dec 30, 2022
211d401
try debug macos unpark
WojciechMazur Dec 30, 2022
ebb0e0d
Revert "Skip wait when inflating object monitor"
WojciechMazur Dec 30, 2022
6a75fd9
Add NIR level fences and synchronization primitives for atomic load/s…
WojciechMazur Dec 31, 2022
7bc9726
Add multithreading flag to nativeConfig checksum
WojciechMazur Dec 31, 2022
f4a2407
Make most of synchronization mechanism no-op in singlethreaded mode
WojciechMazur Dec 31, 2022
89e644d
Fix double executuon of finally block when using linktime conditions
WojciechMazur Dec 31, 2022
80294f0
try fix windows ci
WojciechMazur Dec 31, 2022
e579a4d
Try fix Windows CI
WojciechMazur Dec 31, 2022
eae863b
Use lockwords only in multithreading mode
WojciechMazur Jan 1, 2023
d155831
run scalafmt
WojciechMazur Jan 1, 2023
2b6fae5
Op.Load|Store uses default None argument for SyncAttrs
WojciechMazur Jan 1, 2023
6b75c87
try fix windows ci
WojciechMazur Jan 1, 2023
513a5a8
Revert changes to Log.h in GC
WojciechMazur Jan 1, 2023
6bb4fd3
Merge branch 'multithreading/develop' of https://github.com/WojciechM…
WojciechMazur Jan 2, 2023
26ab90e
Don't generate atomic load/store in singlethreaded mode. Provide liba…
WojciechMazur Jan 2, 2023
8e66d0a
Fix failing test assuming singlethreading
WojciechMazur Jan 2, 2023
c598ff9
Try fix Windows failures when using semaphore in CommixGC
WojciechMazur Jan 2, 2023
ab33e41
Fix Commix semaphore usage on Unix
WojciechMazur Jan 2, 2023
9aec2f8
Merge branch 'multithreading/develop' of github.com:WojciechMazur/sca…
WojciechMazur Jan 2, 2023
6ade997
Don't generate sync scope in non-atomic store
WojciechMazur Jan 2, 2023
6a78b9d
Fix Windows Boehm GC typo
WojciechMazur Jan 2, 2023
65fb723
Disable testing objectmonitro test case on JDK due to the bug
WojciechMazur Jan 2, 2023
000f692
Adapt failing StackTrace checks
WojciechMazur Jan 2, 2023
f7fe923
Make BasicMonitor enter easier to inline
WojciechMazur Jan 2, 2023
6124a64
BasicMonitor - use the least significent bits to mark lock type to al…
WojciechMazur Jan 3, 2023
fed343e
Merge branch 'multithreading/develop' of https://github.com/WojciechM…
WojciechMazur Jan 3, 2023
36f8ea6
Suppress failing stack trace checks on windwos with LTO
WojciechMazur Jan 3, 2023
1258ba4
Try debug issues with commix failures on mac
WojciechMazur Jan 3, 2023
c97f4e4
Normalize mutex/semaphore api in gc
WojciechMazur Jan 3, 2023
f089ec0
Disable remaining fialing throwables test on Windows
WojciechMazur Jan 3, 2023
e52c0c8
Fix mutex issues in GC
WojciechMazur Jan 3, 2023
0ff230b
By default don't require libatomic, it can be missing on macos by def…
WojciechMazur Jan 3, 2023
9aeeab5
Don't use lazy val in WindowsThread
WojciechMazur Jan 4, 2023
0ca311c
Reoorder synchronization when suspending threads
WojciechMazur Jan 4, 2023
87ff9ec
Fix issue with skipped/non terminating park calls
WojciechMazur Jan 4, 2023
8109c7a
Fix printing SyncAttrs in textual NIR representation
WojciechMazur Jan 4, 2023
ee794a1
Fix detection of final fields in Scala 2
WojciechMazur Jan 4, 2023
b36977a
Socket - retry timed connected when interrupted by signal
WojciechMazur Jan 4, 2023
a2bfb51
Make sure Thread constant are initialized before setting priority of …
WojciechMazur Jan 4, 2023
7ce73c2
On MacOS detect SIGBUS signal for yieldpoints instead of SIGSEGV
WojciechMazur Jan 4, 2023
ce10c5a
Use homebrew version of llvm in CI
WojciechMazur Jan 4, 2023
0f4b2f9
Get rid of warning in Synchronizer.c on macos
WojciechMazur Jan 4, 2023
3f8ec12
Merge remote-tracking branch 'upstream/main' into multithreading/develop
WojciechMazur Jan 5, 2023
175b00b
Fix macos builds
WojciechMazur Jan 5, 2023
d215796
Mark WeakReference fields volatile
WojciechMazur Jan 6, 2023
d40863c
PrintStackTrace in SafepointTrapHandler
WojciechMazur Jan 6, 2023
4673b52
Save the jmp_buf on thread and use it when marking
WojciechMazur Jan 6, 2023
39c3a12
Introduce concept of blocking extern functions. Extern functions mark…
WojciechMazur Jan 6, 2023
d065136
Fixes after adding blocking externs
WojciechMazur Jan 6, 2023
00f1ae6
[lint] Get rid of non-local returns in LockSupportTest
WojciechMazur Jan 8, 2023
a7de284
Try fix deadlock on Windows
WojciechMazur Jan 8, 2023
a6a0256
Set timeout or multithreaded builds to 60 minutes (instead of default…
WojciechMazur Jan 8, 2023
635d5f3
Try debug failures in MacOs scripted tests
WojciechMazur Jan 8, 2023
ab645a9
Restore signal handlers in tests to debug unexpected SIGILL on macos
WojciechMazur Jan 8, 2023
d9701f9
Fix scripted tests
WojciechMazur Jan 9, 2023
d6092d9
Enable more signal for bebug
WojciechMazur Jan 9, 2023
d14448c
Improve Sockets connect, reduce overhead, and always throw SocketTime…
WojciechMazur Jan 17, 2023
2ee8b54
Disable ObjectMonitorTests on JVM with Windows, due to spourious fail…
WojciechMazur Jan 17, 2023
fcd41df
Temporaly always use multithreading
WojciechMazur Jan 17, 2023
3eb6acc
Fixes to object monitor
WojciechMazur Jan 18, 2023
27a0285
fix typo
WojciechMazur Jan 18, 2023
bd813a3
Merge remote-tracking branch 'upstream/main' into multithreading/develop
WojciechMazur Jan 18, 2023
ff832b2
fix typo in gc none
WojciechMazur Jan 19, 2023
3823c47
Improve generating GC yieldpoints on jumps, base it on ordering of bl…
WojciechMazur Jan 19, 2023
a14c1a1
Try fix multiarch CI
WojciechMazur Jan 19, 2023
33d9175
Disable asan when marking stack of foreign threads
WojciechMazur Jan 19, 2023
897589c
Revert multithreadin as default
WojciechMazur Jan 19, 2023
b3aec08
use default clang on macos
WojciechMazur Jan 19, 2023
08b1043
Fix typo in workflow
WojciechMazur Jan 19, 2023
184ec79
fix typo in workflow
WojciechMazur Jan 19, 2023
1c45eb1
fix multiarch workflow
WojciechMazur Jan 19, 2023
9623d24
Fix STW threads synchronization on Windows. Remove issue with deadlocks
WojciechMazur Jan 20, 2023
6bf5bde
Merge branch 'multithreading/develop' of https://github.com/WojciechM…
WojciechMazur Jan 20, 2023
c2093e7
Don't use ld linker on macos multiarch and fix setting nativeConfig …
WojciechMazur Jan 20, 2023
11cf081
Use llvm15 on macos (llvm 14 is no longer preinstalled). Fix multithr…
WojciechMazur Jan 20, 2023
a37c1f1
Fix ObjectMontior::waitImpl - fix race condition leading to unlinknig…
WojciechMazur Jan 23, 2023
dd65ff5
Reimplement loading modules - make it multithreading safe in case of …
WojciechMazur Jan 24, 2023
916750e
Reduce amount of generated GC yieldpoints in the code
WojciechMazur Jan 24, 2023
001f87a
Ignore __scalanativE_loadModule code in non multithreaded runtime whe…
WojciechMazur Jan 25, 2023
58fdc1b
Mitigate compilation error in ModuleInitializationTest on Scala 2.12
WojciechMazur Jan 25, 2023
feae5c6
Fix pthread bindings to fix Linux-x86 segmentation faults
WojciechMazur Jan 25, 2023
e1820a6
Fix failing AtomicLong test on Linux-x86
WojciechMazur Jan 25, 2023
a2e86f7
restore testing linux-x86 with immix and commix
WojciechMazur Jan 25, 2023
fd3f1a0
Disable LTO tests on linux-x86
WojciechMazur Jan 25, 2023
24f2f25
Set SignalHandler using sigaction whenver possible
WojciechMazur Jan 25, 2023
6e125ba
Revert "Set SignalHandler using sigaction whenver possible"
WojciechMazur Jan 25, 2023
aeb28db
Merge remote-tracking branch 'upstream/main' into multithreading/develop
WojciechMazur Jan 26, 2023
d119640
Fix linux-x86 tests. Use logical instead of arithmetic shift to not p…
WojciechMazur Jan 26, 2023
3037db4
run scalafmt
WojciechMazur Jan 26, 2023
0ebaf9a
Temporaly disabled fatalWarnings when generating javalib docs
WojciechMazur Jan 27, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
43 changes: 20 additions & 23 deletions .github/workflows/run-tests-linux-multiarch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,19 +83,21 @@ jobs:
build-mode: [debug, release-fast]
lto: [none, thin]
gc: [boehm, immix, commix]
multithreading: [true, false]
exclude:
# Immix does not suppoort Immix/Commix GCs
- gc: immix
arch: linux-x86
- gc: commix
arch: linux-x86
# LTO is broken on linux-x86/llvm-10
- arch: linux-x86
lto: thin
# Release without LTO produces 1 big file taking long to compile, especially when emulated
- build-mode: release-fast
lto: none
- build-mode: release-size
lto: none
- build-mode: debug
lto: thin
# Commix does not support multithreading
- gc: commix
multithreading: true
# Reduce ammount of builds combinations
- gc: immix
lto: none
Expand Down Expand Up @@ -123,7 +125,7 @@ jobs:
with:
path: /tmp/docker-registry
key: docker-registry-${{ hashFiles('ci-docker/Dockerfile') }}-${{matrix.arch}}

- name: Prepare native config
shell: bash
# Following envs CROSS_ are always present in docker container
Expand All @@ -137,20 +139,18 @@ jobs:

SetConfigTemplate=$(cat << EOM
nativeConfig ~= { prev =>
val sysRoot: List[String] = Option{
sys.process.stringSeqToProcess(
Seq(
val sysRoot: List[String] =
if(Seq("linux-x86").contains("${{ matrix.arch }}")) Nil
else Option {
sys.process.stringSeqToProcess(Seq(
s"\${sys.env("CROSS_ROOT")}/bin/\${sys.env("CROSS_TRIPLE")}-gcc",
"-print-sysroot"
)
).!!.trim
}.filter(_.nonEmpty)
.fold(List.empty[String]){ root =>
List(
)).!!.trim
}.filter(_.nonEmpty)
.fold(List.empty[String]){ root => List(
s"--sysroot=\${root}",
s"--gcc-toolchain=\${sys.env("CROSS_ROOT")}"
)
};
)};

prev
.withMode(scalanative.build.Mode.${buildMode})
Expand All @@ -160,22 +160,19 @@ jobs:
.withOptimize(true)
.withCheck(true)
.withCheckFatalWarnings(true)
.withTargetTriple(sys.env("CROSS_TRIPLE"))
.withTargetTriple(sys.env.get("CROSS_TRIPLE"))
.withMultithreadingSupport(${{matrix.multithreading}})
.withCompileOptions(
prev.compileOptions ++ sysRoot ++ List("-fuse-ld=lld")
)
.withLinkingOptions(
prev.linkingOptions ++ sysRoot ++ List("-fuse-ld=lld")
prev.linkingOptions ++ sysRoot ++ List("-fuse-ld=lld", "-latomic")
)
}
EOM
)

if [[ "${{matrix.arch}}" == "linux-x86" ]]; then
echo set-native-config=nativeConfig ~= identity >> $GITHUB_ENV
else
echo set-native-config=${SetConfigTemplate} >> $GITHUB_ENV
fi
echo set-native-config=${SetConfigTemplate} >> $GITHUB_ENV

# Conditionally disable some of the tests (Scala 2 only)
- name: Set filters for partests
Expand Down
70 changes: 70 additions & 0 deletions .github/workflows/run-tests-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
- uses: ./.github/actions/linux-setup-env
with:
scala-version: ${{matrix.scala}}
java-version: 8

- name: Test tools
run: sbt "++ ${{ matrix.scala }} -v" "-no-colors" "-J-Xmx3G" "test-tools ${{ matrix.scala }}"
Expand All @@ -43,6 +44,12 @@ jobs:
"scalaPartest${{env.project-version}}/fetchScalaSource"
scala-cli scripts/partest-check-files.scala -- ${{ matrix.scala }}

# scala-cli-setup can override default java version
- uses: ./.github/actions/linux-setup-env
with:
scala-version: ${{matrix.scala}}
java-version: 8

# Running all partests would take ~2h for each Scala version, run only single test of each kind
# to make sure that infrastructure works correctly.
- name: Run subset of partest tests
Expand Down Expand Up @@ -187,3 +194,66 @@ jobs:
run: |
export LLVM_BIN=$(dirname $(readlink -f /usr/bin/clang))
sbt "test-scripted ${{matrix.scala}}"

test-multihreading:
name: Test experimental multithreading support
runs-on: ubuntu-20.04
needs: tests-tools
strategy:
fail-fast: false
matrix:
scala: [3.2.1, 2.13.10]
build-mode: [debug, release-fast]
gc: [boehm, immix]
lto: [thin]
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/linux-setup-env
with:
scala-version: ${{matrix.scala}}

- name: Prepare native config command
shell: bash
# Following envs CROSS_ are always present in docker container
run: |
buildMode=${{matrix.build-mode}}
if [[ "$buildMode" == "release-fast" ]]; then
buildMode=releaseFast
fi

SetConfigTemplate=$(cat << EOM
nativeConfig ~= { prev =>
prev
.withMode(scalanative.build.Mode.${buildMode})
.withGC(scalanative.build.GC.${{matrix.gc}})
.withLTO(scalanative.build.LTO.${{matrix.lto}})
.withEmbedResources(true)
.withCheck(true)
.withCheckFatalWarnings(true)
.withMultithreadingSupport(true)
}
EOM
)

echo set-native-config=${SetConfigTemplate} >> $GITHUB_ENV

- name: Run tests
# 2x more then it should take to build and run tests
timeout-minutes: 60
env:
TEST_COMMAND: >
++${{matrix.scala}} -v;
set sandbox.forBinaryVersion("${{env.binary-version}}")/${{env.set-native-config}};
set tests.forBinaryVersion("${{env.binary-version}}")/${{env.set-native-config}};
set junitTestOutputsNative.forBinaryVersion("${{env.binary-version}}")/${{env.set-native-config}};
set scalaPartestJunitTests.forBinaryVersion("${{env.binary-version}}")/${{env.set-native-config}};

show sandbox${{env.project-version}}/nativeConfig;

sandbox${{env.project-version}}/run;
testsJVM${{env.project-version}}/test;
tests${{env.project-version}}/test;
junitTestOutputsJVM${{env.project-version}}/test;
junitTestOutputsNative${{env.project-version}}/test;
scalaPartestJunitTests${{env.project-version}}/test
run: sbt -J-Xmx5G "${TEST_COMMAND}"
70 changes: 70 additions & 0 deletions .github/workflows/run-tests-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,73 @@ jobs:
run: |
export LLVM_BIN=$(brew --prefix llvm@15)/bin
sbt "test-scripted ${{matrix.scala}}"

test-multihreading:
name: Test experimental multithreading support
runs-on: macos-11
strategy:
fail-fast: false
matrix:
scala: [3.2.1, 2.13.10]
build-mode: [debug, release-fast]
gc: [boehm, immix]
lto: [thin]
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/macos-setup-env
with:
scala-version: ${{matrix.scala}}

- name: Prepare native config command
shell: bash
# Linking on MacOS in GithubActions fails when using default linker (ld), use lld instead
run: |
buildMode=${{matrix.build-mode}}
if [[ "$buildMode" == "release-fast" ]]; then
buildMode=releaseFast
fi

SetConfigTemplate=$(cat << EOM
nativeConfig ~= { prev =>
prev
.withMode(scalanative.build.Mode.${buildMode})
.withGC(scalanative.build.GC.${{matrix.gc}})
.withLTO(scalanative.build.LTO.${{matrix.lto}})
.withEmbedResources(true)
.withCheck(true)
.withCheckFatalWarnings(true)
.withMultithreadingSupport(true)
.withLinkingOptions(prev.linkingOptions ++ Seq("-fuse-ld=lld") )
}
EOM
)

echo set-native-config=${SetConfigTemplate} >> $GITHUB_ENV

- name: Run tests
# 2x more then it should take to build and run tests
timeout-minutes: 60
env:
TEST_COMMAND: >
++${{matrix.scala}} -v;
set sandbox.forBinaryVersion("${{env.binary-version}}")/${{env.set-native-config}};
set tests.forBinaryVersion("${{env.binary-version}}")/${{env.set-native-config}};
set junitTestOutputsNative.forBinaryVersion("${{env.binary-version}}")/${{env.set-native-config}};
set scalaPartestJunitTests.forBinaryVersion("${{env.binary-version}}")/${{env.set-native-config}};

show tests${{env.project-version}}/nativeConfig;

sandbox${{env.project-version}}/run;
testsJVM${{env.project-version}}/test;
tests${{env.project-version}}/test;
junitTestOutputsJVM${{env.project-version}}/test;
junitTestOutputsNative${{env.project-version}}/test;
scalaPartestJunitTests${{env.project-version}}/test
run: |
# lld fails to link with BoehmGC when using shared library, force linking using static library
if [[ "${{matrix.gc}}" == "boehm" ]]; then
unlink /usr/local/lib/libgc.dylib
fi
export LLVM_BIN="$(brew --prefix llvm@15)/bin"
$LLVM_BIN/clang --version
sbt -J-Xmx5G "${TEST_COMMAND}"
32 changes: 32 additions & 0 deletions .github/workflows/run-tests-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,35 @@ jobs:
tests${{env.project-version}}/test
testsExt${{env.project-version}}/test
shell: cmd

test-multihreading:
name: Test experimental multithreading support
runs-on: windows-2019
strategy:
fail-fast: false
matrix:
scala: [3.2.1, 2.13.10]
build-mode: [debug, release-fast]
gc: [boehm, immix]
lto: [thin]
steps:
- name: Setup git config
run: git config --global core.autocrlf false
- uses: actions/checkout@v3
- uses: ./.github/actions/windows-setup-env
id: setup
with:
scala-version: ${{matrix.scala}}

- name: Run tests
# 2x more then it should take to build and run tests
timeout-minutes: 60
run: >
set SCALANATIVE_GC=${{matrix.gc}}&
set SCALANATIVE_INCLUDE_DIRS=${{steps.setup.outputs.vcpkg-dir}}\include&
set SCALANATIVE_LIB_DIRS=${{steps.setup.outputs.vcpkg-dir}}\lib&
set SCALANATIVE &
sbt -Dscala.scalanative.multithreading.enable=true
"++${{matrix.scala}} -v"
"test-runtime ${{matrix.scala}}"
shell: cmd
94 changes: 94 additions & 0 deletions auxlib/src/main/scala/scala/runtime/BoxesRunTime.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package scala.runtime

import scala.math.ScalaNumber
import scala.scalanative.unsafe._
import scala.annotation.switch

class BoxesRunTime

Expand Down Expand Up @@ -46,4 +47,97 @@ object BoxesRunTime {
def hashFromFloat(o: java.lang.Float): Int = ???
def hashFromDouble(o: java.lang.Double): Int = ???
def hashFromLong(o: java.lang.Long): Int = ???

def equals(x: Any, y: Any): Boolean = {
(x, y) match {
case (x: AnyRef, y: AnyRef) => x eq y
case _ => equals2(x, y)
}
}

/** Since all applicable logic has to be present in the equals method of a
* ScalaNumber in any case, we dispatch to it as soon as we spot one on
* either side.
*/
def equals2(x: Any, y: Any): Boolean = {
x match {
case number: Number => equalsNumObject(number, y)
case char: Character => equalsCharObject(char, y)
case _ =>
if (x == null) y == null
else x == y
}
}

def equalsNumObject(xn: Number, y: Any): Boolean = {
y match {
case number: Number => equalsNumNum(xn, number)
case character: Character => equalsNumChar(xn, character)
case _ =>
if (xn == null) y == null
else xn == y
}
}

private final val CHAR = 0
/* BYTE = 1, SHORT = 2, */
private final val INT = 3
private final val LONG = 4
private final val FLOAT = 5
private final val DOUBLE = 6
private final val OTHER = 7

/** We don't need to return BYTE and SHORT, as everything which might care
* widens to INT.
*/
private def typeCode(a: Any): Int = {
a match {
case _: Integer => INT
case _: Double => DOUBLE
case _: Long => LONG
case _: Character => CHAR
case _: Float => FLOAT
case _: Byte | _: Short => INT
case _ => OTHER
}
}

def equalsNumNum(xn: Number, yn: Number): Boolean = {
val xcode = typeCode(xn)
val ycode = typeCode(yn)
val toMatch = if (ycode > xcode) ycode else xcode
(toMatch: @switch) match {
case INT => xn.intValue == yn.intValue
case LONG => xn.longValue == yn.longValue
case FLOAT => xn.floatValue == yn.floatValue
case DOUBLE => xn.doubleValue == yn.doubleValue
case _ =>
if (yn.isInstanceOf[ScalaNumber] && !xn.isInstanceOf[ScalaNumber])
yn == xn
else if (xn == null) yn == null
else xn == yn
}
}

def equalsCharObject(xc: Character, y: Any): Boolean = {
y match {
case character: Character => return xc.charValue == character.charValue
case number: Number => equalsNumChar(number, xc)
case _ =>
if (xc == null) y == null
else xc == y
}
}

def equalsNumChar(xn: Number, yc: Character): Boolean = {
if (yc == null) return xn == null
val ch = yc.charValue
(typeCode(xn): @switch) match {
case INT => xn.intValue == ch
case LONG => xn.longValue == ch
case FLOAT => xn.floatValue == ch
case DOUBLE => xn.doubleValue == ch
case _ => xn == ch.toInt
}
}
}
Loading