For questions about the invokedynamic bytecode instruction of the Java virtual machine.
Questions tagged [invokedynamic]
78 questions
2
votes
1 answer
Why does the return type (force cast) play a critical rule in MethodHandler performance?
I am working on a simple project and need to retrieve a bean property. First I use reflection. Then I did some investigation on invokedynamic and Method Handler for better performance.
Although invokeExact is much faster than reflection, invoke is…

DeepNightTwo
- 4,809
- 8
- 46
- 60
2
votes
2 answers
How is stored the result of the invokedynamic?
Java 8 introduces support for first-class functions, which allows assigning functions to variables. In this case the variables must be of a function type, which is defined by a functional interface (an interface with just one abstract method).
So,…

Miguel Gamboa
- 8,855
- 7
- 47
- 94
2
votes
2 answers
When will invokedynamic be available in the standard JDK?
I'm eager to start working with dynamic languages on top of Java.
How long before this is part of the standard JDK?

coriolanus
- 401
- 1
- 5
- 7
2
votes
1 answer
How are bootstrap methods registered to the constant pool in Java?
I've been poking around invokedynamic and MethodHandles information recently.
It seems that BOTH Linkage.registerBootstrapMethod() and @BootstrapMethod are deprecated as means of marking bootstrap methods as such.
How are they registered to the…

Kristine Richard
- 53
- 5
2
votes
1 answer
Groovy invokedynamic performance
I had some unexpected benchmark results with the following snippet of Groovy Code:
class A{
def n(){
return 1
}
}
class B{
def n(){
return 2
}
}
class C{
def n(){
return 3
}
}
class D{
def n(){
…

Thorben
- 953
- 13
- 28
1
vote
1 answer
Upgrading groovy from 2.4 to 3.0 , why Intellij complains about could not resolve groovy-all-3.0.15-indy.jar?
I am upgrading a Spring MVC application from Java 1.8 to Java 17. I have tried to update the groovy version from 2.4.x to 3.0.15. If I run the clean build, either from IntelliJ terminal or Mac command prompt, the build runs, but if I refresh using…

jega
- 21
- 3
1
vote
0 answers
Why is invokedynamic faster than invokestatic
Recently, I have been working with low-level Java, modifying the JVM bytecode and generating Class Files without compiling .java files. I just learned about invokedynamic, and I was able to generate my own InvokeDynamic constants and BootstrapMethod…

Ethan Ferguson
- 69
- 8
1
vote
1 answer
How should one use LambdaMetafactory to generate an invoke dynamic callsite
I am trying to work out how to use LambdaMetafactory to generate a usable callSite.
Here's my latest Groovy script attempt. I have tried multiple permutations of parameters and cannot get the second getter based example to work.
The first example I…

WILLIAM WOODMAN
- 1,185
- 5
- 19
- 36
1
vote
1 answer
InvokeDynamic from source code in JDK7
Prerelease versions of JDK 7 contained a class java.dyn.InvokeDynamic that allowed creating invokedynamic instructions from source code.
See here:
http://fwierzbicki.blogspot.com/2009/08/invokedynamic-and-jython-part-i.html
In the official JDK 7…

Eric
- 1,343
- 1
- 11
- 19
1
vote
1 answer
Call Java varargs method from invokedynamic
I want to dynamically call a native method from Java.
Because the method signature is unknown at compile time, I've made generic native methods for most primitive return types that have the same signature:
class NativeHook {
public static…

user7401478
- 1,372
- 1
- 8
- 25
1
vote
0 answers
How to instrument invokedynamic and scalac 2.12 output code with JDI
I want to instrument ScalaCheck compiled with/for scala 2.12, using JDI.
By running javap I have concluded that scalac 2.12.x emits invokedynamic instructions (for some values of x) where scala 2.11 used to generate inner classes, in particular for…

Jonas Kölker
- 7,680
- 3
- 44
- 51
1
vote
1 answer
How can I use ASM to generate invokedynamic calls that simulate invokevirtual
I'd like to see how to make invokedynamic calls with the same dispatch logic as invokevirtual.
I'm asking this question because the examples currently online of generating dynamic method calls with ASM are too trivial to generalise and I think this…

Martin
- 33
- 6
1
vote
1 answer
Why isn't invokedynamic the default in Groovy?
Groovy added the --indy option in version 2.0, back in 2012. It wasn't the default at the time because invoke dynamic required Java 7, and many people at the time used Java 6.
Now even the forthcoming Groovy 3.0 still requires the --indy option in…

DodgyCodeException
- 5,963
- 3
- 21
- 42
1
vote
0 answers
`invokedynamic` on android sdk<26 (Oreo)?
is there a way to have invokedynamic on older versions than sdk level 26 (i.e. Oreo, Android 8)? i.e. just install the later VM (ART) version.
Because it's a VM feature, wouldn't it be independent of, and separable from, all non-VM sdk level 26…

hyperpallium
- 571
- 5
- 18
1
vote
1 answer
Groovy Performance Issue with Invoke Dynamic?
I'm struggling to determine what is causing a moderately large Groovy application to perform slowly in production. When taking thread dumps of running applications the strange thing I'm seeing is lots of threads with a stacktrace like this:
at…

jjathman
- 12,536
- 8
- 29
- 33