From b009b396ed92618974385575df7bbde87a4e2e96 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Fri, 14 Oct 2016 21:13:28 -0400 Subject: - Slightly cheaper compilation of numeric literals. --- src/lux/compiler/lux.clj | 16 +++++++--------- src/lux/type.clj | 4 ++-- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/lux/compiler/lux.clj b/src/lux/compiler/lux.clj index 976bdfa15..62ecce683 100644 --- a/src/lux/compiler/lux.clj +++ b/src/lux/compiler/lux.clj @@ -35,21 +35,19 @@ :let [_ (.visitFieldInsn *writer* Opcodes/GETSTATIC "java/lang/Boolean" (if ?value "TRUE" "FALSE") "Ljava/lang/Boolean;")]] (return nil))) -(do-template [ ] +(do-template [ ] (defn [value] (|do [^MethodVisitor *writer* &/get-writer :let [_ (doto *writer* - (.visitTypeInsn Opcodes/NEW ) - (.visitInsn Opcodes/DUP) (.visitLdcInsn ( value)) - (.visitMethodInsn Opcodes/INVOKESPECIAL "" ))]] + (.visitMethodInsn Opcodes/INVOKESTATIC "valueOf" (str "(" ")" (&host-generics/->type-signature ))))]] (return nil))) - compile-nat "java/lang/Long" "(J)V" long - compile-int "java/lang/Long" "(J)V" long - compile-frac "java/lang/Long" "(J)V" long - compile-real "java/lang/Double" "(D)V" double - compile-char "java/lang/Character" "(C)V" char + compile-nat "java/lang/Long" "J" long + compile-int "java/lang/Long" "J" long + compile-frac "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/src/lux/type.clj b/src/lux/type.clj index 05a353e85..87c330691 100644 --- a/src/lux/type.clj +++ b/src/lux/type.clj @@ -815,10 +815,10 @@ (return fixpoints) (check-error "" expected actual)) - [(&/$NamedT ?ename ?etype) _] + [(&/$NamedT _ ?etype) _] (check* class-loader fixpoints invariant?? ?etype actual) - [_ (&/$NamedT ?aname ?atype)] + [_ (&/$NamedT _ ?atype)] (check* class-loader fixpoints invariant?? expected ?atype) [_ _] -- cgit v1.2.3