Questions tagged [invokedynamic]

For questions about the invokedynamic bytecode instruction of the Java virtual machine.

78 questions
1
vote
1 answer

Pool capturing lambdas

I grok that for capturing lambdas, there needs to be an object allocated (be it Object[] or some abc$Lambda$xyz type). Is it possible to customize this process anyhow? Let's say I have this code: private void test() { int x = 5; …
Radim Vansa
  • 5,686
  • 2
  • 25
  • 40
1
vote
1 answer

Generics information when using invokedynamic

I am creating a java framework to convert beans with the help of Invoke dynamic. I create the convert class with ASM. In order to generate a conversion which looks like: target.setter( convert(source.getter()) ); I write the following bytecode with…
SPee
  • 656
  • 4
  • 5
1
vote
1 answer

Optimizing Groovy Performance

I'm working on groovy code perfomance optimization. I've used jvisualvm to connect to running applicaton and gather CPU samples. Samples say that org.codehaus.groovy.reflection.CachedMethod.inkove takes the most CPU time. I don't see any other…
Capacytron
  • 3,425
  • 6
  • 47
  • 80
1
vote
1 answer

Does spring support invoke dynamic for groovy-backed beans?

Is it possible to configure Groovy beans declared with lang namespace or manually with GroovyScriptFactory in such a way, that they use invoke dynamic support? I have not…
Anton
  • 29
  • 6
1
vote
1 answer

MethodHandle InvokeExact parameter

I am confused by method parameters for method handles. I first build a guardwithtest method handle as shown below: public class App { public static void trueTarget(String str, String own, String t){ System.out.println("This is true…
shijie xu
  • 1,975
  • 21
  • 52
1
vote
1 answer

Howto use invokedynamic with Jasmin?

Here it says: Since 2.1 : [..] added the invokedynamic instruction Thus I suppose that it is possible to write instruction code containing invokedynamics with jasmin. However I could not find any documentation on the jasmin syntax and I just…
yankee
  • 38,872
  • 15
  • 103
  • 162
1
vote
1 answer

JRuby java.lang.ClassCastException

I used a little Jruby script from http://www.javaworld.com/javaworld/jw-07-2006/jw-0717-ruby.html to test invokedynamic: class ADuck def quack() puts "quack A"; end end class BDuck def quack() puts "quack B"; …
Thorben
  • 953
  • 13
  • 28
0
votes
2 answers

invokedynamic and its advantages to application developer

Recently, i was reading about Java 7 features and invokedynamic was one of the most anticipated one. Most of the blogs/articles provide the advantages from JVM implementation point of view, specially for dynamically typed languages. From an…
Chander Shivdasani
  • 9,878
  • 20
  • 76
  • 107
0
votes
1 answer

BootstrapMethodError(IllegalArgumentException: bad parameter count: 256) on lambda with 254 outside local variable references

External variable references from Java lambdas are given as constructor arguments. Java also allows up to 255 arguments to be given to a method. For example, compiling this code: public class Main { public static void main(String[] args) throws…
Peyang
  • 77
  • 8
0
votes
0 answers

instrument a java lambda using ASM

I'm adding support for instrumenting invokedynamic in a concolic engine and the way we currently instrument is by using a custom classloader that finds the resource related to that class in the class path but as the lambda is a synthetic class…
0
votes
0 answers

Does JavaAssist has something like visitInvokeDynamicInsn in ASM

I want to add some code into all my project files with JavaAssist. And i will use the params of each method. But I found when using lambda,it generated a new method in class and the params of original method will be changed finally. So Does…
0
votes
0 answers

ScriptEngineManager.getEngineByName("nashorn") fails because of java.lang.invoke.WrongMethodTypeException

I am unable to create ScriptEngine for nashorn in Java 8 (IBM J9JVM). In the following code, the engine is null. private static void runOther(String[] args){ ScriptEngineManager engineManager = new ScriptEngineManager(); ScriptEngine engine…
shijie xu
  • 1,975
  • 21
  • 52
0
votes
0 answers

java.lang.NoClassDefFoundError: jdk.nashorn.internal.scripts.JO28P0

I finished a library for Java and I used it to replace java.lang.invoke package (i.e., add it to the boot class loader prior to normal JVM library). In the package, it dynamically generates bytecodes for method handles. Thanks if you have any…
shijie xu
  • 1,975
  • 21
  • 52
0
votes
1 answer

jrubyc fails with invokedynamic parameters in linux

I did everything well in window, but fail in linux. What i want to do is to compile ruby script to java bytecode with -Xcompile.invokedynamic=true parameters: [sxu3@** rubyscript]$ jrubyc -Xcompile.invokedynamic=true hello.rb …
shijie xu
  • 1,975
  • 21
  • 52
0
votes
2 answers

How to use invokedynamic to execute method with polymorphism?

In a dynamic language for Java where all variables are declared as java.lang.Object, I need to call Java built-in classes. For example, java.math.BigDecimal constructor can accept number, String and etc. a = 10 // a is `java.lang.Object` create…
David Bower
  • 121
  • 2
  • 10