diff options
author | Eduardo Julian | 2021-11-08 02:02:27 -0400 |
---|---|---|
committer | Eduardo Julian | 2021-11-08 02:02:27 -0400 |
commit | df6cf0d3c980e3d7240eec6cb38d86af61037725 (patch) | |
tree | 6654307936eeeb0947bb7e8db8e9e94430c8c2dd /lux-bootstrapper/src | |
parent | 305a3b5bca562601ee37b4cac69dd02f245830db (diff) |
Sharing the same Function class between bootsrapper and JVM compiler.
Diffstat (limited to 'lux-bootstrapper/src')
-rw-r--r-- | lux-bootstrapper/src/lux/base.clj | 4 | ||||
-rw-r--r-- | lux-bootstrapper/src/lux/compiler/jvm.clj | 4 | ||||
-rw-r--r-- | lux-bootstrapper/src/lux/compiler/jvm/base.clj | 2 | ||||
-rw-r--r-- | lux-bootstrapper/src/lux/compiler/jvm/case.clj | 16 | ||||
-rw-r--r-- | lux-bootstrapper/src/lux/compiler/jvm/lux.clj | 8 | ||||
-rw-r--r-- | lux-bootstrapper/src/lux/compiler/jvm/proc/common.clj | 8 | ||||
-rw-r--r-- | lux-bootstrapper/src/lux/compiler/jvm/rt.clj | 112 | ||||
-rw-r--r-- | lux-bootstrapper/src/lux/host.clj | 7 |
8 files changed, 82 insertions, 79 deletions
diff --git a/lux-bootstrapper/src/lux/base.clj b/lux-bootstrapper/src/lux/base.clj index ca779a82a..42172b836 100644 --- a/lux-bootstrapper/src/lux/base.clj +++ b/lux-bootstrapper/src/lux/base.clj @@ -1193,7 +1193,7 @@ (assoc output index (rem raw 10)) (int (/ raw 10)))) output)))] - ;; Based on the LuxRT.encode_rev method + ;; Based on the Runtime.encode_rev method (defn encode-rev [input] (if (= 0 input) ".0" @@ -1211,7 +1211,7 @@ (.split "0*$") (aget 0)))))) - ;; Based on the LuxRT.decode_rev method + ;; Based on the Runtime.decode_rev method (defn decode-rev [^String input] (if (and (.startsWith input ".") (<= (.length input) (inc rev-bits))) diff --git a/lux-bootstrapper/src/lux/compiler/jvm.clj b/lux-bootstrapper/src/lux/compiler/jvm.clj index 7a547dcd3..ebef7c418 100644 --- a/lux-bootstrapper/src/lux/compiler/jvm.clj +++ b/lux-bootstrapper/src/lux/compiler/jvm.clj @@ -189,8 +189,8 @@ module-class-name nil "java/lang/Object" nil) (.visitSource file-name nil))] _ (if (= &/prelude name) - (|do [_ &&rt/compile-Function-class - _ &&rt/compile-LuxRT-class] + (|do [;; _ &&rt/compile-Function-class + _ &&rt/compile-Runtime-class] (return nil)) (return nil)) :let [compiler-step (&analyser/analyse &optimizer/optimize eval! compile-module!! all-compilers)]] diff --git a/lux-bootstrapper/src/lux/compiler/jvm/base.clj b/lux-bootstrapper/src/lux/compiler/jvm/base.clj index 47566a626..f9cdc411d 100644 --- a/lux-bootstrapper/src/lux/compiler/jvm/base.clj +++ b/lux-bootstrapper/src/lux/compiler/jvm/base.clj @@ -38,7 +38,7 @@ (str "(" (apply str (repeat n "Ljava/lang/Object;")) ")Ljava/lang/Object;")) (def ^:const num-apply-variants 8) (def ^:const arity-field "_arity_") -(def ^:const partials-field "_partials_") +(def ^:const partials-field "partials") ;; [Utils] (defn ^:private write-output [module name data] diff --git a/lux-bootstrapper/src/lux/compiler/jvm/case.clj b/lux-bootstrapper/src/lux/compiler/jvm/case.clj index 6bd9a3824..3858dbde2 100644 --- a/lux-bootstrapper/src/lux/compiler/jvm/case.clj +++ b/lux-bootstrapper/src/lux/compiler/jvm/case.clj @@ -114,21 +114,21 @@ #(doto ^MethodVisitor % (.visitInsn Opcodes/AALOAD)) #(doto ^MethodVisitor % - (.visitMethodInsn Opcodes/INVOKESTATIC &rt/rt-class "tuple_left" "([Ljava/lang/Object;I)Ljava/lang/Object;")))] + (.visitMethodInsn Opcodes/INVOKESTATIC &rt/runtime-class "tuple_left" "([Ljava/lang/Object;I)Ljava/lang/Object;")))] (doto writer stack-peek (.visitTypeInsn Opcodes/CHECKCAST "[Ljava/lang/Object;") (.visitLdcInsn (int lefts)) accessI - (.visitMethodInsn Opcodes/INVOKESTATIC &rt/rt-class "pm_stack_push" "([Ljava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;"))) + (.visitMethodInsn Opcodes/INVOKESTATIC &rt/runtime-class "pm_stack_push" "([Ljava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;"))) (&o/$TuplePM (&/$Right _idx)) (doto writer stack-peek (.visitTypeInsn Opcodes/CHECKCAST "[Ljava/lang/Object;") (.visitLdcInsn (int (dec _idx))) - (.visitMethodInsn Opcodes/INVOKESTATIC &rt/rt-class "tuple_right" "([Ljava/lang/Object;I)Ljava/lang/Object;") - (.visitMethodInsn Opcodes/INVOKESTATIC &rt/rt-class "pm_stack_push" "([Ljava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;")) + (.visitMethodInsn Opcodes/INVOKESTATIC &rt/runtime-class "tuple_right" "([Ljava/lang/Object;I)Ljava/lang/Object;") + (.visitMethodInsn Opcodes/INVOKESTATIC &rt/runtime-class "pm_stack_push" "([Ljava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;")) (&o/$VariantPM _idx+) (|let [$success (new Label) @@ -147,7 +147,7 @@ (.visitLdcInsn writer "") (.visitInsn writer Opcodes/ACONST_NULL))] (doto writer - (.visitMethodInsn Opcodes/INVOKESTATIC &rt/rt-class "sum_get" "([Ljava/lang/Object;ILjava/lang/Object;)Ljava/lang/Object;") + (.visitMethodInsn Opcodes/INVOKESTATIC &rt/runtime-class "sum_get" "([Ljava/lang/Object;ILjava/lang/Object;)Ljava/lang/Object;") (.visitInsn Opcodes/DUP) (.visitJumpInsn Opcodes/IFNULL $fail) (.visitJumpInsn Opcodes/GOTO $success) @@ -155,7 +155,7 @@ (.visitInsn Opcodes/POP) (.visitJumpInsn Opcodes/GOTO $else) (.visitLabel $success) - (.visitMethodInsn Opcodes/INVOKESTATIC &rt/rt-class "pm_stack_push" "([Ljava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;"))) + (.visitMethodInsn Opcodes/INVOKESTATIC &rt/runtime-class "pm_stack_push" "([Ljava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;"))) (&o/$SeqPM _left-pm _right-pm) (doto writer @@ -178,7 +178,7 @@ (compile-pattern* bodies 1 $else pm) (.visitLabel $else) (.visitInsn Opcodes/POP) - (.visitMethodInsn Opcodes/INVOKESTATIC &rt/rt-class "pm_fail" "()V") + (.visitMethodInsn Opcodes/INVOKESTATIC &rt/runtime-class "pm_fail" "()V") (.visitInsn Opcodes/ACONST_NULL) (.visitJumpInsn Opcodes/GOTO $end)))) @@ -200,7 +200,7 @@ (.visitInsn Opcodes/ACONST_NULL))] _ (compile ?value) :let [_ (doto *writer* - (.visitMethodInsn Opcodes/INVOKESTATIC &rt/rt-class "pm_stack_push" "([Ljava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;")) + (.visitMethodInsn Opcodes/INVOKESTATIC &rt/runtime-class "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/lux-bootstrapper/src/lux/compiler/jvm/lux.clj b/lux-bootstrapper/src/lux/compiler/jvm/lux.clj index 279fd119a..4617f7e2e 100644 --- a/lux-bootstrapper/src/lux/compiler/jvm/lux.clj +++ b/lux-bootstrapper/src/lux/compiler/jvm/lux.clj @@ -82,7 +82,7 @@ (.visitLdcInsn *writer* "") (.visitInsn *writer* Opcodes/ACONST_NULL))] _ (compile value) - :let [_ (.visitMethodInsn *writer* Opcodes/INVOKESTATIC &rt/rt-class "sum_make" "(ILjava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;")]] + :let [_ (.visitMethodInsn *writer* Opcodes/INVOKESTATIC &rt/runtime-class "sum_make" "(ILjava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;")]] (return nil))) (defn compile-local [compile ?idx] @@ -211,7 +211,7 @@ (.visitLdcInsn (int (if tail? (dec idx) idx))) - (.visitMethodInsn Opcodes/INVOKESTATIC &rt/rt-class + (.visitMethodInsn Opcodes/INVOKESTATIC &rt/runtime-class (if tail? "tuple_right" "tuple_left") "([Ljava/lang/Object;I)Ljava/lang/Object;")))) _path)]] @@ -347,7 +347,7 @@ (.visitLdcInsn (->> #'&/$End meta ::&/lefts int)) ;; I (.visitInsn Opcodes/ACONST_NULL) ;; I? (.visitLdcInsn &/unit-tag) ;; I?U - (.visitMethodInsn Opcodes/INVOKESTATIC &rt/rt-class "sum_make" "(ILjava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;") ;; V + (.visitMethodInsn Opcodes/INVOKESTATIC &rt/runtime-class "sum_make" "(ILjava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;") ;; V ;; Tail: End ;; Size: Begin (.visitVarInsn Opcodes/ALOAD 0) ;; VA @@ -387,7 +387,7 @@ (.visitLdcInsn "") ;; I2I? (.visitInsn Opcodes/DUP2_X1) ;; II?2I? (.visitInsn Opcodes/POP2) ;; II?2 - (.visitMethodInsn Opcodes/INVOKESTATIC &rt/rt-class "sum_make" "(ILjava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;") ;; IV + (.visitMethodInsn Opcodes/INVOKESTATIC &rt/runtime-class "sum_make" "(ILjava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;") ;; IV ;; Item: End (.visitInsn Opcodes/SWAP) ;; VI (.visitJumpInsn Opcodes/GOTO $loop) diff --git a/lux-bootstrapper/src/lux/compiler/jvm/proc/common.clj b/lux-bootstrapper/src/lux/compiler/jvm/proc/common.clj index 642bd3427..fc1257a3e 100644 --- a/lux-bootstrapper/src/lux/compiler/jvm/proc/common.clj +++ b/lux-bootstrapper/src/lux/compiler/jvm/proc/common.clj @@ -83,7 +83,7 @@ _ (compile ?op) :let [_ (doto *writer* (.visitTypeInsn Opcodes/CHECKCAST &rt/function-class) - (.visitMethodInsn Opcodes/INVOKESTATIC &rt/rt-class "runTry" (str "(L" &rt/function-class ";)[Ljava/lang/Object;")))]] + (.visitMethodInsn Opcodes/INVOKESTATIC &rt/runtime-class "runTry" (str "(L" &rt/function-class ";)[Ljava/lang/Object;")))]] (return nil))) (do-template [<name> <opcode> <unwrap> <wrap>] @@ -161,7 +161,7 @@ _ (compile ?input) :let [_ (doto *writer* (.visitTypeInsn Opcodes/CHECKCAST "java/lang/String") - (.visitMethodInsn Opcodes/INVOKESTATIC &rt/rt-class "decode_frac" "(Ljava/lang/String;)[Ljava/lang/Object;"))]] + (.visitMethodInsn Opcodes/INVOKESTATIC &rt/runtime-class "decode_frac" "(Ljava/lang/String;)[Ljava/lang/Object;"))]] (return nil))) (defn ^:private compile-int-char [compile ?values special-args] @@ -277,11 +277,11 @@ (.visitJumpInsn Opcodes/IF_ICMPEQ $not-found) (.visitInsn Opcodes/I2L) &&/wrap-long - (.visitMethodInsn Opcodes/INVOKESTATIC &rt/rt-class "make_some" "(Ljava/lang/Object;)[Ljava/lang/Object;") + (.visitMethodInsn Opcodes/INVOKESTATIC &rt/runtime-class "make_some" "(Ljava/lang/Object;)[Ljava/lang/Object;") (.visitJumpInsn Opcodes/GOTO $end) (.visitLabel $not-found) (.visitInsn Opcodes/POP) - (.visitMethodInsn Opcodes/INVOKESTATIC &rt/rt-class "make_none" "()[Ljava/lang/Object;") + (.visitMethodInsn Opcodes/INVOKESTATIC &rt/runtime-class "make_none" "()[Ljava/lang/Object;") (.visitLabel $end))]] (return nil))) diff --git a/lux-bootstrapper/src/lux/compiler/jvm/rt.clj b/lux-bootstrapper/src/lux/compiler/jvm/rt.clj index 23b7c1be9..c8c3a522a 100644 --- a/lux-bootstrapper/src/lux/compiler/jvm/rt.clj +++ b/lux-bootstrapper/src/lux/compiler/jvm/rt.clj @@ -21,7 +21,7 @@ MethodVisitor AnnotationVisitor))) -(def ^:const ^String rt-class +(def ^:const ^String runtime-class &&/lux-utils-class) (def ^:const ^String function-class @@ -32,45 +32,45 @@ ;; [Resources] ;; Functions -(def compile-Function-class - (|do [_ (return nil) - :let [super-class "java/lang/Object" - =class (doto (new ClassWriter ClassWriter/COMPUTE_MAXS) - (.visit &host/bytecode-version (+ Opcodes/ACC_PUBLIC Opcodes/ACC_SUPER - Opcodes/ACC_ABSTRACT - ;; Opcodes/ACC_INTERFACE - ) - &&/function-class nil super-class (into-array String [])) - (-> (.visitField (+ Opcodes/ACC_PUBLIC Opcodes/ACC_FINAL) &&/partials-field "I" nil nil) - (doto (.visitEnd)))) - =init-method (doto (.visitMethod =class Opcodes/ACC_PUBLIC init-method "(I)V" nil nil) - (.visitCode) - (.visitVarInsn Opcodes/ALOAD 0) - (.visitMethodInsn Opcodes/INVOKESPECIAL super-class init-method "()V") - (.visitVarInsn Opcodes/ALOAD 0) - (.visitVarInsn Opcodes/ILOAD 1) - (.visitFieldInsn Opcodes/PUTFIELD &&/function-class &&/partials-field "I") - (.visitInsn Opcodes/RETURN) - (.visitMaxs 0 0) - (.visitEnd)) - _ (dotimes [arity* &&/num-apply-variants] - (let [arity (inc arity*)] - (if (= 1 arity) - (doto (.visitMethod =class (+ Opcodes/ACC_PUBLIC Opcodes/ACC_ABSTRACT) &&/apply-method (&&/apply-signature arity) nil nil) - (.visitEnd)) - (doto (.visitMethod =class Opcodes/ACC_PUBLIC &&/apply-method (&&/apply-signature arity) nil nil) - (.visitCode) - (-> (.visitVarInsn Opcodes/ALOAD idx) - (->> (dotimes [idx arity]))) - (.visitMethodInsn Opcodes/INVOKEVIRTUAL &&/function-class &&/apply-method (&&/apply-signature (dec arity))) - (.visitTypeInsn Opcodes/CHECKCAST &&/function-class) - (.visitVarInsn Opcodes/ALOAD arity) - (.visitMethodInsn Opcodes/INVOKEVIRTUAL &&/function-class &&/apply-method (&&/apply-signature 1)) - (.visitInsn Opcodes/ARETURN) - (.visitMaxs 0 0) - (.visitEnd)))))]] - (&&/save-class! (-> &&/function-class (string/split #"/") (nth 2)) - (.toByteArray (doto =class .visitEnd))))) +;; (def compile-Function-class +;; (|do [_ (return nil) +;; :let [super-class "java/lang/Object" +;; =class (doto (new ClassWriter ClassWriter/COMPUTE_MAXS) +;; (.visit &host/bytecode-version (+ Opcodes/ACC_PUBLIC Opcodes/ACC_SUPER +;; Opcodes/ACC_ABSTRACT +;; ;; Opcodes/ACC_INTERFACE +;; ) +;; &&/function-class nil super-class (into-array String [])) +;; (-> (.visitField (+ Opcodes/ACC_PUBLIC Opcodes/ACC_FINAL) &&/partials-field "I" nil nil) +;; (doto (.visitEnd)))) +;; =init-method (doto (.visitMethod =class Opcodes/ACC_PUBLIC init-method "(I)V" nil nil) +;; (.visitCode) +;; (.visitVarInsn Opcodes/ALOAD 0) +;; (.visitMethodInsn Opcodes/INVOKESPECIAL super-class init-method "()V") +;; (.visitVarInsn Opcodes/ALOAD 0) +;; (.visitVarInsn Opcodes/ILOAD 1) +;; (.visitFieldInsn Opcodes/PUTFIELD &&/function-class &&/partials-field "I") +;; (.visitInsn Opcodes/RETURN) +;; (.visitMaxs 0 0) +;; (.visitEnd)) +;; _ (dotimes [arity* &&/num-apply-variants] +;; (let [arity (inc arity*)] +;; (if (= 1 arity) +;; (doto (.visitMethod =class (+ Opcodes/ACC_PUBLIC Opcodes/ACC_ABSTRACT) &&/apply-method (&&/apply-signature arity) nil nil) +;; (.visitEnd)) +;; (doto (.visitMethod =class Opcodes/ACC_PUBLIC &&/apply-method (&&/apply-signature arity) nil nil) +;; (.visitCode) +;; (-> (.visitVarInsn Opcodes/ALOAD idx) +;; (->> (dotimes [idx arity]))) +;; (.visitMethodInsn Opcodes/INVOKEVIRTUAL &&/function-class &&/apply-method (&&/apply-signature (dec arity))) +;; (.visitTypeInsn Opcodes/CHECKCAST &&/function-class) +;; (.visitVarInsn Opcodes/ALOAD arity) +;; (.visitMethodInsn Opcodes/INVOKEVIRTUAL &&/function-class &&/apply-method (&&/apply-signature 1)) +;; (.visitInsn Opcodes/ARETURN) +;; (.visitMaxs 0 0) +;; (.visitEnd)))))]] +;; (&&/save-class! (-> &&/function-class (string/split #"/") (nth 2)) +;; (.toByteArray (doto =class .visitEnd))))) (defmacro <bytecode> [& instructions] `(fn [^MethodVisitor writer#] @@ -78,7 +78,7 @@ ~@instructions))) ;; Runtime infrastructure -(defn ^:private compile-LuxRT-adt-methods [^ClassWriter =class] +(defn ^:private compile-Runtime-adt-methods [^ClassWriter =class] (|let [lefts #(doto ^MethodVisitor % (.visitVarInsn Opcodes/ILOAD 1)) tuple-size #(doto ^MethodVisitor % @@ -178,7 +178,7 @@ super-nested (<bytecode> super-nested-lefts ;; super-lefts !variant <>right? ;; super-lefts, super-right? !variant <>value ;; super-lefts, super-right?, super-value - (.visitMethodInsn Opcodes/INVOKESTATIC rt-class "sum_make" "(ILjava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;")) + (.visitMethodInsn Opcodes/INVOKESTATIC runtime-class "sum_make" "(ILjava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;")) update-!variant (<bytecode> !variant <>value (.visitTypeInsn Opcodes/CHECKCAST "[Ljava/lang/Object;") @@ -271,18 +271,18 @@ (.visitVarInsn Opcodes/ALOAD 0) (.visitMethodInsn Opcodes/INVOKESTATIC <class> <parse-method> <signature>) <wrapper> - (.visitMethodInsn Opcodes/INVOKESTATIC rt-class "make_some" "(Ljava/lang/Object;)[Ljava/lang/Object;") + (.visitMethodInsn Opcodes/INVOKESTATIC runtime-class "make_some" "(Ljava/lang/Object;)[Ljava/lang/Object;") (.visitInsn Opcodes/ARETURN) (.visitLabel $to) (.visitLabel $handler) - (.visitMethodInsn Opcodes/INVOKESTATIC rt-class "make_none" "()[Ljava/lang/Object;") + (.visitMethodInsn Opcodes/INVOKESTATIC runtime-class "make_none" "()[Ljava/lang/Object;") (.visitInsn Opcodes/ARETURN) (.visitMaxs 0 0) (.visitEnd))) nil)) - ^:private compile-LuxRT-int-methods "decode_int" "java/lang/Long" "parseLong" "(Ljava/lang/String;)J" &&/wrap-long - ^:private compile-LuxRT-frac-methods "decode_frac" "java/lang/Double" "parseDouble" "(Ljava/lang/String;)D" &&/wrap-double + ^:private compile-Runtime-int-methods "decode_int" "java/lang/Long" "parseLong" "(Ljava/lang/String;)J" &&/wrap-long + ^:private compile-Runtime-frac-methods "decode_frac" "java/lang/Double" "parseDouble" "(Ljava/lang/String;)D" &&/wrap-double ) (defn peekI [^MethodVisitor writer] @@ -296,7 +296,7 @@ (.visitInsn Opcodes/AALOAD) (.visitTypeInsn Opcodes/CHECKCAST "[Ljava/lang/Object;"))) -(defn ^:private compile-LuxRT-pm-methods [^ClassWriter =class] +(defn ^:private compile-Runtime-pm-methods [^ClassWriter =class] (|let [_ (doto (.visitMethod =class (+ Opcodes/ACC_PUBLIC Opcodes/ACC_STATIC) "pm_fail" "()V" nil nil) (.visitCode) (.visitTypeInsn Opcodes/NEW "java/lang/IllegalStateException") @@ -323,7 +323,7 @@ (.visitEnd))] nil)) -(def compile-LuxRT-class +(def compile-Runtime-class (|do [_ (return nil) :let [full-name &&/lux-utils-class super-class (&host-generics/->bytecode-class-name "java.lang.Object") @@ -357,7 +357,7 @@ (.visitLdcInsn (->> #'&/$None meta ::&/lefts int)) ;; I (.visitInsn Opcodes/ACONST_NULL) ;; I? (.visitLdcInsn &/unit-tag) ;; I?U - (.visitMethodInsn Opcodes/INVOKESTATIC rt-class "sum_make" "(ILjava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;") + (.visitMethodInsn Opcodes/INVOKESTATIC runtime-class "sum_make" "(ILjava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;") (.visitInsn Opcodes/ARETURN) (.visitMaxs 0 0) (.visitEnd)) @@ -366,7 +366,7 @@ (.visitLdcInsn (->> #'&/$Some meta ::&/lefts int)) ;; I (.visitLdcInsn "") ;; I? (.visitVarInsn Opcodes/ALOAD 0) ;; I?O - (.visitMethodInsn Opcodes/INVOKESTATIC rt-class "sum_make" "(ILjava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;") + (.visitMethodInsn Opcodes/INVOKESTATIC runtime-class "sum_make" "(ILjava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;") (.visitInsn Opcodes/ARETURN) (.visitMaxs 0 0) (.visitEnd)) @@ -406,7 +406,7 @@ (.visitVarInsn Opcodes/ALOAD 0) (.visitInsn Opcodes/ACONST_NULL) (.visitMethodInsn Opcodes/INVOKEVIRTUAL function-class &&/apply-method (&&/apply-signature 1)) - (.visitMethodInsn Opcodes/INVOKESTATIC rt-class "make_some" "(Ljava/lang/Object;)[Ljava/lang/Object;") + (.visitMethodInsn Opcodes/INVOKESTATIC runtime-class "make_some" "(Ljava/lang/Object;)[Ljava/lang/Object;") (.visitInsn Opcodes/ARETURN) (.visitLabel $to) (.visitLabel $handler) ;; T @@ -419,14 +419,14 @@ (.visitLdcInsn (->> #'&/$Left meta ::&/lefts int)) ;; SI (.visitInsn Opcodes/ACONST_NULL) ;; SI? swap2x1 ;; I?S - (.visitMethodInsn Opcodes/INVOKESTATIC rt-class "sum_make" "(ILjava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;") + (.visitMethodInsn Opcodes/INVOKESTATIC runtime-class "sum_make" "(ILjava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;") (.visitInsn Opcodes/ARETURN) (.visitMaxs 0 0) (.visitEnd))) _ (doto =class - (compile-LuxRT-pm-methods) - (compile-LuxRT-adt-methods) - (compile-LuxRT-int-methods) - (compile-LuxRT-frac-methods))]] + (compile-Runtime-pm-methods) + (compile-Runtime-adt-methods) + (compile-Runtime-int-methods) + (compile-Runtime-frac-methods))]] (&&/save-class! (-> &&/lux-utils-class (string/split #"/") (nth 2)) (.toByteArray (doto =class .visitEnd))))) diff --git a/lux-bootstrapper/src/lux/host.clj b/lux-bootstrapper/src/lux/host.clj index 4d49a6262..00763ade3 100644 --- a/lux-bootstrapper/src/lux/host.clj +++ b/lux-bootstrapper/src/lux/host.clj @@ -26,11 +26,14 @@ (defn ^String internal [^String external] (.replace external class-name-separator class-separator)) +(defn ^String fundamental-class [^String name] + (str (external &/prelude) class-name-separator name)) + (def ^:const ^String function-class - (str (external &/prelude) class-name-separator "Function")) + (fundamental-class "Function")) (def ^:const ^String lux-utils-class - (str (external &/prelude) class-name-separator "LuxRT")) + (fundamental-class "Runtime")) ;; [Resources] (defn ^String ->module-class [old] |