4 ms·
Maybe my memory is a little rusty or I glossed over a bit too much, but I was thinking of how hotspot does lambdas from here[0]. It seems to use the Invokedyanm
by kjeetgill 7y ago
Maybe my memory is a little rusty or I glossed over a bit too much, but I was thinking of how hotspot does lambdas from here[0]. It seems to use the Invokedyanmic Bootstrap method to spin an InnerClass at runtime. To be fair, it's a hotspot thing and not in the JVM spec.
[0]: https://github.com/frohoff/jdk8u-jdk/blob/master/src/share/classes/java/lang/invoke/LambdaMetafactory.java#L299 https://github.com/frohoff/jdk8u-jdk/blob/master/src/share/c...
- pjmlp 7y agoBetter check out from Brian's talk. Not really, because the class file with invokedynamic bytecodes is supposed to work across all JVM implementations.
- kjeetgill 7y agoI think we agree? The bytecode is transferrable because the classfile only contains an invokedynamic that calls the LambdaMetaFactory for bootstrapping. The LambdaMetaFactory is provided by the runtime JVM itself so that linkage dosn't introduce an implementation dependence. Hotspot's just happens to spin an inner class at runtime.
- pjmlp 7y agoYes we agree, I do conceed that I wasn't fully correct.