From sirinath1978m at gmail.com Tue Jan 5 07:45:55 2021 From: sirinath1978m at gmail.com (Suminda Sirinath Salpitikorala Dharmasena) Date: Tue, 5 Jan 2021 13:15:55 +0530 Subject: Pass by reference: final and effectively final parameters and qualifying return types Message-ID: Hello, Java unlike C# does not have `ref` parameters. Reference parameters contribute to some of the recent speedups as highlighted in this post: https://devblogs.microsoft.com/dotnet/performance-improvements-in-net-5/. So is it possible to automatically convert qualifying parameters and return types in refs. Final and effectively final parameters and also certain return types can also be converted into refs. A language change is not needed as this is done by the compiler/JVM, though further language change can be done to accommodate this. Suminda From forax at univ-mlv.fr Tue Jan 5 09:12:10 2021 From: forax at univ-mlv.fr (Remi Forax) Date: Tue, 5 Jan 2021 10:12:10 +0100 (CET) Subject: Pass by reference: final and effectively final parameters and qualifying return types In-Reply-To: References: Message-ID: <128788954.1055374.1609837930937.JavaMail.zimbra@u-pem.fr> ----- Mail original ----- > De: "Suminda Sirinath Salpitikorala Dharmasena" > ?: "valhalla-dev" > Envoy?: Mardi 5 Janvier 2021 08:45:55 > Objet: Pass by reference: final and effectively final parameters and qualifying return types > Hello, > > Java unlike C# does not have `ref` parameters. Reference parameters > contribute to some of the recent speedups as highlighted in this post: > https://devblogs.microsoft.com/dotnet/performance-improvements-in-net-5/. > > So is it possible to automatically convert qualifying parameters and return > types in refs. > > Final and effectively final parameters and also certain return types can > also be converted into refs. > > A language change is not needed as this is done by the compiler/JVM, though > further language change can be done to accommodate this. Hello, reference parameters, out parameters, are hard to optimize because of pointer aliasing [1]. C# inherits them from the COM runtime model, so has to deal with them. Java does not have them by design. Java uses a pass by value semantics which leads to better code. regards, R?mi > > Suminda [1] https://en.wikipedia.org/wiki/Pointer_aliasing From sirinath1978m at gmail.com Tue Jan 5 13:16:49 2021 From: sirinath1978m at gmail.com (Suminda Sirinath Salpitikorala Dharmasena) Date: Tue, 5 Jan 2021 18:46:49 +0530 Subject: Pass by reference: final and effectively final parameters and qualifying return types In-Reply-To: <128788954.1055374.1609837930937.JavaMail.zimbra@u-pem.fr> References: <128788954.1055374.1609837930937.JavaMail.zimbra@u-pem.fr> Message-ID: What I am suggesting is if a value is not modified in a method just pass it as reference in JITed code, at least, as there is no need to make a copy of the value. The likes of out parameters are not needed in Java but can benefit with some construct like reference ( https://en.wikipedia.org/wiki/Reference_(C%2B%2B), https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/ref ). This is to ensure data does not get unnecessarily duplicated and copied. With the introduction of value types having reference type can be of benefit so what large value types are not copied unnecessarily. S From thartmann at openjdk.java.net Thu Jan 7 07:48:14 2021 From: thartmann at openjdk.java.net (Tobias Hartmann) Date: Thu, 7 Jan 2021 07:48:14 GMT Subject: [lworld] RFR: 8259230: [lworld] Several crashes with C2 stress options Message-ID: <4LehRd29pE2WTjOzr11o4w3ETAZONTEaMPt8CEhhL7M=.1c43539a-3078-4206-94aa-6d871b47390a@github.com> This fixes several smaller C2 issues I've found when running testing with stress options like `StressReflectiveCode` and others enabled. Thanks, Tobias ------------- Commit messages: - 8259230: [lworld] Several crashes with C2 stress options Changes: https://git.openjdk.java.net/valhalla/pull/305/files Webrev: https://webrevs.openjdk.java.net/?repo=valhalla&pr=305&range=00 Issue: https://bugs.openjdk.java.net/browse/JDK-8259230 Stats: 38 lines in 9 files changed: 12 ins; 1 del; 25 mod Patch: https://git.openjdk.java.net/valhalla/pull/305.diff Fetch: git fetch https://git.openjdk.java.net/valhalla pull/305/head:pull/305 PR: https://git.openjdk.java.net/valhalla/pull/305 From thartmann at openjdk.java.net Thu Jan 7 07:53:08 2021 From: thartmann at openjdk.java.net (Tobias Hartmann) Date: Thu, 7 Jan 2021 07:53:08 GMT Subject: [lworld] Integrated: 8259230: [lworld] Several crashes with C2 stress options In-Reply-To: <4LehRd29pE2WTjOzr11o4w3ETAZONTEaMPt8CEhhL7M=.1c43539a-3078-4206-94aa-6d871b47390a@github.com> References: <4LehRd29pE2WTjOzr11o4w3ETAZONTEaMPt8CEhhL7M=.1c43539a-3078-4206-94aa-6d871b47390a@github.com> Message-ID: <5qDlAtgXZa8HeL4bvtL-hp2h-44s02f_kmM53XXyjE0=.88e183bc-643b-4aef-8e9b-eee53d0099f7@github.com> On Thu, 7 Jan 2021 07:44:12 GMT, Tobias Hartmann wrote: > This fixes several smaller C2 issues I've found when running testing with stress options like `StressReflectiveCode` and others enabled. > > Thanks, > Tobias This pull request has now been integrated. Changeset: 40e13c53 Author: Tobias Hartmann URL: https://git.openjdk.java.net/valhalla/commit/40e13c53 Stats: 38 lines in 9 files changed: 12 ins; 1 del; 25 mod 8259230: [lworld] Several crashes with C2 stress options ------------- PR: https://git.openjdk.java.net/valhalla/pull/305 From thartmann at openjdk.java.net Tue Jan 12 08:37:23 2021 From: thartmann at openjdk.java.net (Tobias Hartmann) Date: Tue, 12 Jan 2021 08:37:23 GMT Subject: [lworld] Integrated: 8259556: [lworld] Various C2 crashes with -XX:-ScalarizeInlineTypes Message-ID: <9mPu0Kf9XoWA63poNH2gfRzmpSoWZoW3XQPdur5-uK8=.d412482b-a10f-4f96-aac7-ec460ed30eeb@github.com> This fixes several issues in C2 with -XX:-ScalarizeInlineTypes and improves robustness of the tests to be able to run with more stress options. We still need a good heuristic to decide when **not** to scalarize inline types (for example, if there are too many (oop) fields), this will be addressed by [JDK-8215479](https://bugs.openjdk.java.net/browse/JDK-8215479). Best regards, Tobias ------------- Commit messages: - 8259556: [lworld] Various C2 crashes with -XX:-ScalarizeInlineTypes Changes: https://git.openjdk.java.net/valhalla/pull/306/files Webrev: https://webrevs.openjdk.java.net/?repo=valhalla&pr=306&range=00 Issue: https://bugs.openjdk.java.net/browse/JDK-8259556 Stats: 14 lines in 9 files changed: 3 ins; 1 del; 10 mod Patch: https://git.openjdk.java.net/valhalla/pull/306.diff Fetch: git fetch https://git.openjdk.java.net/valhalla pull/306/head:pull/306 PR: https://git.openjdk.java.net/valhalla/pull/306 From thartmann at openjdk.java.net Tue Jan 12 08:37:23 2021 From: thartmann at openjdk.java.net (Tobias Hartmann) Date: Tue, 12 Jan 2021 08:37:23 GMT Subject: [lworld] Integrated: 8259556: [lworld] Various C2 crashes with -XX:-ScalarizeInlineTypes In-Reply-To: <9mPu0Kf9XoWA63poNH2gfRzmpSoWZoW3XQPdur5-uK8=.d412482b-a10f-4f96-aac7-ec460ed30eeb@github.com> References: <9mPu0Kf9XoWA63poNH2gfRzmpSoWZoW3XQPdur5-uK8=.d412482b-a10f-4f96-aac7-ec460ed30eeb@github.com> Message-ID: On Tue, 12 Jan 2021 08:29:53 GMT, Tobias Hartmann wrote: > This fixes several issues in C2 with -XX:-ScalarizeInlineTypes and improves robustness of the tests to be able to run with more stress options. We still need a good heuristic to decide when **not** to scalarize inline types (for example, if there are too many (oop) fields), this will be addressed by [JDK-8215479](https://bugs.openjdk.java.net/browse/JDK-8215479). > > Best regards, > Tobias This pull request has now been integrated. Changeset: 6e3dc557 Author: Tobias Hartmann URL: https://git.openjdk.java.net/valhalla/commit/6e3dc557 Stats: 14 lines in 9 files changed: 3 ins; 1 del; 10 mod 8259556: [lworld] Various C2 crashes with -XX:-ScalarizeInlineTypes ------------- PR: https://git.openjdk.java.net/valhalla/pull/306 From sadayapalam at openjdk.java.net Tue Jan 12 15:55:16 2021 From: sadayapalam at openjdk.java.net (Srikanth Adayapalam) Date: Tue, 12 Jan 2021 15:55:16 GMT Subject: Withdrawn: 8255733: [type-restrictions] Enhance Javac to help with generation of test files for type restrictions experiments In-Reply-To: References: Message-ID: On Mon, 2 Nov 2020 09:53:12 GMT, Srikanth Adayapalam wrote: > Added option -XDflattenWithErasure to generate class files without the RestrictedField attribute This pull request has been closed without being integrated. ------------- PR: https://git.openjdk.java.net/valhalla/pull/251 From rriggs at openjdk.java.net Thu Jan 14 23:12:28 2021 From: rriggs at openjdk.java.net (Roger Riggs) Date: Thu, 14 Jan 2021 23:12:28 GMT Subject: [lworld] RFR: 8259804: Field.setAccessible should not allow changing fields of inline classes Message-ID: Update the javadoc for setAccessibleObject and Field.set to restrict setting of final fields. Correct the javadoc to match the implementation changes made in 8237444: Trust final fields in records ------------- Commit messages: - 8259804: Field.setAccessible should not allow changing fields of inline classes Changes: https://git.openjdk.java.net/valhalla/pull/307/files Webrev: https://webrevs.openjdk.java.net/?repo=valhalla&pr=307&range=00 Issue: https://bugs.openjdk.java.net/browse/JDK-8259804 Stats: 12 lines in 2 files changed: 2 ins; 6 del; 4 mod Patch: https://git.openjdk.java.net/valhalla/pull/307.diff Fetch: git fetch https://git.openjdk.java.net/valhalla pull/307/head:pull/307 PR: https://git.openjdk.java.net/valhalla/pull/307 From mchung at openjdk.java.net Fri Jan 15 03:03:13 2021 From: mchung at openjdk.java.net (Mandy Chung) Date: Fri, 15 Jan 2021 03:03:13 GMT Subject: [lworld] RFR: 8259804: Field.setAccessible should not allow changing fields of inline classes In-Reply-To: References: Message-ID: On Thu, 14 Jan 2021 23:07:36 GMT, Roger Riggs wrote: > Update the javadoc for setAccessibleObject and Field.set to restrict setting of final fields. > > Correct the javadoc to match the implementation changes made in 8237444: Trust final fields in records > > Also, the corresponding test is updated to match the restrictions. Thanks for updating the javadoc and test. The test can simply be reverted to the jdk/master version and no copyright header update needed. ------------- Marked as reviewed by mchung (Committer). PR: https://git.openjdk.java.net/valhalla/pull/307 From chegar at openjdk.java.net Fri Jan 15 09:52:13 2021 From: chegar at openjdk.java.net (Chris Hegarty) Date: Fri, 15 Jan 2021 09:52:13 GMT Subject: [lworld] RFR: 8259804: Field.setAccessible should not allow changing fields of inline classes In-Reply-To: References: Message-ID: On Thu, 14 Jan 2021 23:07:36 GMT, Roger Riggs wrote: > Update the javadoc for setAccessibleObject and Field.set to restrict setting of final fields. > > Correct the javadoc to match the implementation changes made in 8237444: Trust final fields in records > > Also, the corresponding test is updated to match the restrictions. Marked as reviewed by chegar (Committer). ------------- PR: https://git.openjdk.java.net/valhalla/pull/307 From rriggs at openjdk.java.net Fri Jan 15 14:46:36 2021 From: rriggs at openjdk.java.net (Roger Riggs) Date: Fri, 15 Jan 2021 14:46:36 GMT Subject: [lworld] RFR: 8259804: Field.setAccessible should not allow changing fields of inline classes [v2] In-Reply-To: References: Message-ID: > Update the javadoc for setAccessibleObject and Field.set to restrict setting of final fields. > > Correct the javadoc to match the implementation changes made in 8237444: Trust final fields in records > > Also, the corresponding test is updated to match the restrictions. Roger Riggs has updated the pull request incrementally with one additional commit since the last revision: Revert FieldSetAccessibleTest to the jdk master version; simplify merge later ------------- Changes: - all: https://git.openjdk.java.net/valhalla/pull/307/files - new: https://git.openjdk.java.net/valhalla/pull/307/files/25f16c62..cf92cf71 Webrevs: - full: https://webrevs.openjdk.java.net/?repo=valhalla&pr=307&range=01 - incr: https://webrevs.openjdk.java.net/?repo=valhalla&pr=307&range=00-01 Stats: 15 lines in 1 file changed: 3 ins; 0 del; 12 mod Patch: https://git.openjdk.java.net/valhalla/pull/307.diff Fetch: git fetch https://git.openjdk.java.net/valhalla pull/307/head:pull/307 PR: https://git.openjdk.java.net/valhalla/pull/307 From mchung at openjdk.java.net Fri Jan 15 16:46:17 2021 From: mchung at openjdk.java.net (Mandy Chung) Date: Fri, 15 Jan 2021 16:46:17 GMT Subject: [lworld] RFR: 8259804: Field.setAccessible should not allow changing fields of inline classes [v2] In-Reply-To: References: Message-ID: On Fri, 15 Jan 2021 14:46:36 GMT, Roger Riggs wrote: >> Update the javadoc for setAccessibleObject and Field.set to restrict setting of final fields. >> >> Correct the javadoc to match the implementation changes made in 8237444: Trust final fields in records >> >> Also, the corresponding test is updated to match the restrictions. > > Roger Riggs has updated the pull request incrementally with one additional commit since the last revision: > > Revert FieldSetAccessibleTest to the jdk master version; simplify merge later Marked as reviewed by mchung (Committer). ------------- PR: https://git.openjdk.java.net/valhalla/pull/307 From rriggs at openjdk.java.net Fri Jan 15 16:59:17 2021 From: rriggs at openjdk.java.net (Roger Riggs) Date: Fri, 15 Jan 2021 16:59:17 GMT Subject: [lworld] Integrated: 8259804: Field.setAccessible should not allow changing fields of inline classes In-Reply-To: References: Message-ID: <59MrocLWx21UsDYsRjs3sLKaMrASExfdxTZAt7rEUDg=.bdb803d8-9bd2-415d-adec-a315fd13f9d0@github.com> On Thu, 14 Jan 2021 23:07:36 GMT, Roger Riggs wrote: > Update the javadoc for setAccessibleObject and Field.set to restrict setting of final fields. > > Correct the javadoc to match the implementation changes made in 8237444: Trust final fields in records > > Also, the corresponding test is updated to match the restrictions. This pull request has now been integrated. Changeset: f5fb93c4 Author: Roger Riggs URL: https://git.openjdk.java.net/valhalla/commit/f5fb93c4 Stats: 18 lines in 2 files changed: 2 ins; 3 del; 13 mod 8259804: Field.setAccessible should not allow changing fields of inline classes Reviewed-by: mchung, chegar ------------- PR: https://git.openjdk.java.net/valhalla/pull/307 From sadayapalam at openjdk.java.net Mon Jan 18 09:31:23 2021 From: sadayapalam at openjdk.java.net (Srikanth Adayapalam) Date: Mon, 18 Jan 2021 09:31:23 GMT Subject: [lworld] Integrated: 8257846: [lworld] Separate compilation failure of generic inline class Message-ID: Ensure inline constructors appears as constructors rather than as static factory methods to top layers of javac after Signature attribute processing. ------------- Commit messages: - Fix whitespace issues - 8257846: [lworld] Separate compilation failure of generic inline class Changes: https://git.openjdk.java.net/valhalla/pull/308/files Webrev: https://webrevs.openjdk.java.net/?repo=valhalla&pr=308&range=00 Issue: https://bugs.openjdk.java.net/browse/JDK-8257846 Stats: 82 lines in 3 files changed: 82 ins; 0 del; 0 mod Patch: https://git.openjdk.java.net/valhalla/pull/308.diff Fetch: git fetch https://git.openjdk.java.net/valhalla pull/308/head:pull/308 PR: https://git.openjdk.java.net/valhalla/pull/308 From sadayapalam at openjdk.java.net Mon Jan 18 09:31:25 2021 From: sadayapalam at openjdk.java.net (Srikanth Adayapalam) Date: Mon, 18 Jan 2021 09:31:25 GMT Subject: [lworld] Integrated: 8257846: [lworld] Separate compilation failure of generic inline class In-Reply-To: References: Message-ID: On Mon, 18 Jan 2021 09:22:08 GMT, Srikanth Adayapalam wrote: > Ensure inline constructors appears as constructors rather than as static factory methods to top layers of javac after Signature attribute processing. This pull request has now been integrated. Changeset: bc6af253 Author: Srikanth Adayapalam URL: https://git.openjdk.java.net/valhalla/commit/bc6af253 Stats: 82 lines in 3 files changed: 82 ins; 0 del; 0 mod 8257846: [lworld] Separate compilation failure of generic inline class ------------- PR: https://git.openjdk.java.net/valhalla/pull/308 From thartmann at openjdk.java.net Thu Jan 21 11:36:26 2021 From: thartmann at openjdk.java.net (Tobias Hartmann) Date: Thu, 21 Jan 2021 11:36:26 GMT Subject: [lworld] RFR: 8260034: [lworld] C1 compilation fails with assert "should not be optimized out" Message-ID: <2CIAX6SkzjaXkSPjI547nmQxiw3-I12_q_nVD9z_-KQ=.973bf4fb-7e5a-4e6b-9a5e-f3b520fc1774@github.com> We hit an assert during C1 compilation because an array load is optimized out. The assert is too strong. While looking at the code, I've noticed that we are always profiling array stores, even if the array is known to be a loaded, flattened array. I don't think that's needed. Thanks, Tobias ------------- Commit messages: - Removed trailing whitespace - 8260034: [lworld] C1 compilation fails with assert "should not be optimized out" Changes: https://git.openjdk.java.net/valhalla/pull/309/files Webrev: https://webrevs.openjdk.java.net/?repo=valhalla&pr=309&range=00 Issue: https://bugs.openjdk.java.net/browse/JDK-8260034 Stats: 120 lines in 3 files changed: 92 ins; 10 del; 18 mod Patch: https://git.openjdk.java.net/valhalla/pull/309.diff Fetch: git fetch https://git.openjdk.java.net/valhalla pull/309/head:pull/309 PR: https://git.openjdk.java.net/valhalla/pull/309 From thartmann at openjdk.java.net Thu Jan 21 12:57:01 2021 From: thartmann at openjdk.java.net (Tobias Hartmann) Date: Thu, 21 Jan 2021 12:57:01 GMT Subject: [lworld] Integrated: 8260034: [lworld] C1 compilation fails with assert "should not be optimized out" In-Reply-To: <2CIAX6SkzjaXkSPjI547nmQxiw3-I12_q_nVD9z_-KQ=.973bf4fb-7e5a-4e6b-9a5e-f3b520fc1774@github.com> References: <2CIAX6SkzjaXkSPjI547nmQxiw3-I12_q_nVD9z_-KQ=.973bf4fb-7e5a-4e6b-9a5e-f3b520fc1774@github.com> Message-ID: On Thu, 21 Jan 2021 11:22:29 GMT, Tobias Hartmann wrote: > We hit an assert during C1 compilation because an array load is optimized out. The assert is too strong. While looking at the code, I've noticed that we are always profiling array stores, even if the array is known to be a loaded, flattened array. I don't think that's needed. > > Thanks, > Tobias This pull request has now been integrated. Changeset: 607c71f6 Author: Tobias Hartmann URL: https://git.openjdk.java.net/valhalla/commit/607c71f6 Stats: 120 lines in 3 files changed: 92 ins; 10 del; 18 mod 8260034: [lworld] C1 compilation fails with assert "should not be optimized out" ------------- PR: https://git.openjdk.java.net/valhalla/pull/309 From thartmann at openjdk.java.net Thu Jan 21 13:03:20 2021 From: thartmann at openjdk.java.net (Tobias Hartmann) Date: Thu, 21 Jan 2021 13:03:20 GMT Subject: [lworld] RFR: 8260225: [lworld] C1's delayed load indexed optimization sets incorrect type Message-ID: `LoadIndexed::exact_type()` and `declared_type` return and incorrect type if the load is delayed. See bug report for a detailed description. Thanks, Tobias ------------- Commit messages: - 8260225: [lworld] C1's delayed load indexed optimization sets incorrect type Changes: https://git.openjdk.java.net/valhalla/pull/310/files Webrev: https://webrevs.openjdk.java.net/?repo=valhalla&pr=310&range=00 Issue: https://bugs.openjdk.java.net/browse/JDK-8260225 Stats: 19 lines in 3 files changed: 15 ins; 1 del; 3 mod Patch: https://git.openjdk.java.net/valhalla/pull/310.diff Fetch: git fetch https://git.openjdk.java.net/valhalla pull/310/head:pull/310 PR: https://git.openjdk.java.net/valhalla/pull/310 From fparain at openjdk.java.net Thu Jan 21 17:52:19 2021 From: fparain at openjdk.java.net (Frederic Parain) Date: Thu, 21 Jan 2021 17:52:19 GMT Subject: [lworld] RFR: 8260225: [lworld] C1's delayed load indexed optimization sets incorrect type In-Reply-To: References: Message-ID: On Thu, 21 Jan 2021 12:58:49 GMT, Tobias Hartmann wrote: > `LoadIndexed::exact_type()` and `declared_type` return and incorrect type if the load is delayed. See bug report for a detailed description. > > Thanks, > Tobias Looks good to me. Fred ------------- Marked as reviewed by fparain (Committer). PR: https://git.openjdk.java.net/valhalla/pull/310 From thartmann at openjdk.java.net Fri Jan 22 07:00:06 2021 From: thartmann at openjdk.java.net (Tobias Hartmann) Date: Fri, 22 Jan 2021 07:00:06 GMT Subject: [lworld] RFR: 8260225: [lworld] C1's delayed load indexed optimization sets incorrect type In-Reply-To: References: Message-ID: On Thu, 21 Jan 2021 17:50:06 GMT, Frederic Parain wrote: >> `LoadIndexed::exact_type()` and `declared_type` return and incorrect type if the load is delayed. See bug report for a detailed description. >> >> Thanks, >> Tobias > > Looks good to me. > > Fred Thanks Fred! ------------- PR: https://git.openjdk.java.net/valhalla/pull/310 From thartmann at openjdk.java.net Fri Jan 22 07:17:01 2021 From: thartmann at openjdk.java.net (Tobias Hartmann) Date: Fri, 22 Jan 2021 07:17:01 GMT Subject: [lworld] Integrated: 8260225: [lworld] C1's delayed load indexed optimization sets incorrect type In-Reply-To: References: Message-ID: <9vN8t8tDCbD0_uIlCIn9qgtv_ymolb0-JIaWygOEbUA=.18a8813c-6df3-454d-b201-26412baa7901@github.com> On Thu, 21 Jan 2021 12:58:49 GMT, Tobias Hartmann wrote: > `LoadIndexed::exact_type()` and `declared_type` return and incorrect type if the load is delayed. See bug report for a detailed description. > > Thanks, > Tobias This pull request has now been integrated. Changeset: 61bdc451 Author: Tobias Hartmann URL: https://git.openjdk.java.net/valhalla/commit/61bdc451 Stats: 19 lines in 3 files changed: 15 ins; 1 del; 3 mod 8260225: [lworld] C1's delayed load indexed optimization sets incorrect type Reviewed-by: fparain ------------- PR: https://git.openjdk.java.net/valhalla/pull/310 From thartmann at openjdk.java.net Fri Jan 22 12:00:22 2021 From: thartmann at openjdk.java.net (Tobias Hartmann) Date: Fri, 22 Jan 2021 12:00:22 GMT Subject: [lworld] RFR: 8260283: [lworld] C1's EliminateFieldAccess optimization fails with "wrong types" Message-ID: C1's delayed field access optimization ([JDK-8229897](https://bugs.openjdk.java.net/browse/JDK-8229897)) does not update the field when updating a `LoadField`. The `EliminateFieldAccess` optimization then uses the wrong field (offset) to look up the loaded value in the `MemoryBuffer`. We hit an assert because the field types do not match. Thanks, Tobias ------------- Commit messages: - 8260283: [lworld] C1's EliminateFieldAccess optimization fails with "wrong types" Changes: https://git.openjdk.java.net/valhalla/pull/311/files Webrev: https://webrevs.openjdk.java.net/?repo=valhalla&pr=311&range=00 Issue: https://bugs.openjdk.java.net/browse/JDK-8260283 Stats: 21 lines in 2 files changed: 13 ins; 3 del; 5 mod Patch: https://git.openjdk.java.net/valhalla/pull/311.diff Fetch: git fetch https://git.openjdk.java.net/valhalla pull/311/head:pull/311 PR: https://git.openjdk.java.net/valhalla/pull/311 From thartmann at openjdk.java.net Fri Jan 22 13:04:27 2021 From: thartmann at openjdk.java.net (Tobias Hartmann) Date: Fri, 22 Jan 2021 13:04:27 GMT Subject: [lworld] RFR: 8260283: [lworld] C1's EliminateFieldAccess optimization fails with "wrong types" [v2] In-Reply-To: References: Message-ID: > C1's delayed field access optimization ([JDK-8229897](https://bugs.openjdk.java.net/browse/JDK-8229897)) does not update the field when updating a `LoadField`. The `EliminateFieldAccess` optimization then uses the wrong field (offset) to look up the loaded value in the `MemoryBuffer`. We hit an assert because the field types do not match. > > Thanks, > Tobias Tobias Hartmann has updated the pull request incrementally with one additional commit since the last revision: Field should not be updated ------------- Changes: - all: https://git.openjdk.java.net/valhalla/pull/311/files - new: https://git.openjdk.java.net/valhalla/pull/311/files/122ccf46..ee55b86b Webrevs: - full: https://webrevs.openjdk.java.net/?repo=valhalla&pr=311&range=01 - incr: https://webrevs.openjdk.java.net/?repo=valhalla&pr=311&range=00-01 Stats: 14 lines in 2 files changed: 1 ins; 5 del; 8 mod Patch: https://git.openjdk.java.net/valhalla/pull/311.diff Fetch: git fetch https://git.openjdk.java.net/valhalla pull/311/head:pull/311 PR: https://git.openjdk.java.net/valhalla/pull/311 From thartmann at openjdk.java.net Fri Jan 22 13:14:25 2021 From: thartmann at openjdk.java.net (Tobias Hartmann) Date: Fri, 22 Jan 2021 13:14:25 GMT Subject: [lworld] RFR: 8260283: [lworld] C1's EliminateFieldAccess optimization fails with "wrong types" [v3] In-Reply-To: References: Message-ID: <9zPxvwtswm8S7Z9clVUVr9UykFDDWvwtPH40_0yOStM=.c8c0cd50-f5ef-4242-821e-e8b478277559@github.com> > C1's delayed field access optimization ([JDK-8229897](https://bugs.openjdk.java.net/browse/JDK-8229897)) does not update the field when updating a `LoadField`. The `EliminateFieldAccess` optimization then uses the wrong field (offset) to look up the loaded value in the `MemoryBuffer`. We hit an assert because the field types do not match. > > Thanks, > Tobias Tobias Hartmann has updated the pull request incrementally with one additional commit since the last revision: We don't even need to keep track of the field, holder is sufficient ------------- Changes: - all: https://git.openjdk.java.net/valhalla/pull/311/files - new: https://git.openjdk.java.net/valhalla/pull/311/files/ee55b86b..e366b6cc Webrevs: - full: https://webrevs.openjdk.java.net/?repo=valhalla&pr=311&range=02 - incr: https://webrevs.openjdk.java.net/?repo=valhalla&pr=311&range=01-02 Stats: 11 lines in 2 files changed: 0 ins; 0 del; 11 mod Patch: https://git.openjdk.java.net/valhalla/pull/311.diff Fetch: git fetch https://git.openjdk.java.net/valhalla pull/311/head:pull/311 PR: https://git.openjdk.java.net/valhalla/pull/311 From fparain at openjdk.java.net Fri Jan 22 17:56:54 2021 From: fparain at openjdk.java.net (Frederic Parain) Date: Fri, 22 Jan 2021 17:56:54 GMT Subject: [lworld] RFR: 8260283: [lworld] C1's EliminateFieldAccess optimization fails with "wrong types" [v3] In-Reply-To: <9zPxvwtswm8S7Z9clVUVr9UykFDDWvwtPH40_0yOStM=.c8c0cd50-f5ef-4242-821e-e8b478277559@github.com> References: <9zPxvwtswm8S7Z9clVUVr9UykFDDWvwtPH40_0yOStM=.c8c0cd50-f5ef-4242-821e-e8b478277559@github.com> Message-ID: On Fri, 22 Jan 2021 13:14:25 GMT, Tobias Hartmann wrote: >> C1's delayed field access optimization ([JDK-8229897](https://bugs.openjdk.java.net/browse/JDK-8229897)) does not update the field when updating a `LoadField`. The `EliminateFieldAccess` optimization then uses the wrong field (offset) to look up the loaded value in the `MemoryBuffer`. We hit an assert because the field types do not match. >> >> Thanks, >> Tobias > > Tobias Hartmann has updated the pull request incrementally with one additional commit since the last revision: > > We don't even need to keep track of the field, holder is sufficient Looks good to me. Fred ------------- Marked as reviewed by fparain (Committer). PR: https://git.openjdk.java.net/valhalla/pull/311 From thartmann at openjdk.java.net Mon Jan 25 07:35:04 2021 From: thartmann at openjdk.java.net (Tobias Hartmann) Date: Mon, 25 Jan 2021 07:35:04 GMT Subject: [lworld] RFR: 8260283: [lworld] C1's EliminateFieldAccess optimization fails with "wrong types" [v3] In-Reply-To: References: <9zPxvwtswm8S7Z9clVUVr9UykFDDWvwtPH40_0yOStM=.c8c0cd50-f5ef-4242-821e-e8b478277559@github.com> Message-ID: On Fri, 22 Jan 2021 17:54:24 GMT, Frederic Parain wrote: >> Tobias Hartmann has updated the pull request incrementally with one additional commit since the last revision: >> >> We don't even need to keep track of the field, holder is sufficient > > Looks good to me. > > Fred Thanks Fred! ------------- PR: https://git.openjdk.java.net/valhalla/pull/311 From thartmann at openjdk.java.net Mon Jan 25 07:35:05 2021 From: thartmann at openjdk.java.net (Tobias Hartmann) Date: Mon, 25 Jan 2021 07:35:05 GMT Subject: [lworld] Integrated: 8260283: [lworld] C1's EliminateFieldAccess optimization fails with "wrong types" In-Reply-To: References: Message-ID: On Fri, 22 Jan 2021 11:55:46 GMT, Tobias Hartmann wrote: > C1's delayed field access optimization ([JDK-8229897](https://bugs.openjdk.java.net/browse/JDK-8229897)) does not update the field when updating a `LoadField`. The `EliminateFieldAccess` optimization then uses the wrong field (offset) to look up the loaded value in the `MemoryBuffer`. We hit an assert because the field types do not match. > > Thanks, > Tobias This pull request has now been integrated. Changeset: 6d8a8cc4 Author: Tobias Hartmann URL: https://git.openjdk.java.net/valhalla/commit/6d8a8cc4 Stats: 38 lines in 3 files changed: 14 ins; 8 del; 16 mod 8260283: [lworld] C1's EliminateFieldAccess optimization fails with "wrong types" Reviewed-by: fparain ------------- PR: https://git.openjdk.java.net/valhalla/pull/311 From fparain at openjdk.java.net Mon Jan 25 21:52:14 2021 From: fparain at openjdk.java.net (Frederic Parain) Date: Mon, 25 Jan 2021 21:52:14 GMT Subject: [lworld] RFR: Remove unused field from Method Message-ID: Remove an unused field from the Method class, leftover of the value types thread local buffer. ------------- Commit messages: - Remove unused field from Method Changes: https://git.openjdk.java.net/valhalla/pull/312/files Webrev: https://webrevs.openjdk.java.net/?repo=valhalla&pr=312&range=00 Stats: 3 lines in 1 file changed: 0 ins; 3 del; 0 mod Patch: https://git.openjdk.java.net/valhalla/pull/312.diff Fetch: git fetch https://git.openjdk.java.net/valhalla pull/312/head:pull/312 PR: https://git.openjdk.java.net/valhalla/pull/312 From hseigel at openjdk.java.net Mon Jan 25 21:59:05 2021 From: hseigel at openjdk.java.net (Harold Seigel) Date: Mon, 25 Jan 2021 21:59:05 GMT Subject: [lworld] RFR: Remove unused field from Method In-Reply-To: References: Message-ID: On Mon, 25 Jan 2021 21:42:15 GMT, Frederic Parain wrote: > Remove an unused field from the Method class, leftover of the value types thread local buffer. Hi Fred, Changes look good and trivial. Thanks, Harold ------------- Marked as reviewed by hseigel (Committer). PR: https://git.openjdk.java.net/valhalla/pull/312 From lfoltan at openjdk.java.net Mon Jan 25 22:05:02 2021 From: lfoltan at openjdk.java.net (Lois Foltan) Date: Mon, 25 Jan 2021 22:05:02 GMT Subject: [lworld] RFR: Remove unused field from Method In-Reply-To: References: Message-ID: On Mon, 25 Jan 2021 21:42:15 GMT, Frederic Parain wrote: > Remove an unused field from the Method class, leftover of the value types thread local buffer. Looks good. Lois ------------- Marked as reviewed by lfoltan (Committer). PR: https://git.openjdk.java.net/valhalla/pull/312 From fparain at openjdk.java.net Tue Jan 26 12:53:53 2021 From: fparain at openjdk.java.net (Frederic Parain) Date: Tue, 26 Jan 2021 12:53:53 GMT Subject: [lworld] RFR: Remove unused field from Method In-Reply-To: References: Message-ID: On Mon, 25 Jan 2021 22:02:35 GMT, Lois Foltan wrote: >> Remove an unused field from the Method class, leftover of the value types thread local buffer. > > Looks good. > Lois Lois, Harold, Thank you for the reviews. Fred ------------- PR: https://git.openjdk.java.net/valhalla/pull/312 From fparain at openjdk.java.net Tue Jan 26 12:53:54 2021 From: fparain at openjdk.java.net (Frederic Parain) Date: Tue, 26 Jan 2021 12:53:54 GMT Subject: [lworld] Integrated: Remove unused field from Method In-Reply-To: References: Message-ID: <1JzLJp3dcSzwbNxTuWk9mVSlbh6ZuKK7a-zlZgKM7l0=.a16eb62d-c9bb-4d4b-a6cc-0e0532fee91f@github.com> On Mon, 25 Jan 2021 21:42:15 GMT, Frederic Parain wrote: > Remove an unused field from the Method class, leftover of the value types thread local buffer. This pull request has now been integrated. Changeset: 2f35fb72 Author: Frederic Parain URL: https://git.openjdk.java.net/valhalla/commit/2f35fb72 Stats: 3 lines in 1 file changed: 0 ins; 3 del; 0 mod Remove unused field from Method Reviewed-by: hseigel, lfoltan ------------- PR: https://git.openjdk.java.net/valhalla/pull/312 From fparain at openjdk.java.net Tue Jan 26 15:17:59 2021 From: fparain at openjdk.java.net (Frederic Parain) Date: Tue, 26 Jan 2021 15:17:59 GMT Subject: [lworld] RFR: 8260375: [lworld] ValueTearing fails with -XX:FlatArrayElementMaxSize=0 -XX:InlineFieldMaxFlatSize=0 Message-ID: Please review this fix forcing field and array flattening for tests relying on flattening. Thank you, Fred ------------- Commit messages: - Force flattening for tests requiring it Changes: https://git.openjdk.java.net/valhalla/pull/313/files Webrev: https://webrevs.openjdk.java.net/?repo=valhalla&pr=313&range=00 Issue: https://bugs.openjdk.java.net/browse/JDK-8260375 Stats: 22 lines in 7 files changed: 2 ins; 0 del; 20 mod Patch: https://git.openjdk.java.net/valhalla/pull/313.diff Fetch: git fetch https://git.openjdk.java.net/valhalla pull/313/head:pull/313 PR: https://git.openjdk.java.net/valhalla/pull/313 From thartmann at openjdk.java.net Tue Jan 26 15:25:59 2021 From: thartmann at openjdk.java.net (Tobias Hartmann) Date: Tue, 26 Jan 2021 15:25:59 GMT Subject: [lworld] RFR: 8260375: [lworld] ValueTearing fails with -XX:FlatArrayElementMaxSize=0 -XX:InlineFieldMaxFlatSize=0 In-Reply-To: References: Message-ID: On Tue, 26 Jan 2021 15:12:58 GMT, Frederic Parain wrote: > Please review this fix forcing field and array flattening for tests relying on flattening. > > Thank you, > > Fred Looks good to me. ------------- Marked as reviewed by thartmann (Committer). PR: https://git.openjdk.java.net/valhalla/pull/313 From fparain at openjdk.java.net Tue Jan 26 17:59:49 2021 From: fparain at openjdk.java.net (Frederic Parain) Date: Tue, 26 Jan 2021 17:59:49 GMT Subject: [lworld] Integrated: 8260375: [lworld] ValueTearing fails with -XX:FlatArrayElementMaxSize=0 -XX:InlineFieldMaxFlatSize=0 In-Reply-To: References: Message-ID: <79z7YuFOw6uoyvhgVMlrpPj1bsgEpiCwZ3MvDBtHvyE=.4a238e6d-7886-4753-a3f1-c5fca1fa2223@github.com> On Tue, 26 Jan 2021 15:12:58 GMT, Frederic Parain wrote: > Please review this fix forcing field and array flattening for tests relying on flattening. > > Thank you, > > Fred This pull request has now been integrated. Changeset: a5d6ed3f Author: Frederic Parain URL: https://git.openjdk.java.net/valhalla/commit/a5d6ed3f Stats: 22 lines in 7 files changed: 2 ins; 0 del; 20 mod 8260375: [lworld] ValueTearing fails with -XX:FlatArrayElementMaxSize=0 -XX:InlineFieldMaxFlatSize=0 Reviewed-by: thartmann ------------- PR: https://git.openjdk.java.net/valhalla/pull/313 From mchung at openjdk.java.net Tue Jan 26 21:29:19 2021 From: mchung at openjdk.java.net (Mandy Chung) Date: Tue, 26 Jan 2021 21:29:19 GMT Subject: [lworld] RFR: [lworld] Field::get should return default value instead of null on non-flattened inline field Message-ID: A field could be of a non-flattened inline type. `Unsafe::getReference(Object o, long offset, Class valueType)` should be used instead. The value type parameter is used to differentiate if the field is an inline type or not; if so, it will return an uninitialized value of the inline type. ------------- Commit messages: - test fix - clean up - add new regression test - JDK-8260371: [lworld] Field::get should return default value instead of null on non-flattened inline field Changes: https://git.openjdk.java.net/valhalla/pull/314/files Webrev: https://webrevs.openjdk.java.net/?repo=valhalla&pr=314&range=00 Stats: 166 lines in 5 files changed: 159 ins; 0 del; 7 mod Patch: https://git.openjdk.java.net/valhalla/pull/314.diff Fetch: git fetch https://git.openjdk.java.net/valhalla pull/314/head:pull/314 PR: https://git.openjdk.java.net/valhalla/pull/314 From rriggs at openjdk.java.net Tue Jan 26 21:50:49 2021 From: rriggs at openjdk.java.net (Roger Riggs) Date: Tue, 26 Jan 2021 21:50:49 GMT Subject: [lworld] RFR: [lworld] Field::get should return default value instead of null on non-flattened inline field In-Reply-To: References: Message-ID: On Tue, 26 Jan 2021 21:24:30 GMT, Mandy Chung wrote: > A field could be of a non-flattened inline type. `Unsafe::getReference(Object o, long offset, Class valueType)` should be used instead. The value type parameter is used to differentiate if the field is an inline type or not; if so, it will return an uninitialized value of the inline type. Marked as reviewed by rriggs (Committer). ------------- PR: https://git.openjdk.java.net/valhalla/pull/314 From mchung at openjdk.java.net Tue Jan 26 22:15:00 2021 From: mchung at openjdk.java.net (Mandy Chung) Date: Tue, 26 Jan 2021 22:15:00 GMT Subject: [lworld] Integrated: [lworld] Field::get should return default value instead of null on non-flattened inline field In-Reply-To: References: Message-ID: On Tue, 26 Jan 2021 21:24:30 GMT, Mandy Chung wrote: > A field could be of a non-flattened inline type. `Unsafe::getReference(Object o, long offset, Class valueType)` should be used instead. The value type parameter is used to differentiate if the field is an inline type or not; if so, it will return an uninitialized value of the inline type. This pull request has now been integrated. Changeset: a2e8c6b2 Author: Mandy Chung URL: https://git.openjdk.java.net/valhalla/commit/a2e8c6b2 Stats: 166 lines in 5 files changed: 159 ins; 0 del; 7 mod [lworld] Field::get should return default value instead of null on non-flattened inline field Reviewed-by: rriggs ------------- PR: https://git.openjdk.java.net/valhalla/pull/314 From mchung at openjdk.java.net Tue Jan 26 22:47:06 2021 From: mchung at openjdk.java.net (Mandy Chung) Date: Tue, 26 Jan 2021 22:47:06 GMT Subject: [lworld] RFR: [lworld] code cleanup reverting some old leftover change Message-ID: This patch reverts some leftover change from previous milestones which is unnecessary now. ------------- Commit messages: - Merge branch 'lworld' of https://github.com/openjdk/valhalla into inline-field - Revert unnecessary changes leftover in LW3 - test fix - clean up - add new regression test - JDK-8260371: [lworld] Field::get should return default value instead of null on non-flattened inline field Changes: https://git.openjdk.java.net/valhalla/pull/315/files Webrev: https://webrevs.openjdk.java.net/?repo=valhalla&pr=315&range=00 Stats: 24 lines in 6 files changed: 9 ins; 14 del; 1 mod Patch: https://git.openjdk.java.net/valhalla/pull/315.diff Fetch: git fetch https://git.openjdk.java.net/valhalla pull/315/head:pull/315 PR: https://git.openjdk.java.net/valhalla/pull/315 From mchung at openjdk.java.net Tue Jan 26 23:38:47 2021 From: mchung at openjdk.java.net (Mandy Chung) Date: Tue, 26 Jan 2021 23:38:47 GMT Subject: [lworld] Integrated: [lworld] code cleanup reverting some old leftover change In-Reply-To: References: Message-ID: On Tue, 26 Jan 2021 22:42:32 GMT, Mandy Chung wrote: > This patch reverts some leftover change from previous milestones which is unnecessary now. This pull request has now been integrated. Changeset: 81e6a5af Author: Mandy Chung URL: https://git.openjdk.java.net/valhalla/commit/81e6a5af Stats: 24 lines in 6 files changed: 9 ins; 14 del; 1 mod [lworld] code cleanup reverting some old leftover change ------------- PR: https://git.openjdk.java.net/valhalla/pull/315 From roland at openjdk.java.net Thu Jan 28 12:31:21 2021 From: roland at openjdk.java.net (Roland Westrelin) Date: Thu, 28 Jan 2021 12:31:21 GMT Subject: [lworld] RFR: 8260363: [lworld] C2 compilation fails with assert(n->Opcode() != Op_Phi) failed: cannot match Message-ID: This is caused by a StoreCM whose OopStore doesn't point to a Store node because it was optimized out but to a memory Phi. The Phi is for slice TypeAryPtr::INLINES. When Compile::adjust_flattened_array_access_aliases() runs, the TypeAryPtr::INLINES slice becomes dead and is replaced by independent slices for each field of flat array elements. Because the StoreCM doesn't point to a Store, it's impossible to tell what slice it's for so its input still points to the TypeAryPtr::INLINES Phi once Compile::adjust_flattened_array_access_aliases() is over. Given the TypeAryPtr::INLINES slice is dead that's a problem: assuming we can end up with a StoreCM that points to a Phi for a non eliminated Store (the Store would be behind the Phi I suppose in that case), then after Compile::adjust_flattened_array_access_aliases() runs, the Store would have moved to a new Phi but the StoreCM wouldn't have been updated. But that's not what causes the crash. The crash occurs because the TypeAryPtr::INLINES memory subgraph is partially killed by Compile::adjust_flattened_array_access_aliases() so when matching occurs the Phi is only reachable through a precedence edge from the StoreCM (final graph reshaping moves the OopStore input to precedence edges). It's unreachable from root at matching time (because that code doesn't follow precendence edge) and is not marked as shared by Matcher::find_shared(). When Compile::adjust_flattened_array_access_aliases() runs, the StoreCM OopStore is actually first set to a MergeMem node that captures slices created for flat array fields but when StoreCMNode::Ideal() executes it sets the input to the TypeAryPtr::INLINES input of the MergeMem. I think that last steps is what's incorrect after Compile::adjust_flattened_array_access_aliases(). So I changed that logic so it keeps the MergeMem input and also changed final graph reshape so it adds as many precedence edges as there are flat field inputs to the MergeMem. These changes are required to preserve correctness, I believe. With that, i still hit the assert because the bottom memory input to the MergeMem can end up as a precedence edge to the StoreCM (if that entry to the MergeMem is top). That bottom memory in the case of the regression test is a Phi that was created by Compile::adjust_flattened_array_access_aliases() and is usually optimized out. It's only reachable from the StoreCM precedence edge. I don't think there's a fundamental problem here so I change matching so it looks at precedence edges when looking for shared node. I also had to change node scheduling in a similar way. ------------- Commit messages: - adjust_flattened_array_access_aliases() fix Changes: https://git.openjdk.java.net/valhalla/pull/317/files Webrev: https://webrevs.openjdk.java.net/?repo=valhalla&pr=317&range=00 Issue: https://bugs.openjdk.java.net/browse/JDK-8260363 Stats: 111 lines in 5 files changed: 98 ins; 0 del; 13 mod Patch: https://git.openjdk.java.net/valhalla/pull/317.diff Fetch: git fetch https://git.openjdk.java.net/valhalla pull/317/head:pull/317 PR: https://git.openjdk.java.net/valhalla/pull/317