-
Notifications
You must be signed in to change notification settings - Fork 59
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
feat: minimal stub implementation for kyo-offheap
#1072
feat: minimal stub implementation for kyo-offheap
#1072
Conversation
Adds a minimal stub implementation for `kyo-offheap` to enable support for Scala Native. - `Arena` class manages off-heap memory allocations with automatic deallocation. - `MemorySegment` class provides basic operations for slicing and accessing primitive values in off-heap memory. This implementation forms the basis for integrating off-heap memory management with Scala Native in the `kyo-offheap` module. Signed-off-by: Akhilender Bongirwar <[email protected]>
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.
Nice! I have a few suggestions for improvement.
kyo-offheap/native/src/main/java/lang/foreign/MemorySegment.scala
Outdated
Show resolved
Hide resolved
kyo-offheap/native/src/main/java/lang/foreign/MemorySegment.scala
Outdated
Show resolved
Hide resolved
kyo-offheap/native/src/main/java/lang/foreign/MemorySegment.scala
Outdated
Show resolved
Hide resolved
From my past attempt for this problem, the biggest challenge was how to create a native |
Signed-off-by: Akhilender Bongirwar <[email protected]>
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.
Thanks for implementing my suggestions. There is still some work that needs to be done.
kyo-offheap/native/src/main/java/lang/foreign/MemorySegment.scala
Outdated
Show resolved
Hide resolved
Signed-off-by: Akhilender Bongirwar <[email protected]>
Signed-off-by: Akhilender Bongirwar <[email protected]>
kyo-offheap/native/src/main/java/lang/foreign/MemorySegment.scala
Outdated
Show resolved
Hide resolved
kyo-offheap/native/src/main/java/lang/foreign/MemorySegment.scala
Outdated
Show resolved
Hide resolved
kyo-offheap/native/src/main/java/lang/foreign/MemorySegment.scala
Outdated
Show resolved
Hide resolved
kyo-offheap/native/src/main/java/lang/foreign/MemorySegment.scala
Outdated
Show resolved
Hide resolved
kyo-offheap/native/src/main/java/lang/foreign/MemorySegment.scala
Outdated
Show resolved
Hide resolved
Signed-off-by: Akhilender Bongirwar <[email protected]>
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.
We're getting there.
kyo-offheap/native/src/main/java/lang/foreign/MemorySegment.scala
Outdated
Show resolved
Hide resolved
kyo-offheap/native/src/main/java/lang/foreign/MemorySegment.scala
Outdated
Show resolved
Hide resolved
kyo-offheap/native/src/main/java/lang/foreign/MemorySegment.scala
Outdated
Show resolved
Hide resolved
kyo-offheap/native/src/main/java/lang/foreign/MemorySegment.scala
Outdated
Show resolved
Hide resolved
Signed-off-by: Akhilender Bongirwar <[email protected]>
af9a80b
to
1f52ae7
Compare
Thank you for the contribution! This is looking promising :) I took a look at the build and the new native implementation isn't being tested, we also need changes in the SBT build: diff --git a/build.sbt b/build.sbt
index 2de5dd29..5fa03824 100644
--- a/build.sbt
+++ b/build.sbt
@@ -161,6 +161,7 @@ lazy val kyoNative = project
`kyo-stats-registry`.native,
`kyo-scheduler`.native,
`kyo-core`.native,
+ `kyo-offheap`.native,
`kyo-direct`.native,
`kyo-combinators`.native,
`kyo-sttp`.native
@@ -334,7 +335,7 @@ lazy val `kyo-core` =
)
lazy val `kyo-offheap` =
- crossProject(JVMPlatform)
+ crossProject(JVMPlatform, NativePlatform)
.withoutSuffixFor(JVMPlatform)
.crossType(CrossType.Full)
.in(file("kyo-offheap")) I've added these changes locally and noticed that there are compilation failures. To validate changes, please make sure the tests are passing: |
Signed-off-by: Akhilender Bongirwar <[email protected]>
Signed-off-by: Akhilender Bongirwar <[email protected]>
Although I have used the correct imports and syntax as per https://scala-native.org/en/stable/user/interop.html but still I get errors like |
kyo-offheap/native/src/main/java/lang/foreign/MemorySegment.scala
Outdated
Show resolved
Hide resolved
kyo-offheap/native/src/main/java/lang/foreign/MemorySegment.scala
Outdated
Show resolved
Hide resolved
kyo-offheap/native/src/main/java/lang/foreign/MemorySegment.scala
Outdated
Show resolved
Hide resolved
kyo-offheap/native/src/main/java/lang/foreign/MemorySegment.scala
Outdated
Show resolved
Hide resolved
kyo-offheap/native/src/main/java/lang/foreign/MemorySegment.scala
Outdated
Show resolved
Hide resolved
kyo-offheap/native/src/main/java/lang/foreign/MemorySegment.scala
Outdated
Show resolved
Hide resolved
I am travelling and currently don't have access to my laptop, I will be back by 21st Feb night. |
Signed-off-by: Akhilender Bongirwar <[email protected]>
98dfefb
to
ca68b9a
Compare
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.
You still need to align the names with the official Java version.
kyo-offheap/native/src/main/java/lang/foreign/MemorySegment.scala
Outdated
Show resolved
Hide resolved
kyo-offheap/native/src/main/java/lang/foreign/MemorySegment.scala
Outdated
Show resolved
Hide resolved
kyo-offheap/native/src/main/java/lang/foreign/MemorySegment.scala
Outdated
Show resolved
Hide resolved
Signed-off-by: Akhilender Bongirwar <[email protected]>
Due to the compilation errors, I have modified the
Although there are no compilation errors now but there are new errors in
|
Signed-off-by: Akhilender Bongirwar <[email protected]>
@akhilender-bongirwar if you're having trouble due to the methods being |
- fixed conflicts - removed inline in `Memory.scala` - all compilation errors are suceessfully resolved - Todo: only one test in failing in `MemoryTest.scla` Signed-off-by: Akhilender Bongirwar <[email protected]>
Thx! @fwbrasil. I have modified code accordingly but still trying to figure out one failing test case. |
Signed-off-by: Akhilender Bongirwar <[email protected]>
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.
happy to see the tests pass, great job! 🎉
kyo-offheap/native/src/main/java/lang/foreign/MemorySegment.scala
Outdated
Show resolved
Hide resolved
kyo-offheap/native/src/main/java/lang/foreign/MemorySegment.scala
Outdated
Show resolved
Hide resolved
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.
Still needs more checkOpen to ensure correctness.
kyo-offheap/native/src/main/java/lang/foreign/MemorySegment.scala
Outdated
Show resolved
Hide resolved
kyo-offheap/native/src/main/java/lang/foreign/MemorySegment.scala
Outdated
Show resolved
Hide resolved
Signed-off-by: Akhilender Bongirwar <[email protected]>
@sideeffffect done! |
congrats on your first contribution @akhilender-bongirwar! I've increased the bounty to $250 |
and thank you @sideeffffect for the help with the reviews 🙏 |
Thank you @fwbrasil 🙏 and thank you @sideeffffect 🙏 for reviews and providing relevant official docs links, it truly helped : ) |
@fwbrasil @sideeffffect, I've noticed a failing check following the merge of my PR. All checks passed during the PR process, so I'm unsure if this failure is related to my changes. Could you please let me know if it's something I need to address? If so, I'll make the necessary modifications and submit a new PR with your guidance. |
Adds a minimal stub implementation for
kyo-offheap
to enable support for Scala Native.Arena
class manages off-heap memory allocations with automatic deallocation.MemorySegment
class provides basic operations for slicing and accessing primitive values in off-heap memory.This implementation forms the basis for integrating off-heap memory management with Scala Native in the
kyo-offheap
module.Related Issue - #1053
/claim #1053