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/primitive.lux | 114 --------------------- 1 file changed, 114 deletions(-) delete mode 100644 lux-jvm/source/luxc/lang/translation/jvm/primitive.lux (limited to 'lux-jvm/source/luxc/lang/translation/jvm/primitive.lux') diff --git a/lux-jvm/source/luxc/lang/translation/jvm/primitive.lux b/lux-jvm/source/luxc/lang/translation/jvm/primitive.lux deleted file mode 100644 index 734b55316..000000000 --- a/lux-jvm/source/luxc/lang/translation/jvm/primitive.lux +++ /dev/null @@ -1,114 +0,0 @@ -(.using - [library - [lux {"-" i64} - ["[0]" ffi {"+" import:}] - [macro - ["^" pattern]] - [math - [number - ["i" int]]] - [target - [jvm - ["[0]" type]]] - [tool - [compiler - [phase ("operation@[0]" monad)]]]]] - [luxc - [lang - [host - ["[0]" jvm {"+" Inst Operation} - ["_" inst]]]]]) - -(def: .public bit - (-> Bit (Operation Inst)) - (let [Boolean (type.class "java.lang.Boolean" (list))] - (function (_ value) - (operation@in (_.GETSTATIC Boolean (if value "TRUE" "FALSE") Boolean))))) - -(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 (i64 value) - (-> (I64 Any) (Operation Inst)) - (case (.int value) - (^.template [ ] - [ - (operation@in (|>> (_.wrap type.long)))]) - ([+0 _.LCONST_0] - [+1 _.LCONST_1]) - - (^.template [ ] - [ - (operation@in (|>> _.I2L (_.wrap type.long)))]) - ([-1 _.ICONST_M1] - ... [+0 _.ICONST_0] - ... [+1 _.ICONST_1] - [+2 _.ICONST_2] - [+3 _.ICONST_3] - [+4 _.ICONST_4] - [+5 _.ICONST_5]) - - value - (let [constantI (cond (and (i.>= (java/lang/Byte::MIN_VALUE) value) - (i.<= (java/lang/Byte::MAX_VALUE) value)) - (|>> (_.BIPUSH value) _.I2L) - - (and (i.>= (java/lang/Short::MIN_VALUE) value) - (i.<= (java/lang/Short::MAX_VALUE) value)) - (|>> (_.SIPUSH value) _.I2L) - - ... else - (|> value .int _.long))] - (operation@in (|>> constantI (_.wrap type.long)))))) - -(import: java/lang/Double - "[1]::[0]" - ("static" doubleToRawLongBits "manual" [double] int)) - -(def: d0-bits - Int - (java/lang/Double::doubleToRawLongBits +0.0)) - -(def: .public (f64 value) - (-> Frac (Operation Inst)) - (case value - (^.template [ ] - [ - (operation@in (|>> (_.wrap type.double)))]) - ([+1.0 _.DCONST_1]) - - (^.template [ ] - [ - (operation@in (|>> _.F2D (_.wrap type.double)))]) - ([+2.0 _.FCONST_2]) - - (^.template [ ] - [ - (operation@in (|>> _.I2D (_.wrap type.double)))]) - ([-1.0 _.ICONST_M1] - ... [+0.0 _.ICONST_0] - ... [+1.0 _.ICONST_1] - ... [+2.0 _.ICONST_2] - [+3.0 _.ICONST_3] - [+4.0 _.ICONST_4] - [+5.0 _.ICONST_5]) - - _ - (let [constantI (if (|> value - (as java/lang/Double) - java/lang/Double::doubleToRawLongBits - (i.= ..d0-bits)) - _.DCONST_0 - (_.double value))] - (operation@in (|>> constantI (_.wrap type.double)))))) - -(def: .public text - (-> Text (Operation Inst)) - (|>> _.string operation@in)) -- cgit v1.2.3