So...any thoughts?
De: "John Rose" <john....@oracle.com>
À: jvm-la...@googlegroups.com
Envoyé: Mardi 19 Juillet 2016 18:12:07
Objet: Re: [jvm-l] Tool to convert call sites into invokedynamic?On Jul 19, 2016, at 8:07 AM, Charles Oliver Nutter <hea...@headius.com> wrote:So...any thoughts?Remi has some stuff that can re-weave all normal invokes to indy's.You'll want to put a big filter on it. I anticipate a cool design for that filter.
Another thought: Use annotations to mark some arguments as static,and require those to be ldc-able constants, just like some C intrinsicsrequire some of their arguments to be C constants. (The C compilerbackend object to them if they aren't really constants; your bytecodetransform would object similarly.)I wish we had a good PIC combinator off the shelf. Idea: Use a short@Stable array and ensure constant folding of current method bindings.It's an abuse of @Stable, though, since the PIC contents would changeover time.— John
yes, the rewriting part is easy, the question is more how to find the call youwant to rewrite and how to find the bootstrap method and the bootstraparguments associated with that call.
Charles, given that i will be locked up in a flying box for a little more that 10 hours soon,if you have precise answers to these two questions, i can write a tool for you during that time.
A fun way to design such filter is to create a class that declares methods that uses the @PolymorphicSignature,with that the compiler will not try to box the arguments and it will be easier to substitute a call toa method of this call by an invokedynamic.
De: "Charles Oliver Nutter" <hea...@headius.com>
À: "JVM Languages" <jvm-la...@googlegroups.com>
Envoyé: Jeudi 21 Juillet 2016 03:21:36
Objet: Re: [jvm-l] Tool to convert call sites into invokedynamic?
On Wed, Jul 20, 2016 at 12:41 PM, Remi Forax <fo...@univ-mlv.fr> wrote:yes, the rewriting part is easy, the question is more how to find the call youwant to rewrite and how to find the bootstrap method and the bootstraparguments associated with that call.At the moment I am using my own non-indy call sites, one per actual site in the Java code. The call sites are all very straightforward:sites(context).some_method.call(context, caller, target, args...)Where sites is a private static method that gets the right box of call sites, some_method is one of those call sites for calling "some method" and the call logic does the monomporphic cache.It should not be hard to see this pattern in code and rewrite it, but it won't be a simple invokevirtual => invokedynamic.Charles, given that i will be locked up in a flying box for a little more that 10 hours soon,if you have precise answers to these two questions, i can write a tool for you during that time.What I want is a way to say "take all call sites that look like X and turn them into indy call sites that do X the right way".
A fun way to design such filter is to create a class that declares methods that uses the @PolymorphicSignature,with that the compiler will not try to box the arguments and it will be easier to substitute a call toa method of this call by an invokedynamic.There's lots of annotations I'd love to play with from java.lang.invoke, but is there any way to do it without runtime tricks?
FWIW, a contrived benchmark that uses a lot of dynamic calling from Java is already 3x faster by introducing simple monomorphic caches.This work is the first step.* Get dynamic calls from Java caching in SOME way.* Get dynamic calls from Java using invokedynamic using some tooling. SURE WISH I COULD EMIT INDY FROM JAVA :-D* Profile Java-based Ruby core methods and find the worst poly/megamorphic cases. Move them to Ruby.Once code is in Ruby, I already have a POC to re-emit the bytecode on a per-callsite basis. We should also be able to feed expected types into IR and have it emit specialized versions for e.g. math.Lots of stuff finally coming together, but Java is the biggest thing holding me back right now.- Charlie
This is excellent, Remi! I think I should be able to take it from here.
- Charlie (mobile)
--
You received this message because you are subscribed to the Google Groups "JVM Languages" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jvm-language...@googlegroups.com.
To post to this group, send email to jvm-la...@googlegroups.com.
Visit this group at https://groups.google.com/group/jvm-languages.
For more options, visit https://groups.google.com/d/optout.
This is excellent, Remi! I think I should be able to take it from here.- Charlie (mobile)