Re: RFR: 8361842: Move input validation checks to Java for java.lang.StringCoding intrinsics [v8]

2025-07-18 Thread John R Rose
On Fri, 18 Jul 2025 23:18:16 GMT, John R Rose wrote: > If (as in this case) IC2 loops over calls to IC1 Correction; I meant IC1 calls IC2, in a loop, N times. We don't want a pre-loop in M1 that checks each of N distinct arguments to IC2 (like N calls to M2 would), but rather a bat

Re: RFR: 8361842: Move input validation checks to Java for java.lang.StringCoding intrinsics [v8]

2025-07-18 Thread John R Rose
On Thu, 17 Jul 2025 15:33:37 GMT, Raffaello Giulietti wrote: > What is the thinking when an `@IntrinsicCandidate` method invokes another > `@IntrinsicCandidate` method? Which part is responsible for the checks? This is a good question. Suppose IC1 calls IC2 and both are intrinsic candidates,

Re: RFR: 8315131: Clarify VarHandle set/get access on 32-bit platforms [v5]

2025-07-17 Thread John R Rose
On Thu, 17 Jul 2025 18:28:04 GMT, Chen Liang wrote: >> On 32 bit platforms, when an access to long/double is aligned, it is >> supported but not atomic. The original wording in >> `MethodHandles::byteBufferViewVarHandle` sounds as if it is not supported at >> all. We can fix that by borrowing

Re: RFR: 8315131: Clarify VarHandle set/get access on 32-bit platforms [v3]

