From 4b672d27a1a1a79643c43cf06917072cc97c1289 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Thu, 12 Oct 2017 18:14:19 -0400 Subject: - Compilation and tests for arrays. --- new-luxc/source/luxc/generator/host/jvm/inst.lux | 40 +++++++++++++++--------- 1 file changed, 25 insertions(+), 15 deletions(-) (limited to 'new-luxc/source/luxc/generator/host/jvm/inst.lux') 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) (declare IAND IOR IXOR ISHL ISHR IUSHR LAND LOR LXOR LSHL LSHR LUSHR) + (declare ARRAYLENGTH NEWARRAY ANEWARRAY + AALOAD AASTORE + BALOAD BASTORE + SALOAD SASTORE + IALOAD IASTORE + LALOAD LASTORE + FALOAD FASTORE + DALOAD DASTORE + CALOAD CASTORE) (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) @@ -64,9 +71,7 @@ - (#static AALOAD int) - (#static AASTORE int) - (#static ARRAYLENGTH int) + (#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) -- cgit v1.2.3