0.4.11 (2023-03-15)¶
We’re happy to announce the release of Scala Native. It’s the next maintenance release for Scala Native 0.4.x. As always it brings bug fixes and minor improvements.
Notable changes¶
Extern methods with a variadic number of arguments¶
For a long time, Scala Native supported C va_list
using scalanative.unsafe.CVarArgList
. This allowed for interop with some of the C functions taking the variadic number of arguments. This release makes usage and definition of them easier, by restoring support for idiomatic ways of passing them using Scala variadic arguments lists.
void printf(char* format, ...);
@extern def printf(format: CString, args: Any*): Unit = extern
@main def test() =
val msg = c"MyMessage"
printf("String '%s' is allocated at %p and has %d characters\n", msg, msg, strlen(msg))
Support for LLVM 15¶
The latest versions of LLVM added a new internal representation of pointers - their opaque variant replaces typed pointers. This change should not affect most of the users, but in some specific builds it could have lead to linking issues. Now Scala Native will try to detect version of LLVM toolchain. When using LLVM 15 or newer Scala Native toolchain would always generate opaque pointers in the compiled LLVM IR.
The Scala standard library used by this release is based on the following versions:
Scala binary version | Scala release |
2.12 | 2.12.17 |
2.13 | 2.13.10 |
3 | 3.2.2 |
Commits since last release | 43 |
Merged PRs | 40 |
Contributors | 6 |
Contributors¶
Big thanks to everybody who contributed to this release or reported an issue!
$ git shortlog -sn --no-merges v0.4.10..v0.4.11
24 Wojciech Mazur
14 LeeTibbert
2 Arman Bilge
1 João Costa
1 Ondra Pelech
1 philwalk
Merged PRs¶
(2023-03-16)¶
Merged pull requests:
Java Standard Library¶
Partial Fix #3090: j.nio.MappedByteBuffer no longer causes segmentation fault on FreeBSD64 #3113 (LeeTibbert)
Port all missing
java.util.function
types #3127 (WojciechMazur)Fix #3131: javalib ServerSocket should now be more accepting #3140 (LeeTibbert)
Fix #3153: j.nio.fs.FileHelpers uses only java.io.tmp property for temporary files/dirs #3155 (LeeTibbert)
Fix #3071, #3135: Implement Java 11 writeString & readString methods and Java 10 transferTo #3159 (LeeTibbert)
Fix #2937, 3163: improved j.nio.f.Files default directory idiom handling #3166 (LeeTibbert)
Partial fix #3165: Port two JSR-166 concurrent interfaces/traits: BlockingDeque, TransferQueue #3188 (LeeTibbert)
Fix #3192. #3194: Implement limited java spliterator support #3202 (LeeTibbert)
javalib Spliterators trySplit() methods now split #3218 (LeeTibbert)
POSIX bindings¶
posixlib socket.c now compiles on FreeBSD arm64 #3112 (LeeTibbert)
Fix #1642: posixlib stdio.scala is now mostly Open Group 2018 compliant #3160 (LeeTibbert)
Fix #3206: posixlib unistd and monetary use new CVarArgs support #3209 (LeeTibbert)
Compiler plugin¶
Fix generation of CFuncPtr extern forwarders using opaque types #3182 (WojciechMazur)
Don’t emit
Inst.Jump
/Inst.Label
in NIR taking singleUnit
argument #3201 (WojciechMazur)Restore support for C VarArgs alongside current CVarArgLists #3204 (WojciechMazur)
Allow for materialization of
Tag[Ptr[_]]
or taking abstract type #3207 (WojciechMazur)
Toolchain¶
Define null guards for methods using
this
#3123 (WojciechMazur)Fix #3173: Linux executable file .comment section shows build info #3183 (LeeTibbert)
Use opaque pointers in generated LLVM IR when possible #3190 (WojciechMazur)
Don’t emit debug logs when skipping embeding source files #3191 (WojciechMazur)
Emit
Val.Unit
/Type.Unit
asvoid
in LLVM IR instead of ref toBoxedUnit
#3200 (WojciechMazur)Restore stack state after executing inlined function to prevent stack overflows #3199 (WojciechMazur)
Fix poisonous new lines escapes in
nir.Show
leading to linker failures #3208 (WojciechMazur)
Runtime¶
Update LLVM libunwind to 15.0.7 (was 12.0.1) #3184 (WojciechMazur)
Commix GC - fix deadlocks due to missaligned pointers when marking range #3185 (WojciechMazur)
sbt plugin¶
Port
definedTestNames
override from Scala.js #3203 (armanbilge)