hg: amber/amber: 8192963: Starting with switch desugaring to indy.

Remi Forax forax at univ-mlv.fr
Wed Dec 13 09:58:37 UTC 2017

Hi Jan,
putting the implementation in jdk.internal.misc may have a side effect on performance,
i believe that the VM/JIT trust final fields declared in java.lang.invoke but not the ones in jdk.internal.misc. 

In the code of StringSwitchCallSite, i do not understand how super(targetType, HOOK); can not throw a runtime exception because the MethodType of HOOK takes a callsite as first parameter.

Note: unlike MutableCallSite where you can/have to initialize the callsite in two steps (because the methodHandle it constains has to reference the mutable callsite), so inheriting from a MutableCallSite makes sense, with a ConstantCallSite using inheritance doesn't make sense. You can create a class that doesn't inherits from ConstantCallSite, declare stringSwitch as static and instead of storing the values as field you can declare them as parameter of stringSwitch and use insertArguments to partailly applied them. 


----- Mail original -----
> De: "jan lahoda" <jan.lahoda at oracle.com>
> À: "amber-dev" <amber-dev at openjdk.java.net>
> Envoyé: Mardi 12 Décembre 2017 20:55:21
> Objet: hg: amber/amber: 8192963: Starting with switch desugaring to indy.

> Changeset: bb054c3c7d3a
> Author:    jlahoda
> Date:      2017-12-12 19:41 +0100
> URL:       http://hg.openjdk.java.net/amber/amber/rev/bb054c3c7d3a
> 8192963: Starting with switch desugaring to indy.
> Contributed-by: brian.goetz at oracle.com, jan.lahoda at oracle.com
> + src/java.base/share/classes/java/lang/invoke/SwitchBootstraps.java
> + src/java.base/share/classes/jdk/internal/misc/SwitchBootstrapsImpl.java
> ! src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symtab.java
> ! src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java
> ! src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java
> ! src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Target.java
> ! src/jdk.compiler/share/classes/com/sun/tools/javac/util/Names.java
> + test/jdk/java/lang/invoke/TestSwitchBootstrap.java
> ! test/langtools/tools/javac/switchnull/SwitchNull.java

More information about the amber-dev mailing list