Re: [concurrency-interest] RFR: 8065804: JEP 171: Clarifications/corrections for fence intrinsics

2014-12-09 Thread David Holmes
On 10/12/2014 4:15 AM, Martin Buchholz wrote: On Mon, Dec 8, 2014 at 8:35 PM, David Holmes wrote: So (as you say) with TSO you don't have a total order of stores if you read your own writes out of your own CPU's write buffer. However, my interpretation of "multiple-copy atomic" is that the in

Re: [concurrency-interest] RFR: 8065804: JEP171:Clarifications/corrections for fence intrinsics

2014-12-09 Thread Oleksandr Otenko
Yes, I read the part of that paper about IRIW. My thinking that the ordering of stores would be the more contentious point also appears about the same thing. In IRIW we have two parts of chain that's reasonable to expect to work: x=1 <-- sw -- r1=x <-- po -- r2=y y=1 <-- sw -- r3=y <-- po --

RE: [concurrency-interest] RFR: 8065804: JEP171:Clarifications/corrections for fence intrinsics

2014-12-09 Thread David Holmes
The "no known useful benefit" is based on the paper which states "we are not aware of any cases where IRIW arises as a natural programming idiom". I think your example would be written: Thread 1: x =1; storestore; y=1; Thread 2: r1 = y; r2 =x. Or more clearly, the most common pattern would be:

Re: RFR JDK-8066867: Add InputStream transferTo to transfer content to an OutputStream

2014-12-09 Thread Pavel Rappo
Apologies Patrick, that's me who misread you. I assume I had a mix of your reply, our recent conversation and David's question in my head. About your actual reply. That's probably a matter of taste, since nowhere else except for this particular method this thing is not used (in java.nio.file.Files

RE: [concurrency-interest] RFR: 8065804: JEP171:Clarifications/corrections for fence intrinsics

2014-12-09 Thread David Holmes
Yes you are right - forcing global visibility does ensure ordering. David -Original Message- From: Oleksandr Otenko [mailto:oleksandr.ote...@oracle.com] Sent: Wednesday, 10 December 2014 8:59 AM To: dhol...@ieee.org; Hans Boehm Cc: core-libs-dev; concurrency-inter...@cs.oswego.ed

Re: RFR JDK-8066867: Add InputStream transferTo to transfer content to an OutputStream

2014-12-09 Thread Patrick Reinhart
Hi Chris, > Am 09.12.2014 um 23:58 schrieb Chris Hegarty : > > >> On 9 Dec 2014, at 22:24, Pavel Rappo wrote: >> >> >>> 2) I would extract the buffer size to a constant as in the NIO Files class >> >> Patrick, we've discussed it already. Correct me if I wrong, but we came to >> the >> conclu

Re: [concurrency-interest] RFR: 8065804: JEP171:Clarifications/corrections for fence intrinsics

2014-12-09 Thread Oleksandr Otenko
I see it differently. The issue is ordering - the inability of non-TSO platforms enforce total order of independent stores. The first loads are also independent and their ordering can neither be enforced, nor detected. But the following load can detect the lack of total ordering of stores and l

Re: RFR JDK-8066867: Add InputStream transferTo to transfer content to an OutputStream

2014-12-09 Thread Chris Hegarty
> On 9 Dec 2014, at 22:24, Pavel Rappo wrote: > > >> 2) I would extract the buffer size to a constant as in the NIO Files class > > Patrick, we've discussed it already. Correct me if I wrong, but we came to the > conclusion that there's not enough evidence to support the need for this > metho

Re: RFR JDK-8066867: Add InputStream transferTo to transfer content to an OutputStream

2014-12-09 Thread Patrick Reinhart
Hi Pavel, >> 2) I would extract the buffer size to a constant as in the NIO Files class > I may expressed myself not clear in my comment. I just wanted to point out, if the buffer size may should be extracted to a private static constant. The java.nio.file.Files class was meant to be an exampl

Re: RFR JDK-8066867: Add InputStream transferTo to transfer content to an OutputStream

2014-12-09 Thread Pavel Rappo
> In the transferTo then transferred needs to be a long. > „transferred“ should be a long instead of int Good catch, guys! > ...the method names are inconsistent (the methods in lower case with embedded > underscores) Fixed. Updated webrev: http://cr.openjdk.java.net/~prappo/8066867/webrev.01

Re: RFR JDK-8066867: Add InputStream transferTo to transfer content to an OutputStream

