-
Notifications
You must be signed in to change notification settings - Fork 49
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
[scheduler] scala native support #866
Conversation
f362727
to
2679f0d
Compare
@@ -92,7 +93,8 @@ abstract private class Worker( | |||
|
|||
val a1, a2, a3, a4, a5, a6, a7 = 0L // padding | |||
|
|||
@volatile private var state: State = State.Idle | |||
private val state = new AtomicReference[State](State.Idle) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Scala Native doesn't support method handles. This change might have a performance penalty but it seems worth it.
@@ -0,0 +1,11 @@ | |||
package kyo.scheduler.util |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be shared with JS?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The scheduler in JS is a separate and much simpler implementation since the runtime doesn't support threads. JS doesn't require a stub for this.
private[scheduler] def statsScope = | ||
StatsRegistry.scope("kyo", "scheduler") | ||
|
||
private[scheduler] def bug(msg: String, ex: Throwable) = | ||
log.log(Level.SEVERE, s"🙈 !!Kyo Scheduler Bug!!", new Exception(msg, ex)) | ||
new Exception(s"🙈 !!Kyo Scheduler Bug!! " + msg, ex).printStackTrace() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no java logging in native. Logging to the standard err seems reasonable for a bug.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is! https://github.com/scala-native/scala-native-java-logging
Guess which project motivated me to make the port of this library? Kyo itself 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've opened a PR #868
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ha! pretty cool :) It's nice to see the ecosystem growing. I was a bit skeptical of Scala Native initially but I think that was skewed by my experience working with Graal. Many Scala projects are mostly self-contained code that are trivial to port to Native if the ecosystem is more mature. Graal is great but it can also be a nightmare to set up. I'd say the odds is that kyo-tapir will have a Scala Native version before one that works on GraalVM Native 😅
First step to support Scala Native in
kyo-core
.