Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v20]

2023-11-09 Thread Matthias Baesken
On Fri, 3 Nov 2023 14:46:39 GMT, Andrew Haley wrote: >> A bug in GCC causes shared libraries linked with -ffast-math to disable >> denormal arithmetic. This breaks Java's floating-point semantics. >> >> The bug is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522 >> >> One solution is to save

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v20]

2023-11-03 Thread Andrew Haley
> A bug in GCC causes shared libraries linked with -ffast-math to disable > denormal arithmetic. This breaks Java's floating-point semantics. > > The bug is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522 > > One solution is to save and restore the floating-point control word around > System

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v19]

2023-11-03 Thread Andrew Haley
> A bug in GCC causes shared libraries linked with -ffast-math to disable > denormal arithmetic. This breaks Java's floating-point semantics. > > The bug is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522 > > One solution is to save and restore the floating-point control word around > System

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v18]

2023-11-02 Thread Thomas Stuefe
On Fri, 27 Oct 2023 11:59:59 GMT, Andrew Haley wrote: >> A bug in GCC causes shared libraries linked with -ffast-math to disable >> denormal arithmetic. This breaks Java's floating-point semantics. >> >> The bug is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522 >> >> One solution is to sav

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v18]

2023-11-01 Thread David Holmes
On Fri, 27 Oct 2023 11:59:59 GMT, Andrew Haley wrote: >> A bug in GCC causes shared libraries linked with -ffast-math to disable >> denormal arithmetic. This breaks Java's floating-point semantics. >> >> The bug is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522 >> >> One solution is to sav

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v18]

2023-11-01 Thread Andrew Haley
On Fri, 27 Oct 2023 11:59:59 GMT, Andrew Haley wrote: >> A bug in GCC causes shared libraries linked with -ffast-math to disable >> denormal arithmetic. This breaks Java's floating-point semantics. >> >> The bug is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522 >> >> One solution is to sav

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v15]

2023-10-27 Thread Andrew Haley
On Thu, 26 Oct 2023 15:41:35 GMT, Thomas Stuefe wrote: > This looks good to me. > > One suggestion: to reduce code duplication and to make the code a bit safer > against accidental returns prior to fesetenv, I would have used a mark object > like this: Thanks. I take your point, but I think t

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v15]

2023-10-27 Thread Thomas Stuefe
On Fri, 27 Oct 2023 11:49:16 GMT, Andrew Haley wrote: > > One more thought, it would be good to add the FTZ_mode_enabled check to > > `os::run_periodic_checks()`. > > We already do signal handler checks there, and it is the right place to > > check for "global things third party native code may

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v18]

2023-10-27 Thread Andrew Haley
> A bug in GCC causes shared libraries linked with -ffast-math to disable > denormal arithmetic. This breaks Java's floating-point semantics. > > The bug is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522 > > One solution is to save and restore the floating-point control word around > System

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v16]

2023-10-27 Thread Andrew Haley
On Thu, 26 Oct 2023 17:42:39 GMT, Vladimir Ivanov wrote: >> Andrew Haley has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Remove accidental include > > make/test/JtregNativeHotspot.gmk line 854: > >> 852: BUILD_HOTSPOT_JTREG_EXECUTABLE

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v15]

2023-10-27 Thread Andrew Haley
On Thu, 26 Oct 2023 15:59:08 GMT, Thomas Stuefe wrote: > One more thought, it would be good to add the FTZ_mode_enabled check to > `os::run_periodic_checks()`. > > We already do signal handler checks there, and it is the right place to check > for "global things third party native code may mes

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v17]

2023-10-27 Thread Andrew Haley
> A bug in GCC causes shared libraries linked with -ffast-math to disable > denormal arithmetic. This breaks Java's floating-point semantics. > > The bug is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522 > > One solution is to save and restore the floating-point control word around > System

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v11]

2023-10-26 Thread David Holmes
On Thu, 26 Oct 2023 17:41:52 GMT, Vladimir Ivanov wrote: > > do you have any suggestion about where to move the remaining code that's in > > stubRoutines.cpp? > > As it is now, `globalDefinitions.hpp/cpp` looks the most appropriate one to > me. That seems okay to me too and much better than `

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v16]