2014-12-09 Thread Pavel Rappo
> 2) I would extract the buffer size to a constant as in the NIO Files class Patrick, we've discussed it already. Correct me if I wrong, but we came to the conclusion that there's not enough evidence to support the need for this method. -Pavel

Re: [concurrency-interest] RFR: 8065804: JEP171:Clarifications/corrections for fence intrinsics

2014-12-09 Thread Oleksandr Otenko
In that case I must say I can't see why you mentioned "no known useful benefit". The known useful benefit from ordering reads can be seen here: store in one order: Thread 1: x=1 y=1 load in reverse order: Thread 2: r1=y; r2=x; This is a common pattern, so ordering loads is already useful. Here

RE: [concurrency-interest] RFR: 8065804: JEP171:Clarifications/corrections for fence intrinsics

2014-12-09 Thread David Holmes
In this case the issue is not ordering per-se (which is what dependencies help with) but global visibility. After performing the first read each thread must ensure that its second read will return what the other thread saw for the first read - hence a full dmb/sync between the reads; or generalizin

Re: [concurrency-interest] RFR: 8065804: JEP171:Clarifications/corrections for fence intrinsics

2014-12-09 Thread Oleksandr Otenko
Yes, I do understand the reader needs barriers, too. I guess I was wondering more why the reader would need something stronger than what dependencies etc could enforce. I guess I'll read what Martin forwarded first. Alex On 09/12/2014 21:37, David Holmes wrote: See my earlier response to Mar

RE: [concurrency-interest] RFR: 8065804: JEP171:Clarifications/corrections for fence intrinsics

2014-12-09 Thread David Holmes
See my earlier response to Martin. The reader has to force a consistent view of memory - the writer can't as the write escapes before it can issue the barrier. David -Original Message- From: concurrency-interest-boun...@cs.oswego.edu [mailto:concurrency-interest-boun...@cs.oswego.edu]O

RE: [concurrency-interest] RFR: 8065804: JEP171:Clarifications/corrections for fence intrinsics

2014-12-09 Thread David Holmes
The "thorn" is the need for the barriers in the readers not the writers. (or perhaps as well as the writers in some cases - that is part of the problem.) David -Original Message- From: concurrency-interest-boun...@cs.oswego.edu [mailto:concurrency-interest-boun...@cs.oswego.edu]On Beha

Re: [concurrency-interest] RFR: 8065804: JEP171:Clarifications/corrections for fence intrinsics

2014-12-09 Thread Oleksandr Otenko
Is the thorn the many allowed outcomes, or the single disallowed outcome? (eg order consistency is too strict for stores with no synchronizes-with between them?) Alex On 26/11/2014 02:10, David Holmes wrote: Hi Hans, Given IRIW is a thorn in everyone's side and has no known useful benefit,

Re: [concurrency-interest] RFR: 8065804: JEP171:Clarifications/corrections for fence intrinsics

2014-12-09 Thread Martin Buchholz
On Tue, Dec 9, 2014 at 12:04 PM, Oleksandr Otenko wrote: > On 26/11/2014 02:04, Hans Boehm wrote: >> >> To be concrete here, on Power, loads can normally be ordered by an address >> dependency or light-weight fence (lwsync). However, neither is enough to >> prevent the questionable outcome for IR

Re: [concurrency-interest] RFR: 8065804: JEP171:Clarifications/corrections for fence intrinsics

2014-12-09 Thread Oleksandr Otenko
On 26/11/2014 02:04, Hans Boehm wrote: To be concrete here, on Power, loads can normally be ordered by an address dependency or light-weight fence (lwsync). However, neither is enough to prevent the questionable outcome for IRIW, since it doesn't ensure that the stores in T1 and T2 will be mad

Re: RFR: 8065172: More core reflection final and volatile annotations

2014-12-09 Thread Joel Borggrén-Franck
Hi Martin, Looks good. I also think the code is easier to read now. Thanks for switching back to a version with racy but correct initialization. As Peter wrote, there are many cases where we don’t guarantee == on Type instances. I can see why that would be desirable, but that is a separate dis

Re: [concurrency-interest] RFR: 8065804: JEP 171: Clarifications/corrections for fence intrinsics

2014-12-09 Thread Martin Buchholz
On Mon, Dec 8, 2014 at 8:35 PM, David Holmes wrote: >> So (as you say) with TSO you don't have a total order of stores if you >> read your own writes out of your own CPU's write buffer. However, my >> interpretation of "multiple-copy atomic" is that the initial >> publishing thread can choose to

