예제 #1
0
        /*non-public*/ internal static bool ShouldBeInitialized(MemberName member)
        {
            switch (member.ReferenceKind)
            {
            case REF_invokeStatic:
            case REF_getStatic:
            case REF_putStatic:
            case REF_newInvokeSpecial:
                break;

            default:
                // No need to initialize the class on this kind of member.
                return(false);
            }
            Class cls = member.DeclaringClass;

            if (cls == typeof(ValueConversions) || cls == typeof(MethodHandleImpl) || cls == typeof(Invokers))
            {
                // These guys have lots of <clinit> DMH creation but we know
                // the MHs will not be used until the system is booted.
                return(false);
            }
            if (VerifyAccess.isSamePackage(typeof(MethodHandle), cls) || VerifyAccess.isSamePackage(typeof(ValueConversions), cls))
            {
                // It is a system class.  It is probably in the process of
                // being initialized, but we will help it along just to be safe.
                if (UNSAFE.shouldBeInitialized(cls))
                {
                    UNSAFE.ensureClassInitialized(cls);
                }
                return(false);
            }
            return(UNSAFE.shouldBeInitialized(cls));
        }
예제 #2
0
 private static void MaybeCompile(LambdaForm lform, MemberName m)
 {
     if (VerifyAccess.isSamePackage(m.DeclaringClass, typeof(MethodHandle)))
     {
         // Help along bootstrapping...
         lform.CompileToBytecode();
     }
 }