2023-10-26 Thread Vladimir Ivanov
On Thu, 26 Oct 2023 16:46:04 GMT, Andrew Haley wrote: >> A bug in GCC causes shared libraries linked with -ffast-math to disable >> denormal arithmetic. This breaks Java's floating-point semantics. >> >> The bug is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522 >> >> One solution is to sav

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v11]

2023-10-26 Thread Vladimir Ivanov
On Thu, 26 Oct 2023 10:39:04 GMT, Andrew Haley wrote: > do you have any suggestion about where to move the remaining code that's in > stubRoutines.cpp? As it is now, `globalDefinitions.hpp/cpp` looks the most appropriate one to me. You could create new header file for it (under `share/utiliti

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v16]

2023-10-26 Thread Andrew Haley
> A bug in GCC causes shared libraries linked with -ffast-math to disable > denormal arithmetic. This breaks Java's floating-point semantics. > > The bug is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522 > > One solution is to save and restore the floating-point control word around > System

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v15]

2023-10-26 Thread Thomas Stuefe
On Thu, 26 Oct 2023 14:17:02 GMT, Andrew Haley wrote: >> A bug in GCC causes shared libraries linked with -ffast-math to disable >> denormal arithmetic. This breaks Java's floating-point semantics. >> >> The bug is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522 >> >> One solution is to sav

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v15]

2023-10-26 Thread Thomas Stuefe
On Thu, 26 Oct 2023 14:17:02 GMT, Andrew Haley wrote: >> A bug in GCC causes shared libraries linked with -ffast-math to disable >> denormal arithmetic. This breaks Java's floating-point semantics. >> >> The bug is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522 >> >> One solution is to sav

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v15]

2023-10-26 Thread Andrew Haley
> A bug in GCC causes shared libraries linked with -ffast-math to disable > denormal arithmetic. This breaks Java's floating-point semantics. > > The bug is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522 > > One solution is to save and restore the floating-point control word around > System

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v14]

2023-10-26 Thread Andrew Haley
> A bug in GCC causes shared libraries linked with -ffast-math to disable > denormal arithmetic. This breaks Java's floating-point semantics. > > The bug is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522 > > One solution is to save and restore the floating-point control word around > System

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v11]

2023-10-26 Thread Andrew Haley
On Wed, 18 Oct 2023 19:13:40 GMT, Vladimir Ivanov wrote: > > Meta-question and apologies if this was covered before, but why is this > > logic being added to stubRoutines.cpp? > > Because tha'ts where @iwanowww asked me to put it. I don't much care. Hi @iwanowww , do you have any suggestion ab

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v13]

2023-10-26 Thread Andrew Haley
> A bug in GCC causes shared libraries linked with -ffast-math to disable > denormal arithmetic. This breaks Java's floating-point semantics. > > The bug is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522 > > One solution is to save and restore the floating-point control word around > System

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v11]

2023-10-26 Thread Andrew Haley
On Thu, 19 Oct 2023 09:31:36 GMT, Andrew Haley wrote: >> src/hotspot/os/linux/os_linux.cpp line 1853: >> >>> 1851: >>> 1852: #ifndef IA32 >>> 1853: // Quickly test to make sure denormals are correctly handled. >> >> Nit: I recommend using "subnormal" rather than "denormal" for general >>

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v12]

2023-10-26 Thread Andrew Haley
> A bug in GCC causes shared libraries linked with -ffast-math to disable > denormal arithmetic. This breaks Java's floating-point semantics. > > The bug is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522 > > One solution is to save and restore the floating-point control word around > System

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v11]

2023-10-19 Thread Vladimir Ivanov
On Thu, 19 Oct 2023 09:33:52 GMT, Andrew Haley wrote: > I took them out because of a potential backwards-compatibility breakage. Ok, I checked the removed code (https://github.com/openjdk/jdk/pull/10661/commits/b817d4757c78594be5960ee0be27013e2588d30a) and agree it is not needed here. `Resto

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v11]

2023-10-19 Thread Andrew Haley
On Thu, 19 Oct 2023 01:26:43 GMT, Joe Darcy wrote: >> Andrew Haley has updated the pull request incrementally with three >> additional commits since the last revision: >> >> - Review feedback >> - Merge branch 'JDK-8295159' of https://github.com/theRealAph/jdk into >> JDK-8295159 >> - Remov

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v11]

