if (method.canThrow(PragmaPrivilegedAction.class)) {  return; }
    public static void checkPermission(Permission perm)            throws AccessControlException, PragmaCheckPermission {        if (!Unsafe.getCurrentProcessor().isThreadSwitchActive()) {            //getContext().checkPermission(perm);            // This is an optimized version of            // getContext().checkPermission()            // that does not require any memory allocations.            final VmStackReader reader = Unsafe.getCurrentProcessor()                    .getArchitecture().getStackReader();            Address sf = Unsafe.getCurrentFrame();            int recursionCount = 0;            while (reader.isValid(sf)) {                final VmMethod method = reader.getMethod(sf);                if (method.canThrow(PragmaDoPrivileged.class)) {                    // Stop here with the current thread's stacktrace.                    break;                } else if (method.canThrow(PragmaPrivilegedAction.class)) {                    // Break here, do not include inherited thread context                    return;                } else if (method.canThrow(PragmaCheckPermission.class)) {                    // Be paranoia for now, let's check for recursive                    // checkPermission calls.                    recursionCount++;                    if (recursionCount > 2) {                        reader.debugStackTrace();                        Unsafe.die("Recursive checkPermission");                    }                } else {                    final ProtectionDomain pd = method.getDeclaringClass()                            .getProtectionDomain();                    if (pd != null) {                        //Unsafe.debug(":pd");                        if (!pd.implies(perm)) {                         //Unsafe.debug("Permission denied");                        throw new AccessControlException("Permission \""                                + perm + "\" not granted"); }                    }                }                sf = reader.getPrevious(sf);            }            final VmThread thread = VmThread.currentThread();            final VmAccessControlContext inheritedCtx = thread.getContext();            if (inheritedCtx != null) {                inheritedCtx.checkPermission(perm);            }        }    }