< prev index next >

src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java

Print this page

1118 
1119         static final RuntimeVisibleAnnotationsAttribute FORCE_INLINE = RuntimeVisibleAnnotationsAttribute.of(Annotation.of(ClassDesc.ofDescriptor("Ljdk/internal/vm/annotation/ForceInline;")));
1120 
1121         static final MethodType CONSTRUCTOR_METHOD_TYPE        = MethodType.methodType(void.class, String[].class);
1122         static final Consumer<CodeBuilder> CONSTRUCTOR_BUILDER = new Consumer<CodeBuilder>() {
1123             @Override
1124             public void accept(CodeBuilder cb) {
1125                 /*
1126                  * super(constants);
1127                  */
1128                 int thisSlot      = cb.receiverSlot(),
1129                     constantsSlot = cb.parameterSlot(0);
1130                 cb.aload(thisSlot)
1131                   .aload(constantsSlot)
1132                   .invokespecial(CD_StringConcatBase, INIT_NAME, MTD_INIT, false)
1133                   .return_();
1134             }
1135         };
1136 
1137         static final ReferencedKeyMap<MethodType, SoftReference<MethodHandlePair>> CACHE =
1138                 ReferencedKeyMap.create(true, true,
1139                         new Supplier<>() {
1140                             @Override
1141                             public Map<ReferenceKey<MethodType>, SoftReference<MethodHandlePair>> get() {
1142                                 return new ConcurrentHashMap<>(64);
1143                             }
1144                         });
1145 
1146         private InlineHiddenClassStrategy() {
1147             // no instantiation
1148         }
1149 
1150         private record MethodHandlePair(MethodHandle constructor, MethodHandle concatenator) { };
1151 
1152         /**
1153          * The parameter types are normalized into 7 types: int,long,boolean,char,float,double,Object
1154          */
1155         private static MethodType erasedArgs(MethodType args) {
1156             int parameterCount = args.parameterCount();
1157             var paramTypes = new Class<?>[parameterCount];
1158             boolean changed = false;

1118 
1119         static final RuntimeVisibleAnnotationsAttribute FORCE_INLINE = RuntimeVisibleAnnotationsAttribute.of(Annotation.of(ClassDesc.ofDescriptor("Ljdk/internal/vm/annotation/ForceInline;")));
1120 
1121         static final MethodType CONSTRUCTOR_METHOD_TYPE        = MethodType.methodType(void.class, String[].class);
1122         static final Consumer<CodeBuilder> CONSTRUCTOR_BUILDER = new Consumer<CodeBuilder>() {
1123             @Override
1124             public void accept(CodeBuilder cb) {
1125                 /*
1126                  * super(constants);
1127                  */
1128                 int thisSlot      = cb.receiverSlot(),
1129                     constantsSlot = cb.parameterSlot(0);
1130                 cb.aload(thisSlot)
1131                   .aload(constantsSlot)
1132                   .invokespecial(CD_StringConcatBase, INIT_NAME, MTD_INIT, false)
1133                   .return_();
1134             }
1135         };
1136 
1137         static final ReferencedKeyMap<MethodType, SoftReference<MethodHandlePair>> CACHE =
1138                 ReferencedKeyMap.create(true,
1139                         new Supplier<>() {
1140                             @Override
1141                             public Map<ReferenceKey<MethodType>, SoftReference<MethodHandlePair>> get() {
1142                                 return new ConcurrentHashMap<>(64);
1143                             }
1144                         });
1145 
1146         private InlineHiddenClassStrategy() {
1147             // no instantiation
1148         }
1149 
1150         private record MethodHandlePair(MethodHandle constructor, MethodHandle concatenator) { };
1151 
1152         /**
1153          * The parameter types are normalized into 7 types: int,long,boolean,char,float,double,Object
1154          */
1155         private static MethodType erasedArgs(MethodType args) {
1156             int parameterCount = args.parameterCount();
1157             var paramTypes = new Class<?>[parameterCount];
1158             boolean changed = false;
< prev index next >