2025-07-17 Thread John R Rose
On Thu, 17 Jul 2025 18:00:31 GMT, Chen Liang wrote: >> src/java.base/share/classes/java/lang/foreign/MemoryLayout.java line 281: >> >>> 279: * read write access modes for all {@code T}. On 32-bit platforms, >>> access modes >>> 280: * {@code get} and {@code set} for {@code long}, {@code d

Re: RFR: 8362376: Use @Stable annotation in Java FDLIBM implementation

2025-07-16 Thread John R Rose
On Wed, 16 Jul 2025 04:53:04 GMT, Joe Darcy wrote: > Add `@Stable` to the static final arrays used in the Java port of FDLIBM. The effect of this PR is to make the affected array elements eligible for constant-folding by the JIT. The contract of `@Stable` is private to the JDK, since it is a t

Re: RFR: 8361842: Validate input in both Java and C++ for java.lang.StringCoding intrinsics

2025-07-10 Thread John R Rose
On Thu, 26 Jun 2025 10:48:37 GMT, Volkan Yazici wrote: > Validate input in `java.lang.StringCoding` intrinsic Java wrappers, improve > their documentation, enhance the checks in the associated C++ methods, and > adapt them to cause VM crash on invalid input. > > ## Implementation notes > > Th

Re: RFR: 8360303: Remove two unused invoke files

2025-06-25 Thread John R Rose
On Mon, 23 Jun 2025 22:48:52 GMT, Chen Liang wrote: > sun.invoke.empty.Empty and java.lang.invoke.InvokeDynamic are useless > remnants - Empty can be replaced by java.lang.Void, and InvokeDynamic was > previously used as a stub for javac to compile signature polymorphic methods. > They should

Re: RFR: 8360163: Create annotations to mark dumping method handles and runtime setup required classes

2025-06-24 Thread John R Rose
On Sat, 21 Jun 2025 00:03:26 GMT, Chen Liang wrote: > Currently, the list of classes that have interdependencies and those > that need runtimeSetup are maintained in a hardcoded list in CDS. This makes > it risky for core library developers as they might introduce new > interdependencies and

Re: RFR: 8354674: AArch64: Intrinsify Unsafe::setMemory [v8]

2025-05-22 Thread John R Rose
On Thu, 15 May 2025 16:03:44 GMT, Andrew Haley wrote: >> This intrinsic is generally faster than the current implementation for >> Panama segment operations for all writes larger than about 8 bytes in size, >> increasing to more than 2* the performance on larger memory blocks on >> Graviton 2,

Re: RFR: 8357531: The `SegmentBulkOperations::fill` method can be improved using overlaps [v5]

2025-05-22 Thread John R Rose
On Thu, 22 May 2025 11:52:34 GMT, Per Minborg wrote: >> This PR builds on a concept John Rose told me about some time ago. Instead >> of combining memory operations of various sizes, a single large and skewed >> memory operation can be made to clean up the tail of remaining bytes. >> >> This h

Re: RFR: 8357531: The `SegmentBulkOperations::fill` method can be improved using overlaps [v5]

2025-05-22 Thread John R Rose
On Thu, 22 May 2025 11:52:34 GMT, Per Minborg wrote: >> This PR builds on a concept John Rose told me about some time ago. Instead >> of combining memory operations of various sizes, a single large and skewed >> memory operation can be made to clean up the tail of remaining bytes. >> >> This h

Re: RFR: 8355223: Improve documentation on @IntrinsicCandidate [v6]

2025-05-16 Thread John R Rose
On Wed, 30 Apr 2025 22:26:30 GMT, Chen Liang wrote: >> In offline discussion, we noted that the documentation on this annotation >> does not recommend minimizing the intrinsified section and moving whatever >> can be done in Java to Java; thus I prepared this documentation update, to >> shrink

Re: RFR: 8355223: Improve documentation on @IntrinsicCandidate [v6]

2025-05-16 Thread John R Rose
On Wed, 30 Apr 2025 22:26:30 GMT, Chen Liang wrote: >> In offline discussion, we noted that the documentation on this annotation >> does not recommend minimizing the intrinsified section and moving whatever >> can be done in Java to Java; thus I prepared this documentation update, to >> shrink

Re: RFR: 8353197: Document preconditions for JavaLangAccess methods [v2]

2025-05-13 Thread John R Rose
On Wed, 7 May 2025 11:17:19 GMT, Volkan Yazici wrote: >> src/java.base/share/classes/jdk/internal/access/JavaLangAccess.java line 302: >> >>> 300: * WARNING: This method does not perform any bound checks. >>> 301: */ >>> 302: int countPositives(byte[] ba, int off, int len); >> >>

Re: RFR: 8351996: Behavioral updates for ClassValue::remove [v10]

2025-04-29 Thread John R Rose
On Tue, 29 Apr 2025 19:03:08 GMT, Chen Liang wrote: >> The recent patch #23866 makes calling `ClassValue::remove()` from >> `ClassValue::computeValue()` end up in infinite loops while fixing the stale >> value risk from the method. >> >> The proposed fix is to preserve the stale value risk fix

Re: RFR: 8351996: Behavioral updates for ClassValue::remove [v6]

2025-04-26 Thread John R Rose
On Sun, 27 Apr 2025 04:50:37 GMT, Chen Liang wrote: >> The recent patch #23866 makes calling `ClassValue::remove()` from >> `ClassValue::computeValue()` end up in infinite loops while fixing the stale >> value risk from the method. >> >> The proposed fix is to preserve the stale value risk fix

Re: RFR: 8351996: Behavioral updates for ClassValue::remove [v6]

2025-04-26 Thread John R Rose
On Sun, 27 Apr 2025 04:50:37 GMT, Chen Liang wrote: >> The recent patch #23866 makes calling `ClassValue::remove()` from >> `ClassValue::computeValue()` end up in infinite loops while fixing the stale >> value risk from the method. >> >> The proposed fix is to preserve the stale value risk fix

Re: RFR: 8351996: Behavioral updates for ClassValue::remove [v5]

2025-04-26 Thread John R Rose
On Fri, 21 Mar 2025 19:44:48 GMT, Chen Liang wrote: >> The recent patch #23866 makes calling `ClassValue::remove()` from >> `ClassValue::computeValue()` end up in infinite loops while fixing the stale >> value risk from the method. >> >> The proposed fix is to preserve the stale value risk fix

Re: RFR: 8342283: CDS cannot handle a large number of classes

2025-04-25 Thread John R Rose
On Fri, 25 Apr 2025 14:49:37 GMT, Aleksey Shipilev wrote: > CDS cannot handle large number of classes, because `ClassLoader` data > structures get too large for CDS archival. The new test captures such an > occasion. We do `clear()`-s, but that is not enough to trim the backing > storages for

Re: RFR: 8355223: Improve documentation on @IntrinsicCandidate [v3]

2025-04-22 Thread John R Rose
On Tue, 22 Apr 2025 20:58:21 GMT, Chen Liang wrote: >> In offline discussion, we noted that the documentation on this annotation >> does not recommend minimizing the intrinsified section and moving whatever >> can be done in Java to Java; thus I prepared this documentation update, to >> shrink

Re: RFR: 8355223: Improve documentation on @IntrinsicCandidate [v3]

2025-04-22 Thread John R Rose
On Tue, 22 Apr 2025 20:58:21 GMT, Chen Liang wrote: >> In offline discussion, we noted that the documentation on this annotation >> does not recommend minimizing the intrinsified section and moving whatever >> can be done in Java to Java; thus I prepared this documentation update, to >> shrink

Re: RFR: 8355223: Improve documentation on @IntrinsicCandidate [v2]

2025-04-22 Thread John R Rose
On Tue, 22 Apr 2025 21:01:13 GMT, Chen Liang wrote: >> In the new design, the above "footnotes" go at the bottom. They explain why >> the rules prescribed at the top are important. In effect, inform aggressive >> implementors how far they may bend those rules. Sometimes the rules do get >>

Re: RFR: 8355223: Improve documentation on @IntrinsicCandidate [v2]

2025-04-22 Thread John R Rose
On Tue, 22 Apr 2025 18:38:42 GMT, John R Rose wrote: >> src/java.base/share/classes/jdk/internal/vm/annotation/IntrinsicCandidate.java >> line 58: >> >>> 56: * The HotSpot VM checks, when loading a class, the consistency of >>> recognized >>>

Re: RFR: 8355223: Improve documentation on @IntrinsicCandidate [v2]

2025-04-22 Thread John R Rose
On Tue, 22 Apr 2025 18:23:52 GMT, John R Rose wrote: >> Chen Liang has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Refine validation and defensive copying > > src/java.base/share/clas

Re: RFR: 8355223: Improve documentation on @IntrinsicCandidate [v2]

2025-04-22 Thread John R Rose
On Mon, 21 Apr 2025 20:12:19 GMT, Chen Liang wrote: >> In offline discussion, we noted that the documentation on this annotation >> does not recommend minimizing the intrinsified section and moving whatever >> can be done in Java to Java; thus I prepared this documentation update, to >> shrink

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v6]

