aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/generator/host/jvm
diff options
context:
space:
mode:
authorEduardo Julian2017-10-29 22:21:14 -0400
committerEduardo Julian2017-10-29 22:21:14 -0400
commit7b870a7bd124f35939d9089a2e21f0806a4c6e85 (patch)
tree076fb3544dbb1a811cfbb9dd54008b0753dead16 /new-luxc/source/luxc/generator/host/jvm
parent2dc99a7b62fc5fc19d9982ad4398606f3aebb7a5 (diff)
- Fixed some bugs.
- Improved error reporting. - Implemented macro-expansion (for JVM). - Implemented "let" compilation.
Diffstat (limited to 'new-luxc/source/luxc/generator/host/jvm')
-rw-r--r--new-luxc/source/luxc/generator/host/jvm/inst.lux132
1 files changed, 69 insertions, 63 deletions
diff --git a/new-luxc/source/luxc/generator/host/jvm/inst.lux b/new-luxc/source/luxc/generator/host/jvm/inst.lux
index f515e86ac..37ab75020 100644
--- a/new-luxc/source/luxc/generator/host/jvm/inst.lux
+++ b/new-luxc/source/luxc/generator/host/jvm/inst.lux
@@ -22,68 +22,72 @@
(L/map (function [code] (` ((~' #static) (~ (code;local-symbol code)) (~' int)))))
wrap))
-(with-expansions [<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)
- <member> (declare GETSTATIC PUTSTATIC GETFIELD PUTFIELD
- INVOKESTATIC INVOKESPECIAL INVOKEVIRTUAL INVOKEINTERFACE)
- <stack> (declare DUP DUP2 DUP2_X1 DUP2_X2
- POP POP2
- SWAP)
- <jump> (declare IF_ICMPEQ IF_ICMPGT IF_ICMPLT IF_ACMPEQ IFNULL
- IFEQ IFNE IFLT IFLE IFGT IFGE
- GOTO)
- <var> (declare ILOAD LLOAD DLOAD ALOAD
- ISTORE LSTORE ASTORE)
- <arithmetic> (declare IADD ISUB IMUL IDIV IREM
- LADD LSUB LMUL LDIV LREM LCMP
- FADD FSUB FMUL FDIV FREM FCMPG FCMPL
- DADD DSUB DMUL DDIV DREM 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)
- <concurrency> (declare MONITORENTER MONITOREXIT)
- <return> (declare RETURN IRETURN LRETURN DRETURN ARETURN)]
- (host;import org.objectweb.asm.Opcodes
- (#static NOP int)
-
- <conversion>
- <primitive>
-
- <class>
-
- <stack>
- <jump>
-
- (#static ACONST_NULL int)
-
- <var>
-
- <arithmetic>
- <bit-wise>
-
- <array>
-
- <member>
-
- (#static ATHROW int)
-
- <concurrency>
-
- <return>
- ))
+(`` (host;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_ACMPEQ IFNULL
+ IFEQ IFNE IFLT IFLE IFGT IFGE
+ GOTO))
+
+ (#static ACONST_NULL int)
+
+ ## Var
+ (~~ (declare ILOAD LLOAD DLOAD ALOAD
+ ISTORE LSTORE ASTORE))
+
+ ## Arithmetic
+ (~~ (declare IADD ISUB IMUL IDIV IREM
+ LADD LSUB LMUL LDIV LREM LCMP
+ FADD FSUB FMUL FDIV FREM FCMPG FCMPL
+ DADD DSUB DMUL DDIV DREM 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 DRETURN ARETURN))
+ ))
(host;import org.objectweb.asm.FieldVisitor
(visitEnd [] void))
@@ -152,7 +156,9 @@
[NOP]
## Stack
- [DUP] [DUP2] [DUP2_X1] [DUP2_X2] [POP] [POP2] [SWAP]
+ [DUP] [DUP_X1] [DUP_X2] [DUP2] [DUP2_X1] [DUP2_X2]
+ [POP] [POP2]
+ [SWAP]
## Conversions
[D2F] [D2I] [D2L]