aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/target/jvm/bytecode/environment/limit/registry.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/lux/target/jvm/bytecode/environment/limit/registry.lux')
-rw-r--r--stdlib/source/lux/target/jvm/bytecode/environment/limit/registry.lux47
1 files changed, 38 insertions, 9 deletions
diff --git a/stdlib/source/lux/target/jvm/bytecode/environment/limit/registry.lux b/stdlib/source/lux/target/jvm/bytecode/environment/limit/registry.lux
index eb3820bfb..3a8bd4482 100644
--- a/stdlib/source/lux/target/jvm/bytecode/environment/limit/registry.lux
+++ b/stdlib/source/lux/target/jvm/bytecode/environment/limit/registry.lux
@@ -1,20 +1,30 @@
(.module:
- [lux (#- for)
+ [lux (#- Type for static)
[abstract
["." equivalence (#+ Equivalence)]]
[control
- ["." try]]
+ ["." try (#+ Try) ("#@." functor)]]
[data
+ [number
+ ["n" nat]]
[format
- [binary (#+ Writer)]]]
+ [binary (#+ Writer)]]
+ [collection
+ ["." list ("#@." functor fold)]]]
[type
abstract]]
["." ///// #_
[encoding
- ["#." unsigned (#+ U1 U2)]]])
+ ["#." unsigned (#+ U1 U2)]]
+ ["#." type (#+ Type)
+ [category (#+ Method)]
+ ["#/." parser]]])
(type: #export Register U1)
+(def: normal 1)
+(def: wide 2)
+
(abstract: #export Registry
{}
@@ -24,9 +34,28 @@
(-> U2 Registry)
(|>> :abstraction))
- (def: #export empty
- Registry
- (|> 0 /////unsigned.u2 try.assume :abstraction))
+ (def: (minimal type)
+ (-> (Type Method) Nat)
+ (let [[inputs output exceptions] (/////type/parser.method type)]
+ (|> inputs
+ (list@map (function (_ input)
+ (if (or (is? /////type.long input)
+ (is? /////type.double input))
+ ..wide
+ ..normal)))
+ (list@fold n.+ 0))))
+
+ (template [<start> <name>]
+ [(def: #export <name>
+ (-> (Type Method) (Try Registry))
+ (|>> ..minimal
+ (n.+ <start>)
+ /////unsigned.u2
+ (try@map ..registry)))]
+
+ [0 static]
+ [1 virtual]
+ )
(def: #export equivalence
(Equivalence Registry)
@@ -53,8 +82,8 @@
try.assume
:abstraction)))]
- [for 1]
- [for-wide 2]
+ [for ..normal]
+ [for-wide ..wide]
)
)