Re: [concurrency-interest] RFR: 8065804: JEP 171: Clarifications/corrections for fence intrinsics

2014-12-09 Thread Martin Buchholz
On Mon, Dec 8, 2014 at 8:51 PM, David Holmes wrote: > Then please point me to the common industry definition of it because I > couldn't find anything definitive. And as you state yourself above one > definition of it - the corresponding C11 fence - does not in fact have the > same semantics! I c

Re: RFR: 8065172: More core reflection final and volatile annotations

2014-12-09 Thread Martin Buchholz
Oops sorry - classic mistake of forgetting to hg qrefresh before publishing. On Tue, Dec 9, 2014 at 3:23 AM, Paul Sandoz wrote: > On Dec 8, 2014, at 11:47 PM, Martin Buchholz wrote: >> Webrev updated. > > Not quite sure how the webrev was updated: > > > http://cr.openjdk.java.net/~martin/webr

Re: RFR JDK-8066867: Add InputStream transferTo to transfer content to an OutputStream

2014-12-09 Thread Chris Hegarty
On 9 Dec 2014, at 16:17, David M. Lloyd wrote: > On 12/09/2014 09:47 AM, Pavel Rappo wrote: >> Hi everyone, >> >> Could you please review my change for JDK-8066867? >> >> http://cr.openjdk.java.net/~prappo/8066867/webrev.00/ > > In the NIO version of this method, it accepts a 'long' parameter

Re: RFR JDK-8066867: Add InputStream transferTo to transfer content to an OutputStream

2014-12-09 Thread Patrick Reinhart
Hi Pavel, 1) „transferred“ should be a long instead of int 2) I would extract the buffer size to a constant as in the NIO Files class -Patrick > Hi everyone, > > Could you please review my change for JDK-8066867? > > http://cr.openjdk.java.net/~prappo/8066867/webrev.00/ > > -

Re: RFR JDK-8066867: Add InputStream transferTo to transfer content to an OutputStream

2014-12-09 Thread David M. Lloyd
On 12/09/2014 09:47 AM, Pavel Rappo wrote: Hi everyone, Could you please review my change for JDK-8066867? http://cr.openjdk.java.net/~prappo/8066867/webrev.00/ In the NIO version of this method, it accepts a 'long' parameter which indicates how many bytes should be transferred (similar to s

Re: [9] Review request : JDK-8066798: TEST_RFR: Make java/lang/invoke/LFCaching tests use lib/testlibrary/jdk/testlibrary/TimeLimitedRunner.java to define their number of iterations

2014-12-09 Thread mark . reinhold
2014/12/9 12:51 -0800, konstantin.she...@oracle.com: > Please review the test enhancement > https://bugs.openjdk.java.net/browse/JDK-8066798 The synopsis of this issue begins with "TEST_RFR". What does that even mean? Why do we need it? I'm concerned that the proliferation of "TEST*" prefixes

Re: RFR JDK-8066867: Add InputStream transferTo to transfer content to an OutputStream

2014-12-09 Thread Alan Bateman
On 09/12/2014 15:47, Pavel Rappo wrote: Hi everyone, Could you please review my change for JDK-8066867? http://cr.openjdk.java.net/~prappo/8066867/webrev.00/ In the transferTo then transferred needs to be a long. I think I would re-work the loop to make it a bit more readable but that is a so

RFR JDK-8066867: Add InputStream transferTo to transfer content to an OutputStream

2014-12-09 Thread Pavel Rappo
Hi everyone, Could you please review my change for JDK-8066867? http://cr.openjdk.java.net/~prappo/8066867/webrev.00/ The task originated from discussion: http://mail.openjdk.java.net/pipermail/core-libs-dev/2014-November/029650

Re: RFR 8066397 Remove network-related seed initialization code in ThreadLocal/SplittableRandom

2014-12-09 Thread Peter Levart
Hi Doug, On 12/06/2014 05:14 PM, Doug Lea wrote: On 12/04/2014 07:22 PM, Doug Lea wrote: Because Random, SplittableRandom, and ThreadLocalRandom all use the same basic approach, they can/should use the same mechanism. In other words, to establish a common default-constructor-seed generator i

Re: [9] Review request : JDK-8066798: TEST_RFR: Make java/lang/invoke/LFCaching tests use lib/testlibrary/jdk/testlibrary/TimeLimitedRunner.java to define their number of iterations