2025-03-18 Thread John R Rose
On Thu, 13 Mar 2025 15:22:43 GMT, Per Minborg wrote: >> Implement JEP 502. >> >> The PR passes tier1-tier3 tests. > > Per Minborg has updated the pull request with a new target base due to a > merge or a rebase. The pull request now contains 246 commits: > > - Merge branch 'master' into imple

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v6]

2025-03-15 Thread John R Rose
On Thu, 13 Mar 2025 15:22:43 GMT, Per Minborg wrote: >> Implement JEP 502. >> >> The PR passes tier1-tier3 tests. > > Per Minborg has updated the pull request with a new target base due to a > merge or a rebase. The pull request now contains 246 commits: > > - Merge branch 'master' into imple

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v6]

2025-03-15 Thread John R Rose
On Thu, 13 Mar 2025 15:22:43 GMT, Per Minborg wrote: >> Implement JEP 502. >> >> The PR passes tier1-tier3 tests. > > Per Minborg has updated the pull request with a new target base due to a > merge or a rebase. The pull request now contains 246 commits: > > - Merge branch 'master' into imple

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v6]

2025-03-15 Thread John R Rose
On Thu, 13 Mar 2025 15:22:43 GMT, Per Minborg wrote: >> Implement JEP 502. >> >> The PR passes tier1-tier3 tests. > > Per Minborg has updated the pull request with a new target base due to a > merge or a rebase. The pull request now contains 246 commits: > > - Merge branch 'master' into imple

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v6]

2025-03-15 Thread John R Rose
On Thu, 13 Mar 2025 15:22:43 GMT, Per Minborg wrote: >> Implement JEP 502. >> >> The PR passes tier1-tier3 tests. > > Per Minborg has updated the pull request with a new target base due to a > merge or a rebase. The pull request now contains 246 commits: > > - Merge branch 'master' into imple

Re: RFR: 8350607: Consolidate MethodHandles::zero into MethodHandles::constant [v2]

2025-03-04 Thread John R Rose
On Mon, 24 Feb 2025 23:45:37 GMT, Chen Liang wrote: >> LF editor spins classes, this avoids the spinning overhead and should speed >> up non-capturing lambdas too. >> >> There may need to be additional intrinsic work for MH combinator lf bytecode >> generation. > > Chen Liang has updated the p

