Paul, thanks for review.

Updated webrev:
http://cr.openjdk.java.net/~vlivanov/8037210/webrev.04/

Best regards,
Vladimir Ivanov

On 4/1/14 1:44 PM, Paul Sandoz wrote:
Hi Vladimir,

This looks good. Minor stuff below.

I too prefer *_TYPE instead of Int/Float/Void etc as those are not v. friendly 
for static imports.

Paul.

LambaForm:
--

     private static int fixResult(int result, Name[] names) {
         if (result == LAST_RESULT)
             result = names.length - 1;  // might still be void
         if (result >= 0 && names[result].type == V_TYPE)
             result = -1;
         return result;
     }

change to "result = -1" to:

   result = VOID_RESULT;

?
Done.



Change:

     LambdaForm addArguments(int pos, List<Class<?>> types) {
         BasicType[] basicTypes = new BasicType[types.size()];
         for (int i = 0; i < basicTypes.length; i++)
             basicTypes[i] = basicType(types.get(i));
         return addArguments(pos, basicTypes);
     }

to:

     LambdaForm addArguments(int pos, List<Class<?>> types) {
         return addArguments(pos, basicTypes(types));
     }

?
Done.



Methods not used, i cannot tell which may be there for future code or are 
referenced indirectly:

         String basicTypeSignature() {
             //return LambdaForm.basicTypeSignature(resolvedHandle.type());
             return LambdaForm.basicTypeSignature(methodType());
         }

     void resolve() {
         for (Name n : names) n.resolve();
     }

     static LambdaForm identityForm(BasicType type) {
         return LF_identityForm[type.ordinal()];
     }
     static LambdaForm zeroForm(BasicType type) {
         return LF_zeroForm[type.ordinal()];
     }

Removed.



BoundMethodHandle:
--

Methods not used:

         SpeciesData extendWith(Class<?> type) {
             return extendWith(basicType(type));
         }

         SpeciesData extendWithChar(char type) {
             return extendWith(basicType(type));
         }

     static void initStatics() {}
     static { SpeciesData.initStatics(); }
Removed.



Deprecated method in ASM (there are also a few others):

             mv.visitMethodInsn(INVOKESPECIAL, className, "<init>", 
makeSignature(types, true));

I think you need to append false as the last parameter.
Fixed.



Unused first parameter "cbmhClass":

         static NamedFunction[] makeNominalGetters(Class<?> cbmhClass, String 
types, NamedFunction[] nfs, MethodHandle[] getters) {
Removed.

InvokerByteCodeGenerator
--

     private int loadInsnOpcode(BasicType type) throws InternalError {
         int opcode;
         switch (type) {
         case I_TYPE:  opcode = Opcodes.ILOAD;  break;
         case J_TYPE:  opcode = Opcodes.LLOAD;  break;
         case F_TYPE:  opcode = Opcodes.FLOAD;  break;
         case D_TYPE:  opcode = Opcodes.DLOAD;  break;
         case L_TYPE:  opcode = Opcodes.ALOAD;  break;
         default:
             throw new InternalError("unknown type: " + type);
         }
         return opcode;
     }

Could just do:

   case I_TYPE:  return Opcodes.ILOAD;

etc. Same for "storeInsnOpcode" method.
Changed as you suggest.



Unused?

     static int nfi = 0;
Removed.

MethodHandle
--

Unused?

     /*non-public*/
     MethodHandle bindImmediate(int pos, BasicType basicType, Object value) {
         // Bind an immediate value to a position in the arguments.
         // This means, elide the respective argument,
         // and replace all references to it in NamedFunction args with the 
specified value.

         // CURRENT RESTRICTIONS
         // * only for pos 0 and UNSAFE (position is adjusted in MHImpl to make 
API usable for others)
         assert pos == 0 && basicType == L_TYPE && value instanceof Unsafe;
         MethodType type2 = type.dropParameterTypes(pos, pos + 1); // 
adjustment: ignore receiver!
         LambdaForm form2 = form.bindImmediate(pos + 1, basicType, value); // 
adjust pos to form-relative pos
         return copyWith(type2, form2);
     }
Removed.

Best regards,
Vladimir Ivanov



On Mar 24, 2014, at 5:29 PM, Vladimir Ivanov <vladimir.x.iva...@oracle.com> 
wrote:

Updated version:
http://cr.openjdk.java.net/~vlivanov/8037210/webrev.03/

- changed the way how arrays of types are created:
        static final BasicType[] ALL_TYPES = BasicType.values();
        static final BasicType[] ARG_TYPES = Arrays.copyOf(ALL_TYPES, 
ALL_TYPES.length-1);

- added a test for BasicType (LambdaFormTest.testBasicType).

Best regards,
Vladimir Ivanov



_______________________________________________
mlvm-dev mailing list
mlvm-...@openjdk.java.net
http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev

Reply via email to