RFR: 8263087: Add a MethodHandle combinator that switches over a set of MethodHandles

John Rose john.r.rose at oracle.com
Fri Apr 9 18:01:18 UTC 2021


On Apr 9, 2021, at 9:55 AM, Remi Forax <forax at univ-mlv.fr> wrote:
> 
> I think the combinator should be lookupswitch which is more general than tableswitch with a special case when generating the bytecode to generate a tableswitch instead of a lookupswitch if the indexes are subsequent.

We can get there in the simpler steps Jorn has outlined.

The combinator is much simpler if the case numbers are implicit in [0,N). Then it’s natural to filter on the [0,N) input as a separately factored choice. That also scales to pattern-switch. 

I agree with the choice to have N call sites. It’s possible to build the one call site version on top using constant combinators but not vice versa. 


More information about the core-libs-dev mailing list