From b63ac226cc2ea843f08f7c72b18d22602462c624 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sat, 7 Sep 2019 01:50:37 -0400 Subject: Modified compiler's machinery to use the new abstractions for descriptors and signatures. --- new-luxc/source/luxc/lang/translation/jvm/case.lux | 34 ++++++++++++---------- 1 file changed, 18 insertions(+), 16 deletions(-) (limited to 'new-luxc/source/luxc/lang/translation/jvm/case.lux') 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 ( idx))) - (_.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 (descriptor.method [(list //.$Tuple runtime.$Index) //.$Value]) #0) + (_.INVOKESTATIC $Runtime (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) -- cgit v1.2.3