Re: RFR: 8351045: ClassValue::remove cannot ensure computation observes up-to-date state

2025-03-04 Thread John R Rose
On Mon, 3 Mar 2025 15:24:05 GMT, Chen Liang wrote: > After a call to `ClassValue.remove`, a `ClassValue` can still install a value > that is computed with information that is not up-to-date with the remove > call. This is demonstrated in the test case, where an innocuous > `ClassValue.get` cal

Re: RFR: 8350607: Consolidate MethodHandles::zero into MethodHandles::constant

2025-02-24 Thread John R Rose
On Thu, 20 Feb 2025 02:33:59 GMT, Chen Liang wrote: > LF editor spins classes, this avoids the spinning overhead and should speed > up non-capturing lambdas too. > > There may need to be additional intrinsic work for MH combinator lf bytecode > generation. You are on the right track. Some of

Re: RFR: 8342103: C2 compiler support for Float16 type and associated operations

2024-11-19 Thread John R Rose
On Mon, 14 Oct 2024 11:40:01 GMT, Jatin Bhateja wrote: > Hi All, > > This patch adds C2 compiler support for various Float16 operations added by > [PR#22128](https://github.com/openjdk/jdk/pull/22128) > > Following is the summary of changes included with this patch:- > > 1. Detection of vario

Re: RFR: 8331497: Implement JEP 483: Ahead-of-Time Class Loading & Linking [v14]

2024-11-15 Thread John R Rose
On Fri, 15 Nov 2024 16:38:20 GMT, Ioi Lam wrote: >> This is an implementation of [JEP 483: Ahead-of-Time Class Loading & >> Linking](https://openjdk.org/jeps/483). >> >> >> Note: this is a combined PR of the following individual PRs >> - https://github.com/openjdk/jdk/pull/20516 >> - https

Re: RFR: 8331497: Implement JEP 483: Ahead-of-Time Class Loading & Linking [v12]

2024-11-14 Thread John R Rose
On Fri, 15 Nov 2024 05:48:27 GMT, Ioi Lam wrote: >> This is an implementation of [JEP 483: Ahead-of-Time Class Loading & >> Linking](https://openjdk.org/jeps/483). >> >> >> Note: this is a combined PR of the following individual PRs >> - https://github.com/openjdk/jdk/pull/20516 >> - https

Re: RFR: 8342283: CDS cannot handle a large number of classes

2024-10-30 Thread John R Rose
On Thu, 31 Oct 2024 03:52:16 GMT, Ioi Lam wrote: > When lots of classes are loaded during `java -Xshare:dump`, the internal > arrays used by some of the HashMaps and ArrayLists become too large to be > archived by CDS (> 256KB). > > At the very end of Java bytecode execution during `java -Xsha

Re: Integrated: JDK-8289775: Update java.lang.invoke.MethodHandle[s] to use snippets

2024-10-28 Thread John R Rose
On Tue, 5 Jul 2022 22:22:46 GMT, Joe Darcy wrote: > Update existing examples in java.lang.invoke.{MethodHandle, MethodHandles} > to use snippets rather than the older markup idiom. The code examples in these files were exdented to make it easier to extract example code and test it, and to mai

Re: RFR: 8331497: Implement JEP 483: Ahead-of-Time Class Loading & Linking [v4]

2024-10-24 Thread John R Rose
On Thu, 24 Oct 2024 03:01:54 GMT, Ioi Lam wrote: >> This is an implementation of [JEP 483: Ahead-of-Time Class Loading & >> Linking](https://openjdk.org/jeps/483). >> >> >> Note: this is a combined PR of the following individual PRs >> - https://github.com/openjdk/jdk/pull/20516 >> - https

Re: RFR: 8331497: Implement JEP 483: Ahead-of-Time Class Loading & Linking [v4]

2024-10-23 Thread John R Rose
On Thu, 24 Oct 2024 03:01:54 GMT, Ioi Lam wrote: >> This is an implementation of [JEP 483: Ahead-of-Time Class Loading & >> Linking](https://openjdk.org/jeps/483). >> >> >> Note: this is a combined PR of the following individual PRs >> - https://github.com/openjdk/jdk/pull/20516 >> - https

Re: RFR: 8331497: Implement JEP 483: Ahead-of-Time Class Loading & Linking [v4]

2024-10-23 Thread John R Rose
On Thu, 24 Oct 2024 03:01:54 GMT, Ioi Lam wrote: >> This is an implementation of [JEP 483: Ahead-of-Time Class Loading & >> Linking](https://openjdk.org/jeps/483). >> >> >> Note: this is a combined PR of the following individual PRs >> - https://github.com/openjdk/jdk/pull/20516 >> - https

Re: RFR: 8341260: Add Float16 to jdk.incubator.vector

2024-10-19 Thread John R Rose
On Thu, 17 Oct 2024 23:11:07 GMT, Joe Darcy wrote: > Port of Float16 from java.lang in the lworld+fp16 branch to > jdk.incubabor.vector. Comparing with https://github.com/openjdk/jdk/pull/21490 we can see that there are more than minimum number of intrinsics I recommended above, but (crucially

Re: RFR: 8341260: Add Float16 to jdk.incubator.vector

2024-10-19 Thread John R Rose
On Thu, 17 Oct 2024 23:11:07 GMT, Joe Darcy wrote: > Port of Float16 from java.lang in the lworld+fp16 branch to > jdk.incubabor.vector. Somebody might ask as a followup, "But what about calling sequences? Without intrinsics, how does the JIT know to store Float16 values in the correct type

Re: RFR: 8341260: Add Float16 to jdk.incubator.vector

2024-10-19 Thread John R Rose
On Thu, 17 Oct 2024 23:11:07 GMT, Joe Darcy wrote: > Port of Float16 from java.lang in the lworld+fp16 branch to > jdk.incubabor.vector. Joe, our revised and now-current thinking about JIT support for the Float16 (both as a pre-Valhalla VBC and Valhalla value class) is that there should be ze

Re: RFR: 8327624: Remove VM implementation that bypass verification for core reflection [v2]

2024-10-17 Thread John R Rose
On Thu, 17 Oct 2024 22:44:05 GMT, Mandy Chung wrote: >> The old core reflection implementation generates dynamic classes that are >> special cases in the VM to bypass bytecode verification to workaround >> various issues [1] [2] [3]. >> >> The old core reflection implementation was [removed in

Re: RFR: 8293336: AOT-linking of invokedynamic for lambda expression and string concat [v8]

2024-10-17 Thread John R Rose
On Thu, 17 Oct 2024 04:19:27 GMT, Ioi Lam wrote: >> This is the 7th and final PR for [JEP 483: Ahead-of-Time Class Loading & >> Linking](https://bugs.openjdk.org/browse/JDK-8315737). >> >> This PR implements the AOT-linking of invokedynamic callsites: >> - We only link lambda expressions (`Lamb

Re: RFR: 8319343: Improve CDS module graph support for --add-modules option

2024-10-16 Thread John R Rose
On Wed, 16 Oct 2024 22:46:40 GMT, Calvin Cheung wrote: > Summary of changes: > > Before dumping info the archive, all the module names from `--add-modules` > will be sorted and then concatenated into one string with comma as the > separator between module names. > > During runtime, same funct

Re: RFR: 8311071: Avoid SoftReferences in LambdaFormEditor and MethodTypeForm when storing heap objects into AOT cache [v7]

2024-10-10 Thread John R Rose
On Wed, 2 Oct 2024 01:06:20 GMT, Ioi Lam wrote: >> This is the 6th PR for [JEP 483: Ahead-of-Time Class Loading & >> Linking](https://bugs.openjdk.org/browse/JDK-8315737). >> >> The implementation of java.lang.invoke uses SoftReferences so that unused >> MethodHandles, LambdaForms, etc, can be

Re: RFR: 8311071: Avoid SoftReferences in LambdaFormEditor and MethodTypeForm when storing heap objects into AOT cache [v7]

2024-10-09 Thread John R Rose
On Wed, 2 Oct 2024 01:06:20 GMT, Ioi Lam wrote: >> This is the 6th PR for [JEP 483: Ahead-of-Time Class Loading & >> Linking](https://bugs.openjdk.org/browse/JDK-8315737). >> >> The implementation of java.lang.invoke uses SoftReferences so that unused >> MethodHandles, LambdaForms, etc, can be

Re: RFR: 8338526: Don't store abstract and interface Klasses in class metaspace [v6]

2024-10-09 Thread John R Rose
On Fri, 6 Sep 2024 16:20:52 GMT, Coleen Phillimore wrote: >> This change stores InstanceKlass for interface and abstract classes in the >> non-class metaspace, since class metaspace will have limits on number of >> classes that can be represented when Lilliput changes go in. Classes that >> h

Re: RFR: 8338526: Don't store abstract and interface Klasses in class metaspace [v6]

2024-10-09 Thread John R Rose
On Wed, 9 Oct 2024 16:07:19 GMT, Andrew Haley wrote: > simply(?) by allocating everything contiguously Suddenly I seem to hear Boromir and Yoda, in unison, saying, "One does not simply." - PR Comment: https://git.openjdk.org/jdk/pull/19157#issuecomment-2402756530

Re: RFR: 8338526: Don't store abstract and interface Klasses in class metaspace [v6]

2024-10-08 Thread John R Rose
On Fri, 6 Sep 2024 16:20:52 GMT, Coleen Phillimore wrote: >> This change stores InstanceKlass for interface and abstract classes in the >> non-class metaspace, since class metaspace will have limits on number of >> classes that can be represented when Lilliput changes go in. Classes that >> h

Re: RFR: 8340838: Clean up MutableCallSite to use explicit release fence instead of AtomicInteger

2024-09-24 Thread John R Rose
On Tue, 24 Sep 2024 20:21:48 GMT, Chen Liang wrote: > This implementation code was written in JDK 7, before storeFence was > available in JDK 8. We should update this legacy code to make it clear. Good, thank you. Nice to see that silly variable go away. - Marked as reviewed by j

Re: RFR: 8311188: Simplify and modernize equals and hashCode in java.text [v4]

2023-07-12 Thread John R Rose
On Fri, 7 Jul 2023 00:39:20 GMT, Pavel Rappo wrote: >> Thanks @rose00 for the writeup and @pavelrappo for asking pertinent followup >> questions. >> >> For me the issue here is that there is a bunch of lore about avoiding >> `Objects::equals` and it's embodied in comments like this: >> >>> NB

Re: RFR: 8311188: Simplify and modernize equals and hashCode in java.text

2023-07-04 Thread John R Rose
On Tue, 4 Jul 2023 01:01:22 GMT, Pavel Rappo wrote: >> Hmm, I think that issue refers to code that have explicit non-Object >> parameter types (like `X::equals(Object)boolean` in the issue's sample). >> This method already have both arguments as `Object`, so I don't think >> there's any type-s

Re: RFR: 8289220: Locale.forLanguageTag throws NPE due to soft ref used in locale cache being cleared [v3]

2023-06-06 Thread John R Rose
On Tue, 6 Jun 2023 18:45:50 GMT, Erik Österlund wrote: >> For hotspot, when GC occurs, it causes all threads to run to the nearest >> safepoint and then freeze. Generally, safepoints are generated at branch >> jumps, method ends(ret instructions), loops instructions, and so on. >> Therefore, t

Re: RFR: 6983726: Reimplement MethodHandleProxies.asInterfaceInstance [v11]

2023-05-02 Thread John R Rose
On Mon, 1 May 2023 22:23:11 GMT, Chen Liang wrote: > It had an invocation performance of 2ns/op as opposed to Proxy's 6ns/op, but > the condy implementation has 0.41ns/op. Good, so let’s take the win relative to 6ns/op metric. The condy implementation devotes a whole class to a single MH, so i

Re: RFR: 6983726: Reimplement MethodHandleProxies.asInterfaceInstance [v11]

2023-05-01 Thread John R Rose
On Mon, 1 May 2023 21:37:07 GMT, Johannes Kuhn wrote: > `assertOriginalLookupOf` Yes, that’s the sort of thing I’d expect. It could go into a `jdk.internal.reflect` class. Now that we have modules, JDK platform code can use public APIs not accessible to normal users. Also, the static helper

Re: RFR: 6983726: Reimplement MethodHandleProxies.asInterfaceInstance [v11]

2023-05-01 Thread John R Rose
On Mon, 1 May 2023 14:56:27 GMT, Chen Liang wrote: >> As John Rose has pointed out in this issue, the current j.l.r.Proxy based >> implementation of MethodHandleProxies.asInterface has a few issues: >> 1. Exposes too much information via Proxy supertype (and WrapperInstance >> interface) >> 2.

Re: RFR: 8306075: Micro-optimize Enum.hashCode [v6]

2023-04-17 Thread John R Rose
On Mon, 17 Apr 2023 16:42:38 GMT, olivergillespie wrote: >> Improve the speed of Enum.hashCode by caching the identity hashcode on first >> use. I've seen an application where Enum.hashCode is a hot path, and this is >> fairly simple speedup. The memory overhead is low; in enums with no extra

Re: RFR: 8301958: Avoid Arrays.copyOfRange overhead in java.lang.String [v5]

2023-02-07 Thread John R Rose
On Tue, 7 Feb 2023 15:25:05 GMT, Claes Redestad wrote: >> This adds a local, specialized `copyBytes` method to `String` that avoids >> certain redundant range checks and clamping that JIT has issues removing >> fully. >> >> This has a small but statistically significant effect on `String` >>

Re: RFR: 8301958: Avoid Arrays.copyOfRange overhead in java.lang.String [v5]

2023-02-07 Thread John R Rose
On Tue, 7 Feb 2023 15:25:05 GMT, Claes Redestad wrote: >> This adds a local, specialized `copyBytes` method to `String` that avoids >> certain redundant range checks and clamping that JIT has issues removing >> fully. >> >> This has a small but statistically significant effect on `String` >>

Re: RFR: 8301958: Avoid Arrays.copyOfRange overhead in java.lang.String [v5]

2023-02-07 Thread John R Rose
On Tue, 7 Feb 2023 15:25:05 GMT, Claes Redestad wrote: >> This adds a local, specialized `copyBytes` method to `String` that avoids >> certain redundant range checks and clamping that JIT has issues removing >> fully. >> >> This has a small but statistically significant effect on `String` >>

Re: RFR: 8300487: Store cardinality as a field in BitSet [v5]

2023-01-19 Thread John R Rose
On Wed, 18 Jan 2023 12:43:31 GMT, fabioromano1 wrote: >> The enanchment is useful for applications that make heavy use of BitSet >> objects as sets of integers, and therefore they need to make a lot of calls >> to cardinality() method, which actually require linear time in the number of >> wor

Re: RFR: JDK-8294539: Augment discussion of equivlance relations on floating-point values

2022-09-29 Thread John R Rose
On Thu, 29 Sep 2022 22:14:24 GMT, Joe Darcy wrote: > While the floating-point == operation is *not* an equivalence relation, there > are useful equivalence relations that can be defined over floating-point > values. Text is added to java.lang.Double to discuss and name those relations. src/jav

Re: RFR: JDK-8289551: Conversions between bit representations of half precision values and floats [v6]

2022-07-22 Thread John R Rose
On Fri, 22 Jul 2022 01:29:57 GMT, Joe Darcy wrote: >> Initial implementation. > > Joe Darcy has updated the pull request incrementally with one additional > commit since the last revision: > > Implement review feedback. Looks good. - Marked as reviewed by jrose (Reviewer). PR:

Re: RFR: JDK-8277095 : Empty streams create too many objects [v2]

2022-07-20 Thread John R Rose
On Tue, 16 Nov 2021 20:53:26 GMT, kabutz wrote: >> This is a draft proposal for how we could improve stream performance for the >> case where the streams are empty. Empty collections are common-place. If we >> iterate over them with an Iterator, we would have to create one small >> Iterator ob

Re: RFR: JDK-8289551: Conversions between bit representations of half precision values and floats

2022-07-12 Thread John R Rose
On Fri, 8 Jul 2022 06:11:22 GMT, Joe Darcy wrote: > Initial implementation. src/java.base/share/classes/java/lang/Float.java line 1003: > 1001: float abs_f = Math.abs(f); > 1002: int doppel = Float.floatToRawIntBits(f); > 1003: int f_sign = 0x8000_ & doppel; The cod

Re: RFR: JDK-8289775: Update java.lang.invoke.MethodHandle[s] to use snippets

2022-07-07 Thread John R Rose
On Tue, 5 Jul 2022 22:22:46 GMT, Joe Darcy wrote: > Update existing examples in java.lang.invoke.{MethodHandle, MethodHandles} > to use snippets rather than the older markup idiom. The code examples in these files were exdented to make it easier to extract example code and test it, and to mai