From rriggs at openjdk.java.net Wed Jun 1 17:02:01 2022 From: rriggs at openjdk.java.net (Roger Riggs) Date: Wed, 1 Jun 2022 17:02:01 GMT Subject: [lworld] RFR: Add Class.isIdentity In-Reply-To: References: Message-ID: On Tue, 31 May 2022 18:35:40 GMT, Mandy Chung wrote: >> Add j.l.Class.isIdentity() as a complement to Class.isValue() and Class.isPrimitiveClass. >> >> Class.getModifiers() is updated to remove VM was suppressing the ACC_IDENTITY bit (previously known as ACC_SUPER). >> >> Updated Class.toString() to reflect the addition of ACC_IDENTITY. >> For regular identity classes and interfaces, there is no change to toString. >> >> Removed the obsolete test for ACC_SUPER >> >> This PR may need to wait for corresponding VM changes. > > src/hotspot/share/oops/instanceKlass.cpp line 3398: > >> 3396: } >> 3397: } >> 3398: // Do not strip ACC_SUPER, its ACC_IDENTITY now > > I think this should apply only if `EnableValhalla` (or `--enable-preview` is set). The semantics of the bit are dependent on (at least) the class file version. That's part of the modifier problem, the bit(s) are/will/need to be interpreted differently depending on the class file version and source (class vs member). Solution is TBD. Preview is not implemented yet. ------------- PR: https://git.openjdk.java.net/valhalla/pull/700 From mchung at openjdk.java.net Wed Jun 1 17:22:59 2022 From: mchung at openjdk.java.net (Mandy Chung) Date: Wed, 1 Jun 2022 17:22:59 GMT Subject: [lworld] RFR: Add Class.isIdentity In-Reply-To: References: Message-ID: On Wed, 1 Jun 2022 16:57:59 GMT, Roger Riggs wrote: >> src/hotspot/share/oops/instanceKlass.cpp line 3398: >> >>> 3396: } >>> 3397: } >>> 3398: // Do not strip ACC_SUPER, its ACC_IDENTITY now >> >> I think this should apply only if `EnableValhalla` (or `--enable-preview` is set). > > The semantics of the bit are dependent on (at least) the class file version. > That's part of the modifier problem, the bit(s) are/will/need to be interpreted differently depending on the class file version and source (class vs member). Solution is TBD. > Preview is not implemented yet. I expect when `--enable-preview` is implemented, `EnableValhalla` or some other flag can be used to detect that. The class file version (`ClassFileParser::supports_inline_types`) only applies to a single class. When running with value types enabled, `Class::isIdentity` should return true for classes of a class file version that does not support value type. That's why I think `if (EnableValhalla)` should be adequate for this patch until preview is implemented. ------------- PR: https://git.openjdk.java.net/valhalla/pull/700 From sadayapalam at openjdk.java.net Thu Jun 2 10:43:58 2022 From: sadayapalam at openjdk.java.net (Srikanth Adayapalam) Date: Thu, 2 Jun 2022 10:43:58 GMT Subject: [lworld] RFR: 8287136: [lw4] Javac tolerates abstract value classes that violate constraints for qualifying to be value super classes Message-ID: <3d4sf66bPLiz9Ky5cw0rfaJWLKkXxMPAnJTCwmjQlJM=.b69fb8e0-8603-43af-b495-a1cc1355dbfb@github.com> Also fixes JDK-8281312 and JDK-8287713 ------------- Commit messages: - 8287136: [lw4] Javac tolerates abstract value classes that violate constraints for qualifying to be value super classes Changes: https://git.openjdk.java.net/valhalla/pull/702/files Webrev: https://webrevs.openjdk.java.net/?repo=valhalla&pr=702&range=00 Issue: https://bugs.openjdk.java.net/browse/JDK-8287136 Stats: 444 lines in 21 files changed: 302 ins; 74 del; 68 mod Patch: https://git.openjdk.java.net/valhalla/pull/702.diff Fetch: git fetch https://git.openjdk.java.net/valhalla pull/702/head:pull/702 PR: https://git.openjdk.java.net/valhalla/pull/702 From sadayapalam at openjdk.java.net Thu Jun 2 10:45:04 2022 From: sadayapalam at openjdk.java.net (Srikanth Adayapalam) Date: Thu, 2 Jun 2022 10:45:04 GMT Subject: [lworld] Integrated: 8287136: [lw4] Javac tolerates abstract value classes that violate constraints for qualifying to be value super classes In-Reply-To: <3d4sf66bPLiz9Ky5cw0rfaJWLKkXxMPAnJTCwmjQlJM=.b69fb8e0-8603-43af-b495-a1cc1355dbfb@github.com> References: <3d4sf66bPLiz9Ky5cw0rfaJWLKkXxMPAnJTCwmjQlJM=.b69fb8e0-8603-43af-b495-a1cc1355dbfb@github.com> Message-ID: On Thu, 2 Jun 2022 10:36:37 GMT, Srikanth Adayapalam wrote: > Also fixes JDK-8281312 and JDK-8287713 This pull request has now been integrated. Changeset: 3582cb82 Author: Srikanth Adayapalam URL: https://git.openjdk.java.net/valhalla/commit/3582cb823f75eab34ba7024fc5d98ea37c75f26c Stats: 444 lines in 21 files changed: 302 ins; 74 del; 68 mod 8287136: [lw4] Javac tolerates abstract value classes that violate constraints for qualifying to be value super classes 8287713: [lw4] Javac incorrectly flags subclasses as being ACC_IDENTITY classes. 8281312: [lworld] Reenable test/langtools/tools/javac/processing/rounds/OverwriteBetweenCompilations.java ------------- PR: https://git.openjdk.java.net/valhalla/pull/702 From sadayapalam at openjdk.java.net Fri Jun 3 08:57:09 2022 From: sadayapalam at openjdk.java.net (Srikanth Adayapalam) Date: Fri, 3 Jun 2022 08:57:09 GMT Subject: [lworld] Integrated: 8287770: [lw4] Javac tolerates synchronizing on an instance of a value interface Message-ID: Reject synchronization attempt on any value type instance ------------- Commit messages: - 8287770: [lw4] Javac tolerates synchronizing on an instance of a value interface Changes: https://git.openjdk.java.net/valhalla/pull/703/files Webrev: https://webrevs.openjdk.java.net/?repo=valhalla&pr=703&range=00 Issue: https://bugs.openjdk.java.net/browse/JDK-8287770 Stats: 18 lines in 3 files changed: 16 ins; 0 del; 2 mod Patch: https://git.openjdk.java.net/valhalla/pull/703.diff Fetch: git fetch https://git.openjdk.java.net/valhalla pull/703/head:pull/703 PR: https://git.openjdk.java.net/valhalla/pull/703 From sadayapalam at openjdk.java.net Fri Jun 3 08:57:09 2022 From: sadayapalam at openjdk.java.net (Srikanth Adayapalam) Date: Fri, 3 Jun 2022 08:57:09 GMT Subject: [lworld] Integrated: 8287770: [lw4] Javac tolerates synchronizing on an instance of a value interface In-Reply-To: References: Message-ID: On Fri, 3 Jun 2022 08:49:37 GMT, Srikanth Adayapalam wrote: > Reject synchronization attempt on any value type instance This pull request has now been integrated. Changeset: c2cf3248 Author: Srikanth Adayapalam URL: https://git.openjdk.java.net/valhalla/commit/c2cf32482e8ab7c1916c26ef55f11a788ff83d77 Stats: 18 lines in 3 files changed: 16 ins; 0 del; 2 mod 8287770: [lw4] Javac tolerates synchronizing on an instance of a value interface ------------- PR: https://git.openjdk.java.net/valhalla/pull/703 From rriggs at openjdk.java.net Fri Jun 3 19:15:36 2022 From: rriggs at openjdk.java.net (Roger Riggs) Date: Fri, 3 Jun 2022 19:15:36 GMT Subject: [lworld] RFR: 8287692: Move Class primitive APIs to jdk.internal.value Message-ID: <2q1kOUnGOnpWxQ2fiLxP0geIXLBmW1FiF6hpbA4g73s=.4ea66fbb-2cb0-4065-97d9-42e288ffee2f@github.com> To avoid confusion with the reflection support for [Value Objects](https://bugs.openjdk.java.net/browse/JDK-8277163) the java.lang.Class APIs in support of JEP 401 (Primitive Objects) should be hidden. The methods `Class.asValueType`, `asPrimaryType`, `isPrimaryType`, `isPrimitiveClass`, and `asPrimitiveValueType` are moved to be static methods of `jdk.internal.value.PrimitiveClass`. To access those methods, add `--exports java.base/jdk.internal.value:+open` to the command line in addition to other flags needed to enable Primitive Objects and convert to invoke them as static methods with the class. The openjdk classes and tests are modified to use the alternate API. ------------- Commit messages: - 8287692-only-value-classes: Move Class primitive APIs to jdk.internal.value. Changes: https://git.openjdk.java.net/valhalla/pull/704/files Webrev: https://webrevs.openjdk.java.net/?repo=valhalla&pr=704&range=00 Issue: https://bugs.openjdk.java.net/browse/JDK-8287692 Stats: 526 lines in 58 files changed: 274 ins; 28 del; 224 mod Patch: https://git.openjdk.java.net/valhalla/pull/704.diff Fetch: git fetch https://git.openjdk.java.net/valhalla pull/704/head:pull/704 PR: https://git.openjdk.java.net/valhalla/pull/704 From rriggs at openjdk.java.net Fri Jun 3 19:20:53 2022 From: rriggs at openjdk.java.net (Roger Riggs) Date: Fri, 3 Jun 2022 19:20:53 GMT Subject: [lworld] RFR: 8287692: Move Class primitive APIs to jdk.internal.value.PrimitiveClass In-Reply-To: <2q1kOUnGOnpWxQ2fiLxP0geIXLBmW1FiF6hpbA4g73s=.4ea66fbb-2cb0-4065-97d9-42e288ffee2f@github.com> References: <2q1kOUnGOnpWxQ2fiLxP0geIXLBmW1FiF6hpbA4g73s=.4ea66fbb-2cb0-4065-97d9-42e288ffee2f@github.com> Message-ID: On Fri, 3 Jun 2022 19:07:52 GMT, Roger Riggs wrote: > To avoid confusion with the reflection support for [Value Objects](https://bugs.openjdk.java.net/browse/JDK-8277163) > the java.lang.Class APIs in support of JEP 401 (Primitive Objects) should be hidden. > > The methods `Class.asValueType`, `asPrimaryType`, `isPrimaryType`, `isPrimitiveClass`, and `asPrimitiveValueType` > are moved to be static methods of `jdk.internal.value.PrimitiveClass`. > > To access those methods, add `--exports java.base/jdk.internal.value:+open` to the command line > in addition to other flags needed to enable Primitive Objects and convert to invoke them as static methods with the class. > > The openjdk classes and tests are modified to use the alternate API. p.s. there are more Hotspot tests to update... ------------- PR: https://git.openjdk.java.net/valhalla/pull/704 From mchung at openjdk.java.net Fri Jun 3 22:02:03 2022 From: mchung at openjdk.java.net (Mandy Chung) Date: Fri, 3 Jun 2022 22:02:03 GMT Subject: [lworld] RFR: 8287692: Move Class primitive APIs to jdk.internal.value.PrimitiveClass In-Reply-To: <2q1kOUnGOnpWxQ2fiLxP0geIXLBmW1FiF6hpbA4g73s=.4ea66fbb-2cb0-4065-97d9-42e288ffee2f@github.com> References: <2q1kOUnGOnpWxQ2fiLxP0geIXLBmW1FiF6hpbA4g73s=.4ea66fbb-2cb0-4065-97d9-42e288ffee2f@github.com> Message-ID: On Fri, 3 Jun 2022 19:07:52 GMT, Roger Riggs wrote: > To avoid confusion with the reflection support for [Value Objects](https://bugs.openjdk.java.net/browse/JDK-8277163) > the java.lang.Class APIs in support of JEP 401 (Primitive Objects) should be hidden. > > The methods `Class.asValueType`, `asPrimaryType`, `isPrimaryType`, `isPrimitiveClass`, and `asPrimitiveValueType` > are moved to be static methods of `jdk.internal.value.PrimitiveClass`. > > To access those methods, add `--exports java.base/jdk.internal.value:+open` to the command line > in addition to other flags needed to enable Primitive Objects and convert to invoke them as static methods with the class. > > The openjdk classes and tests are modified to use the alternate API. Looks okay. Thanks for taking this one. Lots of renaming. src/java.base/share/classes/jdk/internal/value/PrimitiveClass.java line 2: > 1: /* > 2: * Copyright (c) 1994, 2022, Oracle and/or its affiliates. All rights reserved. 2022 is the start year. src/java.base/share/classes/jdk/internal/value/PrimitiveClass.java line 62: > 60: * @since Valhalla > 61: */ > 62: @IntrinsicCandidate The compiler intrinsic is for the method in `java.lang.Class`. So the annotation should be dropped. Same for `asValueType`. src/java.base/share/classes/jdk/internal/value/PrimitiveClass.java line 84: > 82: public static Class asValueType(Class aClass) { > 83: return javaLangAccess.asValueType(aClass); > 84: I guess this empty line is not intended? Same for iine 109 src/java.base/share/classes/jdk/internal/value/PrimitiveClass.java line 145: > 143: */ > 144: public static boolean isPrimitiveClass(Class aClass) { > 145: return (aClass.getModifiers() & PRIMITIVE_CLASS) != 0; why not including `isPrimitiveClass` in the shared secret as other methods? src/java.base/share/classes/sun/invoke/util/VerifyAccess.java line 31: > 29: import static java.lang.reflect.Modifier.*; > 30: > 31: import jdk.internal.value.PrimitiveClass; nit: sorted in an alphabetic order (though not always apply in other files) test/jdk/java/lang/invoke/TEST.properties line 5: > 3: > 4: # Reflection methods for primitive classes are in PrimitiveClass instead of java.lang.class > 5: modules = java.base/jdk.internal.value:+open which test needs to reflective access to `jdk.internal.value.PrimitiveClass`? The methods are public and I don't expect they need any reflective access. test/langtools/tools/javac/valhalla/lworld-values/ClassLiteralTypingNegativeTest.java line 5: > 3: * @bug 8221323 > 4: * @summary Javac should support class literals for projection types. > 5: * @modules java.base/jdk.internal.value:+open This and the import is not needed. test/langtools/tools/javac/valhalla/lworld-values/TestReflectiveMirrors.java line 30: > 28: * @bug 8269956 > 29: * @summary javac should generate `ldc LPoint;` for class literal Point.class > 30: * @modules java.base/jdk.internal.value:+open This test does not need reflective access. `@modules java.base/jdk.internal.value` should work. Same applies to other tests. ------------- PR: https://git.openjdk.java.net/valhalla/pull/704 From vromero at openjdk.java.net Sat Jun 4 19:07:49 2022 From: vromero at openjdk.java.net (Vicente Romero) Date: Sat, 4 Jun 2022 19:07:49 GMT Subject: RFR: addressing several issues in the implementation of universal tvars [v6] In-Reply-To: References: Message-ID: > Last review iteration found several issues in the current implementation, addressing them here Vicente Romero has updated the pull request incrementally with one additional commit since the last revision: adding structural type comparator to detect unchecked conversions ------------- Changes: - all: https://git.openjdk.java.net/valhalla/pull/684/files - new: https://git.openjdk.java.net/valhalla/pull/684/files/d005964b..6722ef71 Webrevs: - full: https://webrevs.openjdk.java.net/?repo=valhalla&pr=684&range=05 - incr: https://webrevs.openjdk.java.net/?repo=valhalla&pr=684&range=04-05 Stats: 466 lines in 5 files changed: 216 ins; 214 del; 36 mod Patch: https://git.openjdk.java.net/valhalla/pull/684.diff Fetch: git fetch https://git.openjdk.java.net/valhalla pull/684/head:pull/684 PR: https://git.openjdk.java.net/valhalla/pull/684 From sadayapalam at openjdk.java.net Tue Jun 7 08:28:32 2022 From: sadayapalam at openjdk.java.net (Srikanth Adayapalam) Date: Tue, 7 Jun 2022 08:28:32 GMT Subject: [lworld] RFR: 8287767: [lw4] Javac tolerates mutually incompatible super types. Message-ID: Restore behavior inadvertently deleted earlier. ------------- Commit messages: - 8287767: [lw4] Javac tolerates mutually incompatible super types. Changes: https://git.openjdk.java.net/valhalla/pull/705/files Webrev: https://webrevs.openjdk.java.net/?repo=valhalla&pr=705&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8287767 Stats: 48 lines in 5 files changed: 39 ins; 0 del; 9 mod Patch: https://git.openjdk.java.net/valhalla/pull/705.diff Fetch: git fetch https://git.openjdk.java.net/valhalla pull/705/head:pull/705 PR: https://git.openjdk.java.net/valhalla/pull/705 From sadayapalam at openjdk.java.net Tue Jun 7 08:31:31 2022 From: sadayapalam at openjdk.java.net (Srikanth Adayapalam) Date: Tue, 7 Jun 2022 08:31:31 GMT Subject: [lworld] Integrated: 8287767: [lw4] Javac tolerates mutually incompatible super types. In-Reply-To: References: Message-ID: On Tue, 7 Jun 2022 08:20:09 GMT, Srikanth Adayapalam wrote: > Restore behavior inadvertently deleted earlier. This pull request has now been integrated. Changeset: 830fb16e Author: Srikanth Adayapalam URL: https://git.openjdk.java.net/valhalla/commit/830fb16e574ce125cfe0bc584e6aca481d04cd6e Stats: 48 lines in 5 files changed: 39 ins; 0 del; 9 mod 8287767: [lw4] Javac tolerates mutually incompatible super types. ------------- PR: https://git.openjdk.java.net/valhalla/pull/705 From sadayapalam at openjdk.java.net Tue Jun 7 11:18:28 2022 From: sadayapalam at openjdk.java.net (Srikanth Adayapalam) Date: Tue, 7 Jun 2022 11:18:28 GMT Subject: [lworld] Integrated: 8287898: [lw4] test/hotspot/jtreg/runtime/valhalla/inlinetypes/verifier/VerifierInlineTypes.java fails Message-ID: <-SWBD-dZLM2Czp3ixFojdkozYJebymiqpG9o78a06kA=.73608aac-6773-4cf4-8c17-fd97347caf33@github.com> ?er/VerifierInlineTypes.java fails ------------- Commit messages: - 8287898: [lw4] test/hotspot/jtreg/runtime/valhalla/inlinetypes/verifier/VerifierInlineTypes.java fails Changes: https://git.openjdk.java.net/valhalla/pull/706/files Webrev: https://webrevs.openjdk.java.net/?repo=valhalla&pr=706&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8287898 Stats: 3 lines in 1 file changed: 0 ins; 0 del; 3 mod Patch: https://git.openjdk.java.net/valhalla/pull/706.diff Fetch: git fetch https://git.openjdk.java.net/valhalla pull/706/head:pull/706 PR: https://git.openjdk.java.net/valhalla/pull/706 From sadayapalam at openjdk.java.net Tue Jun 7 11:18:28 2022 From: sadayapalam at openjdk.java.net (Srikanth Adayapalam) Date: Tue, 7 Jun 2022 11:18:28 GMT Subject: [lworld] Integrated: 8287898: [lw4] test/hotspot/jtreg/runtime/valhalla/inlinetypes/verifier/VerifierInlineTypes.java fails In-Reply-To: <-SWBD-dZLM2Czp3ixFojdkozYJebymiqpG9o78a06kA=.73608aac-6773-4cf4-8c17-fd97347caf33@github.com> References: <-SWBD-dZLM2Czp3ixFojdkozYJebymiqpG9o78a06kA=.73608aac-6773-4cf4-8c17-fd97347caf33@github.com> Message-ID: <7XIYC8QaVsWE7zMCwZyZ2PvoS9xFCJ_s_eZEUI6GjGo=.bf4608c7-0b0f-438d-ac49-225f536fc5b4@github.com> On Tue, 7 Jun 2022 11:09:59 GMT, Srikanth Adayapalam wrote: > ?er/VerifierInlineTypes.java fails As commented in https://github.com/openjdk/valhalla/pull/688 for [JDK-8286491](https://bugs.openjdk.org/browse/JDK-8286491): Changes necessary to rip out PERMITS_VALUE flag bit are not included - I have simply redefined the value of the flag bit to "get it out of the way" (This is referring to VM changes I made) The redefining of the value of the flag bit to "get it out of the way" - didn't fully get it out of the way and was causing this test failure. ------------- PR: https://git.openjdk.java.net/valhalla/pull/706 From sadayapalam at openjdk.java.net Tue Jun 7 11:18:29 2022 From: sadayapalam at openjdk.java.net (Srikanth Adayapalam) Date: Tue, 7 Jun 2022 11:18:29 GMT Subject: [lworld] Integrated: 8287898: [lw4] test/hotspot/jtreg/runtime/valhalla/inlinetypes/verifier/VerifierInlineTypes.java fails In-Reply-To: <-SWBD-dZLM2Czp3ixFojdkozYJebymiqpG9o78a06kA=.73608aac-6773-4cf4-8c17-fd97347caf33@github.com> References: <-SWBD-dZLM2Czp3ixFojdkozYJebymiqpG9o78a06kA=.73608aac-6773-4cf4-8c17-fd97347caf33@github.com> Message-ID: On Tue, 7 Jun 2022 11:09:59 GMT, Srikanth Adayapalam wrote: > ?er/VerifierInlineTypes.java fails This pull request has now been integrated. Changeset: 929a25ed Author: Srikanth Adayapalam URL: https://git.openjdk.java.net/valhalla/commit/929a25ed41e2be0691bbabf61d427d5b97600dc1 Stats: 3 lines in 1 file changed: 0 ins; 0 del; 3 mod 8287898: [lw4] test/hotspot/jtreg/runtime/valhalla/inlinetypes/verifier/VerifierInlineTypes.java fails ------------- PR: https://git.openjdk.java.net/valhalla/pull/706 From rriggs at openjdk.java.net Tue Jun 7 14:26:11 2022 From: rriggs at openjdk.java.net (Roger Riggs) Date: Tue, 7 Jun 2022 14:26:11 GMT Subject: [lworld] RFR: 8281463: [lworld] VALUE / PRIMITIVE modifiers should be supported by reflection [v3] In-Reply-To: References: Message-ID: > Add support to java.lang.reflect.AccessFlag ACC_IDENTITY, ACC_VALUE, and ACC_PRIMITIVE. > Added corresponding flags to j.l.reflect.Modifier so the "source" of the AccessFlag is the Modifer mask. > Remove PERMITS_VALUE; moving the definition used by HotSpot to HotSpot code. > > Add comments to java.l.reflect.Modifier suggesting use of AccessFlag instead and limitations. Roger Riggs 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 four additional commits since the last revision: - Merge branch 'lworld' into 8281463-value-modifiers - Add Class.is(AccessFlag) to test for a single flag. - Restore AccessFlag SUPER - 8281463: [lworld] VALUE / PRIMITIVE modifiers should be supported by reflection Use java.lang.reflect.AccessFlag for equivalent functions for value objects. Corrected ModuleDescriptor.STATIC flags to be STATIC_PHASE Added flags to j.l.reflect.Modifier. ------------- Changes: - all: https://git.openjdk.java.net/valhalla/pull/698/files - new: https://git.openjdk.java.net/valhalla/pull/698/files/f83c35fd..946eea0f Webrevs: - full: https://webrevs.openjdk.java.net/?repo=valhalla&pr=698&range=02 - incr: https://webrevs.openjdk.java.net/?repo=valhalla&pr=698&range=01-02 Stats: 573 lines in 33 files changed: 377 ins; 108 del; 88 mod Patch: https://git.openjdk.java.net/valhalla/pull/698.diff Fetch: git fetch https://git.openjdk.java.net/valhalla pull/698/head:pull/698 PR: https://git.openjdk.java.net/valhalla/pull/698 From mcimadamore at openjdk.java.net Tue Jun 7 15:21:50 2022 From: mcimadamore at openjdk.java.net (Maurizio Cimadamore) Date: Tue, 7 Jun 2022 15:21:50 GMT Subject: RFR: addressing several issues in the implementation of universal tvars [v6] In-Reply-To: References: Message-ID: On Sat, 4 Jun 2022 19:07:49 GMT, Vicente Romero wrote: >> Last review iteration found several issues in the current implementation, addressing them here > > Vicente Romero has updated the pull request incrementally with one additional commit since the last revision: > > adding structural type comparator to detect unchecked conversions I think the cleanup is very good - there are probably some other bits that can be cleaned up as well (see comments). I've added some comments on the new visitor, which seems more complex than it should be. src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java line 1171: > 1169: @Override > 1170: public Boolean visitType(Type t, Type s) { > 1171: switch (t.getTag()) { In general - it seems like this routine has been brought in from isSubtype, which I think is wrong. This should borrow the most from isSameType. I believe in the case of this visitor, it would have been ok to simply return true if the two types have same tags? E.g. doesn't seem like adding the `switch` really adds much. src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java line 1179: > 1177: case BOT: case NONE: > 1178: return t.hasTag(s.getTag()); > 1179: case WILDCARD: //we shouldn't be here - avoids crash (see 7034495) comment seems copy and paste error? src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java line 1179: > 1177: case BOT: case NONE: > 1178: return t.hasTag(s.getTag()); > 1179: case WILDCARD: //we shouldn't be here - avoids crash (see 7034495) I do not see a visitor method for wildcards, but I think you need one, as you might get to wildcards recursively, because of `visitClassType` src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java line 1192: > 1190: > 1191: if (s.isPartial()) > 1192: return visit(s, t); Note sure these lines are relevant? src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java line 1201: > 1199: public Boolean visitClassType(ClassType t, Type s) { > 1200: // If t is an intersection, sup might not be a class type > 1201: if (!t.hasTag(CLASS)) return visit(t, s); if tags are different, the two types are not structurally comparable - this seems a leftover from subtyping src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java line 1217: > 1215: } > 1216: } > 1217: return isSameType(t, s); Here you delegate to isSameType... which seems odd - as this is the only place where we do this. src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java line 1221: > 1219: > 1220: public boolean compareTypeArgsRecursive(Type t, Type s) { > 1221: TypePair pair = new TypePair(t, s); This is typically needed in subtyping routines, to prevent against cases where we could expand terms forever. But in the case of a structural comparison, this can never happen? src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java line 1501: > 1499: */ > 1500: SameTypeVisitor isSameTypeVisitor = new SameTypeVisitor(); > 1501: class SameTypeVisitor extends ParameterizedTypeRelation { The `ParameterizedTypeRelation` class seems to still be there - but I don't think it's still useful? ------------- PR: https://git.openjdk.java.net/valhalla/pull/684 From mchung at openjdk.java.net Tue Jun 7 18:32:15 2022 From: mchung at openjdk.java.net (Mandy Chung) Date: Tue, 7 Jun 2022 18:32:15 GMT Subject: [lworld] RFR: 8281463: [lworld] VALUE / PRIMITIVE modifiers should be supported by reflection [v3] In-Reply-To: References: Message-ID: <40rA1x7QWbGDAnO7FCNsi3CIgIsKvJkE5yyF48A5FLg=.f297b028-2797-4ff7-a543-889b29b8bb7d@github.com> On Tue, 7 Jun 2022 14:26:11 GMT, Roger Riggs wrote: >> Add support to java.lang.reflect.AccessFlag ACC_IDENTITY, ACC_VALUE, and ACC_PRIMITIVE. >> Added corresponding flags to j.l.reflect.Modifier so the "source" of the AccessFlag is the Modifer mask. >> Remove PERMITS_VALUE; moving the definition used by HotSpot to HotSpot code. >> >> Add comments to java.l.reflect.Modifier suggesting use of AccessFlag instead and limitations. > > Roger Riggs 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 four additional commits since the last revision: > > - Merge branch 'lworld' into 8281463-value-modifiers > - Add Class.is(AccessFlag) to test for a single flag. > - Restore AccessFlag SUPER > - 8281463: [lworld] VALUE / PRIMITIVE modifiers should be supported by reflection > Use java.lang.reflect.AccessFlag for equivalent functions for value objects. > Corrected ModuleDescriptor.STATIC flags to be STATIC_PHASE > Added flags to j.l.reflect.Modifier. The recent commit changes `AccessFlag.IDENTITY`, `AccessFlag.VALUE`, `AccessFlag.PRIMITIVE` not a source modifier but they are. So I expect `sourceModifier()` returns true for these new constants. Whether these new modifiers should be defined in `Modifier` API requires discussion. `ACC_IDENTITY` may be set even if the source does not declare `identity`. `Modifier::toString` would not return a string that matches the source declaration. So this version not defining new constants in Modifier API looks reasonable. src/java.base/share/classes/java/lang/Class.java line 1511: > 1509: * @param flag an {@link AccessFlag} > 1510: */ > 1511: public boolean is(AccessFlag flag) { Is this API needed? We can do `Class.accessFlags().contains(flag)`. This discussion should belong to PR 7445 (see my comment in the `Modifier`). src/java.base/share/classes/java/lang/reflect/AccessFlag.java line 125: > 123: /** > 124: * The access flag {@code ACC_IDENTITY} corresponding to the > 125: * source modifier {@link Modifier#VALUE value} with a mask typo: `{@link Modifier#IDENTITY identity}` src/java.base/share/classes/java/lang/reflect/AccessFlag.java line 134: > 132: * Now the flag has been repurposed as ACC_IDENTITY. > 133: */ > 134: // SUPER(0x0000_0020, false, Set.of(Location.CLASS)), I expect the test should be updated instead of commenting this out. src/java.base/share/classes/java/lang/reflect/AccessFlag.java line 139: > 137: * The access flag {@code ACC_IDENTITY} with a mask value of {@code 0x0020}. > 138: */ > 139: IDENTITY(0x0000_0020, false, Set.of(Location.CLASS)), It can also be in `Location.INNER_CLASS`. Same for value and primitive. src/java.base/share/classes/java/lang/reflect/AccessFlag.java line 428: > 426: ABSTRACT, STRICT, SYNTHETIC)), > 427: entry(Location.INNER_CLASS, > 428: Set.of(PUBLIC, PRIVATE, PROTECTED, IDENTITY, VALUE, PRIMITIVE, I also caught this issue in the previous version. Glad that it's fixed in this version but the locations of these new constant should include INNER_CLASS as well. src/java.base/share/classes/java/lang/reflect/Modifier.java line 46: > 44: * The {@link AccessFlag} class provides a model that distinguishes between access flags > 45: * for classes, methods, and field. The {@link Class#accessFlags()} and {@link Member#accessFlags()} > 46: * methods provide the access flags for the respective class, method, or field. The discussion of this proposed spec change belongs in [PR 7445](https://github.com/openjdk/jdk/pull/7445). I would prefer to keep the version in Valhalla sync'ed with PR 7445 except the spec change to support the new `identity`, `value`, `primitive` modifiers. Other changes not relevant to Valhalla should be done in the PR target to the main line. src/java.base/share/classes/jdk/internal/org/objectweb/asm/Type.java line 686: > 684: > 685: static boolean isPrimitiveClass(Class clazz) { > 686: return clazz.is(AccessFlag.PRIMITIVE); Suggestion: return clazz.accessFlags().contains(AccessFlag.PRIMITIVE); test/langtools/tools/javac/valhalla/lworld-values/InnerClassAttributeValuenessTest.java line 55: > 53: System.out.println("accessFlags: " + flags); > 54: > 55: if (!Inner.class.is(AccessFlag.VALUE)) Suggestion: if (!flags.contains(AccessFlag.VALUE)) test/langtools/tools/javac/valhalla/lworld-values/InnerClassAttributeValuenessTest.java line 57: > 55: if (!Inner.class.is(AccessFlag.VALUE)) > 56: throw new AssertionError("Value flag missing"); > 57: if (!Inner.class.is(AccessFlag.PRIMITIVE)) Suggestion: if (!flags.contains(AccessFlag.PRIMITIVE)) ------------- PR: https://git.openjdk.java.net/valhalla/pull/698 From mchung at openjdk.java.net Tue Jun 7 18:32:19 2022 From: mchung at openjdk.java.net (Mandy Chung) Date: Tue, 7 Jun 2022 18:32:19 GMT Subject: [lworld] RFR: 8281463: [lworld] VALUE / PRIMITIVE modifiers should be supported by reflection [v2] In-Reply-To: References: Message-ID: On Fri, 27 May 2022 20:21:44 GMT, Roger Riggs wrote: >> Add support to java.lang.reflect.AccessFlag ACC_IDENTITY, ACC_VALUE, and ACC_PRIMITIVE. >> Added corresponding flags to j.l.reflect.Modifier so the "source" of the AccessFlag is the Modifer mask. >> Remove PERMITS_VALUE; moving the definition used by HotSpot to HotSpot code. >> >> Add comments to java.l.reflect.Modifier suggesting use of AccessFlag instead and limitations. > > Roger Riggs has updated the pull request incrementally with one additional commit since the last revision: > > Restore AccessFlag SUPER src/java.base/share/classes/java/lang/reflect/AccessFlag.java line 127: > 125: * 0x0020}. > 126: *

