aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/lang/translation/jvm/function.jvm.lux
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--new-luxc/source/luxc/lang/translation/jvm/function.jvm.lux66
1 files changed, 33 insertions, 33 deletions
diff --git a/new-luxc/source/luxc/lang/translation/jvm/function.jvm.lux b/new-luxc/source/luxc/lang/translation/jvm/function.jvm.lux
index 17585b63c..4e2b71f39 100644
--- a/new-luxc/source/luxc/lang/translation/jvm/function.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/jvm/function.jvm.lux
@@ -31,7 +31,7 @@
(def: (poly-arg? arity)
(-> Arity Bit)
- (n/> +1 arity))
+ (n/> 1 arity))
(def: (reset-method class)
(-> Text $.Method)
@@ -56,12 +56,12 @@
(def: get-amount-of-partialsI
Inst
- (|>> (_.ALOAD +0)
+ (|>> (_.ALOAD 0)
(_.GETFIELD //.function-class runtime.partials-field type.int)))
(def: (load-fieldI class field)
(-> Text Text Inst)
- (|>> (_.ALOAD +0)
+ (|>> (_.ALOAD 0)
(_.GETFIELD class field $Object)))
(def: (inputsI start amount)
@@ -102,7 +102,7 @@
(def: (with-partial arity)
(-> Arity Def)
(if (poly-arg? arity)
- (|> (list.n/range +0 (n/- +2 arity))
+ (|> (list.n/range 0 (n/- 2 arity))
(list/map (.function (_ idx)
(def.field #$.Private $.finalF (reference.partial-name idx) $Object)))
def.fuse)
@@ -114,7 +114,7 @@
[captureI+ (monad.map @ reference.variable env)
#let [argsI (if (poly-arg? arity)
(|> (nullsI (dec arity))
- (list (_.int 0))
+ (list (_.int +0))
_.fuse)
id)]]
(wrap (|>> (_.NEW class)
@@ -129,14 +129,14 @@
(if (poly-arg? arity)
(let [env-size (list.size env)
captureI (|> (case env-size
- +0 (list)
- _ (list.n/range +0 (dec env-size)))
+ 0 (list)
+ _ (list.n/range 0 (dec env-size)))
(list/map (.function (_ source)
- (|>> (_.ALOAD +0)
+ (|>> (_.ALOAD 0)
(_.GETFIELD class (reference.foreign-name source) $Object))))
_.fuse)
argsI (|> (nullsI (dec arity))
- (list (_.int 0))
+ (list (_.int +0))
_.fuse)]
(|>> (_.NEW class)
_.DUP
@@ -144,7 +144,7 @@
argsI
(_.INVOKESPECIAL class "<init>" (init-method env arity) #0)
_.ARETURN))
- (|>> (_.ALOAD +0)
+ (|>> (_.ALOAD 0)
_.ARETURN))))
(def: (with-implementation arity @begin bodyI)
@@ -160,8 +160,8 @@
(def: (function-init arity env-size)
(-> Arity Nat Inst)
- (if (n/= +1 arity)
- (|>> (_.int 0)
+ (if (n/= 1 arity)
+ (|>> (_.int +0)
(_.INVOKESPECIAL //.function-class "<init>" function-init-method #0))
(|>> (_.ILOAD (inc env-size))
(_.INVOKESPECIAL //.function-class "<init>" function-init-method #0))))
@@ -172,24 +172,24 @@
offset-partial (: (-> Nat Nat)
(|>> inc (n/+ env-size)))
store-capturedI (|> (case env-size
- +0 (list)
- _ (list.n/range +0 (dec env-size)))
+ 0 (list)
+ _ (list.n/range 0 (dec env-size)))
(list/map (.function (_ register)
- (|>> (_.ALOAD +0)
+ (|>> (_.ALOAD 0)
(_.ALOAD (inc register))
(_.PUTFIELD class (reference.foreign-name register) $Object))))
_.fuse)
store-partialI (if (poly-arg? arity)
- (|> (list.n/range +0 (n/- +2 arity))
+ (|> (list.n/range 0 (n/- 2 arity))
(list/map (.function (_ idx)
(let [register (offset-partial idx)]
- (|>> (_.ALOAD +0)
+ (|>> (_.ALOAD 0)
(_.ALOAD (inc register))
(_.PUTFIELD class (reference.partial-name idx) $Object)))))
_.fuse)
id)]
(def.method #$.Public $.noneM "<init>" (init-method env arity)
- (|>> (_.ALOAD +0)
+ (|>> (_.ALOAD 0)
(function-init arity env-size)
store-capturedI
store-partialI
@@ -203,20 +203,20 @@
@labels (list/map $.new-label (list.repeat num-partials []))
arity-over-extent (|> (.int function-arity) (i/- (.int apply-arity)))
casesI (|> (list/compose @labels (list @default))
- (list.zip2 (list.n/range +0 num-partials))
+ (list.zip2 (list.n/range 0 num-partials))
(list/map (.function (_ [stage @label])
- (let [load-partialsI (if (n/> +0 stage)
- (|> (list.n/range +0 (dec stage))
+ (let [load-partialsI (if (n/> 0 stage)
+ (|> (list.n/range 0 (dec stage))
(list/map (|>> reference.partial-name (load-fieldI class)))
_.fuse)
id)]
(cond (i/= arity-over-extent (.int stage))
(|>> (_.label @label)
- (_.ALOAD +0)
- (when (n/> +0 stage)
+ (_.ALOAD 0)
+ (when (n/> 0 stage)
(_.INVOKEVIRTUAL class "reset" (reset-method class) #0))
load-partialsI
- (inputsI +1 apply-arity)
+ (inputsI 1 apply-arity)
(_.INVOKEVIRTUAL class "impl" (implementation-method function-arity) #0)
_.ARETURN)
@@ -224,10 +224,10 @@
(let [args-to-completion (|> function-arity (n/- stage))
args-left (|> apply-arity (n/- args-to-completion))]
(|>> (_.label @label)
- (_.ALOAD +0)
+ (_.ALOAD 0)
(_.INVOKEVIRTUAL class "reset" (reset-method class) #0)
load-partialsI
- (inputsI +1 args-to-completion)
+ (inputsI 1 args-to-completion)
(_.INVOKEVIRTUAL class "impl" (implementation-method function-arity) #0)
(applysI (inc args-to-completion) args-left)
_.ARETURN))
@@ -235,8 +235,8 @@
## (i/< arity-over-extent (.int stage))
(let [env-size (list.size env)
load-capturedI (|> (case env-size
- +0 (list)
- _ (list.n/range +0 (dec env-size)))
+ 0 (list)
+ _ (list.n/range 0 (dec env-size)))
(list/map (|>> reference.foreign-name (load-fieldI class)))
_.fuse)]
(|>> (_.label @label)
@@ -246,7 +246,7 @@
get-amount-of-partialsI
(inc-intI apply-arity)
load-partialsI
- (inputsI +1 apply-arity)
+ (inputsI 1 apply-arity)
(nullsI (|> num-partials (n/- apply-arity) (n/- stage)))
(_.INVOKESPECIAL class "<init>" (init-method env function-arity) #0)
_.ARETURN))
@@ -254,7 +254,7 @@
_.fuse)]
(def.method #$.Public $.noneM runtime.apply-method (runtime.apply-signature apply-arity)
(|>> get-amount-of-partialsI
- (_.TABLESWITCH 0 (|> num-partials dec .int)
+ (_.TABLESWITCH +0 (|> num-partials dec .int)
@default @labels)
casesI
(_.INVOKESTATIC //.runtime-class "apply_fail" (type.method (list) #.None (list)) #0)
@@ -269,11 +269,11 @@
applyD (: Def
(if (poly-arg? arity)
(|> (n/min arity runtime.num-apply-variants)
- (list.n/range +1)
+ (list.n/range 1)
(list/map (with-apply class env arity @begin bodyI))
(list& (with-implementation arity @begin bodyI))
def.fuse)
- (def.method #$.Public $.strictM runtime.apply-method (runtime.apply-signature +1)
+ (def.method #$.Public $.strictM runtime.apply-method (runtime.apply-signature 1)
(|>> (_.label @begin)
bodyI
_.ARETURN))))
@@ -294,7 +294,7 @@
(do phase.Monad<Operation>
[@begin _.make-label
[function-class bodyI] (translation.with-context
- (translation.with-anchor [@begin +1]
+ (translation.with-anchor [@begin 1]
(translate bodyS)))
[functionD instanceI] (with-function @begin function-class env arity bodyI)
_ (translation.save! ["" function-class]