2023-10-19 Thread Andrew Haley
On Wed, 18 Oct 2023 08:50:13 GMT, Andrew Haley wrote: >> Meta-question and apologies if this was covered before, but why is this >> logic being added to stubRoutines.cpp? > >> Meta-question and apologies if this was covered before, but why is this >> logic being added to stubRoutines.cpp? > >

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v11]

2023-10-18 Thread Joe Darcy
On Tue, 17 Oct 2023 11:43:59 GMT, Andrew Haley wrote: >> A bug in GCC causes shared libraries linked with -ffast-math to disable >> denormal arithmetic. This breaks Java's floating-point semantics. >> >> The bug is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522 >> >> One solution is to sav

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v11]

2023-10-18 Thread Vladimir Ivanov
On Wed, 18 Oct 2023 08:50:13 GMT, Andrew Haley wrote: >> Meta-question and apologies if this was covered before, but why is this >> logic being added to stubRoutines.cpp? > Because tha'ts where @iwanowww asked me to put it. I don't much care. The constants were duplicated in multiple places (i

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v11]

2023-10-18 Thread Andrew Haley
On Wed, 18 Oct 2023 00:01:20 GMT, David Holmes wrote: > Meta-question and apologies if this was covered before, but why is this logic > being added to stubRoutines.cpp? Because tha'ts where @iwanowww asked me to put it. I don't much care. - PR Comment: https://git.openjdk.org/jdk/

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v11]

2023-10-17 Thread David Holmes
On Tue, 17 Oct 2023 11:43:59 GMT, Andrew Haley wrote: >> A bug in GCC causes shared libraries linked with -ffast-math to disable >> denormal arithmetic. This breaks Java's floating-point semantics. >> >> The bug is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522 >> >> One solution is to sav

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v10]

2023-10-17 Thread David Holmes
On Tue, 17 Oct 2023 10:56:33 GMT, Andrew Haley wrote: >> src/hotspot/cpu/x86/macroAssembler_x86.cpp line 5169: >> >>> 5167: // Perform a little arithmetic to make sure that denormal >>> 5168: // numbers are handled correctly, i.e. that the "Denormals Are >>> 5169: // Zeros" fla

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v11]

2023-10-17 Thread Andrew Haley
> A bug in GCC causes shared libraries linked with -ffast-math to disable > denormal arithmetic. This breaks Java's floating-point semantics. > > The bug is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522 > > One solution is to save and restore the floating-point control word around > System

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v10]

2023-10-17 Thread Andrew Haley
On Tue, 17 Oct 2023 02:15:45 GMT, David Holmes wrote: >> Andrew Haley has updated the pull request incrementally with two additional >> commits since the last revision: >> >> - Comments only. >> - Review feedback > > src/hotspot/cpu/x86/macroAssembler_x86.cpp line 5169: > >> 5167: // P

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v10]

2023-10-16 Thread David Holmes
On Mon, 16 Oct 2023 16:22:27 GMT, Andrew Haley wrote: >> A bug in GCC causes shared libraries linked with -ffast-math to disable >> denormal arithmetic. This breaks Java's floating-point semantics. >> >> The bug is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522 >> >> One solution is to sav

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v10]

2023-10-16 Thread Andrew Haley
> A bug in GCC causes shared libraries linked with -ffast-math to disable > denormal arithmetic. This breaks Java's floating-point semantics. > > The bug is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522 > > One solution is to save and restore the floating-point control word around > System

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v9]

2023-10-16 Thread Andrew Haley
On Wed, 11 Oct 2023 18:08:55 GMT, Vladimir Ivanov wrote: >> Andrew Haley has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Add TestDenormalDouble.java > > test/hotspot/jtreg/compiler/floatingpoint/libfast-math.c line 26: > >> 24: #include

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v8]

2023-10-12 Thread Andrew Haley
On Wed, 11 Oct 2023 19:51:34 GMT, Vladimir Ivanov wrote: > And I was confused at first why there's a volatile on `tresh`. A short > comment describing the intentions would definitely help here. OK. - PR Review Comment: https://git.openjdk.org/jdk/pull/10661#discussion_r1356952291

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v9]

2023-10-12 Thread Andrew Haley
On Wed, 11 Oct 2023 17:57:27 GMT, Vladimir Ivanov wrote: >> Andrew Haley has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Add TestDenormalDouble.java > > src/hotspot/os/bsd/os_bsd.cpp line 977: > >> 975: >> 976: void *os::Bsd::dlopen_he

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v9]

