diff options
Diffstat (limited to 'stdlib/source/lux/target')
-rw-r--r-- | stdlib/source/lux/target/jvm/attribute.lux | 20 | ||||
-rw-r--r-- | stdlib/source/lux/target/jvm/attribute/constant.lux | 8 | ||||
-rw-r--r-- | stdlib/source/lux/target/jvm/bytecode.lux | 22 |
3 files changed, 24 insertions, 26 deletions
diff --git a/stdlib/source/lux/target/jvm/attribute.lux b/stdlib/source/lux/target/jvm/attribute.lux index 5f8892631..083ebaa15 100644 --- a/stdlib/source/lux/target/jvm/attribute.lux +++ b/stdlib/source/lux/target/jvm/attribute.lux @@ -49,7 +49,7 @@ (with-expansions [<Code> (as-is (/code.Code Attribute))] (type: #export #rec Attribute - (#Constant (Info Constant)) + (#Constant (Info (Constant Any))) (#Code (Info <Code>))) (type: #export Code @@ -64,7 +64,7 @@ (info-equivalence /constant.equivalence) (info-equivalence (/code.equivalence equivalence)))))) -(def: fixed-attribute-length +(def: common-attribute-length ($_ n.+ ## u2 attribute_name_index; //unsigned.bytes/2 @@ -77,25 +77,23 @@ (case attribute (^template [<tag>] (<tag> [name length info]) - (|> length //unsigned.value (n.+ fixed-attribute-length))) + (|> length //unsigned.value (n.+ ..common-attribute-length))) ([#Constant] [#Code]))) -(def: constant-name "ConstantValue") - +## TODO: Inline ASAP (def: (constant' @name index) - (-> (Index UTF8) Constant Attribute) + (-> (Index UTF8) (Constant Any) Attribute) (#Constant {#name @name #length (|> /constant.length //unsigned.u4 try.assume) #info index})) (def: #export (constant index) - (-> Constant (Resource Attribute)) + (-> (Constant Any) (Resource Attribute)) (do //constant/pool.monad - [@name (//constant/pool.utf8 ..constant-name)] + [@name (//constant/pool.utf8 "ConstantValue")] (wrap (constant' @name index)))) -(def: code-name "Code") - +## TODO: Inline ASAP (def: (code' @name specification) (-> (Index UTF8) Code Attribute) (#Code {#name @name @@ -109,7 +107,7 @@ (def: #export (code specification) (-> Code (Resource Attribute)) (do //constant/pool.monad - [@name (//constant/pool.utf8 ..code-name)] + [@name (//constant/pool.utf8 "Code")] (wrap (code' @name specification)))) (def: #export (writer value) diff --git a/stdlib/source/lux/target/jvm/attribute/constant.lux b/stdlib/source/lux/target/jvm/attribute/constant.lux index 0206ed26e..c5605bcc3 100644 --- a/stdlib/source/lux/target/jvm/attribute/constant.lux +++ b/stdlib/source/lux/target/jvm/attribute/constant.lux @@ -11,16 +11,16 @@ [encoding ["#." unsigned (#+ U2 U4)]]]) -(type: #export Constant - (Index Value)) +(type: #export (Constant a) + (Index (Value a))) (def: #export equivalence - (Equivalence Constant) + (All [a] (Equivalence (Constant a))) ///index.equivalence) (def: #export length ///index.length) (def: #export writer - (Writer Constant) + (All [a] (Writer (Constant a))) ///index.writer) diff --git a/stdlib/source/lux/target/jvm/bytecode.lux b/stdlib/source/lux/target/jvm/bytecode.lux index 5ad3d2204..a31b90195 100644 --- a/stdlib/source/lux/target/jvm/bytecode.lux +++ b/stdlib/source/lux/target/jvm/bytecode.lux @@ -219,17 +219,6 @@ [@4 5] ) -(def: discontinuity! - (Bytecode Any) - (function (_ [pool environment tracker]) - (do try.monad - [_ (/environment.stack environment)] - (#try.Success [[pool - (/environment.discontinue environment) - tracker] - [..relative-identity - []]])))) - (template [<name> <consumption> <production> <registry> <instruction>] [(def: #export <name> (Bytecode Any) @@ -414,6 +403,17 @@ [monitorexit $1 $0 @_ _.monitorexit] ) +(def: discontinuity! + (Bytecode Any) + (function (_ [pool environment tracker]) + (do try.monad + [_ (/environment.stack environment)] + (#try.Success [[pool + (/environment.discontinue environment) + tracker] + [..relative-identity + []]])))) + (template [<name> <consumption> <instruction>] [(def: #export <name> (Bytecode Any) |