12 RFR(M) 8214583: AccessController.getContext may return wrong value after JDK-8212605

2018-12-14 Thread dean . long
https://bugs.openjdk.java.net/browse/JDK-8214583 http://cr.openjdk.java.net/~dlong/8214583/webrev This change includes two new regression test that demonstrate the problem, and a fix that allows the tests to pass. The problem happens when the JIT compiler's escape analysis eliminates the allo

Re: 12 RFR(M) 8214583: AccessController.getContext may return wrong value after JDK-8212605

2018-12-15 Thread Claes Redestad
Hi Dean, to avoid escape analysis-eliminated allocations in the past @DontInline has been sufficient. This means a simpler patch (no changes to native code needed - added assertions notwithstanding) and passes your tests with C2 (it'd concern me if Graal's EA sees through this trick, as it might

Re: 12 RFR(M) 8214583: AccessController.getContext may return wrong value after JDK-8212605

2018-12-16 Thread David Holmes
On 15/12/2018 10:59 am, dean.l...@oracle.com wrote: https://bugs.openjdk.java.net/browse/JDK-8214583 http://cr.openjdk.java.net/~dlong/8214583/webrev This change includes two new regression test that demonstrate the problem, and a fix that allows the tests to pass. The problem happens when th

Re: 12 RFR(M) 8214583: AccessController.getContext may return wrong value after JDK-8212605

2018-12-16 Thread dean . long
On 12/16/18 4:06 PM, David Holmes wrote: On 15/12/2018 10:59 am, dean.l...@oracle.com wrote: https://bugs.openjdk.java.net/browse/JDK-8214583 http://cr.openjdk.java.net/~dlong/8214583/webrev This change includes two new regression test that demonstrate the problem, and a fix that allows the te

Re: 12 RFR(M) 8214583: AccessController.getContext may return wrong value after JDK-8212605

2018-12-16 Thread David Holmes
On 17/12/2018 12:49 pm, dean.l...@oracle.com wrote: On 12/16/18 4:06 PM, David Holmes wrote: On 15/12/2018 10:59 am, dean.l...@oracle.com wrote: https://bugs.openjdk.java.net/browse/JDK-8214583 http://cr.openjdk.java.net/~dlong/8214583/webrev This change includes two new regression test that d

Re: 12 RFR(M) 8214583: AccessController.getContext may return wrong value after JDK-8212605

2018-12-16 Thread dean . long
On 12/16/18 7:03 PM, David Holmes wrote: On 17/12/2018 12:49 pm, dean.l...@oracle.com wrote: On 12/16/18 4:06 PM, David Holmes wrote: On 15/12/2018 10:59 am, dean.l...@oracle.com wrote: https://bugs.openjdk.java.net/browse/JDK-8214583 http://cr.openjdk.java.net/~dlong/8214583/webrev This chan

Re: 12 RFR(M) 8214583: AccessController.getContext may return wrong value after JDK-8212605

2018-12-16 Thread dean . long
Unfortunately, I don't think @DontInline on an empty method is sufficient here.  If other code is relying on @DontInline for the same purpose then we might need to reexamine that code.  My understanding from discussing with other compiler engineers is that using a native method is the safest techn

Re: 12 RFR(M) 8214583: AccessController.getContext may return wrong value after JDK-8212605

2018-12-16 Thread dean . long
On 12/16/18 7:39 PM, dean.l...@oracle.com wrote: On 12/16/18 7:03 PM, David Holmes wrote: On 17/12/2018 12:49 pm, dean.l...@oracle.com wrote: On 12/16/18 4:06 PM, David Holmes wrote: On 15/12/2018 10:59 am, dean.l...@oracle.com wrote: https://bugs.openjdk.java.net/browse/JDK-8214583 http://cr

Re: 12 RFR(M) 8214583: AccessController.getContext may return wrong value after JDK-8212605

2018-12-16 Thread Claes Redestad
Fair enough, I wasn't aware EA was looking beyond the inlined code like this (which means it can't be "dead" or the JIT might see through the trick at some point). I've skimmed the existing usages in the JDK and can't find anything that seems to be dependent on DontInline defeating EA - maybe ther

Re: 12 RFR(M) 8214583: AccessController.getContext may return wrong value after JDK-8212605

2018-12-16 Thread dean . long
On 12/16/18 9:52 PM, Claes Redestad wrote: Either way, it might be nice to have a more explicit facility for this in a future release, as David suggested. Say an @Escaping local variable/parameter annotation. I agree.  I suggested @Escapes or @StackWalkable in JDK-8214585. @Escaping or @Sta

Re: 12 RFR(M) 8214583: AccessController.getContext may return wrong value after JDK-8212605

2018-12-16 Thread dean . long
On 12/16/18 9:52 PM, Claes Redestad wrote: Fair enough, I wasn't aware EA was looking beyond the inlined code like this (which means it can't be "dead" or the JIT might see through the trick at some point). I've skimmed the existing usages in the JDK and can't find anything that seems to be depen

Re: 12 RFR(M) 8214583: AccessController.getContext may return wrong value after JDK-8212605

2018-12-17 Thread Mandy Chung
This looks okay to me. Mandy On 12/14/18 4:59 PM, dean.l...@oracle.com wrote: https://bugs.openjdk.java.net/browse/JDK-8214583 http://cr.openjdk.java.net/~dlong/8214583/webrev This change includes two new regression test that demonstrate the problem, and a fix that allows the tests to pass.

Re: 12 RFR(M) 8214583: AccessController.getContext may return wrong value after JDK-8212605

2018-12-17 Thread dean . long
Thanks Mandy. dl On 12/17/18 2:55 PM, Mandy Chung wrote: This looks okay to me. Mandy On 12/14/18 4:59 PM, dean.l...@oracle.com wrote: https://bugs.openjdk.java.net/browse/JDK-8214583 http://cr.openjdk.java.net/~dlong/8214583/webrev This change includes two new regression test that demonstr

Re: 12 RFR(M) 8214583: AccessController.getContext may return wrong value after JDK-8212605

2018-12-18 Thread dean . long
David, can I list you as a reviewer? dl On 12/16/18 8:47 PM, dean.l...@oracle.com wrote: On 12/16/18 7:39 PM, dean.l...@oracle.com wrote: On 12/16/18 7:03 PM, David Holmes wrote: On 17/12/2018 12:49 pm, dean.l...@oracle.com wrote: On 12/16/18 4:06 PM, David Holmes wrote: On 15/12/2018 10:59

Re: 12 RFR(M) 8214583: AccessController.getContext may return wrong value after JDK-8212605

2018-12-18 Thread dean . long
Claes, can I list you as a reviewer? dl On 12/16/18 9:52 PM, Claes Redestad wrote: Fair enough, I wasn't aware EA was looking beyond the inlined code like this (which means it can't be "dead" or the JIT might see through the trick at some point). I've skimmed the existing usages in the JDK and

Re: 12 RFR(M) 8214583: AccessController.getContext may return wrong value after JDK-8212605

2018-12-18 Thread David Holmes
On 19/12/2018 6:52 am, dean.l...@oracle.com wrote: David, can I list you as a reviewer? No, sorry, I only commented on the general issue. David dl On 12/16/18 8:47 PM, dean.l...@oracle.com wrote: On 12/16/18 7:39 PM, dean.l...@oracle.com wrote: On 12/16/18 7:03 PM, David Holmes wrote: On