2023-10-12 Thread Andrew Haley
On Thu, 12 Oct 2023 09:23:08 GMT, Florian Weimer wrote: >> Andrew Haley has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Add TestDenormalDouble.java > > test/hotspot/jtreg/compiler/floatingpoint/libfast-math.c line 37: > >> 35: >> 36: #

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v8]

2023-10-12 Thread Andrew Haley
On Wed, 11 Oct 2023 18:41:08 GMT, Thomas Stuefe wrote: >> What difference does it make if it does? > > I was trying to understand the BSD+gcc combination. We use clang on MacOS, so > the only platform I thought would be affected would be one of the BSDs. > > But I thought those also moved to c

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v9]

2023-10-12 Thread Magnus Ihse Bursie
On Wed, 11 Oct 2023 17:29:11 GMT, Andrew Haley wrote: >> A bug in GCC causes shared libraries linked with -ffast-math to disable >> denormal arithmetic. This breaks Java's floating-point semantics. >> >> The bug is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522 >> >> One solution is to sav

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v9]

2023-10-12 Thread Florian Weimer
On Wed, 11 Oct 2023 17:29:11 GMT, Andrew Haley wrote: >> A bug in GCC causes shared libraries linked with -ffast-math to disable >> denormal arithmetic. This breaks Java's floating-point semantics. >> >> The bug is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522 >> >> One solution is to sav

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v9]

2023-10-11 Thread Vladimir Ivanov
On Wed, 11 Oct 2023 17:29:11 GMT, Andrew Haley wrote: >> A bug in GCC causes shared libraries linked with -ffast-math to disable >> denormal arithmetic. This breaks Java's floating-point semantics. >> >> The bug is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522 >> >> One solution is to sav

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v8]

2023-10-11 Thread Vladimir Ivanov
On Wed, 11 Oct 2023 18:43:31 GMT, Thomas Stuefe wrote: >> `thresh` is volatile. What more is needed? > > Argh, sorry, missed that volatile. And I was confused at first why there's a volatile on `tresh`. A short comment describing the intentions would definitely help here. - PR Rev

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v8]

2023-10-11 Thread Thomas Stuefe
On Wed, 11 Oct 2023 17:20:18 GMT, Andrew Haley wrote: >> src/hotspot/os/bsd/os_bsd.cpp line 976: >> >>> 974: // same architecture as Hotspot is running on >>> 975: >>> 976: void *os::Bsd::dlopen_helper(const char *filename, int mode) { >> >> I thought BSD is switching to clang. > > What differ

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v9]

2023-10-11 Thread Andrew Haley
> A bug in GCC causes shared libraries linked with -ffast-math to disable > denormal arithmetic. This breaks Java's floating-point semantics. > > The bug is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522 > > One solution is to save and restore the floating-point control word around > System

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v7]

2023-10-11 Thread Andrew Haley
On Wed, 11 Oct 2023 13:54:05 GMT, Thomas Stuefe wrote: > > > I'm seeing one automated test failure on Linux x86, which I don't > > > understand because I've excluded that test for generic-i586. If anyone > > > understands this, please shout up. > > > > > > For avoidance of doubt, the test doe

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v8]

2023-10-11 Thread Andrew Haley
On Wed, 11 Oct 2023 14:03:24 GMT, Thomas Stuefe wrote: >> Andrew Haley has updated the pull request with a new target base due to a >> merge or a rebase. The pull request now contains 28 commits: >> >> - Merge branch 'JDK-8295159' of https://github.com/theRealAph/jdk into >> JDK-8295159 >> -

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v8]

2023-10-11 Thread Thomas Stuefe
On Wed, 11 Oct 2023 13:36:01 GMT, Andrew Haley wrote: >> A bug in GCC causes shared libraries linked with -ffast-math to disable >> denormal arithmetic. This breaks Java's floating-point semantics. >> >> The bug is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522 >> >> One solution is to sav

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v7]

2023-10-11 Thread Thomas Stuefe
On Wed, 11 Oct 2023 13:38:57 GMT, Andrew Haley wrote: > > I'm seeing one automated test failure on Linux x86, which I don't > > understand because I've excluded that test for generic-i586. If anyone > > understands this, please shout up. > > For avoidance of doubt, the test doesn't run locally

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v8]

