/// <summary>
        /// Create a LF which can invoke the given method.
        /// Cache and share this structure among all methods with
        /// the same basicType and refKind.
        /// </summary>
        private static LambdaForm PreparedLambdaForm(MemberName m)
        {
            assert(m.Invocable) : m;             // call preparedFieldLambdaForm instead
            MethodType mtype = m.InvocationType.BasicType();

            assert(!m.MethodHandleInvoke || "invokeBasic".Equals(m.Name)) : m;
            int which;

            switch (m.ReferenceKind)
            {
            case REF_invokeVirtual:
                which = LF_INVVIRTUAL;
                break;

            case REF_invokeStatic:
                which = LF_INVSTATIC;
                break;

            case REF_invokeSpecial:
                which = LF_INVSPECIAL;
                break;

            case REF_invokeInterface:
                which = LF_INVINTERFACE;
                break;

            case REF_newInvokeSpecial:
                which = LF_NEWINVSPECIAL;
                break;

            default:
                throw new InternalError(m.ToString());
            }
            if (which == LF_INVSTATIC && ShouldBeInitialized(m))
            {
                // precompute the barrier-free version:
                PreparedLambdaForm(mtype, which);
                which = LF_INVSTATIC_INIT;
            }
            LambdaForm lform = PreparedLambdaForm(mtype, which);

            MaybeCompile(lform, m);
            assert(lform.MethodType().DropParameterTypes(0, 1).Equals(m.InvocationType.BasicType())) : Arrays.asList(m, m.InvocationType.BasicType(), lform, lform.MethodType());
            return(lform);
        }
        /// <summary>
        /// Create a LF which can access the given field.
        /// Cache and share this structure among all fields with
        /// the same basicType and refKind.
        /// </summary>
        private static LambdaForm PreparedFieldLambdaForm(MemberName m)
        {
            Class ftype      = m.FieldType;
            bool  isVolatile = m.Volatile;
            sbyte formOp;

            switch (m.ReferenceKind)
            {
            case REF_getField:
                formOp = AF_GETFIELD;
                break;

            case REF_putField:
                formOp = AF_PUTFIELD;
                break;

            case REF_getStatic:
                formOp = AF_GETSTATIC;
                break;

            case REF_putStatic:
                formOp = AF_PUTSTATIC;
                break;

            default:
                throw new InternalError(m.ToString());
            }
            if (ShouldBeInitialized(m))
            {
                // precompute the barrier-free version:
                PreparedFieldLambdaForm(formOp, isVolatile, ftype);
                assert((AF_GETSTATIC_INIT - AF_GETSTATIC) == (AF_PUTSTATIC_INIT - AF_PUTSTATIC));
                formOp += (sbyte)(AF_GETSTATIC_INIT - AF_GETSTATIC);
            }
            LambdaForm lform = PreparedFieldLambdaForm(formOp, isVolatile, ftype);

            MaybeCompile(lform, m);
            assert(lform.MethodType().DropParameterTypes(0, 1).Equals(m.InvocationType.BasicType())) : Arrays.asList(m, m.InvocationType.BasicType(), lform, lform.MethodType());
            return(lform);
        }