2014-12-09 Thread Igor Ignatyev
on last thing to think about: does it make sense to move 'if (!run.passed) { ... } else { ... }' code into TestRun class? On 12/09/2014 04:03 PM, Konstantin Shefov wrote: Igor, I changed the webrev: http://cr.openjdk.java.net/~kshefov/8066798/webrev.02 -Konstantin On 09.12.2014 15:03, Igor

Re: [9] Review request : JDK-8066798: TEST_RFR: Make java/lang/invoke/LFCaching tests use lib/testlibrary/jdk/testlibrary/TimeLimitedRunner.java to define their number of iterations

2014-12-09 Thread Konstantin Shefov
Igor, I changed the webrev: http://cr.openjdk.java.net/~kshefov/8066798/webrev.02 -Konstantin On 09.12.2014 15:03, Igor Ignatyev wrote: Konstantin, well, now I don't see any points to have a lambda. you can simple make it a method in TestRunInfo and rename TestRunInfo into TestRun. 174 t

Re: [9, 8u40] RFR (XXS): 8066746: MHs.explicitCastArguments does incorrect type checks for VarargsCollector

2014-12-09 Thread Vladimir Ivanov
John, Paul, thanks for the reviews! Looks ok. Curiously, is there a reason why you chose to use MH.invokeWithArguments rather than MH.invoke/invokeExact? No particular reason. Just didn't want to want to spend time tuning call site for signature polymorphic method. Best regards, Vladimir Iv

Re: [9, 8u40] RFR (XXS): 8066746: MHs.explicitCastArguments does incorrect type checks for VarargsCollector

2014-12-09 Thread Paul Sandoz
On Dec 9, 2014, at 12:47 AM, Vladimir Ivanov wrote: > http://cr.openjdk.java.net/~vlivanov/8066746/webrev.00/ > https://bugs.openjdk.java.net/browse/JDK-8066746 > Looks ok. Curiously, is there a reason why you chose to use MH.invokeWithArguments rather than MH.invoke/invokeExact? Paul. >

Re: [9] Review request : JDK-8066798: TEST_RFR: Make java/lang/invoke/LFCaching tests use lib/testlibrary/jdk/testlibrary/TimeLimitedRunner.java to define their number of iterations

2014-12-09 Thread Igor Ignatyev
Konstantin, well, now I don't see any points to have a lambda. you can simple make it a method in TestRunInfo and rename TestRunInfo into TestRun. 174 t.printStackTrace(); 175 System.err.println("FAILED"); you don't print exception me

Re: RFR: 8065172: More core reflection final and volatile annotations

2014-12-09 Thread Paul Sandoz
On Dec 8, 2014, at 11:47 PM, Martin Buchholz wrote: > Webrev updated. Not quite sure how the webrev was updated: http://cr.openjdk.java.net/~martin/webrevs/openjdk9/core-reflection-more-safety/ But the patch file http://cr.openjdk.java.net/~martin/webrevs/openjdk9/core-reflection-more-s

Re: [9] Review request : JDK-8066798: TEST_RFR: Make java/lang/invoke/LFCaching tests use lib/testlibrary/jdk/testlibrary/TimeLimitedRunner.java to define their number of iterations

2014-12-09 Thread Konstantin Shefov
Hi Igor Thanks for reviewing. I have made some changes, added a separate class to store the variables. "doneIterations" is not local for lambda, it is incremented after each lambda execution. Also I changed to catch Exception. http://cr.openjdk.java.net/~kshefov/8066798/webrev.01 -Konstantin

Re: [9] Review request : JDK-8066798: TEST_RFR: Make java/lang/invoke/LFCaching tests use lib/testlibrary/jdk/testlibrary/TimeLimitedRunner.java to define their number of iterations

2014-12-09 Thread Igor Ignatyev
Hi Konstantin, 0. I don't like static variables which you introduced. were I you, I'd create a class which encapsulates them. + it looks like - doneIterations is a local for the lambda - totalIterations is almost affectively final - testCounter/failCounter are just informative variable and c

[9] Review request : JDK-8066798: TEST_RFR: Make java/lang/invoke/LFCaching tests use lib/testlibrary/jdk/testlibrary/TimeLimitedRunner.java to define their number of iterations

2014-12-09 Thread Konstantin Shefov
Hello, Please review the test enhancement https://bugs.openjdk.java.net/browse/JDK-8066798 Webrev is http://cr.openjdk.java.net/~kshefov/8066798/webrev.00 Test has been modified to use lib/testlibrary/jdk/testlibrary/TimeLimitedRunner.java class to define its number of iterations depending o