2023-10-11 Thread Andrew Haley
On Wed, 27 Sep 2023 07:49:48 GMT, Magnus Ihse Bursie wrote: >> Andrew Haley has updated the pull request with a new target base due to a >> merge or a rebase. The pull request now contains 28 commits: >> >> - Merge branch 'JDK-8295159' of https://github.com/theRealAph/jdk into >> JDK-8295159

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v7]

2023-10-11 Thread Andrew Haley
On Wed, 11 Oct 2023 13:31:22 GMT, Andrew Haley wrote: > I'm seeing one automated test failure on Linux x86, which I don't understand > because I've excluded that test for generic-i586. If anyone understands this, > please shout up. For avoidance of doubt, the test doesn't run locally, only on

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v8]

2023-10-11 Thread Magnus Ihse Bursie
On Wed, 11 Oct 2023 13:31:22 GMT, Andrew Haley wrote: >> A bug in GCC causes shared libraries linked with -ffast-math to disable >> denormal arithmetic. This breaks Java's floating-point semantics. >> >> The bug is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522 >> >> One solution is to sav

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v7]

2023-10-11 Thread Andrew Haley
On Wed, 12 Oct 2022 17:00:15 GMT, Andrew Haley wrote: >> A bug in GCC causes shared libraries linked with -ffast-math to disable >> denormal arithmetic. This breaks Java's floating-point semantics. >> >> The bug is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522 >> >> One solution is to sav

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v8]

2023-10-11 Thread Andrew Haley
> A bug in GCC causes shared libraries linked with -ffast-math to disable > denormal arithmetic. This breaks Java's floating-point semantics. > > The bug is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522 > > One solution is to save and restore the floating-point control word around > System

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v5]

2023-10-11 Thread Andrew Haley
On Wed, 12 Oct 2022 15:59:48 GMT, Aleksey Shipilev wrote: >> Andrew Haley has updated the pull request incrementally with one additional >> commit since the last revision: >> >> 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic > > test/hotspot/jtreg/compiler/floatin

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v7]

2023-09-17 Thread David Holmes
On Wed, 12 Oct 2022 17:00:15 GMT, Andrew Haley wrote: >> A bug in GCC causes shared libraries linked with -ffast-math to disable >> denormal arithmetic. This breaks Java's floating-point semantics. >> >> The bug is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522 >> >> One solution is to sav

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v7]

2023-09-16 Thread Magnus Ihse Bursie
On Wed, 12 Oct 2022 17:00:15 GMT, Andrew Haley wrote: >> A bug in GCC causes shared libraries linked with -ffast-math to disable >> denormal arithmetic. This breaks Java's floating-point semantics. >> >> The bug is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522 >> >> One solution is to sav

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v7]

2023-01-02 Thread Florian Weimer
On Wed, 12 Oct 2022 17:00:15 GMT, Andrew Haley wrote: >> A bug in GCC causes shared libraries linked with -ffast-math to disable >> denormal arithmetic. This breaks Java's floating-point semantics. >> >> The bug is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522 >> >> One solution is to sav

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v7]

2022-11-30 Thread Andrew Haley
On Wed, 12 Oct 2022 17:00:15 GMT, Andrew Haley wrote: >> A bug in GCC causes shared libraries linked with -ffast-math to disable >> denormal arithmetic. This breaks Java's floating-point semantics. >> >> The bug is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522 >> >> One solution is to sav

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v7]

2022-10-31 Thread Andrew Haley
On Mon, 31 Oct 2022 18:25:57 GMT, Jorn Vernee wrote: > > Anyway, I plan to > > a. Restore the FPU CR after calls to dlopen(3). > > b. Detect FPU CR corruption at safepoints, and print a warning. At least > > the user might find out that something is wrong. > > Doing (a) seems good. I can't say f

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v7]

2022-10-31 Thread Jorn Vernee
On Mon, 31 Oct 2022 17:44:07 GMT, Andrew Haley wrote: > Anyway, I plan to > > a. Restore the FPU CR after calls to dlopen(3). > b. Detect FPU CR corruption at safepoints, and print a warning. At least > the user might find out that something is wrong. Doing (a) seems good. I can't say for sure

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v7]

2022-10-31 Thread Andrew Haley
On Wed, 12 Oct 2022 17:00:15 GMT, Andrew Haley wrote: >> A bug in GCC causes shared libraries linked with -ffast-math to disable >> denormal arithmetic. This breaks Java's floating-point semantics. >> >> The bug is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522 >> >> One solution is to sav

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v7]

