Arg ordering on the test path method handle for GwT

Rémi Forax forax at univ-mlv.fr
Wed Jan 12 15:04:22 PST 2011


On 01/12/2011 10:28 PM, Mark Roos wrote:
>
> Done
>
> Though it would be nice if there was a dropArguments api like
>         dropArguments(MethodHandle target, int start, int count)
>
> Since I have only one type in my world the value of selecting by types 
> is lost.
>
> Thanks
> mark

No, when you invoke a method handle with invokeExact or by invokedynamic,
the VM first checks at runtime the method type. Otherwise, you will be able
to crash the VM.

So the resulting method handle of dropArguments must have a correct 
method type,
thus you have to provide the classes of the dropt arguments.
In your case, the classes can be easily derived from the target's method 
type.

something like target.type().parameterList().subList(0, 
target.type().parameterCount() - 1).toArray(new Class<?>[0]);

Rémi

>
> mlvm-dev-bounces at openjdk.java.net wrote on 01/06/2011 11:25:09 AM:
>
> >
> > In that case, the simplest way to go is to generate your GWT
> > predicate as a unary MH, but then wrap it in a dropArguments so it
> > can take *all* the arguments but drop all but the last.  Then pass
> > the the wrapped predicate to guardWithTest.
> >
> > Agree.
>
>
> _______________________________________________
> mlvm-dev mailing list
> mlvm-dev at openjdk.java.net
> http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/mlvm-dev/attachments/20110113/5c2c655f/attachment.html 


More information about the mlvm-dev mailing list