Differences in asType between MLVM/bsdport and JDK7
Ola Bini
ola.bini at gmail.com
Fri May 27 00:11:29 PDT 2011
I ran the compile against what's in b144, but directly from the JDK7 repo
On 2011-05-27 12.26, John Rose wrote:
> On May 26, 2011, at 11:38 PM, Ola Bini wrote:
>
>> It seems there is still a difference in how asType MHs work between what
>> is in current JDK7 repo, and what you get from building bsdport with
>> mlvm patches. Specifically, when running things with bsdport/mlvm they
>> work. When running on JDK7 (built about 30 minutes ago) I get this:
>
> There are changes to asType in meth-review-7032323.patch.
>
> I just committed that change set a few hours ago here:
> http://hg.openjdk.java.net/hsx/hotspot-comp/jdk
>
> I hope it will be in b145, although we are still figuring this out.
>
> Are you comparing against b143 or b144 (which just came out a few minutes ago)? (It should not matter very much; just asking.)
>
>> Caused by: java.lang.IllegalArgumentException: target and fallback types
>> must match: (SephObject,Object,Object,Object,Object)Object !=
>> (SephObject,SephObject,SThread,LexicalScope,MethodHandle)SephObject
>
> This mismatch is being correctly reported. The change is probably in the logic that created one of the inputs to GWT.
>
>> at
>> java.lang.invoke.MethodHandleStatics.newIllegalArgumentException(MethodHandleStatics.java:87)
>> at
>> java.lang.invoke.MethodHandles.misMatchedTypes(MethodHandles.java:2074)
>> at
>> java.lang.invoke.MethodHandles.guardWithTest(MethodHandles.java:2058)
>> at
>> seph.lang.compiler.SephCallSite.computeSlowPath(SephCallSite.java:149)
>> at seph.lang.compiler.SephCallSite.<init>(SephCallSite.java:46)
>> at seph.lang.compiler.SephCallSite.bootstrap(SephCallSite.java:31)
>> at java.lang.invoke.CallSite.makeSite(CallSite.java:276)
>>
>> John, do you have any idea of what's missing to make this work in JDK7 too?
>
> Please recheck your use of MethodHandles.invoker or MethodHandles.spreadInvoker. The behavior was seriously out of sync. with the docs, and the docs were unclear. The latest behavior should be correct and clearly documented.
>
> If in doubt, you can apply asType to your invoker to make sure it has the type you expect.
Yes, that's exactly what I'm doing. The spreader makes it all a Object
arguments, and I then use asType to make them into the types they really
are.
Am I misunderstanding things here?
The place that is doing the work is this:
MethodHandle _insertArguments =
insertArguments(findStatic(MethodHandles.class,
"insertArguments",
methodType(MethodHandle.class,
MethodHandle.class,
int.class,
Object[].class)),
1,
0).asCollector(Object[].class,
type().parameterCount()).
asType(type().insertParameterTypes(0,
MethodHandle.class)
.changeReturnType(MethodHandle.class));
Sorry for the obscuring going on. =/
Cheers
--
Ola Bini (http://olabini.com)
Ioke - JRuby - ThoughtWorks
"Yields falsehood when quined" yields falsehood when quined.
More information about the mlvm-dev
mailing list