scalan
package scalan
- Alphabetic
- By Inheritance
- scalan
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Package Members
- package meta
- package primitives
- package reflection
Contains the Sigma Reflection API.
Contains the Sigma Reflection API. Sigma reflection is a mechanism for obtaining metadata about classes, methods, fields, etc. at runtime. It is used by kiama to rewrite ErgoTree expressions. It is also used by the ErgoTree interpreter to implement MethodCall nodes.
The Sigma Reflection API has two implementations: 1) based on the Java Reflection API 2) based on Sigma Reflection metadata declared in the StaticImpl.scala file
- package staged
- package util
Type Members
- final class AVHashMap[K, V] extends AnyVal
Allocation free alternative to scala.collection.mutable.Map with similar interface.
Allocation free alternative to scala.collection.mutable.Map with similar interface. This simplifies optimization of performance critical code.
- abstract class Base extends AnyRef
The Base trait houses common AST nodes.
The Base trait houses common AST nodes. It also manages a list of encountered definitions which allows for common sub-expression elimination (CSE).
- abstract class DFunc[A, B] extends AnyRef
Function interface which support specialization and thus unboxed invocations.
- trait DefRewriting extends AnyRef
- class DelayInvokeException extends Exception
Can be thrown in staged method body to prevent body unfolding.
Can be thrown in staged method body to prevent body unfolding. When this exception is thrown, the caller can catch it and reify this invocation as MethodCall graph node.
- trait Entities extends TypeDescs
A slice in the Scalan cake with base classes for various descriptors.
- trait ExactIntegral[T] extends ExactNumeric[T]
Type-class which defines the operations on Integral types (Byte, Short, Int, Long, BigInt) with overflow checks.
Type-class which defines the operations on Integral types (Byte, Short, Int, Long, BigInt) with overflow checks.
An exception is raised when an overflow is detected. Each concrete instance of this type-class overrides three methods
plus
,minus
,times
.By default all the methods are implemented by delegating to the corresponding Integral instance from the standard Scala library.
This trait is used in core IR to avoid implicitly using standard scala implementations.
- trait ExactNumeric[T] extends AnyRef
Numeric operations with overflow checks.
Numeric operations with overflow checks. Raise exception when overflow is detected. Each instance of this typeclass overrides three methods
plus
,minus
,times
. All other methods are implemented by delegating to the corresponding Numeric instance from standard Scala library. This trait is used in core IR to avoid implicitly using standard scala implementations - trait ExactOrdering[T] extends Ordering[T]
Ordering operations to be used with other Exact traits.
Ordering operations to be used with other Exact traits. All methods are implemented by delegating to the corresponding Ordering instance from standard Scala library. This trait is used in core IR to avoid implicitly using standard scala implementations.
- class ExactOrderingImpl[T] extends ExactOrdering[T]
- class Lazy[A] extends AnyRef
Non-thread safe (but efficient on single thread) immutable lazy value.
Non-thread safe (but efficient on single thread) immutable lazy value. The
block
is executed only once. - trait Library extends Scalan with WrappersModule with CollsModule
- trait MethodCalls extends Base
- case class ModuleInfo(packageName: String, moduleName: String, extension: String = ".scalan") extends Product with Serializable
Information about generated Special library module.
Information about generated Special library module. Instances are created in generated code.
- See also
*Impl.scala files
- trait Modules extends Base
- final class MutableLazy[A] extends AnyRef
Non-thread safe (but efficient on single thread) immutable lazy value with reset.
Non-thread safe (but efficient on single thread) immutable lazy value with reset. The
block
may execute potentially many times, but only once before each reset. - final class Nullable[+T] extends AnyVal
Allocation free alternative to scala.Option with similar interface.
Allocation free alternative to scala.Option with similar interface. Using this in recognizers allows: 1) to avoid allocation of Some(x) 2) reading random memory location (where Some is stored) to access x
- abstract class RType[A] extends AnyRef
Base type for all runtime type descriptors.
Base type for all runtime type descriptors. Sigma uses type descriptors to represent structure of the data values. Data values of registers and context variables come equipped with type descriptors in order to check the actual type is the same as the type expected by the script.
- Annotations
- @implicitNotFound()
- See also
getReg, getVar
- class Scalan extends TypeDescs with MethodCalls with Tuples with NumericOps with UnBinOps with LogicalOps with OrderingOps with Equal with UniversalOps with Functions with IfThenElse with Transforming with Thunks with Entities with Modules with DefRewriting
Aggregate cake with all inter-dependent modules assembled together.
Aggregate cake with all inter-dependent modules assembled together. Each instance of this class contains independent IR context, thus many instances can be created simultaneously. However, the inner types declared in the traits are path-dependant. This in particular means that ctx1.Ref[_] and ctx2.Ref[_] are different types. The typical usage is to create
val ctx = new Scalan
and then import inner declarations usingimport ctx._
. This way the declaration will be directly available as if they were global declarations. At the same time cake design pattern allow tooverride
many methods and values in classed derived fromScalan
, this is significant benefit over *everything is global* design. - trait SigmaLibrary extends Scalan with Library with WrappersModule with SigmaDslModule
Main trait which represents sigma operations in graph IR cake.
- abstract class TypeDescs extends Base
- trait WrapSpec extends AnyRef
Base type for all wrapper specification classes.
Base type for all wrapper specification classes.
- See also
OptionWrapSpec as an example
Value Members
- val EmptyArrayOfInt: Array[Int]
Immutable empty array of integers, should be used instead of allocating new empty arrays.
- val EmptySeqOfInt: Seq[Int]
Immutable empty Seq[Int] backed by empty array.
Immutable empty Seq[Int] backed by empty array. You should prefer using it instead of
Seq[Int]()
orSeq.empty[Int]
- def emptyDBufferOfInt: Buffer[Int]
Create a new empty buffer around pre-allocated empty array.
Create a new empty buffer around pre-allocated empty array. This method is preferred, rather that creating empty debox.Buffer directly because it allows to avoid allocation of the empty array. Note, this method allocates a new Buffer, but the underlying empty array is shared. This is safe because empty arrays are immutable.
- implicit def rtypeToClassTag[A](implicit t: RType[A]): ClassTag[A]
Allows implicit resolution to find appropriate instance of ClassTag in the scope where RType is implicitly available.
- object AVHashMap
- object ExactIntegral
ExactIntegral instances for all types.
- object ExactNumeric
- object ExactOrdering extends Serializable
ExactOrdering instances for all types.
- object GraphIRReflection
Registrations of reflection metadata for graph-ir module (see README.md).
Registrations of reflection metadata for graph-ir module (see README.md). For each class of this module that needs reflection metadata, we register a class entry with the necessary information. Only information that is needed at runtime is registered.
- object Lazy
- object MutableLazy
- object Nullable
- object OverloadHack
Scala specific trick to appease erasure of methods argument types.
Scala specific trick to appease erasure of methods argument types. Example usage: def m1(l: List[Int])(implicit o: Overloaded1) def m2(l: List[String])(implicit o: Overloaded2) Without the implicit arguments the methods would have identical signatures after erasure, which is a compilation time error.
- object RType