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

Update scala-native dependencies #26

Merged
merged 5 commits into from
Dec 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,5 @@ jobs:
run: sudo apt-get install clang libstdc++-12-dev libgc-dev
- name: Test
run: sbt rootNative/test
- name: Stress Test with Lower Memory
run: env GC_MAXIMUM_HEAP_SIZE=512M sbt 'rootNative/testOnly StressTest'
44 changes: 25 additions & 19 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,28 @@ ThisBuild / scalaVersion := "3.3.1"

lazy val root =
crossProject(JVMPlatform, NativePlatform)
.crossType(CrossType.Full)
.in(file("."))
.settings(Seq(
name := "Gears",
organization := "ch.epfl.lamp",
version := "0.1.0-SNAPSHOT",
testFrameworks += new TestFramework("munit.Framework")
))
.jvmSettings(Seq(
javaOptions += "--version 21",
libraryDependencies += "org.scalameta" %% "munit" % "1.0.0-M10" % Test
))
.nativeSettings(Seq(
nativeConfig ~= { c =>
c.withMultithreadingSupport(true)
.withGC(GC.boehm) // immix doesn't work yet
},
libraryDependencies += "org.scalameta" %%% "munit" % "1.0.0-M10+15-3940023e-SNAPSHOT" % Test
))
.crossType(CrossType.Full)
.in(file("."))
.settings(
Seq(
name := "Gears",
organization := "ch.epfl.lamp",
version := "0.1.0-SNAPSHOT",
testFrameworks += new TestFramework("munit.Framework")
)
)
.jvmSettings(
Seq(
javaOptions += "--version 21",
libraryDependencies += "org.scalameta" %% "munit" % "1.0.0-M10" % Test
)
)
.nativeSettings(
Seq(
nativeConfig ~= { c =>
c.withMultithreadingSupport(true)
.withGC(GC.boehm)
},
libraryDependencies += "org.scalameta" %%% "munit" % "1.0.0-M10+16-4e2ab919-SNAPSHOT" % Test
)
)
2 changes: 1 addition & 1 deletion dependencies/scala-native
Submodule scala-native updated 42 files
+27 −3 .github/actions/windows-setup-env/action.yml
+2 −2 .github/workflows/run-tests-linux.yml
+3 −3 .github/workflows/run-tests-macos.yml
+2 −4 .github/workflows/run-tests-windows.yml
+8 −6 junit-runtime/src/main/scala/scala/scalanative/junit/Reporter.scala
+52 −48 nativelib/src/main/resources/scala-native/gc/commix/Allocator.c
+1 −0 nativelib/src/main/resources/scala-native/gc/commix/Allocator.h
+29 −3 nativelib/src/main/resources/scala-native/gc/commix/BlockAllocator.c
+4 −0 nativelib/src/main/resources/scala-native/gc/commix/BlockAllocator.h
+73 −1 nativelib/src/main/resources/scala-native/gc/commix/CommixGC.c
+36 −14 nativelib/src/main/resources/scala-native/gc/commix/Heap.c
+3 −0 nativelib/src/main/resources/scala-native/gc/commix/Heap.h
+11 −10 nativelib/src/main/resources/scala-native/gc/commix/LargeAllocator.c
+89 −42 nativelib/src/main/resources/scala-native/gc/commix/Marker.c
+115 −0 nativelib/src/main/resources/scala-native/gc/commix/MutatorThread.c
+52 −0 nativelib/src/main/resources/scala-native/gc/commix/MutatorThread.h
+5 −2 nativelib/src/main/resources/scala-native/gc/commix/Phase.c
+4 −2 nativelib/src/main/resources/scala-native/gc/commix/State.c
+7 −4 nativelib/src/main/resources/scala-native/gc/commix/State.h
+40 −9 nativelib/src/main/resources/scala-native/gc/commix/Sweeper.c
+208 −0 nativelib/src/main/resources/scala-native/gc/commix/Synchronizer.c
+13 −0 nativelib/src/main/resources/scala-native/gc/commix/Synchronizer.h
+0 −1 nativelib/src/main/resources/scala-native/gc/commix/WeakRefGreyList.c
+17 −7 nativelib/src/main/resources/scala-native/gc/immix/Heap.c
+5 −5 nativelib/src/main/resources/scala-native/gc/immix/MutatorThread.c
+8 −8 nativelib/src/main/resources/scala-native/gc/immix/Synchronizer.c
+37 −5 nir/src/main/scala/scala/scalanative/nir/MemoryOrder.scala
+13 −0 nir/src/main/scala/scala/scalanative/nir/SyncAttrs.scala
+200 −72 nir/src/main/scala/scala/scalanative/nir/Vals.scala
+15 −2 project/Commands.scala
+112 −0 project/MyScalaNativePlugin.scala
+1 −0 project/build.sbt
+3 −0 test-interface-common/src/main/scala/scala/scalanative/testinterface/common/RPCCore.scala
+6 −3 test-interface/src/main/scala/scala/scalanative/testinterface/NativeRPC.scala
+2 −1 test-interface/src/main/scala/scala/scalanative/testinterface/TestMain.scala
+0 −4 test-interface/src/main/scala/scala/scalanative/testinterface/signalhandling/SignalConfig.scala
+2 −2 test-runner/src/main/scala/scala/scalanative/testinterface/ComRunner.scala
+6 −2 test-runner/src/main/scala/scala/scalanative/testinterface/adapter/RunnerAdapter.scala
+1 −1 test-runner/src/main/scala/scala/scalanative/testinterface/adapter/TestAdapter.scala
+0 −5 tools/src/main/scala/scala/scalanative/build/Validator.scala
+2 −2 tools/src/main/scala/scala/scalanative/codegen/Lower.scala
+1 −1 unit-tests/native/src/test/scala/scala/scalanative/annotation/AlignTest.scala
45 changes: 45 additions & 0 deletions shared/src/test/scala/Stress.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import gears.async.{Async, Future, AsyncSupport, uninterruptible}
import gears.async.AsyncOperations.*
import gears.async.default.given
import gears.async.Future.MutableCollector
import java.util.concurrent.atomic.AtomicInteger
import gears.async.Timer
import scala.concurrent.duration._

class StressTest extends munit.FunSuite:
test("survives a stress test that hammers on creating futures") {
val total = 200_000L
Seq[Long](1, 2, 4, 16, 10000).foreach: parallelism =>
val k = AtomicInteger(0)
def compute(using Async) =
k.incrementAndGet()
Async.blocking:
val collector = MutableCollector((1L to parallelism).map(_ => Future { compute })*)
var sum = 0L
for i <- parallelism + 1 to total do
sum += collector.results.read().right.get.await
collector += Future { compute }
for i <- 1L to parallelism do sum += collector.results.read().right.get.await
assertEquals(sum, total * (total + 1) / 2)
}

test("survives a stress test that hammers on suspending") {
val total = 100_000L
val parallelism = 5000L
Async.blocking:
val sleepy =
val timer = Timer(1.second)
Future { timer.run() }
timer.src
val k = AtomicInteger(0)
def compute(using Async) =
sleepy.awaitResult
k.incrementAndGet()
val collector = MutableCollector((1L to parallelism).map(_ => Future { compute })*)
var sum = 0L
for i <- parallelism + 1 to total do
sum += collector.results.read().right.get.await
collector += Future { compute }
for i <- 1L to parallelism do sum += collector.results.read().right.get.await
assertEquals(sum, total * (total + 1) / 2)
}