Skip to content

Commit

Permalink
feat: Create new JITC engine (#205)
Browse files Browse the repository at this point in the history
Fixes #202
  • Loading branch information
markehammons authored May 28, 2023
1 parent b3cee5f commit 8e2ad0c
Show file tree
Hide file tree
Showing 19 changed files with 456 additions and 402 deletions.
2 changes: 1 addition & 1 deletion build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import mill.contrib.scoverage.{ScoverageModule, ScoverageReport}
object scoverage extends BaseModule with ScoverageReport

trait BaseModule extends ScoverageModule with ScalafmtModule {
def scalaVersion = "3.3.0-RC6"
def scalaVersion = "3.3.0"
def scoverageVersion = "2.0.7"

val munitVersion = "1.0.0-M7"
Expand Down
111 changes: 0 additions & 111 deletions core/src/fr/hammons/slinc/Fn.scala

This file was deleted.

133 changes: 0 additions & 133 deletions core/src/fr/hammons/slinc/JitManager.scala

This file was deleted.

3 changes: 2 additions & 1 deletion core/src/fr/hammons/slinc/Ptr.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package fr.hammons.slinc
import scala.reflect.ClassTag
import fr.hammons.slinc.modules.DescriptorModule
import fr.hammons.slinc.modules.ReadWriteModule
import fr.hammons.slinc.fnutils.{Fn, toNativeCompatible}

class Ptr[A](private[slinc] val mem: Mem, private[slinc] val offset: Bytes):
inline def `unary_!`(using rwm: ReadWriteModule): A =
Expand Down Expand Up @@ -86,6 +87,6 @@ object Ptr:
)

inline def upcall[A](inline a: A)(using alloc: Allocator): Ptr[A] =
val nFn = Fn.toNativeCompatible(a)
val nFn = toNativeCompatible(a)
val descriptor = FunctionDescriptor.fromFunction[A]
Ptr[A](alloc.upcall(descriptor, nFn), Bytes(0))
2 changes: 0 additions & 2 deletions core/src/fr/hammons/slinc/Slinc.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import types.SizeT

trait Slinc:
val version: Int
protected def jitManager: JitManager

protected def scopePlatformSpecific: ScopeI.PlatformSpecific

given dm: DescriptorModule
Expand Down
32 changes: 32 additions & 0 deletions core/src/fr/hammons/slinc/fnutils/Fn.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package fr.hammons.slinc.fnutils

sealed trait Fn[A, B <: Tuple, C]

object Fn:
given [Z]: Fn[() => Z, EmptyTuple, Z] with {}
given [A, Z]: Fn[A => Z, Tuple1[A], Z] with {}
given [A, B, Z]: Fn[(A, B) => Z, (A, B), Z] with {}
given [A, B, C, Z]: Fn[(A, B, C) => Z, (A, B, C), Z] with {}
given [A, B, C, D, Z]: Fn[(A, B, C, D) => Z, (A, B, C, D), Z] with {}
given [A, B, C, D, E, Z]: Fn[(A, B, C, D, E) => Z, (A, B, C, D, E), Z] with {}
given [A, B, C, D, E, F, Z]
: Fn[(A, B, C, D, E, F) => Z, (A, B, C, D, E, F), Z] with {}
given [A, B, C, D, E, F, G, Z]
: Fn[(A, B, C, D, E, F, G) => Z, (A, B, C, D, E, F, G), Z] with {}
given [A, B, C, D, E, F, G, H, Z]
: Fn[(A, B, C, D, E, F, G, H) => Z, (A, B, C, D, E, F, G, H), Z] with {}
given [A, B, C, D, E, F, G, H, I, Z]
: Fn[(A, B, C, D, E, F, G, H, I) => Z, (A, B, C, D, E, F, G, H, I), Z]
with {}

given [A, B, C, D, E, F, G, H, I, J, Z]: Fn[
(A, B, C, D, E, F, G, H, I, J) => Z,
(A, B, C, D, E, F, G, H, I, J),
Z
] with {}

given [A, B, C, D, E, F, G, H, I, J, K, Z]: Fn[
(A, B, C, D, E, F, G, H, I, J, K) => Z,
(A, B, C, D, E, F, G, H, I, J, K),
Z
] with {}
Loading

0 comments on commit 8e2ad0c

Please sign in to comment.