RFR (S) 8182554: Code for os::random() assumes long is 32 bits
coleen.phillimore at oracle.com
coleen.phillimore at oracle.com
Wed Jun 28 18:44:03 UTC 2017
Hi Thomas, Thanks for reviewing this.
On 6/28/17 1:35 PM, Thomas Stüfe wrote:
> Hi Coleen,
>
> long->int: this makes sense.
> thread safety: So, if I understand this correctly, before it could
> happen that two threads calling at the same time would return the same
> value from the random sequence? Your patch seems fine and solves this.
Yes, that would be the case. It's highly unlikely now since most
os::random calls are at the beginning and the Symbols call during Symbol
creation while holding the SymbolTable_lock.
Thanks!
Coleen
>
> Kind Regards, Thomas
>
> On Wed, Jun 28, 2017 at 5:46 PM, <coleen.phillimore at oracle.com
> <mailto:coleen.phillimore at oracle.com>> wrote:
>
> Summary: And make updating the _rand_seed thread safe.
>
> See bug for more details.
>
> open webrev at
> http://cr.openjdk.java.net/~coleenp/8182554.01/webrev
> <http://cr.openjdk.java.net/%7Ecoleenp/8182554.01/webrev>
> bug link https://bugs.openjdk.java.net/browse/JDK-8182554
> <https://bugs.openjdk.java.net/browse/JDK-8182554>
>
> Tested with JPRT and performance tested addition of cas in
> os::random call (no regressions). The only thing that uses
> os::random more than like once is Symbol creation.
>
> Thanks,
> Coleen
>
>
More information about the hotspot-dev
mailing list