Skip to content

Commit 8e2ad0c

Browse files
authored
feat: Create new JITC engine (#205)
Fixes #202
1 parent b3cee5f commit 8e2ad0c

File tree

19 files changed

+456
-402
lines changed

19 files changed

+456
-402
lines changed

build.sc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import mill.contrib.scoverage.{ScoverageModule, ScoverageReport}
1313
object scoverage extends BaseModule with ScoverageReport
1414

1515
trait BaseModule extends ScoverageModule with ScalafmtModule {
16-
def scalaVersion = "3.3.0-RC6"
16+
def scalaVersion = "3.3.0"
1717
def scoverageVersion = "2.0.7"
1818

1919
val munitVersion = "1.0.0-M7"

core/src/fr/hammons/slinc/Fn.scala

Lines changed: 0 additions & 111 deletions
This file was deleted.

core/src/fr/hammons/slinc/JitManager.scala

Lines changed: 0 additions & 133 deletions
This file was deleted.

core/src/fr/hammons/slinc/Ptr.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package fr.hammons.slinc
33
import scala.reflect.ClassTag
44
import fr.hammons.slinc.modules.DescriptorModule
55
import fr.hammons.slinc.modules.ReadWriteModule
6+
import fr.hammons.slinc.fnutils.{Fn, toNativeCompatible}
67

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

8889
inline def upcall[A](inline a: A)(using alloc: Allocator): Ptr[A] =
89-
val nFn = Fn.toNativeCompatible(a)
90+
val nFn = toNativeCompatible(a)
9091
val descriptor = FunctionDescriptor.fromFunction[A]
9192
Ptr[A](alloc.upcall(descriptor, nFn), Bytes(0))

core/src/fr/hammons/slinc/Slinc.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ import types.SizeT
77

88
trait Slinc:
99
val version: Int
10-
protected def jitManager: JitManager
11-
1210
protected def scopePlatformSpecific: ScopeI.PlatformSpecific
1311

1412
given dm: DescriptorModule
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package fr.hammons.slinc.fnutils
2+
3+
sealed trait Fn[A, B <: Tuple, C]
4+
5+
object Fn:
6+
given [Z]: Fn[() => Z, EmptyTuple, Z] with {}
7+
given [A, Z]: Fn[A => Z, Tuple1[A], Z] with {}
8+
given [A, B, Z]: Fn[(A, B) => Z, (A, B), Z] with {}
9+
given [A, B, C, Z]: Fn[(A, B, C) => Z, (A, B, C), Z] with {}
10+
given [A, B, C, D, Z]: Fn[(A, B, C, D) => Z, (A, B, C, D), Z] with {}
11+
given [A, B, C, D, E, Z]: Fn[(A, B, C, D, E) => Z, (A, B, C, D, E), Z] with {}
12+
given [A, B, C, D, E, F, Z]
13+
: Fn[(A, B, C, D, E, F) => Z, (A, B, C, D, E, F), Z] with {}
14+
given [A, B, C, D, E, F, G, Z]
15+
: Fn[(A, B, C, D, E, F, G) => Z, (A, B, C, D, E, F, G), Z] with {}
16+
given [A, B, C, D, E, F, G, H, Z]
17+
: Fn[(A, B, C, D, E, F, G, H) => Z, (A, B, C, D, E, F, G, H), Z] with {}
18+
given [A, B, C, D, E, F, G, H, I, Z]
19+
: Fn[(A, B, C, D, E, F, G, H, I) => Z, (A, B, C, D, E, F, G, H, I), Z]
20+
with {}
21+
22+
given [A, B, C, D, E, F, G, H, I, J, Z]: Fn[
23+
(A, B, C, D, E, F, G, H, I, J) => Z,
24+
(A, B, C, D, E, F, G, H, I, J),
25+
Z
26+
] with {}
27+
28+
given [A, B, C, D, E, F, G, H, I, J, K, Z]: Fn[
29+
(A, B, C, D, E, F, G, H, I, J, K) => Z,
30+
(A, B, C, D, E, F, G, H, I, J, K),
31+
Z
32+
] with {}

0 commit comments

Comments
 (0)