From 60daee098f92a44c3b404a9f5801f2e8126ad650 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Tue, 5 Apr 2022 18:32:42 -0400 Subject: No longer depending on the ASM library for JVM bytecode generation. --- .../source/luxc/lang/translation/jvm/structure.lux | 118 --------------------- 1 file changed, 118 deletions(-) delete mode 100644 lux-jvm/source/luxc/lang/translation/jvm/structure.lux (limited to 'lux-jvm/source/luxc/lang/translation/jvm/structure.lux') diff --git a/lux-jvm/source/luxc/lang/translation/jvm/structure.lux b/lux-jvm/source/luxc/lang/translation/jvm/structure.lux deleted file mode 100644 index 878658efe..000000000 --- a/lux-jvm/source/luxc/lang/translation/jvm/structure.lux +++ /dev/null @@ -1,118 +0,0 @@ -(.using - [library - [lux {"-" Type Primitive} - ["[0]" ffi {"+" import:}] - [abstract - ["[0]" monad {"+" do}]] - [control - ["[0]" exception {"+" exception:}]] - [data - [text - ["%" format {"+" format}]] - [collection - ["[0]" list]]] - [math - [number - ["n" nat] - ["i" int]]] - [target - [jvm - ["[0]" type {"+" Type} - ["[0]" category {"+" Void Value Return Primitive Object Class Array Var Parameter Method}] - ["[0]" descriptor {"+" Descriptor}] - ["[0]" signature {"+" Signature}]]]] - [tool - [compiler - ["[0]" phase] - [meta - [archive {"+" Archive}]] - [language - [lux - [synthesis {"+" Synthesis}]]]]]]] - [luxc - [lang - [host - [jvm {"+" Inst Operation Phase Generator} - ["_" inst]]]]] - ["[0]" // - ["[1][0]" runtime]]) - -(exception: .public (not_a_tuple [size Nat]) - (exception.report - "Expected size" ">= 2" - "Actual size" (%.nat size))) - -(def: .public (tuple generate archive members) - (Generator (List Synthesis)) - (do [@ phase.monad] - [.let [size (list.size members)] - _ (phase.assertion ..not_a_tuple size - (n.>= 2 size)) - membersI (|> members - list.enumeration - (monad.each @ (function (_ [idx member]) - (do @ - [memberI (generate archive member)] - (in (|>> _.DUP - (_.int (.int idx)) - memberI - _.AASTORE))))) - (# @ each _.fuse))] - (in (|>> (_.int (.int size)) - (_.array //runtime.$Value) - membersI)))) - -(import: java/lang/Byte - "[1]::[0]" - ("static" MAX_VALUE byte) - ("static" MIN_VALUE byte)) - -(import: java/lang/Short - "[1]::[0]" - ("static" MAX_VALUE short) - ("static" MIN_VALUE short)) - -(def: .public (tagI lefts right?) - (-> Nat Bit Inst) - (case lefts - 0 _.ICONST_0 - 1 _.ICONST_1 - 2 _.ICONST_2 - 3 _.ICONST_3 - 4 _.ICONST_4 - 5 _.ICONST_5 - tag (let [tag (.int tag)] - (cond (and (i.>= (java/lang/Byte::MIN_VALUE) tag) - (i.<= (java/lang/Byte::MAX_VALUE) tag)) - (_.BIPUSH tag) - - (and (i.>= (java/lang/Short::MIN_VALUE) tag) - (i.<= (java/lang/Short::MAX_VALUE) tag)) - (_.SIPUSH tag) - - ... else - (_.int tag))))) - -(def: .public leftI _.NULL) -(def: .public rightI (_.string "")) - -(def: .public (flagI right?) - (-> Bit Inst) - (if right? - ..rightI - ..leftI)) - -(def: .public (variant generate archive [lefts right? member]) - (Generator [Nat Bit Synthesis]) - (do phase.monad - [memberI (generate archive member) - .let [tagI (..tagI lefts right?)]] - (in (|>> tagI - (flagI right?) - memberI - (_.INVOKESTATIC //.$Runtime - "variant_make" - (type.method [(list) - (list //runtime.$Lefts //runtime.$Right? //runtime.$Value) - //.$Variant - (list)])))))) -- cgit v1.2.3