aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/lang/translation/jvm/case.lux
diff options
context:
space:
mode:
authorEduardo Julian2019-09-07 01:50:37 -0400
committerEduardo Julian2019-09-07 01:50:37 -0400
commitb63ac226cc2ea843f08f7c72b18d22602462c624 (patch)
tree7fb72562c39549108b7a48c1a6819c9bd3a64dab /new-luxc/source/luxc/lang/translation/jvm/case.lux
parent181f93f3e963c9738ed60f6f5e2d2a37253a0b1b (diff)
Modified compiler's machinery to use the new abstractions for descriptors and signatures.
Diffstat (limited to '')
-rw-r--r--new-luxc/source/luxc/lang/translation/jvm/case.lux34
1 files changed, 18 insertions, 16 deletions
diff --git a/new-luxc/source/luxc/lang/translation/jvm/case.lux b/new-luxc/source/luxc/lang/translation/jvm/case.lux
index f57671f36..d676f2996 100644
--- a/new-luxc/source/luxc/lang/translation/jvm/case.lux
+++ b/new-luxc/source/luxc/lang/translation/jvm/case.lux
@@ -1,5 +1,5 @@
(.module:
- [lux (#- if let case)
+ [lux (#- Type if let case)
[abstract
[monad (#+ do)]]
[control
@@ -10,8 +10,10 @@
["n" nat]]]
[target
[jvm
- [type
- ["." descriptor]]]]
+ ["." type (#+ Type)
+ ["." category (#+ Void Value Return Primitive Object Class Array Var Parameter Method)]
+ ["." descriptor (#+ Descriptor)]
+ ["." signature (#+ Signature)]]]]
[tool
[compiler
["." synthesis (#+ Path Synthesis)]
@@ -24,7 +26,7 @@
["." //
["." runtime]])
-(def: $Runtime (descriptor.class //.runtime-class))
+(def: $Runtime (type.class //.runtime-class (list)))
(def: (pop-altI stack-depth)
(-> Nat Inst)
@@ -43,7 +45,7 @@
(def: pushI
Inst
- (|>> (_.INVOKESTATIC $Runtime "pm_push" (descriptor.method [(list runtime.$Stack //.$Value) runtime.$Stack]) #0)))
+ (|>> (_.INVOKESTATIC $Runtime "pm_push" (type.method [(list runtime.$Stack //.$Value) runtime.$Stack (list)]) #0)))
(def: (path' phase stack-depth @else @end path)
(-> Phase Nat Label Label Path (Operation Inst))
@@ -58,19 +60,19 @@
(^ (synthesis.path/bit value))
(operation@wrap (.let [jumpI (.if value _.IFEQ _.IFNE)]
(|>> peekI
- (_.unwrap descriptor.boolean)
+ (_.unwrap type.boolean)
(jumpI @else))))
(^ (synthesis.path/i64 value))
(operation@wrap (|>> peekI
- (_.unwrap descriptor.long)
+ (_.unwrap type.long)
(_.long (.int value))
_.LCMP
(_.IFNE @else)))
(^ (synthesis.path/f64 value))
(operation@wrap (|>> peekI
- (_.unwrap descriptor.double)
+ (_.unwrap type.double)
(_.double value)
_.DCMPL
(_.IFNE @else)))
@@ -78,9 +80,9 @@
(^ (synthesis.path/text value))
(operation@wrap (|>> peekI
(_.string value)
- (_.INVOKEVIRTUAL (descriptor.class "java.lang.Object")
+ (_.INVOKEVIRTUAL (type.class "java.lang.Object" (list))
"equals"
- (descriptor.method [(list //.$Value) descriptor.boolean])
+ (type.method [(list //.$Value) type.boolean (list)])
#0)
(_.IFEQ @else)))
@@ -99,7 +101,7 @@
(_.CHECKCAST //.$Variant)
(_.int (.int (<prepare> idx)))
<flag>
- (_.INVOKESTATIC $Runtime "pm_variant" (descriptor.method [(list //.$Variant runtime.$Tag runtime.$Flag) runtime.$Value]) #0)
+ (_.INVOKESTATIC $Runtime "pm_variant" (type.method [(list //.$Variant runtime.$Tag runtime.$Flag) runtime.$Value (list)]) #0)
_.DUP
(_.IFNULL @fail)
(_.GOTO @success)
@@ -117,7 +119,7 @@
_.AALOAD
lefts
- (_.INVOKESTATIC $Runtime "tuple_left" (descriptor.method [(list //.$Tuple runtime.$Index) //.$Value]) #0))]
+ (_.INVOKESTATIC $Runtime "tuple_left" (type.method [(list //.$Tuple runtime.$Index) //.$Value (list)]) #0))]
(|>> peekI
(_.CHECKCAST //.$Tuple)
(_.int (.int lefts))
@@ -128,7 +130,7 @@
(operation@wrap (|>> peekI
(_.CHECKCAST //.$Tuple)
(_.int (.int lefts))
- (_.INVOKESTATIC $Runtime "tuple_right" (descriptor.method [(list //.$Tuple runtime.$Index) //.$Value]) #0)
+ (_.INVOKESTATIC $Runtime "tuple_right" (type.method [(list //.$Tuple runtime.$Index) //.$Value (list)]) #0)
pushI))
## Extra optimization
@@ -154,7 +156,7 @@
(wrap (|>> peekI
(_.CHECKCAST //.$Tuple)
(_.int (.int lefts))
- (_.INVOKESTATIC $Runtime <getter> (descriptor.method [(list //.$Tuple runtime.$Index) //.$Value]) #0)
+ (_.INVOKESTATIC $Runtime <getter> (type.method [(list //.$Tuple runtime.$Index) //.$Value (list)]) #0)
(_.ASTORE register)
then!))))
([synthesis.member/left "tuple_left"]
@@ -187,7 +189,7 @@
(wrap (|>> pathI
(_.label @else)
_.POP
- (_.INVOKESTATIC $Runtime "pm_fail" (descriptor.method [(list) descriptor.void]) #0)
+ (_.INVOKESTATIC $Runtime "pm_fail" (type.method [(list) type.void (list)]) #0)
_.NULL
(_.GOTO @end)))))
@@ -200,7 +202,7 @@
(wrap (<| _.with-label (function (_ @else))
_.with-label (function (_ @end))
(|>> testI
- (_.unwrap descriptor.boolean)
+ (_.unwrap type.boolean)
(_.IFEQ @else)
thenI
(_.GOTO @end)