diff options
Diffstat (limited to 'stdlib/source')
-rw-r--r-- | stdlib/source/lux/target/jvm/bytecode.lux | 12 | ||||
-rw-r--r-- | stdlib/source/test/lux/target/jvm.lux | 12 |
2 files changed, 10 insertions, 14 deletions
diff --git a/stdlib/source/lux/target/jvm/bytecode.lux b/stdlib/source/lux/target/jvm/bytecode.lux index 3adfabe67..cb0df3383 100644 --- a/stdlib/source/lux/target/jvm/bytecode.lux +++ b/stdlib/source/lux/target/jvm/bytecode.lux @@ -753,13 +753,13 @@ ## else 1)) -(template [<static?> <name> <instruction>] +(template [<static?> <name> <instruction> <method>] [(def: #export (<name> class method type) (-> (Type Class) Text (Type Method) (Bytecode Any)) (let [[inputs output exceptions] (parser.method type)] (do ..monad [index (<| ..lift - (//constant/pool.method (..reflection class)) + (<method> (..reflection class)) {#//constant/pool.name method #//constant/pool.descriptor (type.descriptor type)}) #let [consumption (|> inputs @@ -773,10 +773,10 @@ @_ <instruction> [index consumption production]))))] - [#1 invokestatic _.invokestatic] - [#0 invokevirtual _.invokevirtual] - [#0 invokespecial _.invokespecial] - [#0 invokeinterface _.invokeinterface] + [#1 invokestatic _.invokestatic //constant/pool.method] + [#0 invokevirtual _.invokevirtual //constant/pool.method] + [#0 invokespecial _.invokespecial //constant/pool.method] + [#0 invokeinterface _.invokeinterface //constant/pool.interface-method] ) (template [<consumption> <name> <1> <2>] diff --git a/stdlib/source/test/lux/target/jvm.lux b/stdlib/source/test/lux/target/jvm.lux index 13be558e5..1ab7ed5ab 100644 --- a/stdlib/source/test/lux/target/jvm.lux +++ b/stdlib/source/test/lux/target/jvm.lux @@ -739,16 +739,12 @@ (/.invokespecial ..$Double "<init>" (/type.method [(list /type.double) /type.void (list)])))) (<| (_.lift "INVOKEINTERFACE") (do random.monad - [parameter ..$Double::random - subject ..$Double::random]) + [subject ..$String::random]) (..bytecode (|>> (:coerce java/lang/Long) - ("jvm leq" (java/lang/Double::compare parameter subject)))) + ("jvm leq" (text.size subject)))) (do /.monad - [_ (/.double subject) _ ..$Double::wrap - _ (/.double parameter) _ ..$Double::wrap - _ (/.invokeinterface (/type.class "java.lang.Comparable" (list)) - "compareTo" - (/type.method [(list ..$Object) /type.int (list)])) + [_ (/.string subject) + _ (/.invokeinterface (/type.class "java.lang.CharSequence" (list)) "length" (/type.method [(list) /type.int (list)])) _ /.i2l] ..$Long::wrap)) ))) |