diff options
Diffstat (limited to '')
-rw-r--r-- | lux-jvm/source/luxc/lang/host/jvm.lux | 14 | ||||
-rw-r--r-- | lux-jvm/source/luxc/lang/host/jvm/def.lux | 22 | ||||
-rw-r--r-- | lux-jvm/source/luxc/lang/host/jvm/inst.lux | 86 |
3 files changed, 61 insertions, 61 deletions
diff --git a/lux-jvm/source/luxc/lang/host/jvm.lux b/lux-jvm/source/luxc/lang/host/jvm.lux index c2a2a6f41..a50090c5d 100644 --- a/lux-jvm/source/luxc/lang/host/jvm.lux +++ b/lux-jvm/source/luxc/lang/host/jvm.lux @@ -1,11 +1,11 @@ (.module: [lux (#- Definition Type) - [host (#+ import:)] + [ffi (#+ import:)] [abstract monad] [control - ["p" parser - ["s" code]]] + ["<>" parser + ["<.>" code]]] [data [binary (#+ Binary)] [collection @@ -84,10 +84,10 @@ (type: #export (Generator i) (-> Phase Archive i (Operation Inst))) -(syntax: (config: {type s.local_identifier} - {none s.local_identifier} - {++ s.local_identifier} - {options (s.tuple (p.many s.local_identifier))}) +(syntax: (config: {type <code>.local_identifier} + {none <code>.local_identifier} + {++ <code>.local_identifier} + {options (<code>.tuple (<>.many <code>.local_identifier))}) (let [g!type (code.local_identifier type) g!none (code.local_identifier none) g!tags+ (list/map code.local_tag options) diff --git a/lux-jvm/source/luxc/lang/host/jvm/def.lux b/lux-jvm/source/luxc/lang/host/jvm/def.lux index 212d9d854..b2012006a 100644 --- a/lux-jvm/source/luxc/lang/host/jvm/def.lux +++ b/lux-jvm/source/luxc/lang/host/jvm/def.lux @@ -1,6 +1,6 @@ (.module: [lux (#- Type) - ["." host (#+ import: do_to)] + ["." ffi (#+ import: do_to)] [control ["." function]] [data @@ -80,9 +80,9 @@ (def: (string_array values) (-> (List Text) (Array Text)) - (let [output (host.array java/lang/String (list.size values))] + (let [output (ffi.array java/lang/String (list.size values))] (exec (list@map (function (_ [idx value]) - (host.array_write idx value output)) + (ffi.array_write idx value output)) (list.enumeration values)) output))) @@ -168,7 +168,7 @@ [(def: #export (<name> version visibility config name constraints super interfaces definitions) (-> //.Version //.Visibility //.Class_Config Text (List Constraint) (Type Class) (List (Type Class)) //.Def - (host.type [byte])) + (ffi.type [byte])) (let [writer (|> (do_to (org/objectweb/asm/ClassWriter::new class_computes) (org/objectweb/asm/ClassWriter::visit (version_flag version) ($_ i.+ @@ -197,7 +197,7 @@ (def: #export (interface version visibility config name constraints interfaces definitions) (-> //.Version //.Visibility //.Class_Config Text (List Constraint) (List (Type Class)) //.Def - (host.type [byte])) + (ffi.type [byte])) (let [writer (|> (do_to (org/objectweb/asm/ClassWriter::new class_computes) (org/objectweb/asm/ClassWriter::visit (version_flag version) ($_ i.+ @@ -258,7 +258,7 @@ (..binary_name name) (..descriptor type) (..signature type) - (host.null) + (ffi.null) writer) (org/objectweb/asm/FieldVisitor::visitEnd))] writer))) @@ -279,13 +279,13 @@ writer)))] [boolean_field Bit type.boolean function.identity] - [byte_field Int type.byte host.long_to_byte] - [short_field Int type.short host.long_to_short] - [int_field Int type.int host.long_to_int] + [byte_field Int type.byte ffi.long_to_byte] + [short_field Int type.short ffi.long_to_short] + [int_field Int type.int ffi.long_to_int] [long_field Int type.long function.identity] - [float_field Frac type.float host.double_to_float] + [float_field Frac type.float ffi.double_to_float] [double_field Frac type.double function.identity] - [char_field Nat type.char (|>> .int host.long_to_int host.int_to_char)] + [char_field Nat type.char (|>> .int ffi.long_to_int ffi.int_to_char)] [string_field Text (type.class "java.lang.String" (list)) function.identity] ) diff --git a/lux-jvm/source/luxc/lang/host/jvm/inst.lux b/lux-jvm/source/luxc/lang/host/jvm/inst.lux index 1f9e93c71..efc4a0d0c 100644 --- a/lux-jvm/source/luxc/lang/host/jvm/inst.lux +++ b/lux-jvm/source/luxc/lang/host/jvm/inst.lux @@ -1,6 +1,6 @@ (.module: [lux (#- Type int char) - ["." host (#+ import: do_to)] + ["." ffi (#+ import: do_to)] [abstract [monad (#+ do)]] [control @@ -162,13 +162,13 @@ (-> <type> Inst) (function (_ visitor) (do_to visitor - (org/objectweb/asm/MethodVisitor::visitLdcInsn (<prepare> value)))))] + (org/objectweb/asm/MethodVisitor::visitLdcInsn (<prepare> value)))))] [boolean Bit function.identity] - [int Int host.long_to_int] + [int Int ffi.long_to_int] [long Int function.identity] [double Frac function.identity] - [char Nat (|>> .int host.long_to_int host.int_to_char)] + [char Nat (|>> .int ffi.long_to_int ffi.int_to_char)] [string Text function.identity] ) @@ -180,7 +180,7 @@ Inst (function (_ visitor) (do_to visitor - (org/objectweb/asm/MethodVisitor::visitInsn (!prefix <constant>)))))] + (org/objectweb/asm/MethodVisitor::visitInsn (!prefix <constant>)))))] [ICONST_M1] [ICONST_0] [ICONST_1] [ICONST_2] [ICONST_3] [ICONST_4] [ICONST_5] [LCONST_0] [LCONST_1] @@ -192,14 +192,14 @@ Inst (function (_ visitor) (do_to visitor - (org/objectweb/asm/MethodVisitor::visitInsn (!prefix ACONST_NULL))))) + (org/objectweb/asm/MethodVisitor::visitInsn (!prefix ACONST_NULL))))) (template [<constant>] [(def: #export (<constant> constant) (-> Int Inst) (function (_ visitor) (do_to visitor - (org/objectweb/asm/MethodVisitor::visitIntInsn (!prefix <constant>) constant))))] + (org/objectweb/asm/MethodVisitor::visitIntInsn (!prefix <constant>) constant))))] [BIPUSH] [SIPUSH] @@ -210,7 +210,7 @@ Inst (function (_ visitor) (do_to visitor - (org/objectweb/asm/MethodVisitor::visitInsn (!prefix <name>)))))] + (org/objectweb/asm/MethodVisitor::visitInsn (!prefix <name>)))))] [NOP] @@ -273,7 +273,7 @@ (-> Register Inst) (function (_ visitor) (do_to visitor - (org/objectweb/asm/MethodVisitor::visitVarInsn (!prefix <name>) (.int register)))))] + (org/objectweb/asm/MethodVisitor::visitVarInsn (!prefix <name>) (.int register)))))] [IINC] [ILOAD] [LLOAD] [FLOAD] [DLOAD] [ALOAD] @@ -285,7 +285,7 @@ (-> (Type Class) Text (Type Value) Inst) (function (_ visitor) (do_to visitor - (org/objectweb/asm/MethodVisitor::visitFieldInsn (<inst>) (..class_name class) field (..descriptor type)))))] + (org/objectweb/asm/MethodVisitor::visitFieldInsn (<inst>) (..class_name class) field (..descriptor type)))))] [GETSTATIC org/objectweb/asm/Opcodes::GETSTATIC] [PUTSTATIC org/objectweb/asm/Opcodes::PUTSTATIC] @@ -300,7 +300,7 @@ (-> (Type <category>) Inst) (function (_ visitor) (do_to visitor - (org/objectweb/asm/MethodVisitor::visitTypeInsn (<inst>) (..class_name class)))))] + (org/objectweb/asm/MethodVisitor::visitTypeInsn (<inst>) (..class_name class)))))] (~~ (template.splice <instructions>+))))] @@ -317,31 +317,31 @@ (-> (Type Primitive) Inst) (function (_ visitor) (do_to visitor - (org/objectweb/asm/MethodVisitor::visitIntInsn (org/objectweb/asm/Opcodes::NEWARRAY) - (`` (cond (~~ (template [<descriptor> <opcode>] - [(type@= <descriptor> type) (<opcode>)] - - [type.boolean org/objectweb/asm/Opcodes::T_BOOLEAN] - [type.byte org/objectweb/asm/Opcodes::T_BYTE] - [type.short org/objectweb/asm/Opcodes::T_SHORT] - [type.int org/objectweb/asm/Opcodes::T_INT] - [type.long org/objectweb/asm/Opcodes::T_LONG] - [type.float org/objectweb/asm/Opcodes::T_FLOAT] - [type.double org/objectweb/asm/Opcodes::T_DOUBLE] - [type.char org/objectweb/asm/Opcodes::T_CHAR])) - ## else - (undefined))))))) + (org/objectweb/asm/MethodVisitor::visitIntInsn (org/objectweb/asm/Opcodes::NEWARRAY) + (`` (cond (~~ (template [<descriptor> <opcode>] + [(type@= <descriptor> type) (<opcode>)] + + [type.boolean org/objectweb/asm/Opcodes::T_BOOLEAN] + [type.byte org/objectweb/asm/Opcodes::T_BYTE] + [type.short org/objectweb/asm/Opcodes::T_SHORT] + [type.int org/objectweb/asm/Opcodes::T_INT] + [type.long org/objectweb/asm/Opcodes::T_LONG] + [type.float org/objectweb/asm/Opcodes::T_FLOAT] + [type.double org/objectweb/asm/Opcodes::T_DOUBLE] + [type.char org/objectweb/asm/Opcodes::T_CHAR])) + ## else + (undefined))))))) (template [<name> <inst> <interface?>] [(def: #export (<name> class method_name method) (-> (Type Class) Text (Type Method) Inst) (function (_ visitor) (do_to visitor - (org/objectweb/asm/MethodVisitor::visitMethodInsn (<inst>) - (..class_name class) - method_name - (|> method type.descriptor descriptor.descriptor) - <interface?>))))] + (org/objectweb/asm/MethodVisitor::visitMethodInsn (<inst>) + (..class_name class) + method_name + (|> method type.descriptor descriptor.descriptor) + <interface?>))))] [INVOKESTATIC org/objectweb/asm/Opcodes::INVOKESTATIC false] [INVOKEVIRTUAL org/objectweb/asm/Opcodes::INVOKEVIRTUAL false] @@ -354,7 +354,7 @@ (-> //.Label Inst) (function (_ visitor) (do_to visitor - (org/objectweb/asm/MethodVisitor::visitJumpInsn (!prefix <name>) @where))))] + (org/objectweb/asm/MethodVisitor::visitJumpInsn (!prefix <name>) @where))))] [IF_ICMPEQ] [IF_ICMPGT] [IF_ICMPLT] [IF_ICMPNE] [IF_ICMPGE] [IF_ICMPLE] @@ -370,45 +370,45 @@ (i.< (product.left left) (product.left right))) keys+labels) array_size (list.size keys+labels) - keys_array (host.array int array_size) - labels_array (host.array org/objectweb/asm/Label array_size) + keys_array (ffi.array int array_size) + labels_array (ffi.array org/objectweb/asm/Label array_size) _ (loop [idx 0] (if (n.< array_size idx) (let [[key label] (maybe.assume (list.nth idx keys+labels))] (exec - (host.array_write idx (host.long_to_int key) keys_array) - (host.array_write idx label labels_array) + (ffi.array_write idx (ffi.long_to_int key) keys_array) + (ffi.array_write idx label labels_array) (recur (inc idx)))) []))] (do_to visitor - (org/objectweb/asm/MethodVisitor::visitLookupSwitchInsn default keys_array labels_array))))) + (org/objectweb/asm/MethodVisitor::visitLookupSwitchInsn default keys_array labels_array))))) (def: #export (TABLESWITCH min max default labels) (-> Int Int //.Label (List //.Label) Inst) (function (_ visitor) (let [num_labels (list.size labels) - labels_array (host.array org/objectweb/asm/Label num_labels) + labels_array (ffi.array org/objectweb/asm/Label num_labels) _ (loop [idx 0] (if (n.< num_labels idx) - (exec (host.array_write idx - (maybe.assume (list.nth idx labels)) - labels_array) + (exec (ffi.array_write idx + (maybe.assume (list.nth idx labels)) + labels_array) (recur (inc idx))) []))] (do_to visitor - (org/objectweb/asm/MethodVisitor::visitTableSwitchInsn min max default labels_array))))) + (org/objectweb/asm/MethodVisitor::visitTableSwitchInsn min max default labels_array))))) (def: #export (try @from @to @handler exception) (-> //.Label //.Label //.Label (Type Class) Inst) (function (_ visitor) (do_to visitor - (org/objectweb/asm/MethodVisitor::visitTryCatchBlock @from @to @handler (..class_name exception))))) + (org/objectweb/asm/MethodVisitor::visitTryCatchBlock @from @to @handler (..class_name exception))))) (def: #export (label @label) (-> //.Label Inst) (function (_ visitor) (do_to visitor - (org/objectweb/asm/MethodVisitor::visitLabel @label)))) + (org/objectweb/asm/MethodVisitor::visitLabel @label)))) (def: #export (array elementT) (-> (Type Value) Inst) |