aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/generator/host/jvm/inst.lux
diff options
context:
space:
mode:
authorEduardo Julian2017-10-12 18:14:19 -0400
committerEduardo Julian2017-10-12 18:14:19 -0400
commit4b672d27a1a1a79643c43cf06917072cc97c1289 (patch)
tree6136e952c0e87172921ad4bf5c0ee128a085a0ba /new-luxc/source/luxc/generator/host/jvm/inst.lux
parent50c370878c0f9985a8b6d1003af9e9f6282b853e (diff)
- Compilation and tests for arrays.
Diffstat (limited to '')
-rw-r--r--new-luxc/source/luxc/generator/host/jvm/inst.lux40
1 files changed, 25 insertions, 15 deletions
diff --git a/new-luxc/source/luxc/generator/host/jvm/inst.lux b/new-luxc/source/luxc/generator/host/jvm/inst.lux
index 7a6215804..efc66f130 100644
--- a/new-luxc/source/luxc/generator/host/jvm/inst.lux
+++ b/new-luxc/source/luxc/generator/host/jvm/inst.lux
@@ -42,6 +42,15 @@
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)
<return> (declare RETURN IRETURN LRETURN DRETURN ARETURN)]
(host;import org.objectweb.asm.Opcodes
(#static NOP int)
@@ -51,8 +60,6 @@
(#static CHECKCAST int)
(#static NEW int)
- (#static NEWARRAY int)
- (#static ANEWARRAY int)
<stack>
<jump>
@@ -64,9 +71,7 @@
<arithmethic>
<bit-wise>
- (#static AALOAD int)
- (#static AASTORE int)
- (#static ARRAYLENGTH int)
+ <array>
(#static GETSTATIC int)
(#static PUTSTATIC int)
@@ -178,7 +183,15 @@
[DCMPG] [DCMPL]
## Array
- [AALOAD] [AASTORE] [ARRAYLENGTH]
+ [ARRAYLENGTH]
+ [AALOAD] [AASTORE]
+ [BALOAD] [BASTORE]
+ [SALOAD] [SASTORE]
+ [IALOAD] [IASTORE]
+ [LALOAD] [LASTORE]
+ [FALOAD] [FASTORE]
+ [DALOAD] [DASTORE]
+ [CALOAD] [CASTORE]
## Exceptions
[ATHROW]
@@ -230,7 +243,7 @@
(do-to visitor
(MethodVisitor.visitIntInsn [Opcodes.NEWARRAY (case type
#$;Boolean Opcodes.T_BOOLEAN
- #$;Byte Opcodes.T_SHORT
+ #$;Byte Opcodes.T_BYTE
#$;Short Opcodes.T_SHORT
#$;Int Opcodes.T_INT
#$;Long Opcodes.T_LONG
@@ -289,12 +302,11 @@
(do-to visitor
(MethodVisitor.visitLabel [@label]))))
-(def: #export (array type size)
- (-> $;Type Nat $;Inst)
+(def: #export (array type)
+ (-> $;Type $;Inst)
(case type
(#$;Primitive prim)
- (|>. (int (nat-to-int size))
- (NEWARRAY prim))
+ (NEWARRAY prim)
(#$;Generic generic)
(let [elem-class (case generic
@@ -303,12 +315,10 @@
_
($t;binary-name "java.lang.Object"))]
- (|>. (int (nat-to-int size))
- (ANEWARRAY elem-class)))
+ (ANEWARRAY elem-class))
_
- (|>. (int (nat-to-int size))
- (ANEWARRAY ($t;descriptor type)))))
+ (ANEWARRAY ($t;descriptor type))))
(def: (primitive-wrapper type)
(-> $;Primitive Text)