InvokeDynamic

377 views
Skip to first unread message

Robin Heggelund Hansen

unread,
Apr 4, 2014, 4:42:56 AM4/4/14
to clo...@googlegroups.com
Hi!

Did someone ever look at supporting InvokeDynamic for Clojure? I've read a couple of blogs and it seemed interesting, would be cool to know if there actually were any advantages in practice.

Plínio Balduino

unread,
Apr 4, 2014, 5:43:18 AM4/4/14
to clo...@googlegroups.com

On 04/04/2014, at 05:42, Robin Heggelund Hansen <skinn...@gmail.com> wrote:

Hi!

Did someone ever look at supporting InvokeDynamic for Clojure? I've read a couple of blogs and it seemed interesting, would be cool to know if there actually were any advantages in practice.

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Robin Heggelund Hansen

unread,
Apr 4, 2014, 5:44:42 AM4/4/14
to clo...@googlegroups.com
Yeah, those were the blog posts I’ve read, but I can’t see that this is actually being worked on for Clojure?

You received this message because you are subscribed to a topic in the Google Groups "Clojure" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/clojure/vNXIfkgRRkI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to clojure+u...@googlegroups.com.

Plínio Balduino

unread,
Apr 4, 2014, 6:09:16 AM4/4/14
to clo...@googlegroups.com
The guys from core team will correct me if I say any bs, but I think it's not possible to keep Clojure compatible with Java 6, as Clojure 1.6 is, and use InvokeDynamic bytecode in the same binary. DynJS, for example, is not compatible with Java 6. 

Anyway, it would be nice to see any experiment with that bytecode and Clojure, maybe evolving to some form of Clojure 2.0. 

It would be nice to hear the core team and/or Hickey's position about it. 

Regards

Plinio Balduino

Ragnar Dahlén

unread,
Apr 4, 2014, 6:35:21 AM4/4/14
to clo...@googlegroups.com

Robin Heggelund Hansen

unread,
Apr 4, 2014, 6:37:13 AM4/4/14
to clo...@googlegroups.com
Thank you!

Alex Miller

unread,
Apr 4, 2014, 8:45:18 AM4/4/14
to clo...@googlegroups.com
I agree that we cannot (yet) cut support for Java 6 but we continue to watch polls and usage closely.  Java 6 has been EOL'ed for a while now and usage continues to drop. However, there are a few minor JDK-specific bits already in Clojure and it would be entirely possible to handle separate paths for 6 and 7.

The major concern is with the stability and *predictability* of invokedynamic. indy has undergone major revisions between Java 7 and 8 so it may be that what needs to be done is substantially different between the two. My impression from watching the work of people like Charles Nutter is that it requires a lot of flag tweaking to make it work reliably. It also seems that when you go off the fast path, you can go over a cliff with performance. **These are my impressions - they could be wrong.** For these reasons, it has not been high on the priority list, but having more work or data on this would be great. I am not speaking for Rich here, but my guess is that this is compatible with his thoughts.

One of my first efforts for 1.7 is going to be working out how to support multiple Clojure builds for different purposes (such as lean runtime, Android, whatever) - this is foundational work that can open up the possibility of specialized Clojure builds, such as an invokedynamic-aware version.

Alex

Robin Heggelund Hansen

unread,
Apr 4, 2014, 8:49:32 AM4/4/14
to clo...@googlegroups.com
Great to hear, I’m looking forward to progress :)

Plínio Balduino

unread,
Apr 4, 2014, 12:46:13 PM4/4/14
to Clojure Official
I strongly recommend to talk with dynjs guys about invokedynamic.

Dynjs is a ECMAScript engine written in Java 7 that was intended to use all the power of invokedynamic. Again, they can correct me if I'm saying bananas, but it looks lie Java 7 has some issues in invokedynamic implementation and the result is quite slower than expected.

Douglas Campos, aka qmx, father of dynjs presented some talks about that specific feature and the problems that dynjs core team found.


I hope that it can be useful in our discussion.

Plínio

Colin Fleming

unread,
Apr 4, 2014, 8:28:28 PM4/4/14
to clo...@googlegroups.com
My understanding is that invokedynamic was very problematic in Java 7, but is quite a different design and works much better in Java 8. I'd expect it to be much more heavily optimised in Java 8 since it's used by a core Java feature (lambdas). Unfortunately targeting Java 8 only is probably not feasible for some time.

Rohit Aggarwal

unread,
Apr 5, 2014, 9:58:28 AM4/5/14
to clo...@googlegroups.com
An interesting paper looking at the languages based on top of the JVM here:

http://www.dcs.gla.ac.uk/%7Ewingli/jvm_language_study/jvmlanguages.pdf

A presentation based on the above paper here:

http://www.dcs.gla.ac.uk/~wingli/jvm_language_study/JVM_Languages_Presentation.pdf

funk...@gmail.com

unread,
Jun 17, 2014, 11:27:20 PM6/17/14
to clo...@googlegroups.com
I wonder if InvokeDynamic could be used to bring more consistency between the 20-argument limit function signatures used for objects and the 4-argument limit function signatures for functions with primitive arguments, by dynamically generating the appropriate method type (with whatever combination of primitives and objects was needed). Java lambdas offer this.
Reply all
Reply to author
Forward
0 new messages