Re: RFR: 8262891: Compiler implementation for Pattern Matching for switch (Preview) [v4]

2021-05-26 Thread Rémi Forax
On Tue, 25 May 2021 16:14:56 GMT, Jan Lahoda wrote: > I'd like to note this is a preview feature - we can change the desugaring. At > the same time, I don't think this does not work with sub-patterns (those can > be easily desugared to guards, I think). Yes, but in that case the classcheck du

Re: RFR: 8262891: Compiler implementation for Pattern Matching for switch (Preview) [v4]

2021-05-25 Thread Jan Lahoda
On Tue, 25 May 2021 16:00:43 GMT, Rémi Forax wrote: > > The reason for this integer (which is not a constant in the case of this > > switch) is to restart the matching in case guards fail to "match". > > Considering the example here: > > ``` > > class Example { > > void example(Object

Re: RFR: 8262891: Compiler implementation for Pattern Matching for switch (Preview) [v4]

2021-05-25 Thread Rémi Forax
On Tue, 25 May 2021 14:22:57 GMT, Jan Lahoda wrote: > The reason for this integer (which is not a constant in the case of this > switch) is to restart the matching in case guards fail to "match". > Considering the example here: > > ``` > class Example { > void example(Object o) { >

Re: RFR: 8262891: Compiler implementation for Pattern Matching for switch (Preview) [v4]

2021-05-25 Thread Evgeny Mandrikov
On Tue, 25 May 2021 14:13:55 GMT, Rémi Forax wrote: > 7: iconst_0 < this zero @forax as far as I understood this will be a value of parameter `startIndex` in `java.lang.runtime. SwitchBootstraps.doSwitch`  Please correct me @lahodaj if I'm wrong. - PR:

Re: RFR: 8262891: Compiler implementation for Pattern Matching for switch (Preview) [v4]

2021-05-25 Thread Jan Lahoda
On Tue, 25 May 2021 14:13:55 GMT, Rémi Forax wrote: > > Thanks Evgeny, I'll take a look. > > @forax, do you mean why there is "0" in: > > 11: invokedynamic #13, 0 > > ? > > Not this one, the one on the stack. > > 7: iconst_0 < this zero > 8: istore_3 > 9: aload_2 > 10: iload_3 > 11:

Re: RFR: 8262891: Compiler implementation for Pattern Matching for switch (Preview) [v4]

2021-05-25 Thread Rémi Forax
On Tue, 25 May 2021 12:20:02 GMT, Jan Lahoda wrote: > Thanks Evgeny, I'll take a look. > > @forax, do you mean why there is "0" in: > 11: invokedynamic #13, 0 > ? Not this one, the one on the stack. 7: iconst_0 < this zero 8: istore_3 9: aload_2 10: iload_3 11: invokedynamic #13, 0 //

Re: RFR: 8262891: Compiler implementation for Pattern Matching for switch (Preview) [v4]

2021-05-25 Thread Jan Lahoda
On Wed, 19 May 2021 08:00:12 GMT, Jan Lahoda wrote: >> This is a preview of a patch implementing JEP 406: Pattern Matching for >> switch (Preview): >> https://bugs.openjdk.java.net/browse/JDK-8213076 >> >> The current draft of the specification is here: >>

Re: RFR: 8262891: Compiler implementation for Pattern Matching for switch (Preview) [v4]

2021-05-25 Thread Remi Forax
- Mail original - > De: "Evgeny Mandrikov" > À: "build-dev" , "compiler-dev" > , "core-libs-dev" > , "javadoc-dev" > Envoyé: Mardi 25 Mai 2021 11:32:03 > Objet: Re: RFR: 8262891: Compiler implementation for Pattern M

Re: RFR: 8262891: Compiler implementation for Pattern Matching for switch (Preview) [v4]

2021-05-25 Thread Evgeny Mandrikov
On Mon, 17 May 2021 19:01:01 GMT, Jan Lahoda wrote: >> Good work. There's a lot to take in here. I think overall, it holds up well >> - I like how case labels have been extended to accommodate for patterns. In >> the front-end, I think there are some questions over the split between Attr >>

Re: RFR: 8262891: Compiler implementation for Pattern Matching for switch (Preview) [v4]

2021-05-19 Thread Jan Lahoda
> This is a preview of a patch implementing JEP 406: Pattern Matching for > switch (Preview): > https://bugs.openjdk.java.net/browse/JDK-8213076 > > The current draft of the specification is here: > http://cr.openjdk.java.net/~gbierman/jep406/jep406-20210430/specs/patterns-switch-jls.html > > A