< prev index next >

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

Print this page

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

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