diff options
Diffstat (limited to 'stdlib/source/lux/target/jvm/attribute/code.lux')
-rw-r--r-- | stdlib/source/lux/target/jvm/attribute/code.lux | 82 |
1 files changed, 0 insertions, 82 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)) - )) |