Re: RFR: 8286850: [macos] Add support for signing user provided app image [v2]

2022-06-06 Thread Alexander Matveev
Hi Michael,

See below.

On Jun 5, 2022, at 5:58 PM, Michael Hall 
mailto:mik3h...@gmail.com>> wrote:


./build/*/images/jdk/bin/jpackage --app-image 
~/HalfPipe/halfpipe_jpkg/outputdir/HalfPipe.app --mac-sign 
--mac-signing-key-user-name "Developer ID Application: Michael Hall 
(5X6BXQB3Q7)"
Bundler Mac DMG Package skipped because of a configuration problem: When using 
an external app image you must specify the app name.
Advice to fix: Set the app name via the -name CLI flag, the 
fx:application/@name ANT attribute, or via the 'appName' bundler argument.

./build/*/images/jdk/bin/jpackage --app-image 
~/HalfPipe/halfpipe_jpkg/outputdir/HalfPipe.app --mac-sign 
--mac-signing-key-user-name "Developer ID Application: Michael Hall 
(5X6BXQB3Q7)" --name HalfPipe
Warning: Using unsigned app-image to build signed dmg.

*** The app-image was actually a signed one. I’m not sure that matters. Also 
since this would normally be my intention should there be a warning? ***

codesign -v --verbose=4 ~/HalfPipe/halfpipe_jpkg/outputdir/HalfPipe.app
/Users/mjh/HalfPipe/halfpipe_jpkg/outputdir/HalfPipe.app: valid on disk
/Users/mjh/HalfPipe/halfpipe_jpkg/outputdir/HalfPipe.app: satisfies its 
Designated Requirement

*** Seems successful ***

Thanks again.


Possibly my mistake somehow but codesign seems to flag something if the 
application is actually unsigned.

${PACKAGER} \
--verbose \
   --add-modules java.desktop,java.prefs,java.se \
   --type app-image \
--input ./input \
--app-version 1.0  \
--name BlackJack\ Blastoff_Unsigned \
--main-jar bjb.jar \
--main-class org.bjb.BlackJackApp \
--java-options '-Xmx1024m -XX:+UseG1GC -XX:MaxGCPauseMillis=50  
-Dapple.laf.useScreenMenuBar=true 
-Dcom.apple.mrj.application.apple.menu.about.name=BlackjackBlastoff 
-Dapple.awt.application.name=Blackjack\ Blastoff’

[19:41:02.231] Creating app package: BlackJack Blastoff_Unsigned.app in 
/Users/mjh/Blackjack_Blastoff/bjb/bjb_jpkg
[19:41:05.516] Command [PID: -1]:
   jlink --output /Users/mjh/Blackjack_Blastoff/bjb/bjb_jpkg/BlackJack 
Blastoff_Unsigned.app/Contents/runtime/Contents/Home --module-path 
/Library/Java/JavaVirtualMachines/jdk-18.jdk/Contents/Home/jmods --add-modules 
java.desktop,java.prefs,java.se --strip-native-commands 
--strip-debug --no-man-pages --no-header-files
[19:41:05.517] Output:

[19:41:05.518] Returned: 0

[19:41:05.545] Using default package resource JavaApp.icns [icon] (add 
BlackJack Blastoff_Unsigned.icns to the resource-dir to customize).
[19:41:05.547] Preparing Info.plist: 
/Users/mjh/Blackjack_Blastoff/bjb/bjb_jpkg/BlackJack 
Blastoff_Unsigned.app/Contents/Info.plist.
[19:41:05.547] Using default package resource Info-lite.plist.template 
[Application Info.plist] (add Info.plist to the resource-dir to customize).
[19:41:05.550] Using default package resource Runtime-Info.plist.template [Java 
Runtime Info.plist] (add Runtime-Info.plist to the resource-dir to customize).
[19:41:05.551] Succeeded in building Mac Application Image package

./build/*/images/jdk/bin/jpackage --app-image 
~/Blackjack_Blastoff/bjb/bjb_jpkg/BlackJack\ Blastoff_Unsigned.app --mac-sign 
--mac-signing-key-user-name "Developer ID Application: Michael Hall 
(5X6BXQB3Q7)" --name BlackJack_Blastoff_Unsigned
Warning: Using unsigned app-image to build signed dmg.

open BlackJack_Blastoff_Unsigned-1.0.dmg

codesign -v --verbose=4 /Volumes/BlackJack_Blastoff_Unsigned/BlackJack\ 
Blastoff_Unsigned.app
/Volumes/BlackJack_Blastoff_Unsigned/BlackJack Blastoff_Unsigned.app: code has 
no resources but signature indicates they must be present
This is correct. You generated unsigned application image and then package it 
into DMG with signing enabled. In this case we will not sign app image. Only 
installer package will get signed and it applies only to PKG. DMG does not have 
any signing. This is was same behavior as before JDK-8286850.

You need to sign app image first:
./build/*/images/jdk/bin/jpackage --type app-image --app-image 
~/Blackjack_Blastoff/bjb/bjb_jpkg/BlackJack\ Blastoff_Unsigned.app --mac-sign 
--mac-signing-key-user-name "Developer ID Application: Michael Hall 
(5X6BXQB3Q7)" --name BlackJack_Blastoff_Unsigned

Then run command to generate DMG or PKG. Enable signing if you want PKG to be 
signed. No need to specify it for DMG if you generating DMG from predefined 
application image.

As for "code has no resources but signature indicates they must be present” I 
believe it is due to JDK-8277493 and it was fixed in JDK 19.


I am using the installed jdk18 to create the app-image. Would that need to be 
done with the same jdk with the changes applied?
Yes, if you need to sign app image after post processing it should be generated 
with JDK version which contains JDK-8286850 fix. Unless something will change 
jpackage from JDK 20 should able to sign app image generated by JDK 19, but JDK 
19 jpackage will not able to sign app image generated by JDK 18.

This is do to additional values are stored 

Re: RFR: 8283667: [vectorapi] Vectorization for masked load with IOOBE with predicate feature [v5]

2022-06-06 Thread Xiaohong Gong
On Mon, 6 Jun 2022 15:41:06 GMT, Paul Sandoz  wrote:

> Looks good. As a follow on PR I think it would be useful to add constants 
> `OFFSET_IN_RANGE` and `OFFSET_OUT_OF_RANGE`, then it becomes much clearer in 
> source and you can drop the `/* offsetInRange */` comment on the argument.

Hi @PaulSandoz , thanks for the advice! I'v rebased the codes and added these 
two constants in the latest patch. Thanks again for the review!

-

PR: https://git.openjdk.java.net/jdk/pull/8035


Re: RFR: 8283667: [vectorapi] Vectorization for masked load with IOOBE with predicate feature [v6]

2022-06-06 Thread Xiaohong Gong
> Currently the vector load with mask when the given index happens out of the 
> array boundary is implemented with pure java scalar code to avoid the IOOBE 
> (IndexOutOfBoundaryException). This is necessary for architectures that do 
> not support the predicate feature. Because the masked load is implemented 
> with a full vector load and a vector blend applied on it. And a full vector 
> load will definitely cause the IOOBE which is not valid. However, for 
> architectures that support the predicate feature like SVE/AVX-512/RVV, it can 
> be vectorized with the predicated load instruction as long as the indexes of 
> the masked lanes are within the bounds of the array. For these architectures, 
> loading with unmasked lanes does not raise exception.
> 
> This patch adds the vectorization support for the masked load with IOOBE 
> part. Please see the original java implementation (FIXME: optimize):
> 
> 
>   @ForceInline
>   public static
>   ByteVector fromArray(VectorSpecies species,
>byte[] a, int offset,
>VectorMask m) {
>   ByteSpecies vsp = (ByteSpecies) species;
>   if (offset >= 0 && offset <= (a.length - species.length())) {
>   return vsp.dummyVector().fromArray0(a, offset, m);
>   }
> 
>   // FIXME: optimize
>   checkMaskFromIndexSize(offset, vsp, m, 1, a.length);
>   return vsp.vOp(m, i -> a[offset + i]);
>   }
> 
> Since it can only be vectorized with the predicate load, the hotspot must 
> check whether the current backend supports it and falls back to the java 
> scalar version if not. This is different from the normal masked vector load 
> that the compiler will generate a full vector load and a vector blend if the 
> predicate load is not supported. So to let the compiler make the expected 
> action, an additional flag (i.e. `usePred`) is added to the existing 
> "loadMasked" intrinsic, with the value "true" for the IOOBE part while 
> "false" for the normal load. And the compiler will fail to intrinsify if the 
> flag is "true" and the predicate load is not supported by the backend, which 
> means that normal java path will be executed.
> 
> Also adds the same vectorization support for masked:
>  - fromByteArray/fromByteBuffer
>  - fromBooleanArray
>  - fromCharArray
> 
> The performance for the new added benchmarks improve about `1.88x ~ 30.26x` 
> on the x86 AVX-512 system:
> 
> Benchmark  before   After  Units
> LoadMaskedIOOBEBenchmark.byteLoadArrayMaskIOOBE   737.542 1387.069 ops/ms
> LoadMaskedIOOBEBenchmark.doubleLoadArrayMaskIOOBE 118.366  330.776 ops/ms
> LoadMaskedIOOBEBenchmark.floatLoadArrayMaskIOOBE  233.832 6125.026 ops/ms
> LoadMaskedIOOBEBenchmark.intLoadArrayMaskIOOBE233.816 7075.923 ops/ms
> LoadMaskedIOOBEBenchmark.longLoadArrayMaskIOOBE   119.771  330.587 ops/ms
> LoadMaskedIOOBEBenchmark.shortLoadArrayMaskIOOBE  431.961  939.301 ops/ms
> 
> Similar performance gain can also be observed on 512-bit SVE system.

Xiaohong Gong has updated the pull request with a new target base due to a 
merge or a rebase. The pull request now contains seven commits:

 - Add constant OFFSET_IN_RANGE and OFFSET_OUT_OF_RANGE
 - Merge branch 'jdk:master' into JDK-8283667
 - Merge branch 'jdk:master' into JDK-8283667
 - Use integer constant for offsetInRange all the way through
 - Rename "use_predicate" to "needs_predicate"
 - Rename the "usePred" to "offsetInRange"
 - 8283667: [vectorapi] Vectorization for masked load with IOOBE with predicate 
feature

-

Changes: https://git.openjdk.java.net/jdk/pull/8035/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk=8035=05
  Stats: 453 lines in 44 files changed: 174 ins; 21 del; 258 mod
  Patch: https://git.openjdk.java.net/jdk/pull/8035.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/8035/head:pull/8035

PR: https://git.openjdk.java.net/jdk/pull/8035


Re: RFR: 8287663 Add a regression test for JDK-8287073

2022-06-06 Thread Ioi Lam
On Mon, 6 Jun 2022 23:07:06 GMT, Ioi Lam  wrote:

> We should try to consolidate these test cases to improve maintainability.

