How to filter results of a virtual method?

Kirill Shirokov kirill.shirokov at oracle.com
Thu Jan 27 19:09:09 PST 2011


By the way, why exactInvoker() is needed? Isn't the following true?

exactInvoker(target.type()).bindTo(target) == target

Kirill

On 01/27/2011 12:01 AM, Jim Laskey wrote:
> I think it's a simple issue.  Drop should use 1 instead of 0.
>
>
>      public static
>      MethodHandle filterReturnValue(MethodHandle target, MethodHandle filter) {
>          MethodType targetType = target.type();
>          MethodType filterType = filter.type();
>          if (filterType.parameterCount() != 1
>              || filterType.parameterType(0) != targetType.returnType())
>              System.err.println("target and filter types do not match");
>          // FIXME: Too many nodes here.
>          MethodHandle returner = dropArguments(filter, 0, targetType.parameterList());<<<   0 should be 1
>          return foldArguments(returner, exactInvoker(target.type()).bindTo(target));
>      }
>
> Cheers,
>
> -- Jim


More information about the mlvm-dev mailing list