aboutsummaryrefslogtreecommitdiff
path: root/lux-jvm
diff options
context:
space:
mode:
Diffstat (limited to 'lux-jvm')
-rw-r--r--lux-jvm/source/luxc/lang/directive/jvm.lux3
-rw-r--r--lux-jvm/source/luxc/lang/host/jvm.lux3
-rw-r--r--lux-jvm/source/luxc/lang/host/jvm/def.lux77
-rw-r--r--lux-jvm/source/luxc/lang/host/jvm/inst.lux181
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm.lux19
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm/extension/common.lux5
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux18
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm/primitive.lux13
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm/reference.lux8
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm/structure.lux12
-rw-r--r--lux-jvm/source/program.lux11
11 files changed, 185 insertions, 165 deletions
diff --git a/lux-jvm/source/luxc/lang/directive/jvm.lux b/lux-jvm/source/luxc/lang/directive/jvm.lux
index 0ec4fb1d5..8f1fab5e2 100644
--- a/lux-jvm/source/luxc/lang/directive/jvm.lux
+++ b/lux-jvm/source/luxc/lang/directive/jvm.lux
@@ -38,7 +38,8 @@
["_" inst]]]])
(import: org/objectweb/asm/Label
- (new []))
+ ["#::."
+ (new [])])
(def: (literal literal)
(-> /.Literal Inst)
diff --git a/lux-jvm/source/luxc/lang/host/jvm.lux b/lux-jvm/source/luxc/lang/host/jvm.lux
index 6d2e49b22..dea97851a 100644
--- a/lux-jvm/source/luxc/lang/host/jvm.lux
+++ b/lux-jvm/source/luxc/lang/host/jvm.lux
@@ -32,7 +32,8 @@
(import: org/objectweb/asm/ClassWriter)
(import: org/objectweb/asm/Label
- (new []))
+ ["#::."
+ (new [])])
(type: #export Def
(-> org/objectweb/asm/ClassWriter org/objectweb/asm/ClassWriter))
diff --git a/lux-jvm/source/luxc/lang/host/jvm/def.lux b/lux-jvm/source/luxc/lang/host/jvm/def.lux
index 0f841ba96..a9003b485 100644
--- a/lux-jvm/source/luxc/lang/host/jvm/def.lux
+++ b/lux-jvm/source/luxc/lang/host/jvm/def.lux
@@ -30,49 +30,52 @@
(import: java/lang/String)
(import: org/objectweb/asm/Opcodes
- (#static ACC_PUBLIC int)
- (#static ACC_PROTECTED int)
- (#static ACC_PRIVATE int)
-
- (#static ACC_TRANSIENT int)
- (#static ACC_VOLATILE int)
-
- (#static ACC_ABSTRACT int)
- (#static ACC_FINAL int)
- (#static ACC_STATIC int)
- (#static ACC_SYNCHRONIZED int)
- (#static ACC_STRICT int)
-
- (#static ACC_SUPER int)
- (#static ACC_INTERFACE int)
-
- (#static V1_1 int)
- (#static V1_2 int)
- (#static V1_3 int)
- (#static V1_4 int)
- (#static V1_5 int)
- (#static V1_6 int)
- (#static V1_7 int)
- (#static V1_8 int)
- )
+ ["#::."
+ (#static ACC_PUBLIC int)
+ (#static ACC_PROTECTED int)
+ (#static ACC_PRIVATE int)
+
+ (#static ACC_TRANSIENT int)
+ (#static ACC_VOLATILE int)
+
+ (#static ACC_ABSTRACT int)
+ (#static ACC_FINAL int)
+ (#static ACC_STATIC int)
+ (#static ACC_SYNCHRONIZED int)
+ (#static ACC_STRICT int)
+
+ (#static ACC_SUPER int)
+ (#static ACC_INTERFACE int)
+
+ (#static V1_1 int)
+ (#static V1_2 int)
+ (#static V1_3 int)
+ (#static V1_4 int)
+ (#static V1_5 int)
+ (#static V1_6 int)
+ (#static V1_7 int)
+ (#static V1_8 int)])
(import: org/objectweb/asm/FieldVisitor
- (visitEnd [] void))
+ ["#::."
+ (visitEnd [] void)])
(import: org/objectweb/asm/MethodVisitor
- (visitCode [] void)
- (visitMaxs [int int] void)
- (visitEnd [] void))
+ ["#::."
+ (visitCode [] void)
+ (visitMaxs [int int] void)
+ (visitEnd [] void)])
(import: org/objectweb/asm/ClassWriter
- (#static COMPUTE_MAXS int)
- (#static COMPUTE_FRAMES int)
- (new [int])
- (visit [int int java/lang/String java/lang/String java/lang/String [java/lang/String]] void)
- (visitEnd [] void)
- (visitField [int java/lang/String java/lang/String java/lang/String java/lang/Object] org/objectweb/asm/FieldVisitor)
- (visitMethod [int java/lang/String java/lang/String java/lang/String [java/lang/String]] org/objectweb/asm/MethodVisitor)
- (toByteArray [] [byte]))
+ ["#::."
+ (#static COMPUTE_MAXS int)
+ (#static COMPUTE_FRAMES int)
+ (new [int])
+ (visit [int int java/lang/String java/lang/String java/lang/String [java/lang/String]] void)
+ (visitEnd [] void)
+ (visitField [int java/lang/String java/lang/String java/lang/String java/lang/Object] org/objectweb/asm/FieldVisitor)
+ (visitMethod [int java/lang/String java/lang/String java/lang/String [java/lang/String]] org/objectweb/asm/MethodVisitor)
+ (toByteArray [] [byte])])
(def: (string-array values)
(-> (List Text) (Array Text))
diff --git a/lux-jvm/source/luxc/lang/host/jvm/inst.lux b/lux-jvm/source/luxc/lang/host/jvm/inst.lux
index 69f822591..9d51a15bb 100644
--- a/lux-jvm/source/luxc/lang/host/jvm/inst.lux
+++ b/lux-jvm/source/luxc/lang/host/jvm/inst.lux
@@ -48,100 +48,103 @@
wrap))
(`` (import: org/objectweb/asm/Opcodes
- (#static NOP int)
-
- ## Conversion
- (~~ (declare D2F D2I D2L
- F2D F2I F2L
- I2B I2C I2D I2F I2L I2S
- L2D L2F L2I))
-
- ## Primitive
- (~~ (declare T_BOOLEAN T_CHAR T_FLOAT T_DOUBLE
- T_BYTE T_SHORT T_INT T_LONG))
-
- ## Class
- (~~ (declare CHECKCAST NEW INSTANCEOF))
-
- ## Stack
- (~~ (declare DUP DUP_X1 DUP_X2
- DUP2 DUP2_X1 DUP2_X2
- POP POP2
- SWAP))
-
- ## Jump
- (~~ (declare IF_ICMPEQ IF_ICMPGT IF_ICMPLT
- IF_ICMPNE IF_ICMPGE IF_ICMPLE
- IF_ACMPEQ IF_ACMPNE IFNULL IFNONNULL
- IFEQ IFNE IFLT IFLE IFGT IFGE
- GOTO))
-
- (~~ (declare BIPUSH SIPUSH))
- (~~ (declare ICONST_M1 ICONST_0 ICONST_1 ICONST_2 ICONST_3 ICONST_4 ICONST_5
- LCONST_0 LCONST_1
- FCONST_0 FCONST_1 FCONST_2
- DCONST_0 DCONST_1))
- (#static ACONST_NULL int)
-
- ## Var
- (~~ (declare IINC
- ILOAD LLOAD FLOAD DLOAD ALOAD
- ISTORE LSTORE FSTORE DSTORE ASTORE))
-
- ## Arithmetic
- (~~ (declare IADD ISUB IMUL IDIV IREM INEG
- LADD LSUB LMUL LDIV LREM LNEG LCMP
- FADD FSUB FMUL FDIV FREM FNEG FCMPG FCMPL
- DADD DSUB DMUL DDIV DREM DNEG DCMPG DCMPL))
-
- ## Bit-wise
- (~~ (declare IAND IOR IXOR ISHL ISHR IUSHR
- LAND LOR LXOR LSHL LSHR LUSHR))
-
- ## Array
- (~~ (declare ARRAYLENGTH NEWARRAY ANEWARRAY
- AALOAD AASTORE
- BALOAD BASTORE
- SALOAD SASTORE
- IALOAD IASTORE
- LALOAD LASTORE
- FALOAD FASTORE
- DALOAD DASTORE
- CALOAD CASTORE))
-
- ## Member
- (~~ (declare GETSTATIC PUTSTATIC GETFIELD PUTFIELD
- INVOKESTATIC INVOKESPECIAL INVOKEVIRTUAL INVOKEINTERFACE))
-
- (#static ATHROW int)
-
- ## Concurrency
- (~~ (declare MONITORENTER MONITOREXIT))
-
- ## Return
- (~~ (declare RETURN IRETURN LRETURN FRETURN DRETURN ARETURN))
+ ["#::."
+ (#static NOP int)
+
+ ## Conversion
+ (~~ (declare D2F D2I D2L
+ F2D F2I F2L
+ I2B I2C I2D I2F I2L I2S
+ L2D L2F L2I))
+
+ ## Primitive
+ (~~ (declare T_BOOLEAN T_CHAR T_FLOAT T_DOUBLE
+ T_BYTE T_SHORT T_INT T_LONG))
+
+ ## Class
+ (~~ (declare CHECKCAST NEW INSTANCEOF))
+
+ ## Stack
+ (~~ (declare DUP DUP_X1 DUP_X2
+ DUP2 DUP2_X1 DUP2_X2
+ POP POP2
+ SWAP))
+
+ ## Jump
+ (~~ (declare IF_ICMPEQ IF_ICMPGT IF_ICMPLT
+ IF_ICMPNE IF_ICMPGE IF_ICMPLE
+ IF_ACMPEQ IF_ACMPNE IFNULL IFNONNULL
+ IFEQ IFNE IFLT IFLE IFGT IFGE
+ GOTO))
+
+ (~~ (declare BIPUSH SIPUSH))
+ (~~ (declare ICONST_M1 ICONST_0 ICONST_1 ICONST_2 ICONST_3 ICONST_4 ICONST_5
+ LCONST_0 LCONST_1
+ FCONST_0 FCONST_1 FCONST_2
+ DCONST_0 DCONST_1))
+ (#static ACONST_NULL int)
+
+ ## Var
+ (~~ (declare IINC
+ ILOAD LLOAD FLOAD DLOAD ALOAD
+ ISTORE LSTORE FSTORE DSTORE ASTORE))
+
+ ## Arithmetic
+ (~~ (declare IADD ISUB IMUL IDIV IREM INEG
+ LADD LSUB LMUL LDIV LREM LNEG LCMP
+ FADD FSUB FMUL FDIV FREM FNEG FCMPG FCMPL
+ DADD DSUB DMUL DDIV DREM DNEG DCMPG DCMPL))
+
+ ## Bit-wise
+ (~~ (declare IAND IOR IXOR ISHL ISHR IUSHR
+ LAND LOR LXOR LSHL LSHR LUSHR))
+
+ ## Array
+ (~~ (declare ARRAYLENGTH NEWARRAY ANEWARRAY
+ AALOAD AASTORE
+ BALOAD BASTORE
+ SALOAD SASTORE
+ IALOAD IASTORE
+ LALOAD LASTORE
+ FALOAD FASTORE
+ DALOAD DASTORE
+ CALOAD CASTORE))
+
+ ## Member
+ (~~ (declare GETSTATIC PUTSTATIC GETFIELD PUTFIELD
+ INVOKESTATIC INVOKESPECIAL INVOKEVIRTUAL INVOKEINTERFACE))
+
+ (#static ATHROW int)
+
+ ## Concurrency
+ (~~ (declare MONITORENTER MONITOREXIT))
+
+ ## Return
+ (~~ (declare RETURN IRETURN LRETURN FRETURN DRETURN ARETURN))]
))
(import: org/objectweb/asm/Label
- (new []))
+ ["#::."
+ (new [])])
(import: org/objectweb/asm/MethodVisitor
- (visitCode [] void)
- (visitMaxs [int int] void)
- (visitEnd [] void)
- (visitInsn [int] void)
- (visitLdcInsn [java/lang/Object] void)
- (visitFieldInsn [int java/lang/String java/lang/String java/lang/String] void)
- (visitTypeInsn [int java/lang/String] void)
- (visitVarInsn [int int] void)
- (visitIntInsn [int int] void)
- (visitMethodInsn [int java/lang/String java/lang/String java/lang/String boolean] void)
- (visitLabel [org/objectweb/asm/Label] void)
- (visitJumpInsn [int org/objectweb/asm/Label] void)
- (visitTryCatchBlock [org/objectweb/asm/Label org/objectweb/asm/Label org/objectweb/asm/Label java/lang/String] void)
- (visitLookupSwitchInsn [org/objectweb/asm/Label [int] [org/objectweb/asm/Label]] void)
- (visitTableSwitchInsn [int int org/objectweb/asm/Label [org/objectweb/asm/Label]] void)
- )
+ ["#::."
+ (visitCode [] void)
+ (visitMaxs [int int] void)
+ (visitEnd [] void)
+ (visitInsn [int] void)
+ (visitLdcInsn [java/lang/Object] void)
+ (visitFieldInsn [int java/lang/String java/lang/String java/lang/String] void)
+ (visitTypeInsn [int java/lang/String] void)
+ (visitVarInsn [int int] void)
+ (visitIntInsn [int int] void)
+ (visitMethodInsn [int java/lang/String java/lang/String java/lang/String boolean] void)
+ (visitLabel [org/objectweb/asm/Label] void)
+ (visitJumpInsn [int org/objectweb/asm/Label] void)
+ (visitTryCatchBlock [org/objectweb/asm/Label org/objectweb/asm/Label org/objectweb/asm/Label java/lang/String] void)
+ (visitLookupSwitchInsn [org/objectweb/asm/Label [int] [org/objectweb/asm/Label]] void)
+ (visitTableSwitchInsn [int int org/objectweb/asm/Label [org/objectweb/asm/Label]] void)
+ ])
## [Insts]
(def: #export make-label
diff --git a/lux-jvm/source/luxc/lang/translation/jvm.lux b/lux-jvm/source/luxc/lang/translation/jvm.lux
index 30a130150..dce3017f5 100644
--- a/lux-jvm/source/luxc/lang/translation/jvm.lux
+++ b/lux-jvm/source/luxc/lang/translation/jvm.lux
@@ -42,13 +42,16 @@
)
(import: java/lang/reflect/Field
- (get [#? java/lang/Object] #try #? java/lang/Object))
+ ["#::."
+ (get [#? java/lang/Object] #try #? java/lang/Object)])
(import: (java/lang/Class a)
- (getField [java/lang/String] #try java/lang/reflect/Field))
+ ["#::."
+ (getField [java/lang/String] #try java/lang/reflect/Field)])
(import: java/lang/Object
- (getClass [] (java/lang/Class java/lang/Object)))
+ ["#::."
+ (getClass [] (java/lang/Class java/lang/Object))])
(import: java/lang/ClassLoader)
@@ -124,7 +127,7 @@
(io.run (do (try.with io.monad)
[_ (loader.store eval-class bytecode library)
class (loader.load eval-class loader)
- value (:: io.monad wrap (..class-value eval-class class))]
+ value (\ io.monad wrap (..class-value eval-class class))]
(wrap [value
[eval-class bytecode]])))))
@@ -132,7 +135,7 @@
(-> Library java/lang/ClassLoader Definition (Try Any))
(io.run (do (try.with io.monad)
[existing-class? (|> (atom.read library)
- (:: io.monad map (dictionary.contains? class-name))
+ (\ io.monad map (dictionary.contains? class-name))
(try.lift io.monad)
(: (IO (Try Bit))))
_ (if existing-class?
@@ -153,8 +156,8 @@
(: Host
(structure
(def: (evaluate! context valueI)
- (:: try.monad map product.left
- (..evaluate! library loader context valueI)))
+ (\ try.monad map product.left
+ (..evaluate! library loader context valueI)))
(def: execute!
(..execute! library loader))
@@ -175,7 +178,7 @@
[#let [class-name (..class-name context)]
_ (loader.store class-name bytecode library)
class (loader.load class-name loader)]
- (:: io.monad wrap (..class-value class-name class))))))))))
+ (\ io.monad wrap (..class-value class-name class))))))))))
(def: #export $Variant (type.array ..$Value))
(def: #export $Tuple (type.array ..$Value))
diff --git a/lux-jvm/source/luxc/lang/translation/jvm/extension/common.lux b/lux-jvm/source/luxc/lang/translation/jvm/extension/common.lux
index 0388c5c7f..e73ea068e 100644
--- a/lux-jvm/source/luxc/lang/translation/jvm/extension/common.lux
+++ b/lux-jvm/source/luxc/lang/translation/jvm/extension/common.lux
@@ -53,8 +53,9 @@
(phase.throw extension.invalid-syntax [extension-name %synthesis input]))))
(import: java/lang/Double
- (#static MIN_VALUE java/lang/Double)
- (#static MAX_VALUE java/lang/Double))
+ ["#::."
+ (#static MIN_VALUE java/lang/Double)
+ (#static MAX_VALUE java/lang/Double)])
(def: $String (type.class "java.lang.String" (list)))
(def: $CharSequence (type.class "java.lang.CharSequence" (list)))
diff --git a/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux b/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux
index 86b814bad..77f421703 100644
--- a/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux
+++ b/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux
@@ -956,20 +956,20 @@
_.ARETURN)
(#.Right returnT)
- (cond (or (:: type.equivalence = type.boolean returnT)
- (:: type.equivalence = type.byte returnT)
- (:: type.equivalence = type.short returnT)
- (:: type.equivalence = type.int returnT)
- (:: type.equivalence = type.char returnT))
+ (cond (or (\ type.equivalence = type.boolean returnT)
+ (\ type.equivalence = type.byte returnT)
+ (\ type.equivalence = type.short returnT)
+ (\ type.equivalence = type.int returnT)
+ (\ type.equivalence = type.char returnT))
_.IRETURN
- (:: type.equivalence = type.long returnT)
+ (\ type.equivalence = type.long returnT)
_.LRETURN
- (:: type.equivalence = type.float returnT)
+ (\ type.equivalence = type.float returnT)
_.FRETURN
- ## (:: type.equivalence = type.double returnT)
+ ## (\ type.equivalence = type.double returnT)
_.DRETURN))))
(def: class::anonymous
@@ -1038,7 +1038,7 @@
returnT
exceptionsT])
(|>> bodyG (returnI returnT)))))))
- (:: @ map _def.fuse))
+ (\ @ map _def.fuse))
#let [directive [anonymous-class-name
(_def.class #$.V1_6 #$.Public $.finalC
anonymous-class-name (list)
diff --git a/lux-jvm/source/luxc/lang/translation/jvm/primitive.lux b/lux-jvm/source/luxc/lang/translation/jvm/primitive.lux
index 2e0aba43e..2d8bff828 100644
--- a/lux-jvm/source/luxc/lang/translation/jvm/primitive.lux
+++ b/lux-jvm/source/luxc/lang/translation/jvm/primitive.lux
@@ -23,12 +23,14 @@
(operation@wrap (_.GETSTATIC Boolean (if value "TRUE" "FALSE") Boolean)))))
(import: java/lang/Byte
- (#static MAX_VALUE byte)
- (#static MIN_VALUE byte))
+ ["#::."
+ (#static MAX_VALUE byte)
+ (#static MIN_VALUE byte)])
(import: java/lang/Short
- (#static MAX_VALUE short)
- (#static MIN_VALUE short))
+ ["#::."
+ (#static MAX_VALUE short)
+ (#static MIN_VALUE short)])
(def: #export (i64 value)
(-> (I64 Any) (Operation Inst))
@@ -64,7 +66,8 @@
(operation@wrap (|>> constantI (_.wrap type.long))))))
(import: java/lang/Double
- (#static doubleToRawLongBits #manual [double] int))
+ ["#::."
+ (#static doubleToRawLongBits #manual [double] int)])
(def: d0-bits
Int
diff --git a/lux-jvm/source/luxc/lang/translation/jvm/reference.lux b/lux-jvm/source/luxc/lang/translation/jvm/reference.lux
index 61eac8dcc..c7570d01a 100644
--- a/lux-jvm/source/luxc/lang/translation/jvm/reference.lux
+++ b/lux-jvm/source/luxc/lang/translation/jvm/reference.lux
@@ -38,8 +38,8 @@
(def: (foreign archive variable)
(-> Archive Register (Operation Inst))
(do {@ phase.monad}
- [class-name (:: @ map //.class-name
- (generation.context archive))]
+ [class-name (\ @ map //.class-name
+ (generation.context archive))]
(wrap (|>> (_.ALOAD 0)
(_.GETFIELD (type.class class-name (list))
(|> variable .nat foreign-name)
@@ -61,6 +61,6 @@
(def: #export (constant archive name)
(-> Archive Name (Operation Inst))
(do {@ phase.monad}
- [class-name (:: @ map //.class-name
- (generation.remember archive name))]
+ [class-name (\ @ map //.class-name
+ (generation.remember archive name))]
(wrap (_.GETSTATIC (type.class class-name (list)) //.value-field //.$Value))))
diff --git a/lux-jvm/source/luxc/lang/translation/jvm/structure.lux b/lux-jvm/source/luxc/lang/translation/jvm/structure.lux
index c268cb14a..d91ed3d14 100644
--- a/lux-jvm/source/luxc/lang/translation/jvm/structure.lux
+++ b/lux-jvm/source/luxc/lang/translation/jvm/structure.lux
@@ -55,18 +55,20 @@
(_.int (.int idx))
memberI
_.AASTORE)))))
- (:: @ map _.fuse))]
+ (\ @ map _.fuse))]
(wrap (|>> (_.int (.int size))
(_.array //runtime.$Value)
membersI))))
(import: java/lang/Byte
- (#static MAX_VALUE byte)
- (#static MIN_VALUE byte))
+ ["#::."
+ (#static MAX_VALUE byte)
+ (#static MIN_VALUE byte)])
(import: java/lang/Short
- (#static MAX_VALUE short)
- (#static MIN_VALUE short))
+ ["#::."
+ (#static MAX_VALUE short)
+ (#static MIN_VALUE short)])
(def: #export (tagI lefts right?)
(-> Nat Bit Inst)
diff --git a/lux-jvm/source/program.lux b/lux-jvm/source/program.lux
index 433f76d36..8a6729e1d 100644
--- a/lux-jvm/source/program.lux
+++ b/lux-jvm/source/program.lux
@@ -66,13 +66,16 @@
["translation" extension]]]]])
(import: java/lang/reflect/Method
- (invoke [java/lang/Object [java/lang/Object]] #try java/lang/Object))
+ ["#::."
+ (invoke [java/lang/Object [java/lang/Object]] #try java/lang/Object)])
(import: (java/lang/Class c)
- (getMethod [java/lang/String [(java/lang/Class java/lang/Object)]] #try java/lang/reflect/Method))
+ ["#::."
+ (getMethod [java/lang/String [(java/lang/Class java/lang/Object)]] #try java/lang/reflect/Method)])
(import: java/lang/Object
- (getClass [] (java/lang/Class java/lang/Object)))
+ ["#::."
+ (getClass [] (java/lang/Class java/lang/Object))])
(def: _object-class
(java/lang/Class java/lang/Object)
@@ -172,6 +175,6 @@
..extender
service
[packager.package
- (format (/cli.target service) (:: file.default separator) "program.jar")])]
+ (format (/cli.target service) (\ file.default separator) "program.jar")])]
(..declare-success! []))
(io.io [])))