I filed [JDK-8287185](https://bugs.openjdk.org/browse/JDK-8287185)

-

PR: https://git.openjdk.java.net/jdk/pull/8993


Re: RFR: 8286850: [macos] Add support for signing user provided app image [v2]

2022-06-06 Thread Alexander Matveev
Hi Michael,

Printing "Warning: Using unsigned app-image to build signed dmg.” with signed 
application should be fixed with JDK-8286850. Did you reproduce it on build 
containing JDK-8286850?

Thanks,
Alexander

> On Jun 5, 2022, at 3:06 PM, Michael Hall  wrote:
> 
> 
> 
>> On Jun 5, 2022, at 8:56 AM, Michael Hall  wrote:
>> 
>> 
>> Fwiw, I was going to take a look at this but my build failed.
>> 
>> === Output from failing command(s) repeated here ===
>> * For target support_native_java.desktop_liblcms_cmstypes.o:
>> /Users/mjh/Documents/GitHub/jdk/src/java.desktop/share/native/liblcms/cmstypes.c:3441:132:
>>  error: parameter 'SizeOfTag' set but not used 
>> [-Werror,-Wunused-but-set-parameter]
>> void *Type_ProfileSequenceId_Read(struct _cms_typehandler_struct* self, 
>> cmsIOHANDLER* io, cmsUInt32Number* nItems, cmsUInt32Number SizeOfTag)
>>  
>> ^
>> /Users/mjh/Documents/GitHub/jdk/src/java.desktop/share/native/liblcms/cmstypes.c:5137:125:
>>  error: parameter 'SizeOfTag' set but not used 
>> [-Werror,-Wunused-but-set-parameter]
>> void *Type_Dictionary_Read(struct _cms_typehandler_struct* self, 
>> cmsIOHANDLER* io, cmsUInt32Number* nItems, cmsUInt32Number SizeOfTag)
>>  
>>  ^
>> 2 errors generated.
>> 
>> 
>> OS/X 12.4
>> 
>> 2.4 GHz Quad-Core Intel Core i5
>> 
>> If I should post that somewhere else let me know.
>> 
> 
> Again fwiw, I commented out references to SizeOfTag in the two methods and 
> got a good build.
> 
> ./build/*/images/jdk/bin/jpackage --app-image 
> ~/HalfPipe/halfpipe_jpkg/outputdir/HalfPipe.app --mac-sign 
> --mac-signing-key-user-name "Developer ID Application: Michael Hall 
> (5X6BXQB3Q7)"
> Bundler Mac DMG Package skipped because of a configuration problem: When 
> using an external app image you must specify the app name. 
> Advice to fix: Set the app name via the -name CLI flag, the 
> fx:application/@name ANT attribute, or via the 'appName' bundler argument.
> 
> ./build/*/images/jdk/bin/jpackage --app-image 
> ~/HalfPipe/halfpipe_jpkg/outputdir/HalfPipe.app --mac-sign 
> --mac-signing-key-user-name "Developer ID Application: Michael Hall 
> (5X6BXQB3Q7)" --name HalfPipe
> Warning: Using unsigned app-image to build signed dmg.
> 
> *** The app-image was actually a signed one. I’m not sure that matters. Also 
> since this would normally be my intention should there be a warning? ***
> 
> codesign -v --verbose=4 ~/HalfPipe/halfpipe_jpkg/outputdir/HalfPipe.app
> /Users/mjh/HalfPipe/halfpipe_jpkg/outputdir/HalfPipe.app: valid on disk
> /Users/mjh/HalfPipe/halfpipe_jpkg/outputdir/HalfPipe.app: satisfies its 
> Designated Requirement
> 
> *** Seems successful ***
> 
> Thanks again.
> 



Re: JDK-8186958 - Behaviour of large values for numMapping in WeakHashMap.newWeakHashMap API

2022-06-06 Thread Stuart Marks

Hi Jai,

The error

java.lang.OutOfMemoryError: Java heap space

indicates that the VM really has run out of memory. Presumably if you increased the 
heap size, it would actually be able to allocate that memory. You might have to add 
the /othervm test directive and add JVM options to require a larger heap.


The table size must be a power of two, so the largest table size that will be 
allocated is 1 << 30 or 1073741824 as you noted. That will take about 8GB of heap 
(in the no-compressed-OOP case). That's not terribly large, but we might want to 
check to see if there are other tests that require that much memory.


As you also noted, WeakHashMap eagerly allocates its table whereas LinkedHashMap and 
HashMap do not. I think this is an acceptable behavior variation. Note that we had 
to avoid this case in WhiteboxResizeTest:


https://github.com/openjdk/jdk/blob/master/test/jdk/java/util/HashMap/WhiteBoxResizeTest.java#L167

We might have to make similar special cases here for WHM.

I don't think we need to document this behavior difference. More precisely: this 
kind of implementation variation doesn't need to be specified. In the future we 
might change WHM to allocate lazily.


The API should accommodate extremely large values of numMappings. Even if it's 
larger than 1 << 30 and the table size is allocated at 1 << 30, it's still possible 
to add numMappings mappings without resizing. (Memory permitting, of course.) Doing 
so will violate the load factor invariant, and it might result in more collisions 
than one would like, but it should still work.


I think we just need to decide whether we want to have a test that allocates this 
much memory, and if so, to apply the necessary settings to make sure the JVM has 
enough heap.


s'marks


On 6/6/22 12:01 AM, Jaikiran Pai wrote:
In a recent enhancement we added new APIs to construct LinkedHashMap, HashMap and 
WeakHashMap instances as part of https://bugs.openjdk.java.net/browse/JDK-8186958.


Since we missed adding tests for that change, I have been working on adding some 
basic tests for this change as part of 
https://bugs.openjdk.java.net/browse/JDK-8285405. The draft PR is here 
https://github.com/openjdk/jdk/pull/9036.


It's in draft state because it has uncovered an aspect of this change that we might 
have to address or document for these new APIs. Specifically, the tests I added now 
have a test which does the equivalent of:


// numMappings = 2147483647
var w = WeakHashMap.newWeakHashMap(Integer.MAX_VALUE);

Similar tests have been added for HashMap and LinkedHashMap too, but for the sake of 
this discussion, I'll focus on WeakHashMap. Running this code/test runs into:


test NewWeakHashMap.testNewWeakHashMapNonNegative(2147483647): failure
java.lang.OutOfMemoryError: Java heap space
     at java.base/java.util.WeakHashMap.newTable(WeakHashMap.java:194)
     at java.base/java.util.WeakHashMap.(WeakHashMap.java:221)
     at java.base/java.util.WeakHashMap.(WeakHashMap.java:238)
     at java.base/java.util.WeakHashMap.newWeakHashMap(WeakHashMap.java:1363)
     at NewWeakHashMap.testNewWeakHashMapNonNegative(NewWeakHashMap.java:69)


This exception happens with only WeakHashMap. LinkedHashMap and HashMap don't show 
this behaviour. It appears that WeakHashMap eagerly creates an large array (of 
length 1073741824 in this case) in the newTable method which gets called by its 
constructor.


This raises a few questions about these new APIs - these APIs take an integer and 
the document allows positive values. So the current Integer.MAX_VALUE in theory is a 
valid integer value for this API. Should these APIs document what might happen when 
such a large numMapping is passed to it? Should that documentation be different for 
different classes (as seen the HashMap and LinkedHashMap behave differently as 
compared to WeakHashMap)? Should this "numMappings" be considered a hard value? In 
other words, the current documentation of this new API states:


"Creates a new, empty WeakHashMap suitable for the expected number of mappings

and its initial capacity is generally large enough so that the expected number
of mappings can be added without resizing the map."

The documentation doesn't seem to guarantee that the resizing won't occur. So in 
cases like these where the numMappings is a very large value, should the 
implementation(s) have logic which doesn't trigger this OOM error?


-Jaikiran




Re: CVF: new Core Libraries Group member: Naoto Sato

2022-06-06 Thread Iris Clark
Vote yes

Iris


From: core-libs-dev  on behalf of Stuart 
Marks 
Sent: Monday, June 6, 2022 5:52 PM
To: core-libs-dev 
Subject: CVF: new Core Libraries Group member: Naoto Sato

I hereby nominate Naoto Sato [1] to membership in the Core Libraries Group [2].

Naoto Sato has been on the Core Libraries team for over a decade and has 
contributed
hundreds of changes to the JDK project [3]. His most significant recent 
contribution
is JEP 400: UTF-8 by Default [4]. Naoto is also lead of the Internationalization
Group [5] and a Reviewer on the JDK project.

Votes are due by June 20, 2022, 23:59 PDT.

Only current members of the Core Libraries Group [6] are eligible to vote on 
this
nomination. Votes must be cast in the open by replying to this mailing list, as
described here [7]. Results are determined by lazy consensus [8].

s'marks


[1] https://openjdk.java.net/census#naoto
[2] https://openjdk.java.net/groups/core-libs/
[3] https://github.com/openjdk/jdk/search?q=author-name%3Anaoto=commits
[4] https://openjdk.java.net/jeps/400
[5] https://openjdk.java.net/groups/i18n/
[6] https://openjdk.java.net/census#core-libs
[7] https://openjdk.java.net/groups/#member-vote
[8] https://openjdk.java.net/bylaws#lazy-consensus




Re: RFR: 8273346: Expand library mappings to IEEE 754 operations [v4]

2022-06-06 Thread Brian Burkhalter
On Mon, 6 Jun 2022 22:24:03 GMT, Joe Darcy  wrote:

>> Generally add apiNote's to map from Java library methods to particular IEEE 
>> 754 operations. For now, I only added such notes to java.lang.Math and not 
>> java.lang.StrictMath.
>
> Joe Darcy has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Respond to review feedback.

Approved assuming comments will be addressed prior to integration.

src/java.base/share/classes/java/math/RoundingMode.java line 53:

> 51:  * two bracketing values is the result. For in-range real numbers, for
> 52:  * a given set of representable values, a rounding policy maps a
> 53:  * continuous segment of real number line to a single representable

"the" real number line

-

Marked as reviewed by bpb (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/8876


Re: RFR: 8283667: [vectorapi] Vectorization for masked load with IOOBE with predicate feature [v5]

2022-06-06 Thread Xiaohong Gong
On Mon, 6 Jun 2022 10:40:45 GMT, Jatin Bhateja  wrote:

>> Xiaohong Gong has updated the pull request with a new target base due to a 
>> merge or a rebase. The pull request now contains five commits:
>> 
>>  - Merge branch 'jdk:master' into JDK-8283667
>>  - Use integer constant for offsetInRange all the way through
>>  - Rename "use_predicate" to "needs_predicate"
>>  - Rename the "usePred" to "offsetInRange"
>>  - 8283667: [vectorapi] Vectorization for masked load with IOOBE with 
>> predicate feature
>
> test/micro/org/openjdk/bench/jdk/incubator/vector/LoadMaskedIOOBEBenchmark.java
>  line 97:
> 
>> 95: public void byteLoadArrayMaskIOOBE() {
>> 96: for (int i = 0; i < inSize; i += bspecies.length()) {
>> 97: VectorMask mask = VectorMask.fromArray(bspecies, m, i);
> 
> For other case "if (offset >= 0 && offset <= (a.length - species.length())) 
> )" we are anyways intrinsifying, should we limit this micro to work only for 
> newly optimized case.

Yeah, thanks and it's really a good suggestion to limit this benchmark only for 
the IOOBE cases. I locally modified the tests to make sure only the IOOBE case 
happens and the results show good as well. But do you think it's better to keep 
as it is since we can also see the performance of the common cases to make sure 
no regressions happen? As the current benchmarks can also show the performance 
gain by this PR.

-

PR: https://git.openjdk.java.net/jdk/pull/8035


Re: CVF: new Core Libraries Group member: Naoto Sato

2022-06-06 Thread Joseph D. Darcy

Vote: yes

-joe

On 6/6/2022 5:52 PM, Stuart Marks wrote:
I hereby nominate Naoto Sato [1] to membership in the Core Libraries 
Group [2].


Naoto Sato has been on the Core Libraries team for over a decade and 
has contributed hundreds of changes to the JDK project [3]. His most 
significant recent contribution is JEP 400: UTF-8 by Default [4]. 
Naoto is also lead of the Internationalization Group [5] and a 
Reviewer on the JDK project.


Votes are due by June 20, 2022, 23:59 PDT.

Only current members of the Core Libraries Group [6] are eligible to 
vote on this nomination. Votes must be cast in the open by replying to 
this mailing list, as described here [7]. Results are determined by 
lazy consensus [8].


s'marks


[1] https://openjdk.java.net/census#naoto
[2] https://openjdk.java.net/groups/core-libs/
[3] 
https://github.com/openjdk/jdk/search?q=author-name%3Anaoto=commits

[4] https://openjdk.java.net/jeps/400
[5] https://openjdk.java.net/groups/i18n/
[6] https://openjdk.java.net/census#core-libs
[7] https://openjdk.java.net/groups/#member-vote
[8] https://openjdk.java.net/bylaws#lazy-consensus




Integrated: 8286279: [vectorapi] Only check index of masked lanes if offset is out of array boundary for masked store

2022-06-06 Thread Xiaohong Gong
On Tue, 10 May 2022 01:23:55 GMT, Xiaohong Gong  wrote:

> Checking whether the indexes of masked lanes are inside of the valid memory 
> boundary is necessary for masked vector memory access. However, this could be 
> saved if the given offset is inside of the vector range that could make sure 
> no IOOBE (IndexOutOfBoundaryException) happens. The masked load APIs have 
> saved this kind of check for common cases. And this patch did the similar 
> optimization for the masked vector store.
> 
> The performance for the new added store masked benchmarks improves about 
> `1.83x ~ 2.62x` on a x86 system:
> 
> Benchmark   BeforeAfter Gain Units
> StoreMaskedBenchmark.byteStoreArrayMask   12757.936 23291.118  1.826 ops/ms
> StoreMaskedBenchmark.doubleStoreArrayMask  1520.932  3921.616  2.578 ops/ms
> StoreMaskedBenchmark.floatStoreArrayMask   2713.031  7122.535  2.625 ops/ms
> StoreMaskedBenchmark.intStoreArrayMask 4113.772  8220.206  1.998 ops/ms
> StoreMaskedBenchmark.longStoreArrayMask1993.986  4874.148  2.444 ops/ms
> StoreMaskedBenchmark.shortStoreArrayMask   8543.593 17821.086  2.086 ops/ms
> 
> Similar performane gain can also be observed on ARM hardware.

This pull request has now been integrated.

Changeset: ef7cc210
Author:Xiaohong Gong 
URL:   
https://git.openjdk.java.net/jdk/commit/ef7cc2105c66de443d3a9af706220272018a0d8d
Stats: 216 lines in 9 files changed: 179 ins; 0 del; 37 mod

8286279: [vectorapi] Only check index of masked lanes if offset is out of array 
boundary for masked store

Reviewed-by: psandoz

-

PR: https://git.openjdk.java.net/jdk/pull/8620


Re: RFR: 8286279: [vectorapi] Only check index of masked lanes if offset is out of array boundary for masked store [v2]

2022-06-06 Thread Xiaohong Gong
On Tue, 31 May 2022 16:48:27 GMT, Paul Sandoz  wrote:

>> @PaulSandoz, could you please help to check whether the current version is 
>> ok for you? Thanks so much!
>
> @XiaohongGong looks good, now the Vector API JEP has been integrated you will 
> get a merge conflict, but it should be easier to resolve.

Thanks for the review @PaulSandoz @merykitty !

-

PR: https://git.openjdk.java.net/jdk/pull/8620


RFR: 8287760: --do-not-resolve-by-default gets overwritten if --warn-if-resolved flags is used

2022-06-06 Thread Thiago Henrique Hüpner
8287760: --do-not-resolve-by-default gets overwritten if --warn-if-resolved 
flags is used

-

Commit messages:
 - 8287760: Keep do-not-resolve-by-default flag

Changes: https://git.openjdk.java.net/jdk/pull/9049/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk=9049=00
  Issue: https://bugs.openjdk.org/browse/JDK-8287760
  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
  Patch: https://git.openjdk.java.net/jdk/pull/9049.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/9049/head:pull/9049

PR: https://git.openjdk.java.net/jdk/pull/9049


CVF: new Core Libraries Group member: Naoto Sato

2022-06-06 Thread Stuart Marks

I hereby nominate Naoto Sato [1] to membership in the Core Libraries Group [2].

Naoto Sato has been on the Core Libraries team for over a decade and has contributed 
hundreds of changes to the JDK project [3]. His most significant recent contribution 
is JEP 400: UTF-8 by Default [4]. Naoto is also lead of the Internationalization 
Group [5] and a Reviewer on the JDK project.


Votes are due by June 20, 2022, 23:59 PDT.

Only current members of the Core Libraries Group [6] are eligible to vote on this 
nomination. Votes must be cast in the open by replying to this mailing list, as 
described here [7]. Results are determined by lazy consensus [8].


s'marks


[1] https://openjdk.java.net/census#naoto
[2] https://openjdk.java.net/groups/core-libs/
[3] https://github.com/openjdk/jdk/search?q=author-name%3Anaoto=commits
[4] https://openjdk.java.net/jeps/400
[5] https://openjdk.java.net/groups/i18n/
[6] https://openjdk.java.net/census#core-libs
[7] https://openjdk.java.net/groups/#member-vote
[8] https://openjdk.java.net/bylaws#lazy-consensus




Re: RFR: 8287663 Add a regression test for JDK-8287073

2022-06-06 Thread Ioi Lam
On Thu, 2 Jun 2022 14:32:28 GMT, Severin Gehwolf  wrote:

> This adds a regression test for a recent fix (JDK-8287073). I've restructured 
> the linux specific JDK code to call a separate static function to enable this 
> test. It'll help future tests too.
> 
> Testing:
> - [x] Container tests continue to pass + GHA
> - [x] New regression test fails prior the code fix of JDK-8287073 and passes 
> with it

Not specific to this PR, but we have a general problem with lots of duplication 
between these two files. E.g.,


https://github.com/openjdk/jdk/blob/a50b06e85124f61b5133189a2a2e461753d5d9e7/test/hotspot/jtreg/containers/cgroup/CgroupSubsystemFactory.java#L132-L143

https://github.com/openjdk/jdk/blob/a50b06e85124f61b5133189a2a2e461753d5d9e7/test/jdk/jdk/internal/platform/cgroup/TestCgroupSubsystemFactory.java#L130-L143

We should try to consolidate these test cases to improve maintainability.

-

PR: https://git.openjdk.java.net/jdk/pull/8993


Re: RFR: 8287663 Add a regression test for JDK-8287073

2022-06-06 Thread Ioi Lam
On Thu, 2 Jun 2022 14:32:28 GMT, Severin Gehwolf  wrote:

> This adds a regression test for a recent fix (JDK-8287073). I've restructured 
> the linux specific JDK code to call a separate static function to enable this 
> test. It'll help future tests too.
> 
> Testing:
> - [x] Container tests continue to pass + GHA
> - [x] New regression test fails prior the code fix of JDK-8287073 and passes 
> with it

LGTM.

-

Marked as reviewed by iklam (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/8993


Integrated: JDK-8287867: Bad merge of jdk/test/lib/util/ForceGC.java causing test compilation error

2022-06-06 Thread Mandy Chung
On Mon, 6 Jun 2022 21:58:20 GMT, Mandy Chung  wrote:

> A typo in ForceGC.java causes several test failing due to compilation error.

This pull request has now been integrated.

Changeset: a50b06e8
Author:Mandy Chung 
URL:   
https://git.openjdk.java.net/jdk/commit/a50b06e85124f61b5133189a2a2e461753d5d9e7
Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod

8287867: Bad merge of jdk/test/lib/util/ForceGC.java causing test compilation 
error

Reviewed-by: dcubed

-

PR: https://git.openjdk.java.net/jdk/pull/9043


Re: RFR: 8273346: Expand library mappings to IEEE 754 operations [v2]

2022-06-06 Thread Joe Darcy
On Thu, 2 Jun 2022 08:22:11 GMT, Raffaello Giulietti  
wrote:

>> src/java.base/share/classes/java/lang/Math.java line 823:
>> 
>>> 821:  * @apiNote
>>> 822:  * This method corresponds to the convertTowardPositive operation
>>> 823:  * defined in IEEE 754.
>> 
>> Probably what is meant is IEEE `convertToIntegerTowardPositive` (not 
>> `convertTowardPositive`).
>> However, that's another kind of rounding, which always rounds any 
>> non-integral value toward positive infinity, not just ties. This is not what 
>> happens with this method.
>
>> not just ties
> Plz. disregard this 3 words

Okay, checking the IEEE 754-2019 spec again, there are operations to round a 
floating-point value to an integral-valued floating-point value 
(roundToIntegral{$ROUNDING_DIRECTION_ATTRIBUTE} and separately operations to 
round from a floating-point value to a value in an integer format 
(convertToInteger{$ROUNDING_DIRECTION_ATTRIBUTE} ). However, as noted, there is 
no IEEE 754 operations for rounding up only for ties. I'll remove the API notes 
for the round methods; thanks for catching this.

-

PR: https://git.openjdk.java.net/jdk/pull/8876


Re: RFR: 8273346: Expand library mappings to IEEE 754 operations [v4]

2022-06-06 Thread Joe Darcy
> Generally add apiNote's to map from Java library methods to particular IEEE 
> 754 operations. For now, I only added such notes to java.lang.Math and not 
> java.lang.StrictMath.

Joe Darcy has updated the pull request incrementally with one additional commit 
since the last revision:

  Respond to review feedback.

-

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/8876/files
  - new: https://git.openjdk.java.net/jdk/pull/8876/files/be81f60b..ba3e9a75

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk=8876=03
 - incr: https://webrevs.openjdk.java.net/?repo=jdk=8876=02-03

  Stats: 8 lines in 1 file changed: 0 ins; 8 del; 0 mod
  Patch: https://git.openjdk.java.net/jdk/pull/8876.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/8876/head:pull/8876

PR: https://git.openjdk.java.net/jdk/pull/8876


Integrated: 8250950: Allow per-user and system wide configuration of a jpackaged app

2022-06-06 Thread Alexey Semenyuk
On Fri, 3 Jun 2022 21:07:47 GMT, Alexey Semenyuk  wrote:

> 8250950: Allow per-user and system wide configuration of a jpackaged app

This pull request has now been integrated.

Changeset: c37c8e5d
Author:Alexey Semenyuk 
URL:   
https://git.openjdk.java.net/jdk/commit/c37c8e5d34905ff2df34a93aa53dd3369e164596
Stats: 599 lines in 15 files changed: 543 ins; 36 del; 20 mod

8250950: Allow per-user and system wide configuration of a jpackaged app

Reviewed-by: almatvee

-

PR: https://git.openjdk.java.net/jdk/pull/9025


Re: RFR: JDK-8287867: Bad merge of jdk/test/lib/util/ForceGC.java causing test compilation error

2022-06-06 Thread Mandy Chung
On Mon, 6 Jun 2022 21:58:20 GMT, Mandy Chung  wrote:

> A typo in ForceGC.java causes several test failing due to compilation error.

thanks for the prompt review.

-

PR: https://git.openjdk.java.net/jdk/pull/9043


Re: RFR: JDK-8287867: Bad merge of jdk/test/lib/util/ForceGC.java causing test compilation error

2022-06-06 Thread Daniel D . Daugherty
On Mon, 6 Jun 2022 21:58:20 GMT, Mandy Chung  wrote:

> A typo in ForceGC.java causes several test failing due to compilation error.

Thumbs up. This is a trivial fix.

-

Marked as reviewed by dcubed (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/9043


RFR: JDK-8287867: Bad merge of jdk/test/lib/util/ForceGC.java causing test compilation error

2022-06-06 Thread Mandy Chung
A typo in ForceGC.java causes several test failing due to compilation error.

-

Commit messages:
 - JDK-8287867: Bad merge of jdk/test/lib/util/ForceGC.java causing compilation 
error

Changes: https://git.openjdk.java.net/jdk/pull/9043/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk=9043=00
  Issue: https://bugs.openjdk.org/browse/JDK-8287867
  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
  Patch: https://git.openjdk.java.net/jdk/pull/9043.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/9043/head:pull/9043

PR: https://git.openjdk.java.net/jdk/pull/9043


Re: RFR: 8283660: Convert com/sun/jndi/ldap/AbstractLdapNamingEnumeration.java finalizer to Cleaner [v12]

2022-06-06 Thread Brent Christian
> Please review this change to replace the finalizer in 
> `AbstractLdapNamingEnumeration` with a Cleaner.
> 
> The pieces of state required for cleanup (`LdapCtx homeCtx`, `LdapResult 
> res`, and `LdapClient enumClnt`) are moved to a static inner class . From 
> there, the change is fairly mechanical.
> 
> Details of note: 
> 1. Some operations need to change the state values (the update() method is 
> probably the most interesting).
> 2. Subclasses need to access `homeCtx`; I added a `homeCtx()` method to read 
> `homeCtx` from the superclass's `state`.
> 
> The test case is based on a copy of 
> `com/sun/jndi/ldap/blits/AddTests/AddNewEntry.java`. A more minimal test case 
> might be possible, but this was done for expediency.
> 
> The test only confirms that the new Cleaner use does not keep the object 
> reachable. It only tests `LdapSearchEnumeration` (not `LdapNamingEnumeration` 
> or `LdapBindingEnumeration`, though all are subclasses of 
> `AbstractLdapNamingEnumeration`). 
> 
> Thanks.

Brent Christian has updated the pull request incrementally with one additional 
commit since the last revision:

  Restore EnumCtx to being an inner class, to keep all the state together in 
the code

-

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/8311/files
  - new: https://git.openjdk.java.net/jdk/pull/8311/files/0f729619..c8bdac44

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk=8311=11
 - incr: https://webrevs.openjdk.java.net/?repo=jdk=8311=10-11

  Stats: 90 lines in 1 file changed: 44 ins; 45 del; 1 mod
  Patch: https://git.openjdk.java.net/jdk/pull/8311.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/8311/head:pull/8311

PR: https://git.openjdk.java.net/jdk/pull/8311


Re: RFR: 8273346: Expand library mappings to IEEE 754 operations [v3]

2022-06-06 Thread Joe Darcy
> Generally add apiNote's to map from Java library methods to particular IEEE 
> 754 operations. For now, I only added such notes to java.lang.Math and not 
> java.lang.StrictMath.

Joe Darcy has updated the pull request with a new target base due to a merge or 
a rebase. The incremental webrev excludes the unrelated changes brought in by 
the merge/rebase. The pull request contains six additional commits since the 
last revision:

 - Merge branch 'master' into JDK-8273346
 - Merge branch 'master' into JDK-8273346
 - Respond to review feedback; make another pass to link methods to IEEE 754 
operations.
 - Merge branch 'master' into JDK-8273346
 - Add floor and ceil.
 - JDK-8273346: Examine use of "rounding mode" and "rounding policy" in Math 
and StrictMath

-

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/8876/files
  - new: https://git.openjdk.java.net/jdk/pull/8876/files/9169ad9e..be81f60b

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk=8876=02
 - incr: https://webrevs.openjdk.java.net/?repo=jdk=8876=01-02

  Stats: 17707 lines in 455 files changed: 14288 ins; 2165 del; 1254 mod
  Patch: https://git.openjdk.java.net/jdk/pull/8876.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/8876/head:pull/8876

PR: https://git.openjdk.java.net/jdk/pull/8876


Re: RFR: 8287596: Reorg jdk.test.lib.util.ForceGC [v6]

2022-06-06 Thread Xue-Lei Andrew Fan
> This is a follow up update per comments in [JDK-8287384 
> PR](https://github.com/openjdk/jdk/pull/8907).  The tier1 and tier2 test in 
> open part looks good to me.  Please help to run Mach5 just case the closed 
> test cases are impacted.

Xue-Lei Andrew Fan has updated the pull request with a new target base due to a 
merge or a rebase. The pull request now contains eight commits:

 - Merge master
 - Merge
 - add timeout parameter
 - rollback is not in this branch
 - rollback JDK-8287384
 - back to wait 1 second
 - Remove trailing white space
 - 8287596: Reorg jdk.test.lib.util.ForceGC

-

Changes: https://git.openjdk.java.net/jdk/pull/8979/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk=8979=05
  Stats: 86 lines in 10 files changed: 12 ins; 29 del; 45 mod
  Patch: https://git.openjdk.java.net/jdk/pull/8979.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/8979/head:pull/8979

PR: https://git.openjdk.java.net/jdk/pull/8979


Integrated: JDK-8287838: Update Float and Double to use snippets

2022-06-06 Thread Joe Darcy
On Sun, 5 Jun 2022 21:19:37 GMT, Joe Darcy  wrote:

> Various code blocks in Float and Double would be better as snippets.

This pull request has now been integrated.

Changeset: 0e06bf3b
Author:Joe Darcy 
URL:   
https://git.openjdk.java.net/jdk/commit/0e06bf3b04f69c57120d32106a3ae5f69030934d
Stats: 8 lines in 2 files changed: 1 ins; 0 del; 7 mod

8287838: Update Float and Double to use snippets

Reviewed-by: alanb

-

PR: https://git.openjdk.java.net/jdk/pull/9034


Integrated: 8285285: Avoid redundant allocations in WindowsPreferences

2022-06-06 Thread Andrey Turbanov
On Wed, 20 Apr 2022 19:16:00 GMT, Andrey Turbanov  wrote:

> 1. No need to call `String.substring` if you need need to compare start of 
> string with some constant. `String.startWith` suites better.
> 2. Unused String array is allocated in `childrenNamesSpi` method

This pull request has now been integrated.

Changeset: e94b05c7
Author:Andrey Turbanov 
URL:   
https://git.openjdk.java.net/jdk/commit/e94b05c72046cfc52898917e835794bb1aec548a
Stats: 18 lines in 1 file changed: 0 ins; 2 del; 16 mod

8285285: Avoid redundant allocations in WindowsPreferences

Reviewed-by: jpai

-

PR: https://git.openjdk.java.net/jdk/pull/8322


Integrated: 8287766: Unnecessary Vector usage in LdapClient

2022-06-06 Thread Andrey Turbanov
On Sun, 29 May 2022 20:22:55 GMT, Andrey Turbanov  wrote:

> In [JDK-8273098](https://bugs.openjdk.java.net/browse/JDK-8273098) I missed 
> one place, where Vector could be replaced with ArrayList.
> Usage of thread-safe collection `Vector` is unnecessary. It's recommended to 
> use `ArrayList` if a thread-safe implementation is not needed.

This pull request has now been integrated.

Changeset: 3eb49fec
Author:Andrey Turbanov 
URL:   
https://git.openjdk.java.net/jdk/commit/3eb49feceabe8253b78b794a3d8fdc0556d8f2e2
Stats: 4 lines in 1 file changed: 1 ins; 0 del; 3 mod

8287766: Unnecessary Vector usage in LdapClient

Reviewed-by: dfuchs, vtewari, aefimov

-

PR: https://git.openjdk.java.net/jdk/pull/8940


Integrated: JDK-8287671: Adjust ForceGC to invoke System::gc fewer times for negative case

2022-06-06 Thread Mandy Chung
On Fri, 3 Jun 2022 18:05:52 GMT, Mandy Chung  wrote:

> This reapplies JDK-8287384 and adjust the number of GCs for negative case, 
> i.e. the condition is never met that is used to verify a reference is not 
> GC'ed.

This pull request has now been integrated.

Changeset: 2e332c27
Author:Mandy Chung 
URL:   
https://git.openjdk.java.net/jdk/commit/2e332c276052554540da0998316a5a99bc350cd6
Stats: 19 lines in 1 file changed: 11 ins; 0 del; 8 mod

8287671: Adjust ForceGC to invoke System::gc fewer times for negative case

Reviewed-by: rriggs, bchristi, xuelei

-

PR: https://git.openjdk.java.net/jdk/pull/9021


Re: RFR: 8285285: Avoid redundant allocations in WindowsPreferences

2022-06-06 Thread Andrey Turbanov
On Wed, 20 Apr 2022 19:16:00 GMT, Andrey Turbanov  wrote:

> 1. No need to call `String.substring` if you need need to compare start of 
> string with some constant. `String.startWith` suites better.
> 2. Unused String array is allocated in `childrenNamesSpi` method

Thank you for review!

-

PR: https://git.openjdk.java.net/jdk/pull/8322


Re: RFR: 8287766: Unnecessary Vector usage in LdapClient

2022-06-06 Thread Andrey Turbanov
On Sun, 29 May 2022 20:22:55 GMT, Andrey Turbanov  wrote:

> In [JDK-8273098](https://bugs.openjdk.java.net/browse/JDK-8273098) I missed 
> one place, where Vector could be replaced with ArrayList.
> Usage of thread-safe collection `Vector` is unnecessary. It's recommended to 
> use `ArrayList` if a thread-safe implementation is not needed.

Thank you for review!

-

PR: https://git.openjdk.java.net/jdk/pull/8940


Re: RFR: 8283660: Convert com/sun/jndi/ldap/AbstractLdapNamingEnumeration.java finalizer to Cleaner [v11]

2022-06-06 Thread Brent Christian
> Please review this change to replace the finalizer in 
> `AbstractLdapNamingEnumeration` with a Cleaner.
> 
> The pieces of state required for cleanup (`LdapCtx homeCtx`, `LdapResult 
> res`, and `LdapClient enumClnt`) are moved to a static inner class . From 
> there, the change is fairly mechanical.
> 
> Details of note: 
> 1. Some operations need to change the state values (the update() method is 
> probably the most interesting).
> 2. Subclasses need to access `homeCtx`; I added a `homeCtx()` method to read 
> `homeCtx` from the superclass's `state`.
> 
> The test case is based on a copy of 
> `com/sun/jndi/ldap/blits/AddTests/AddNewEntry.java`. A more minimal test case 
> might be possible, but this was done for expediency.
> 
> The test only confirms that the new Cleaner use does not keep the object 
> reachable. It only tests `LdapSearchEnumeration` (not `LdapNamingEnumeration` 
> or `LdapBindingEnumeration`, though all are subclasses of 
> `AbstractLdapNamingEnumeration`). 
> 
> Thanks.

Brent Christian has updated the pull request incrementally with two additional 
commits since the last revision:

 - Restore comments in ldap capture file
 - Update test files - add copyright, etc

-

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/8311/files
  - new: https://git.openjdk.java.net/jdk/pull/8311/files/e34e888f..0f729619

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk=8311=10
 - incr: https://webrevs.openjdk.java.net/?repo=jdk=8311=09-10

  Stats: 44 lines in 1 file changed: 33 ins; 1 del; 10 mod
  Patch: https://git.openjdk.java.net/jdk/pull/8311.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/8311/head:pull/8311

PR: https://git.openjdk.java.net/jdk/pull/8311


Re: RFR: 8250950: Allow per-user and system wide configuration of a jpackaged app

2022-06-06 Thread Alexey Semenyuk
On Fri, 3 Jun 2022 21:07:47 GMT, Alexey Semenyuk  wrote:

> 8250950: Allow per-user and system wide configuration of a jpackaged app

@sashamatveev please resume the review

-

PR: https://git.openjdk.java.net/jdk/pull/9025


Re: RFR: 8250950: Allow per-user and system wide configuration of a jpackaged app [v2]

2022-06-06 Thread Alexander Matveev
On Mon, 6 Jun 2022 20:37:11 GMT, Alexey Semenyuk  wrote:

>> 8250950: Allow per-user and system wide configuration of a jpackaged app
>
> Alexey Semenyuk has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   Add TKit.createDirectories() method that will delete created nonexistent 
> directories.

Marked as reviewed by almatvee (Reviewer).

-

PR: https://git.openjdk.java.net/jdk/pull/9025


Re: RFR: 8250950: Allow per-user and system wide configuration of a jpackaged app [v2]

2022-06-06 Thread Alexey Semenyuk
> 8250950: Allow per-user and system wide configuration of a jpackaged app

Alexey Semenyuk has updated the pull request incrementally with one additional 
commit since the last revision:

  Add TKit.createDirectories() method that will delete created nonexistent 
directories.

-

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/9025/files
  - new: https://git.openjdk.java.net/jdk/pull/9025/files/af2708b4..1f512ff1

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk=9025=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk=9025=00-01

  Stats: 38 lines in 2 files changed: 32 ins; 1 del; 5 mod
  Patch: https://git.openjdk.java.net/jdk/pull/9025.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/9025/head:pull/9025

PR: https://git.openjdk.java.net/jdk/pull/9025


Re: RFR: JDK-8287838: Update Float and Double to use snippets [v2]

2022-06-06 Thread Joe Darcy
On Mon, 6 Jun 2022 05:29:24 GMT, Alan Bateman  wrote:

> One other thing you could do is link Pattern.matches in the snippet to the 
> matches method.

Suggestion made in subsequent push; thanks.

> src/java.base/share/classes/java/lang/Double.java line 683:
> 
>> 681:  *   "[\\x00-\\x20]*");// Optional trailing "whitespace"
>> 682:  *
>> 683:  *  if (Pattern.matches(fpRegex, myString)) // @link 
>> substring="Pattern.matches" target ="java.util.regex.Pattern#matches"
> 
> If you want to avoid the annoyingly long line then you can put the "// @link 
> ..." on the previous line if you want.

It can be done with a snippet region like this:


 *  // @link region substring="Pattern.matches" target 
="java.util.regex.Pattern#matches"
 *  if (Pattern.matches(fpRegex, myString))
 *  Double.valueOf(myString); // Will not throw NumberFormatException
 * // @end

-

PR: https://git.openjdk.java.net/jdk/pull/9034


Re: RFR: JDK-8287838: Update Float and Double to use snippets [v2]

2022-06-06 Thread Alan Bateman
On Mon, 6 Jun 2022 20:37:07 GMT, Joe Darcy  wrote:

>> Various code blocks in Float and Double would be better as snippets.
>
> Joe Darcy has updated the pull request incrementally with two additional 
> commits since the last revision:
> 
>  - Use idiom for shorter lines
>  - Respond to review feedback.

src/java.base/share/classes/java/lang/Double.java line 683:

> 681:  *   "[\\x00-\\x20]*");// Optional trailing "whitespace"
> 682:  *
> 683:  *  if (Pattern.matches(fpRegex, myString)) // @link 
> substring="Pattern.matches" target ="java.util.regex.Pattern#matches"

If you want to avoid the annoyingly long line then you can put the "// @link 
..." on the previous line if you want.

-

PR: https://git.openjdk.java.net/jdk/pull/9034


Re: RFR: JDK-8287838: Update Float and Double to use snippets [v2]

2022-06-06 Thread Joe Darcy
> Various code blocks in Float and Double would be better as snippets.

Joe Darcy has updated the pull request incrementally with two additional 
commits since the last revision:

 - Use idiom for shorter lines
 - Respond to review feedback.

-

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/9034/files
  - new: https://git.openjdk.java.net/jdk/pull/9034/files/255fbb15..56abd0ac

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk=9034=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk=9034=00-01

  Stats: 3 lines in 1 file changed: 1 ins; 0 del; 2 mod
  Patch: https://git.openjdk.java.net/jdk/pull/9034.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/9034/head:pull/9034

PR: https://git.openjdk.java.net/jdk/pull/9034


Re: RFR: 8285081: Improve XPath operators count accuracy [v3]

2022-06-06 Thread Naoto Sato
On Fri, 3 Jun 2022 23:56:31 GMT, Joe Wang  wrote:

>> Adjust how XPath operators are counted to improve accuracy. This change does 
>> not affect how XPath works. 
>> 
>> Test:  
>>  Tier2 passed;
>>  JCK XML tests passed.
>
> Joe Wang has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   remove unused parameter

LGTM

-

Marked as reviewed by naoto (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/9022


Re: RFR: JDK-8287671: Adjust ForceGC to invoke System::gc fewer times for negative case

2022-06-06 Thread Mandy Chung
On Fri, 3 Jun 2022 18:05:52 GMT, Mandy Chung  wrote:

> This reapplies JDK-8287384 and adjust the number of GCs for negative case, 
> i.e. the condition is never met that is used to verify a reference is not 
> GC'ed.

JDK-8287384 affects the tests using ForceGC for negative cases only.  It will 
return with a fewer GC cycles of a shortened wait time between each cycle.  It 
will be okay since a strongly reachable reference will never be GC'ed.

-

PR: https://git.openjdk.java.net/jdk/pull/9021


Re: RFR: 8287596: Reorg jdk.test.lib.util.ForceGC [v2]

2022-06-06 Thread Xue-Lei Andrew Fan
On Wed, 1 Jun 2022 21:09:15 GMT, Mandy Chung  wrote:

>> Xue-Lei Andrew Fan has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   back to wait 1 second
>
> No, it doesn't work.  You can build a fastdebug build with `configure 
> --enable-debug`.  I reproduce it on macOS.   If I restore to the previous 
> version without 8287384, the test passes.

Inspired by @mlchung (See https://github.com/openjdk/jdk/pull/9021), use less 
waiting time for  UnloadingTest and re-open this PR.

-

PR: https://git.openjdk.java.net/jdk/pull/8979


Re: RFR: 8287596: Reorg jdk.test.lib.util.ForceGC [v5]

2022-06-06 Thread Xue-Lei Andrew Fan
> This is a follow up update per comments in [JDK-8287384 
> PR](https://github.com/openjdk/jdk/pull/8907).  The tier1 and tier2 test in 
> open part looks good to me.  Please help to run Mach5 just case the closed 
> test cases are impacted.

Xue-Lei Andrew Fan has updated the pull request with a new target base due to a 
merge or a rebase. The pull request now contains seven commits:

 - Merge
 - add timeout parameter
 - rollback is not in this branch
 - rollback JDK-8287384
 - back to wait 1 second
 - Remove trailing white space
 - 8287596: Reorg jdk.test.lib.util.ForceGC

-

Changes: https://git.openjdk.java.net/jdk/pull/8979/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk=8979=04
  Stats: 87 lines in 10 files changed: 19 ins; 25 del; 43 mod
  Patch: https://git.openjdk.java.net/jdk/pull/8979.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/8979/head:pull/8979

PR: https://git.openjdk.java.net/jdk/pull/8979


Re: RFR: 8287860: Revise usage of volatile in j.u.Locale [v2]

2022-06-06 Thread Сергей Цыпанов
On Mon, 6 Jun 2022 17:31:15 GMT, Naoto Sato  wrote:

>> Сергей Цыпанов has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   8287860: Mark hash fields with @Stable
>
> src/java.base/share/classes/java/util/Locale.java line 1084:
> 
>> 1082: Properties props = GetPropertyAction.privilegedGetProperties();
>> 1083: 
>> 1084: Locale defaultLocale = Locale.defaultLocale;
> 
> I'd use a different local variable name so that it won't clash with the field 
> name. The same holds for other locations (`isoLanguages` and `languageTag`)

Done!

-

PR: https://git.openjdk.java.net/jdk/pull/9041


Re: RFR: 8287860: Revise usage of volatile in j.u.Locale [v2]

2022-06-06 Thread Naoto Sato
On Mon, 6 Jun 2022 14:36:03 GMT, Сергей Цыпанов  wrote:

>> - cached hash code of `Locale` and `Locale$LanguageRange` shouldn't be 
>> volatile, even in case of race in the worst case it is recalculated at most 
>> once per thread
>> - `defaultLocale` field is read multiple times in `initDefault()`
>> - `isoLanguages` is accessed multiple times in `getISOLanguages()`
>> - `languageTag` is read twice in `toLanguageTag()`
>
> Сергей Цыпанов has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   8287860: Mark hash fields with @Stable

src/java.base/share/classes/java/util/Locale.java line 1084:

> 1082: Properties props = GetPropertyAction.privilegedGetProperties();
> 1083: 
> 1084: Locale defaultLocale = Locale.defaultLocale;

I'd use a different local variable name so that it won't clash with the field 
name. The same holds for other locations (`isoLanguages` and `languageTag`)

-

PR: https://git.openjdk.java.net/jdk/pull/9041


Re: RFR: 8287860: Revise usage of volatile in j.u.Locale [v3]

2022-06-06 Thread Naoto Sato
On Mon, 6 Jun 2022 20:19:22 GMT, Сергей Цыпанов  wrote:

>> - cached hash code of `Locale` and `Locale$LanguageRange` shouldn't be 
>> volatile, even in case of race in the worst case it is recalculated at most 
>> once per thread
>> - `defaultLocale` field is read multiple times in `initDefault()`
>> - `isoLanguages` is accessed multiple times in `getISOLanguages()`
>> - `languageTag` is read twice in `toLanguageTag()`
>
> Сергей Цыпанов has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   8287860: Rename local vars

Looks good. Thanks for fixing this.

-

Marked as reviewed by naoto (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/9041


Re: RFR: 8287860: Revise usage of volatile in j.u.Locale [v3]

2022-06-06 Thread Сергей Цыпанов
> - cached hash code of `Locale` and `Locale$LanguageRange` shouldn't be 
> volatile, even in case of race in the worst case it is recalculated at most 
> once per thread
> - `defaultLocale` field is read multiple times in `initDefault()`
> - `isoLanguages` is accessed multiple times in `getISOLanguages()`
> - `languageTag` is read twice in `toLanguageTag()`

Сергей Цыпанов has updated the pull request incrementally with one additional 
commit since the last revision:

  8287860: Rename local vars

-

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/9041/files
  - new: https://git.openjdk.java.net/jdk/pull/9041/files/d4534346..454621d4

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk=9041=02
 - incr: https://webrevs.openjdk.java.net/?repo=jdk=9041=01-02

  Stats: 14 lines in 1 file changed: 0 ins; 0 del; 14 mod
  Patch: https://git.openjdk.java.net/jdk/pull/9041.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/9041/head:pull/9041

PR: https://git.openjdk.java.net/jdk/pull/9041


Re: Questions about Float.toString(float)

2022-06-06 Thread Raffaello Giulietti




On 2022-06-05 09:59, LP wrote:

Hi,

(1)
float f = Float.intBitsToFloat(260046848);

JDK 17: Float.toString(f) -> 1.26217745E-29
master: Float.toString(f) -> 1.2621775E-29

BigDecimal.valueOf(Float.intBitsToFloat(260046847)) -> 1.2621773731219804E-29
BigDecimal.valueOf(Float.intBitsToFloat(260046848)) -> 1.2621774483536189E-29
BigDecimal.valueOf(Float.intBitsToFloat(260046849)) -> 1.2621775988168958E-29

What about 1.2621774E-29? I believe both 1.2621774E-29 and 1.2621775E-29 
satisfy the Javadoc of Float.toString(float), so maybe it doesn't matter, but 
1.2621774E-29 is closer to f.



In addition to f above, let
float g = Float.intBitsToFloat(260046847);

Then
f == 1.2621775E-29f  -> true
g == 1.2621774E-29f  -> true

Hence, 1.2621774E-29f rounded to the closest float is g, not f.
1.2621775E-29f is indeed the shortest decimal that rounds to f. Other 
equally long decimals like 1.2621774E-29f or 1.2621776E-29f do not round 
to f but to other floats.


So, no, 1.2621774E-29 does not satisfy the spec for f. Only 
1.2621775E-29 does.




(2)
float f = Float.intBitsToFloat(1291845637);

JDK 17: Float.toString(f) -> 1.34217808E8
master: Float.toString(f) -> 1.3421781E8

BigDecimal.valueOf(Float.intBitsToFloat(1291845636)) -> 134217792
BigDecimal.valueOf(Float.intBitsToFloat(1291845637)) -> 134217808
BigDecimal.valueOf(Float.intBitsToFloat(1291845638)) -> 134217824

What about 1.342178E8? 1.3421781E8 is an improvement over 1.34217808E8, but 
it's still not conforming to the Javadoc if 1.342178E8 is valid.



Again, 1.342178E8f < 1.3421781E8f, so these are decimals representing 
two different floats. Only 1.3421781E8f rounds to your f, whereas 
1.342178E8f rounds to

float g = Float.intBitsToFloat(1291845636);





Apologies if I misunderstood something.

Thanks,
LP


Questions about Float.toString(float)

2022-06-06 Thread LP
Hi,

(1)
float f = Float.intBitsToFloat(260046848);

JDK 17: Float.toString(f) -> 1.26217745E-29
master: Float.toString(f) -> 1.2621775E-29

BigDecimal.valueOf(Float.intBitsToFloat(260046847)) -> 1.2621773731219804E-29
BigDecimal.valueOf(Float.intBitsToFloat(260046848)) -> 1.2621774483536189E-29
BigDecimal.valueOf(Float.intBitsToFloat(260046849)) -> 1.2621775988168958E-29

What about 1.2621774E-29? I believe both 1.2621774E-29 and 1.2621775E-29 
satisfy the Javadoc of Float.toString(float), so maybe it doesn't matter, but 
1.2621774E-29 is closer to f.

(2)
float f = Float.intBitsToFloat(1291845637);

JDK 17: Float.toString(f) -> 1.34217808E8
master: Float.toString(f) -> 1.3421781E8

BigDecimal.valueOf(Float.intBitsToFloat(1291845636)) -> 134217792
BigDecimal.valueOf(Float.intBitsToFloat(1291845637)) -> 134217808
BigDecimal.valueOf(Float.intBitsToFloat(1291845638)) -> 134217824

What about 1.342178E8? 1.3421781E8 is an improvement over 1.34217808E8, but 
it's still not conforming to the Javadoc if 1.342178E8 is valid.

Apologies if I misunderstood something.

Thanks,
LP

Re: RFR: 8284493: Fix rounding error in computeNextExponential [v2]

2022-06-06 Thread openjdk-notifier[bot]
On Thu, 2 Jun 2022 03:00:32 GMT, Chris Hennick  wrote:

>> Chris Hennick has refreshed the contents of this pull request, and previous 
>> commits have been removed. The incremental views will show differences 
>> compared to the previous content of the PR. The pull request contains one 
>> new commit since the last revision:
>> 
>>   Fix rounding error in computeNextExponential; use FMA
>>   
>>   Repeatedly adding DoubleZigguratTables.exponentialX0 to extra causes a 
>> rounding error to accumulate at the tail of the distribution; this fixes 
>> that by tracking the multiple of exponentialX0 as a long.
>>   
>>   Add computeWinsorizedNextExponential for testability
>
> In addition to the changes discussed heretofore, I've also changed line 1382 
> to eliminate unneeded tail exploration; this should make `nextGaussian` 
> faster at high percentiles (probably measurable at 99%ile; should definitely 
> be measurable at  at 99.99%ile).

@Pr0methean Please do not rebase or force-push to an active PR as it 
invalidates existing review comments. All changes will be squashed into a 
single commit automatically when integrating. See [OpenJDK Developers’ 
Guide](https://openjdk.java.net/guide/#working-with-pull-requests) for more 
information.

-

PR: https://git.openjdk.java.net/jdk/pull/8131


Re: RFR: 8284493: Fix rounding error in computeNextExponential [v4]

2022-06-06 Thread Chris Hennick
> Repeatedly adding DoubleZigguratTables.exponentialX0 to extra causes a 
> rounding error to accumulate at the tail of the distribution (probably 
> starting around 2*exponentialX0 == 0x1.e46eff20739afp3 ~ 15.1); this fixes 
> that by tracking the multiple of exponentialX0 as a long. (This changes the 
> maximum possible output to `1.0p63 * DoubleZigguratTables.exponentialX0 == 
> 0x1.e46eff20739afp65`; previously it would have been `0x1.0p56` because once 
> `extra` reaches that amount, `x + extra == extra` due to the rounding error. 
> This lowers the probability of reaching the maximum with an ideal PRNG from 
> about `1.3877787807814488E-17` to about `1.4323726067488646E-20` (calculated 
> using the identity `ln(x) == Math.log10(x)/Math.log10(Math.exp(1))`).

Chris Hennick has updated the pull request with a new target base due to a 
merge or a rebase. The incremental webrev excludes the unrelated changes 
brought in by the merge/rebase. The pull request contains three additional 
commits since the last revision:

 - Merge branch 'openjdk:master' into patch-1
 - Merge branch 'openjdk:master' into patch-1
 - Fix rounding error in computeNextExponential; use FMA
   
   Repeatedly adding DoubleZigguratTables.exponentialX0 to extra causes a 
rounding error to accumulate at the tail of the distribution; this fixes that 
by tracking the multiple of exponentialX0 as a long.
   
   Add computeWinsorizedNextExponential for testability

-

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/8131/files
  - new: https://git.openjdk.java.net/jdk/pull/8131/files/c5a28f98..1daaadac

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk=8131=03
 - incr: https://webrevs.openjdk.java.net/?repo=jdk=8131=02-03

  Stats: 1548 lines in 42 files changed: 1399 ins; 60 del; 89 mod
  Patch: https://git.openjdk.java.net/jdk/pull/8131.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/8131/head:pull/8131

PR: https://git.openjdk.java.net/jdk/pull/8131


Re: RFR: 8287541: Files.writeString fails to throw IOException for charset "windows-1252" [v2]

2022-06-06 Thread Naoto Sato
On Sat, 4 Jun 2022 11:27:00 GMT, Andrey Turbanov  wrote:

>> Naoto Sato has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   Changed per suggestion
>
> src/java.base/share/classes/java/lang/String.java line 849:
> 
>> 847: int en = scale(len, ce.maxBytesPerChar());
>> 848: // fastpath with ArrayEncoder implies `doReplace`.
>> 849: if (ce instanceof ArrayEncoder ae && doReplace) {
> 
> Wouldn't it be more readable (and perphaps faster) if we do check boolean 
> flag first?

Fixed.

-

PR: https://git.openjdk.java.net/jdk/pull/9019


Re: RFR: 8287541: Files.writeString fails to throw IOException for charset "windows-1252" [v2]

2022-06-06 Thread Naoto Sato
> The code path calls `String.getBytesNoRepl()`, but it blindly replaces 
> unmappable characters with replacements if the encoder is an `ArrayEncoder`. 
> Changed only to do so if `doReplace` is `true` in 
> `String.encodeWithEncoder()`.

Naoto Sato has updated the pull request incrementally with one additional 
commit since the last revision:

  Changed per suggestion

-

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/9019/files
  - new: https://git.openjdk.java.net/jdk/pull/9019/files/72d27809..51ce3615

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk=9019=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk=9019=00-01

  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
  Patch: https://git.openjdk.java.net/jdk/pull/9019.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/9019/head:pull/9019

PR: https://git.openjdk.java.net/jdk/pull/9019


Re: RFR: 8286279: [vectorapi] Only check index of masked lanes if offset is out of array boundary for masked store [v3]

2022-06-06 Thread Paul Sandoz
On Thu, 2 Jun 2022 01:29:54 GMT, Xiaohong Gong  wrote:

>> Checking whether the indexes of masked lanes are inside of the valid memory 
>> boundary is necessary for masked vector memory access. However, this could 
>> be saved if the given offset is inside of the vector range that could make 
>> sure no IOOBE (IndexOutOfBoundaryException) happens. The masked load APIs 
>> have saved this kind of check for common cases. And this patch did the 
>> similar optimization for the masked vector store.
>> 
>> The performance for the new added store masked benchmarks improves about 
>> `1.83x ~ 2.62x` on a x86 system:
>> 
>> Benchmark   BeforeAfter Gain Units
>> StoreMaskedBenchmark.byteStoreArrayMask   12757.936 23291.118  1.826 ops/ms
>> StoreMaskedBenchmark.doubleStoreArrayMask  1520.932  3921.616  2.578 ops/ms
>> StoreMaskedBenchmark.floatStoreArrayMask   2713.031  7122.535  2.625 ops/ms
>> StoreMaskedBenchmark.intStoreArrayMask 4113.772  8220.206  1.998 ops/ms
>> StoreMaskedBenchmark.longStoreArrayMask1993.986  4874.148  2.444 ops/ms
>> StoreMaskedBenchmark.shortStoreArrayMask   8543.593 17821.086  2.086 ops/ms
>> 
>> Similar performane gain can also be observed on ARM hardware.
>
> Xiaohong Gong has updated the pull request with a new target base due to a 
> merge or a rebase. The pull request now contains three commits:
> 
>  - Merge branch 'jdk:master' to JDK-8286279
>  - Wrap the offset check into a static method
>  - 8286279: [vectorapi] Only check index of masked lanes if offset is out of 
> array boundary for masked store

Marked as reviewed by psandoz (Reviewer).

-

PR: https://git.openjdk.java.net/jdk/pull/8620


Re: RFR: 8283667: [vectorapi] Vectorization for masked load with IOOBE with predicate feature [v5]

2022-06-06 Thread Paul Sandoz
On Thu, 2 Jun 2022 03:27:59 GMT, Xiaohong Gong  wrote:

>> Currently the vector load with mask when the given index happens out of the 
>> array boundary is implemented with pure java scalar code to avoid the IOOBE 
>> (IndexOutOfBoundaryException). This is necessary for architectures that do 
>> not support the predicate feature. Because the masked load is implemented 
>> with a full vector load and a vector blend applied on it. And a full vector 
>> load will definitely cause the IOOBE which is not valid. However, for 
>> architectures that support the predicate feature like SVE/AVX-512/RVV, it 
>> can be vectorized with the predicated load instruction as long as the 
>> indexes of the masked lanes are within the bounds of the array. For these 
>> architectures, loading with unmasked lanes does not raise exception.
>> 
>> This patch adds the vectorization support for the masked load with IOOBE 
>> part. Please see the original java implementation (FIXME: optimize):
>> 
>> 
>>   @ForceInline
>>   public static
>>   ByteVector fromArray(VectorSpecies species,
>>byte[] a, int offset,
>>VectorMask m) {
>>   ByteSpecies vsp = (ByteSpecies) species;
>>   if (offset >= 0 && offset <= (a.length - species.length())) {
>>   return vsp.dummyVector().fromArray0(a, offset, m);
>>   }
>> 
>>   // FIXME: optimize
>>   checkMaskFromIndexSize(offset, vsp, m, 1, a.length);
>>   return vsp.vOp(m, i -> a[offset + i]);
>>   }
>> 
>> Since it can only be vectorized with the predicate load, the hotspot must 
>> check whether the current backend supports it and falls back to the java 
>> scalar version if not. This is different from the normal masked vector load 
>> that the compiler will generate a full vector load and a vector blend if the 
>> predicate load is not supported. So to let the compiler make the expected 
>> action, an additional flag (i.e. `usePred`) is added to the existing 
>> "loadMasked" intrinsic, with the value "true" for the IOOBE part while 
>> "false" for the normal load. And the compiler will fail to intrinsify if the 
>> flag is "true" and the predicate load is not supported by the backend, which 
>> means that normal java path will be executed.
>> 
>> Also adds the same vectorization support for masked:
>>  - fromByteArray/fromByteBuffer
>>  - fromBooleanArray
>>  - fromCharArray
>> 
>> The performance for the new added benchmarks improve about `1.88x ~ 30.26x` 
>> on the x86 AVX-512 system:
>> 
>> Benchmark  before   After  Units
>> LoadMaskedIOOBEBenchmark.byteLoadArrayMaskIOOBE   737.542 1387.069 ops/ms
>> LoadMaskedIOOBEBenchmark.doubleLoadArrayMaskIOOBE 118.366  330.776 ops/ms
>> LoadMaskedIOOBEBenchmark.floatLoadArrayMaskIOOBE  233.832 6125.026 ops/ms
>> LoadMaskedIOOBEBenchmark.intLoadArrayMaskIOOBE233.816 7075.923 ops/ms
>> LoadMaskedIOOBEBenchmark.longLoadArrayMaskIOOBE   119.771  330.587 ops/ms
>> LoadMaskedIOOBEBenchmark.shortLoadArrayMaskIOOBE  431.961  939.301 ops/ms
>> 
>> Similar performance gain can also be observed on 512-bit SVE system.
>
> Xiaohong Gong has updated the pull request with a new target base due to a 
> merge or a rebase. The pull request now contains five commits:
> 
>  - Merge branch 'jdk:master' into JDK-8283667
>  - Use integer constant for offsetInRange all the way through
>  - Rename "use_predicate" to "needs_predicate"
>  - Rename the "usePred" to "offsetInRange"
>  - 8283667: [vectorapi] Vectorization for masked load with IOOBE with 
> predicate feature

Looks good. As a follow on PR I think it would be useful to add constants 
`OFFSET_IN_RANGE` and `OFFSET_OUT_OF_RANGE`, then it becomes much clearer in 
source and you can drop the `/* offsetInRange */` comment on the argument.

-

Marked as reviewed by psandoz (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/8035


Re: RFR: 8287353: Use snippet tag instead of pre tag in Javadoc of InterruptedException [v3]

2022-06-06 Thread Jaikiran Pai
On Mon, 6 Jun 2022 14:58:25 GMT, Thiago Henrique Hüpner  
wrote:

>> 8287353: Use snippet tag instead of pre tag in Javadoc of 
>> InterruptedException
>
> Thiago Henrique Hüpner has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   Update copyright year

Marked as reviewed by jpai (Reviewer).

-

PR: https://git.openjdk.java.net/jdk/pull/8400


Re: RFR: 8287541: Files.writeString fails to throw IOException for charset "windows-1252"

2022-06-06 Thread Lance Andersen
On Fri, 3 Jun 2022 16:48:46 GMT, Naoto Sato  wrote:

> The code path calls `String.getBytesNoRepl()`, but it blindly replaces 
> unmappable characters with replacements if the encoder is an `ArrayEncoder`. 
> Changed only to do so if `doReplace` is `true` in 
> `String.encodeWithEncoder()`.

Marked as reviewed by lancea (Reviewer).

-

PR: https://git.openjdk.java.net/jdk/pull/9019


Re: RFR: 8287353: Use snippet tag instead of pre tag in Javadoc of InterruptedException [v3]

2022-06-06 Thread Thiago Henrique Hüpner
> 8287353: Use snippet tag instead of pre tag in Javadoc of InterruptedException

Thiago Henrique Hüpner has updated the pull request incrementally with one 
additional commit since the last revision:

  Update copyright year

-

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/8400/files
  - new: https://git.openjdk.java.net/jdk/pull/8400/files/f83dde2f..876f45c5

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk=8400=02
 - incr: https://webrevs.openjdk.java.net/?repo=jdk=8400=01-02

  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
  Patch: https://git.openjdk.java.net/jdk/pull/8400.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/8400/head:pull/8400

PR: https://git.openjdk.java.net/jdk/pull/8400


Re: RFR: 8287353: Use snippet tag instead of pre tag in Javadoc of InterruptedException

2022-06-06 Thread openjdk-notifier[bot]
On Wed, 27 Apr 2022 13:33:29 GMT, Thiago Henrique Hüpner 
 wrote:

>> 8287353: Use snippet tag instead of pre tag in Javadoc of 
>> InterruptedException
>
> If this is a valid change, could someone please create a Jira issue to link 
> to it?

@Thihup Please do not rebase or force-push to an active PR as it invalidates 
existing review comments. All changes will be squashed into a single commit 
automatically when integrating. See [OpenJDK Developers’ 
Guide](https://openjdk.java.net/guide/#working-with-pull-requests) for more 
information.

-

PR: https://git.openjdk.java.net/jdk/pull/8400


Re: RFR: 8279283 - BufferedInputStream should override transferTo [v5]

2022-06-06 Thread Markus KARG
On Mon, 27 Dec 2021 13:43:12 GMT, Markus KARG  wrote:

>> Implementation of JDK-8279283
>
> Markus KARG has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   fixed missing BufferedInputStream

I think we should turn it back to draft.

-

PR: https://git.openjdk.java.net/jdk/pull/6935


Re: RFR: 8287860: Revise usage of volatile in j.u.Locale [v2]

2022-06-06 Thread Сергей Цыпанов
On Mon, 6 Jun 2022 13:34:27 GMT, liach  wrote:

>> These fields can only be written once besides the default values, but they 
>> don't have to be written in the static initializer or constructor. So when a 
>> non-zero hash code is written, it's cached as if it's a final field. For a 
>> zero value, it would always undergo extra calculations like before and write 
>> multiple times, but the writes don't matter as it would only write zero, 
>> which would not yield false hash code if a previously written 0 value is 
>> cached.
>
>> Shouldn't the fields annotated with `@Stable` be `final` as well?
> 
> You might have seen `@Stable final` fields. Those are only meaningful for 
> arrays, where such caching happens at each array index. For non-arrays, 
> `@Stable final` is simply equivalent to `final`, and simple `@Stable` acts as 
> what I said above.

Done!

-

PR: https://git.openjdk.java.net/jdk/pull/9041


Re: RFR: 8287860: Revise usage of volatile in j.u.Locale [v2]

2022-06-06 Thread Сергей Цыпанов
> - cached hash code of `Locale` and `Locale$LanguageRange` shouldn't be 
> volatile, even in case of race in the worst case it is recalculated at most 
> once per thread
> - `defaultLocale` field is read multiple times in `initDefault()`
> - `isoLanguages` is accessed multiple times in `getISOLanguages()`
> - `languageTag` is read twice in `toLanguageTag()`

Сергей Цыпанов has updated the pull request incrementally with one additional 
commit since the last revision:

  8287860: Mark hash fields with @Stable

-

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/9041/files
  - new: https://git.openjdk.java.net/jdk/pull/9041/files/d64917f1..d4534346

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk=9041=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk=9041=00-01

  Stats: 5 lines in 2 files changed: 2 ins; 0 del; 3 mod
  Patch: https://git.openjdk.java.net/jdk/pull/9041.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/9041/head:pull/9041

PR: https://git.openjdk.java.net/jdk/pull/9041


Re: RFR: 8287353: Use snippet tag instead of pre tag in Javadoc of InterruptedException

2022-06-06 Thread Jaikiran Pai
On Wed, 27 Apr 2022 13:33:29 GMT, Thiago Henrique Hüpner 
 wrote:

>> 8287353: Use snippet tag instead of pre tag in Javadoc of 
>> InterruptedException
>
> If this is a valid change, could someone please create a Jira issue to link 
> to it?

Hello @Thihup, overall this change looks fine to me. Can you please update the 
copyright year on that file's header to `Copyright (c) 1995, 2022,`?

-

PR: https://git.openjdk.java.net/jdk/pull/8400


Re: RFR: JDK-8287838: Update Float and Double to use snippets

2022-06-06 Thread liach
On Sun, 5 Jun 2022 21:19:37 GMT, Joe Darcy  wrote:

> Various code blocks in Float and Double would be better as snippets.

src/java.base/share/classes/java/lang/Double.java line 643:

> 641:  * expression below can be used to screen the input string:
> 642:  *
> 643:  *  {@snippet lang="java" :

Mind remove the extra space before `{`?

-

PR: https://git.openjdk.java.net/jdk/pull/9034


Re: RFR: 8287860: Revise usage of volatile in j.u.Locale

2022-06-06 Thread liach
On Mon, 6 Jun 2022 13:28:44 GMT, Сергей Цыпанов  wrote:

>> src/java.base/share/classes/java/util/Locale.java line 2260:
>> 
>>> 2258:  * Calculated hashcode
>>> 2259:  */
>>> 2260: private transient volatile int hashCodeValue;
>> 
>> We can additionally annotate such cache fields with `@Stable` so as to 
>> enable constant-folding optimizations from the hotspot JIT.
>
> Shouldn't the fields annotated with `@Stable` be `final` as well?

These fields can only be written once besides the default values, but they 
don't have to be written in the static initializer or constructor. So when a 
non-zero hash code is written, it's cached as if it's a final field. For a zero 
value, it would always undergo extra calculations like before and write 
multiple times, but the writes don't matter as it would only write zero, which 
would not yield false hash code if a previously written 0 value is cached.

-

PR: https://git.openjdk.java.net/jdk/pull/9041


Re: RFR: 8287860: Revise usage of volatile in j.u.Locale

2022-06-06 Thread liach
On Mon, 6 Jun 2022 13:32:21 GMT, liach  wrote:

>> Shouldn't the fields annotated with `@Stable` be `final` as well?
>
> These fields can only be written once besides the default values, but they 
> don't have to be written in the static initializer or constructor. So when a 
> non-zero hash code is written, it's cached as if it's a final field. For a 
> zero value, it would always undergo extra calculations like before and write 
> multiple times, but the writes don't matter as it would only write zero, 
> which would not yield false hash code if a previously written 0 value is 
> cached.

> Shouldn't the fields annotated with `@Stable` be `final` as well?

You might have seen `@Stable final` fields. Those are only meaningful for 
arrays, where such caching happens at each array index. For non-arrays, 
`@Stable final` is simply equivalent to `final`, and simple `@Stable` acts as 
what I said above.

-

PR: https://git.openjdk.java.net/jdk/pull/9041


Re: RFR: 8287860: Revise usage of volatile in j.u.Locale

2022-06-06 Thread Сергей Цыпанов
On Mon, 6 Jun 2022 13:20:31 GMT, liach  wrote:

>> - cached hash code of `Locale` and `Locale$LanguageRange` shouldn't be 
>> volatile, even in case of race in the worst case it is recalculated at most 
>> once per thread
>> - `defaultLocale` field is read multiple times in `initDefault()`
>> - `isoLanguages` is accessed multiple times in `getISOLanguages()`
>> - `languageTag` is read twice in `toLanguageTag()`
>
> src/java.base/share/classes/java/util/Locale.java line 2260:
> 
>> 2258:  * Calculated hashcode
>> 2259:  */
>> 2260: private transient volatile int hashCodeValue;
> 
> We can additionally annotate such cache fields with `@Stable` so as to enable 
> constant-folding optimizations from the hotspot JIT.

Shouldn't the fields annotated with `@Stable` be `final` as well?

-

PR: https://git.openjdk.java.net/jdk/pull/9041


Re: RFR: 8287696: Avoid redundant Hashtable.containsKey call in JarVerifier.doneWithMeta

2022-06-06 Thread Jaikiran Pai
On Sat, 28 May 2022 12:00:00 GMT, Andrey Turbanov  wrote:

> Hashtable doesn't allow `null` values. So, instead of pair 
> `containsKey`/`remove` calls, we can directly call `remove` and then compare 
> result with `null`.
> https://github.com/openjdk/jdk/blob/2c461acfebd28fe5ef62805cbb004f91a3b18f08/src/java.base/share/classes/java/util/jar/JarVerifier.java#L433-L436

Looks fine to me. Please wait for another review before merging.

-

Marked as reviewed by jpai (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/8935


Re: RFR: 8287860: Revise usage of volatile in j.u.Locale

2022-06-06 Thread liach
On Mon, 6 Jun 2022 12:58:39 GMT, Сергей Цыпанов  wrote:

> - cached hash code of `Locale` and `Locale$LanguageRange` shouldn't be 
> volatile, even in case of race in the worst case it is recalculated at most 
> once per thread
> - `defaultLocale` field is read multiple times in `initDefault()`
> - `isoLanguages` is accessed multiple times in `getISOLanguages()`
> - `languageTag` is read twice in `toLanguageTag()`

src/java.base/share/classes/java/util/Locale.java line 2260:

> 2258:  * Calculated hashcode
> 2259:  */
> 2260: private transient volatile int hashCodeValue;

We can additionally annotate such cache fields with `@Stable` so as to enable 
constant-folding optimizations from the hotspot JIT.

-

PR: https://git.openjdk.java.net/jdk/pull/9041


Re: RFR: 8287541: Files.writeString fails to throw IOException for charset "windows-1252"

2022-06-06 Thread Jaikiran Pai
On Fri, 3 Jun 2022 16:48:46 GMT, Naoto Sato  wrote:

> The code path calls `String.getBytesNoRepl()`, but it blindly replaces 
> unmappable characters with replacements if the encoder is an `ArrayEncoder`. 
> Changed only to do so if `doReplace` is `true` in 
> `String.encodeWithEncoder()`.

Marked as reviewed by jpai (Reviewer).

-

PR: https://git.openjdk.java.net/jdk/pull/9019


RFR: 8287860: Revise usage of volatile in j.u.Locale

2022-06-06 Thread Сергей Цыпанов
- cached hash code of `Locale` and `Locale$LanguageRange` shouldn't be 
volatile, even in case of race in the worst case it is recalculated at most 
once per thread
- `defaultLocale` field is read multiple times in `initDefault()`
- `isoLanguages` is accessed multiple times in `getISOLanguages()`
- `languageTag` is read twice in `toLanguageTag()`

-

Commit messages:
 - 8287860: Revise usage of volatile in j.u.Locale

Changes: https://git.openjdk.java.net/jdk/pull/9041/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk=9041=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8287860
  Stats: 12 lines in 2 files changed: 3 ins; 0 del; 9 mod
  Patch: https://git.openjdk.java.net/jdk/pull/9041.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/9041/head:pull/9041

PR: https://git.openjdk.java.net/jdk/pull/9041


Re: RFR: 4511638: Double.toString(double) sometimes produces incorrect results [v15]

2022-06-06 Thread Andrew Dinn
On Wed, 1 Jun 2022 10:37:23 GMT, Raffaello Giulietti  
wrote:

>> Hello,
>> 
>> here's a PR for a patch submitted on March 2020 
>> [1](https://cr.openjdk.java.net/~bpb/4511638/webrev.04/) when Mercurial was 
>> a thing.
>> 
>> The patch has been edited to adhere to OpenJDK code conventions about 
>> multi-line (block) comments. Nothing in the code proper has changed, except 
>> for the addition of redundant but clarifying parentheses in some expressions.
>> 
>> 
>> Greetings
>> Raffaello
>
> Raffaello Giulietti has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   4511638: Double.toString(double) sometimes produces incorrect results

Hallelujah!

-

PR: https://git.openjdk.java.net/jdk/pull/3402


Re: RFR: 8283667: [vectorapi] Vectorization for masked load with IOOBE with predicate feature [v5]

2022-06-06 Thread Jatin Bhateja
On Thu, 2 Jun 2022 03:27:59 GMT, Xiaohong Gong  wrote:

>> Currently the vector load with mask when the given index happens out of the 
>> array boundary is implemented with pure java scalar code to avoid the IOOBE 
>> (IndexOutOfBoundaryException). This is necessary for architectures that do 
>> not support the predicate feature. Because the masked load is implemented 
>> with a full vector load and a vector blend applied on it. And a full vector 
>> load will definitely cause the IOOBE which is not valid. However, for 
>> architectures that support the predicate feature like SVE/AVX-512/RVV, it 
>> can be vectorized with the predicated load instruction as long as the 
>> indexes of the masked lanes are within the bounds of the array. For these 
>> architectures, loading with unmasked lanes does not raise exception.
>> 
>> This patch adds the vectorization support for the masked load with IOOBE 
>> part. Please see the original java implementation (FIXME: optimize):
>> 
>> 
>>   @ForceInline
>>   public static
>>   ByteVector fromArray(VectorSpecies species,
>>byte[] a, int offset,
>>VectorMask m) {
>>   ByteSpecies vsp = (ByteSpecies) species;
>>   if (offset >= 0 && offset <= (a.length - species.length())) {
>>   return vsp.dummyVector().fromArray0(a, offset, m);
>>   }
>> 
>>   // FIXME: optimize
>>   checkMaskFromIndexSize(offset, vsp, m, 1, a.length);
>>   return vsp.vOp(m, i -> a[offset + i]);
>>   }
>> 
>> Since it can only be vectorized with the predicate load, the hotspot must 
>> check whether the current backend supports it and falls back to the java 
>> scalar version if not. This is different from the normal masked vector load 
>> that the compiler will generate a full vector load and a vector blend if the 
>> predicate load is not supported. So to let the compiler make the expected 
>> action, an additional flag (i.e. `usePred`) is added to the existing 
>> "loadMasked" intrinsic, with the value "true" for the IOOBE part while 
>> "false" for the normal load. And the compiler will fail to intrinsify if the 
>> flag is "true" and the predicate load is not supported by the backend, which 
>> means that normal java path will be executed.
>> 
>> Also adds the same vectorization support for masked:
>>  - fromByteArray/fromByteBuffer
>>  - fromBooleanArray
>>  - fromCharArray
>> 
>> The performance for the new added benchmarks improve about `1.88x ~ 30.26x` 
>> on the x86 AVX-512 system:
>> 
>> Benchmark  before   After  Units
>> LoadMaskedIOOBEBenchmark.byteLoadArrayMaskIOOBE   737.542 1387.069 ops/ms
>> LoadMaskedIOOBEBenchmark.doubleLoadArrayMaskIOOBE 118.366  330.776 ops/ms
>> LoadMaskedIOOBEBenchmark.floatLoadArrayMaskIOOBE  233.832 6125.026 ops/ms
>> LoadMaskedIOOBEBenchmark.intLoadArrayMaskIOOBE233.816 7075.923 ops/ms
>> LoadMaskedIOOBEBenchmark.longLoadArrayMaskIOOBE   119.771  330.587 ops/ms
>> LoadMaskedIOOBEBenchmark.shortLoadArrayMaskIOOBE  431.961  939.301 ops/ms
>> 
>> Similar performance gain can also be observed on 512-bit SVE system.
>
> Xiaohong Gong has updated the pull request with a new target base due to a 
> merge or a rebase. The pull request now contains five commits:
> 
>  - Merge branch 'jdk:master' into JDK-8283667
>  - Use integer constant for offsetInRange all the way through
>  - Rename "use_predicate" to "needs_predicate"
>  - Rename the "usePred" to "offsetInRange"
>  - 8283667: [vectorapi] Vectorization for masked load with IOOBE with 
> predicate feature

test/micro/org/openjdk/bench/jdk/incubator/vector/LoadMaskedIOOBEBenchmark.java 
line 97:

> 95: public void byteLoadArrayMaskIOOBE() {
> 96: for (int i = 0; i < inSize; i += bspecies.length()) {
> 97: VectorMask mask = VectorMask.fromArray(bspecies, m, i);

For other case "if (offset >= 0 && offset <= (a.length - species.length())) )" 
we are anyways intrinsifying, should we limit this micro to work only for newly 
optimized case.

-

PR: https://git.openjdk.java.net/jdk/pull/8035


Re: RFR: 8279283 - BufferedInputStream should override transferTo [v5]

2022-06-06 Thread Alan Bateman
On Mon, 27 Dec 2021 13:43:12 GMT, Markus KARG  wrote:

>> Implementation of JDK-8279283
>
> Markus KARG has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   fixed missing BufferedInputStream

Can this PR be closed or returned to daft?

-

PR: https://git.openjdk.java.net/jdk/pull/6935


JDK-8186958 - Behaviour of large values for numMapping in WeakHashMap.newWeakHashMap API

2022-06-06 Thread Jaikiran Pai
In a recent enhancement we added new APIs to construct LinkedHashMap, 
HashMap and WeakHashMap instances as part of 
https://bugs.openjdk.java.net/browse/JDK-8186958.


Since we missed adding tests for that change, I have been working on 
adding some basic tests for this change as part of 
https://bugs.openjdk.java.net/browse/JDK-8285405. The draft PR is here 
https://github.com/openjdk/jdk/pull/9036.


It's in draft state because it has uncovered an aspect of this change 
that we might have to address or document for these new APIs. 
Specifically, the tests I added now have a test which does the 
equivalent of:


// numMappings = 2147483647
var w = WeakHashMap.newWeakHashMap(Integer.MAX_VALUE);

Similar tests have been added for HashMap and LinkedHashMap too, but for 
the sake of this discussion, I'll focus on WeakHashMap. Running this 
code/test runs into:


test NewWeakHashMap.testNewWeakHashMapNonNegative(2147483647): failure
java.lang.OutOfMemoryError: Java heap space
    at java.base/java.util.WeakHashMap.newTable(WeakHashMap.java:194)
    at java.base/java.util.WeakHashMap.(WeakHashMap.java:221)
    at java.base/java.util.WeakHashMap.(WeakHashMap.java:238)
    at 
java.base/java.util.WeakHashMap.newWeakHashMap(WeakHashMap.java:1363)

    at NewWeakHashMap.testNewWeakHashMapNonNegative(NewWeakHashMap.java:69)


This exception happens with only WeakHashMap. LinkedHashMap and HashMap 
don't show this behaviour. It appears that WeakHashMap eagerly creates 
an large array (of length 1073741824 in this case) in the newTable 
method which gets called by its constructor.


This raises a few questions about these new APIs - these APIs take an 
integer and the document allows positive values. So the current 
Integer.MAX_VALUE in theory is a valid integer value for this API. 
Should these APIs document what might happen when such a large 
numMapping is passed to it? Should that documentation be different for 
different classes (as seen the HashMap and LinkedHashMap behave 
differently as compared to WeakHashMap)? Should this "numMappings" be 
considered a hard value? In other words, the current documentation of 
this new API states:


"Creates a new, empty WeakHashMap suitable for the expected number of 
mappings


and its initial capacity is generally large enough so that the expected 
number

of mappings can be added without resizing the map."

The documentation doesn't seem to guarantee that the resizing won't 
occur. So in cases like these where the numMappings is a very large 
value, should the implementation(s) have logic which doesn't trigger 
this OOM error?


-Jaikiran