2022-10-31 Thread Andrew Haley
On 10/31/22 15:49, Joe Darcy wrote: In terms of the overhead of using floating-point expression evaluation as a guard, are there still platforms where operating on subnormal values is pathologically slower? Some generations of SPARC chips had that behavior where a subnormal multiply would take, s

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v7]

2022-10-31 Thread Joe Darcy
On 10/25/2022 7:27 AM, Andrew Haley wrote: On Thu, 20 Oct 2022 20:26:47 GMT, Vladimir Ivanov wrote: The GCC bugs with `-ffast-math` only corrupts `FTZ` and `DAZ`. But `RC` and exception masks may be corrupted as well the same way and I believe the consequences are be similar (silent divergen

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v7]

2022-10-27 Thread Andrew Haley
On Wed, 12 Oct 2022 17:00:15 GMT, Andrew Haley wrote: >> A bug in GCC causes shared libraries linked with -ffast-math to disable >> denormal arithmetic. This breaks Java's floating-point semantics. >> >> The bug is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522 >> >> One solution is to sav

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v7]

2022-10-26 Thread Jorn Vernee
On Wed, 12 Oct 2022 17:00:15 GMT, Andrew Haley wrote: >> A bug in GCC causes shared libraries linked with -ffast-math to disable >> denormal arithmetic. This breaks Java's floating-point semantics. >> >> The bug is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522 >> >> One solution is to sav

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v7]

2022-10-26 Thread Vladimir Ivanov
On Wed, 12 Oct 2022 17:00:15 GMT, Andrew Haley wrote: >> A bug in GCC causes shared libraries linked with -ffast-math to disable >> denormal arithmetic. This breaks Java's floating-point semantics. >> >> The bug is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522 >> >> One solution is to sav

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic

2022-10-26 Thread Vladimir Ivanov
On Wed, 26 Oct 2022 17:10:00 GMT, David Holmes wrote: > At most an expanded -Xcheck:jni check for FP-state manipulation, with an enhanced/fixed RestoreMXCSROnJNICalls is in order IMVHO. FTR both `-Xcheck:jni` and `-XX:+RestoreMXCSROnJNICalls` already catch the problematic case being discussed.

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v7]

2022-10-26 Thread Andrew Haley
On Wed, 12 Oct 2022 17:00:15 GMT, Andrew Haley wrote: >> A bug in GCC causes shared libraries linked with -ffast-math to disable >> denormal arithmetic. This breaks Java's floating-point semantics. >> >> The bug is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522 >> >> One solution is to sav

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v7]

2022-10-25 Thread John R Rose
On Tue, 25 Oct 2022 23:13:08 GMT, Vladimir Ivanov wrote: > …very modest impact while still being able to catch important types of MXCSR > corruption. I fully support having it turned on by default for JNI calls. I guess I agree. With the clever test for the bad mode Java cares about, the over

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v7]

2022-10-25 Thread David Holmes
On 26/10/2022 1:02 am, Andrew Haley wrote: On Tue, 25 Oct 2022 14:46:57 GMT, Florian Weimer wrote: Sorry, I feel like this has gone a bit off track. It started as some hardening for `loadLibrary`, but now it's about making all JNI calls a bit slower? Is there any data to suggest that this is

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v7]

2022-10-25 Thread Vladimir Ivanov
On Wed, 12 Oct 2022 17:00:15 GMT, Andrew Haley wrote: >> A bug in GCC causes shared libraries linked with -ffast-math to disable >> denormal arithmetic. This breaks Java's floating-point semantics. >> >> The bug is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522 >> >> One solution is to sav

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v7]

2022-10-25 Thread Andrew Haley
On Tue, 18 Oct 2022 07:46:35 GMT, Florian Weimer wrote: > I wonder if something that focuses on diagnostic tools might be better here, > particularly if there hasn't been any reported breakage. The `dlopen` > protection is of course very incomplete because any JNI call can change the > state i

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v7]

2022-10-25 Thread Andrew Haley
On Wed, 12 Oct 2022 17:00:15 GMT, Andrew Haley wrote: >> A bug in GCC causes shared libraries linked with -ffast-math to disable >> denormal arithmetic. This breaks Java's floating-point semantics. >> >> The bug is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522 >> >> One solution is to sav

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v7]

