aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEduardo Julian2016-07-11 00:53:02 -0400
committerEduardo Julian2016-07-11 00:53:02 -0400
commit38e90e52bc135d1a0aec60187b9443b08dde784d (patch)
tree19d37f86c80e4a252d5172843cec407aa852d68d /src
parent7687730b92adf914b3713201b4c49b5b997b31dd (diff)
- Renamed LuxUtils to LuxRT.
- Fixed a bug in _lux_proc ["array" "get"].
Diffstat (limited to 'src')
-rw-r--r--src/lux/compiler.clj2
-rw-r--r--src/lux/compiler/base.clj2
-rw-r--r--src/lux/compiler/case.clj30
-rw-r--r--src/lux/compiler/host.clj30
-rw-r--r--src/lux/compiler/lux.clj6
5 files changed, 35 insertions, 35 deletions
diff --git a/src/lux/compiler.clj b/src/lux/compiler.clj
index a17036b7e..a5d7f7115 100644
--- a/src/lux/compiler.clj
+++ b/src/lux/compiler.clj
@@ -171,7 +171,7 @@
(.visitSource file-name nil))]
_ (if (= "lux" name)
(|do [_ &&host/compile-Function-class
- _ &&host/compile-LuxUtils-class]
+ _ &&host/compile-LuxRT-class]
(return nil))
(return nil))]
(fn [state]
diff --git a/src/lux/compiler/base.clj b/src/lux/compiler/base.clj
index 1cc310564..5c50191fe 100644
--- a/src/lux/compiler/base.clj
+++ b/src/lux/compiler/base.clj
@@ -28,7 +28,7 @@
(def ^String output-dir "target/jvm")
(def ^String output-package (str output-dir "/" "program.jar"))
(def ^String function-class "lux/Function")
-(def ^String lux-utils-class "lux/LuxUtils")
+(def ^String lux-utils-class "lux/LuxRT")
(def ^String unit-tag-field "unit_tag")
;; Formats
diff --git a/src/lux/compiler/case.clj b/src/lux/compiler/case.clj
index 639883ac8..08624d171 100644
--- a/src/lux/compiler/case.clj
+++ b/src/lux/compiler/case.clj
@@ -55,18 +55,18 @@
(&o/$PopPM)
(doto writer
- (.visitMethodInsn Opcodes/INVOKESTATIC "lux/LuxUtils" "pm_stack_pop" "([Ljava/lang/Object;)[Ljava/lang/Object;"))
+ (.visitMethodInsn Opcodes/INVOKESTATIC "lux/LuxRT" "pm_stack_pop" "([Ljava/lang/Object;)[Ljava/lang/Object;"))
(&o/$BindPM _var-id)
(doto writer
(.visitInsn Opcodes/DUP)
- (.visitMethodInsn Opcodes/INVOKESTATIC "lux/LuxUtils" "pm_stack_peek" "([Ljava/lang/Object;)Ljava/lang/Object;")
+ (.visitMethodInsn Opcodes/INVOKESTATIC "lux/LuxRT" "pm_stack_peek" "([Ljava/lang/Object;)Ljava/lang/Object;")
(.visitVarInsn Opcodes/ASTORE _var-id))
(&o/$BoolPM _value)
(doto writer
(.visitInsn Opcodes/DUP)
- (.visitMethodInsn Opcodes/INVOKESTATIC "lux/LuxUtils" "pm_stack_peek" "([Ljava/lang/Object;)Ljava/lang/Object;")
+ (.visitMethodInsn Opcodes/INVOKESTATIC "lux/LuxRT" "pm_stack_peek" "([Ljava/lang/Object;)Ljava/lang/Object;")
(.visitTypeInsn Opcodes/CHECKCAST "java/lang/Boolean")
(.visitMethodInsn Opcodes/INVOKEVIRTUAL "java/lang/Boolean" "booleanValue" "()Z")
(.visitLdcInsn _value)
@@ -75,7 +75,7 @@
(&o/$IntPM _value)
(doto writer
(.visitInsn Opcodes/DUP)
- (.visitMethodInsn Opcodes/INVOKESTATIC "lux/LuxUtils" "pm_stack_peek" "([Ljava/lang/Object;)Ljava/lang/Object;")
+ (.visitMethodInsn Opcodes/INVOKESTATIC "lux/LuxRT" "pm_stack_peek" "([Ljava/lang/Object;)Ljava/lang/Object;")
(.visitTypeInsn Opcodes/CHECKCAST "java/lang/Long")
(.visitMethodInsn Opcodes/INVOKEVIRTUAL "java/lang/Long" "longValue" "()J")
(.visitLdcInsn (long _value))
@@ -85,7 +85,7 @@
(&o/$RealPM _value)
(doto writer
(.visitInsn Opcodes/DUP)
- (.visitMethodInsn Opcodes/INVOKESTATIC "lux/LuxUtils" "pm_stack_peek" "([Ljava/lang/Object;)Ljava/lang/Object;")
+ (.visitMethodInsn Opcodes/INVOKESTATIC "lux/LuxRT" "pm_stack_peek" "([Ljava/lang/Object;)Ljava/lang/Object;")
(.visitTypeInsn Opcodes/CHECKCAST "java/lang/Double")
(.visitMethodInsn Opcodes/INVOKEVIRTUAL "java/lang/Double" "doubleValue" "()D")
(.visitLdcInsn (double _value))
@@ -95,7 +95,7 @@
(&o/$CharPM _value)
(doto writer
(.visitInsn Opcodes/DUP)
- (.visitMethodInsn Opcodes/INVOKESTATIC "lux/LuxUtils" "pm_stack_peek" "([Ljava/lang/Object;)Ljava/lang/Object;")
+ (.visitMethodInsn Opcodes/INVOKESTATIC "lux/LuxRT" "pm_stack_peek" "([Ljava/lang/Object;)Ljava/lang/Object;")
(.visitTypeInsn Opcodes/CHECKCAST "java/lang/Character")
(.visitMethodInsn Opcodes/INVOKEVIRTUAL "java/lang/Character" "charValue" "()C")
(.visitLdcInsn _value)
@@ -104,7 +104,7 @@
(&o/$TextPM _value)
(doto writer
(.visitInsn Opcodes/DUP)
- (.visitMethodInsn Opcodes/INVOKESTATIC "lux/LuxUtils" "pm_stack_peek" "([Ljava/lang/Object;)Ljava/lang/Object;")
+ (.visitMethodInsn Opcodes/INVOKESTATIC "lux/LuxRT" "pm_stack_peek" "([Ljava/lang/Object;)Ljava/lang/Object;")
(.visitLdcInsn _value)
(.visitMethodInsn Opcodes/INVOKEVIRTUAL "java/lang/Object" "equals" "(Ljava/lang/Object;)Z")
(.visitJumpInsn Opcodes/IFEQ $else))
@@ -118,11 +118,11 @@
(&/T [_idx true]))]
(doto writer
(.visitInsn Opcodes/DUP)
- (.visitMethodInsn Opcodes/INVOKESTATIC "lux/LuxUtils" "pm_stack_peek" "([Ljava/lang/Object;)Ljava/lang/Object;")
+ (.visitMethodInsn Opcodes/INVOKESTATIC "lux/LuxRT" "pm_stack_peek" "([Ljava/lang/Object;)Ljava/lang/Object;")
(.visitTypeInsn Opcodes/CHECKCAST "[Ljava/lang/Object;")
(.visitLdcInsn (int _idx))
- (.visitMethodInsn Opcodes/INVOKESTATIC "lux/LuxUtils" (if is-tail? "product_getRight" "product_getLeft") "([Ljava/lang/Object;I)Ljava/lang/Object;")
- (.visitMethodInsn Opcodes/INVOKESTATIC "lux/LuxUtils" "pm_stack_push" "([Ljava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;")
+ (.visitMethodInsn Opcodes/INVOKESTATIC "lux/LuxRT" (if is-tail? "product_getRight" "product_getLeft") "([Ljava/lang/Object;I)Ljava/lang/Object;")
+ (.visitMethodInsn Opcodes/INVOKESTATIC "lux/LuxRT" "pm_stack_push" "([Ljava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;")
))
(&o/$VariantPM _idx+)
@@ -136,14 +136,14 @@
(&/T [_idx true]))
_ (doto writer
(.visitInsn Opcodes/DUP)
- (.visitMethodInsn Opcodes/INVOKESTATIC "lux/LuxUtils" "pm_stack_peek" "([Ljava/lang/Object;)Ljava/lang/Object;")
+ (.visitMethodInsn Opcodes/INVOKESTATIC "lux/LuxRT" "pm_stack_peek" "([Ljava/lang/Object;)Ljava/lang/Object;")
(.visitTypeInsn Opcodes/CHECKCAST "[Ljava/lang/Object;")
(.visitLdcInsn (int _idx)))
_ (if is-last
(.visitLdcInsn writer "")
(.visitInsn writer Opcodes/ACONST_NULL))]
(doto writer
- (.visitMethodInsn Opcodes/INVOKESTATIC "lux/LuxUtils" "sum_get" "([Ljava/lang/Object;ILjava/lang/Object;)Ljava/lang/Object;")
+ (.visitMethodInsn Opcodes/INVOKESTATIC "lux/LuxRT" "sum_get" "([Ljava/lang/Object;ILjava/lang/Object;)Ljava/lang/Object;")
(.visitInsn Opcodes/DUP)
(.visitJumpInsn Opcodes/IFNULL $fail)
(.visitJumpInsn Opcodes/GOTO $success)
@@ -151,7 +151,7 @@
(.visitInsn Opcodes/POP)
(.visitJumpInsn Opcodes/GOTO $else)
(.visitLabel $success)
- (.visitMethodInsn Opcodes/INVOKESTATIC "lux/LuxUtils" "pm_stack_push" "([Ljava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;")))
+ (.visitMethodInsn Opcodes/INVOKESTATIC "lux/LuxRT" "pm_stack_push" "([Ljava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;")))
(&o/$SeqPM _left-pm _right-pm)
(doto writer
@@ -174,7 +174,7 @@
(compile-pattern* bodies 1 $else pm)
(.visitLabel $else)
(.visitInsn Opcodes/POP)
- (.visitMethodInsn Opcodes/INVOKESTATIC "lux/LuxUtils" "pm_fail" "()V")
+ (.visitMethodInsn Opcodes/INVOKESTATIC "lux/LuxRT" "pm_fail" "()V")
(.visitInsn Opcodes/ACONST_NULL)
(.visitJumpInsn Opcodes/GOTO $end))))
@@ -196,7 +196,7 @@
:let [_ (doto *writer*
(.visitInsn Opcodes/ACONST_NULL)
(.visitInsn Opcodes/SWAP)
- (.visitMethodInsn Opcodes/INVOKESTATIC "lux/LuxUtils" "pm_stack_push" "([Ljava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;"))
+ (.visitMethodInsn Opcodes/INVOKESTATIC "lux/LuxRT" "pm_stack_push" "([Ljava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;"))
_ (compile-pattern *writer* bodies-labels ?pm $end)]
_ (compile-bodies *writer* compile bodies-labels ?bodies $end)
:let [_ (.visitLabel *writer* $end)]]
diff --git a/src/lux/compiler/host.clj b/src/lux/compiler/host.clj
index d94ca9dbd..ceb270ac1 100644
--- a/src/lux/compiler/host.clj
+++ b/src/lux/compiler/host.clj
@@ -556,7 +556,7 @@
(&&/save-class! (second (string/split &&/function-class #"/"))
(.toByteArray (doto =class .visitEnd)))))
-(defn ^:private compile-LuxUtils-adt-methods [=class]
+(defn ^:private compile-LuxRT-adt-methods [=class]
(|let [_ (let [$begin (new Label)
$not-rec (new Label)]
(doto (.visitMethod =class (+ Opcodes/ACC_PUBLIC Opcodes/ACC_STATIC) "product_getLeft" "([Ljava/lang/Object;I)Ljava/lang/Object;" nil nil)
@@ -718,7 +718,7 @@
(.visitEnd)))]
nil))
-(defn ^:private compile-LuxUtils-pm-methods [=class]
+(defn ^:private compile-LuxRT-pm-methods [=class]
(|let [_ (doto (.visitMethod =class (+ Opcodes/ACC_PUBLIC Opcodes/ACC_STATIC) "pm_fail" "()V" nil nil)
(.visitCode)
(.visitTypeInsn Opcodes/NEW "java/lang/IllegalStateException")
@@ -762,7 +762,7 @@
(.visitEnd))]
nil))
-(def compile-LuxUtils-class
+(def compile-LuxRT-class
(|do [_ (return nil)
:let [full-name &&/lux-utils-class
super-class (&host-generics/->bytecode-class-name "java.lang.Object")
@@ -794,8 +794,8 @@
(.visitMaxs 0 0)
(.visitEnd)))
_ (doto =class
- (compile-LuxUtils-adt-methods)
- (compile-LuxUtils-pm-methods))]]
+ (compile-LuxRT-adt-methods)
+ (compile-LuxRT-pm-methods))]]
(&&/save-class! (second (string/split &&/lux-utils-class #"/"))
(.toByteArray (doto =class .visitEnd)))))
@@ -1320,23 +1320,23 @@
&&/unwrap-long
(.visitInsn Opcodes/L2I))]
:let [_ (.visitInsn *writer* Opcodes/AALOAD)]
- :let [$then (new Label)
+ :let [$is-null (new Label)
$end (new Label)
_ (doto *writer*
(.visitInsn Opcodes/DUP)
- (.visitJumpInsn Opcodes/IFNULL $then)
- (.visitInsn Opcodes/POP)
- (.visitLdcInsn (int 0))
- (.visitInsn Opcodes/ACONST_NULL)
- (.visitLdcInsn &/unit-tag)
- (.visitMethodInsn Opcodes/INVOKESTATIC "lux/LuxUtils" "sum_make" "(ILjava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;")
- (.visitJumpInsn Opcodes/GOTO $end)
- (.visitLabel $then)
+ (.visitJumpInsn Opcodes/IFNULL $is-null)
(.visitLdcInsn (int 1))
(.visitLdcInsn "")
(.visitInsn Opcodes/DUP2_X1) ;; I?2I?
(.visitInsn Opcodes/POP2) ;; I?2
- (.visitMethodInsn Opcodes/INVOKESTATIC "lux/LuxUtils" "sum_make" "(ILjava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;")
+ (.visitMethodInsn Opcodes/INVOKESTATIC "lux/LuxRT" "sum_make" "(ILjava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;")
+ (.visitJumpInsn Opcodes/GOTO $end)
+ (.visitLabel $is-null)
+ (.visitInsn Opcodes/POP)
+ (.visitLdcInsn (int 0))
+ (.visitInsn Opcodes/ACONST_NULL)
+ (.visitLdcInsn &/unit-tag)
+ (.visitMethodInsn Opcodes/INVOKESTATIC "lux/LuxRT" "sum_make" "(ILjava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;")
(.visitLabel $end))]]
(return nil)))
diff --git a/src/lux/compiler/lux.clj b/src/lux/compiler/lux.clj
index 3f069dbfd..180d1556b 100644
--- a/src/lux/compiler/lux.clj
+++ b/src/lux/compiler/lux.clj
@@ -87,7 +87,7 @@
(.visitLdcInsn *writer* "")
(.visitInsn *writer* Opcodes/ACONST_NULL))]
_ (compile value)
- :let [_ (.visitMethodInsn *writer* Opcodes/INVOKESTATIC "lux/LuxUtils" "sum_make" "(ILjava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;")]]
+ :let [_ (.visitMethodInsn *writer* Opcodes/INVOKESTATIC "lux/LuxRT" "sum_make" "(ILjava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;")]]
(return nil)))
(defn compile-local [compile ?idx]
@@ -394,7 +394,7 @@
(.visitLdcInsn (->> #'&/$Nil meta ::&/idx int)) ;; I
(.visitInsn Opcodes/ACONST_NULL) ;; I?
(.visitLdcInsn &/unit-tag) ;; I?U
- (.visitMethodInsn Opcodes/INVOKESTATIC "lux/LuxUtils" "sum_make" "(ILjava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;") ;; V
+ (.visitMethodInsn Opcodes/INVOKESTATIC "lux/LuxRT" "sum_make" "(ILjava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;") ;; V
;; Tail: End
;; Size: Begin
(.visitVarInsn Opcodes/ALOAD 0) ;; VA
@@ -434,7 +434,7 @@
(.visitLdcInsn "") ;; I2I?
(.visitInsn Opcodes/DUP2_X1) ;; II?2I?
(.visitInsn Opcodes/POP2) ;; II?2
- (.visitMethodInsn Opcodes/INVOKESTATIC "lux/LuxUtils" "sum_make" "(ILjava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;") ;; IV
+ (.visitMethodInsn Opcodes/INVOKESTATIC "lux/LuxRT" "sum_make" "(ILjava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;") ;; IV
;; Cons: End
(.visitInsn Opcodes/SWAP) ;; VI
(.visitJumpInsn Opcodes/GOTO $loop)