diff options
Diffstat (limited to 'stdlib/source/lux/target/jvm/attribute')
-rw-r--r-- | stdlib/source/lux/target/jvm/attribute/code.lux | 82 | ||||
-rw-r--r-- | stdlib/source/lux/target/jvm/attribute/code/exception.lux | 57 | ||||
-rw-r--r-- | stdlib/source/lux/target/jvm/attribute/constant.lux | 26 |
3 files changed, 0 insertions, 165 deletions
diff --git a/stdlib/source/lux/target/jvm/attribute/code.lux b/stdlib/source/lux/target/jvm/attribute/code.lux deleted file mode 100644 index 212d44765..000000000 --- a/stdlib/source/lux/target/jvm/attribute/code.lux +++ /dev/null @@ -1,82 +0,0 @@ -(.module: - [lux (#- Code) - [type (#+ :share)] - [abstract - [equivalence (#+ Equivalence)]] - [data - ["." product] - ["." binary (#+ Binary)] - [format - [".F" binary (#+ Writer) ("#\." monoid)]] - [collection - ["." row (#+ Row) ("#\." functor fold)]]] - [math - [number - ["n" nat]]]] - ["." /// #_ - [bytecode - [environment - ["#." limit (#+ Limit)]]] - [encoding - ["#." unsigned (#+ U2)]]] - ["." / #_ - ["#." exception (#+ Exception)]]) - -(type: #export (Code Attribute) - {#limit Limit - #code Binary - #exception_table (Row Exception) - #attributes (Row Attribute)}) - -(def: #export (length length code) - (All [Attribute] (-> (-> Attribute Nat) (Code Attribute) Nat)) - ($_ n.+ - ## u2 max_stack; - ## u2 max_locals; - ///limit.length - ## u4 code_length; - ///unsigned.bytes/4 - ## u1 code[code_length]; - (binary.size (get@ #code code)) - ## u2 exception_table_length; - ///unsigned.bytes/2 - ## exception_table[exception_table_length]; - (|> code - (get@ #exception_table) - row.size - (n.* /exception.length)) - ## u2 attributes_count; - ///unsigned.bytes/2 - ## attribute_info attributes[attributes_count]; - (|> code - (get@ #attributes) - (row\map length) - (row\fold n.+ 0)))) - -(def: #export (equivalence attribute_equivalence) - (All [attribute] - (-> (Equivalence attribute) (Equivalence (Code attribute)))) - ($_ product.equivalence - ///limit.equivalence - binary.equivalence - (row.equivalence /exception.equivalence) - (row.equivalence attribute_equivalence) - )) - -## https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.3 -(def: #export (writer writer code) - (All [Attribute] (-> (Writer Attribute) (Writer (Code Attribute)))) - ($_ binaryF\compose - ## u2 max_stack; - ## u2 max_locals; - (///limit.writer (get@ #limit code)) - ## u4 code_length; - ## u1 code[code_length]; - (binaryF.binary/32 (get@ #code code)) - ## u2 exception_table_length; - ## exception_table[exception_table_length]; - ((binaryF.row/16 /exception.writer) (get@ #exception_table code)) - ## u2 attributes_count; - ## attribute_info attributes[attributes_count]; - ((binaryF.row/16 writer) (get@ #attributes code)) - )) diff --git a/stdlib/source/lux/target/jvm/attribute/code/exception.lux b/stdlib/source/lux/target/jvm/attribute/code/exception.lux deleted file mode 100644 index 9ae264438..000000000 --- a/stdlib/source/lux/target/jvm/attribute/code/exception.lux +++ /dev/null @@ -1,57 +0,0 @@ -(.module: - [lux #* - [abstract - [equivalence (#+ Equivalence)]] - [data - ["." product] - ["." format #_ - ["#" binary (#+ Writer)]]] - [math - [number - ["n" nat]]]] - ["." // #_ - ["//#" /// #_ - [constant (#+ Class)] - ["#." index (#+ Index)] - [bytecode - ["#." address (#+ Address)]] - [encoding - ["#." unsigned (#+ U2)]]]]) - -(type: #export Exception - {#start Address - #end Address - #handler Address - #catch (Index Class)}) - -(def: #export equivalence - (Equivalence Exception) - ($_ product.equivalence - ////address.equivalence - ////address.equivalence - ////address.equivalence - ////index.equivalence - )) - -## https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.3 -(def: #export length - Nat - ($_ n.+ - ## u2 start_pc; - ////unsigned.bytes/2 - ## u2 end_pc; - ////unsigned.bytes/2 - ## u2 handler_pc; - ////unsigned.bytes/2 - ## u2 catch_type; - ////unsigned.bytes/2 - )) - -(def: #export writer - (Writer Exception) - ($_ format.and - ////address.writer - ////address.writer - ////address.writer - ////index.writer - )) diff --git a/stdlib/source/lux/target/jvm/attribute/constant.lux b/stdlib/source/lux/target/jvm/attribute/constant.lux deleted file mode 100644 index c5605bcc3..000000000 --- a/stdlib/source/lux/target/jvm/attribute/constant.lux +++ /dev/null @@ -1,26 +0,0 @@ -(.module: - [lux #* - [abstract - [equivalence (#+ Equivalence)]] - [data - [format - [binary (#+ Writer)]]]] - ["." /// #_ - [constant (#+ Value)] - ["#." index (#+ Index)] - [encoding - ["#." unsigned (#+ U2 U4)]]]) - -(type: #export (Constant a) - (Index (Value a))) - -(def: #export equivalence - (All [a] (Equivalence (Constant a))) - ///index.equivalence) - -(def: #export length - ///index.length) - -(def: #export writer - (All [a] (Writer (Constant a))) - ///index.writer) |