aboutsummaryrefslogtreecommitdiff
path: root/stdlib
diff options
context:
space:
mode:
authorEduardo Julian2019-12-27 00:51:00 -0400
committerEduardo Julian2019-12-27 00:51:00 -0400
commit581ccee156457b0f84696def59fc324c1cbbdaba (patch)
tree0202c9a26d65920eeaabecffb810b5be0bc8a15d /stdlib
parent9e6725e3fd45ad0b8faf54ec00ca9dcb8b603e32 (diff)
Falling back to using the old method of JVM generation while I properly debug and optimize the new one.
Diffstat (limited to '')
-rw-r--r--stdlib/source/lux/host.jvm.lux25
-rw-r--r--stdlib/source/lux/target/jvm/bytecode.lux10
-rw-r--r--stdlib/source/lux/tool/compiler/phase/generation/jvm/extension/common.lux4
3 files changed, 27 insertions, 12 deletions
diff --git a/stdlib/source/lux/host.jvm.lux b/stdlib/source/lux/host.jvm.lux
index d0952f71e..b34cd4242 100644
--- a/stdlib/source/lux/host.jvm.lux
+++ b/stdlib/source/lux/host.jvm.lux
@@ -32,7 +32,7 @@
[encoding
["." name (#+ External)]]
["." type (#+ Type Argument Typed)
- ["." category (#+ Void Value Return Method Primitive Object Class Array Var Parameter Declaration)]
+ ["." category (#+ Void Value' Value Return' Return Method Primitive Object Class Array Var Parameter Declaration)]
["." box]
["." descriptor]
["." signature]
@@ -44,8 +44,15 @@
(|>> name.internal
name.read))
-(def: signature (|>> type.signature signature.signature))
-(def: reflection (|>> type.reflection reflection.reflection))
+(def: signature
+ (All [category]
+ (-> (Type category) Text))
+ (|>> type.signature signature.signature))
+
+(def: reflection
+ (All [category]
+ (-> (Type (<| Return' Value' category)) Text))
+ (|>> type.reflection reflection.reflection))
(template [<name> <class>]
[(def: #export <name> .Type (#.Primitive <class> #.Nil))]
@@ -657,7 +664,9 @@
)))))
(def: (itself^ type)
- (All [a] (-> (Type a) (Parser (Type a))))
+ (All [category]
+ (-> (Type (<| Return' Value' category))
+ (Parser (Type (<| Return' Value' category)))))
(do <>.monad
[_ (<c>.identifier! ["" (..reflection type)])]
(wrap type)))
@@ -690,9 +699,15 @@
(..array^ type^)
))))
+(def: void^
+ (Parser (Type Void))
+ (do <>.monad
+ [_ (<c>.identifier! ["" (reflection.reflection reflection.void)])]
+ (wrap type.void)))
+
(def: (return^ imports type-vars)
(-> Context (List (Type Var)) (Parser (Type Return)))
- (<>.either (itself^ type.void)
+ (<>.either ..void^
(..type^ imports type-vars)))
(def: var^
diff --git a/stdlib/source/lux/target/jvm/bytecode.lux b/stdlib/source/lux/target/jvm/bytecode.lux
index bba140a7a..9092445c7 100644
--- a/stdlib/source/lux/target/jvm/bytecode.lux
+++ b/stdlib/source/lux/target/jvm/bytecode.lux
@@ -458,7 +458,7 @@
(import: #long java/lang/Float)
-(template [<name> <type> <constructor> <constant> <ldc> <to-lux> <specializations>]
+(template [<name> <type> <constructor> <constant> <wide> <to-lux> <specializations>]
[(def: #export (<name> value)
(-> <type> (Bytecode Any))
(case (|> value <to-lux>)
@@ -473,7 +473,7 @@
(..bytecode $0 $1 @_ _.ldc [index])
(#try.Failure _)
- (..bytecode $0 $1 @_ <ldc> [index])))))]
+ (..bytecode $0 $1 @_ <wide> [index])))))]
[int I32 //constant.integer //constant/pool.integer _.ldc-w/integer
(<| .int i32.i64)
@@ -485,13 +485,13 @@
[+4 _.iconst-4]
[+5 _.iconst-5])]
[float java/lang/Float //constant.float //constant/pool.float _.ldc-w/float
- host.float-to-double
+ (<| (:coerce Frac) host.float-to-double)
([+0.0 _.fconst-0]
[+1.0 _.fconst-1]
[+2.0 _.fconst-2])]
)
-(template [<name> <type> <constructor> <constant> <ldc> <to-lux> <specializations>]
+(template [<name> <type> <constructor> <constant> <wide> <to-lux> <specializations>]
[(def: #export (<name> value)
(-> <type> (Bytecode Any))
(case (|> value <to-lux>)
@@ -501,7 +501,7 @@
_ (do ..monad
[index (..lift (<constant> (<constructor> value)))]
- (..bytecode $0 $2 @_ <ldc> [index]))))]
+ (..bytecode $0 $2 @_ <wide> [index]))))]
[long Int //constant.long //constant/pool.long _.ldc2-w/long
(<|)
diff --git a/stdlib/source/lux/tool/compiler/phase/generation/jvm/extension/common.lux b/stdlib/source/lux/tool/compiler/phase/generation/jvm/extension/common.lux
index d06a5167c..d57dd6b50 100644
--- a/stdlib/source/lux/tool/compiler/phase/generation/jvm/extension/common.lux
+++ b/stdlib/source/lux/tool/compiler/phase/generation/jvm/extension/common.lux
@@ -184,8 +184,8 @@
)
(import: #long java/lang/Double
- (#static MIN_VALUE java/lang/Double)
- (#static MAX_VALUE java/lang/Double))
+ (#static MIN_VALUE double)
+ (#static MAX_VALUE double))
(template [<name> <const>]
[(def: (<name> _)