> 127: * NOTE: The Valhalla draft JVMS spec does not define a value for ACC_SUPER. This can be an `@apiNote`? This sentence means a TODO note to me and need to determine what to do with a removed access flag in this new API. ------------- PR: https://git.openjdk.java.net/valhalla/pull/698 From vromero at openjdk.java.net Tue Jun 7 18:35:28 2022 From: vromero at openjdk.java.net (Vicente Romero) Date: Tue, 7 Jun 2022 18:35:28 GMT Subject: RFR: addressing several issues in the implementation of universal tvars [v6] In-Reply-To: References: Message-ID: <7yNP33_EaYDd1MJvaqJqZroon48ussRcpkck3iF5U0E=.67301760-c925-4053-b331-6e0dfa1bf94f@github.com> On Tue, 7 Jun 2022 14:37:18 GMT, Maurizio Cimadamore wrote: >> Vicente Romero has updated the pull request incrementally with one additional commit since the last revision: >> >> adding structural type comparator to detect unchecked conversions > > src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java line 1171: > >> 1169: @Override >> 1170: public Boolean visitType(Type t, Type s) { >> 1171: switch (t.getTag()) { > > In general - it seems like this routine has been brought in from isSubtype, which I think is wrong. This should borrow the most from isSameType. I believe in the case of this visitor, it would have been ok to simply return true if the two types have same tags? E.g. doesn't seem like adding the `switch` really adds much. agreed > src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java line 1179: > >> 1177: case BOT: case NONE: >> 1178: return t.hasTag(s.getTag()); >> 1179: case WILDCARD: //we shouldn't be here - avoids crash (see 7034495) > > comment seems copy and paste error? I wasn't sure if this code for wildcards should be there or not, removing it ------------- PR: https://git.openjdk.java.net/valhalla/pull/684 From vromero at openjdk.java.net Tue Jun 7 18:40:04 2022 From: vromero at openjdk.java.net (Vicente Romero) Date: Tue, 7 Jun 2022 18:40:04 GMT Subject: RFR: addressing several issues in the implementation of universal tvars [v6] In-Reply-To: References: Message-ID: On Tue, 7 Jun 2022 14:37:51 GMT, Maurizio Cimadamore wrote: >> Vicente Romero has updated the pull request incrementally with one additional commit since the last revision: >> >> adding structural type comparator to detect unchecked conversions > > src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java line 1179: > >> 1177: case BOT: case NONE: >> 1178: return t.hasTag(s.getTag()); >> 1179: case WILDCARD: //we shouldn't be here - avoids crash (see 7034495) > > I do not see a visitor method for wildcards, but I think you need one, as you might get to wildcards recursively, because of `visitClassType` I think we should be covered here as visitors: `StructuralTypeComparator` and `TypeArgStructComparator` are interdependent, so I think we should be fine there, unless I'm missing something ------------- PR: https://git.openjdk.java.net/valhalla/pull/684 From rriggs at openjdk.java.net Tue Jun 7 19:11:00 2022 From: rriggs at openjdk.java.net (Roger Riggs) Date: Tue, 7 Jun 2022 19:11:00 GMT Subject: [lworld] RFR: 8281463: [lworld] VALUE / PRIMITIVE modifiers should be supported by reflection [v3] In-Reply-To: <40rA1x7QWbGDAnO7FCNsi3CIgIsKvJkE5yyF48A5FLg=.f297b028-2797-4ff7-a543-889b29b8bb7d@github.com> References: <40rA1x7QWbGDAnO7FCNsi3CIgIsKvJkE5yyF48A5FLg=.f297b028-2797-4ff7-a543-889b29b8bb7d@github.com> Message-ID: On Tue, 7 Jun 2022 18:09:52 GMT, Mandy Chung wrote: >> Roger Riggs 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 four additional commits since the last revision: >> >> - Merge branch 'lworld' into 8281463-value-modifiers >> - Add Class.is(AccessFlag) to test for a single flag. >> - Restore AccessFlag SUPER >> - 8281463: [lworld] VALUE / PRIMITIVE modifiers should be supported by reflection >> Use java.lang.reflect.AccessFlag for equivalent functions for value objects. >> Corrected ModuleDescriptor.STATIC flags to be STATIC_PHASE >> Added flags to j.l.reflect.Modifier. > > src/java.base/share/classes/java/lang/Class.java line 1511: > >> 1509: * @param flag an {@link AccessFlag} >> 1510: */ >> 1511: public boolean is(AccessFlag flag) { > > Is this API needed? We can do `Class.accessFlags().contains(flag)`. This discussion should belong to PR 7445 (see my comment in the `Modifier`). There are significant performance concerns. The current implementation of getModifers() is an intrinsic and all of the tests for modifiers are boolean operations against static constants. Doing a Set.contains against a set that is re-built every time getAccessFlags() is called is a non-starter. Many of the access flags have dedicated methods in j.l.Class, for example, isPublic, isStatic, etc. It would improve usability and performance to be able to check for an accessFlag in a simple direct operation. I'll keep this for the time being. > src/java.base/share/classes/java/lang/reflect/AccessFlag.java line 125: > >> 123: /** >> 124: * The access flag {@code ACC_IDENTITY} corresponding to the >> 125: * source modifier {@link Modifier#VALUE value} with a mask > > typo: `{@link Modifier#IDENTITY identity}` The new Valhalla specific access flags are not define in Modifier. So a link is not warranted. The reference to the JLS section would be appropriate. > src/java.base/share/classes/java/lang/reflect/AccessFlag.java line 134: > >> 132: * Now the flag has been repurposed as ACC_IDENTITY. >> 133: */ >> 134: // SUPER(0x0000_0020, false, Set.of(Location.CLASS)), > > I expect the test should be updated instead of commenting this out. By the time this is finalized, there will be no ACC_SUPER in the JVMs spec. > src/java.base/share/classes/java/lang/reflect/AccessFlag.java line 139: > >> 137: * The access flag {@code ACC_IDENTITY} with a mask value of {@code 0x0020}. >> 138: */ >> 139: IDENTITY(0x0000_0020, false, Set.of(Location.CLASS)), > > It can also be in `Location.INNER_CLASS`. Same for value and primitive. fixed > src/java.base/share/classes/java/lang/reflect/Modifier.java line 46: > >> 44: * The {@link AccessFlag} class provides a model that distinguishes between access flags >> 45: * for classes, methods, and field. The {@link Class#accessFlags()} and {@link Member#accessFlags()} >> 46: * methods provide the access flags for the respective class, method, or field. > > The discussion of this proposed spec change belongs in [PR 7445](https://github.com/openjdk/jdk/pull/7445). I would prefer to keep the version in Valhalla sync'ed with PR 7445 except the spec change to support the new `identity`, `value`, `primitive` modifiers. Other changes not relevant to Valhalla should be done in the PR target to the main line. We'll come back to it when the PR is finally reviewed. We can resolve any differences when Valhalla is to be integrated. > src/java.base/share/classes/jdk/internal/org/objectweb/asm/Type.java line 686: > >> 684: >> 685: static boolean isPrimitiveClass(Class clazz) { >> 686: return clazz.is(AccessFlag.PRIMITIVE); > > Suggestion: > > return clazz.accessFlags().contains(AccessFlag.PRIMITIVE); Not performant. > test/langtools/tools/javac/valhalla/lworld-values/InnerClassAttributeValuenessTest.java line 55: > >> 53: System.out.println("accessFlags: " + flags); >> 54: >> 55: if (!Inner.class.is(AccessFlag.VALUE)) > > Suggestion: > > if (!flags.contains(AccessFlag.VALUE)) No, not performant. > test/langtools/tools/javac/valhalla/lworld-values/InnerClassAttributeValuenessTest.java line 57: > >> 55: if (!Inner.class.is(AccessFlag.VALUE)) >> 56: throw new AssertionError("Value flag missing"); >> 57: if (!Inner.class.is(AccessFlag.PRIMITIVE)) > > Suggestion: > > if (!flags.contains(AccessFlag.PRIMITIVE)) Ditto ------------- PR: https://git.openjdk.java.net/valhalla/pull/698 From rriggs at openjdk.java.net Tue Jun 7 19:23:39 2022 From: rriggs at openjdk.java.net (Roger Riggs) Date: Tue, 7 Jun 2022 19:23:39 GMT Subject: [lworld] RFR: 8281463: [lworld] VALUE / PRIMITIVE modifiers should be supported by reflection [v4] In-Reply-To: References: Message-ID: > Add support to java.lang.reflect.AccessFlag ACC_IDENTITY, ACC_VALUE, and ACC_PRIMITIVE. > Added corresponding flags to j.l.reflect.Modifier so the "source" of the AccessFlag is the Modifer mask. > Remove PERMITS_VALUE; moving the definition used by HotSpot to HotSpot code. > > Add comments to java.l.reflect.Modifier suggesting use of AccessFlag instead and limitations. Roger Riggs has updated the pull request incrementally with one additional commit since the last revision: Address review comments ------------- Changes: - all: https://git.openjdk.java.net/valhalla/pull/698/files - new: https://git.openjdk.java.net/valhalla/pull/698/files/946eea0f..9af6875e Webrevs: - full: https://webrevs.openjdk.java.net/?repo=valhalla&pr=698&range=03 - incr: https://webrevs.openjdk.java.net/?repo=valhalla&pr=698&range=02-03 Stats: 14 lines in 2 files changed: 7 ins; 1 del; 6 mod Patch: https://git.openjdk.java.net/valhalla/pull/698.diff Fetch: git fetch https://git.openjdk.java.net/valhalla pull/698/head:pull/698 PR: https://git.openjdk.java.net/valhalla/pull/698 From mchung at openjdk.java.net Tue Jun 7 19:23:41 2022 From: mchung at openjdk.java.net (Mandy Chung) Date: Tue, 7 Jun 2022 19:23:41 GMT Subject: [lworld] RFR: 8281463: [lworld] VALUE / PRIMITIVE modifiers should be supported by reflection [v3] In-Reply-To: References: <40rA1x7QWbGDAnO7FCNsi3CIgIsKvJkE5yyF48A5FLg=.f297b028-2797-4ff7-a543-889b29b8bb7d@github.com> Message-ID: On Tue, 7 Jun 2022 19:02:41 GMT, Roger Riggs wrote: >> src/java.base/share/classes/java/lang/reflect/AccessFlag.java line 134: >> >>> 132: * Now the flag has been repurposed as ACC_IDENTITY. >>> 133: */ >>> 134: // SUPER(0x0000_0020, false, Set.of(Location.CLASS)), >> >> I expect the test should be updated instead of commenting this out. > > By the time this is finalized, there will be no ACC_SUPER in the JVMs spec. We don't know what Java SE release ACC_SUPER will be dropped. If `AccessFlag` API is added in Java 20 and `ACC_SUPER` is dropped in the same release, then you are right and this constant will never be defined. Anyway, I'm ok either the javadoc and `ACC_SUPER` is removed from this file or just keep it with an api note. ------------- PR: https://git.openjdk.java.net/valhalla/pull/698 From mchung at openjdk.java.net Tue Jun 7 19:35:53 2022 From: mchung at openjdk.java.net (Mandy Chung) Date: Tue, 7 Jun 2022 19:35:53 GMT Subject: [lworld] RFR: 8281463: [lworld] VALUE / PRIMITIVE modifiers should be supported by reflection [v3] In-Reply-To: References: <40rA1x7QWbGDAnO7FCNsi3CIgIsKvJkE5yyF48A5FLg=.f297b028-2797-4ff7-a543-889b29b8bb7d@github.com> Message-ID: On Tue, 7 Jun 2022 19:04:13 GMT, Roger Riggs wrote: >> src/java.base/share/classes/java/lang/reflect/Modifier.java line 46: >> >>> 44: * The {@link AccessFlag} class provides a model that distinguishes between access flags >>> 45: * for classes, methods, and field. The {@link Class#accessFlags()} and {@link Member#accessFlags()} >>> 46: * methods provide the access flags for the respective class, method, or field. >> >> The discussion of this proposed spec change belongs in [PR 7445](https://github.com/openjdk/jdk/pull/7445). I would prefer to keep the version in Valhalla sync'ed with PR 7445 except the spec change to support the new `identity`, `value`, `primitive` modifiers. Other changes not relevant to Valhalla should be done in the PR target to the main line. > > We'll come back to it when the PR is finally reviewed. > We can resolve any differences when Valhalla is to be integrated. I prefer to drop these spec change from this PR and include it when it's resolved with PR 7445. ------------- PR: https://git.openjdk.java.net/valhalla/pull/698 From mchung at openjdk.java.net Tue Jun 7 19:38:50 2022 From: mchung at openjdk.java.net (Mandy Chung) Date: Tue, 7 Jun 2022 19:38:50 GMT Subject: [lworld] RFR: 8281463: [lworld] VALUE / PRIMITIVE modifiers should be supported by reflection [v3] In-Reply-To: References: <40rA1x7QWbGDAnO7FCNsi3CIgIsKvJkE5yyF48A5FLg=.f297b028-2797-4ff7-a543-889b29b8bb7d@github.com> Message-ID: On Tue, 7 Jun 2022 19:07:10 GMT, Roger Riggs wrote: >> src/java.base/share/classes/java/lang/Class.java line 1511: >> >>> 1509: * @param flag an {@link AccessFlag} >>> 1510: */ >>> 1511: public boolean is(AccessFlag flag) { >> >> Is this API needed? We can do `Class.accessFlags().contains(flag)`. This discussion should belong to PR 7445 (see my comment in the `Modifier`). > > There are significant performance concerns. The current implementation of getModifers() is an intrinsic and all of the tests for modifiers are boolean operations against static constants. > Doing a Set.contains against a set that is re-built every time getAccessFlags() is called is a non-starter. > Many of the access flags have dedicated methods in j.l.Class, for example, isPublic, isStatic, etc. > It would improve usability and performance to be able to check for an accessFlag in a simple direct operation. > I'll keep this for the time being. This new API requires discussion and also whether it needs to be performant. Can you bring this discussion to PR 7445. `Class::isValue`, `Class::isIdentity` and `Class::isPrimitive` is performance-sensitive and the current implementation is performant checking against the modifiers. Is there a case that `Class::isXXX` cannot be used? ------------- PR: https://git.openjdk.java.net/valhalla/pull/698 From rriggs at openjdk.java.net Tue Jun 7 19:50:48 2022 From: rriggs at openjdk.java.net (Roger Riggs) Date: Tue, 7 Jun 2022 19:50:48 GMT Subject: [lworld] RFR: 8281463: [lworld] VALUE / PRIMITIVE modifiers should be supported by reflection [v3] In-Reply-To: References: <40rA1x7QWbGDAnO7FCNsi3CIgIsKvJkE5yyF48A5FLg=.f297b028-2797-4ff7-a543-889b29b8bb7d@github.com> Message-ID: On Tue, 7 Jun 2022 19:31:39 GMT, Mandy Chung wrote: >> We'll come back to it when the PR is finally reviewed. >> We can resolve any differences when Valhalla is to be integrated. > > I prefer to drop these spec change from this PR and include it when it's resolved with PR 7445. Until there is progress on 7445, I don't want to Valhalla to be held up and want to try out new APIs where they may be appropriate to the existing uses of Modifier. 7445 has not yet considered existing using cases of Modifier. It has already been raised as a comment. ------------- PR: https://git.openjdk.java.net/valhalla/pull/698 From vromero at openjdk.java.net Tue Jun 7 20:00:56 2022 From: vromero at openjdk.java.net (Vicente Romero) Date: Tue, 7 Jun 2022 20:00:56 GMT Subject: RFR: addressing several issues in the implementation of universal tvars [v6] In-Reply-To: References: Message-ID: On Tue, 7 Jun 2022 14:38:21 GMT, Maurizio Cimadamore wrote: >> Vicente Romero has updated the pull request incrementally with one additional commit since the last revision: >> >> adding structural type comparator to detect unchecked conversions > > src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java line 1192: > >> 1190: >> 1191: if (s.isPartial()) >> 1192: return visit(s, t); > > Note sure these lines are relevant? right I agree ------------- PR: https://git.openjdk.java.net/valhalla/pull/684 From vromero at openjdk.java.net Tue Jun 7 20:55:00 2022 From: vromero at openjdk.java.net (Vicente Romero) Date: Tue, 7 Jun 2022 20:55:00 GMT Subject: RFR: addressing several issues in the implementation of universal tvars [v6] In-Reply-To: References: Message-ID: On Tue, 7 Jun 2022 14:39:04 GMT, Maurizio Cimadamore wrote: >> Vicente Romero has updated the pull request incrementally with one additional commit since the last revision: >> >> adding structural type comparator to detect unchecked conversions > > src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java line 1201: > >> 1199: public Boolean visitClassType(ClassType t, Type s) { >> 1200: // If t is an intersection, sup might not be a class type >> 1201: if (!t.hasTag(CLASS)) return visit(t, s); > > if tags are different, the two types are not structurally comparable - this seems a leftover from subtyping sure ------------- PR: https://git.openjdk.java.net/valhalla/pull/684 From vromero at openjdk.java.net Tue Jun 7 21:04:50 2022 From: vromero at openjdk.java.net (Vicente Romero) Date: Tue, 7 Jun 2022 21:04:50 GMT Subject: RFR: addressing several issues in the implementation of universal tvars [v6] In-Reply-To: References: Message-ID: On Tue, 7 Jun 2022 14:41:50 GMT, Maurizio Cimadamore wrote: >> Vicente Romero has updated the pull request incrementally with one additional commit since the last revision: >> >> adding structural type comparator to detect unchecked conversions > > src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java line 1217: > >> 1215: } >> 1216: } >> 1217: return isSameType(t, s); > > Here you delegate to isSameType... which seems odd - as this is the only place where we do this. right, fixing it > src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java line 1221: > >> 1219: >> 1220: public boolean compareTypeArgsRecursive(Type t, Type s) { >> 1221: TypePair pair = new TypePair(t, s); > > This is typically needed in subtyping routines, to prevent against cases where we could expand terms forever. But in the case of a structural comparison, this can never happen? with wildcards yes, unless we rewrite the visitor adding a method for wildcards ------------- PR: https://git.openjdk.java.net/valhalla/pull/684 From vromero at openjdk.java.net Tue Jun 7 22:34:50 2022 From: vromero at openjdk.java.net (Vicente Romero) Date: Tue, 7 Jun 2022 22:34:50 GMT Subject: RFR: addressing several issues in the implementation of universal tvars [v7] In-Reply-To: References: Message-ID: <2dkaNxrQ8mpaR3O8y8KzRMnop3oTbpuRmNnG0e5a4Vs=.5290463f-c2de-4f4e-acde-e83a870cb888@github.com> > Last review iteration found several issues in the current implementation, addressing them here Vicente Romero has updated the pull request incrementally with one additional commit since the last revision: addressing issues found in last review iteration ------------- Changes: - all: https://git.openjdk.java.net/valhalla/pull/684/files - new: https://git.openjdk.java.net/valhalla/pull/684/files/6722ef71..6ef6c6a3 Webrevs: - full: https://webrevs.openjdk.java.net/?repo=valhalla&pr=684&range=06 - incr: https://webrevs.openjdk.java.net/?repo=valhalla&pr=684&range=05-06 Stats: 36 lines in 1 file changed: 5 ins; 23 del; 8 mod Patch: https://git.openjdk.java.net/valhalla/pull/684.diff Fetch: git fetch https://git.openjdk.java.net/valhalla pull/684/head:pull/684 PR: https://git.openjdk.java.net/valhalla/pull/684 From vromero at openjdk.java.net Tue Jun 7 22:34:52 2022 From: vromero at openjdk.java.net (Vicente Romero) Date: Tue, 7 Jun 2022 22:34:52 GMT Subject: RFR: addressing several issues in the implementation of universal tvars [v6] In-Reply-To: References: Message-ID: On Sat, 4 Jun 2022 19:07:49 GMT, Vicente Romero wrote: >> Last review iteration found several issues in the current implementation, addressing them here > > Vicente Romero has updated the pull request incrementally with one additional commit since the last revision: > > adding structural type comparator to detect unchecked conversions I have updated the code after the last review comments, thanks! ------------- PR: https://git.openjdk.java.net/valhalla/pull/684 From vromero at openjdk.java.net Tue Jun 7 22:34:54 2022 From: vromero at openjdk.java.net (Vicente Romero) Date: Tue, 7 Jun 2022 22:34:54 GMT Subject: RFR: addressing several issues in the implementation of universal tvars [v7] In-Reply-To: References: Message-ID: On Tue, 7 Jun 2022 14:30:38 GMT, Maurizio Cimadamore wrote: >> Vicente Romero has updated the pull request incrementally with one additional commit since the last revision: >> >> addressing issues found in last review iteration > > src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java line 1501: > >> 1499: */ >> 1500: SameTypeVisitor isSameTypeVisitor = new SameTypeVisitor(); >> 1501: class SameTypeVisitor extends ParameterizedTypeRelation { > > The `ParameterizedTypeRelation` class seems to still be there - but I don't think it's still useful? I will remove it ------------- PR: https://git.openjdk.java.net/valhalla/pull/684 From vromero at openjdk.java.net Wed Jun 8 00:17:01 2022 From: vromero at openjdk.java.net (Vicente Romero) Date: Wed, 8 Jun 2022 00:17:01 GMT Subject: RFR: addressing several issues in the implementation of universal tvars [v8] In-Reply-To: References: Message-ID: > Last review iteration found several issues in the current implementation, addressing them here Vicente Romero has updated the pull request incrementally with one additional commit since the last revision: merging StructuralTypeComparator and TypeArgStructComparator ------------- Changes: - all: https://git.openjdk.java.net/valhalla/pull/684/files - new: https://git.openjdk.java.net/valhalla/pull/684/files/6ef6c6a3..52f7677c Webrevs: - full: https://webrevs.openjdk.java.net/?repo=valhalla&pr=684&range=07 - incr: https://webrevs.openjdk.java.net/?repo=valhalla&pr=684&range=06-07 Stats: 102 lines in 1 file changed: 41 ins; 58 del; 3 mod Patch: https://git.openjdk.java.net/valhalla/pull/684.diff Fetch: git fetch https://git.openjdk.java.net/valhalla pull/684/head:pull/684 PR: https://git.openjdk.java.net/valhalla/pull/684 From mcimadamore at openjdk.java.net Wed Jun 8 14:54:50 2022 From: mcimadamore at openjdk.java.net (Maurizio Cimadamore) Date: Wed, 8 Jun 2022 14:54:50 GMT Subject: RFR: addressing several issues in the implementation of universal tvars [v8] In-Reply-To: References: Message-ID: On Wed, 8 Jun 2022 00:17:01 GMT, Vicente Romero wrote: >> Last review iteration found several issues in the current implementation, addressing them here > > Vicente Romero has updated the pull request incrementally with one additional commit since the last revision: > > merging StructuralTypeComparator and TypeArgStructComparator src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java line 1378: > 1376: SubtypingRelation isSubtypeRelation = new SubtypingRelation(); > 1377: class SubtypingRelation extends TypeRelation { > 1378: SubtypingRelationKind param; What is this needed for? We should get into a position where subtyping is "just" subtyping, no need for having some kind of mode flag - unless I'm misunderstanding something? ------------- PR: https://git.openjdk.java.net/valhalla/pull/684 From vromero at openjdk.java.net Wed Jun 8 15:01:02 2022 From: vromero at openjdk.java.net (Vicente Romero) Date: Wed, 8 Jun 2022 15:01:02 GMT Subject: RFR: addressing several issues in the implementation of universal tvars [v8] In-Reply-To: References: Message-ID: On Wed, 8 Jun 2022 14:51:12 GMT, Maurizio Cimadamore wrote: >> Vicente Romero has updated the pull request incrementally with one additional commit since the last revision: >> >> merging StructuralTypeComparator and TypeArgStructComparator > > src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java line 1378: > >> 1376: SubtypingRelation isSubtypeRelation = new SubtypingRelation(); >> 1377: class SubtypingRelation extends TypeRelation { >> 1378: SubtypingRelationKind param; > > What is this needed for? We should get into a position where subtyping is "just" subtyping, no need for having some kind of mode flag - unless I'm misunderstanding something? yep I will tackle that now, if I recall correctly I tried to removed it but there where other changes in areas a bit distant from the visitors that's why I didn't go for it in a first step ------------- PR: https://git.openjdk.java.net/valhalla/pull/684 From vromero at openjdk.java.net Wed Jun 8 17:06:58 2022 From: vromero at openjdk.java.net (Vicente Romero) Date: Wed, 8 Jun 2022 17:06:58 GMT Subject: RFR: addressing several issues in the implementation of universal tvars [v9] In-Reply-To: References: Message-ID: <6UMCAP-gHCdAYkuu_7HfAQHCkJfmbAdJFC7zM2vOW3w=.818cf5fd-9fbe-4429-8bfd-e137209ba420@github.com> > Last review iteration found several issues in the current implementation, addressing them here Vicente Romero has updated the pull request incrementally with one additional commit since the last revision: removing additional code from isSubtype visitors ------------- Changes: - all: https://git.openjdk.java.net/valhalla/pull/684/files - new: https://git.openjdk.java.net/valhalla/pull/684/files/52f7677c..b80ba384 Webrevs: - full: https://webrevs.openjdk.java.net/?repo=valhalla&pr=684&range=08 - incr: https://webrevs.openjdk.java.net/?repo=valhalla&pr=684&range=07-08 Stats: 63 lines in 2 files changed: 11 ins; 43 del; 9 mod Patch: https://git.openjdk.java.net/valhalla/pull/684.diff Fetch: git fetch https://git.openjdk.java.net/valhalla pull/684/head:pull/684 PR: https://git.openjdk.java.net/valhalla/pull/684 From vromero at openjdk.java.net Wed Jun 8 17:07:00 2022 From: vromero at openjdk.java.net (Vicente Romero) Date: Wed, 8 Jun 2022 17:07:00 GMT Subject: RFR: addressing several issues in the implementation of universal tvars [v8] In-Reply-To: References: Message-ID: <1zNMcYXahiSXzif0EmT_O79H7yuqQKqfxe2OEPM14Xk=.4495bf7b-191b-461c-a1bd-c6be2692404d@github.com> On Wed, 8 Jun 2022 14:57:25 GMT, Vicente Romero wrote: >> src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java line 1378: >> >>> 1376: SubtypingRelation isSubtypeRelation = new SubtypingRelation(); >>> 1377: class SubtypingRelation extends TypeRelation { >>> 1378: SubtypingRelationKind param; >> >> What is this needed for? We should get into a position where subtyping is "just" subtyping, no need for having some kind of mode flag - unless I'm misunderstanding something? > > yep I will tackle that now, if I recall correctly I tried to removed it but there where other changes in areas a bit distant from the visitors that's why I didn't go for it in a first step sorry it was a simple change I thought it would be a greater one, just uploaded a new version that removes this `param` and related code from `isSubtype` ------------- PR: https://git.openjdk.java.net/valhalla/pull/684 From mcimadamore at openjdk.java.net Wed Jun 8 18:20:09 2022 From: mcimadamore at openjdk.java.net (Maurizio Cimadamore) Date: Wed, 8 Jun 2022 18:20:09 GMT Subject: RFR: addressing several issues in the implementation of universal tvars [v9] In-Reply-To: <6UMCAP-gHCdAYkuu_7HfAQHCkJfmbAdJFC7zM2vOW3w=.818cf5fd-9fbe-4429-8bfd-e137209ba420@github.com> References: <6UMCAP-gHCdAYkuu_7HfAQHCkJfmbAdJFC7zM2vOW3w=.818cf5fd-9fbe-4429-8bfd-e137209ba420@github.com> Message-ID: On Wed, 8 Jun 2022 17:06:58 GMT, Vicente Romero wrote: >> Last review iteration found several issues in the current implementation, addressing them here > > Vicente Romero has updated the pull request incrementally with one additional commit since the last revision: > > removing additional code from isSubtype visitors test/langtools/tools/javac/valhalla/lworld-values/universal-type-variables/UniversalTVarsCompilationTests.java line 671: > 669: T.ref field; > 670: void foo(T t, Consumer action) { > 671: action.accept(field = t); Why does this fail? Aren't the two types identical (modulo ref/val) ? ------------- PR: https://git.openjdk.java.net/valhalla/pull/684 From vromero at openjdk.java.net Wed Jun 8 18:42:53 2022 From: vromero at openjdk.java.net (Vicente Romero) Date: Wed, 8 Jun 2022 18:42:53 GMT Subject: RFR: addressing several issues in the implementation of universal tvars [v9] In-Reply-To: References: <6UMCAP-gHCdAYkuu_7HfAQHCkJfmbAdJFC7zM2vOW3w=.818cf5fd-9fbe-4429-8bfd-e137209ba420@github.com> Message-ID: On Wed, 8 Jun 2022 18:16:03 GMT, Maurizio Cimadamore wrote: >> Vicente Romero has updated the pull request incrementally with one additional commit since the last revision: >> >> removing additional code from isSubtype visitors > > test/langtools/tools/javac/valhalla/lworld-values/universal-type-variables/UniversalTVarsCompilationTests.java line 671: > >> 669: T.ref field; >> 670: void foo(T t, Consumer action) { >> 671: action.accept(field = t); > > Why does this fail? Aren't the two types identical (modulo ref/val) ? well action is parameterized with a wildcard so here we are assigning a ref to a wildcard, `field = t` is not failing though that assignment generates a warning ------------- PR: https://git.openjdk.java.net/valhalla/pull/684 From rriggs at openjdk.java.net Wed Jun 8 18:46:43 2022 From: rriggs at openjdk.java.net (Roger Riggs) Date: Wed, 8 Jun 2022 18:46:43 GMT Subject: [lworld] RFR: 8281463: [lworld] VALUE / PRIMITIVE modifiers should be supported by reflection [v5] In-Reply-To: References: Message-ID: > Add support to java.lang.reflect.AccessFlag ACC_IDENTITY, ACC_VALUE, and ACC_PRIMITIVE. > Added corresponding flags to j.l.reflect.Modifier so the "source" of the AccessFlag is the Modifer mask. > Remove PERMITS_VALUE; moving the definition used by HotSpot to HotSpot code. > > Add comments to java.l.reflect.Modifier suggesting use of AccessFlag instead and limitations. Roger Riggs has updated the pull request incrementally with one additional commit since the last revision: Revert changes and simplify Update GenericStringTest to work with value and primitive classes. ------------- Changes: - all: https://git.openjdk.java.net/valhalla/pull/698/files - new: https://git.openjdk.java.net/valhalla/pull/698/files/9af6875e..cab6cae4 Webrevs: - full: https://webrevs.openjdk.java.net/?repo=valhalla&pr=698&range=04 - incr: https://webrevs.openjdk.java.net/?repo=valhalla&pr=698&range=03-04 Stats: 40 lines in 6 files changed: 12 ins; 16 del; 12 mod Patch: https://git.openjdk.java.net/valhalla/pull/698.diff Fetch: git fetch https://git.openjdk.java.net/valhalla pull/698/head:pull/698 PR: https://git.openjdk.java.net/valhalla/pull/698 From vromero at openjdk.java.net Wed Jun 8 19:14:51 2022 From: vromero at openjdk.java.net (Vicente Romero) Date: Wed, 8 Jun 2022 19:14:51 GMT Subject: RFR: addressing several issues in the implementation of universal tvars [v9] In-Reply-To: References: <6UMCAP-gHCdAYkuu_7HfAQHCkJfmbAdJFC7zM2vOW3w=.818cf5fd-9fbe-4429-8bfd-e137209ba420@github.com> Message-ID: On Wed, 8 Jun 2022 18:37:46 GMT, Vicente Romero wrote: >> test/langtools/tools/javac/valhalla/lworld-values/universal-type-variables/UniversalTVarsCompilationTests.java line 671: >> >>> 669: T.ref field; >>> 670: void foo(T t, Consumer action) { >>> 671: action.accept(field = t); >> >> Why does this fail? Aren't the two types identical (modulo ref/val) ? > > well action is parameterized with a wildcard so here we are assigning a ref to a wildcard, `field = t` is not failing though that assignment generates a warning it could probably be better to write the test as: field = t; action.accept(field = t); what do you think? ------------- PR: https://git.openjdk.java.net/valhalla/pull/684 From mchung at openjdk.java.net Wed Jun 8 21:12:51 2022 From: mchung at openjdk.java.net (Mandy Chung) Date: Wed, 8 Jun 2022 21:12:51 GMT Subject: [lworld] RFR: 8281463: [lworld] VALUE / PRIMITIVE modifiers should be supported by reflection [v5] In-Reply-To: References: Message-ID: On Wed, 8 Jun 2022 18:46:43 GMT, Roger Riggs wrote: >> Add support to java.lang.reflect.AccessFlag ACC_IDENTITY, ACC_VALUE, and ACC_PRIMITIVE. >> Added corresponding flags to j.l.reflect.Modifier so the "source" of the AccessFlag is the Modifer mask. >> Remove PERMITS_VALUE; moving the definition used by HotSpot to HotSpot code. >> >> Add comments to java.l.reflect.Modifier suggesting use of AccessFlag instead and limitations. > > Roger Riggs has updated the pull request incrementally with one additional commit since the last revision: > > Revert changes and simplify > Update GenericStringTest to work with value and primitive classes. Thanks for the update. I agree that the `Modifier` class spec needs update. PR 7445 should finalize that. src/java.base/share/classes/java/lang/Class.java line 207: > 205: private static final int SYNTHETIC = 0x00001000; > 206: private static final int VALUE_CLASS = 0x00000040; > 207: private static final int PRIMITIVE_CLASS = 0x00000800; `VALUE_CLASS` and `PRIMITIVE_CLASS` can be removed now and replaced with `AccessFlag::mask`. ------------- Marked as reviewed by mchung (Committer). PR: https://git.openjdk.java.net/valhalla/pull/698 From mchung at openjdk.java.net Wed Jun 8 21:25:56 2022 From: mchung at openjdk.java.net (Mandy Chung) Date: Wed, 8 Jun 2022 21:25:56 GMT Subject: [lworld] RFR: 8287241: Add IdentityException to report that a value object is not valid [v2] In-Reply-To: References: Message-ID: On Wed, 25 May 2022 20:36:52 GMT, Roger Riggs wrote: >> Add class java.lang.IdentityException, when thrown indicates that an identity object was required but a value object was supplied. >> >> Also add methods `java.util.Objects.requireIdentity(obj)` and `Objects.requireIdentity(obj, message)` to check and throw. >> >> Updated java.lang.ref.Reference and related tests to use new exception and method. > > Roger Riggs has updated the pull request incrementally with one additional commit since the last revision: > > Add Objects.requireIdentity(obj, Supplier supplier); > update copyright Marked as reviewed by mchung (Committer). src/java.base/share/classes/java/lang/IdentityException.java line 31: > 29: * Identity objects are required for synchronization and locking. > 30: * Value-based > 31: * objects do not have identity and cannot be used for synchronization or locking. Need `@since Valhalla` src/java.base/share/classes/java/lang/IdentityException.java line 35: > 33: public class IdentityException extends RuntimeException { > 34: /** > 35: * Create an IdentityException with no message. Suggestion: * Create an {@code IdentityException} with no message. Same applies to the javadoc of all constructors. src/java.base/share/classes/java/util/Objects.java line 206: > 204: Objects.requireNonNull(obj); > 205: var cl = obj.getClass(); > 206: if (cl.isValue()) Suggestion: if (obj.getClass().isValue()) Same as the implementation of other variants of the `requireIdentity` method. ------------- PR: https://git.openjdk.java.net/valhalla/pull/696 From rriggs at openjdk.java.net Wed Jun 8 21:31:42 2022 From: rriggs at openjdk.java.net (Roger Riggs) Date: Wed, 8 Jun 2022 21:31:42 GMT Subject: [lworld] RFR: 8281463: [lworld] VALUE / PRIMITIVE modifiers should be supported by reflection [v6] In-Reply-To: References: Message-ID: > Add support to java.lang.reflect.AccessFlag ACC_IDENTITY, ACC_VALUE, and ACC_PRIMITIVE. > Added corresponding flags to j.l.reflect.Modifier so the "source" of the AccessFlag is the Modifer mask. > Remove PERMITS_VALUE; moving the definition used by HotSpot to HotSpot code. > > Add comments to java.l.reflect.Modifier suggesting use of AccessFlag instead and limitations. Roger Riggs has updated the pull request incrementally with one additional commit since the last revision: Replace static int constants with AccessFlag method calls. ------------- Changes: - all: https://git.openjdk.java.net/valhalla/pull/698/files - new: https://git.openjdk.java.net/valhalla/pull/698/files/cab6cae4..349a9399 Webrevs: - full: https://webrevs.openjdk.java.net/?repo=valhalla&pr=698&range=05 - incr: https://webrevs.openjdk.java.net/?repo=valhalla&pr=698&range=04-05 Stats: 4 lines in 1 file changed: 0 ins; 2 del; 2 mod Patch: https://git.openjdk.java.net/valhalla/pull/698.diff Fetch: git fetch https://git.openjdk.java.net/valhalla pull/698/head:pull/698 PR: https://git.openjdk.java.net/valhalla/pull/698 From rriggs at openjdk.java.net Wed Jun 8 21:36:54 2022 From: rriggs at openjdk.java.net (Roger Riggs) Date: Wed, 8 Jun 2022 21:36:54 GMT Subject: [lworld] RFR: 8287241: Add IdentityException to report that a value object is not valid [v2] In-Reply-To: References: Message-ID: On Wed, 8 Jun 2022 21:20:55 GMT, Mandy Chung wrote: >> Roger Riggs has updated the pull request incrementally with one additional commit since the last revision: >> >> Add Objects.requireIdentity(obj, Supplier supplier); >> update copyright > > src/java.base/share/classes/java/util/Objects.java line 206: > >> 204: Objects.requireNonNull(obj); >> 205: var cl = obj.getClass(); >> 206: if (cl.isValue()) > > Suggestion: > > if (obj.getClass().isValue()) > > > Same as the implementation of other variants of the `requireIdentity` method. `cl` is used to throw the IdentityException in the following line. ------------- PR: https://git.openjdk.java.net/valhalla/pull/696 From rriggs at openjdk.java.net Wed Jun 8 21:42:05 2022 From: rriggs at openjdk.java.net (Roger Riggs) Date: Wed, 8 Jun 2022 21:42:05 GMT Subject: [lworld] RFR: 8287241: Add IdentityException to report that a value object is not valid [v3] In-Reply-To: References: Message-ID: <1Yj5HQBGPPtstPIiDtYOk5noH1IQHrLoVK6Fynkq5Kk=.f5493033-746d-43c7-a353-c5e51378cd9a@github.com> > Add class java.lang.IdentityException, when thrown indicates that an identity object was required but a value object was supplied. > > Also add methods `java.util.Objects.requireIdentity(obj)` and `Objects.requireIdentity(obj, message)` to check and throw. > > Updated java.lang.ref.Reference and related tests to use new exception and method. Roger Riggs has updated the pull request incrementally with one additional commit since the last revision: Tweaks to Objects.requireIdentity and IdentityException ------------- Changes: - all: https://git.openjdk.java.net/valhalla/pull/696/files - new: https://git.openjdk.java.net/valhalla/pull/696/files/0785a81f..0d9a92c6 Webrevs: - full: https://webrevs.openjdk.java.net/?repo=valhalla&pr=696&range=02 - incr: https://webrevs.openjdk.java.net/?repo=valhalla&pr=696&range=01-02 Stats: 8 lines in 2 files changed: 2 ins; 0 del; 6 mod Patch: https://git.openjdk.java.net/valhalla/pull/696.diff Fetch: git fetch https://git.openjdk.java.net/valhalla pull/696/head:pull/696 PR: https://git.openjdk.java.net/valhalla/pull/696 From mchung at openjdk.java.net Wed Jun 8 21:42:05 2022 From: mchung at openjdk.java.net (Mandy Chung) Date: Wed, 8 Jun 2022 21:42:05 GMT Subject: [lworld] RFR: 8287241: Add IdentityException to report that a value object is not valid [v2] In-Reply-To: References: Message-ID: <4Q9WAlHPc4Cgjh5cnYcG24JL9KgE_-188x1lIyqgJjc=.dfdc7147-7960-4290-b5d2-0d40e099db2d@github.com> On Wed, 8 Jun 2022 21:33:34 GMT, Roger Riggs wrote: >> src/java.base/share/classes/java/util/Objects.java line 206: >> >>> 204: Objects.requireNonNull(obj); >>> 205: var cl = obj.getClass(); >>> 206: if (cl.isValue()) >> >> Suggestion: >> >> if (obj.getClass().isValue()) >> >> >> Same as the implementation of other variants of the `requireIdentity` method. > > `cl` is used to throw the IdentityException in the following line. okay. thanks ------------- PR: https://git.openjdk.java.net/valhalla/pull/696 From forax at openjdk.java.net Wed Jun 8 21:57:58 2022 From: forax at openjdk.java.net (=?UTF-8?B?UsOpbWk=?= Forax) Date: Wed, 8 Jun 2022 21:57:58 GMT Subject: [lworld] RFR: 8287241: Add IdentityException to report that a value object is not valid [v3] In-Reply-To: <1Yj5HQBGPPtstPIiDtYOk5noH1IQHrLoVK6Fynkq5Kk=.f5493033-746d-43c7-a353-c5e51378cd9a@github.com> References: <1Yj5HQBGPPtstPIiDtYOk5noH1IQHrLoVK6Fynkq5Kk=.f5493033-746d-43c7-a353-c5e51378cd9a@github.com> Message-ID: On Wed, 8 Jun 2022 21:42:05 GMT, Roger Riggs wrote: >> Add class java.lang.IdentityException, when thrown indicates that an identity object was required but a value object was supplied. >> >> Also add methods `java.util.Objects.requireIdentity(obj)` and `Objects.requireIdentity(obj, message)` to check and throw. >> >> Updated java.lang.ref.Reference and related tests to use new exception and method. > > Roger Riggs has updated the pull request incrementally with one additional commit since the last revision: > > Tweaks to Objects.requireIdentity and IdentityException src/java.base/share/classes/java/lang/IdentityException.java line 69: > 67: public IdentityException(String message, Throwable cause) { > 68: super(message, cause); > 69: } There is a missing variant, the one with a Throwable but no message that you use when you want to throw an IdentityException as a result of a previous exception (by example an IllegalMonitorStateException). ------------- PR: https://git.openjdk.java.net/valhalla/pull/696 From sadayapalam at openjdk.java.net Thu Jun 9 06:24:12 2022 From: sadayapalam at openjdk.java.net (Srikanth Adayapalam) Date: Thu, 9 Jun 2022 06:24:12 GMT Subject: [lworld] Integrated: 8288084: [lw4] Tier1 hotspot runtime test ClassHierarchyTest.java fails Message-ID: This test is still expecting IdentityObject in the class hierarchy. The changes made for JDK-8245216 need to be reversed. ------------- Commit messages: - 8288084: [lw4] Tier1 hotspot runtime test ClassHierarchyTest.java fails Changes: https://git.openjdk.java.net/valhalla/pull/707/files Webrev: https://webrevs.openjdk.java.net/?repo=valhalla&pr=707&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8288084 Stats: 9 lines in 1 file changed: 0 ins; 5 del; 4 mod Patch: https://git.openjdk.java.net/valhalla/pull/707.diff Fetch: git fetch https://git.openjdk.java.net/valhalla pull/707/head:pull/707 PR: https://git.openjdk.java.net/valhalla/pull/707 From sadayapalam at openjdk.java.net Thu Jun 9 06:24:12 2022 From: sadayapalam at openjdk.java.net (Srikanth Adayapalam) Date: Thu, 9 Jun 2022 06:24:12 GMT Subject: [lworld] Integrated: 8288084: [lw4] Tier1 hotspot runtime test ClassHierarchyTest.java fails In-Reply-To: References: Message-ID: On Thu, 9 Jun 2022 06:14:56 GMT, Srikanth Adayapalam wrote: > This test is still expecting IdentityObject in the class hierarchy. The changes made for JDK-8245216 need to be reversed. This pull request has now been integrated. Changeset: 5cf27a50 Author: Srikanth Adayapalam URL: https://git.openjdk.java.net/valhalla/commit/5cf27a50ffe902b7de9ace6969d092fd225e6f78 Stats: 9 lines in 1 file changed: 0 ins; 5 del; 4 mod 8288084: [lw4] Tier1 hotspot runtime test ClassHierarchyTest.java fails ------------- PR: https://git.openjdk.java.net/valhalla/pull/707 From sadayapalam at openjdk.java.net Thu Jun 9 10:40:06 2022 From: sadayapalam at openjdk.java.net (Srikanth Adayapalam) Date: Thu, 9 Jun 2022 10:40:06 GMT Subject: [lworld] Integrated: 8287763: [lw4] Javac does not implement the spec for non-trivial constructors in toto Message-ID: Align with JLS changes to mark abstract classes with various forms of non-trivial constructors as being identity classes. ------------- Commit messages: - Fix white space errors - 8287763: [lw4] Javac does not implement the spec for non-trivial constructors in toto Changes: https://git.openjdk.java.net/valhalla/pull/708/files Webrev: https://webrevs.openjdk.java.net/?repo=valhalla&pr=708&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8287763 Stats: 169 lines in 8 files changed: 158 ins; 1 del; 10 mod Patch: https://git.openjdk.java.net/valhalla/pull/708.diff Fetch: git fetch https://git.openjdk.java.net/valhalla pull/708/head:pull/708 PR: https://git.openjdk.java.net/valhalla/pull/708 From sadayapalam at openjdk.java.net Thu Jun 9 10:40:07 2022 From: sadayapalam at openjdk.java.net (Srikanth Adayapalam) Date: Thu, 9 Jun 2022 10:40:07 GMT Subject: [lworld] Integrated: 8287763: [lw4] Javac does not implement the spec for non-trivial constructors in toto In-Reply-To: References: Message-ID: <6GyqOn43oOKyNIlPggEsO0OhkOYIln8qhGsyLNOubWY=.528ed8b0-4ddd-49b0-b476-c32209d73a24@github.com> On Thu, 9 Jun 2022 10:27:48 GMT, Srikanth Adayapalam wrote: > Align with JLS changes to mark abstract classes with various forms of non-trivial constructors as being identity classes. This pull request has now been integrated. Changeset: 6692a954 Author: Srikanth Adayapalam URL: https://git.openjdk.java.net/valhalla/commit/6692a954f4b4ddcd8b420dffd9dbea1c1ee22f2b Stats: 169 lines in 8 files changed: 158 ins; 1 del; 10 mod 8287763: [lw4] Javac does not implement the spec for non-trivial constructors in toto ------------- PR: https://git.openjdk.java.net/valhalla/pull/708 From thartmann at openjdk.java.net Thu Jun 9 11:57:25 2022 From: thartmann at openjdk.java.net (Tobias Hartmann) Date: Thu, 9 Jun 2022 11:57:25 GMT Subject: [lworld] RFR: 8288098: [lworld] C2 fails to scalarize value class arguments Message-ID: C2 fails to scalarize a value class argument because its class is not listed for preloading (because the argument class is equal to the method holder class). We should not rely on the preload attribute here but simply check if the argument class is a loaded value class. Proper mismatch handling will be added by [JDK-8284443](https://bugs.openjdk.org/browse/JDK-8284443). I also added a regression test and fixed unrelated `TestNullableInlineTypes::test97` which failed due to recent changes. Thanks, Tobias ------------- Commit messages: - 8288098: [lworld] C2 fails to scalarize value class arguments Changes: https://git.openjdk.java.net/valhalla/pull/709/files Webrev: https://webrevs.openjdk.java.net/?repo=valhalla&pr=709&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8288098 Stats: 29 lines in 6 files changed: 11 ins; 12 del; 6 mod Patch: https://git.openjdk.java.net/valhalla/pull/709.diff Fetch: git fetch https://git.openjdk.java.net/valhalla pull/709/head:pull/709 PR: https://git.openjdk.java.net/valhalla/pull/709 From thartmann at openjdk.java.net Thu Jun 9 13:08:56 2022 From: thartmann at openjdk.java.net (Tobias Hartmann) Date: Thu, 9 Jun 2022 13:08:56 GMT Subject: [lworld] Integrated: 8288098: [lworld] C2 fails to scalarize value class arguments In-Reply-To: References: Message-ID: On Thu, 9 Jun 2022 11:49:35 GMT, Tobias Hartmann wrote: > C2 fails to scalarize a value class argument because its class is not listed for preloading (because the argument class is equal to the method holder class). We should not rely on the preload attribute here but simply check if the argument class is a loaded value class. Proper mismatch handling will be added by [JDK-8284443](https://bugs.openjdk.org/browse/JDK-8284443). > > I also added a regression test and fixed unrelated `TestNullableInlineTypes::test97` which failed due to recent changes. > > Thanks, > Tobias This pull request has now been integrated. Changeset: 328d1ea2 Author: Tobias Hartmann URL: https://git.openjdk.java.net/valhalla/commit/328d1ea273241c67654174227c1145a2256609bf Stats: 29 lines in 6 files changed: 11 ins; 12 del; 6 mod 8288098: [lworld] C2 fails to scalarize value class arguments ------------- PR: https://git.openjdk.java.net/valhalla/pull/709 From thartmann at openjdk.java.net Thu Jun 9 14:33:47 2022 From: thartmann at openjdk.java.net (Tobias Hartmann) Date: Thu, 9 Jun 2022 14:33:47 GMT Subject: [lworld] RFR: 8283777: [lworld] TestArrayCopyAsLoadsStores.java triggers assert after merging jdk-19+15 Message-ID: <1pJ9bHGLzfxop3cuZph8ZCmgyLc5yvcyF-ARvX6LheQ=.75e16e51-be4a-41af-8e4b-f5bf0de5c953@github.com> We hit a dominance assert because `maybe_cast_profiled_obj` replaces `original` in the map while there can still be a bailout afterwards. This code is not Valhalla specific but was moved up to before the uncommon trap long ago with https://github.com/openjdk/valhalla/commit/09f099cab74c483c4aee3e927f2bc3c41ad784c9. I don't think that's required anymore, so this change simply restores the mainline version. Thanks, Tobias ------------- Commit messages: - 8283777: [lworld] TestArrayCopyAsLoadsStores.java triggers assert after merging jdk-19+15 Changes: https://git.openjdk.org/valhalla/pull/710/files Webrev: https://webrevs.openjdk.java.net/?repo=valhalla&pr=710&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8283777 Stats: 46 lines in 2 files changed: 20 ins; 24 del; 2 mod Patch: https://git.openjdk.org/valhalla/pull/710.diff Fetch: git fetch https://git.openjdk.org/valhalla pull/710/head:pull/710 PR: https://git.openjdk.org/valhalla/pull/710 From rriggs at openjdk.java.net Thu Jun 9 14:58:06 2022 From: rriggs at openjdk.java.net (Roger Riggs) Date: Thu, 9 Jun 2022 14:58:06 GMT Subject: [lworld] RFR: 8287241: Add IdentityException to report that a value object is not valid [v4] In-Reply-To: References: Message-ID: <0Jt2fkK5eO-S8DIUCY6x1gKXdoLs5qbJ4tefB-bnZsA=.1947cd31-e73d-4c7d-bfc3-db1d0f86f0d5@github.com> > Add class java.lang.IdentityException, when thrown indicates that an identity object was required but a value object was supplied. > > Also add methods `java.util.Objects.requireIdentity(obj)` and `Objects.requireIdentity(obj, message)` to check and throw. > > Updated java.lang.ref.Reference and related tests to use new exception and method. Roger Riggs has updated the pull request incrementally with one additional commit since the last revision: Add IdentityException constructor with a single Throwable cause. ------------- Changes: - all: https://git.openjdk.org/valhalla/pull/696/files - new: https://git.openjdk.org/valhalla/pull/696/files/0d9a92c6..92c6e90e Webrevs: - full: https://webrevs.openjdk.java.net/?repo=valhalla&pr=696&range=03 - incr: https://webrevs.openjdk.java.net/?repo=valhalla&pr=696&range=02-03 Stats: 16 lines in 1 file changed: 13 ins; 3 del; 0 mod Patch: https://git.openjdk.org/valhalla/pull/696.diff Fetch: git fetch https://git.openjdk.org/valhalla pull/696/head:pull/696 PR: https://git.openjdk.org/valhalla/pull/696 From rriggs at openjdk.java.net Thu Jun 9 15:03:57 2022 From: rriggs at openjdk.java.net (Roger Riggs) Date: Thu, 9 Jun 2022 15:03:57 GMT Subject: [lworld] RFR: 8287241: Add IdentityException to report that a value object is not valid [v3] In-Reply-To: References: <1Yj5HQBGPPtstPIiDtYOk5noH1IQHrLoVK6Fynkq5Kk=.f5493033-746d-43c7-a353-c5e51378cd9a@github.com> Message-ID: On Wed, 8 Jun 2022 21:55:54 GMT, R?mi Forax wrote: >> Roger Riggs has updated the pull request incrementally with one additional commit since the last revision: >> >> Tweaks to Objects.requireIdentity and IdentityException > > src/java.base/share/classes/java/lang/IdentityException.java line 69: > >> 67: public IdentityException(String message, Throwable cause) { >> 68: super(message, cause); >> 69: } > > There is a missing variant, the one with a Throwable but no message that you use when you want to throw an IdentityException as a result of a previous exception (by example an IllegalMonitorStateException). It not clear where to draw the line on convenience methods (message can be null), but ok, added. ------------- PR: https://git.openjdk.org/valhalla/pull/696 From forax at openjdk.java.net Thu Jun 9 16:01:08 2022 From: forax at openjdk.java.net (=?UTF-8?B?UsOpbWk=?= Forax) Date: Thu, 9 Jun 2022 16:01:08 GMT Subject: [lworld] RFR: 8287241: Add IdentityException to report that a value object is not valid [v3] In-Reply-To: References: <1Yj5HQBGPPtstPIiDtYOk5noH1IQHrLoVK6Fynkq5Kk=.f5493033-746d-43c7-a353-c5e51378cd9a@github.com> Message-ID: <5g_IeAFbCEE1ZjhN0tpV-Z0IQ3-jTihfjZZJDtTtjgo=.370552af-4b6b-4a24-a8d1-8368447371d0@github.com> On Thu, 9 Jun 2022 15:00:43 GMT, Roger Riggs wrote: >> src/java.base/share/classes/java/lang/IdentityException.java line 69: >> >>> 67: public IdentityException(String message, Throwable cause) { >>> 68: super(message, cause); >>> 69: } >> >> There is a missing variant, the one with a Throwable but no message that you use when you want to throw an IdentityException as a result of a previous exception (by example an IllegalMonitorStateException). > > It not clear where to draw the line on convenience methods (message can be null), but ok, added. It's a convenient method but it's not equivalent to calling IdentityException(null, cause), Throwable(cause) is equivalent to Throwable(cause.getMessage(), cause) which is important if later a logger is configured to only log the error message. ------------- PR: https://git.openjdk.org/valhalla/pull/696 From mchung at openjdk.java.net Thu Jun 9 18:17:28 2022 From: mchung at openjdk.java.net (Mandy Chung) Date: Thu, 9 Jun 2022 18:17:28 GMT Subject: [lworld] RFR: 8287241: Add IdentityException to report that a value object is not valid [v3] In-Reply-To: <5g_IeAFbCEE1ZjhN0tpV-Z0IQ3-jTihfjZZJDtTtjgo=.370552af-4b6b-4a24-a8d1-8368447371d0@github.com> References: <1Yj5HQBGPPtstPIiDtYOk5noH1IQHrLoVK6Fynkq5Kk=.f5493033-746d-43c7-a353-c5e51378cd9a@github.com> <5g_IeAFbCEE1ZjhN0tpV-Z0IQ3-jTihfjZZJDtTtjgo=.370552af-4b6b-4a24-a8d1-8368447371d0@github.com> Message-ID: <0scQTnoaz2S3XdkBIqa0LPqSAn6xcQNL_0NPx0907Sc=.7e74ac52-c666-418e-abdb-6b43a5444898@github.com> On Thu, 9 Jun 2022 15:53:02 GMT, R?mi Forax wrote: >> It not clear where to draw the line on convenience methods (message can be null), but ok, added. > > It's a convenient method but it's not equivalent to calling IdentityException(null, cause), Throwable(cause) is equivalent to Throwable(cause.getMessage(), cause) which is important if later a logger is configured to only log the error message. Exceptions in the JDK do not always have all four standard constructors as in `Throwable`. There was a discussion to audit the constructor choices for JDK exceptions. Some new exceptions do add all 4 constructors (`IllegalCallerException` and `WrongThreadException`). Since this one has a constructor taking the `cause` for exception chaining, it's reasonable to add the variant setting the default message to `cause.getMessage()`. ------------- PR: https://git.openjdk.org/valhalla/pull/696 From mchung at openjdk.java.net Thu Jun 9 18:17:29 2022 From: mchung at openjdk.java.net (Mandy Chung) Date: Thu, 9 Jun 2022 18:17:29 GMT Subject: [lworld] RFR: 8287241: Add IdentityException to report that a value object is not valid [v3] In-Reply-To: <0scQTnoaz2S3XdkBIqa0LPqSAn6xcQNL_0NPx0907Sc=.7e74ac52-c666-418e-abdb-6b43a5444898@github.com> References: <1Yj5HQBGPPtstPIiDtYOk5noH1IQHrLoVK6Fynkq5Kk=.f5493033-746d-43c7-a353-c5e51378cd9a@github.com> <5g_IeAFbCEE1ZjhN0tpV-Z0IQ3-jTihfjZZJDtTtjgo=.370552af-4b6b-4a24-a8d1-8368447371d0@github.com> <0scQTnoaz2S3XdkBIqa0LPqSAn6xcQNL_0NPx0907Sc=.7e74ac52-c666-418e-abdb-6b43a5444898@github.com> Message-ID: On Thu, 9 Jun 2022 18:14:17 GMT, Mandy Chung wrote: >> It's a convenient method but it's not equivalent to calling IdentityException(null, cause), Throwable(cause) is equivalent to Throwable(cause.getMessage(), cause) which is important if later a logger is configured to only log the error message. > > Exceptions in the JDK do not always have all four standard constructors as in `Throwable`. There was a discussion to audit the constructor choices for JDK exceptions. Some new exceptions do add all 4 constructors (`IllegalCallerException` and `WrongThreadException`). Since this one has a constructor taking the `cause` for exception chaining, it's reasonable to add the variant setting the default message to `cause.getMessage()`. Exceptions in the JDK do not always have all four standard constructors as in `Throwable`. There was a discussion to audit the constructor choices for JDK exceptions. Some new exceptions do add all 4 constructors (`IllegalCallerException` and `WrongThreadException`). Since this one has a constructor taking the `cause` for exception chaining, it's reasonable to add the variant setting the default message to `cause.getMessage()`. ------------- PR: https://git.openjdk.org/valhalla/pull/696 From sadayapalam at openjdk.java.net Fri Jun 10 05:27:03 2022 From: sadayapalam at openjdk.java.net (Srikanth Adayapalam) Date: Fri, 10 Jun 2022 05:27:03 GMT Subject: [lworld] RFR: 8288171: [lw4] Revert JDK-8253873 to fix failures in jdi, jvmti and jwdp tests Message-ID: <1j9j41Grj1iv00ayZTfKJ6E_tGmKEXf-cjMVXPxY6vc=.c5f67918-47cc-43d5-afb2-257833374451@github.com> This reverts commit 644b057b80b716e009f32a9d22ef5dd07e9dd12c Also reverts changes made to test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Interfaces/interfaces001.java for JDK-8248662 ------------- Commit messages: - Revert "8253873: jdi, jvmti, and jdwp tests fail because of unexpected number of interfaces" Changes: https://git.openjdk.org/valhalla/pull/711/files Webrev: https://webrevs.openjdk.java.net/?repo=valhalla&pr=711&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8288171 Stats: 98 lines in 8 files changed: 1 ins; 23 del; 74 mod Patch: https://git.openjdk.org/valhalla/pull/711.diff Fetch: git fetch https://git.openjdk.org/valhalla pull/711/head:pull/711 PR: https://git.openjdk.org/valhalla/pull/711 From sadayapalam at openjdk.java.net Fri Jun 10 05:29:33 2022 From: sadayapalam at openjdk.java.net (Srikanth Adayapalam) Date: Fri, 10 Jun 2022 05:29:33 GMT Subject: [lworld] Integrated: 8288171: [lw4] Revert JDK-8253873 to fix failures in jdi, jvmti and jwdp tests In-Reply-To: <1j9j41Grj1iv00ayZTfKJ6E_tGmKEXf-cjMVXPxY6vc=.c5f67918-47cc-43d5-afb2-257833374451@github.com> References: <1j9j41Grj1iv00ayZTfKJ6E_tGmKEXf-cjMVXPxY6vc=.c5f67918-47cc-43d5-afb2-257833374451@github.com> Message-ID: On Fri, 10 Jun 2022 05:21:36 GMT, Srikanth Adayapalam wrote: > This reverts commit 644b057b80b716e009f32a9d22ef5dd07e9dd12c > Also reverts changes made to test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Interfaces/interfaces001.java for JDK-8248662 This pull request has now been integrated. Changeset: 15cb319a Author: Srikanth Adayapalam URL: https://git.openjdk.org/valhalla/commit/15cb319a3d2e7d314864ceba44170aa8c2860918 Stats: 98 lines in 8 files changed: 1 ins; 23 del; 74 mod 8288171: [lw4] Revert JDK-8253873 to fix failures in jdi, jvmti and jwdp tests ------------- PR: https://git.openjdk.org/valhalla/pull/711 From thartmann at openjdk.java.net Fri Jun 10 06:11:59 2022 From: thartmann at openjdk.java.net (Tobias Hartmann) Date: Fri, 10 Jun 2022 06:11:59 GMT Subject: [lworld] Integrated: 8283777: [lworld] TestArrayCopyAsLoadsStores.java triggers assert after merging jdk-19+15 In-Reply-To: <1pJ9bHGLzfxop3cuZph8ZCmgyLc5yvcyF-ARvX6LheQ=.75e16e51-be4a-41af-8e4b-f5bf0de5c953@github.com> References: <1pJ9bHGLzfxop3cuZph8ZCmgyLc5yvcyF-ARvX6LheQ=.75e16e51-be4a-41af-8e4b-f5bf0de5c953@github.com> Message-ID: On Thu, 9 Jun 2022 14:20:34 GMT, Tobias Hartmann wrote: > We hit a dominance assert because `maybe_cast_profiled_obj` replaces `original` in the map while there can still be a bailout afterwards. This code is not Valhalla specific but was moved up to before the uncommon trap long ago with https://github.com/openjdk/valhalla/commit/09f099cab74c483c4aee3e927f2bc3c41ad784c9. I don't think that's required anymore, so this change simply restores the mainline version. > > Thanks, > Tobias This pull request has now been integrated. Changeset: 02985564 Author: Tobias Hartmann URL: https://git.openjdk.org/valhalla/commit/02985564a67dc91a3f76d008b63b6dcdd786f6b8 Stats: 46 lines in 2 files changed: 20 ins; 24 del; 2 mod 8283777: [lworld] TestArrayCopyAsLoadsStores.java triggers assert after merging jdk-19+15 ------------- PR: https://git.openjdk.org/valhalla/pull/710 From sadayapalam at openjdk.java.net Fri Jun 10 09:41:10 2022 From: sadayapalam at openjdk.java.net (Srikanth Adayapalam) Date: Fri, 10 Jun 2022 09:41:10 GMT Subject: [lworld] RFR: 8288186: [lw4] Many runtime/cds/appcds/ tests are still referring to IdentityObject Message-ID: Revert "8265719: [lworld] CDS tests fail after the merge with master" This reverts commit 74dbd64e4577489843b992f43ae1f8104762c328. ------------- Commit messages: - 8288186: [lw4] Many runtime/cds/appcds/ tests are still referring to IdentityObject Changes: https://git.openjdk.org/valhalla/pull/712/files Webrev: https://webrevs.openjdk.java.net/?repo=valhalla&pr=712&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8288186 Stats: 48 lines in 14 files changed: 0 ins; 16 del; 32 mod Patch: https://git.openjdk.org/valhalla/pull/712.diff Fetch: git fetch https://git.openjdk.org/valhalla pull/712/head:pull/712 PR: https://git.openjdk.org/valhalla/pull/712 From sadayapalam at openjdk.java.net Fri Jun 10 09:47:44 2022 From: sadayapalam at openjdk.java.net (Srikanth Adayapalam) Date: Fri, 10 Jun 2022 09:47:44 GMT Subject: [lworld] Integrated: 8288186: [lw4] Many runtime/cds/appcds/ tests are still referring to IdentityObject In-Reply-To: References: Message-ID: On Fri, 10 Jun 2022 09:35:32 GMT, Srikanth Adayapalam wrote: > Revert "8265719: [lworld] CDS tests fail after the merge with master" > This reverts commit 74dbd64e4577489843b992f43ae1f8104762c328. This pull request has now been integrated. Changeset: 22bb5472 Author: Srikanth Adayapalam URL: https://git.openjdk.org/valhalla/commit/22bb54721e39720c690cfd2d3baa0d65cb8d3bb9 Stats: 48 lines in 14 files changed: 0 ins; 16 del; 32 mod 8288186: [lw4] Many runtime/cds/appcds/ tests are still referring to IdentityObject ------------- PR: https://git.openjdk.org/valhalla/pull/712 From mcimadamore at openjdk.java.net Fri Jun 10 10:40:30 2022 From: mcimadamore at openjdk.java.net (Maurizio Cimadamore) Date: Fri, 10 Jun 2022 10:40:30 GMT Subject: RFR: addressing several issues in the implementation of universal tvars [v9] In-Reply-To: References: <6UMCAP-gHCdAYkuu_7HfAQHCkJfmbAdJFC7zM2vOW3w=.818cf5fd-9fbe-4429-8bfd-e137209ba420@github.com> Message-ID: On Wed, 8 Jun 2022 19:10:59 GMT, Vicente Romero wrote: >> well `action`'s type is parameterized with a wildcard so here we are assigning a ref to a wildcard, `field = t` is not failing though that assignment generates a warning > > it could probably be better to write the test as: > > field = t; > action.accept(field = t); > > what do you think? Ah I see. So there's two things here: 1. assignment from `t` to `field` - that works ok (with warning) 2. passing `field` (of type `T.ref`) to `action`. On (2), `action` is subject to capture conversion, so its type is `Consumer<#CAP>` where `T <: #CAP `. So, we have to check whether `T.ref` is assignable to `#CAP`. I believe this currently fails because `T.ref` cannot be "lifted" to `#CAP`. I think this is ok for now, but I note that, when type variables are involved, there are always two ways to prove subtyping: * T <: S iff upper(T) <: S * S <: T iff S <: lower(T) It is true that, in (2) you cannot "lift" `T.ref` to `'#CAP`, but it is also true that you can "unlift" `#CAP` down to `T`, at which point you would have a structural comparison between `T.ref` and `T` again (which would be ok). Whether or not this is what we want to do is a specification question - we can revisit later. (Here I note that we don't currently do this even for ordinary unchecked conversions, so what we have is probably ok). ------------- PR: https://git.openjdk.org/valhalla/pull/684 From vromero at openjdk.java.net Fri Jun 10 15:15:30 2022 From: vromero at openjdk.java.net (Vicente Romero) Date: Fri, 10 Jun 2022 15:15:30 GMT Subject: RFR: addressing several issues in the implementation of universal tvars [v9] In-Reply-To: References: <6UMCAP-gHCdAYkuu_7HfAQHCkJfmbAdJFC7zM2vOW3w=.818cf5fd-9fbe-4429-8bfd-e137209ba420@github.com> Message-ID: On Fri, 10 Jun 2022 10:34:57 GMT, Maurizio Cimadamore wrote: >> it could probably be better to write the test as: >> >> field = t; >> action.accept(field = t); >> >> what do you think? > > Ah I see. So there's two things here: > 1. assignment from `t` to `field` - that works ok (with warning) > 2. passing `field` (of type `T.ref`) to `action`. > > On (2), `action` is subject to capture conversion, so its type is `Consumer<#CAP>` where `T <: #CAP `. So, we have to check whether `T.ref` is assignable to `#CAP`. I believe this currently fails because `T.ref` cannot be "lifted" to `#CAP`. > > I think this is ok for now, but I note that, when type variables are involved, there are always two ways to prove subtyping: > > * T <: S iff upper(T) <: S > * S <: T iff S <: lower(T) > > It is true that, in (2) you cannot "lift" `T.ref` to `'#CAP`, but it is also true that you can "unlift" `#CAP` down to `T`, at which point you would have a structural comparison between `T.ref` and `T` again (which would be ok). > > Whether or not this is what we want to do is a specification question - we can revisit later. (Here I note that we don't currently do this even for ordinary unchecked conversions, so what we have is probably ok). I see, thanks for the review ------------- PR: https://git.openjdk.org/valhalla/pull/684 From vromero at openjdk.java.net Fri Jun 10 15:19:47 2022 From: vromero at openjdk.java.net (Vicente Romero) Date: Fri, 10 Jun 2022 15:19:47 GMT Subject: Integrated: addressing several issues in the implementation of universal tvars In-Reply-To: References: Message-ID: On Fri, 15 Apr 2022 16:32:46 GMT, Vicente Romero wrote: > Last review iteration found several issues in the current implementation, addressing them here This pull request has now been integrated. Changeset: 4e3d1e06 Author: Vicente Romero URL: https://git.openjdk.org/valhalla/commit/4e3d1e065838a8050bf76af67653bb479b605efc Stats: 484 lines in 11 files changed: 274 ins; 163 del; 47 mod addressing several issues in the implementation of universal tvars ------------- PR: https://git.openjdk.org/valhalla/pull/684 From vromero at openjdk.java.net Fri Jun 10 16:22:47 2022 From: vromero at openjdk.java.net (Vicente Romero) Date: Fri, 10 Jun 2022 16:22:47 GMT Subject: Integrated: Merge lworld Message-ID: Merge lworld into universal-tvars ------------- Commit messages: - Merge branch 'lworld' into universal-tvars_merge_lworld_last - 8288186: [lw4] Many runtime/cds/appcds/ tests are still referring to IdentityObject - 8283777: [lworld] TestArrayCopyAsLoadsStores.java triggers assert after merging jdk-19+15 - 8288171: [lw4] Revert JDK-8253873 to fix failures in jdi, jvmti and jwdp tests - 8288098: [lworld] C2 fails to scalarize value class arguments - 8287763: [lw4] Javac does not implement the spec for non-trivial constructors in toto - 8288084: [lw4] Tier1 hotspot runtime test ClassHierarchyTest.java fails - 8287898: [lw4] test/hotspot/jtreg/runtime/valhalla/inlinetypes/verifier/VerifierInlineTypes.java fails - 8287767: [lw4] Javac tolerates mutually incompatible super types. - 8287770: [lw4] Javac tolerates synchronizing on an instance of a value interface - ... and 13 more: https://git.openjdk.org/valhalla/compare/4e3d1e06...f661394b The webrevs contain the adjustments done while merging with regards to each parent branch: - universal-tvars: https://webrevs.openjdk.java.net/?repo=valhalla&pr=713&range=00.0 - lworld: https://webrevs.openjdk.java.net/?repo=valhalla&pr=713&range=00.1 Changes: https://git.openjdk.org/valhalla/pull/713/files Stats: 9535 lines in 300 files changed: 5759 ins; 2405 del; 1371 mod Patch: https://git.openjdk.org/valhalla/pull/713.diff Fetch: git fetch https://git.openjdk.org/valhalla pull/713/head:pull/713 PR: https://git.openjdk.org/valhalla/pull/713 From vromero at openjdk.java.net Fri Jun 10 16:22:48 2022 From: vromero at openjdk.java.net (Vicente Romero) Date: Fri, 10 Jun 2022 16:22:48 GMT Subject: Integrated: Merge lworld In-Reply-To: References: Message-ID: <7ly6EgYOBtpK4PBlV27Kv7RSTJ-PW_drw60NvHN0hdU=.b94c1368-eeb8-4d0e-8e44-432b58075b70@github.com> On Fri, 10 Jun 2022 15:41:14 GMT, Vicente Romero wrote: > Merge lworld into universal-tvars This pull request has now been integrated. Changeset: cc1b78ea Author: Vicente Romero URL: https://git.openjdk.org/valhalla/commit/cc1b78eaa7d2a563afc3754e5f10eb743719b94a Stats: 9535 lines in 300 files changed: 5759 ins; 2405 del; 1371 mod Merge lworld ------------- PR: https://git.openjdk.org/valhalla/pull/713 From rriggs at openjdk.org Thu Jun 16 15:58:57 2022 From: rriggs at openjdk.org (Roger Riggs) Date: Thu, 16 Jun 2022 15:58:57 GMT Subject: [lworld] RFR: 8288600: [test] Revert IdentityObject interface change in java.namig test RunBasic Message-ID: The removal of the IdentityObject interface needs to be reflected in the ldap test golden files. The interface does not appear in serialized objects. ------------- Commit messages: - 8288600: [test] Revert IdentityObject interface change in java.naming test RunBasic Changes: https://git.openjdk.org/valhalla/pull/715/files Webrev: https://webrevs.openjdk.org/?repo=valhalla&pr=715&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8288600 Stats: 139 lines in 2 files changed: 0 ins; 13 del; 126 mod Patch: https://git.openjdk.org/valhalla/pull/715.diff Fetch: git fetch https://git.openjdk.org/valhalla pull/715/head:pull/715 PR: https://git.openjdk.org/valhalla/pull/715 From rriggs at openjdk.org Thu Jun 16 17:22:07 2022 From: rriggs at openjdk.org (Roger Riggs) Date: Thu, 16 Jun 2022 17:22:07 GMT Subject: [lworld] Integrated: 8287241: Add IdentityException to report that a value object is not valid In-Reply-To: References: Message-ID: On Tue, 24 May 2022 18:25:18 GMT, Roger Riggs wrote: > Add class java.lang.IdentityException, when thrown indicates that an identity object was required but a value object was supplied. > > Also add methods `java.util.Objects.requireIdentity(obj)` and `Objects.requireIdentity(obj, message)` to check and throw. > > Updated java.lang.ref.Reference and related tests to use new exception and method. This pull request has now been integrated. Changeset: 3d15c2f1 Author: Roger Riggs URL: https://git.openjdk.org/valhalla/commit/3d15c2f1b54c8ce28c2aec82ac2c096c2ffb0f60 Stats: 157 lines in 4 files changed: 149 ins; 3 del; 5 mod 8287241: Add IdentityException to report that a value object is not valid Reviewed-by: mchung ------------- PR: https://git.openjdk.org/valhalla/pull/696 From vromero at openjdk.org Thu Jun 16 23:26:45 2022 From: vromero at openjdk.org (Vicente Romero) Date: Thu, 16 Jun 2022 23:26:45 GMT Subject: RFR: left-overs from last type system refactoring Message-ID: Some additional refactorings that I forgot to apply as part of [PR-684](https://urldefense.com/v3/__https://github.com/openjdk/valhalla/pull/684__;!!ACWV5N9M2RV99hQ!Na43f-8H5zINX3FHnv0iGpwNV8AUbpRat9i9-glFqaEa_cBXxTA7ATGQckf752USc7sN6pp4iRPos6YnO3SeZ_Y$ ) ------------- Commit messages: - left-overs from last type system refactoring Changes: https://git.openjdk.org/valhalla/pull/716/files Webrev: https://webrevs.openjdk.org/?repo=valhalla&pr=716&range=00 Stats: 116 lines in 1 file changed: 48 ins; 57 del; 11 mod Patch: https://git.openjdk.org/valhalla/pull/716.diff Fetch: git fetch https://git.openjdk.org/valhalla pull/716/head:pull/716 PR: https://git.openjdk.org/valhalla/pull/716 From vromero at openjdk.org Thu Jun 16 23:30:10 2022 From: vromero at openjdk.org (Vicente Romero) Date: Thu, 16 Jun 2022 23:30:10 GMT Subject: Integrated: left-overs from last type system refactoring In-Reply-To: References: Message-ID: On Thu, 16 Jun 2022 23:20:09 GMT, Vicente Romero wrote: > Some additional refactorings that I forgot to apply as part of [PR-684](https://urldefense.com/v3/__https://github.com/openjdk/valhalla/pull/684__;!!ACWV5N9M2RV99hQ!O1Jrr3Dvn8njU4t7mJR5mvtaUU1fF5klW6O0xNBV8BAZEhSmh80dZj6JpltPvEi4aTXzku2lDCeM2UEIAzqlI_A$ ) This pull request has now been integrated. Changeset: 5f9208ad Author: Vicente Romero URL: https://git.openjdk.org/valhalla/commit/5f9208ada5ef37151849622df802f3aa6a10b16b Stats: 116 lines in 1 file changed: 48 ins; 57 del; 11 mod left-overs from last type system refactoring ------------- PR: https://git.openjdk.org/valhalla/pull/716 From sadayapalam at openjdk.org Fri Jun 17 08:09:09 2022 From: sadayapalam at openjdk.org (Srikanth Adayapalam) Date: Fri, 17 Jun 2022 08:09:09 GMT Subject: [lworld] RFR: 8288644: [lw4] Unable to extend a separately compiled abstract value class Message-ID: <1KQl_wLrVBFCLxlKkqH7X4szaA4w5uUwId7SP1fcsig=.5a45ab6f-2e9e-452c-a057-4d698c6f686b@github.com> Lower constructors in abstract value classes into void methods and in concrete value classes into static factory methods. ------------- Commit messages: - 8288644: [lw4] Unable to extend a separately compiled abstract value class Changes: https://git.openjdk.org/valhalla/pull/717/files Webrev: https://webrevs.openjdk.org/?repo=valhalla&pr=717&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8288644 Stats: 70 lines in 6 files changed: 46 ins; 1 del; 23 mod Patch: https://git.openjdk.org/valhalla/pull/717.diff Fetch: git fetch https://git.openjdk.org/valhalla pull/717/head:pull/717 PR: https://git.openjdk.org/valhalla/pull/717 From rriggs at openjdk.org Fri Jun 17 14:20:27 2022 From: rriggs at openjdk.org (Roger Riggs) Date: Fri, 17 Jun 2022 14:20:27 GMT Subject: [lworld] Integrated: 8288600: [test] Revert IdentityObject interface change in java.naming test RunBasic In-Reply-To: References: Message-ID: <6tthXs_Xz63-flPwoCMDQdAVvmq4XDE2TFQqY8Ur2ng=.f347de75-e0e4-4826-a342-491faaec31be@github.com> On Thu, 16 Jun 2022 15:50:30 GMT, Roger Riggs wrote: > The removal of the IdentityObject interface needs to be reflected in the ldap test golden files. > The interface does not appear in serialized objects. This pull request has now been integrated. Changeset: dff3d147 Author: Roger Riggs URL: https://git.openjdk.org/valhalla/commit/dff3d147adcaee101f1f867381a36fd2eea0f887 Stats: 139 lines in 2 files changed: 0 ins; 13 del; 126 mod 8288600: [test] Revert IdentityObject interface change in java.naming test RunBasic ------------- PR: https://git.openjdk.org/valhalla/pull/715 From rriggs at openjdk.org Fri Jun 17 17:26:37 2022 From: rriggs at openjdk.org (Roger Riggs) Date: Fri, 17 Jun 2022 17:26:37 GMT Subject: [lworld] RFR: 8281463: [lworld] VALUE / PRIMITIVE modifiers should be supported by reflection [v7] In-Reply-To: References: Message-ID: > Add support to java.lang.reflect.AccessFlag ACC_IDENTITY, ACC_VALUE, and ACC_PRIMITIVE. > Added corresponding flags to j.l.reflect.Modifier so the "source" of the AccessFlag is the Modifer mask. > Remove PERMITS_VALUE; moving the definition used by HotSpot to HotSpot code. > > Add comments to java.l.reflect.Modifier suggesting use of AccessFlag instead and limitations. Roger Riggs 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 ten additional commits since the last revision: - Merge branch 'lworld' into 8281463-value-modifiers - Proxy class definition needs ACC_IDENTITY Restore ACC_SUPER to AccessFlag and adjust test - Replace static int constants with AccessFlag method calls. - Revert changes and simplify Update GenericStringTest to work with value and primitive classes. - Address review comments - Merge branch 'lworld' into 8281463-value-modifiers - Add Class.is(AccessFlag) to test for a single flag. - Restore AccessFlag SUPER - 8281463: [lworld] VALUE / PRIMITIVE modifiers should be supported by reflection Use java.lang.reflect.AccessFlag for equivalent functions for value objects. Corrected ModuleDescriptor.STATIC flags to be STATIC_PHASE Added flags to j.l.reflect.Modifier. ------------- Changes: - all: https://git.openjdk.org/valhalla/pull/698/files - new: https://git.openjdk.org/valhalla/pull/698/files/349a9399..558d8734 Webrevs: - full: https://webrevs.openjdk.org/?repo=valhalla&pr=698&range=06 - incr: https://webrevs.openjdk.org/?repo=valhalla&pr=698&range=05-06 Stats: 708 lines in 49 files changed: 343 ins; 99 del; 266 mod Patch: https://git.openjdk.org/valhalla/pull/698.diff Fetch: git fetch https://git.openjdk.org/valhalla pull/698/head:pull/698 PR: https://git.openjdk.org/valhalla/pull/698 From fparain at openjdk.org Fri Jun 17 19:30:16 2022 From: fparain at openjdk.org (Frederic Parain) Date: Fri, 17 Jun 2022 19:30:16 GMT Subject: [lworld] RFR: 8288644: [lw4] Unable to extend a separately compiled abstract value class In-Reply-To: <1KQl_wLrVBFCLxlKkqH7X4szaA4w5uUwId7SP1fcsig=.5a45ab6f-2e9e-452c-a057-4d698c6f686b@github.com> References: <1KQl_wLrVBFCLxlKkqH7X4szaA4w5uUwId7SP1fcsig=.5a45ab6f-2e9e-452c-a057-4d698c6f686b@github.com> Message-ID: On Fri, 17 Jun 2022 08:02:52 GMT, Srikanth Adayapalam wrote: > Lower constructors in abstract value classes into void methods and in concrete value classes into static factory methods. VM changes look good to me, according to the semantic given by Dan. ------------- Marked as reviewed by fparain (Committer). PR: https://git.openjdk.org/valhalla/pull/717 From sadayapalam at openjdk.org Sat Jun 18 04:32:30 2022 From: sadayapalam at openjdk.org (Srikanth Adayapalam) Date: Sat, 18 Jun 2022 04:32:30 GMT Subject: [lworld] Integrated: 8288644: [lw4] Unable to extend a separately compiled abstract value class In-Reply-To: <1KQl_wLrVBFCLxlKkqH7X4szaA4w5uUwId7SP1fcsig=.5a45ab6f-2e9e-452c-a057-4d698c6f686b@github.com> References: <1KQl_wLrVBFCLxlKkqH7X4szaA4w5uUwId7SP1fcsig=.5a45ab6f-2e9e-452c-a057-4d698c6f686b@github.com> Message-ID: On Fri, 17 Jun 2022 08:02:52 GMT, Srikanth Adayapalam wrote: > Lower constructors in abstract value classes into void methods and in concrete value classes into static factory methods. This pull request has now been integrated. Changeset: c7a75211 Author: Srikanth Adayapalam URL: https://git.openjdk.org/valhalla/commit/c7a75211b98e5af6b46e936f4a091b92513606bd Stats: 70 lines in 6 files changed: 46 ins; 1 del; 23 mod 8288644: [lw4] Unable to extend a separately compiled abstract value class Reviewed-by: fparain ------------- PR: https://git.openjdk.org/valhalla/pull/717 From rriggs at openjdk.org Fri Jun 24 17:16:40 2022 From: rriggs at openjdk.org (Roger Riggs) Date: Fri, 24 Jun 2022 17:16:40 GMT Subject: [lworld] RFR: 8281463: [lworld] VALUE / PRIMITIVE modifiers should be supported by reflection [v8] In-Reply-To: References: Message-ID: > Add support to java.lang.reflect.AccessFlag ACC_IDENTITY, ACC_VALUE, and ACC_PRIMITIVE. > Added corresponding flags to j.l.reflect.Modifier so the "source" of the AccessFlag is the Modifer mask. > Remove PERMITS_VALUE; moving the definition used by HotSpot to HotSpot code. > > Add comments to java.l.reflect.Modifier suggesting use of AccessFlag instead and limitations. Roger Riggs has updated the pull request incrementally with one additional commit since the last revision: Sync with jdk AccessFlag updates. ------------- Changes: - all: https://git.openjdk.org/valhalla/pull/698/files - new: https://git.openjdk.org/valhalla/pull/698/files/558d8734..605d386c Webrevs: - full: https://webrevs.openjdk.org/?repo=valhalla&pr=698&range=07 - incr: https://webrevs.openjdk.org/?repo=valhalla&pr=698&range=06-07 Stats: 757 lines in 11 files changed: 684 ins; 14 del; 59 mod Patch: https://git.openjdk.org/valhalla/pull/698.diff Fetch: git fetch https://git.openjdk.org/valhalla pull/698/head:pull/698 PR: https://git.openjdk.org/valhalla/pull/698 From rriggs at openjdk.org Thu Jun 30 14:08:38 2022 From: rriggs at openjdk.org (Roger Riggs) Date: Thu, 30 Jun 2022 14:08:38 GMT Subject: [lworld] RFR: 8286824: [valhalla] WeakHashMap for value classes Message-ID: WeakHashMap uses WeakReference for keys, allowing it to retain only keys and values that are strongly referenced elsewhere. The behavior of WeakReference (or any Reference class) is not defined for value objects. Four (4) behaviors are proposed for WeakHashMap to give the developer a choice: - SOFT - Keys that are value objects are retained until memory pressure clears soft references; then the keys that are value objects are removed automatically - STRONG - Keys are value objects are retained until they are explicitly removed - THROW - Keys that are value objects can not be put into the map; UnsupportedOperationException is thrown - DISCARD - Keys that are value objects are silently discarded; as if they were removed immediately without being visible The default is SOFT - key/values are removed when there is memory pressure. Entries will be removed automatically at some point, though less deterministically than with WeakReferences. ------------- Commit messages: - Merge - javadoc cleanup - replace newIdentity with 'new Object()' - fix NPE - Merge branch 'lworld' into 8286824-weakhashmap - Minor updates - Implement enum ValuePolicy for WeakHashMap - Implement enum ValuePolicy for WeakHashMap Changes: https://git.openjdk.org/valhalla/pull/718/files Webrev: https://webrevs.openjdk.org/?repo=valhalla&pr=718&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8286824 Stats: 427 lines in 3 files changed: 421 ins; 1 del; 5 mod Patch: https://git.openjdk.org/valhalla/pull/718.diff Fetch: git fetch https://git.openjdk.org/valhalla pull/718/head:pull/718 PR: https://git.openjdk.org/valhalla/pull/718