diff options
Diffstat (limited to 'luxc/src/lux/compiler')
-rw-r--r-- | luxc/src/lux/compiler/cache/ann.clj | 5 | ||||
-rw-r--r-- | luxc/src/lux/compiler/js.clj | 3 | ||||
-rw-r--r-- | luxc/src/lux/compiler/js/lux.clj | 4 | ||||
-rw-r--r-- | luxc/src/lux/compiler/jvm.clj | 3 | ||||
-rw-r--r-- | luxc/src/lux/compiler/jvm/case.clj | 7 | ||||
-rw-r--r-- | luxc/src/lux/compiler/jvm/lux.clj | 1 | ||||
-rw-r--r-- | luxc/src/lux/compiler/jvm/proc/common.clj | 62 | ||||
-rw-r--r-- | luxc/src/lux/compiler/jvm/rt.clj | 5 |
8 files changed, 8 insertions, 82 deletions
diff --git a/luxc/src/lux/compiler/cache/ann.clj b/luxc/src/lux/compiler/cache/ann.clj index b71d6707b..35a41f247 100644 --- a/luxc/src/lux/compiler/cache/ann.clj +++ b/luxc/src/lux/compiler/cache/ann.clj @@ -43,9 +43,6 @@ (&/$RealA value) (str "R" value stop) - (&/$CharA value) - (str "C" value stop) - (&/$TextA value) (serialize-text value) @@ -88,7 +85,6 @@ ^:private deserialize-int "I" &/$IntA Long/parseLong ^:private deserialize-deg "D" &/$DegA Long/parseLong ^:private deserialize-real "R" &/$RealA Double/parseDouble - ^:private deserialize-char "C" &/$CharA (fn [^String input] (.charAt input 0)) ^:private deserialize-text "T" &/$TextA identity ) @@ -143,7 +139,6 @@ (deserialize-int input) (deserialize-deg input) (deserialize-real input) - (deserialize-char input) (deserialize-text input) (deserialize-ident input) (deserialize-list input) diff --git a/luxc/src/lux/compiler/js.clj b/luxc/src/lux/compiler/js.clj index c19a40dcd..b618b7b1b 100644 --- a/luxc/src/lux/compiler/js.clj +++ b/luxc/src/lux/compiler/js.clj @@ -51,9 +51,6 @@ (&o/$real ?value) (&&lux/compile-real ?value) - (&o/$char ?value) - (&&lux/compile-char ?value) - (&o/$text ?value) (&&lux/compile-text ?value) diff --git a/luxc/src/lux/compiler/js/lux.clj b/luxc/src/lux/compiler/js/lux.clj index d066dff17..593055b8b 100644 --- a/luxc/src/lux/compiler/js/lux.clj +++ b/luxc/src/lux/compiler/js/lux.clj @@ -192,10 +192,6 @@ (&o/$RealPM _value) (return (str "if(" cursor-peek " !== " _value ") { " pm-fail " }")) - (&o/$CharPM _value) - (|do [=value (compile-char _value)] - (return (str "if(" (str "(" cursor-peek ").C") " !== " (str "(" =value ").C") ") { " pm-fail " }"))) - (&o/$TextPM _value) (|do [=value (compile-text _value)] (return (str "if(" cursor-peek " !== " =value ") { " pm-fail " }"))) diff --git a/luxc/src/lux/compiler/jvm.clj b/luxc/src/lux/compiler/jvm.clj index 22310201c..5c11c0c6d 100644 --- a/luxc/src/lux/compiler/jvm.clj +++ b/luxc/src/lux/compiler/jvm.clj @@ -62,9 +62,6 @@ (&o/$real ?value) (&&lux/compile-real ?value) - (&o/$char ?value) - (&&lux/compile-char ?value) - (&o/$text ?value) (&&lux/compile-text ?value) diff --git a/luxc/src/lux/compiler/jvm/case.clj b/luxc/src/lux/compiler/jvm/case.clj index da8d8d0a9..c205381e8 100644 --- a/luxc/src/lux/compiler/jvm/case.clj +++ b/luxc/src/lux/compiler/jvm/case.clj @@ -101,13 +101,6 @@ (.visitInsn Opcodes/DCMPL) (.visitJumpInsn Opcodes/IFNE $else)) - (&o/$CharPM _value) - (doto writer - stack-peek - &&/unwrap-char - (.visitLdcInsn _value) - (.visitJumpInsn Opcodes/IF_ICMPNE $else)) - (&o/$TextPM _value) (doto writer stack-peek diff --git a/luxc/src/lux/compiler/jvm/lux.clj b/luxc/src/lux/compiler/jvm/lux.clj index bb7dda339..123676d35 100644 --- a/luxc/src/lux/compiler/jvm/lux.clj +++ b/luxc/src/lux/compiler/jvm/lux.clj @@ -41,7 +41,6 @@ compile-int "java/lang/Long" "J" long compile-deg "java/lang/Long" "J" long compile-real "java/lang/Double" "D" double - compile-char "java/lang/Character" "C" char ) (defn compile-text [?value] diff --git a/luxc/src/lux/compiler/jvm/proc/common.clj b/luxc/src/lux/compiler/jvm/proc/common.clj index 821fcc619..7c44f3434 100644 --- a/luxc/src/lux/compiler/jvm/proc/common.clj +++ b/luxc/src/lux/compiler/jvm/proc/common.clj @@ -274,31 +274,6 @@ ^:private compile-real-lt Opcodes/DCMPG -1 &&/unwrap-double ) -(do-template [<name> <opcode> <unwrap>] - (defn <name> [compile ?values special-args] - (|do [:let [(&/$Cons ?x (&/$Cons ?y (&/$Nil))) ?values] - ^MethodVisitor *writer* &/get-writer - _ (compile ?x) - :let [_ (doto *writer* - <unwrap>)] - _ (compile ?y) - :let [_ (doto *writer* - <unwrap>) - $then (new Label) - $end (new Label) - _ (doto *writer* - (.visitJumpInsn <opcode> $then) - (.visitFieldInsn Opcodes/GETSTATIC (&host-generics/->bytecode-class-name "java.lang.Boolean") "FALSE" (&host-generics/->type-signature "java.lang.Boolean")) - (.visitJumpInsn Opcodes/GOTO $end) - (.visitLabel $then) - (.visitFieldInsn Opcodes/GETSTATIC (&host-generics/->bytecode-class-name "java.lang.Boolean") "TRUE" (&host-generics/->type-signature "java.lang.Boolean")) - (.visitLabel $end))]] - (return nil))) - - ^:private compile-char-eq Opcodes/IF_ICMPEQ &&/unwrap-char - ^:private compile-char-lt Opcodes/IF_ICMPLT &&/unwrap-char - ) - (do-template [<name> <cmp-output>] (defn <name> [compile ?values special-args] (|do [:let [(&/$Cons ?x (&/$Cons ?y (&/$Nil))) ?values] @@ -440,34 +415,15 @@ ^:private compile-real-to-deg "java.lang.Double" "real-to-deg" "(D)J" &&/unwrap-double &&/wrap-long ) -(let [widen (fn [^MethodVisitor *writer*] - (doto *writer* - (.visitInsn Opcodes/I2L))) - shrink (fn [^MethodVisitor *writer*] - (doto *writer* - (.visitInsn Opcodes/L2I) - (.visitInsn Opcodes/I2C)))] - (do-template [<name> <unwrap> <wrap> <adjust>] - (defn <name> [compile ?values special-args] - (|do [:let [(&/$Cons ?x (&/$Nil)) ?values] - ^MethodVisitor *writer* &/get-writer - _ (compile ?x) - :let [_ (doto *writer* - <unwrap> - <adjust> - <wrap>)]] - (return nil))) - - ^:private compile-nat-to-char &&/unwrap-long &&/wrap-char shrink - ^:private compile-char-to-nat &&/unwrap-char &&/wrap-long widen - )) - -(defn ^:private compile-char-to-text [compile ?values special-args] +(defn ^:private compile-nat-to-char [compile ?values special-args] (|do [:let [(&/$Cons ?x (&/$Nil)) ?values] ^MethodVisitor *writer* &/get-writer _ (compile ?x) :let [_ (doto *writer* - (.visitMethodInsn Opcodes/INVOKEVIRTUAL "java/lang/Object" "toString" "()Ljava/lang/String;"))]] + &&/unwrap-long + (.visitInsn Opcodes/L2I) + (.visitInsn Opcodes/I2C) + (.visitMethodInsn Opcodes/INVOKESTATIC "java/lang/String" "valueOf" "(C)Ljava/lang/String;"))]] (return nil))) (do-template [<name>] @@ -968,14 +924,6 @@ "decode" (compile-real-decode compile ?values special-args) ) - "char" - (case proc - "=" (compile-char-eq compile ?values special-args) - "<" (compile-char-lt compile ?values special-args) - "to-nat" (compile-char-to-nat compile ?values special-args) - "to-text" (compile-char-to-text compile ?values special-args) - ) - "math" (case proc "e" (compile-math-e compile ?values special-args) diff --git a/luxc/src/lux/compiler/jvm/rt.clj b/luxc/src/lux/compiler/jvm/rt.clj index 31a2c800c..63a5e1935 100644 --- a/luxc/src/lux/compiler/jvm/rt.clj +++ b/luxc/src/lux/compiler/jvm/rt.clj @@ -698,8 +698,9 @@ (.visitLabel $from) (.visitVarInsn Opcodes/ALOAD 0) (.visitVarInsn Opcodes/ILOAD 1) - (.visitMethodInsn Opcodes/INVOKEVIRTUAL "java/lang/String" "charAt" "(I)C") - &&/wrap-char + (.visitMethodInsn Opcodes/INVOKEVIRTUAL "java/lang/String" "codePointAt" "(I)I") + (.visitInsn Opcodes/I2L) + &&/wrap-long (.visitMethodInsn Opcodes/INVOKESTATIC "lux/LuxRT" "make_some" "(Ljava/lang/Object;)[Ljava/lang/Object;") (.visitInsn Opcodes/ARETURN) (.visitLabel $to) |