src/java.base/share/classes/java/lang/invoke/LambdaFormEditor.java
changeset 47753 a2008587c13f
parent 47216 71c04702a3d5
child 52226 b4b932c6001f
equal deleted inserted replaced
47752:e0041b182e31 47753:a2008587c13f
   379     }
   379     }
   380 
   380 
   381     /// Editing methods for method handles.  These need to have fast paths.
   381     /// Editing methods for method handles.  These need to have fast paths.
   382 
   382 
   383     private BoundMethodHandle.SpeciesData oldSpeciesData() {
   383     private BoundMethodHandle.SpeciesData oldSpeciesData() {
   384         return BoundMethodHandle.speciesData(lambdaForm);
   384         return BoundMethodHandle.speciesDataFor(lambdaForm);
   385     }
   385     }
       
   386 
   386     private BoundMethodHandle.SpeciesData newSpeciesData(BasicType type) {
   387     private BoundMethodHandle.SpeciesData newSpeciesData(BasicType type) {
   387         return oldSpeciesData().extendWith(type);
   388         return oldSpeciesData().extendWith((byte) type.ordinal());
   388     }
   389     }
   389 
   390 
   390     BoundMethodHandle bindArgumentL(BoundMethodHandle mh, int pos, Object value) {
   391     BoundMethodHandle bindArgumentL(BoundMethodHandle mh, int pos, Object value) {
   391         assert(mh.speciesData() == oldSpeciesData());
   392         assert(mh.speciesData() == oldSpeciesData());
   392         BasicType bt = L_TYPE;
   393         BasicType bt = L_TYPE;
   459             newBaseAddress = oldBaseAddress.withConstraint(newData);
   460             newBaseAddress = oldBaseAddress.withConstraint(newData);
   460             buf.renameParameter(0, newBaseAddress);
   461             buf.renameParameter(0, newBaseAddress);
   461             buf.replaceParameterByNewExpression(pos, new Name(getter, newBaseAddress));
   462             buf.replaceParameterByNewExpression(pos, new Name(getter, newBaseAddress));
   462         } else {
   463         } else {
   463             // cannot bind the MH arg itself, unless oldData is empty
   464             // cannot bind the MH arg itself, unless oldData is empty
   464             assert(oldData == BoundMethodHandle.SpeciesData.EMPTY);
   465             assert(oldData == BoundMethodHandle.SPECIALIZER.topSpecies());
   465             newBaseAddress = new Name(L_TYPE).withConstraint(newData);
   466             newBaseAddress = new Name(L_TYPE).withConstraint(newData);
   466             buf.replaceParameterByNewExpression(0, new Name(getter, newBaseAddress));
   467             buf.replaceParameterByNewExpression(0, new Name(getter, newBaseAddress));
   467             buf.insertParameter(0, newBaseAddress);
   468             buf.insertParameter(0, newBaseAddress);
   468         }
   469         }
   469 
   470