2022-10-25 Thread Andrew Haley
On Tue, 25 Oct 2022 14:46:57 GMT, Florian Weimer wrote: > Sorry, I feel like this has gone a bit off track. It started as some > hardening for `loadLibrary`, but now it's about making all JNI calls a bit > slower? Is there any data to suggest that this is necessary? > > Would it be possible to

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v7]

2022-10-25 Thread Florian Weimer
On Wed, 12 Oct 2022 17:00:15 GMT, Andrew Haley wrote: >> A bug in GCC causes shared libraries linked with -ffast-math to disable >> denormal arithmetic. This breaks Java's floating-point semantics. >> >> The bug is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522 >> >> One solution is to sav

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v7]

2022-10-25 Thread Andrew Haley
On Tue, 25 Oct 2022 13:29:52 GMT, Andrew Haley wrote: > Enabling `-XX:+RestoreMXCSROnJNICalls` makes the overhead much worse: > > ``` > Benchmark Mode Cnt Score Error Units > CallOverheadConstant.jni_blank avgt 40 14.741 ± 0.031 ns/op > CallOverheadConstant

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v7]

2022-10-25 Thread Andrew Haley
On Thu, 20 Oct 2022 20:26:47 GMT, Vladimir Ivanov wrote: > The GCC bugs with `-ffast-math` only corrupts `FTZ` and `DAZ`. > > But `RC` and exception masks may be corrupted as well the same way and I > believe the consequences are be similar (silent divergence in results during > FP computation

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v7]

2022-10-25 Thread Andrew Haley
On Wed, 12 Oct 2022 17:00:15 GMT, Andrew Haley wrote: >> A bug in GCC causes shared libraries linked with -ffast-math to disable >> denormal arithmetic. This breaks Java's floating-point semantics. >> >> The bug is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522 >> >> One solution is to sav

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v7]

2022-10-21 Thread Andrew Haley
On Thu, 20 Oct 2022 20:26:47 GMT, Vladimir Ivanov wrote: > That sounds like a very interesting idea. > > It would be very helpful to get an understanding how much overhead `STMXCSR` > plus a branch adds in JNI stub to decide whether it's worth optimizing for. It's not just Intel's implementati

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v7]

2022-10-20 Thread Vladimir Ivanov
On Wed, 12 Oct 2022 17:00:15 GMT, Andrew Haley wrote: >> A bug in GCC causes shared libraries linked with -ffast-math to disable >> denormal arithmetic. This breaks Java's floating-point semantics. >> >> The bug is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522 >> >> One solution is to sav

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v7]

2022-10-20 Thread Joseph D. Darcy
PS And additional expressions could be crashed to rule out flush-to-zero, treating all subnormals and zero, and other non-compliant modes of operation. -Joe On 10/20/2022 1:05 PM, Joseph D. Darcy wrote: On 10/20/2022 10:43 AM, Andrew Haley wrote: On Wed, 12 Oct 2022 17:00:15 GMT, Andrew Hal

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v7]

2022-10-20 Thread Joseph D. Darcy
On 10/20/2022 10:43 AM, Andrew Haley wrote: On Wed, 12 Oct 2022 17:00:15 GMT, Andrew Haley wrote: A bug in GCC causes shared libraries linked with -ffast-math to disable denormal arithmetic. This breaks Java's floating-point semantics. The bug is https://gcc.gnu.org/bugzilla/show_bug.cgi?i

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v7]

2022-10-20 Thread Andrew Haley
On Wed, 12 Oct 2022 17:00:15 GMT, Andrew Haley wrote: >> A bug in GCC causes shared libraries linked with -ffast-math to disable >> denormal arithmetic. This breaks Java's floating-point semantics. >> >> The bug is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522 >> >> One solution is to sav

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v7]

2022-10-18 Thread Vladimir Ivanov
On Wed, 12 Oct 2022 17:00:15 GMT, Andrew Haley wrote: >> A bug in GCC causes shared libraries linked with -ffast-math to disable >> denormal arithmetic. This breaks Java's floating-point semantics. >> >> The bug is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522 >> >> One solution is to sav

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v7]

2022-10-18 Thread Vladimir Ivanov
On Wed, 12 Oct 2022 17:00:15 GMT, Andrew Haley wrote: >> A bug in GCC causes shared libraries linked with -ffast-math to disable >> denormal arithmetic. This breaks Java's floating-point semantics. >> >> The bug is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522 >> >> One solution is to sav

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v7]

2022-10-18 Thread Vladimir Ivanov
On Wed, 12 Oct 2022 17:00:15 GMT, Andrew Haley wrote: >> A bug in GCC causes shared libraries linked with -ffast-math to disable >> denormal arithmetic. This breaks Java's floating-point semantics. >> >> The bug is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522 >> >> One solution is to sav

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v7]

2022-10-18 Thread Andrew Haley
On Tue, 18 Oct 2022 07:43:13 GMT, Florian Weimer wrote: >> Andrew Haley has updated the pull request incrementally with one additional >> commit since the last revision: >> >> 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic > > src/hotspot/os/linux/os_linux.cpp lin

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v7]

2022-10-18 Thread Florian Weimer
On Wed, 12 Oct 2022 17:00:15 GMT, Andrew Haley wrote: >> A bug in GCC causes shared libraries linked with -ffast-math to disable >> denormal arithmetic. This breaks Java's floating-point semantics. >> >> The bug is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522 >> >> One solution is to sav

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v7]

2022-10-17 Thread David Holmes
On Wed, 12 Oct 2022 17:00:15 GMT, Andrew Haley wrote: >> A bug in GCC causes shared libraries linked with -ffast-math to disable >> denormal arithmetic. This breaks Java's floating-point semantics. >> >> The bug is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522 >> >> One solution is to sav

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v7]

2022-10-17 Thread David Holmes
On Wed, 12 Oct 2022 17:00:15 GMT, Andrew Haley wrote: >> A bug in GCC causes shared libraries linked with -ffast-math to disable >> denormal arithmetic. This breaks Java's floating-point semantics. >> >> The bug is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522 >> >> One solution is to sav

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v7]

2022-10-17 Thread Vladimir Ivanov
On Wed, 12 Oct 2022 17:00:15 GMT, Andrew Haley wrote: >> A bug in GCC causes shared libraries linked with -ffast-math to disable >> denormal arithmetic. This breaks Java's floating-point semantics. >> >> The bug is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522 >> >> One solution is to sav

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v7]

2022-10-14 Thread Andrew Haley
On 10/13/22 19:13, Vladimir Ivanov wrote: On Thu, 13 Oct 2022 07:47:20 GMT, Andrew Haley wrote: The problem is that this bug is very insidious: the user probably doesn't know that there's anything wrong, and almost certainly has no idea that it's anything to do with JNI. I'm still trying t

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v7]

2022-10-13 Thread Vladimir Ivanov
On Thu, 13 Oct 2022 07:47:20 GMT, Andrew Haley wrote: > The problem is that this bug is very insidious: the user probably doesn't > know that there's anything wrong, and almost certainly has no idea that it's > anything to do with JNI. I'm still trying to grasp why the current problem is somet

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v7]

2022-10-13 Thread Andrew Haley
On Wed, 12 Oct 2022 17:00:15 GMT, Andrew Haley wrote: >> A bug in GCC causes shared libraries linked with -ffast-math to disable >> denormal arithmetic. This breaks Java's floating-point semantics. >> >> The bug is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522 >> >> One solution is to sav

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v7]

2022-10-13 Thread Andrew Haley
On Wed, 12 Oct 2022 20:26:34 GMT, Jorn Vernee wrote: > Following that logic: from our perspective `dlopen` violates its ABI in > certain cases. Preserving the control bits across calls to `dlopen` seems > like a pragmatic solution. I'm not sure how important it is to have an opt-in > for the c

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v7]

2022-10-13 Thread Andrew Haley
On Wed, 12 Oct 2022 20:35:09 GMT, Maurizio Cimadamore wrote: > Isn't it an illustration of a more general problem we have with native code > where it can mess with FP environment at any time? Yes. > We already have similar problems with MXCSR register and provide verification > logic (part o

Re: RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic [v7]

2022-10-12 Thread Vladimir Ivanov
On Wed, 12 Oct 2022 20:35:09 GMT, Maurizio Cimadamore wrote: > Note also that this specific problem is triggered by dlopen itself, because > certain libraries might have some "bad" (from the perspective of JVM) > initialization code. ... and it leads to another question whether the JVM itself

  1   2   >