Auxiliary libraries for Scala Native runtime providing essential runtime support including boxed types, concurrent collections, and utility functions
npx @tessl/cli install tessl/maven-org-scala-native--auxlib-native0-5-3@0.5.0The auxlib library provides essential runtime support components for Scala Native, including boxed primitive types, concurrent collection infrastructure, array utilities, reference type wrappers, and mathematical abstractions. This low-level library serves as a foundational layer for Scala Native's runtime system, enabling proper interoperability between Scala's type system and native code execution.
libraryDependencies += "org.scala-native" %%% "auxlib" % "0.5.7"import scala.runtime.BoxesRunTime
import scala.runtime.{BooleanRef, IntRef, ObjectRef}
import scala.math.ScalaNumber
import scala.collection.concurrent.{BasicNode, MainNode}import scala.runtime.BoxesRunTime
import scala.runtime.IntRef
// Boxing and unboxing primitives
val boxedInt = BoxesRunTime.boxToInteger(42)
val unboxedInt = BoxesRunTime.unboxToInt(boxedInt)
// Using reference types for mutable variables
val intRef = IntRef.create(10)
intRef.elem = 20
println(intRef.elem) // 20
// Arithmetic operations on boxed values
val a = BoxesRunTime.boxToInteger(5)
val b = BoxesRunTime.boxToInteger(3)
val sum = BoxesRunTime.add(a, b)
val result = BoxesRunTime.unboxToInt(sum) // 8The auxlib library is organized into five main functional areas:
This design provides the essential runtime infrastructure that bridges Scala language features with native compilation and execution models.
Comprehensive boxing/unboxing utilities with arithmetic, bitwise, and logical operators for primitive types. Handles type coercion and provides runtime support for Scala's unified type system.
object BoxesRunTime {
def boxToInteger(v: Int): java.lang.Integer
def unboxToInt(o: java.lang.Object): Int
def add(arg1: java.lang.Object, arg2: java.lang.Object): java.lang.Object
def equals(x: java.lang.Object, y: java.lang.Object): Boolean
}Mutable and volatile reference wrappers for all primitive types and objects. Provides thread-safe access patterns and atomic operations support.
class IntRef(var elem: Int) extends Serializable
object IntRef {
def create(elem: Int): IntRef
def zero(): IntRef
}
class VolatileIntRef(@volatile var elem: Int) extends SerializableArray cloning utilities supporting all primitive array types and object arrays with proper type preservation.
object ArrayRuntime {
def cloneArray(array: Array[Int]): Array[Int]
def cloneArray(array: Array[java.lang.Object]): Array[java.lang.Object]
}Base classes and atomic field updaters for building lock-free concurrent data structures. Provides the foundation for Scala's concurrent collections.
abstract class BasicNode {
def string(lev: Int): String
}
abstract class MainNode[K <: AnyRef, V <: AnyRef] extends BasicNode {
def cachedSize(ct: Object): Int
def knownSize(): Int
}Abstract base classes for Scala's numeric type hierarchy, providing foundation for custom numeric types and mathematical operations.
abstract class ScalaNumber extends java.lang.Number {
protected def isWhole(): Boolean
def underlying(): Object
}class BooleanRef(var elem: Boolean) extends Serializable
class CharRef(var elem: Char) extends Serializable
class ByteRef(var elem: Byte) extends Serializable
class ShortRef(var elem: Short) extends Serializable
class IntRef(var elem: Int) extends Serializable
class LongRef(var elem: Long) extends Serializable
class FloatRef(var elem: Float) extends Serializable
class DoubleRef(var elem: Double) extends Serializable
class ObjectRef[A](var elem: A) extends Serializableclass VolatileBooleanRef(@volatile var elem: Boolean) extends Serializable
class VolatileIntRef(@volatile var elem: Int) extends Serializable
class VolatileObjectRef[A](@volatile var elem: A) extends Serializableabstract class BasicNode
abstract class MainNode[K <: AnyRef, V <: AnyRef] extends BasicNode
abstract class INodeBase[K <: AnyRef, V <: AnyRef](generation: Gen) extends BasicNode
abstract class CNodeBase[K <: AnyRef, V <: AnyRef] extends MainNode[K, V]