<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi Dean,<br>
    <br>
    I reviewed webrev.4 version.  It looks good.  Happy to see moving
    the doPrivileged support to Java and the performance improvement.<br>
    <br>
    <div class="moz-cite-prefix">On 10/31/18 3:23 PM,
      <a class="moz-txt-link-abbreviated" href="mailto:dean.long@oracle.com">dean.long@oracle.com</a> wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:0e3759bf-9c6f-dd75-bb27-5579e23c5348@oracle.com"><a class="moz-txt-link-freetext" href="https://bugs.openjdk.java.net/browse/JDK-8212605">https://bugs.openjdk.java.net/browse/JDK-8212605</a>
      <br>
      <a class="moz-txt-link-freetext" href="http://cr.openjdk.java.net/~dlong/8212605/webrev.1">http://cr.openjdk.java.net/~dlong/8212605/webrev.1</a>
      <br>
      <br>
      This change implements AccessController.doPrivileged in Java. 
      This gives a performance improvement while also being useful to
      Project Loom by removing the Java --> native --> Java
      transition.  One reason doPrivileged has historically been in
      native is because of the need to guarantee the cleanup of the
      privileged context when doPrivileged returns.  To do that in Java,
      the information that AccessController.getContext needs is pushed
      onto the Java stack as arguments to a method that getContext will
      recognize during its stack walk.  This allows us to remove the
      native privileged stack while guaranteeing that the privileged
      context goes away when the method returns.
      <br>
    </blockquote>
    <blockquote type="cite"
      cite="mid:0e3759bf-9c6f-dd75-bb27-5579e23c5348@oracle.com">Tested
      with tier1-tier3 hotspot and jdk tests and JCK api/java_security
      tests.  For the first few rounds of testing, I kept the old native
      privileged stack and compared the results of the old and new
      implementations for each getContext call, which did catch some
      early bugs.  The changes were also examined by internal security
      experts and run through additional internal security tests.
      <br>
      <br>
      The improvement on this [1] doPrivileged microbenchmark is
      approximate 50x.
      <br>
      <br>
      There is no attempt to optimize getContext() or security
      permission checks in this change, however, this is intended to be
      a first step towards other possible improvements, for example
      those proposed here [2].
      <br>
      <br>
    </blockquote>
    <br>
    FYI.  Sean and I also did some experiment to replace
    JVM_GetStackAccessControlContext with StackWalker some time ago. 
    Another potential area to move the code from VM to Java for the
    future as David explored and probably involves  performance work in
    the stack walker.<br>
    <br>
    Mandy<br>
  </body>
</html>