From dmitry.dmitriev at oracle.com Wed Jul 1 12:49:08 2015 From: dmitry.dmitriev at oracle.com (Dmitry Dmitriev) Date: Wed, 1 Jul 2015 15:49:08 +0300 Subject: RFR (S): 8129786: Buffer overrun when passing long not existing option in JDK 9 Message-ID: <5593E1C4.8020702@oracle.com> Hello, Please review this small fix and new test. Also, I need a sponsor for this fix, who can push it. In this fix logic for stripped_argname was put into "if (arg_len <= BUFLEN)" statement. stripped_argname is used only to check is option is newly obsolete. Since valid VM option should be not bigger than 255 characters(BUFLEN value), then obsolete_jvm_flags contains only options with strlen <= BUFLEN. Webrev: http://cr.openjdk.java.net/~ddmitriev/8129786/webrev.00/ JBS: https://bugs.openjdk.java.net/browse/JDK-8129786 Tested: JPRT(with new test), hotspot all & vm.quick Thanks, Dmitry From daniel.daugherty at oracle.com Wed Jul 1 13:49:50 2015 From: daniel.daugherty at oracle.com (Daniel D. Daugherty) Date: Wed, 01 Jul 2015 07:49:50 -0600 Subject: RFR (S): 8129786: Buffer overrun when passing long not existing option in JDK 9 In-Reply-To: <5593E1C4.8020702@oracle.com> References: <5593E1C4.8020702@oracle.com> Message-ID: <5593EFFE.10302@oracle.com> > Webrev: http://cr.openjdk.java.net/~ddmitriev/8129786/webrev.00/ src/share/vm/runtime/arguments.cpp L840: if (arg_len <= BUFLEN) { Please add a comment. Perhaps: // Only make the obsolete check for valid arguments. L843: strncpy(stripped_argname, argname, arg_len); L844: stripped_argname[arg_len] = '\0'; //strncpy doesn't null terminate. This is not due to your change but this comment isn't quite right. Perhaps: stripped_argname[arg_len] = '\0'; // strncpy may not null terminate. strncpy() null terminates if the length of 'argname' is less than arg_len. Also added one more space after ';' and added a space after '//'. L847: char version[256]; Can you change this '256' to BUFLEN+1 also? test/runtime/CommandLine/TestLongUnrecognizedVMOption.java L27: * @summary Verify that JVM correctly process very long unregnized VM option Typo: 'process' -> 'processes' Typo: 'unregnized' -> 'unrecognized' L29: * @modules java.management Why this module? L49: extra blank line at the end; jcheck may not like this Thumbs up. I don't need to see another webrev if you decide to fix these minor nits. Dan On 7/1/15 6:49 AM, Dmitry Dmitriev wrote: > Hello, > > Please review this small fix and new test. Also, I need a sponsor for > this fix, who can push it. > > In this fix logic for stripped_argname was put into "if (arg_len <= > BUFLEN)" statement. stripped_argname is used only to check is option > is newly obsolete. Since valid VM option should be not bigger than 255 > characters(BUFLEN value), then obsolete_jvm_flags contains only > options with strlen <= BUFLEN. > > Webrev: http://cr.openjdk.java.net/~ddmitriev/8129786/webrev.00/ > > JBS: https://bugs.openjdk.java.net/browse/JDK-8129786 > Tested: JPRT(with new test), hotspot all & vm.quick > > Thanks, > Dmitry From claes.redestad at oracle.com Wed Jul 1 14:54:55 2015 From: claes.redestad at oracle.com (Claes Redestad) Date: Wed, 01 Jul 2015 16:54:55 +0200 Subject: RFR: 8081589: Output of -XX:+TraceClassLoadingPreorder in JDK9 incompatible with MakeClasslist tool Message-ID: <5593FF3F.2040501@oracle.com> Hi, please review this rewrite/cleanup of the MakeClasslist tool to operate on the output of -XX:DumpLoadedClassList rather than -XX:+TraceClassLoadingPreorder. Since the tool became rather trivial I opted to write it in nashorn-compliant javascript to streamline the usage. Bug: https://bugs.openjdk.java.net/browse/JDK-8081589 Webrev: http://cr.openjdk.java.net/~redestad/8081589/webrev.02 A number of undocumented/unused tests were removed and an outdated README was incorporated into the tool source itself, among other things clarifying that the checksum needs to be calculated and added to the classlist before checking it into the workspace. I've asked around about how to go about adding tests for standalone tools like these, but didn't come up with a good answer. If someone insists I add a small test to this I'd hope there's some insight into how best to do that (shell-based jtreg test?) Thanks! /Claes From dmitry.dmitriev at oracle.com Wed Jul 1 16:38:53 2015 From: dmitry.dmitriev at oracle.com (Dmitry Dmitriev) Date: Wed, 1 Jul 2015 19:38:53 +0300 Subject: RFR (S): 8129786: Buffer overrun when passing long not existing option in JDK 9 In-Reply-To: <5593EFFE.10302@oracle.com> References: <5593E1C4.8020702@oracle.com> <5593EFFE.10302@oracle.com> Message-ID: <5594179D.7030607@oracle.com> Hello Dan, Thank you for review! Updated webrev: http://cr.openjdk.java.net/~ddmitriev/8129786/webrev.01/ Please see my comments inline. Regards, Dmitry On 01.07.2015 16:49, Daniel D. Daugherty wrote: > > Webrev: http://cr.openjdk.java.net/~ddmitriev/8129786/webrev.00/ > > src/share/vm/runtime/arguments.cpp > L840: if (arg_len <= BUFLEN) { > Please add a comment. Perhaps: > > // Only make the obsolete check for valid arguments. Done! > > L843: strncpy(stripped_argname, argname, arg_len); > L844: stripped_argname[arg_len] = '\0'; //strncpy doesn't null > terminate. > This is not due to your change but this comment isn't quite > right. > Perhaps: > > stripped_argname[arg_len] = '\0'; // strncpy may not null > terminate. > > strncpy() null terminates if the length of 'argname' is > less than arg_len. Also added one more space after ';' > and added a space after '//'. Done! > > L847: char version[256]; > Can you change this '256' to BUFLEN+1 also? I prefer to leave it as is, because there are no relationship between 'version' and BUFLEN. BUFLEN is used for parsing options, thus I use it for stripped_argname. But I think it will be better not to use it for 'version'. > > test/runtime/CommandLine/TestLongUnrecognizedVMOption.java > L27: * @summary Verify that JVM correctly process very long > unregnized VM option > Typo: 'process' -> 'processes' > Typo: 'unregnized' -> 'unrecognized' > Done! > L29: * @modules java.management > Why this module? I got this dependency from script which used to find dependencies of test code. > > L49: extra blank line at the end; jcheck may not like this > Done! > Thumbs up. I don't need to see another webrev if you > decide to fix these minor nits. > > Dan > > > On 7/1/15 6:49 AM, Dmitry Dmitriev wrote: >> Hello, >> >> Please review this small fix and new test. Also, I need a sponsor for >> this fix, who can push it. >> >> In this fix logic for stripped_argname was put into "if (arg_len <= >> BUFLEN)" statement. stripped_argname is used only to check is option >> is newly obsolete. Since valid VM option should be not bigger than >> 255 characters(BUFLEN value), then obsolete_jvm_flags contains only >> options with strlen <= BUFLEN. >> >> Webrev: http://cr.openjdk.java.net/~ddmitriev/8129786/webrev.00/ >> >> JBS: https://bugs.openjdk.java.net/browse/JDK-8129786 >> Tested: JPRT(with new test), hotspot all & vm.quick >> >> Thanks, >> Dmitry From daniel.daugherty at oracle.com Wed Jul 1 16:42:51 2015 From: daniel.daugherty at oracle.com (Daniel D. Daugherty) Date: Wed, 01 Jul 2015 10:42:51 -0600 Subject: RFR (S): 8129786: Buffer overrun when passing long not existing option in JDK 9 In-Reply-To: <5594179D.7030607@oracle.com> References: <5593E1C4.8020702@oracle.com> <5593EFFE.10302@oracle.com> <5594179D.7030607@oracle.com> Message-ID: <5594188B.1060107@oracle.com> On 7/1/15 10:38 AM, Dmitry Dmitriev wrote: > Hello Dan, > > Thank you for review! Updated webrev: > http://cr.openjdk.java.net/~ddmitriev/8129786/webrev.01/ > > Please see my comments inline. > > Regards, > Dmitry > > On 01.07.2015 16:49, Daniel D. Daugherty wrote: >> > Webrev: http://cr.openjdk.java.net/~ddmitriev/8129786/webrev.00/ >> >> src/share/vm/runtime/arguments.cpp >> L840: if (arg_len <= BUFLEN) { >> Please add a comment. Perhaps: >> >> // Only make the obsolete check for valid arguments. > Done! >> >> L843: strncpy(stripped_argname, argname, arg_len); >> L844: stripped_argname[arg_len] = '\0'; //strncpy doesn't >> null terminate. >> This is not due to your change but this comment isn't quite >> right. >> Perhaps: >> >> stripped_argname[arg_len] = '\0'; // strncpy may not >> null terminate. >> >> strncpy() null terminates if the length of 'argname' is >> less than arg_len. Also added one more space after ';' >> and added a space after '//'. > Done! >> >> L847: char version[256]; >> Can you change this '256' to BUFLEN+1 also? > I prefer to leave it as is, because there are no relationship between > 'version' and BUFLEN. BUFLEN is used for parsing options, thus I use > it for stripped_argname. But I think it will be better not to use it > for 'version'. Is there some constant hanging around that is appropriate? A literal '256' is just bugging me... :-) > >> >> test/runtime/CommandLine/TestLongUnrecognizedVMOption.java >> L27: * @summary Verify that JVM correctly process very long >> unregnized VM option >> Typo: 'process' -> 'processes' >> Typo: 'unregnized' -> 'unrecognized' >> > Done! >> L29: * @modules java.management >> Why this module? > I got this dependency from script which used to find dependencies of > test code. OK, but why? I see nothing in this test that requires the java.management module... Dan >> >> L49: extra blank line at the end; jcheck may not like this >> > Done! >> Thumbs up. I don't need to see another webrev if you >> decide to fix these minor nits. >> >> Dan >> >> >> On 7/1/15 6:49 AM, Dmitry Dmitriev wrote: >>> Hello, >>> >>> Please review this small fix and new test. Also, I need a sponsor >>> for this fix, who can push it. >>> >>> In this fix logic for stripped_argname was put into "if (arg_len <= >>> BUFLEN)" statement. stripped_argname is used only to check is option >>> is newly obsolete. Since valid VM option should be not bigger than >>> 255 characters(BUFLEN value), then obsolete_jvm_flags contains only >>> options with strlen <= BUFLEN. >>> >>> Webrev: http://cr.openjdk.java.net/~ddmitriev/8129786/webrev.00/ >>> >>> JBS: https://bugs.openjdk.java.net/browse/JDK-8129786 >>> Tested: JPRT(with new test), hotspot all & vm.quick >>> >>> Thanks, >>> Dmitry > From dmitry.dmitriev at oracle.com Wed Jul 1 16:49:50 2015 From: dmitry.dmitriev at oracle.com (Dmitry Dmitriev) Date: Wed, 1 Jul 2015 19:49:50 +0300 Subject: RFR (S): 8129786: Buffer overrun when passing long not existing option in JDK 9 In-Reply-To: <5594188B.1060107@oracle.com> References: <5593E1C4.8020702@oracle.com> <5593EFFE.10302@oracle.com> <5594179D.7030607@oracle.com> <5594188B.1060107@oracle.com> Message-ID: <55941A2E.4000408@oracle.com> On 01.07.2015 19:42, Daniel D. Daugherty wrote: > > On 7/1/15 10:38 AM, Dmitry Dmitriev wrote: >> Hello Dan, >> >> Thank you for review! Updated webrev: >> http://cr.openjdk.java.net/~ddmitriev/8129786/webrev.01/ >> >> Please see my comments inline. >> >> Regards, >> Dmitry >> >> On 01.07.2015 16:49, Daniel D. Daugherty wrote: >>> > Webrev: http://cr.openjdk.java.net/~ddmitriev/8129786/webrev.00/ >>> >>> src/share/vm/runtime/arguments.cpp >>> L840: if (arg_len <= BUFLEN) { >>> Please add a comment. Perhaps: >>> >>> // Only make the obsolete check for valid arguments. >> Done! >>> >>> L843: strncpy(stripped_argname, argname, arg_len); >>> L844: stripped_argname[arg_len] = '\0'; //strncpy doesn't >>> null terminate. >>> This is not due to your change but this comment isn't quite >>> right. >>> Perhaps: >>> >>> stripped_argname[arg_len] = '\0'; // strncpy may not >>> null terminate. >>> >>> strncpy() null terminates if the length of 'argname' is >>> less than arg_len. Also added one more space after ';' >>> and added a space after '//'. >> Done! >>> >>> L847: char version[256]; >>> Can you change this '256' to BUFLEN+1 also? >> I prefer to leave it as is, because there are no relationship between >> 'version' and BUFLEN. BUFLEN is used for parsing options, thus I use >> it for stripped_argname. But I think it will be better not to use it >> for 'version'. > > Is there some constant hanging around that is appropriate? > A literal '256' is just bugging me... :-) Yes, I agree with you :) But I don't see any of them around. > > >> >>> >>> test/runtime/CommandLine/TestLongUnrecognizedVMOption.java >>> L27: * @summary Verify that JVM correctly process very long >>> unregnized VM option >>> Typo: 'process' -> 'processes' >>> Typo: 'unregnized' -> 'unrecognized' >>> >> Done! >>> L29: * @modules java.management >>> Why this module? >> I got this dependency from script which used to find dependencies of >> test code. > > OK, but why? I see nothing in this test that requires the > java.management module... I think that because jdk.test.lib.ProcessTools is depends on java.management and this leads to the test dependency. Thank you, Dmitry > > Dan > > >>> >>> L49: extra blank line at the end; jcheck may not like this >>> >> Done! >>> Thumbs up. I don't need to see another webrev if you >>> decide to fix these minor nits. >>> >>> Dan >>> >>> >>> On 7/1/15 6:49 AM, Dmitry Dmitriev wrote: >>>> Hello, >>>> >>>> Please review this small fix and new test. Also, I need a sponsor >>>> for this fix, who can push it. >>>> >>>> In this fix logic for stripped_argname was put into "if (arg_len <= >>>> BUFLEN)" statement. stripped_argname is used only to check is >>>> option is newly obsolete. Since valid VM option should be not >>>> bigger than 255 characters(BUFLEN value), then obsolete_jvm_flags >>>> contains only options with strlen <= BUFLEN. >>>> >>>> Webrev: http://cr.openjdk.java.net/~ddmitriev/8129786/webrev.00/ >>>> >>>> JBS: https://bugs.openjdk.java.net/browse/JDK-8129786 >>>> Tested: JPRT(with new test), hotspot all & vm.quick >>>> >>>> Thanks, >>>> Dmitry >> > From daniel.daugherty at oracle.com Wed Jul 1 16:51:17 2015 From: daniel.daugherty at oracle.com (Daniel D. Daugherty) Date: Wed, 01 Jul 2015 10:51:17 -0600 Subject: RFR (S): 8129786: Buffer overrun when passing long not existing option in JDK 9 In-Reply-To: <55941A2E.4000408@oracle.com> References: <5593E1C4.8020702@oracle.com> <5593EFFE.10302@oracle.com> <5594179D.7030607@oracle.com> <5594188B.1060107@oracle.com> <55941A2E.4000408@oracle.com> Message-ID: <55941A85.5030009@oracle.com> On 7/1/15 10:49 AM, Dmitry Dmitriev wrote: > On 01.07.2015 19:42, Daniel D. Daugherty wrote: >> >> On 7/1/15 10:38 AM, Dmitry Dmitriev wrote: >>> Hello Dan, >>> >>> Thank you for review! Updated webrev: >>> http://cr.openjdk.java.net/~ddmitriev/8129786/webrev.01/ >>> >>> Please see my comments inline. >>> >>> Regards, >>> Dmitry >>> >>> On 01.07.2015 16:49, Daniel D. Daugherty wrote: >>>> > Webrev: http://cr.openjdk.java.net/~ddmitriev/8129786/webrev.00/ >>>> >>>> src/share/vm/runtime/arguments.cpp >>>> L840: if (arg_len <= BUFLEN) { >>>> Please add a comment. Perhaps: >>>> >>>> // Only make the obsolete check for valid arguments. >>> Done! >>>> >>>> L843: strncpy(stripped_argname, argname, arg_len); >>>> L844: stripped_argname[arg_len] = '\0'; //strncpy doesn't >>>> null terminate. >>>> This is not due to your change but this comment isn't quite >>>> right. >>>> Perhaps: >>>> >>>> stripped_argname[arg_len] = '\0'; // strncpy may not >>>> null terminate. >>>> >>>> strncpy() null terminates if the length of 'argname' is >>>> less than arg_len. Also added one more space after ';' >>>> and added a space after '//'. >>> Done! >>>> >>>> L847: char version[256]; >>>> Can you change this '256' to BUFLEN+1 also? >>> I prefer to leave it as is, because there are no relationship >>> between 'version' and BUFLEN. BUFLEN is used for parsing options, >>> thus I use it for stripped_argname. But I think it will be better >>> not to use it for 'version'. >> >> Is there some constant hanging around that is appropriate? >> A literal '256' is just bugging me... :-) > Yes, I agree with you :) But I don't see any of them around. OK... >> >> >>> >>>> >>>> test/runtime/CommandLine/TestLongUnrecognizedVMOption.java >>>> L27: * @summary Verify that JVM correctly process very long >>>> unregnized VM option >>>> Typo: 'process' -> 'processes' >>>> Typo: 'unregnized' -> 'unrecognized' >>>> >>> Done! >>>> L29: * @modules java.management >>>> Why this module? >>> I got this dependency from script which used to find dependencies of >>> test code. >> >> OK, but why? I see nothing in this test that requires the >> java.management module... > I think that because jdk.test.lib.ProcessTools is depends on > java.management and this leads to the test dependency. OK... that makes sense. Dan > > Thank you, > Dmitry >> >> Dan >> >> >>>> >>>> L49: extra blank line at the end; jcheck may not like this >>>> >>> Done! >>>> Thumbs up. I don't need to see another webrev if you >>>> decide to fix these minor nits. >>>> >>>> Dan >>>> >>>> >>>> On 7/1/15 6:49 AM, Dmitry Dmitriev wrote: >>>>> Hello, >>>>> >>>>> Please review this small fix and new test. Also, I need a sponsor >>>>> for this fix, who can push it. >>>>> >>>>> In this fix logic for stripped_argname was put into "if (arg_len >>>>> <= BUFLEN)" statement. stripped_argname is used only to check is >>>>> option is newly obsolete. Since valid VM option should be not >>>>> bigger than 255 characters(BUFLEN value), then obsolete_jvm_flags >>>>> contains only options with strlen <= BUFLEN. >>>>> >>>>> Webrev: http://cr.openjdk.java.net/~ddmitriev/8129786/webrev.00/ >>>>> >>>>> JBS: https://bugs.openjdk.java.net/browse/JDK-8129786 >>>>> Tested: JPRT(with new test), hotspot all & vm.quick >>>>> >>>>> Thanks, >>>>> Dmitry >>> >> > From ioi.lam at oracle.com Wed Jul 1 20:44:06 2015 From: ioi.lam at oracle.com (Ioi Lam) Date: Wed, 01 Jul 2015 13:44:06 -0700 Subject: RFR: 8081589: Output of -XX:+TraceClassLoadingPreorder in JDK9 incompatible with MakeClasslist tool In-Reply-To: <5593FF3F.2040501@oracle.com> References: <5593FF3F.2040501@oracle.com> Message-ID: <55945116.20102@oracle.com> Claes, The changes look good to me. It's nice to replace a large amount of Java code with a simple script. How about doing the line splitting like this: var classes = readFully(arg).replace(/[\r\n]+/g, "\n").split("\n") That way it will be able to handle an input file that have a mixture of newline characters (e.g., if someone has edited a Unix text file on a Windows editor). Thanks - Ioi On 7/1/15 7:54 AM, Claes Redestad wrote: > Hi, > > please review this rewrite/cleanup of the MakeClasslist tool to > operate on the output of > -XX:DumpLoadedClassList rather than -XX:+TraceClassLoadingPreorder. > Since the tool > became rather trivial I opted to write it in nashorn-compliant > javascript to streamline > the usage. > > Bug: https://bugs.openjdk.java.net/browse/JDK-8081589 > Webrev: http://cr.openjdk.java.net/~redestad/8081589/webrev.02 > > A number of undocumented/unused tests were removed and an outdated > README was > incorporated into the tool source itself, among other things > clarifying that the checksum > needs to be calculated and added to the classlist before checking it > into the workspace. > > I've asked around about how to go about adding tests for standalone > tools like these, but > didn't come up with a good answer. If someone insists I add a small > test to this I'd hope > there's some insight into how best to do that (shell-based jtreg test?) > > Thanks! > > /Claes From coleen.phillimore at oracle.com Thu Jul 2 00:11:34 2015 From: coleen.phillimore at oracle.com (Coleen Phillimore) Date: Wed, 01 Jul 2015 20:11:34 -0400 Subject: RFR: 8081589: Output of -XX:+TraceClassLoadingPreorder in JDK9 incompatible with MakeClasslist tool In-Reply-To: <5593FF3F.2040501@oracle.com> References: <5593FF3F.2040501@oracle.com> Message-ID: <559481B6.8060302@oracle.com> Does this mean that -XX:+TraceClassLoadingPreorder is not needed anymore? thanks, Coleen On 7/1/15 10:54 AM, Claes Redestad wrote: > Hi, > > please review this rewrite/cleanup of the MakeClasslist tool to > operate on the output of > -XX:DumpLoadedClassList rather than -XX:+TraceClassLoadingPreorder. > Since the tool > became rather trivial I opted to write it in nashorn-compliant > javascript to streamline > the usage. > > Bug: https://bugs.openjdk.java.net/browse/JDK-8081589 > Webrev: http://cr.openjdk.java.net/~redestad/8081589/webrev.02 > > A number of undocumented/unused tests were removed and an outdated > README was > incorporated into the tool source itself, among other things > clarifying that the checksum > needs to be calculated and added to the classlist before checking it > into the workspace. > > I've asked around about how to go about adding tests for standalone > tools like these, but > didn't come up with a good answer. If someone insists I add a small > test to this I'd hope > there's some insight into how best to do that (shell-based jtreg test?) > > Thanks! > > /Claes From ioi.lam at oracle.com Thu Jul 2 00:15:03 2015 From: ioi.lam at oracle.com (Ioi Lam) Date: Wed, 01 Jul 2015 17:15:03 -0700 Subject: RFR: 8081589: Output of -XX:+TraceClassLoadingPreorder in JDK9 incompatible with MakeClasslist tool In-Reply-To: <559481B6.8060302@oracle.com> References: <5593FF3F.2040501@oracle.com> <559481B6.8060302@oracle.com> Message-ID: <55948287.9090808@oracle.com> I still use it for other class loading analysis. -XX:+TraceClassLoading always prints the super class first, before printing the sub class. -XX:+TraceClassLoadingPreorder is the only way to see whether the super class or the sub class was requested first. - Ioi On 7/1/15 5:11 PM, Coleen Phillimore wrote: > > Does this mean that -XX:+TraceClassLoadingPreorder is not needed anymore? > thanks, > Coleen > > On 7/1/15 10:54 AM, Claes Redestad wrote: >> Hi, >> >> please review this rewrite/cleanup of the MakeClasslist tool to >> operate on the output of >> -XX:DumpLoadedClassList rather than -XX:+TraceClassLoadingPreorder. >> Since the tool >> became rather trivial I opted to write it in nashorn-compliant >> javascript to streamline >> the usage. >> >> Bug: https://bugs.openjdk.java.net/browse/JDK-8081589 >> Webrev: http://cr.openjdk.java.net/~redestad/8081589/webrev.02 >> >> A number of undocumented/unused tests were removed and an outdated >> README was >> incorporated into the tool source itself, among other things >> clarifying that the checksum >> needs to be calculated and added to the classlist before checking it >> into the workspace. >> >> I've asked around about how to go about adding tests for standalone >> tools like these, but >> didn't come up with a good answer. If someone insists I add a small >> test to this I'd hope >> there's some insight into how best to do that (shell-based jtreg test?) >> >> Thanks! >> >> /Claes > From david.holmes at oracle.com Thu Jul 2 03:09:06 2015 From: david.holmes at oracle.com (David Holmes) Date: Thu, 2 Jul 2015 13:09:06 +1000 Subject: RFR (S): 8129786: Buffer overrun when passing long not existing option in JDK 9 In-Reply-To: <5594179D.7030607@oracle.com> References: <5593E1C4.8020702@oracle.com> <5593EFFE.10302@oracle.com> <5594179D.7030607@oracle.com> Message-ID: <5594AB52.1090109@oracle.com> Hi Dmitry, Looks good to me. If you prepare the changeset and send it to me I'll do the JPRT submit for you. Thanks, David On 2/07/2015 2:38 AM, Dmitry Dmitriev wrote: > Hello Dan, > > Thank you for review! Updated webrev: > http://cr.openjdk.java.net/~ddmitriev/8129786/webrev.01/ > > Please see my comments inline. > > Regards, > Dmitry > > On 01.07.2015 16:49, Daniel D. Daugherty wrote: >> > Webrev: http://cr.openjdk.java.net/~ddmitriev/8129786/webrev.00/ >> >> src/share/vm/runtime/arguments.cpp >> L840: if (arg_len <= BUFLEN) { >> Please add a comment. Perhaps: >> >> // Only make the obsolete check for valid arguments. > Done! >> >> L843: strncpy(stripped_argname, argname, arg_len); >> L844: stripped_argname[arg_len] = '\0'; //strncpy doesn't null >> terminate. >> This is not due to your change but this comment isn't quite >> right. >> Perhaps: >> >> stripped_argname[arg_len] = '\0'; // strncpy may not null >> terminate. >> >> strncpy() null terminates if the length of 'argname' is >> less than arg_len. Also added one more space after ';' >> and added a space after '//'. > Done! >> >> L847: char version[256]; >> Can you change this '256' to BUFLEN+1 also? > I prefer to leave it as is, because there are no relationship between > 'version' and BUFLEN. BUFLEN is used for parsing options, thus I use it > for stripped_argname. But I think it will be better not to use it for > 'version'. > >> >> test/runtime/CommandLine/TestLongUnrecognizedVMOption.java >> L27: * @summary Verify that JVM correctly process very long >> unregnized VM option >> Typo: 'process' -> 'processes' >> Typo: 'unregnized' -> 'unrecognized' >> > Done! >> L29: * @modules java.management >> Why this module? > I got this dependency from script which used to find dependencies of > test code. >> >> L49: extra blank line at the end; jcheck may not like this >> > Done! >> Thumbs up. I don't need to see another webrev if you >> decide to fix these minor nits. >> >> Dan >> >> >> On 7/1/15 6:49 AM, Dmitry Dmitriev wrote: >>> Hello, >>> >>> Please review this small fix and new test. Also, I need a sponsor for >>> this fix, who can push it. >>> >>> In this fix logic for stripped_argname was put into "if (arg_len <= >>> BUFLEN)" statement. stripped_argname is used only to check is option >>> is newly obsolete. Since valid VM option should be not bigger than >>> 255 characters(BUFLEN value), then obsolete_jvm_flags contains only >>> options with strlen <= BUFLEN. >>> >>> Webrev: http://cr.openjdk.java.net/~ddmitriev/8129786/webrev.00/ >>> >>> JBS: https://bugs.openjdk.java.net/browse/JDK-8129786 >>> Tested: JPRT(with new test), hotspot all & vm.quick >>> >>> Thanks, >>> Dmitry > From david.buck at oracle.com Thu Jul 2 10:46:37 2015 From: david.buck at oracle.com (david buck) Date: Thu, 02 Jul 2015 19:46:37 +0900 Subject: RFR [8u65]: 8072147: Preloading libjsig.dylib causes deadlock when signal() is called Message-ID: <5595168D.5050700@oracle.com> Hi! This is a request for review of the jdk8 backport of 8072147. As the gcc version used to build jdk8 does not directly support thread-local storage, I had to rewrite parts of the fix to use the pthreads thread-specific data API (pthread_(get/set)specific and friends). Hence the need for review, as opposed to simple approval. Bug: https://bugs.openjdk.java.net/browse/jdk-8072147 Webrev: http://cr.openjdk.java.net/~dbuck/8072147/webrev.jdk8.02/ JDK9 Changeset: http://hg.openjdk.java.net/jdk9/hs-rt/hotspot/rev/660fa1b69f63 Review thread for JDK9 fix: http://mail.openjdk.java.net/pipermail/hotspot-runtime-dev/2015-June/015282.html I have tested the fix both manually and via JPRT. Cheers, -Buck From daniel.daugherty at oracle.com Thu Jul 2 13:14:22 2015 From: daniel.daugherty at oracle.com (Daniel D. Daugherty) Date: Thu, 02 Jul 2015 07:14:22 -0600 Subject: RFR [8u65]: 8072147: Preloading libjsig.dylib causes deadlock when signal() is called In-Reply-To: <5595168D.5050700@oracle.com> References: <5595168D.5050700@oracle.com> Message-ID: <5595392E.6010306@oracle.com> > Webrev: http://cr.openjdk.java.net/~dbuck/8072147/webrev.jdk8.02/ src/os/bsd/vm/jsig.c No comments. Thumbs up. Thanks for including all the links for the JDK9 version. Made the review much easier. Dan On 7/2/15 4:46 AM, david buck wrote: > Hi! > > This is a request for review of the jdk8 backport of 8072147. As the > gcc version used to build jdk8 does not directly support thread-local > storage, I had to rewrite parts of the fix to use the pthreads > thread-specific data API (pthread_(get/set)specific and friends). > Hence the need for review, as opposed to simple approval. > > Bug: https://bugs.openjdk.java.net/browse/jdk-8072147 > Webrev: http://cr.openjdk.java.net/~dbuck/8072147/webrev.jdk8.02/ > JDK9 Changeset: > http://hg.openjdk.java.net/jdk9/hs-rt/hotspot/rev/660fa1b69f63 > Review thread for JDK9 fix: > http://mail.openjdk.java.net/pipermail/hotspot-runtime-dev/2015-June/015282.html > > I have tested the fix both manually and via JPRT. > > Cheers, > -Buck From david.holmes at oracle.com Thu Jul 2 13:22:25 2015 From: david.holmes at oracle.com (David Holmes) Date: Thu, 2 Jul 2015 23:22:25 +1000 Subject: RFR [8u65]: 8072147: Preloading libjsig.dylib causes deadlock when signal() is called In-Reply-To: <5595168D.5050700@oracle.com> References: <5595168D.5050700@oracle.com> Message-ID: <55953B11.8020903@oracle.com> Hi David, On 2/07/2015 8:46 PM, david buck wrote: > Hi! > > This is a request for review of the jdk8 backport of 8072147. As the gcc > version used to build jdk8 does not directly support thread-local > storage, I had to rewrite parts of the fix to use the pthreads > thread-specific data API (pthread_(get/set)specific and friends). Hence > the need for review, as opposed to simple approval. > > Bug: https://bugs.openjdk.java.net/browse/jdk-8072147 > Webrev: http://cr.openjdk.java.net/~dbuck/8072147/webrev.jdk8.02/ > JDK9 Changeset: > http://hg.openjdk.java.net/jdk9/hs-rt/hotspot/rev/660fa1b69f63 > Review thread for JDK9 fix: > http://mail.openjdk.java.net/pipermail/hotspot-runtime-dev/2015-June/015282.html > > > I have tested the fix both manually and via JPRT. This looks good to me. Note current pushes to 8u-dev are being flagged for 8u66 not 8u65. :) Thanks, David > Cheers, > -Buck From karen.kinnear at oracle.com Thu Jul 2 13:47:45 2015 From: karen.kinnear at oracle.com (Karen Kinnear) Date: Thu, 2 Jul 2015 09:47:45 -0400 Subject: RFR [8u65]: 8072147: Preloading libjsig.dylib causes deadlock when signal() is called In-Reply-To: <5595168D.5050700@oracle.com> References: <5595168D.5050700@oracle.com> Message-ID: <0F61DCD5-1CE3-4322-A6C0-2D137105FA07@oracle.com> David, Looks good. Thank you for the check_status macro, that makes the code much easier to read. And I appreciate you checking for system call errors. Thank you for manually running the runtime signal tests before we have fixed the blocking bugs for them. thanks, Karen On Jul 2, 2015, at 6:46 AM, david buck wrote: > Hi! > > This is a request for review of the jdk8 backport of 8072147. As the gcc version used to build jdk8 does not directly support thread-local storage, I had to rewrite parts of the fix to use the pthreads thread-specific data API (pthread_(get/set)specific and friends). Hence the need for review, as opposed to simple approval. > > Bug: https://bugs.openjdk.java.net/browse/jdk-8072147 > Webrev: http://cr.openjdk.java.net/~dbuck/8072147/webrev.jdk8.02/ > JDK9 Changeset: http://hg.openjdk.java.net/jdk9/hs-rt/hotspot/rev/660fa1b69f63 > Review thread for JDK9 fix: http://mail.openjdk.java.net/pipermail/hotspot-runtime-dev/2015-June/015282.html > > I have tested the fix both manually and via JPRT. > > Cheers, > -Buck From claes.redestad at oracle.com Thu Jul 2 14:12:10 2015 From: claes.redestad at oracle.com (Claes Redestad) Date: Thu, 02 Jul 2015 16:12:10 +0200 Subject: RFR: 8081589: Output of -XX:+TraceClassLoadingPreorder in JDK9 incompatible with MakeClasslist tool In-Reply-To: <55945116.20102@oracle.com> References: <5593FF3F.2040501@oracle.com> <55945116.20102@oracle.com> Message-ID: <559546BA.30701@oracle.com> Hi Ioi, On 2015-07-01 22:44, Ioi Lam wrote: > Claes, > > The changes look good to me. It's nice to replace a large amount of > Java code with a simple script. > > How about doing the line splitting like this: > > var classes = readFully(arg).replace(/[\r\n]+/g, "\n").split("\n") > > That way it will be able to handle an input file that have a mixture > of newline characters (e.g., if someone has edited a Unix text file on > a Windows editor). Sure thing, this also makes the script more concise: http://cr.openjdk.java.net/~redestad/8081589/webrev.03/ Thanks! /Claes > > Thanks > - Ioi > > On 7/1/15 7:54 AM, Claes Redestad wrote: >> Hi, >> >> please review this rewrite/cleanup of the MakeClasslist tool to >> operate on the output of >> -XX:DumpLoadedClassList rather than -XX:+TraceClassLoadingPreorder. >> Since the tool >> became rather trivial I opted to write it in nashorn-compliant >> javascript to streamline >> the usage. >> >> Bug: https://bugs.openjdk.java.net/browse/JDK-8081589 >> Webrev: http://cr.openjdk.java.net/~redestad/8081589/webrev.02 >> >> A number of undocumented/unused tests were removed and an outdated >> README was >> incorporated into the tool source itself, among other things >> clarifying that the checksum >> needs to be calculated and added to the classlist before checking it >> into the workspace. >> >> I've asked around about how to go about adding tests for standalone >> tools like these, but >> didn't come up with a good answer. If someone insists I add a small >> test to this I'd hope >> there's some insight into how best to do that (shell-based jtreg test?) >> >> Thanks! >> >> /Claes > From ioi.lam at oracle.com Thu Jul 2 18:07:58 2015 From: ioi.lam at oracle.com (Ioi Lam) Date: Thu, 02 Jul 2015 11:07:58 -0700 Subject: RFR: 8081589: Output of -XX:+TraceClassLoadingPreorder in JDK9 incompatible with MakeClasslist tool In-Reply-To: <559546BA.30701@oracle.com> References: <5593FF3F.2040501@oracle.com> <55945116.20102@oracle.com> <559546BA.30701@oracle.com> Message-ID: <55957DFE.2050300@oracle.com> Looks good! Thanks - Ioi On 7/2/15 7:12 AM, Claes Redestad wrote: > Hi Ioi, > > On 2015-07-01 22:44, Ioi Lam wrote: >> Claes, >> >> The changes look good to me. It's nice to replace a large amount of >> Java code with a simple script. >> >> How about doing the line splitting like this: >> >> var classes = readFully(arg).replace(/[\r\n]+/g, "\n").split("\n") >> >> That way it will be able to handle an input file that have a mixture >> of newline characters (e.g., if someone has edited a Unix text file >> on a Windows editor). > > Sure thing, this also makes the script more concise: > > http://cr.openjdk.java.net/~redestad/8081589/webrev.03/ > > Thanks! > > /Claes > >> >> Thanks >> - Ioi >> >> On 7/1/15 7:54 AM, Claes Redestad wrote: >>> Hi, >>> >>> please review this rewrite/cleanup of the MakeClasslist tool to >>> operate on the output of >>> -XX:DumpLoadedClassList rather than -XX:+TraceClassLoadingPreorder. >>> Since the tool >>> became rather trivial I opted to write it in nashorn-compliant >>> javascript to streamline >>> the usage. >>> >>> Bug: https://bugs.openjdk.java.net/browse/JDK-8081589 >>> Webrev: http://cr.openjdk.java.net/~redestad/8081589/webrev.02 >>> >>> A number of undocumented/unused tests were removed and an outdated >>> README was >>> incorporated into the tool source itself, among other things >>> clarifying that the checksum >>> needs to be calculated and added to the classlist before checking it >>> into the workspace. >>> >>> I've asked around about how to go about adding tests for standalone >>> tools like these, but >>> didn't come up with a good answer. If someone insists I add a small >>> test to this I'd hope >>> there's some insight into how best to do that (shell-based jtreg test?) >>> >>> Thanks! >>> >>> /Claes >> > From ioi.lam at oracle.com Thu Jul 2 20:58:48 2015 From: ioi.lam at oracle.com (Ioi Lam) Date: Thu, 02 Jul 2015 13:58:48 -0700 Subject: RFR (S) 8129355 - [TESTBUG] FragmentMetaspaceSimple.java fails with ClassNotFoundException: test.Empty Message-ID: <5595A608.2060307@oracle.com> Please review a small fix: http://cr.openjdk.java.net/~iklam/8129355-frag-metaspace-testbug-v1/ Bug: [TESTBUG] runtime FragmentMetaspaceSimple.java fails with java.lang.ClassNotFoundException: test.Empty https://bugs.openjdk.java.net/browse/JDK-8129355 Cause of failure: The test case is intended to stress the HotSpot metaspace allocation code, for 80 seconds, by repeatedly loading many instances of a simple class named "test.Empty". In the failing version, each class is loaded by a new URLClassLoader instance. So each time when a class is loaded, the file system is accessed to read the bytes of the class. So inadvertently, this test has also become a stress test for the file system. On some of our embedded test machines, the file system may be misbehaving and would fail to read the Empty.class file on rare occasions. This causes the test failure reported by 8129355. Summary of fix: My fix is to not to use URLClassLoader. Instead, read Empty.class only once, and store the contents into a byte buffer. This buffer will be used to define every instance of the Empty class. While this fix does not address the root cause of the failure (file system issue in some test machines), it will reduce the noise in our nightly tests. Also, now that the file system is accessed much less frequently, we can run many more iterations so we can stress the metaspace more, which is the real intent of this test. Now it runs for about 80 million iterations on a fast PC and 5 million iterations on an embedded box. Tests: Since the new version causes more stress in metaspace, I wanted to make sure it doesn't cause any new failures related to metaspace. So I used the "RBT" tool to run the test 50 times on 8 platforms: linux-arm64, linux-i586, linux-x64, macosx-x64, solaris-sparcv9, solaris-x64, windows-i586, windows-x64 for both product and fast debug builds. I also ran the test on 32-bit ARM for 12 hours (700+ runs) and saw no failure. Thanks - Ioi From mikhailo.seledtsov at oracle.com Thu Jul 2 21:36:58 2015 From: mikhailo.seledtsov at oracle.com (Mikhailo Seledtsov) Date: Thu, 02 Jul 2015 14:36:58 -0700 Subject: RFR (S) 8129355 - [TESTBUG] FragmentMetaspaceSimple.java fails with ClassNotFoundException: test.Empty In-Reply-To: <5595A608.2060307@oracle.com> References: <5595A608.2060307@oracle.com> Message-ID: <5595AEFA.6020508@oracle.com> Hi Ioi, Changes look good to me. This is a great optimization idea for this testcase, to load class from buffer instead of a file. And thank you for thorough testing of the fix. Misha On 7/2/2015 1:58 PM, Ioi Lam wrote: > Please review a small fix: > > http://cr.openjdk.java.net/~iklam/8129355-frag-metaspace-testbug-v1/ > > Bug: [TESTBUG] runtime FragmentMetaspaceSimple.java fails with > java.lang.ClassNotFoundException: test.Empty > > https://bugs.openjdk.java.net/browse/JDK-8129355 > > Cause of failure: > > The test case is intended to stress the HotSpot metaspace allocation > code, for 80 seconds, > by repeatedly loading many instances of a simple class named > "test.Empty". > > In the failing version, each class is loaded by a new > URLClassLoader instance. So each time > when a class is loaded, the file system is accessed to read the > bytes of the class. So > inadvertently, this test has also become a stress test for the > file system. > > On some of our embedded test machines, the file system may be > misbehaving and would fail > to read the Empty.class file on rare occasions. This causes the > test failure reported > by 8129355. > > Summary of fix: > > My fix is to not to use URLClassLoader. Instead, read Empty.class > only once, and store the > contents into a byte buffer. This buffer will be used to define > every instance of the Empty > class. > > While this fix does not address the root cause of the failure > (file system issue in some > test machines), it will reduce the noise in our nightly tests. > > Also, now that the file system is accessed much less frequently, > we can run many more iterations > so we can stress the metaspace more, which is the real intent of > this test. > > Now it runs for about 80 million iterations on a fast PC and 5 > million iterations on an > embedded box. > > Tests: > > Since the new version causes more stress in metaspace, I wanted to > make sure it doesn't cause > any new failures related to metaspace. So I used the "RBT" tool to > run the test 50 times > on 8 platforms: > > linux-arm64, linux-i586, linux-x64, macosx-x64, > solaris-sparcv9, solaris-x64, windows-i586, windows-x64 > > for both product and fast debug builds. I also ran the test on > 32-bit ARM for 12 hours (700+ runs) > and saw no failure. > > Thanks > - Ioi From coleen.phillimore at oracle.com Fri Jul 3 00:22:36 2015 From: coleen.phillimore at oracle.com (Coleen Phillimore) Date: Thu, 2 Jul 2015 20:22:36 -0400 Subject: RFR (S) 8129355 - [TESTBUG] FragmentMetaspaceSimple.java fails with ClassNotFoundException: test.Empty In-Reply-To: <5595AEFA.6020508@oracle.com> References: <5595A608.2060307@oracle.com> <5595AEFA.6020508@oracle.com> Message-ID: <2A5171B1-6D26-4ECB-9916-F47C04D183A4@oracle.com> This looks like a good fix to me also. Coleen Sent from my iPhone > On Jul 2, 2015, at 5:36 PM, Mikhailo Seledtsov wrote: > > Hi Ioi, > > Changes look good to me. > This is a great optimization idea for this testcase, to load class from buffer instead of a file. > > And thank you for thorough testing of the fix. > > Misha > >> On 7/2/2015 1:58 PM, Ioi Lam wrote: >> Please review a small fix: >> >> http://cr.openjdk.java.net/~iklam/8129355-frag-metaspace-testbug-v1/ >> >> Bug: [TESTBUG] runtime FragmentMetaspaceSimple.java fails with java.lang.ClassNotFoundException: test.Empty >> >> https://bugs.openjdk.java.net/browse/JDK-8129355 >> >> Cause of failure: >> >> The test case is intended to stress the HotSpot metaspace allocation code, for 80 seconds, >> by repeatedly loading many instances of a simple class named "test.Empty". >> >> In the failing version, each class is loaded by a new URLClassLoader instance. So each time >> when a class is loaded, the file system is accessed to read the bytes of the class. So >> inadvertently, this test has also become a stress test for the file system. >> >> On some of our embedded test machines, the file system may be misbehaving and would fail >> to read the Empty.class file on rare occasions. This causes the test failure reported >> by 8129355. >> >> Summary of fix: >> >> My fix is to not to use URLClassLoader. Instead, read Empty.class only once, and store the >> contents into a byte buffer. This buffer will be used to define every instance of the Empty >> class. >> >> While this fix does not address the root cause of the failure (file system issue in some >> test machines), it will reduce the noise in our nightly tests. >> >> Also, now that the file system is accessed much less frequently, we can run many more iterations >> so we can stress the metaspace more, which is the real intent of this test. >> >> Now it runs for about 80 million iterations on a fast PC and 5 million iterations on an >> embedded box. >> >> Tests: >> >> Since the new version causes more stress in metaspace, I wanted to make sure it doesn't cause >> any new failures related to metaspace. So I used the "RBT" tool to run the test 50 times >> on 8 platforms: >> >> linux-arm64, linux-i586, linux-x64, macosx-x64, >> solaris-sparcv9, solaris-x64, windows-i586, windows-x64 >> >> for both product and fast debug builds. I also ran the test on 32-bit ARM for 12 hours (700+ runs) >> and saw no failure. >> >> Thanks >> - Ioi > From alexander.vorobyev at oracle.com Fri Jul 3 16:12:45 2015 From: alexander.vorobyev at oracle.com (alexander vorobyev) Date: Fri, 03 Jul 2015 19:12:45 +0300 Subject: [8u65] Request for approval: backport of JDK-8007890 In-Reply-To: <558F1F4B.7040706@oracle.com> References: <542E8041.1010101@oracle.com> <558D5430.7040209@oracle.com> <558F1F4B.7040706@oracle.com> Message-ID: <5596B47D.8090104@oracle.com> Hi David, It is too late for 8u60, I guess. So I decided to fix it in 8u65. And in this case it should be jdk8u-cpu repository. Maybe it is possible to target to 8u66? To which repository can I push it in this case (considering that jdk8u/hs-dev is not accepting any change)? Thanks On 28-Jun-15 1:10 AM, David Holmes wrote: > Hi Alexander, > > Why is this targeted to 8u65 and where do you propose to push it? > jdk8u/hs-dev is not accepting any changes at the moment. > > Thanks, > David > > On 26/06/2015 11:31 PM, alexander vorobyev wrote: >> >> Hi All, >> >> I would like to backport fix for JDK-8007890 to 8u65. >> >> Bug id:https://bugs.openjdk.java.net/browse/JDK-8007890 >> Webrev:http://cr.openjdk.java.net/~ctornqvi/webrev/8007890/webrev.00/ >> >> Changeset:http://hg.openjdk.java.net/jdk9/jdk9/hotspot/rev/e865e9584e0e >> Review thread for original >> fix:http://mail.openjdk.java.net/pipermail/hotspot-runtime-dev/2014-March/011228.html >> >> >> >> testing: jprt >> >> Thanks, >> Alexander >> >> >> From david.holmes at oracle.com Fri Jul 3 23:27:38 2015 From: david.holmes at oracle.com (David Holmes) Date: Sat, 4 Jul 2015 09:27:38 +1000 Subject: [8u65] Request for approval: backport of JDK-8007890 In-Reply-To: <5596B47D.8090104@oracle.com> References: <542E8041.1010101@oracle.com> <558D5430.7040209@oracle.com> <558F1F4B.7040706@oracle.com> <5596B47D.8090104@oracle.com> Message-ID: <55971A6A.9060205@oracle.com> On 4/07/2015 2:12 AM, alexander vorobyev wrote: > Hi David, > > It is too late for 8u60, I guess. So I decided to fix it in 8u65. And in > this case it should be jdk8u-cpu repository. > > Maybe it is possible to target to 8u66? To which repository can I push > it in this case (considering that jdk8u/hs-dev is not accepting any > change)? jdk8u/hs-dev is now accepting changes for 8u66. Cheers, David > Thanks > > > On 28-Jun-15 1:10 AM, David Holmes wrote: >> Hi Alexander, >> >> Why is this targeted to 8u65 and where do you propose to push it? >> jdk8u/hs-dev is not accepting any changes at the moment. >> >> Thanks, >> David >> >> On 26/06/2015 11:31 PM, alexander vorobyev wrote: >>> >>> Hi All, >>> >>> I would like to backport fix for JDK-8007890 to 8u65. >>> >>> Bug id:https://bugs.openjdk.java.net/browse/JDK-8007890 >>> Webrev:http://cr.openjdk.java.net/~ctornqvi/webrev/8007890/webrev.00/ >>> >>> Changeset:http://hg.openjdk.java.net/jdk9/jdk9/hotspot/rev/e865e9584e0e >>> Review thread for original >>> fix:http://mail.openjdk.java.net/pipermail/hotspot-runtime-dev/2014-March/011228.html >>> >>> >>> >>> testing: jprt >>> >>> Thanks, >>> Alexander >>> >>> >>> > From daniel.daugherty at oracle.com Sat Jul 4 00:11:28 2015 From: daniel.daugherty at oracle.com (Daniel D. Daugherty) Date: Fri, 03 Jul 2015 18:11:28 -0600 Subject: RFR(S) Contended Locking fast notify bucket (8075171) In-Reply-To: <555A4678.7020308@oracle.com> References: <555A4678.7020308@oracle.com> Message-ID: <559724B0.6000507@oracle.com> Greetings, I've updated the patch for Contended Locking fast notify bucket based on David H's and Karen's comments. This work is being tracked by the following bug ID: JDK-8075171 Contended Locking fast notify bucket https://bugs.openjdk.java.net/browse/JDK-8075171 Here is the webrev URL: http://cr.openjdk.java.net/~dcubed/8075171-webrev/1-jdk9-hs-rt/ Here is the JEP link: https://bugs.openjdk.java.net/browse/JDK-8046133 Testing: - RBT vm.quick batches (in process) - JPRT test jobs - MonitorWaitNotifyStresser micro-benchmark (in process) - CallTimerGrid stress testing (in process) The changes in this round are in only four of the files: src/share/vm/opto/runtime.cpp - deleted comment about hashCode() that belongs in a different bucket src/share/vm/runtime/objectMonitor.cpp - add MAX_RECHECK_INTERVAL define for use in ObjectMonitor::EnterI() - cleanup recheck interval code - ObjectMonitor::INotify() return type is now "void" - delete duplicate comments, clarify/rewrite some comments src/share/vm/runtime/objectMonitor.hpp - ObjectMonitor::INotify() return type is now "void" src/share/vm/runtime/synchronizer.cpp - clarify/rewrite comments, add additional comments - cleanup variables in ObjectSynchronizer::quick_notify - refactor loop to be more clear - delete unused enum MaximumRecheckInterval The easiest way to review the delta is to download the two patch files and compare them in something like jfilemerge: http://cr.openjdk.java.net/~dcubed/8075171-webrev/0-jdk9-hs-rt/hotspot.patch http://cr.openjdk.java.net/~dcubed/8075171-webrev/1-jdk9-hs-rt/hotspot.patch Dan On 5/18/15 2:07 PM, Daniel D. Daugherty wrote: > Greetings, > > I have the Contended Locking fast notify bucket ready for review. > > The code changes in this bucket are the final piece in the triad > of {fast-enter, fast-exit, fast-notify} changes. There are no > macro assembler changes in this bucket (yeah!), but there are > code review cleanups motivated by comments on other buckets, e.g., > changing variables like 'Tally' -> 'tally'. > > This work is being tracked by the following bug ID: > > JDK-8075171 Contended Locking fast notify bucket > https://bugs.openjdk.java.net/browse/JDK-8075171 > > Here is the webrev URL: > > http://cr.openjdk.java.net/~dcubed/8075171-webrev/0-jdk9-hs-rt/ > > Here is the JEP link: > > https://bugs.openjdk.java.net/browse/JDK-8046133 > > Testing: > > - Aurora Adhoc RT/SVC baseline batch > - JPRT test jobs > - MonitorWaitNotifyStresser micro-benchmark (in process) > - CallTimerGrid stress testing (in process) > - Aurora performance testing: > - out of the box for the "promotion" and 32-bit server configs > - heavy weight monitors for the "promotion" and 32-bit server configs > (-XX:-UseBiasedLocking -XX:+UseHeavyMonitors) > (in process) > > The hang somehow introduced by the "fast enter" bucket is still > unresolved, but progress is being made. That work is being tracked > by the following bug: > > JDK-8077392 Stream fork/join tasks occasionally fail to complete > https://bugs.openjdk.java.net/browse/JDK-8077392 > > You'll see a change that re-enables the "fast enter" bucket in this > webrev, but that change will not be pushed when we're done with the > review of this bucket unless JDK-8077392 is resolved. > > Thanks, in advance, for any comments, questions or suggestions. > > Gory details about the changes are below... > > Dan > > > 8075171 summary of changes: > > src/share/vm/classfile/vmSymbols.hpp > - Add do_intrinsic() entries for _notify and _notifyAll > > src/share/vm/opto/library_call.cpp > - Add optional inline_notify() that is controlled by new > '-XX:[+-]InlineNotify' option > > src/share/vm/opto/runtime.cpp > src/share/vm/opto/runtime.hpp > - Add OptoRuntime::monitor_notify_C() and > OptoRuntime::monitor_notifyAll_C() functions to support > the new "fast notify" code paths > - Add new OptoRuntime::monitor_notify_Type() to support > the above two new functions > > src/share/vm/runtime/globals.hpp > - Add '-XX:[+-]InlineNotify' option; default option value is > enabled (true) > > src/share/vm/runtime/objectMonitor.cpp > src/share/vm/runtime/objectMonitor.hpp > - Refactor ObjectMonitor::notify() and ObjectMonitor::notifyAll() > into wrappers that call the new ObjectMonitor::INotify() > - Add new ObjectMonitor::INotify() to reduce code duplication > between "notify" and "notifyAll" code paths > > src/share/vm/runtime/sharedRuntime.cpp > - Temporarily re-enable the "fast enter" optimization in order > to do performance testing. JDK-8077392 is still unresolved, > but progress is being made. > > src/share/vm/runtime/synchronizer.cpp > src/share/vm/runtime/synchronizer.hpp > - Add ObjectSynchronizer::quick_notify() that implements the > new "fast notify" code paths > - The new code handles a couple of special cases where the > "notify" can be done without the heavy weight slow-path > (thread state transitions and other baggage) > > From daniel.daugherty at oracle.com Sat Jul 4 00:14:16 2015 From: daniel.daugherty at oracle.com (Daniel D. Daugherty) Date: Fri, 03 Jul 2015 18:14:16 -0600 Subject: RFR(S) 8077392 inspired thread dump improvements, comment, additions, new diagnostics (8130448) Message-ID: <55972558.6060905@oracle.com> Greetings, The hunt for the following bug: JDK-8077392 Stream fork/join tasks occasionally fail to complete and David C's work on the following bug: JDK-8069412 Locks need better debug-printing support have inspired additional thread dump improvements, comment additions to some Java monitor code and some new diagnostic options. This work is being tracked by the following bug ID: JDK-8130448 8077392 inspired thread dump improvements, comment additions, new diagnostics https://bugs.openjdk.java.net/browse/JDK-8130448 Here is the webrev URL: http://cr.openjdk.java.net/~dcubed/8130448-webrev/0-jdk9-hs-rt/ Testing: - RBT vm.quick batches (in process) - JPRT test jobs Thanks, in advance, for any comments, questions or suggestions. Gory details about the changes are below... Dan 8130448 summary of changes: src/cpu/x86/vm/macroAssembler_x86.cpp - comment additions for the assembly code src/share/vm/oops/markOop.cpp - has_monitor() has to be checked before is_locked() since the has_monitor() bits are a superset of the is_locked() bits - code style fixes src/share/vm/runtime/globals.hpp - add VerboseStackTrace diagnostic option - add GuaranteeOnMonitorMismatch diagnostic option - add JavaThreadExitReleasesMonitors product option; this is the Java equivalent of JNIDetachReleasesMonitors src/share/vm/runtime/objectMonitor.cpp - delete unused ObjectMonitor::try_enter() - fix assert wording src/share/vm/runtime/objectMonitor.hpp - delete unused ObjectMonitor::try_enter() src/share/vm/runtime/synchronizer.cpp - add GuaranteeOnMonitorMismatch support with some diagnostic output src/share/vm/runtime/thread.cpp - add JavaThreadExitReleasesMonitors support src/share/vm/runtime/vframe.cpp - clarify existing comments - add comments to clarify what "waiting on" means - add line to show when we are "waiting on", but there are no locals available (previously we were "waiting on" silently) - add support for "waiting to relock" which can happen for any of the monitors and not just the top monitor - switch mark->print_on() verbose output to new VerboseStackTrace switch; thread dumps are not enabled with a specific switch so the '-XX:+Verbose' model of being a modifier for another option does not fit From david.holmes at oracle.com Mon Jul 6 04:32:51 2015 From: david.holmes at oracle.com (David Holmes) Date: Mon, 6 Jul 2015 14:32:51 +1000 Subject: RFR(S) Contended Locking fast notify bucket (8075171) In-Reply-To: <559724B0.6000507@oracle.com> References: <555A4678.7020308@oracle.com> <559724B0.6000507@oracle.com> Message-ID: <559A04F3.3060702@oracle.com> Thanks Dan! No further comments from me. David On 4/07/2015 10:11 AM, Daniel D. Daugherty wrote: > Greetings, > > I've updated the patch for Contended Locking fast notify bucket > based on David H's and Karen's comments. > > This work is being tracked by the following bug ID: > > JDK-8075171 Contended Locking fast notify bucket > https://bugs.openjdk.java.net/browse/JDK-8075171 > > Here is the webrev URL: > > http://cr.openjdk.java.net/~dcubed/8075171-webrev/1-jdk9-hs-rt/ > > Here is the JEP link: > > https://bugs.openjdk.java.net/browse/JDK-8046133 > > Testing: > > - RBT vm.quick batches (in process) > - JPRT test jobs > - MonitorWaitNotifyStresser micro-benchmark (in process) > - CallTimerGrid stress testing (in process) > > > The changes in this round are in only four of the files: > > src/share/vm/opto/runtime.cpp > > - deleted comment about hashCode() that belongs in a different bucket > > src/share/vm/runtime/objectMonitor.cpp > > - add MAX_RECHECK_INTERVAL define for use in ObjectMonitor::EnterI() > - cleanup recheck interval code > - ObjectMonitor::INotify() return type is now "void" > - delete duplicate comments, clarify/rewrite some comments > > src/share/vm/runtime/objectMonitor.hpp > > - ObjectMonitor::INotify() return type is now "void" > > src/share/vm/runtime/synchronizer.cpp > > - clarify/rewrite comments, add additional comments > - cleanup variables in ObjectSynchronizer::quick_notify > - refactor loop to be more clear > - delete unused enum MaximumRecheckInterval > > The easiest way to review the delta is to download the two patch > files and compare them in something like jfilemerge: > > http://cr.openjdk.java.net/~dcubed/8075171-webrev/0-jdk9-hs-rt/hotspot.patch > > http://cr.openjdk.java.net/~dcubed/8075171-webrev/1-jdk9-hs-rt/hotspot.patch > > > Dan > > > On 5/18/15 2:07 PM, Daniel D. Daugherty wrote: >> Greetings, >> >> I have the Contended Locking fast notify bucket ready for review. >> >> The code changes in this bucket are the final piece in the triad >> of {fast-enter, fast-exit, fast-notify} changes. There are no >> macro assembler changes in this bucket (yeah!), but there are >> code review cleanups motivated by comments on other buckets, e.g., >> changing variables like 'Tally' -> 'tally'. >> >> This work is being tracked by the following bug ID: >> >> JDK-8075171 Contended Locking fast notify bucket >> https://bugs.openjdk.java.net/browse/JDK-8075171 >> >> Here is the webrev URL: >> >> http://cr.openjdk.java.net/~dcubed/8075171-webrev/0-jdk9-hs-rt/ >> >> Here is the JEP link: >> >> https://bugs.openjdk.java.net/browse/JDK-8046133 >> >> Testing: >> >> - Aurora Adhoc RT/SVC baseline batch >> - JPRT test jobs >> - MonitorWaitNotifyStresser micro-benchmark (in process) >> - CallTimerGrid stress testing (in process) >> - Aurora performance testing: >> - out of the box for the "promotion" and 32-bit server configs >> - heavy weight monitors for the "promotion" and 32-bit server configs >> (-XX:-UseBiasedLocking -XX:+UseHeavyMonitors) >> (in process) >> >> The hang somehow introduced by the "fast enter" bucket is still >> unresolved, but progress is being made. That work is being tracked >> by the following bug: >> >> JDK-8077392 Stream fork/join tasks occasionally fail to complete >> https://bugs.openjdk.java.net/browse/JDK-8077392 >> >> You'll see a change that re-enables the "fast enter" bucket in this >> webrev, but that change will not be pushed when we're done with the >> review of this bucket unless JDK-8077392 is resolved. >> >> Thanks, in advance, for any comments, questions or suggestions. >> >> Gory details about the changes are below... >> >> Dan >> >> >> 8075171 summary of changes: >> >> src/share/vm/classfile/vmSymbols.hpp >> - Add do_intrinsic() entries for _notify and _notifyAll >> >> src/share/vm/opto/library_call.cpp >> - Add optional inline_notify() that is controlled by new >> '-XX:[+-]InlineNotify' option >> >> src/share/vm/opto/runtime.cpp >> src/share/vm/opto/runtime.hpp >> - Add OptoRuntime::monitor_notify_C() and >> OptoRuntime::monitor_notifyAll_C() functions to support >> the new "fast notify" code paths >> - Add new OptoRuntime::monitor_notify_Type() to support >> the above two new functions >> >> src/share/vm/runtime/globals.hpp >> - Add '-XX:[+-]InlineNotify' option; default option value is >> enabled (true) >> >> src/share/vm/runtime/objectMonitor.cpp >> src/share/vm/runtime/objectMonitor.hpp >> - Refactor ObjectMonitor::notify() and ObjectMonitor::notifyAll() >> into wrappers that call the new ObjectMonitor::INotify() >> - Add new ObjectMonitor::INotify() to reduce code duplication >> between "notify" and "notifyAll" code paths >> >> src/share/vm/runtime/sharedRuntime.cpp >> - Temporarily re-enable the "fast enter" optimization in order >> to do performance testing. JDK-8077392 is still unresolved, >> but progress is being made. >> >> src/share/vm/runtime/synchronizer.cpp >> src/share/vm/runtime/synchronizer.hpp >> - Add ObjectSynchronizer::quick_notify() that implements the >> new "fast notify" code paths >> - The new code handles a couple of special cases where the >> "notify" can be done without the heavy weight slow-path >> (thread state transitions and other baggage) >> >> > From david.holmes at oracle.com Mon Jul 6 06:43:35 2015 From: david.holmes at oracle.com (David Holmes) Date: Mon, 6 Jul 2015 16:43:35 +1000 Subject: RFR(S) 8077392 inspired thread dump improvements, comment, additions, new diagnostics (8130448) In-Reply-To: <55972558.6060905@oracle.com> References: <55972558.6060905@oracle.com> Message-ID: <559A2397.2010409@oracle.com> Hi Dan, Metacomment: Could I suggest that in a RFR your subject line has the form : , rather than (bugid) - especially when the synopsis actually starts with a bug id :) Thanks. Mostly okay but some major concerns around the can of worms that JavaThreadExitReleasesMonitors opens up. On 4/07/2015 10:14 AM, Daniel D. Daugherty wrote: > Greetings, > > The hunt for the following bug: > > JDK-8077392 Stream fork/join tasks occasionally fail to complete > > and David C's work on the following bug: > > JDK-8069412 Locks need better debug-printing support > > have inspired additional thread dump improvements, comment additions > to some Java monitor code and some new diagnostic options. src/cpu/x86/vm/macroAssembler_x86.cpp 1821 // update _owner from from BasicLock to thread Typo: from from 2091 // the placeholder value. If that didn't work, then another 2092 // grabbed the lock so we're done (and exit was a success). another -> another thread ? 2201 // If that didn't work, then another grabbed the lock 2202 // so we're done (and exit was a success). another -> another thread ? --- src/share/vm/oops/markOop.cpp 40 st->print("NULL"); // this should not happen Shouldn't that be an assert or guarantee in that case? Or at a minimum print something like: "NULL (but you should never see this!)" 42 BasicLock * bl = (BasicLock *) mon->owner(); What information has told us this is a BasicLock* not a Thread* ? But as all you do is print bl why not just p2i(mon->owner()) ? --- src/share/vm/runtime/globals.hpp JavaThreadExitReleasesMonitors has me perplexed. The JNI DetachThread case seems to be a concession to badly written code that fails to release locks on error paths. The equivalent for a Java thread would again involve lock acquisition via JNI. But I don't recall ever seeing a bug report or RFE related to this. What seems to have motivated this new flag is the potential for a broken VM to actually leave the monitor locked (e.g. because compiled code failed to do the unlock on all paths). To address that I'd be inclined to simply have a guarantee in the Java thread exit path, rather than a flag to do the clean up and another flag to control a guarantee. I don't think two new command-line options (has this gone through CCC yet?) are justified. Also note that allowing for JVM induced missing unlocks is something that can affect JNI attached threads as well as regular Java threads. I'll take this up in discussing thread.cpp below. That aside, the comment, which was modelled on the JNI DetachThread variant, does not really work in this case: 2801 "JavaThread exit() releases monitors owned by thread") \ JavaThread is not a programming concept but an internal JVM abstraction. I would suggest something like: "Java thread termination releases monitors unexpectedly still owned by thread" --- src/share/vm/runtime/objectMonitor.cpp src/share/vm/runtime/objectMonitor.hpp No comments --- src/share/vm/runtime/synchronizer.cpp If we find the unexpected locked monitor it would be useful to see more Java level information about the Thread (in the non-detaching case) and the object that is locked. --- src/share/vm/runtime/thread.cpp As noted previously JNI attached threads can also be affected by JVM induced locking bugs. So the comment block: 1804 // 6282335 JNI DetachCurrentThread spec states that all Java monitors 1805 // held by this thread must be released. A detach operation must only 1806 // get here if there are no Java frames on the stack. Therefore, any 1807 // owned monitors at this point MUST be JNI-acquired monitors which are 1808 // pre-inflated and in the monitor cache. is not strictly correct as it is presuming a correctly operating JVM. Further the logic now applied: 1816 if ((exit_type == jni_detach && JNIDetachReleasesMonitors) || 1817 JavaThreadExitReleasesMonitors) { is also not "correct" because if we have JavaThreadExitReleasesMonitors true while JNIDetachReleasesMonitors is false, we will in fact release any JNI acquired monitors because we can't make the distinction. Given we can't make the distinction I don't see any way for these separate flags to actually work well together. As I said above I'm more inclined to just add a guarantee to the non-detach case, than add two new flags. (Even though this means there won't be detection for such bugs when JNI attached threads encounter them - including the main thread :( ). As I said this has me perplexed. :( --- src/share/vm/runtime/vframe.cpp 170 // It would be nice to distinguish between "waiting on" and 171 // "waited on". Currently, "waiting on" here with a 172 // java.lang.Thread.State == "WAITING (on object monitor)" 173 // earlier in the output means that the monitor has not yet been 174 // notified and java.lang.Thread.State == "BLOCKED (on object 175 // monitor)" earlier in the output means that the monitor has 176 // been notified and the thread is blocked on reentry. That's a very long sentence that can be quite difficult to parse and could probably be reworded to describe how the output should be interpreted eg: // If earlier in the output we reported java.lang.Thread.State == // "WAITING (on object monitor)" and now we report "waited on", then // we are still waiting for notification [or timeout?]. Otherwise if // we earlier reported java.lang.Thread.State == "BLOCKED (on object // monitor)", then we are actually waiting to reacquire the monitor // lock. At this level we can't distinguish the two cases to report // "waited on" rather than "waiting on" for the second case. I wonder if we can prod deeper into VM state to try and make the distinction? 184 } else { 185 st->print_cr("\t- %s ", wait_state); The concept of "locals" is confusing here. Isn't the "local" in this case just the object that we have waited upon? In which case we should say "no object reference available". Though I would have thought/hoped there must be a way to find the object reference even in a compiled frame? 195 // Print out all monitors that we have locked, are trying to lock 196 // or are trying to relock after a wait(). that makes it sound like there are three cases when really a "relock" is just a specific case of lock. I would suggest: // Print out all monitors that we have locked, or are trying to // lock, including re-locking when returning from a wait(). 252 lock_state = "waiting to relock"; I prefer "waiting to re-lock in wait()", if that isn't too long. Otherwise "relock" needs to be a concept people are familiar with. 260 if (VerboseStackTrace && mark != NULL) { 261 st->print("\t- lockbits="); 262 mark->print_on(st); This really doesn't seem to warrant a new diagnostic flag, regardless of whether we think applying -XX:+Verbose is a good fit or not. Thanks, David ------- > This work is being tracked by the following bug ID: > > JDK-8130448 8077392 inspired thread dump improvements, comment > additions, new diagnostics > https://bugs.openjdk.java.net/browse/JDK-8130448 > > Here is the webrev URL: > > http://cr.openjdk.java.net/~dcubed/8130448-webrev/0-jdk9-hs-rt/ > > Testing: > > - RBT vm.quick batches (in process) > - JPRT test jobs > > Thanks, in advance, for any comments, questions or suggestions. > > Gory details about the changes are below... > > Dan > > 8130448 summary of changes: > > src/cpu/x86/vm/macroAssembler_x86.cpp > - comment additions for the assembly code > > src/share/vm/oops/markOop.cpp > - has_monitor() has to be checked before is_locked() since > the has_monitor() bits are a superset of the is_locked() bits > - code style fixes > > src/share/vm/runtime/globals.hpp > - add VerboseStackTrace diagnostic option > - add GuaranteeOnMonitorMismatch diagnostic option > - add JavaThreadExitReleasesMonitors product option; > this is the Java equivalent of JNIDetachReleasesMonitors > > src/share/vm/runtime/objectMonitor.cpp > - delete unused ObjectMonitor::try_enter() > - fix assert wording > > src/share/vm/runtime/objectMonitor.hpp > - delete unused ObjectMonitor::try_enter() > > src/share/vm/runtime/synchronizer.cpp > - add GuaranteeOnMonitorMismatch support with some > diagnostic output > > src/share/vm/runtime/thread.cpp > - add JavaThreadExitReleasesMonitors support > > src/share/vm/runtime/vframe.cpp > - clarify existing comments > - add comments to clarify what "waiting on" means > - add line to show when we are "waiting on", but > there are no locals available (previously we were > "waiting on" silently) > - add support for "waiting to relock" which can happen > for any of the monitors and not just the top monitor > - switch mark->print_on() verbose output to new > VerboseStackTrace switch; thread dumps are not enabled > with a specific switch so the '-XX:+Verbose' model of > being a modifier for another option does not fit From daniel.daugherty at oracle.com Mon Jul 6 13:20:49 2015 From: daniel.daugherty at oracle.com (Daniel D. Daugherty) Date: Mon, 06 Jul 2015 07:20:49 -0600 Subject: RFR(S) Contended Locking fast notify bucket (8075171) In-Reply-To: <559A04F3.3060702@oracle.com> References: <555A4678.7020308@oracle.com> <559724B0.6000507@oracle.com> <559A04F3.3060702@oracle.com> Message-ID: <559A80B1.5050708@oracle.com> David, Thanks for the re-review! Dan On 7/5/15 10:32 PM, David Holmes wrote: > Thanks Dan! No further comments from me. > > David > > On 4/07/2015 10:11 AM, Daniel D. Daugherty wrote: >> Greetings, >> >> I've updated the patch for Contended Locking fast notify bucket >> based on David H's and Karen's comments. >> >> This work is being tracked by the following bug ID: >> >> JDK-8075171 Contended Locking fast notify bucket >> https://bugs.openjdk.java.net/browse/JDK-8075171 >> >> Here is the webrev URL: >> >> http://cr.openjdk.java.net/~dcubed/8075171-webrev/1-jdk9-hs-rt/ >> >> Here is the JEP link: >> >> https://bugs.openjdk.java.net/browse/JDK-8046133 >> >> Testing: >> >> - RBT vm.quick batches (in process) >> - JPRT test jobs >> - MonitorWaitNotifyStresser micro-benchmark (in process) >> - CallTimerGrid stress testing (in process) >> >> >> The changes in this round are in only four of the files: >> >> src/share/vm/opto/runtime.cpp >> >> - deleted comment about hashCode() that belongs in a different bucket >> >> src/share/vm/runtime/objectMonitor.cpp >> >> - add MAX_RECHECK_INTERVAL define for use in ObjectMonitor::EnterI() >> - cleanup recheck interval code >> - ObjectMonitor::INotify() return type is now "void" >> - delete duplicate comments, clarify/rewrite some comments >> >> src/share/vm/runtime/objectMonitor.hpp >> >> - ObjectMonitor::INotify() return type is now "void" >> >> src/share/vm/runtime/synchronizer.cpp >> >> - clarify/rewrite comments, add additional comments >> - cleanup variables in ObjectSynchronizer::quick_notify >> - refactor loop to be more clear >> - delete unused enum MaximumRecheckInterval >> >> The easiest way to review the delta is to download the two patch >> files and compare them in something like jfilemerge: >> >> http://cr.openjdk.java.net/~dcubed/8075171-webrev/0-jdk9-hs-rt/hotspot.patch >> >> >> http://cr.openjdk.java.net/~dcubed/8075171-webrev/1-jdk9-hs-rt/hotspot.patch >> >> >> >> Dan >> >> >> On 5/18/15 2:07 PM, Daniel D. Daugherty wrote: >>> Greetings, >>> >>> I have the Contended Locking fast notify bucket ready for review. >>> >>> The code changes in this bucket are the final piece in the triad >>> of {fast-enter, fast-exit, fast-notify} changes. There are no >>> macro assembler changes in this bucket (yeah!), but there are >>> code review cleanups motivated by comments on other buckets, e.g., >>> changing variables like 'Tally' -> 'tally'. >>> >>> This work is being tracked by the following bug ID: >>> >>> JDK-8075171 Contended Locking fast notify bucket >>> https://bugs.openjdk.java.net/browse/JDK-8075171 >>> >>> Here is the webrev URL: >>> >>> http://cr.openjdk.java.net/~dcubed/8075171-webrev/0-jdk9-hs-rt/ >>> >>> Here is the JEP link: >>> >>> https://bugs.openjdk.java.net/browse/JDK-8046133 >>> >>> Testing: >>> >>> - Aurora Adhoc RT/SVC baseline batch >>> - JPRT test jobs >>> - MonitorWaitNotifyStresser micro-benchmark (in process) >>> - CallTimerGrid stress testing (in process) >>> - Aurora performance testing: >>> - out of the box for the "promotion" and 32-bit server configs >>> - heavy weight monitors for the "promotion" and 32-bit server configs >>> (-XX:-UseBiasedLocking -XX:+UseHeavyMonitors) >>> (in process) >>> >>> The hang somehow introduced by the "fast enter" bucket is still >>> unresolved, but progress is being made. That work is being tracked >>> by the following bug: >>> >>> JDK-8077392 Stream fork/join tasks occasionally fail to complete >>> https://bugs.openjdk.java.net/browse/JDK-8077392 >>> >>> You'll see a change that re-enables the "fast enter" bucket in this >>> webrev, but that change will not be pushed when we're done with the >>> review of this bucket unless JDK-8077392 is resolved. >>> >>> Thanks, in advance, for any comments, questions or suggestions. >>> >>> Gory details about the changes are below... >>> >>> Dan >>> >>> >>> 8075171 summary of changes: >>> >>> src/share/vm/classfile/vmSymbols.hpp >>> - Add do_intrinsic() entries for _notify and _notifyAll >>> >>> src/share/vm/opto/library_call.cpp >>> - Add optional inline_notify() that is controlled by new >>> '-XX:[+-]InlineNotify' option >>> >>> src/share/vm/opto/runtime.cpp >>> src/share/vm/opto/runtime.hpp >>> - Add OptoRuntime::monitor_notify_C() and >>> OptoRuntime::monitor_notifyAll_C() functions to support >>> the new "fast notify" code paths >>> - Add new OptoRuntime::monitor_notify_Type() to support >>> the above two new functions >>> >>> src/share/vm/runtime/globals.hpp >>> - Add '-XX:[+-]InlineNotify' option; default option value is >>> enabled (true) >>> >>> src/share/vm/runtime/objectMonitor.cpp >>> src/share/vm/runtime/objectMonitor.hpp >>> - Refactor ObjectMonitor::notify() and ObjectMonitor::notifyAll() >>> into wrappers that call the new ObjectMonitor::INotify() >>> - Add new ObjectMonitor::INotify() to reduce code duplication >>> between "notify" and "notifyAll" code paths >>> >>> src/share/vm/runtime/sharedRuntime.cpp >>> - Temporarily re-enable the "fast enter" optimization in order >>> to do performance testing. JDK-8077392 is still unresolved, >>> but progress is being made. >>> >>> src/share/vm/runtime/synchronizer.cpp >>> src/share/vm/runtime/synchronizer.hpp >>> - Add ObjectSynchronizer::quick_notify() that implements the >>> new "fast notify" code paths >>> - The new code handles a couple of special cases where the >>> "notify" can be done without the heavy weight slow-path >>> (thread state transitions and other baggage) >>> >>> >> From daniel.daugherty at oracle.com Mon Jul 6 20:47:41 2015 From: daniel.daugherty at oracle.com (Daniel D. Daugherty) Date: Mon, 06 Jul 2015 14:47:41 -0600 Subject: RFR(S) 8130448: thread dump improvements, comment, additions, new diagnostics inspired by 8077392 In-Reply-To: <559A2397.2010409@oracle.com> References: <55972558.6060905@oracle.com> <559A2397.2010409@oracle.com> Message-ID: <559AE96D.6010508@oracle.com> On 7/6/15 12:43 AM, David Holmes wrote: > Hi Dan, > > Metacomment: Could I suggest that in a RFR your subject line has the > form : , rather than (bugid) - especially > when the synopsis actually starts with a bug id :) Thanks. Yup that bug synopsis is/was a mess: Changed the synopsis line to : thread dump improvements, comment additions, new diagnostics inspired by 8077392 Also updated the e-mail thread subject line to your suggested format. Will try to remember to switch to that style in the future. > Mostly okay but some major concerns around the can of worms that > JavaThreadExitReleasesMonitors opens up. This is Java monitors so "can of worms" is familiar! :-) > > On 4/07/2015 10:14 AM, Daniel D. Daugherty wrote: >> Greetings, >> >> The hunt for the following bug: >> >> JDK-8077392 Stream fork/join tasks occasionally fail to complete >> >> and David C's work on the following bug: >> >> JDK-8069412 Locks need better debug-printing support >> >> have inspired additional thread dump improvements, comment additions >> to some Java monitor code and some new diagnostic options. > > src/cpu/x86/vm/macroAssembler_x86.cpp > > 1821 // update _owner from from BasicLock to thread > > Typo: from from Will fix. > 2091 // the placeholder value. If that didn't work, then another > 2092 // grabbed the lock so we're done (and exit was a success). > > another -> another thread ? Yes, "another thread" is better. Will fix. > 2201 // If that didn't work, then another grabbed the lock > 2202 // so we're done (and exit was a success). > > another -> another thread ? Yes, "another thread" is better. Will fix. > --- > > src/share/vm/oops/markOop.cpp > > 40 st->print("NULL"); // this should not happen > > Shouldn't that be an assert or guarantee in that case? Or at a minimum > print something like: "NULL (but you should never see this!)" This is a relocated line from David C's change: old 49: st->print("monitor=NULL"); I simply added a comment to it. I don't think I like the idea of the thread dump code assert()'ing or guarantee()'ing because there might be other useful info that would have been printed after the assert() or guarantee() failure. I do like the idea of changing the message to: 40: st->print("NULL (this should never be seen!)"); > 42 BasicLock * bl = (BasicLock *) mon->owner(); > > What information has told us this is a BasicLock* not a Thread* ? But > as all you do is print bl why not just p2i(mon->owner()) ? Again, this is a relocated line from David C's change: old 51: BasicLock * bl = (BasicLock *) mon->owner(); I'm going to guess that David C had some other code in there before that needed/assumed that the field is a "BasicLock *", but that code didn't make it into his final version. I will drop the 'bl' local and update the p2i() call to use mon->owner() directly. > --- > > src/share/vm/runtime/globals.hpp > > JavaThreadExitReleasesMonitors has me perplexed. The JNI DetachThread > case seems to be a concession to badly written code that fails to > release locks on error paths. I don't think I would call the JNIDetachReleasesMonitors case a concession to badly written JNI code. 6282335 is very clear that this code was added to meet the JNI spec. The JNI spec words might be considered a concession... http://docs.oracle.com/javase/8/docs/technotes/guides/jni/spec/invocation.html#DetachCurrentThread > DetachCurrentThread > > jint DetachCurrentThread(JavaVM *vm); > > Detaches the current thread from a Java VM. All Java monitors > held by this thread are released. All Java threads waiting for > this thread to die are notified. > > The main thread can be detached from the VM. > The equivalent for a Java thread would again involve lock acquisition > via JNI. But I don't recall ever seeing a bug report or RFE related to > this. What seems to have motivated this new flag is the potential for > a broken VM to actually leave the monitor locked (e.g. because > compiled code failed to do the unlock on all paths). 8077392 and bugs like it are exactly the reason for adding these two options. JavaThreadExitReleasesMonitors is added to provide a work around until the underlying bug or bugs are fixed. This option is targeted at folks that are chasing their own bugs and don't care about this one. GuaranteeOnMonitorMismatch is added to help hunt 8077392 specifically and to sanity check for similar issues generally. I can see using the two options in combination with existing test suites as a stress test for the Java monitor subsystem. > To address that I'd be inclined to simply have a guarantee in the Java > thread exit path, rather than a flag to do the clean up and another > flag to control a guarantee. The check for an unexited Java monitor is not cheap. The existing check under the JNIDetachReleasesMonitors flag is positioned to only affect threads using JNI DetachCurrentThread() and that cost is justified as part of meeting the JNI spec. Adding the unexited Java monitor check to all exiting Java threads should not be done lightly due to the cost. If the VM is functioning correctly, then why impose this cost on all exiting Java threads? > I don't think two new command-line options (has this gone through CCC > yet?) are justified. No, this has not gone through CCC yet. My preference is to get code review feedback (like this) before submitting a CCC. I suppose I could have simply added more sub-options to the existing Java monitor subsystem knobs and switches, but it seemed to make sense to model JavaThreadExitReleasesMonitors on the existing JNIDetachReleasesMonitors. > Also note that allowing for JVM induced missing unlocks is something > that can affect JNI attached threads as well as regular Java threads. > I'll take this up in discussing thread.cpp below. > > That aside, the comment, which was modelled on the JNI DetachThread > variant, does not really work in this case: > > 2801 "JavaThread exit() releases monitors owned by thread") > \ > > JavaThread is not a programming concept but an internal JVM > abstraction. I would suggest something like: > > "Java thread termination releases monitors unexpectedly still owned by > thread" I'll switch to your description text if we end up keeping the new options. > --- > > src/share/vm/runtime/objectMonitor.cpp > src/share/vm/runtime/objectMonitor.hpp > > No comments > > --- > > src/share/vm/runtime/synchronizer.cpp > > If we find the unexpected locked monitor it would be useful to see > more Java level information about the Thread (in the non-detaching > case) and the object that is locked. I can probably steal some code from the thread dump side to give us more info about the Object associated with the Java monitor... > --- > > src/share/vm/runtime/thread.cpp > > As noted previously JNI attached threads can also be affected by JVM > induced locking bugs. So the comment block: > > 1804 // 6282335 JNI DetachCurrentThread spec states that all Java > monitors > 1805 // held by this thread must be released. A detach operation > must only > 1806 // get here if there are no Java frames on the stack. > Therefore, any > 1807 // owned monitors at this point MUST be JNI-acquired monitors > which are > 1808 // pre-inflated and in the monitor cache. > > is not strictly correct as it is presuming a correctly operating JVM. I actually disagree with the last two sentences in that comment block, but I didn't have a good rewrite in mind. I'll think about it more. > Further the logic now applied: > > 1816 if ((exit_type == jni_detach && JNIDetachReleasesMonitors) || > 1817 JavaThreadExitReleasesMonitors) { > > is also not "correct" because if we have > JavaThreadExitReleasesMonitors true while JNIDetachReleasesMonitors is > false, we will in fact release any JNI acquired monitors because we > can't make the distinction. I don't think JNIDetachReleasesMonitors only has to deal with JNI-acquired monitors and I don't think that JavaThreadExitReleasesMonitors only has to deal with Java code acquired monitors. I see these options as applying to "how you got to the Java thread exit path" and not applying to "what needs to be cleaned up". I see JNIDetachReleasesMonitors as a way of cleaning up unexited Java monitors when we're executing the JNI DetachCurrentThread() code path. I don't really care why the Java monitors are unexited... and I think the spec wording is clear that all unexited Java monitors are cleaned up... not just JNI-acquired monitors. I see JavaThreadExitReleasesMonitors as a way of cleaning up unexited Java monitors in any code path where we are exiting the Java thread. I see JavaThreadExitReleasesMonitors as a superset of JNIDetachReleasesMonitors. > Given we can't make the distinction I don't see any way for these > separate flags to actually work well together. I think they work well together when JavaThreadExitReleasesMonitors is seen as a superset of JNIDetachReleasesMonitors. Of course, that hinges on my opinion that JNIDetachReleasesMonitors applies to any unexited Java monitor and not just JNI-acquired Java monitors. > As I said above I'm more inclined to just add a guarantee to the > non-detach case, than add two new flags. (Even though this means there > won't be detection for such bugs when JNI attached threads encounter > them - including the main thread :( ). I really don't want to add this check to all Java thread exit paths since it is expensive. > As I said this has me perplexed. :( Hopefully, I've explained it better now. > --- > > src/share/vm/runtime/vframe.cpp > > 170 // It would be nice to distinguish between "waiting on" and > 171 // "waited on". Currently, "waiting on" here with a > 172 // java.lang.Thread.State == "WAITING (on object monitor)" > 173 // earlier in the output means that the monitor has not yet > been > 174 // notified and java.lang.Thread.State == "BLOCKED (on object > 175 // monitor)" earlier in the output means that the monitor has > 176 // been notified and the thread is blocked on reentry. > > That's a very long sentence that can be quite difficult to parse and > could probably be reworded to describe how the output should be > interpreted eg: > > // If earlier in the output we reported java.lang.Thread.State == > // "WAITING (on object monitor)" and now we report "waited on", then > // we are still waiting for notification [or timeout?]. Otherwise if > // we earlier reported java.lang.Thread.State == "BLOCKED (on object > // monitor)", then we are actually waiting to reacquire the monitor > // lock. At this level we can't distinguish the two cases to report > // "waited on" rather than "waiting on" for the second case. I'll take a look at rewriting the comment and may just take your version entirely. > I wonder if we can prod deeper into VM state to try and make the > distinction? I played around with doing just that, but it seems like the M&M code that fetches similar state probes the state stored in the java.lang.Thread object. I didn't want to go there. > > 184 } else { > 185 st->print_cr("\t- %s ", wait_state); > > The concept of "locals" is confusing here. Isn't the "local" in this > case just the object that we have waited upon? In which case we should > say "no object reference available". I got the phrase "locals" from the compiler code that was trying to decode the object reference. I can change to "no object reference available". I definitely want to say _something_ here. The existing code is just silent. > Though I would have thought/hoped there must be a way to find the > object reference even in a compiled frame? Yes, if you deopt... I didn't want to go there. > 195 // Print out all monitors that we have locked, are trying to lock > 196 // or are trying to relock after a wait(). > > that makes it sound like there are three cases when really a "relock" > is just a specific case of lock. I would suggest: > > // Print out all monitors that we have locked, or are trying to > // lock, including re-locking when returning from a wait(). Making it more clear that the "re-locking" is coming from "wait()" is an improvement. I'll fix this. > 252 lock_state = "waiting to relock"; > > I prefer "waiting to re-lock in wait()", if that isn't too long. > Otherwise "relock" needs to be a concept people are familiar with. I like "waiting to re-lock in wait()". > 260 if (VerboseStackTrace && mark != NULL) { > 261 st->print("\t- lockbits="); > 262 mark->print_on(st); > > This really doesn't seem to warrant a new diagnostic flag, regardless > of whether we think applying -XX:+Verbose is a good fit or not. I suspect that David C didn't want to change the default output format and neither do I. We have some tests that try to parse out specific things from thread dumps to verify certain bug fixes and we don't want to break those. I'm thinking of the "duplicate owner" bug fix that we fixed in thread dumps, but I can't pull up the bug ID (yet)... Thanks for the thorough review. I have to say that I wasn't expecting much comment on this review at all. :-) Dan > > Thanks, > David > ------- > >> This work is being tracked by the following bug ID: >> >> JDK-8130448 8077392 inspired thread dump improvements, comment >> additions, new diagnostics >> https://bugs.openjdk.java.net/browse/JDK-8130448 >> >> Here is the webrev URL: >> >> http://cr.openjdk.java.net/~dcubed/8130448-webrev/0-jdk9-hs-rt/ >> >> Testing: >> >> - RBT vm.quick batches (in process) >> - JPRT test jobs >> >> Thanks, in advance, for any comments, questions or suggestions. >> >> Gory details about the changes are below... >> >> Dan >> >> 8130448 summary of changes: >> >> src/cpu/x86/vm/macroAssembler_x86.cpp >> - comment additions for the assembly code >> >> src/share/vm/oops/markOop.cpp >> - has_monitor() has to be checked before is_locked() since >> the has_monitor() bits are a superset of the is_locked() bits >> - code style fixes >> >> src/share/vm/runtime/globals.hpp >> - add VerboseStackTrace diagnostic option >> - add GuaranteeOnMonitorMismatch diagnostic option >> - add JavaThreadExitReleasesMonitors product option; >> this is the Java equivalent of JNIDetachReleasesMonitors >> >> src/share/vm/runtime/objectMonitor.cpp >> - delete unused ObjectMonitor::try_enter() >> - fix assert wording >> >> src/share/vm/runtime/objectMonitor.hpp >> - delete unused ObjectMonitor::try_enter() >> >> src/share/vm/runtime/synchronizer.cpp >> - add GuaranteeOnMonitorMismatch support with some >> diagnostic output >> >> src/share/vm/runtime/thread.cpp >> - add JavaThreadExitReleasesMonitors support >> >> src/share/vm/runtime/vframe.cpp >> - clarify existing comments >> - add comments to clarify what "waiting on" means >> - add line to show when we are "waiting on", but >> there are no locals available (previously we were >> "waiting on" silently) >> - add support for "waiting to relock" which can happen >> for any of the monitors and not just the top monitor >> - switch mark->print_on() verbose output to new >> VerboseStackTrace switch; thread dumps are not enabled >> with a specific switch so the '-XX:+Verbose' model of >> being a modifier for another option does not fit From coleen.phillimore at oracle.com Mon Jul 6 21:00:48 2015 From: coleen.phillimore at oracle.com (Coleen Phillimore) Date: Mon, 06 Jul 2015 17:00:48 -0400 Subject: Runtime command-line deprecation (Was Re: RFR: 8066821(S) Enhance command line processing to manage deprecating and obsoleting -XX command line arguments In-Reply-To: <87B07B03-3423-4738-9617-0C7B72A74A6E@oracle.com> References: <54B44661.8070007@oracle.com> <54B84E91.1050708@oracle.com> <54D15A0B.6030501@oracle.com> <87B07B03-3423-4738-9617-0C7B72A74A6E@oracle.com> Message-ID: <559AEC80.3010907@oracle.com> Hi, I'm happy for more clarity in the process of removing command line arguments. I have some questions and comments below. On 6/26/15 4:09 PM, Karen Kinnear wrote: > Derek, > > I am really glad you are looking into this. I expanded this to the runtime folks in case many of them have not yet seen this. > Mary just forwarded this and I believe you haven't checked it in yet, so perhaps still time to discuss and make sure > we all are together on the deprecation policy. > > The runtime team was discussing at staff this week how we handle deprecating jvm command-line options as > we are looking to do more clean up in the future. > > So our internal change control process classifies our exported interfaces into three categories: > External: command-line flags e.g. -verbose:gc, -Xmx, ... > This includes any commercial flags > Private: -XX flags documented (e.g. performance tuning or troubleshooting) > I would assume this would include -XX product, experimental flags and manageable flags > Internal: undocumented -XX flags > I would assume this would include -XX develop and diagnostic flags > > (please correct me if my assumptions are wrong folks) This is a good categorization. Although I think there's some grey area between External and Private, where some XX options are so commonly used they should be considered External. Some of the GC options may fall into this category like UseParNewGC. > > The way I understand that we handle private -XX options today is a 2-step removal: (obsolete_jvm_flags - where the > release number is in a table and could be undefined) > > Using your helpful taxonomy from https://bugs.openjdk.java.net/browse/JDK-806682: > > Today: private -XX options use 2-step removal (obsolete_jvm_flags) > release 1: Deprecate & Obsolete - warn about the option but do nothing with it (we can remove all code that supports it) > release 2: Dead - unrecognized > - the point of the 2-step is to give customers time to modify any scripts they use > > I believe we have very rarely removed External flags - since customers, licensees, etc. may expect them. > > Mini-proposal: > 1) I would recommend that we add a future set of changes to add consistent handling for the External flags - > so that they would follow a three-step removal: > release 1: Deprecate & Handle - warn and keep supporting > release 2: Deprecate & Obsolete - warn and do nothing > release 3: Dead - unrecognized > > 2) For the Internal flags - I think it would be kindest to customers and not a huge amount of additional work if > we were to follow the Private model of using a 2 step. > > 3) leave the Private flags with the current 2-step removal Yes, this reflects our current model. > > 4) add support for aliasing - for any of them > So that if you are doing aliasing, you would follow the model you are adding > release 1: Deprecated & Handled - i.e. warn and still support (and set the information for the new alias) > release 2: Dead - unrecognized > > 5) Could we possibly take the two flags that followed a different model already, i.e. moving to > Deprecated & Handled and handle those as mistakes rather than part of a new general model? So this is my question which is around the code review in question. Note, Derek, can you resend the RFR to hotspot-dev at openjdk.java.net so it gets to all of us (even the compiler team may want to share in the mechanism). Why are UseParNewGC and MaxGCMinorPauseMillis deprecated and handled and not deprecated and obsolete? I don't actually see why have the distinction here? Did these flags follow the deprecation procedure below? Why not just make them obsolete, why have this other mechanism? I may be asking the same question as Karen. I think the aliased flags could have a deprecate and handle model (where handle == alias) in which case you only need one table for the aliased flags, and you need to keep them in globals.hpp so they're parsed properly. > > Or do you think we will see more cases other than aliasing in which we would want to > release 1: Deprecate & Handle and then release 2: Dead > rather than release 1: Deprecate & Obsolete and then 2: Dead > or rather than a 3 step like the External option proposal above? I think for the aliased flags you want the first option here (deprecate&handle), right? But that's only because you need to keep the option in globals.hpp so it parses correctly, otherwise the second option (deprecate&obsolete) would be the preference? The options in the GC that are being deprecated and handled have had warnings about them for a while, so making them obsolete doesn't feel too soon. Also, I agree with Kim's comment below that your comment lines are too long. My fonts are too big to have windows this wide. thanks, Coleen > > thanks, > Karen > > p.s. Note that all of the deprecation needs to > 1) work with licensee engineering to ensure we give licensee's a head's up and get feedback > 2) file a change control request > > - we try to do these both as bulk requests to reduce the processing overhead. > > p.p.s. Details > > 1. Do the warnings print today or are they silent? Just want to make sure we are conscious of how > those are handled if any of this moves to the new unified logging mechanism for which the new default > for "warning" level is to print. > > 2. "will likely be removed in a future release"? If we have already set the release it will be removed - is this a bit > vague or did I not read closely enough? > > > > On Feb 3, 2015, at 6:30 PM, Derek White wrote: > >> Request for review (again): >> >> - Updated with Kim's suggestion. >> - Stopped double-printing warnings in some cases. >> - Initial caps on warning() messages. >> >> Webrev: http://cr.openjdk.java.net/~drwhite/8066821/webrev.04/ >> CR: https://bugs.openjdk.java.net/browse/JDK-8066821 >> Tests: jtreg, jprt >> >> Thanks for looking! >> >> - Derek >> >> On 1/28/15 3:47 PM, Kim Barrett wrote: >>> On Jan 15, 2015, at 6:34 PM, Derek White wrote: >>>> Hi All, >>>> >>>> I need another review, especially someone from runtime. Coleen, do you want crack at it or can you forward as needed? >>>> >>>> Another version for review: >>>> http://cr.openjdk.java.net/~drwhite/8066821/webrev.01 >>> I noticed a bunch of formatting changes that were in the previous >>> webrev have been eliminated in the .01 webrev. Since I was going to >>> comment or complain about at least some of them, I have no objection >>> to having them backed out. >>> >>> This is not a complete review; I've only gotten part way through the >>> first file! Unfortunately, I'm swamped with other things right now >>> and don't seem to be making progress toward finishing. So here's what >>> I've got so far. >>> >>> ------------------------------------------------------------------------------ >>> src/share/vm/runtime/arguments.cpp >>> 132 int len = (int)strlen(name); >>> >>> Pre-existing issue. >>> >>> Why is this using int and casting to int, rather than just using >>> size_t? The return type for strlen is size_t, as is the argument for >>> strncmp where len is used, and the other use of len also can/should be >>> size_t. >>> >>> [I only noticed this because an earlier webrev tweaked the formatting >>> of this line.] >>> >>> ------------------------------------------------------------------------------ >>> src/share/vm/runtime/arguments.cpp >>> 235 const char* spec_vendor = "Sun Microsystems Inc."; >>> 236 uint32_t spec_version = 0; >>> >>> Dead initializers; the variables are immediately reassigned new >>> values. >>> >>> This is a pre-existing defect that I wouldn't have even noticed had >>> the enum for bufsz not been reformatted in a previous webrev. (How's >>> that for a lesson in being lazy. :-) >>> >>> ------------------------------------------------------------------------------ >>> src/share/vm/runtime/arguments.cpp >>> 253 * -XX arguments are usually defined in globals.hpp, globals_.hpp, globals_.hpp, _globals.hpp, or _globals.hpp. >>> >>> Rather than "are usually defined in" I think better would be something >>> like "are defined several places, such as". >>> >>> ------------------------------------------------------------------------------ >>> src/share/vm/runtime/arguments.cpp >>> 251 * -XX argument processing: >>> >>> While the Hotspot style guidelines explicitly don't specify a line >>> length limit, I find lines that are long enough that they don't fit in >>> one side of a side-by-side webrev on a reasonable-sized landscape >>> monitor with a font size I can read without having to scroll the frame >>> back and forth to be pretty annoying. >>> >>> ------------------------------------------------------------------------------ >>> src/share/vm/runtime/arguments.cpp >>> 419 if (((strncmp(flag_status.name, s, len) == 0) && >>> 420 (strlen(s) == len)) || >>> 421 ((s[0] == '+' || s[0] == '-') && >>> 422 (strncmp(flag_status.name, &s[1], len) == 0) && >>> 423 (strlen(&s[1]) == len))) { >>> >>> Pre-existing issue. >>> >>> The calls to strlen and comparisons to len on lines 420 and 423 could >>> be replaced with >>> >>> 420: s[len] == '\0' >>> >>> 423: s[len+1] == '\0' >>> >>> ------------------------------------------------------------------------------ >>> src/share/vm/runtime/arguments.cpp >>> 449 size_t len = strlen(flag_status.alias_name); >>> 450 if (((strncmp(flag_status.alias_name, flag_name, len) == 0) && >>> 451 (strlen(flag_name) == len))) { >>> >>> There is no point to using strlen() and strncmp() here. Just use >>> strcmp(), e.g. >>> >>> if (strcmp(flag_status.alias_name, flag_name) == 0) { >>> >>> http://stackoverflow.com/questions/14885000/does-strlen-in-a-strncmp-expression-defeat-the-purpose-of-using-strncmp-ov >>> >>> ------------------------------------------------------------------------------ >>> src/share/vm/runtime/arguments.cpp >>> 412 int i = 0; >>> 413 assert(version != NULL, "Must provide a version buffer"); >>> 414 while (special_table[i].name != NULL) { >>> ... >>> 432 i++; >>> >>> Pre-existing issue. >>> >>> More readable would be to use a for-loop, e.g. >>> >>> for (size_t i = 0; special_table[i].name != NULL; ++i) { >>> ... >>> } >>> >>> size_t is a better type for i too. >>> >>> ------------------------------------------------------------------------------ >>> src/share/vm/runtime/arguments.cpp >>> 446 int i = 0; >>> 447 while (aliased_jvm_flags[i].alias_name != NULL) { >>> ... >>> 454 i++; >>> >>> As above, a for-loop would be more readable. >>> >>> ------------------------------------------------------------------------------ >>> From david.holmes at oracle.com Tue Jul 7 07:11:38 2015 From: david.holmes at oracle.com (David Holmes) Date: Tue, 7 Jul 2015 17:11:38 +1000 Subject: RFR(S) 8130448: thread dump improvements, comment, additions, new diagnostics inspired by 8077392 In-Reply-To: <559AE96D.6010508@oracle.com> References: <55972558.6060905@oracle.com> <559A2397.2010409@oracle.com> <559AE96D.6010508@oracle.com> Message-ID: <559B7BAA.8070705@oracle.com> Hi Dan, Top posting as I'm lazy and running late :) Okay ... I'm still uneasy about adding two additional flags for the "release monitors on exit" situation. I hear what you are saying about the cost of the monitor check - I had thought we kept easy access to the set of monitors owned by a thread but it seems not, so trawling the global monitor list is indeed an expensive operation. :( So okay but I don't like it :) I also take your point about viewing the new flag as a superset of the JNI-detach case. That's fair enough, but of course that aspect needs to be documented. I was left unclear about your position on the VerboseStackTrace. I agree the new output was likely put under a flag to avoid disturbing existing output formats. But I don't see that it warrants its own flag - to me using Verbose okay (though the fact it is a develop flag is limiting). Thanks, David On 7/07/2015 6:47 AM, Daniel D. Daugherty wrote: > On 7/6/15 12:43 AM, David Holmes wrote: >> Hi Dan, >> >> Metacomment: Could I suggest that in a RFR your subject line has the >> form : , rather than (bugid) - especially >> when the synopsis actually starts with a bug id :) Thanks. > > Yup that bug synopsis is/was a mess: > > Changed the synopsis line to : > > thread dump improvements, comment additions, new diagnostics > inspired by 8077392 > > Also updated the e-mail thread subject line to your suggested format. > Will try to remember to switch to that style in the future. > > >> Mostly okay but some major concerns around the can of worms that >> JavaThreadExitReleasesMonitors opens up. > > This is Java monitors so "can of worms" is familiar! :-) > > >> >> On 4/07/2015 10:14 AM, Daniel D. Daugherty wrote: >>> Greetings, >>> >>> The hunt for the following bug: >>> >>> JDK-8077392 Stream fork/join tasks occasionally fail to complete >>> >>> and David C's work on the following bug: >>> >>> JDK-8069412 Locks need better debug-printing support >>> >>> have inspired additional thread dump improvements, comment additions >>> to some Java monitor code and some new diagnostic options. >> >> src/cpu/x86/vm/macroAssembler_x86.cpp >> >> 1821 // update _owner from from BasicLock to thread >> >> Typo: from from > > Will fix. > > >> 2091 // the placeholder value. If that didn't work, then another >> 2092 // grabbed the lock so we're done (and exit was a success). >> >> another -> another thread ? > > Yes, "another thread" is better. Will fix. > > >> 2201 // If that didn't work, then another grabbed the lock >> 2202 // so we're done (and exit was a success). >> >> another -> another thread ? > > Yes, "another thread" is better. Will fix. > > >> --- >> >> src/share/vm/oops/markOop.cpp >> >> 40 st->print("NULL"); // this should not happen >> >> Shouldn't that be an assert or guarantee in that case? Or at a minimum >> print something like: "NULL (but you should never see this!)" > > This is a relocated line from David C's change: > > old 49: st->print("monitor=NULL"); > > I simply added a comment to it. I don't think I like the idea of the > thread dump code assert()'ing or guarantee()'ing because there might > be other useful info that would have been printed after the assert() > or guarantee() failure. > > I do like the idea of changing the message to: > > 40: st->print("NULL (this should never be seen!)"); > > >> 42 BasicLock * bl = (BasicLock *) mon->owner(); >> >> What information has told us this is a BasicLock* not a Thread* ? But >> as all you do is print bl why not just p2i(mon->owner()) ? > > Again, this is a relocated line from David C's change: > > old 51: BasicLock * bl = (BasicLock *) mon->owner(); > > I'm going to guess that David C had some other code in there before > that needed/assumed that the field is a "BasicLock *", but that code > didn't make it into his final version. > > I will drop the 'bl' local and update the p2i() call to use > mon->owner() directly. > > >> --- >> >> src/share/vm/runtime/globals.hpp >> >> JavaThreadExitReleasesMonitors has me perplexed. The JNI DetachThread >> case seems to be a concession to badly written code that fails to >> release locks on error paths. > > I don't think I would call the JNIDetachReleasesMonitors case a concession > to badly written JNI code. 6282335 is very clear that this code was added > to meet the JNI spec. The JNI spec words might be considered a > concession... > > http://docs.oracle.com/javase/8/docs/technotes/guides/jni/spec/invocation.html#DetachCurrentThread > > > > DetachCurrentThread > > > > jint DetachCurrentThread(JavaVM *vm); > > > > Detaches the current thread from a Java VM. All Java monitors > > held by this thread are released. All Java threads waiting for > > this thread to die are notified. > > > > The main thread can be detached from the VM. > > > >> The equivalent for a Java thread would again involve lock acquisition >> via JNI. But I don't recall ever seeing a bug report or RFE related to >> this. What seems to have motivated this new flag is the potential for >> a broken VM to actually leave the monitor locked (e.g. because >> compiled code failed to do the unlock on all paths). > > 8077392 and bugs like it are exactly the reason for adding these > two options. > > JavaThreadExitReleasesMonitors is added to provide a work around > until the underlying bug or bugs are fixed. This option is targeted > at folks that are chasing their own bugs and don't care about this > one. > > GuaranteeOnMonitorMismatch is added to help hunt 8077392 specifically > and to sanity check for similar issues generally. I can see using the > two options in combination with existing test suites as a stress test > for the Java monitor subsystem. > > >> To address that I'd be inclined to simply have a guarantee in the Java >> thread exit path, rather than a flag to do the clean up and another >> flag to control a guarantee. > > The check for an unexited Java monitor is not cheap. > > The existing check under the JNIDetachReleasesMonitors flag is > positioned to only affect threads using JNI DetachCurrentThread() > and that cost is justified as part of meeting the JNI spec. > > Adding the unexited Java monitor check to all exiting Java > threads should not be done lightly due to the cost. If the > VM is functioning correctly, then why impose this cost on > all exiting Java threads? > > >> I don't think two new command-line options (has this gone through CCC >> yet?) are justified. > > No, this has not gone through CCC yet. My preference is to get > code review feedback (like this) before submitting a CCC. > > I suppose I could have simply added more sub-options to the > existing Java monitor subsystem knobs and switches, but it > seemed to make sense to model JavaThreadExitReleasesMonitors > on the existing JNIDetachReleasesMonitors. > > >> Also note that allowing for JVM induced missing unlocks is something >> that can affect JNI attached threads as well as regular Java threads. >> I'll take this up in discussing thread.cpp below. >> >> That aside, the comment, which was modelled on the JNI DetachThread >> variant, does not really work in this case: >> >> 2801 "JavaThread exit() releases monitors owned by thread") >> \ >> >> JavaThread is not a programming concept but an internal JVM >> abstraction. I would suggest something like: >> >> "Java thread termination releases monitors unexpectedly still owned by >> thread" > > I'll switch to your description text if we end up keeping the > new options. > > >> --- >> >> src/share/vm/runtime/objectMonitor.cpp >> src/share/vm/runtime/objectMonitor.hpp >> >> No comments >> >> --- >> >> src/share/vm/runtime/synchronizer.cpp >> >> If we find the unexpected locked monitor it would be useful to see >> more Java level information about the Thread (in the non-detaching >> case) and the object that is locked. > > I can probably steal some code from the thread dump side to > give us more info about the Object associated with the Java > monitor... > > >> --- >> >> src/share/vm/runtime/thread.cpp >> >> As noted previously JNI attached threads can also be affected by JVM >> induced locking bugs. So the comment block: >> >> 1804 // 6282335 JNI DetachCurrentThread spec states that all Java >> monitors >> 1805 // held by this thread must be released. A detach operation >> must only >> 1806 // get here if there are no Java frames on the stack. >> Therefore, any >> 1807 // owned monitors at this point MUST be JNI-acquired monitors >> which are >> 1808 // pre-inflated and in the monitor cache. >> >> is not strictly correct as it is presuming a correctly operating JVM. > > I actually disagree with the last two sentences in that comment block, > but I didn't have a good rewrite in mind. I'll think about it more. > > > >> Further the logic now applied: >> >> 1816 if ((exit_type == jni_detach && JNIDetachReleasesMonitors) || >> 1817 JavaThreadExitReleasesMonitors) { >> >> is also not "correct" because if we have >> JavaThreadExitReleasesMonitors true while JNIDetachReleasesMonitors is >> false, we will in fact release any JNI acquired monitors because we >> can't make the distinction. > > I don't think JNIDetachReleasesMonitors only has to deal with JNI-acquired > monitors and I don't think that JavaThreadExitReleasesMonitors only has to > deal with Java code acquired monitors. I see these options as applying to > "how you got to the Java thread exit path" and not applying to "what needs > to be cleaned up". > > I see JNIDetachReleasesMonitors as a way of cleaning up unexited Java > monitors when we're executing the JNI DetachCurrentThread() code path. > I don't really care why the Java monitors are unexited... and I think > the spec wording is clear that all unexited Java monitors are cleaned > up... not just JNI-acquired monitors. > > I see JavaThreadExitReleasesMonitors as a way of cleaning up unexited > Java monitors in any code path where we are exiting the Java thread. I see > JavaThreadExitReleasesMonitors as a superset of JNIDetachReleasesMonitors. > > >> Given we can't make the distinction I don't see any way for these >> separate flags to actually work well together. > > I think they work well together when JavaThreadExitReleasesMonitors > is seen as a superset of JNIDetachReleasesMonitors. Of course, that > hinges on my opinion that JNIDetachReleasesMonitors applies to any > unexited Java monitor and not just JNI-acquired Java monitors. > > >> As I said above I'm more inclined to just add a guarantee to the >> non-detach case, than add two new flags. (Even though this means there >> won't be detection for such bugs when JNI attached threads encounter >> them - including the main thread :( ). > > I really don't want to add this check to all Java thread exit > paths since it is expensive. > > >> As I said this has me perplexed. :( > > Hopefully, I've explained it better now. > > >> --- >> >> src/share/vm/runtime/vframe.cpp >> >> 170 // It would be nice to distinguish between "waiting on" and >> 171 // "waited on". Currently, "waiting on" here with a >> 172 // java.lang.Thread.State == "WAITING (on object monitor)" >> 173 // earlier in the output means that the monitor has not yet >> been >> 174 // notified and java.lang.Thread.State == "BLOCKED (on object >> 175 // monitor)" earlier in the output means that the monitor has >> 176 // been notified and the thread is blocked on reentry. >> >> That's a very long sentence that can be quite difficult to parse and >> could probably be reworded to describe how the output should be >> interpreted eg: >> >> // If earlier in the output we reported java.lang.Thread.State == >> // "WAITING (on object monitor)" and now we report "waited on", then >> // we are still waiting for notification [or timeout?]. Otherwise if >> // we earlier reported java.lang.Thread.State == "BLOCKED (on object >> // monitor)", then we are actually waiting to reacquire the monitor >> // lock. At this level we can't distinguish the two cases to report >> // "waited on" rather than "waiting on" for the second case. > > I'll take a look at rewriting the comment and may just take your > version entirely. > > >> I wonder if we can prod deeper into VM state to try and make the >> distinction? > > I played around with doing just that, but it seems like the M&M > code that fetches similar state probes the state stored in the > java.lang.Thread object. I didn't want to go there. > > >> >> 184 } else { >> 185 st->print_cr("\t- %s ", wait_state); >> >> The concept of "locals" is confusing here. Isn't the "local" in this >> case just the object that we have waited upon? In which case we should >> say "no object reference available". > > I got the phrase "locals" from the compiler code that was trying to > decode the object reference. I can change to "no object reference > available". > I definitely want to say _something_ here. The existing code is just > silent. > > >> Though I would have thought/hoped there must be a way to find the >> object reference even in a compiled frame? > > Yes, if you deopt... I didn't want to go there. > > >> 195 // Print out all monitors that we have locked, are trying to lock >> 196 // or are trying to relock after a wait(). >> >> that makes it sound like there are three cases when really a "relock" >> is just a specific case of lock. I would suggest: >> >> // Print out all monitors that we have locked, or are trying to >> // lock, including re-locking when returning from a wait(). > > Making it more clear that the "re-locking" is coming from "wait()" > is an improvement. I'll fix this. > > >> 252 lock_state = "waiting to relock"; >> >> I prefer "waiting to re-lock in wait()", if that isn't too long. >> Otherwise "relock" needs to be a concept people are familiar with. > > I like "waiting to re-lock in wait()". > > >> 260 if (VerboseStackTrace && mark != NULL) { >> 261 st->print("\t- lockbits="); >> 262 mark->print_on(st); >> >> This really doesn't seem to warrant a new diagnostic flag, regardless >> of whether we think applying -XX:+Verbose is a good fit or not. > > I suspect that David C didn't want to change the default output format > and neither do I. We have some tests that try to parse out specific > things from thread dumps to verify certain bug fixes and we don't want > to break those. I'm thinking of the "duplicate owner" bug fix that we > fixed in thread dumps, but I can't pull up the bug ID (yet)... > > Thanks for the thorough review. I have to say that I wasn't expecting > much comment on this review at all. :-) > > > Dan > > >> >> Thanks, >> David >> ------- >> >>> This work is being tracked by the following bug ID: >>> >>> JDK-8130448 8077392 inspired thread dump improvements, comment >>> additions, new diagnostics >>> https://bugs.openjdk.java.net/browse/JDK-8130448 >>> >>> Here is the webrev URL: >>> >>> http://cr.openjdk.java.net/~dcubed/8130448-webrev/0-jdk9-hs-rt/ >>> >>> Testing: >>> >>> - RBT vm.quick batches (in process) >>> - JPRT test jobs >>> >>> Thanks, in advance, for any comments, questions or suggestions. >>> >>> Gory details about the changes are below... >>> >>> Dan >>> >>> 8130448 summary of changes: >>> >>> src/cpu/x86/vm/macroAssembler_x86.cpp >>> - comment additions for the assembly code >>> >>> src/share/vm/oops/markOop.cpp >>> - has_monitor() has to be checked before is_locked() since >>> the has_monitor() bits are a superset of the is_locked() bits >>> - code style fixes >>> >>> src/share/vm/runtime/globals.hpp >>> - add VerboseStackTrace diagnostic option >>> - add GuaranteeOnMonitorMismatch diagnostic option >>> - add JavaThreadExitReleasesMonitors product option; >>> this is the Java equivalent of JNIDetachReleasesMonitors >>> >>> src/share/vm/runtime/objectMonitor.cpp >>> - delete unused ObjectMonitor::try_enter() >>> - fix assert wording >>> >>> src/share/vm/runtime/objectMonitor.hpp >>> - delete unused ObjectMonitor::try_enter() >>> >>> src/share/vm/runtime/synchronizer.cpp >>> - add GuaranteeOnMonitorMismatch support with some >>> diagnostic output >>> >>> src/share/vm/runtime/thread.cpp >>> - add JavaThreadExitReleasesMonitors support >>> >>> src/share/vm/runtime/vframe.cpp >>> - clarify existing comments >>> - add comments to clarify what "waiting on" means >>> - add line to show when we are "waiting on", but >>> there are no locals available (previously we were >>> "waiting on" silently) >>> - add support for "waiting to relock" which can happen >>> for any of the monitors and not just the top monitor >>> - switch mark->print_on() verbose output to new >>> VerboseStackTrace switch; thread dumps are not enabled >>> with a specific switch so the '-XX:+Verbose' model of >>> being a modifier for another option does not fit > From daniel.daugherty at oracle.com Tue Jul 7 17:28:45 2015 From: daniel.daugherty at oracle.com (Daniel D. Daugherty) Date: Tue, 07 Jul 2015 11:28:45 -0600 Subject: RFR(S) 8130448: thread dump improvements, comment, additions, new diagnostics inspired by 8077392 In-Reply-To: <559B7BAA.8070705@oracle.com> References: <55972558.6060905@oracle.com> <559A2397.2010409@oracle.com> <559AE96D.6010508@oracle.com> <559B7BAA.8070705@oracle.com> Message-ID: <559C0C4D.8090504@oracle.com> On 7/7/15 1:11 AM, David Holmes wrote: > Hi Dan, > > Top posting as I'm lazy and running late :) No problem with the top posting. It makes your remaining concerns earlier to see and address. > Okay ... I'm still uneasy about adding two additional flags for the > "release monitors on exit" situation. I hear what you are saying about > the cost of the monitor check - I had thought we kept easy access to > the set of monitors owned by a thread but it seems not, so trawling > the global monitor list is indeed an expensive operation. :( So okay > but I don't like it :) Since JavaThreadExitReleasesMonitors and GuaranteeOnMonitorMismatch are targeted at finding/working around bugs in the Java Monitor implementation, I'm going to take a look at moving the flag support down into Java Monitor subsystem's implementation specific options. That will get the options out of the global space and they won't have to be counted against the "cap and trade" limit :-) > I also take your point about viewing the new flag as a superset of the > JNI-detach case. That's fair enough, but of course that aspect needs > to be documented. I'm starting to wonder why we have the 'JNIDetachReleasesMonitors' option at all. Is there a good reason to be able to turn off this piece of code? > I was left unclear about your position on the VerboseStackTrace. I > agree the new output was likely put under a flag to avoid disturbing > existing output formats. But I don't see that it warrants its own flag > - to me using Verbose okay (though the fact it is a develop flag is > limiting). Thanks for reminding me that '-XX:+Verbose' is a develop flag. That's another reason for not using that flag. Combined with the fact that '-XX:+Verbose' is considered a modifier to other flags and thread dumps aren't enabled/triggered by a flag means (to me anyway) that '-XX:+Verbose' is still not a good match. However, I have a vague memory that the Java Monitor subsystem has its own "verbose" flag. I'll take a look at switching to that... Will be working on the next round... Dan > > Thanks, > David > > On 7/07/2015 6:47 AM, Daniel D. Daugherty wrote: >> On 7/6/15 12:43 AM, David Holmes wrote: >>> Hi Dan, >>> >>> Metacomment: Could I suggest that in a RFR your subject line has the >>> form : , rather than (bugid) - especially >>> when the synopsis actually starts with a bug id :) Thanks. >> >> Yup that bug synopsis is/was a mess: >> >> Changed the synopsis line to : >> >> thread dump improvements, comment additions, new diagnostics >> inspired by 8077392 >> >> Also updated the e-mail thread subject line to your suggested format. >> Will try to remember to switch to that style in the future. >> >> >>> Mostly okay but some major concerns around the can of worms that >>> JavaThreadExitReleasesMonitors opens up. >> >> This is Java monitors so "can of worms" is familiar! :-) >> >> >>> >>> On 4/07/2015 10:14 AM, Daniel D. Daugherty wrote: >>>> Greetings, >>>> >>>> The hunt for the following bug: >>>> >>>> JDK-8077392 Stream fork/join tasks occasionally fail to complete >>>> >>>> and David C's work on the following bug: >>>> >>>> JDK-8069412 Locks need better debug-printing support >>>> >>>> have inspired additional thread dump improvements, comment additions >>>> to some Java monitor code and some new diagnostic options. >>> >>> src/cpu/x86/vm/macroAssembler_x86.cpp >>> >>> 1821 // update _owner from from BasicLock to thread >>> >>> Typo: from from >> >> Will fix. >> >> >>> 2091 // the placeholder value. If that didn't work, then another >>> 2092 // grabbed the lock so we're done (and exit was a success). >>> >>> another -> another thread ? >> >> Yes, "another thread" is better. Will fix. >> >> >>> 2201 // If that didn't work, then another grabbed the lock >>> 2202 // so we're done (and exit was a success). >>> >>> another -> another thread ? >> >> Yes, "another thread" is better. Will fix. >> >> >>> --- >>> >>> src/share/vm/oops/markOop.cpp >>> >>> 40 st->print("NULL"); // this should not happen >>> >>> Shouldn't that be an assert or guarantee in that case? Or at a minimum >>> print something like: "NULL (but you should never see this!)" >> >> This is a relocated line from David C's change: >> >> old 49: st->print("monitor=NULL"); >> >> I simply added a comment to it. I don't think I like the idea of the >> thread dump code assert()'ing or guarantee()'ing because there might >> be other useful info that would have been printed after the assert() >> or guarantee() failure. >> >> I do like the idea of changing the message to: >> >> 40: st->print("NULL (this should never be seen!)"); >> >> >>> 42 BasicLock * bl = (BasicLock *) mon->owner(); >>> >>> What information has told us this is a BasicLock* not a Thread* ? But >>> as all you do is print bl why not just p2i(mon->owner()) ? >> >> Again, this is a relocated line from David C's change: >> >> old 51: BasicLock * bl = (BasicLock *) mon->owner(); >> >> I'm going to guess that David C had some other code in there before >> that needed/assumed that the field is a "BasicLock *", but that code >> didn't make it into his final version. >> >> I will drop the 'bl' local and update the p2i() call to use >> mon->owner() directly. >> >> >>> --- >>> >>> src/share/vm/runtime/globals.hpp >>> >>> JavaThreadExitReleasesMonitors has me perplexed. The JNI DetachThread >>> case seems to be a concession to badly written code that fails to >>> release locks on error paths. >> >> I don't think I would call the JNIDetachReleasesMonitors case a >> concession >> to badly written JNI code. 6282335 is very clear that this code was >> added >> to meet the JNI spec. The JNI spec words might be considered a >> concession... >> >> http://docs.oracle.com/javase/8/docs/technotes/guides/jni/spec/invocation.html#DetachCurrentThread >> >> >> >> > DetachCurrentThread >> > >> > jint DetachCurrentThread(JavaVM *vm); >> > >> > Detaches the current thread from a Java VM. All Java monitors >> > held by this thread are released. All Java threads waiting for >> > this thread to die are notified. >> > >> > The main thread can be detached from the VM. >> >> >> >>> The equivalent for a Java thread would again involve lock acquisition >>> via JNI. But I don't recall ever seeing a bug report or RFE related to >>> this. What seems to have motivated this new flag is the potential for >>> a broken VM to actually leave the monitor locked (e.g. because >>> compiled code failed to do the unlock on all paths). >> >> 8077392 and bugs like it are exactly the reason for adding these >> two options. >> >> JavaThreadExitReleasesMonitors is added to provide a work around >> until the underlying bug or bugs are fixed. This option is targeted >> at folks that are chasing their own bugs and don't care about this >> one. >> >> GuaranteeOnMonitorMismatch is added to help hunt 8077392 specifically >> and to sanity check for similar issues generally. I can see using the >> two options in combination with existing test suites as a stress test >> for the Java monitor subsystem. >> >> >>> To address that I'd be inclined to simply have a guarantee in the Java >>> thread exit path, rather than a flag to do the clean up and another >>> flag to control a guarantee. >> >> The check for an unexited Java monitor is not cheap. >> >> The existing check under the JNIDetachReleasesMonitors flag is >> positioned to only affect threads using JNI DetachCurrentThread() >> and that cost is justified as part of meeting the JNI spec. >> >> Adding the unexited Java monitor check to all exiting Java >> threads should not be done lightly due to the cost. If the >> VM is functioning correctly, then why impose this cost on >> all exiting Java threads? >> >> >>> I don't think two new command-line options (has this gone through CCC >>> yet?) are justified. >> >> No, this has not gone through CCC yet. My preference is to get >> code review feedback (like this) before submitting a CCC. >> >> I suppose I could have simply added more sub-options to the >> existing Java monitor subsystem knobs and switches, but it >> seemed to make sense to model JavaThreadExitReleasesMonitors >> on the existing JNIDetachReleasesMonitors. >> >> >>> Also note that allowing for JVM induced missing unlocks is something >>> that can affect JNI attached threads as well as regular Java threads. >>> I'll take this up in discussing thread.cpp below. >>> >>> That aside, the comment, which was modelled on the JNI DetachThread >>> variant, does not really work in this case: >>> >>> 2801 "JavaThread exit() releases monitors owned by thread") >>> \ >>> >>> JavaThread is not a programming concept but an internal JVM >>> abstraction. I would suggest something like: >>> >>> "Java thread termination releases monitors unexpectedly still owned by >>> thread" >> >> I'll switch to your description text if we end up keeping the >> new options. >> >> >>> --- >>> >>> src/share/vm/runtime/objectMonitor.cpp >>> src/share/vm/runtime/objectMonitor.hpp >>> >>> No comments >>> >>> --- >>> >>> src/share/vm/runtime/synchronizer.cpp >>> >>> If we find the unexpected locked monitor it would be useful to see >>> more Java level information about the Thread (in the non-detaching >>> case) and the object that is locked. >> >> I can probably steal some code from the thread dump side to >> give us more info about the Object associated with the Java >> monitor... >> >> >>> --- >>> >>> src/share/vm/runtime/thread.cpp >>> >>> As noted previously JNI attached threads can also be affected by JVM >>> induced locking bugs. So the comment block: >>> >>> 1804 // 6282335 JNI DetachCurrentThread spec states that all Java >>> monitors >>> 1805 // held by this thread must be released. A detach operation >>> must only >>> 1806 // get here if there are no Java frames on the stack. >>> Therefore, any >>> 1807 // owned monitors at this point MUST be JNI-acquired monitors >>> which are >>> 1808 // pre-inflated and in the monitor cache. >>> >>> is not strictly correct as it is presuming a correctly operating JVM. >> >> I actually disagree with the last two sentences in that comment block, >> but I didn't have a good rewrite in mind. I'll think about it more. >> >> >> >>> Further the logic now applied: >>> >>> 1816 if ((exit_type == jni_detach && JNIDetachReleasesMonitors) || >>> 1817 JavaThreadExitReleasesMonitors) { >>> >>> is also not "correct" because if we have >>> JavaThreadExitReleasesMonitors true while JNIDetachReleasesMonitors is >>> false, we will in fact release any JNI acquired monitors because we >>> can't make the distinction. >> >> I don't think JNIDetachReleasesMonitors only has to deal with >> JNI-acquired >> monitors and I don't think that JavaThreadExitReleasesMonitors only >> has to >> deal with Java code acquired monitors. I see these options as >> applying to >> "how you got to the Java thread exit path" and not applying to "what >> needs >> to be cleaned up". >> >> I see JNIDetachReleasesMonitors as a way of cleaning up unexited Java >> monitors when we're executing the JNI DetachCurrentThread() code path. >> I don't really care why the Java monitors are unexited... and I think >> the spec wording is clear that all unexited Java monitors are cleaned >> up... not just JNI-acquired monitors. >> >> I see JavaThreadExitReleasesMonitors as a way of cleaning up unexited >> Java monitors in any code path where we are exiting the Java thread. >> I see >> JavaThreadExitReleasesMonitors as a superset of >> JNIDetachReleasesMonitors. >> >> >>> Given we can't make the distinction I don't see any way for these >>> separate flags to actually work well together. >> >> I think they work well together when JavaThreadExitReleasesMonitors >> is seen as a superset of JNIDetachReleasesMonitors. Of course, that >> hinges on my opinion that JNIDetachReleasesMonitors applies to any >> unexited Java monitor and not just JNI-acquired Java monitors. >> >> >>> As I said above I'm more inclined to just add a guarantee to the >>> non-detach case, than add two new flags. (Even though this means there >>> won't be detection for such bugs when JNI attached threads encounter >>> them - including the main thread :( ). >> >> I really don't want to add this check to all Java thread exit >> paths since it is expensive. >> >> >>> As I said this has me perplexed. :( >> >> Hopefully, I've explained it better now. >> >> >>> --- >>> >>> src/share/vm/runtime/vframe.cpp >>> >>> 170 // It would be nice to distinguish between "waiting on" and >>> 171 // "waited on". Currently, "waiting on" here with a >>> 172 // java.lang.Thread.State == "WAITING (on object monitor)" >>> 173 // earlier in the output means that the monitor has not yet >>> been >>> 174 // notified and java.lang.Thread.State == "BLOCKED (on object >>> 175 // monitor)" earlier in the output means that the monitor has >>> 176 // been notified and the thread is blocked on reentry. >>> >>> That's a very long sentence that can be quite difficult to parse and >>> could probably be reworded to describe how the output should be >>> interpreted eg: >>> >>> // If earlier in the output we reported java.lang.Thread.State == >>> // "WAITING (on object monitor)" and now we report "waited on", then >>> // we are still waiting for notification [or timeout?]. Otherwise if >>> // we earlier reported java.lang.Thread.State == "BLOCKED (on object >>> // monitor)", then we are actually waiting to reacquire the monitor >>> // lock. At this level we can't distinguish the two cases to report >>> // "waited on" rather than "waiting on" for the second case. >> >> I'll take a look at rewriting the comment and may just take your >> version entirely. >> >> >>> I wonder if we can prod deeper into VM state to try and make the >>> distinction? >> >> I played around with doing just that, but it seems like the M&M >> code that fetches similar state probes the state stored in the >> java.lang.Thread object. I didn't want to go there. >> >> >>> >>> 184 } else { >>> 185 st->print_cr("\t- %s ", wait_state); >>> >>> The concept of "locals" is confusing here. Isn't the "local" in this >>> case just the object that we have waited upon? In which case we should >>> say "no object reference available". >> >> I got the phrase "locals" from the compiler code that was trying to >> decode the object reference. I can change to "no object reference >> available". >> I definitely want to say _something_ here. The existing code is just >> silent. >> >> >>> Though I would have thought/hoped there must be a way to find the >>> object reference even in a compiled frame? >> >> Yes, if you deopt... I didn't want to go there. >> >> >>> 195 // Print out all monitors that we have locked, are trying to lock >>> 196 // or are trying to relock after a wait(). >>> >>> that makes it sound like there are three cases when really a "relock" >>> is just a specific case of lock. I would suggest: >>> >>> // Print out all monitors that we have locked, or are trying to >>> // lock, including re-locking when returning from a wait(). >> >> Making it more clear that the "re-locking" is coming from "wait()" >> is an improvement. I'll fix this. >> >> >>> 252 lock_state = "waiting to relock"; >>> >>> I prefer "waiting to re-lock in wait()", if that isn't too long. >>> Otherwise "relock" needs to be a concept people are familiar with. >> >> I like "waiting to re-lock in wait()". >> >> >>> 260 if (VerboseStackTrace && mark != NULL) { >>> 261 st->print("\t- lockbits="); >>> 262 mark->print_on(st); >>> >>> This really doesn't seem to warrant a new diagnostic flag, regardless >>> of whether we think applying -XX:+Verbose is a good fit or not. >> >> I suspect that David C didn't want to change the default output format >> and neither do I. We have some tests that try to parse out specific >> things from thread dumps to verify certain bug fixes and we don't want >> to break those. I'm thinking of the "duplicate owner" bug fix that we >> fixed in thread dumps, but I can't pull up the bug ID (yet)... >> >> Thanks for the thorough review. I have to say that I wasn't expecting >> much comment on this review at all. :-) >> >> >> Dan >> >> >>> >>> Thanks, >>> David >>> ------- >>> >>>> This work is being tracked by the following bug ID: >>>> >>>> JDK-8130448 8077392 inspired thread dump improvements, comment >>>> additions, new diagnostics >>>> https://bugs.openjdk.java.net/browse/JDK-8130448 >>>> >>>> Here is the webrev URL: >>>> >>>> http://cr.openjdk.java.net/~dcubed/8130448-webrev/0-jdk9-hs-rt/ >>>> >>>> Testing: >>>> >>>> - RBT vm.quick batches (in process) >>>> - JPRT test jobs >>>> >>>> Thanks, in advance, for any comments, questions or suggestions. >>>> >>>> Gory details about the changes are below... >>>> >>>> Dan >>>> >>>> 8130448 summary of changes: >>>> >>>> src/cpu/x86/vm/macroAssembler_x86.cpp >>>> - comment additions for the assembly code >>>> >>>> src/share/vm/oops/markOop.cpp >>>> - has_monitor() has to be checked before is_locked() since >>>> the has_monitor() bits are a superset of the is_locked() bits >>>> - code style fixes >>>> >>>> src/share/vm/runtime/globals.hpp >>>> - add VerboseStackTrace diagnostic option >>>> - add GuaranteeOnMonitorMismatch diagnostic option >>>> - add JavaThreadExitReleasesMonitors product option; >>>> this is the Java equivalent of JNIDetachReleasesMonitors >>>> >>>> src/share/vm/runtime/objectMonitor.cpp >>>> - delete unused ObjectMonitor::try_enter() >>>> - fix assert wording >>>> >>>> src/share/vm/runtime/objectMonitor.hpp >>>> - delete unused ObjectMonitor::try_enter() >>>> >>>> src/share/vm/runtime/synchronizer.cpp >>>> - add GuaranteeOnMonitorMismatch support with some >>>> diagnostic output >>>> >>>> src/share/vm/runtime/thread.cpp >>>> - add JavaThreadExitReleasesMonitors support >>>> >>>> src/share/vm/runtime/vframe.cpp >>>> - clarify existing comments >>>> - add comments to clarify what "waiting on" means >>>> - add line to show when we are "waiting on", but >>>> there are no locals available (previously we were >>>> "waiting on" silently) >>>> - add support for "waiting to relock" which can happen >>>> for any of the monitors and not just the top monitor >>>> - switch mark->print_on() verbose output to new >>>> VerboseStackTrace switch; thread dumps are not enabled >>>> with a specific switch so the '-XX:+Verbose' model of >>>> being a modifier for another option does not fit >> From david.holmes at oracle.com Tue Jul 7 23:18:57 2015 From: david.holmes at oracle.com (David Holmes) Date: Wed, 8 Jul 2015 09:18:57 +1000 Subject: [8u65] Request for approval: backport of JDK-8007890 In-Reply-To: <55971A6A.9060205@oracle.com> References: <542E8041.1010101@oracle.com> <558D5430.7040209@oracle.com> <558F1F4B.7040706@oracle.com> <5596B47D.8090104@oracle.com> <55971A6A.9060205@oracle.com> Message-ID: <559C5E61.5000605@oracle.com> Hi Alexander, I approve this for backport to jdk8u/hs-dev (8u66). Thanks, David On 4/07/2015 9:27 AM, David Holmes wrote: > On 4/07/2015 2:12 AM, alexander vorobyev wrote: >> Hi David, >> >> It is too late for 8u60, I guess. So I decided to fix it in 8u65. And in >> this case it should be jdk8u-cpu repository. >> >> Maybe it is possible to target to 8u66? To which repository can I push >> it in this case (considering that jdk8u/hs-dev is not accepting any >> change)? > > jdk8u/hs-dev is now accepting changes for 8u66. > > Cheers, > David > >> Thanks >> >> >> On 28-Jun-15 1:10 AM, David Holmes wrote: >>> Hi Alexander, >>> >>> Why is this targeted to 8u65 and where do you propose to push it? >>> jdk8u/hs-dev is not accepting any changes at the moment. >>> >>> Thanks, >>> David >>> >>> On 26/06/2015 11:31 PM, alexander vorobyev wrote: >>>> >>>> Hi All, >>>> >>>> I would like to backport fix for JDK-8007890 to 8u65. >>>> >>>> Bug id:https://bugs.openjdk.java.net/browse/JDK-8007890 >>>> Webrev:http://cr.openjdk.java.net/~ctornqvi/webrev/8007890/webrev.00/ >>>> >>>> Changeset:http://hg.openjdk.java.net/jdk9/jdk9/hotspot/rev/e865e9584e0e >>>> Review thread for original >>>> fix:http://mail.openjdk.java.net/pipermail/hotspot-runtime-dev/2014-March/011228.html >>>> >>>> >>>> >>>> >>>> testing: jprt >>>> >>>> Thanks, >>>> Alexander >>>> >>>> >>>> >> From jeremymanson at google.com Wed Jul 8 00:00:26 2015 From: jeremymanson at google.com (Jeremy Manson) Date: Tue, 7 Jul 2015 17:00:26 -0700 Subject: RFR: 8079301: Some command line options not settable via JAVA_TOOL_OPTIONS In-Reply-To: References: <554839B4.3020800@oracle.com> Message-ID: No love? Is there a code owner here I should pester more directly? Jeremy On Fri, Jun 26, 2015 at 3:00 PM, Martin Buchholz wrote: > As usual with Google patches, they are in use locally. This one has been > stable for a while without complaints. Please sponsor. > > On Fri, Jun 26, 2015 at 1:53 PM, Jeremy Manson > wrote: > >> All this talk about IgnoreUnrecognizedVMOptions reminded me that this >> review is still outstanding. Any takers? >> >> Jeremy >> >> On Tue, May 5, 2015 at 10:01 AM, Jeremy Manson >> wrote: >> >>> Hi David, >>> >>> Thanks for taking a look. >>> >>> On Mon, May 4, 2015 at 8:32 PM, David Holmes >>> wrote: >>> >>>> Hi Jeremy, >>>> >>>> On 5/05/2015 6:51 AM, Jeremy Manson wrote: >>>> >>>>> Not sure who might be willing to sponsor this. David? You did the >>>>> last >>>>> one. :) >>>>> >>>> >>>> Might be a while before I can get to it. I did have a quick look (and >>>> will need a longer one). >>> >>> >>> I understand. I'm just happy it's possible to upstream this stuff at >>> all[1]. >>> >>> [1] With the eternal caveat that I'd be happier if we didn't *have* to >>> go through you folks, but we've learned to live with it. >>> >>> >>> >>>> Context: A number of command line options are not settable via >>>>> JAVA_TOOL_OPTIONS and _JAVA_OPTIONS: >>>>> >>>>> - PrintVMOptions >>>>> >>>> >>>> So you have changed the semantics of this to print out the options from >>>> the command-line and each of the two env vars. Seems reasonable but may be >>>> better to know which option came from where as we can now see the same >>>> option (or conflicting variants thereof) multiple times. >>>> >>> >>> I'd be happy to do this. Any preferred syntax? Does someone actually >>> own this feature? >>> >>> I'm unclear what the current processing order is for the different >>>> sources of options, and whether the changes affect that order? >>>> >>> >>> Nope. I go through sad contortions to keep the processing order the >>> same. It's JAVA_TOOL_OPTIONS, then command line, then _JAVA_OPTIONS. See >>> lines 2549-2567. >>> >>> >>>> >>>> - IgnoreUnrecognizedVMOptions >>>>> - PrintFlagsInitial >>>>> >>>> >>>> Unclear what "initial" actually means - is it the default? >>> >>> >>> More or less. If you stick, for example, IgnoreUnrecognizedVMOptions in >>> there first, it will get printed out as "true". I haven't really changed >>> the semantics here either - I've just added processing of the envvars. >>> >>> - NativeMemoryTracking >>>>> - PrintFlagsWithComments >>>>> >>>>> This is because these flags have to be processed before processing >>>>> other >>>>> flags, and no one ever bothered to do that for the flags coming from >>>>> environment variables. This patch fixes that problem. >>>>> >>>>> I have a test, but it is a modification to a JDK test instead of a HS >>>>> test, >>>>> so it can go in separately (I guess). >>>>> >>>> >>>> They can be pushed together to different repos in the same forest. >>>> >>> >>> Okay. Here's the test change: >>> >>> http://cr.openjdk.java.net/~jmanson/8079301t/webrev.00/ >>> >>> >>>> As I said I'll have to get back to this. And hopefully someone else in >>>> runtime will take a good look as well ;-) >>>> >>> >>> I'd be happy to toss it over to whomever owns this, if anyone. Thanks! >>> >>> Jeremy >>> >>> >>> >>>> >>>> Bug: >>>>> https://bugs.openjdk.java.net/browse/JDK-8079301 >>>>> >>>>> Webrev: >>>>> http://cr.openjdk.java.net/~jmanson/8079301/webrev.00/ >>>>> >>>>> Jeremy >>>>> >>>>> >>> >> > From harold.seigel at oracle.com Wed Jul 8 12:16:45 2015 From: harold.seigel at oracle.com (harold seigel) Date: Wed, 08 Jul 2015 08:16:45 -0400 Subject: RFR(XS) 8130183: InnerClasses: VM permits wrong inner_class_info_index value of zero Message-ID: <559D14AD.7000303@oracle.com> Hi, Please review this small change to fix bug JDK-8130183. The JVM allows the InnerClasses attributes inner_class_info_index to have the value of zero. This violates JVM-Spec 8. See http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.6. The fix ensures that the inner_class_info_index is non-zero and is a valid index into the constant pool. Open Webrev: http://cr.openjdk.java.net/~hseigel/bug_8130183/ JBS Bug: https://bugs.openjdk.java.net/browse/JDK-8130183 The fix was tested with JCL Lang and VM tests, the UTE quick and split_verifier tests, and the hotspot, java/io, java/lang, and java/util JTreg tests. Thanks, Harold From lois.foltan at oracle.com Wed Jul 8 12:53:47 2015 From: lois.foltan at oracle.com (Lois Foltan) Date: Wed, 08 Jul 2015 08:53:47 -0400 Subject: RFR(XS) 8130183: InnerClasses: VM permits wrong inner_class_info_index value of zero In-Reply-To: <559D14AD.7000303@oracle.com> References: <559D14AD.7000303@oracle.com> Message-ID: <559D1D5B.7090206@oracle.com> Looks good. Lois On 7/8/2015 8:16 AM, harold seigel wrote: > Hi, > > Please review this small change to fix bug JDK-8130183. The JVM > allows the InnerClasses attributes inner_class_info_index to have the > value of zero. This violates JVM-Spec 8. See > http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.6. > > The fix ensures that the inner_class_info_index is non-zero and is a > valid index into the constant pool. > > Open Webrev: http://cr.openjdk.java.net/~hseigel/bug_8130183/ > > JBS Bug: https://bugs.openjdk.java.net/browse/JDK-8130183 > > The fix was tested with JCL Lang and VM tests, the UTE quick and > split_verifier tests, and the hotspot, java/io, java/lang, and > java/util JTreg tests. > > Thanks, Harold From harold.seigel at oracle.com Wed Jul 8 12:55:21 2015 From: harold.seigel at oracle.com (harold seigel) Date: Wed, 08 Jul 2015 08:55:21 -0400 Subject: RFR(XS) 8130183: InnerClasses: VM permits wrong inner_class_info_index value of zero In-Reply-To: <559D1D5B.7090206@oracle.com> References: <559D14AD.7000303@oracle.com> <559D1D5B.7090206@oracle.com> Message-ID: <559D1DB9.4050809@oracle.com> Thanks for the review! Harold On 7/8/2015 8:53 AM, Lois Foltan wrote: > Looks good. > Lois > > On 7/8/2015 8:16 AM, harold seigel wrote: >> Hi, >> >> Please review this small change to fix bug JDK-8130183. The JVM >> allows the InnerClasses attributes inner_class_info_index to have the >> value of zero. This violates JVM-Spec 8. See >> http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.6. >> >> The fix ensures that the inner_class_info_index is non-zero and is a >> valid index into the constant pool. >> >> Open Webrev: http://cr.openjdk.java.net/~hseigel/bug_8130183/ >> >> JBS Bug: https://bugs.openjdk.java.net/browse/JDK-8130183 >> >> The fix was tested with JCL Lang and VM tests, the UTE quick and >> split_verifier tests, and the hotspot, java/io, java/lang, and >> java/util JTreg tests. >> >> Thanks, Harold > From coleen.phillimore at oracle.com Wed Jul 8 13:19:56 2015 From: coleen.phillimore at oracle.com (Coleen Phillimore) Date: Wed, 08 Jul 2015 09:19:56 -0400 Subject: RFR: 8079301: Some command line options not settable via JAVA_TOOL_OPTIONS In-Reply-To: References: <554839B4.3020800@oracle.com> Message-ID: <559D237C.2060702@oracle.com> I'll sponsor it but can you repost the RFR? There has been a fair bit of work to command line processing lately so I'd like to have the others look at it too. Have you merged this up with the latest version of hs-rt repository and were there conflicts? Also, have you looked at the RFR: "Open code review for 8061999 Enhance VM option parsing to allow options to be specified" and are there conflicts with this? The hotspot change looks good to me. http://cr.openjdk.java.net/~jmanson/8079301t/webrev.00/test/com/sun/management/HotSpotDiagnosticMXBean/CheckOrigin.java.udiff.html "UseCerealGC" LOL Can you use a different option than PrintOopAddress in this test? I don't know why this command line option exists or would be useful for, and seems to be a good candidate for removal. If you need a valid argument, that is unlikely to go away, TraceExceptions would be good. Thanks, Coleen On 7/7/15 8:00 PM, Jeremy Manson wrote: > No love? Is there a code owner here I should pester more directly? > > Jeremy > > On Fri, Jun 26, 2015 at 3:00 PM, Martin Buchholz > wrote: > >> As usual with Google patches, they are in use locally. This one has been >> stable for a while without complaints. Please sponsor. >> >> On Fri, Jun 26, 2015 at 1:53 PM, Jeremy Manson >> wrote: >> >>> All this talk about IgnoreUnrecognizedVMOptions reminded me that this >>> review is still outstanding. Any takers? >>> >>> Jeremy >>> >>> On Tue, May 5, 2015 at 10:01 AM, Jeremy Manson >>> wrote: >>> >>>> Hi David, >>>> >>>> Thanks for taking a look. >>>> >>>> On Mon, May 4, 2015 at 8:32 PM, David Holmes >>>> wrote: >>>> >>>>> Hi Jeremy, >>>>> >>>>> On 5/05/2015 6:51 AM, Jeremy Manson wrote: >>>>> >>>>>> Not sure who might be willing to sponsor this. David? You did the >>>>>> last >>>>>> one. :) >>>>>> >>>>> Might be a while before I can get to it. I did have a quick look (and >>>>> will need a longer one). >>>> >>>> I understand. I'm just happy it's possible to upstream this stuff at >>>> all[1]. >>>> >>>> [1] With the eternal caveat that I'd be happier if we didn't *have* to >>>> go through you folks, but we've learned to live with it. >>>> >>>> >>>> >>>>> Context: A number of command line options are not settable via >>>>>> JAVA_TOOL_OPTIONS and _JAVA_OPTIONS: >>>>>> >>>>>> - PrintVMOptions >>>>>> >>>>> So you have changed the semantics of this to print out the options from >>>>> the command-line and each of the two env vars. Seems reasonable but may be >>>>> better to know which option came from where as we can now see the same >>>>> option (or conflicting variants thereof) multiple times. >>>>> >>>> I'd be happy to do this. Any preferred syntax? Does someone actually >>>> own this feature? >>>> >>>> I'm unclear what the current processing order is for the different >>>>> sources of options, and whether the changes affect that order? >>>>> >>>> Nope. I go through sad contortions to keep the processing order the >>>> same. It's JAVA_TOOL_OPTIONS, then command line, then _JAVA_OPTIONS. See >>>> lines 2549-2567. >>>> >>>> >>>>> - IgnoreUnrecognizedVMOptions >>>>>> - PrintFlagsInitial >>>>>> >>>>> Unclear what "initial" actually means - is it the default? >>>> >>>> More or less. If you stick, for example, IgnoreUnrecognizedVMOptions in >>>> there first, it will get printed out as "true". I haven't really changed >>>> the semantics here either - I've just added processing of the envvars. >>>> >>>> - NativeMemoryTracking >>>>>> - PrintFlagsWithComments >>>>>> >>>>>> This is because these flags have to be processed before processing >>>>>> other >>>>>> flags, and no one ever bothered to do that for the flags coming from >>>>>> environment variables. This patch fixes that problem. >>>>>> >>>>>> I have a test, but it is a modification to a JDK test instead of a HS >>>>>> test, >>>>>> so it can go in separately (I guess). >>>>>> >>>>> They can be pushed together to different repos in the same forest. >>>>> >>>> Okay. Here's the test change: >>>> >>>> http://cr.openjdk.java.net/~jmanson/8079301t/webrev.00/ >>>> >>>> >>>>> As I said I'll have to get back to this. And hopefully someone else in >>>>> runtime will take a good look as well ;-) >>>>> >>>> I'd be happy to toss it over to whomever owns this, if anyone. Thanks! >>>> >>>> Jeremy >>>> >>>> >>>> >>>>> Bug: >>>>>> https://bugs.openjdk.java.net/browse/JDK-8079301 >>>>>> >>>>>> Webrev: >>>>>> http://cr.openjdk.java.net/~jmanson/8079301/webrev.00/ >>>>>> >>>>>> Jeremy >>>>>> >>>>>> From harold.seigel at oracle.com Wed Jul 8 13:32:22 2015 From: harold.seigel at oracle.com (harold seigel) Date: Wed, 08 Jul 2015 09:32:22 -0400 Subject: RFR(XS) 8130669: VM prohibits methods with return values Message-ID: <559D2666.5010209@oracle.com> Hi, Please review this small change to fix bug JDK-8130669. The JVM incorrectly throws ClassFormatError exceptions for non-void methods named . But, the JVM Spec 8 says that such methods should be ignored. See http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-2.html#jvms-2.9 for details. The fix changes the JVM to, in this case, only throw ClassFormatError exceptions for non-void methods. Open Webrev: http://cr.openjdk.java.net/~hseigel/bug_8130669/ JBS Bug: https://bugs.openjdk.java.net/browse/JDK-8130669 The fix was tested with JCK Lang and VM tests, the UTE quick and split_verifier tests, and the hotspot, java/io, java/lang, and java/util JTreg tests. Thanks, Harold From karen.kinnear at oracle.com Wed Jul 8 16:07:29 2015 From: karen.kinnear at oracle.com (Karen Kinnear) Date: Wed, 8 Jul 2015 12:07:29 -0400 Subject: RFR(XS) 8130183: InnerClasses: VM permits wrong inner_class_info_index value of zero In-Reply-To: <559D14AD.7000303@oracle.com> References: <559D14AD.7000303@oracle.com> Message-ID: <47D48089-A6A5-41A7-9C03-11AE9167C66A@oracle.com> Harold, The code looks good. Does this also catch the anonymous/local class with zero inner_class_info_index - i.e. did you run the other examples attached to the bug? thanks, Karen On Jul 8, 2015, at 8:16 AM, harold seigel wrote: > Hi, > > Please review this small change to fix bug JDK-8130183. The JVM allows the InnerClasses attributes inner_class_info_index to have the value of zero. This violates JVM-Spec 8. See http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.6. > > The fix ensures that the inner_class_info_index is non-zero and is a valid index into the constant pool. > > Open Webrev: http://cr.openjdk.java.net/~hseigel/bug_8130183/ > > JBS Bug: https://bugs.openjdk.java.net/browse/JDK-8130183 > > The fix was tested with JCL Lang and VM tests, the UTE quick and split_verifier tests, and the hotspot, java/io, java/lang, and java/util JTreg tests. > > Thanks, Harold From karen.kinnear at oracle.com Wed Jul 8 16:41:51 2015 From: karen.kinnear at oracle.com (Karen Kinnear) Date: Wed, 8 Jul 2015 12:41:51 -0400 Subject: RFR(XS) 8130669: VM prohibits methods with return values In-Reply-To: <559D2666.5010209@oracle.com> References: <559D2666.5010209@oracle.com> Message-ID: <0E7D8DDC-044C-4DA0-B638-4538D97ECB1B@oracle.com> Harold, I like your code changes and your tests. One small comment: 1. verifier.cpp around line 2849 - could you possibly fix the comment - it says "Class file parser verifies that methods with '<' have void return" -- we only check now which is what that logic cares about thanks, Karen On Jul 8, 2015, at 9:32 AM, harold seigel wrote: > Hi, > > Please review this small change to fix bug JDK-8130669. The JVM incorrectly throws ClassFormatError exceptions for non-void methods named . But, the JVM Spec 8 says that such methods should be ignored. See http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-2.html#jvms-2.9 for details. > > The fix changes the JVM to, in this case, only throw ClassFormatError exceptions for non-void methods. > > Open Webrev: http://cr.openjdk.java.net/~hseigel/bug_8130669/ > > JBS Bug: https://bugs.openjdk.java.net/browse/JDK-8130669 > > The fix was tested with JCK Lang and VM tests, the UTE quick and split_verifier tests, and the hotspot, java/io, java/lang, and java/util JTreg tests. > > Thanks, Harold From harold.seigel at oracle.com Wed Jul 8 16:52:30 2015 From: harold.seigel at oracle.com (harold seigel) Date: Wed, 08 Jul 2015 12:52:30 -0400 Subject: RFR(XS) 8130183: InnerClasses: VM permits wrong inner_class_info_index value of zero In-Reply-To: <47D48089-A6A5-41A7-9C03-11AE9167C66A@oracle.com> References: <559D14AD.7000303@oracle.com> <47D48089-A6A5-41A7-9C03-11AE9167C66A@oracle.com> Message-ID: <559D554E.80802@oracle.com> Hi Karen, Thanks for the review. I did run all four examples attached to the bug and they all correctly throw ClassFormatError exceptions for the inner_class_info_index being zero. Harold On 7/8/2015 12:07 PM, Karen Kinnear wrote: > Harold, > > The code looks good. > > Does this also catch the anonymous/local class with zero inner_class_info_index - i.e. did you run the other examples attached to the bug? > > thanks, > Karen > > On Jul 8, 2015, at 8:16 AM, harold seigel wrote: > >> Hi, >> >> Please review this small change to fix bug JDK-8130183. The JVM allows the InnerClasses attributes inner_class_info_index to have the value of zero. This violates JVM-Spec 8. See http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.6. >> >> The fix ensures that the inner_class_info_index is non-zero and is a valid index into the constant pool. >> >> Open Webrev: http://cr.openjdk.java.net/~hseigel/bug_8130183/ >> >> JBS Bug: https://bugs.openjdk.java.net/browse/JDK-8130183 >> >> The fix was tested with JCL Lang and VM tests, the UTE quick and split_verifier tests, and the hotspot, java/io, java/lang, and java/util JTreg tests. >> >> Thanks, Harold From harold.seigel at oracle.com Wed Jul 8 16:58:43 2015 From: harold.seigel at oracle.com (harold seigel) Date: Wed, 08 Jul 2015 12:58:43 -0400 Subject: RFR(XS) 8130669: VM prohibits methods with return values In-Reply-To: <0E7D8DDC-044C-4DA0-B638-4538D97ECB1B@oracle.com> References: <559D2666.5010209@oracle.com> <0E7D8DDC-044C-4DA0-B638-4538D97ECB1B@oracle.com> Message-ID: <559D56C2.2050907@oracle.com> Hi Karen, Thanks for the review and catching that comment. I'll update it. Harold On 7/8/2015 12:41 PM, Karen Kinnear wrote: > Harold, > > I like your code changes and your tests. > > One small comment: > 1. verifier.cpp around line 2849 - could you possibly fix the comment - it says > "Class file parser verifies that methods with '<' have void return" > -- we only check now which is what that logic cares about > > thanks, > Karen > > > On Jul 8, 2015, at 9:32 AM, harold seigel wrote: > >> Hi, >> >> Please review this small change to fix bug JDK-8130669. The JVM incorrectly throws ClassFormatError exceptions for non-void methods named . But, the JVM Spec 8 says that such methods should be ignored. See http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-2.html#jvms-2.9 for details. >> >> The fix changes the JVM to, in this case, only throw ClassFormatError exceptions for non-void methods. >> >> Open Webrev: http://cr.openjdk.java.net/~hseigel/bug_8130669/ >> >> JBS Bug: https://bugs.openjdk.java.net/browse/JDK-8130669 >> >> The fix was tested with JCK Lang and VM tests, the UTE quick and split_verifier tests, and the hotspot, java/io, java/lang, and java/util JTreg tests. >> >> Thanks, Harold From karen.kinnear at oracle.com Wed Jul 8 16:58:41 2015 From: karen.kinnear at oracle.com (Karen Kinnear) Date: Wed, 8 Jul 2015 12:58:41 -0400 Subject: RFR(S) Contended Locking fast notify bucket (8075171) In-Reply-To: <557F6786.6030808@oracle.com> References: <555A4678.7020308@oracle.com> <556417AF.8050203@oracle.com> <557F6786.6030808@oracle.com> Message-ID: Dan, I don't know if you created rfes or not for the potential ideas. What I did when I cleaned this up earlier was move them to a wiki page http://j2se.us.oracle.com/web/bin/view/HotspotRuntime/SyncFutures So we could create rfes when we thought we might be actually adopting the ideas. This is linked off of the runtime brainstorming page in the contended locking section: https://wiki.se.oracle.com/display/JPG/JVM+Runtime+Brainstorming Feel free to modify either of those pages with new ideas. hope this helps, Karen On Jun 15, 2015, at 8:02 PM, Daniel D. Daugherty wrote: > On 5/26/15 12:50 AM, David Holmes wrote: >> Hi Dan, >> >> Sorry for the delay on this. And thanks for the detailed explanation of the changes. > > Sorry for the delay in responding to your review. It didn't make sense > (to me) to move forward with this bucket while the regression introduced > by the "fast enter" bucket (JDK-8077392) remained in such an unknown > state. While still unresolved, much is known about JDK-8077392 and I > feel more comfortable about moving forward with the "fast notify" > bucket (JDK-8075171). > > >> Overall looks good only a couple of nits. :) > > Thanks! > > >> See below ... > > As usual, replies are embedded below. > > >> >> On 19/05/2015 6:07 AM, Daniel D. Daugherty wrote: >>> Greetings, >>> >>> I have the Contended Locking fast notify bucket ready for review. >>> >>> The code changes in this bucket are the final piece in the triad >>> of {fast-enter, fast-exit, fast-notify} changes. There are no >>> macro assembler changes in this bucket (yeah!), but there are >>> code review cleanups motivated by comments on other buckets, e.g., >>> changing variables like 'Tally' -> 'tally'. >>> >>> This work is being tracked by the following bug ID: >>> >>> JDK-8075171 Contended Locking fast notify bucket >>> https://bugs.openjdk.java.net/browse/JDK-8075171 >>> >>> Here is the webrev URL: >>> >>> http://cr.openjdk.java.net/~dcubed/8075171-webrev/0-jdk9-hs-rt/ >>> >>> Here is the JEP link: >>> >>> https://bugs.openjdk.java.net/browse/JDK-8046133 >>> >>> Testing: >>> >>> - Aurora Adhoc RT/SVC baseline batch >>> - JPRT test jobs >>> - MonitorWaitNotifyStresser micro-benchmark (in process) >>> - CallTimerGrid stress testing (in process) >>> - Aurora performance testing: >>> - out of the box for the "promotion" and 32-bit server configs >>> - heavy weight monitors for the "promotion" and 32-bit server configs >>> (-XX:-UseBiasedLocking -XX:+UseHeavyMonitors) >>> (in process) >>> >>> The hang somehow introduced by the "fast enter" bucket is still >>> unresolved, but progress is being made. That work is being tracked >>> by the following bug: >>> >>> JDK-8077392 Stream fork/join tasks occasionally fail to complete >>> https://bugs.openjdk.java.net/browse/JDK-8077392 >>> >>> You'll see a change that re-enables the "fast enter" bucket in this >>> webrev, but that change will not be pushed when we're done with the >>> review of this bucket unless JDK-8077392 is resolved. >>> >>> Thanks, in advance, for any comments, questions or suggestions. >>> >>> Gory details about the changes are below... >>> >>> Dan >>> >>> >>> 8075171 summary of changes: >>> >>> src/share/vm/classfile/vmSymbols.hpp >>> - Add do_intrinsic() entries for _notify and _notifyAll >> >> Ok >> >>> src/share/vm/opto/library_call.cpp >>> - Add optional inline_notify() that is controlled by new >>> '-XX:[+-]InlineNotify' option >> >> Ok >> >>> src/share/vm/opto/runtime.cpp >>> src/share/vm/opto/runtime.hpp >>> - Add OptoRuntime::monitor_notify_C() and >>> OptoRuntime::monitor_notifyAll_C() functions to support >>> the new "fast notify" code paths >>> - Add new OptoRuntime::monitor_notify_Type() to support >>> the above two new functions >> >> Ok >> >>> src/share/vm/runtime/globals.hpp >>> - Add '-XX:[+-]InlineNotify' option; default option value is >>> enabled (true) >> >> Ok >> >>> src/share/vm/runtime/objectMonitor.cpp >>> src/share/vm/runtime/objectMonitor.hpp >>> - Refactor ObjectMonitor::notify() and ObjectMonitor::notifyAll() >>> into wrappers that call the new ObjectMonitor::INotify() >>> - Add new ObjectMonitor::INotify() to reduce code duplication >>> between "notify" and "notifyAll" code paths >> >> Why does INotify return int ? > > I'm going to guess that this is a left-over from an earlier version of > the refactor of ObjectMonitor::notify() and ObjectMonitor::notifyAll(). > I will change it to return 'void'. > > >> The soliloquy starting: >> >> 1762 // Consider: a non-uncommon synchronization bug is to use notify() when notifyAll() >> >> seems somewhat out of context without some option to turn notify into notifyAll, > > The prefix of "Consider:" in a comment marks an idea that we should > consider implementing. We're thinking about moving these ideas into > RFE's in order to improve the readability of the code as it stands > today. > > >> or apply the MinimumWait. > > The '-XX:SyncFlags=1' option causes all park() operations to use a small > timer value so it is a good way to check for lost unpark() operations. > 'MinimumWait' doesn't exist as anything other than comments. I suspect > that it was superseded by RecheckInterval and MaximumRecheckInterval. > I'll look at fixing those comments. > > >> Further a lost wakeup need not imply incorrect use of notify rather than notifyAll so there are really two different debugging techniques being described. > > I don't think the new comment block is trying to say that the only > source for a "lost wakeup" bug is due to the use of notify() when > notifyAll() is more appropriate. I'll see if I can tweak the wording > a little to make it clear that the use of notify() when notifyAll() > is more appropriate is just an example. > > >> >>> src/share/vm/runtime/sharedRuntime.cpp >>> - Temporarily re-enable the "fast enter" optimization in order >>> to do performance testing. JDK-8077392 is still unresolved, >>> but progress is being made. >> >> Ok >> >>> src/share/vm/runtime/synchronizer.cpp >>> src/share/vm/runtime/synchronizer.hpp >>> - Add ObjectSynchronizer::quick_notify() that implements the >>> new "fast notify" code paths >> >> The comment block starting: >> >> 150 // An interesting optimization is to have the JIT recognize the following >> >> seems to be an other soliloquy. While interesting I initially thought it was describing what quick_notify was doing - which it isn't. Maybe that commentary belongs somewhere in the compiler code where the intrinsification is being done? > > L150-L155 should have been marked with a "Consider:" tag. This > one screams to be moved into an RFE. > > >> The 'All' parameter to quick_notify should be 'all'. > > Yes and the 'Self' parameter should be 'self'. I thought I had > fixed those for all new functions. Guess not. :-( > > >> The comment block at lines 176 - 180 should be moved prior to line 171, because the check at 171 is the "not biased" case, and the check at 174 is the "owned by caller" case. > > 165 if (mark->has_locker() && Self->is_lock_owned((address)mark->locker())) { > > The if-block starting at line 165 is the stack locked case. > > 171 if (mark->has_monitor()) { > > The if-block starting at L171 is the inflated monitor case. > > 174 if (mon->owner() != Self) return false; > > The if-statement on L174 is the ownership sanity check for the > notify/notifyAll operation. This shouldn't happen because a > thread that doesn't own the Java Monitor should not call notify() > or notifyAll() on it, but we take the slow path in order to > provide a better failure mode. > > The biased locking case actually hits here: > > 201 return false; // revert to slow-path > > > I think I need to rip out much of the comment from L176-L180 and > maybe move some of it elsewhere. > > >> This loop: >> >> 188 for (;;) { >> 189 if (mon->first_waiter() == NULL) break; >> 190 mon->INotify(Self); >> 191 ++tally; >> 192 if (!All) break; >> 193 } >> >> would be a bit cleaner to me if written: >> >> do { >> mon->INotify(Self); >> ++tally; >> } while (mon->first_waiter() != NULL && All); > > Since that loop is protected by an initial first_waiter() check: > > 181 if (mon->first_waiter() != NULL) { > > I concur that your loop is better. I'll fix it. > > Thanks for your review! And again, sorry about the delay in responding. > > Dan > > >> >> Thanks, >> David >> >>> - The new code handles a couple of special cases where the >>> "notify" can be done without the heavy weight slow-path >>> (thread state transitions and other baggage) > From daniel.daugherty at oracle.com Wed Jul 8 17:25:47 2015 From: daniel.daugherty at oracle.com (Daniel D. Daugherty) Date: Wed, 08 Jul 2015 11:25:47 -0600 Subject: RFR(S) Contended Locking fast notify bucket (8075171) In-Reply-To: References: <555A4678.7020308@oracle.com> <556417AF.8050203@oracle.com> <557F6786.6030808@oracle.com> Message-ID: <559D5D1B.8080009@oracle.com> Karen, No new RFEs filed yet as part of this bucket (8075171). I think the migration of ideas and what-ifs needs to happen under another bug fix. We also need to figure out where to move this stuff. The wikis you mention below are Oracle internal so I don't think those are a good place to land content that is currently in OpenJDK. Dan On 7/8/15 10:58 AM, Karen Kinnear wrote: > Dan, > > I don't know if you created rfes or not for the potential ideas. > > What I did when I cleaned this up earlier was move them to a wiki page > http://j2se.us.oracle.com/web/bin/view/HotspotRuntime/SyncFutures > > So we could create rfes when we thought we might be actually adopting the ideas. > > This is linked off of the runtime brainstorming page in the contended locking section: > https://wiki.se.oracle.com/display/JPG/JVM+Runtime+Brainstorming > > Feel free to modify either of those pages with new ideas. > > hope this helps, > Karen > > On Jun 15, 2015, at 8:02 PM, Daniel D. Daugherty wrote: > >> On 5/26/15 12:50 AM, David Holmes wrote: >>> Hi Dan, >>> >>> Sorry for the delay on this. And thanks for the detailed explanation of the changes. >> Sorry for the delay in responding to your review. It didn't make sense >> (to me) to move forward with this bucket while the regression introduced >> by the "fast enter" bucket (JDK-8077392) remained in such an unknown >> state. While still unresolved, much is known about JDK-8077392 and I >> feel more comfortable about moving forward with the "fast notify" >> bucket (JDK-8075171). >> >> >>> Overall looks good only a couple of nits. :) >> Thanks! >> >> >>> See below ... >> As usual, replies are embedded below. >> >> >>> On 19/05/2015 6:07 AM, Daniel D. Daugherty wrote: >>>> Greetings, >>>> >>>> I have the Contended Locking fast notify bucket ready for review. >>>> >>>> The code changes in this bucket are the final piece in the triad >>>> of {fast-enter, fast-exit, fast-notify} changes. There are no >>>> macro assembler changes in this bucket (yeah!), but there are >>>> code review cleanups motivated by comments on other buckets, e.g., >>>> changing variables like 'Tally' -> 'tally'. >>>> >>>> This work is being tracked by the following bug ID: >>>> >>>> JDK-8075171 Contended Locking fast notify bucket >>>> https://bugs.openjdk.java.net/browse/JDK-8075171 >>>> >>>> Here is the webrev URL: >>>> >>>> http://cr.openjdk.java.net/~dcubed/8075171-webrev/0-jdk9-hs-rt/ >>>> >>>> Here is the JEP link: >>>> >>>> https://bugs.openjdk.java.net/browse/JDK-8046133 >>>> >>>> Testing: >>>> >>>> - Aurora Adhoc RT/SVC baseline batch >>>> - JPRT test jobs >>>> - MonitorWaitNotifyStresser micro-benchmark (in process) >>>> - CallTimerGrid stress testing (in process) >>>> - Aurora performance testing: >>>> - out of the box for the "promotion" and 32-bit server configs >>>> - heavy weight monitors for the "promotion" and 32-bit server configs >>>> (-XX:-UseBiasedLocking -XX:+UseHeavyMonitors) >>>> (in process) >>>> >>>> The hang somehow introduced by the "fast enter" bucket is still >>>> unresolved, but progress is being made. That work is being tracked >>>> by the following bug: >>>> >>>> JDK-8077392 Stream fork/join tasks occasionally fail to complete >>>> https://bugs.openjdk.java.net/browse/JDK-8077392 >>>> >>>> You'll see a change that re-enables the "fast enter" bucket in this >>>> webrev, but that change will not be pushed when we're done with the >>>> review of this bucket unless JDK-8077392 is resolved. >>>> >>>> Thanks, in advance, for any comments, questions or suggestions. >>>> >>>> Gory details about the changes are below... >>>> >>>> Dan >>>> >>>> >>>> 8075171 summary of changes: >>>> >>>> src/share/vm/classfile/vmSymbols.hpp >>>> - Add do_intrinsic() entries for _notify and _notifyAll >>> Ok >>> >>>> src/share/vm/opto/library_call.cpp >>>> - Add optional inline_notify() that is controlled by new >>>> '-XX:[+-]InlineNotify' option >>> Ok >>> >>>> src/share/vm/opto/runtime.cpp >>>> src/share/vm/opto/runtime.hpp >>>> - Add OptoRuntime::monitor_notify_C() and >>>> OptoRuntime::monitor_notifyAll_C() functions to support >>>> the new "fast notify" code paths >>>> - Add new OptoRuntime::monitor_notify_Type() to support >>>> the above two new functions >>> Ok >>> >>>> src/share/vm/runtime/globals.hpp >>>> - Add '-XX:[+-]InlineNotify' option; default option value is >>>> enabled (true) >>> Ok >>> >>>> src/share/vm/runtime/objectMonitor.cpp >>>> src/share/vm/runtime/objectMonitor.hpp >>>> - Refactor ObjectMonitor::notify() and ObjectMonitor::notifyAll() >>>> into wrappers that call the new ObjectMonitor::INotify() >>>> - Add new ObjectMonitor::INotify() to reduce code duplication >>>> between "notify" and "notifyAll" code paths >>> Why does INotify return int ? >> I'm going to guess that this is a left-over from an earlier version of >> the refactor of ObjectMonitor::notify() and ObjectMonitor::notifyAll(). >> I will change it to return 'void'. >> >> >>> The soliloquy starting: >>> >>> 1762 // Consider: a non-uncommon synchronization bug is to use notify() when notifyAll() >>> >>> seems somewhat out of context without some option to turn notify into notifyAll, >> The prefix of "Consider:" in a comment marks an idea that we should >> consider implementing. We're thinking about moving these ideas into >> RFE's in order to improve the readability of the code as it stands >> today. >> >> >>> or apply the MinimumWait. >> The '-XX:SyncFlags=1' option causes all park() operations to use a small >> timer value so it is a good way to check for lost unpark() operations. >> 'MinimumWait' doesn't exist as anything other than comments. I suspect >> that it was superseded by RecheckInterval and MaximumRecheckInterval. >> I'll look at fixing those comments. >> >> >>> Further a lost wakeup need not imply incorrect use of notify rather than notifyAll so there are really two different debugging techniques being described. >> I don't think the new comment block is trying to say that the only >> source for a "lost wakeup" bug is due to the use of notify() when >> notifyAll() is more appropriate. I'll see if I can tweak the wording >> a little to make it clear that the use of notify() when notifyAll() >> is more appropriate is just an example. >> >> >>>> src/share/vm/runtime/sharedRuntime.cpp >>>> - Temporarily re-enable the "fast enter" optimization in order >>>> to do performance testing. JDK-8077392 is still unresolved, >>>> but progress is being made. >>> Ok >>> >>>> src/share/vm/runtime/synchronizer.cpp >>>> src/share/vm/runtime/synchronizer.hpp >>>> - Add ObjectSynchronizer::quick_notify() that implements the >>>> new "fast notify" code paths >>> The comment block starting: >>> >>> 150 // An interesting optimization is to have the JIT recognize the following >>> >>> seems to be an other soliloquy. While interesting I initially thought it was describing what quick_notify was doing - which it isn't. Maybe that commentary belongs somewhere in the compiler code where the intrinsification is being done? >> L150-L155 should have been marked with a "Consider:" tag. This >> one screams to be moved into an RFE. >> >> >>> The 'All' parameter to quick_notify should be 'all'. >> Yes and the 'Self' parameter should be 'self'. I thought I had >> fixed those for all new functions. Guess not. :-( >> >> >>> The comment block at lines 176 - 180 should be moved prior to line 171, because the check at 171 is the "not biased" case, and the check at 174 is the "owned by caller" case. >> 165 if (mark->has_locker() && Self->is_lock_owned((address)mark->locker())) { >> >> The if-block starting at line 165 is the stack locked case. >> >> 171 if (mark->has_monitor()) { >> >> The if-block starting at L171 is the inflated monitor case. >> >> 174 if (mon->owner() != Self) return false; >> >> The if-statement on L174 is the ownership sanity check for the >> notify/notifyAll operation. This shouldn't happen because a >> thread that doesn't own the Java Monitor should not call notify() >> or notifyAll() on it, but we take the slow path in order to >> provide a better failure mode. >> >> The biased locking case actually hits here: >> >> 201 return false; // revert to slow-path >> >> >> I think I need to rip out much of the comment from L176-L180 and >> maybe move some of it elsewhere. >> >> >>> This loop: >>> >>> 188 for (;;) { >>> 189 if (mon->first_waiter() == NULL) break; >>> 190 mon->INotify(Self); >>> 191 ++tally; >>> 192 if (!All) break; >>> 193 } >>> >>> would be a bit cleaner to me if written: >>> >>> do { >>> mon->INotify(Self); >>> ++tally; >>> } while (mon->first_waiter() != NULL && All); >> Since that loop is protected by an initial first_waiter() check: >> >> 181 if (mon->first_waiter() != NULL) { >> >> I concur that your loop is better. I'll fix it. >> >> Thanks for your review! And again, sorry about the delay in responding. >> >> Dan >> >> >>> Thanks, >>> David >>> >>>> - The new code handles a couple of special cases where the >>>> "notify" can be done without the heavy weight slow-path >>>> (thread state transitions and other baggage) From karen.kinnear at oracle.com Wed Jul 8 17:31:26 2015 From: karen.kinnear at oracle.com (Karen Kinnear) Date: Wed, 8 Jul 2015 13:31:26 -0400 Subject: RFR(S) Contended Locking fast notify bucket (8075171) In-Reply-To: <557F678A.3010108@oracle.com> References: <555A4678.7020308@oracle.com> <4EF34946-A98A-4636-998E-6B38759EB2A0@oracle.com> <557F678A.3010108@oracle.com> Message-ID: Dan, On Jun 15, 2015, at 8:02 PM, Daniel D. Daugherty wrote: > On 5/27/15 2:58 PM, Karen Kinnear wrote: >> Dan, > > Sorry for the delay in responding to your review. It didn't make sense > (to me) to move forward with this bucket while the regression introduced > by the "fast enter" bucket (JDK-8077392) remained in such an unknown > state. While still unresolved, much is known about JDK-8077392 and I > feel more comfortable about moving forward with the "fast notify" > bucket (JDK-8075171). > > >> The code looks really good. > > Thanks! > > >> Thank you for the detailed description and the >> extensive testing. >> >> Two minor comments: >> 1. objectMonitor.cpp ~ 1706 - after the else if (policy == 2) > > You didn't mention it, but there's a duplicated comment on > L1706 and L1707; I'll fix that also. > > >> - could you possibly move the iterator->TState = ObjectWaiter::TS_CXQ to before the if (List == NULL)/else? >> - otherwise I think it is only set on the else My bad - the TState is set to TS_ENTER above if policy != 4 - I missed that. thanks, Karen > > I think the existing code is correct: > > 1708 if (list == NULL) { > 1709 iterator->_next = iterator->_prev = NULL; > 1710 _EntryList = iterator; > 1711 } else { > 1712 iterator->TState = ObjectWaiter::TS_CXQ; > 1713 for (;;) { > 1714 ObjectWaiter * front = _cxq; > 1715 iterator->_next = front; > 1716 if (Atomic::cmpxchg_ptr(iterator, &_cxq, front) == front) { > 1717 break; > 1718 } > 1719 } > > We set the TState to TS_CXQ on L1712 because we are prepending > stuff from the _cxq on L1714-1716. > In the if-block on L1708-1710, we aren't doing anything with > _cxq so no need to change TState from its current value. > > >> >> 2. opto.runtime.cpp >> lines 433-435 -- did you want the comment about intrinsifying hashCode()? My memory is we aren't picking up >> those changes > > I've gone back and forth about leaving that comment there or > moving it to the hashcode() bucket. We aren't picking up the > hashcode() changes as part of this JEP. I'll go back to the > original changes and see if I can remember why I put it in > this bucket; at the time, I had a good reason... :-) > > Thanks for your review! And again, sorry about the delay in responding. > > Dan > > >> >> thanks, >> Karen >> >> >> On May 18, 2015, at 4:07 PM, Daniel D. Daugherty wrote: >> >>> Greetings, >>> >>> I have the Contended Locking fast notify bucket ready for review. >>> >>> The code changes in this bucket are the final piece in the triad >>> of {fast-enter, fast-exit, fast-notify} changes. There are no >>> macro assembler changes in this bucket (yeah!), but there are >>> code review cleanups motivated by comments on other buckets, e.g., >>> changing variables like 'Tally' -> 'tally'. >>> >>> This work is being tracked by the following bug ID: >>> >>> JDK-8075171 Contended Locking fast notify bucket >>> https://bugs.openjdk.java.net/browse/JDK-8075171 >>> >>> Here is the webrev URL: >>> >>> http://cr.openjdk.java.net/~dcubed/8075171-webrev/0-jdk9-hs-rt/ >>> >>> Here is the JEP link: >>> >>> https://bugs.openjdk.java.net/browse/JDK-8046133 >>> >>> Testing: >>> >>> - Aurora Adhoc RT/SVC baseline batch >>> - JPRT test jobs >>> - MonitorWaitNotifyStresser micro-benchmark (in process) >>> - CallTimerGrid stress testing (in process) >>> - Aurora performance testing: >>> - out of the box for the "promotion" and 32-bit server configs >>> - heavy weight monitors for the "promotion" and 32-bit server configs >>> (-XX:-UseBiasedLocking -XX:+UseHeavyMonitors) >>> (in process) >>> >>> The hang somehow introduced by the "fast enter" bucket is still >>> unresolved, but progress is being made. That work is being tracked >>> by the following bug: >>> >>> JDK-8077392 Stream fork/join tasks occasionally fail to complete >>> https://bugs.openjdk.java.net/browse/JDK-8077392 >>> >>> You'll see a change that re-enables the "fast enter" bucket in this >>> webrev, but that change will not be pushed when we're done with the >>> review of this bucket unless JDK-8077392 is resolved. >>> >>> Thanks, in advance, for any comments, questions or suggestions. >>> >>> Gory details about the changes are below... >>> >>> Dan >>> >>> >>> 8075171 summary of changes: >>> >>> src/share/vm/classfile/vmSymbols.hpp >>> - Add do_intrinsic() entries for _notify and _notifyAll >>> >>> src/share/vm/opto/library_call.cpp >>> - Add optional inline_notify() that is controlled by new >>> '-XX:[+-]InlineNotify' option >>> >>> src/share/vm/opto/runtime.cpp >>> src/share/vm/opto/runtime.hpp >>> - Add OptoRuntime::monitor_notify_C() and >>> OptoRuntime::monitor_notifyAll_C() functions to support >>> the new "fast notify" code paths >>> - Add new OptoRuntime::monitor_notify_Type() to support >>> the above two new functions >>> >>> src/share/vm/runtime/globals.hpp >>> - Add '-XX:[+-]InlineNotify' option; default option value is >>> enabled (true) >>> >>> src/share/vm/runtime/objectMonitor.cpp >>> src/share/vm/runtime/objectMonitor.hpp >>> - Refactor ObjectMonitor::notify() and ObjectMonitor::notifyAll() >>> into wrappers that call the new ObjectMonitor::INotify() >>> - Add new ObjectMonitor::INotify() to reduce code duplication >>> between "notify" and "notifyAll" code paths >>> >>> src/share/vm/runtime/sharedRuntime.cpp >>> - Temporarily re-enable the "fast enter" optimization in order >>> to do performance testing. JDK-8077392 is still unresolved, >>> but progress is being made. >>> >>> src/share/vm/runtime/synchronizer.cpp >>> src/share/vm/runtime/synchronizer.hpp >>> - Add ObjectSynchronizer::quick_notify() that implements the >>> new "fast notify" code paths >>> - The new code handles a couple of special cases where the >>> "notify" can be done without the heavy weight slow-path >>> (thread state transitions and other baggage) > From daniel.daugherty at oracle.com Wed Jul 8 17:52:23 2015 From: daniel.daugherty at oracle.com (Daniel D. Daugherty) Date: Wed, 08 Jul 2015 11:52:23 -0600 Subject: RFR(S) Contended Locking fast notify bucket (8075171) In-Reply-To: References: <555A4678.7020308@oracle.com> <4EF34946-A98A-4636-998E-6B38759EB2A0@oracle.com> <557F678A.3010108@oracle.com> Message-ID: <559D6357.5000705@oracle.com> Karen, Thanks for closing the loop on this piece... Last thing is the re-review when you get the chance... Dan On 7/8/15 11:31 AM, Karen Kinnear wrote: > Dan, > > On Jun 15, 2015, at 8:02 PM, Daniel D. Daugherty wrote: > >> On 5/27/15 2:58 PM, Karen Kinnear wrote: >>> Dan, >> Sorry for the delay in responding to your review. It didn't make sense >> (to me) to move forward with this bucket while the regression introduced >> by the "fast enter" bucket (JDK-8077392) remained in such an unknown >> state. While still unresolved, much is known about JDK-8077392 and I >> feel more comfortable about moving forward with the "fast notify" >> bucket (JDK-8075171). >> >> >>> The code looks really good. >> Thanks! >> >> >>> Thank you for the detailed description and the >>> extensive testing. >>> >>> Two minor comments: >>> 1. objectMonitor.cpp ~ 1706 - after the else if (policy == 2) >> You didn't mention it, but there's a duplicated comment on >> L1706 and L1707; I'll fix that also. >> >> >>> - could you possibly move the iterator->TState = ObjectWaiter::TS_CXQ to before the if (List == NULL)/else? >>> - otherwise I think it is only set on the else > My bad - the TState is set to TS_ENTER above if policy != 4 - I missed that. > > thanks, > Karen >> I think the existing code is correct: >> >> 1708 if (list == NULL) { >> 1709 iterator->_next = iterator->_prev = NULL; >> 1710 _EntryList = iterator; >> 1711 } else { >> 1712 iterator->TState = ObjectWaiter::TS_CXQ; >> 1713 for (;;) { >> 1714 ObjectWaiter * front = _cxq; >> 1715 iterator->_next = front; >> 1716 if (Atomic::cmpxchg_ptr(iterator, &_cxq, front) == front) { >> 1717 break; >> 1718 } >> 1719 } >> >> We set the TState to TS_CXQ on L1712 because we are prepending >> stuff from the _cxq on L1714-1716. >> In the if-block on L1708-1710, we aren't doing anything with >> _cxq so no need to change TState from its current value. >> >> >>> 2. opto.runtime.cpp >>> lines 433-435 -- did you want the comment about intrinsifying hashCode()? My memory is we aren't picking up >>> those changes >> I've gone back and forth about leaving that comment there or >> moving it to the hashcode() bucket. We aren't picking up the >> hashcode() changes as part of this JEP. I'll go back to the >> original changes and see if I can remember why I put it in >> this bucket; at the time, I had a good reason... :-) >> >> Thanks for your review! And again, sorry about the delay in responding. >> >> Dan >> >> >>> thanks, >>> Karen >>> >>> >>> On May 18, 2015, at 4:07 PM, Daniel D. Daugherty wrote: >>> >>>> Greetings, >>>> >>>> I have the Contended Locking fast notify bucket ready for review. >>>> >>>> The code changes in this bucket are the final piece in the triad >>>> of {fast-enter, fast-exit, fast-notify} changes. There are no >>>> macro assembler changes in this bucket (yeah!), but there are >>>> code review cleanups motivated by comments on other buckets, e.g., >>>> changing variables like 'Tally' -> 'tally'. >>>> >>>> This work is being tracked by the following bug ID: >>>> >>>> JDK-8075171 Contended Locking fast notify bucket >>>> https://bugs.openjdk.java.net/browse/JDK-8075171 >>>> >>>> Here is the webrev URL: >>>> >>>> http://cr.openjdk.java.net/~dcubed/8075171-webrev/0-jdk9-hs-rt/ >>>> >>>> Here is the JEP link: >>>> >>>> https://bugs.openjdk.java.net/browse/JDK-8046133 >>>> >>>> Testing: >>>> >>>> - Aurora Adhoc RT/SVC baseline batch >>>> - JPRT test jobs >>>> - MonitorWaitNotifyStresser micro-benchmark (in process) >>>> - CallTimerGrid stress testing (in process) >>>> - Aurora performance testing: >>>> - out of the box for the "promotion" and 32-bit server configs >>>> - heavy weight monitors for the "promotion" and 32-bit server configs >>>> (-XX:-UseBiasedLocking -XX:+UseHeavyMonitors) >>>> (in process) >>>> >>>> The hang somehow introduced by the "fast enter" bucket is still >>>> unresolved, but progress is being made. That work is being tracked >>>> by the following bug: >>>> >>>> JDK-8077392 Stream fork/join tasks occasionally fail to complete >>>> https://bugs.openjdk.java.net/browse/JDK-8077392 >>>> >>>> You'll see a change that re-enables the "fast enter" bucket in this >>>> webrev, but that change will not be pushed when we're done with the >>>> review of this bucket unless JDK-8077392 is resolved. >>>> >>>> Thanks, in advance, for any comments, questions or suggestions. >>>> >>>> Gory details about the changes are below... >>>> >>>> Dan >>>> >>>> >>>> 8075171 summary of changes: >>>> >>>> src/share/vm/classfile/vmSymbols.hpp >>>> - Add do_intrinsic() entries for _notify and _notifyAll >>>> >>>> src/share/vm/opto/library_call.cpp >>>> - Add optional inline_notify() that is controlled by new >>>> '-XX:[+-]InlineNotify' option >>>> >>>> src/share/vm/opto/runtime.cpp >>>> src/share/vm/opto/runtime.hpp >>>> - Add OptoRuntime::monitor_notify_C() and >>>> OptoRuntime::monitor_notifyAll_C() functions to support >>>> the new "fast notify" code paths >>>> - Add new OptoRuntime::monitor_notify_Type() to support >>>> the above two new functions >>>> >>>> src/share/vm/runtime/globals.hpp >>>> - Add '-XX:[+-]InlineNotify' option; default option value is >>>> enabled (true) >>>> >>>> src/share/vm/runtime/objectMonitor.cpp >>>> src/share/vm/runtime/objectMonitor.hpp >>>> - Refactor ObjectMonitor::notify() and ObjectMonitor::notifyAll() >>>> into wrappers that call the new ObjectMonitor::INotify() >>>> - Add new ObjectMonitor::INotify() to reduce code duplication >>>> between "notify" and "notifyAll" code paths >>>> >>>> src/share/vm/runtime/sharedRuntime.cpp >>>> - Temporarily re-enable the "fast enter" optimization in order >>>> to do performance testing. JDK-8077392 is still unresolved, >>>> but progress is being made. >>>> >>>> src/share/vm/runtime/synchronizer.cpp >>>> src/share/vm/runtime/synchronizer.hpp >>>> - Add ObjectSynchronizer::quick_notify() that implements the >>>> new "fast notify" code paths >>>> - The new code handles a couple of special cases where the >>>> "notify" can be done without the heavy weight slow-path >>>> (thread state transitions and other baggage) > > From karen.kinnear at oracle.com Wed Jul 8 17:53:54 2015 From: karen.kinnear at oracle.com (Karen Kinnear) Date: Wed, 8 Jul 2015 13:53:54 -0400 Subject: RFR(S) Contended Locking fast notify bucket (8075171) In-Reply-To: <559724B0.6000507@oracle.com> References: <555A4678.7020308@oracle.com> <559724B0.6000507@oracle.com> Message-ID: <59B99866-C9BB-46F8-87C3-7E6FA8122227@oracle.com> Dan, Looks good. Only comment is - In ObjectMonitor::INotify - lines 1668-1671 the default value of policy is "2" -- which basically is "b" not "a" unless the EntryList is empty. thanks, Karen On Jul 3, 2015, at 8:11 PM, Daniel D. Daugherty wrote: > Greetings, > > I've updated the patch for Contended Locking fast notify bucket > based on David H's and Karen's comments. > > This work is being tracked by the following bug ID: > > JDK-8075171 Contended Locking fast notify bucket > https://bugs.openjdk.java.net/browse/JDK-8075171 > > Here is the webrev URL: > > http://cr.openjdk.java.net/~dcubed/8075171-webrev/1-jdk9-hs-rt/ > > Here is the JEP link: > > https://bugs.openjdk.java.net/browse/JDK-8046133 > > Testing: > > - RBT vm.quick batches (in process) > - JPRT test jobs > - MonitorWaitNotifyStresser micro-benchmark (in process) > - CallTimerGrid stress testing (in process) > > > The changes in this round are in only four of the files: > > src/share/vm/opto/runtime.cpp > > - deleted comment about hashCode() that belongs in a different bucket > > src/share/vm/runtime/objectMonitor.cpp > > - add MAX_RECHECK_INTERVAL define for use in ObjectMonitor::EnterI() > - cleanup recheck interval code > - ObjectMonitor::INotify() return type is now "void" > - delete duplicate comments, clarify/rewrite some comments > > src/share/vm/runtime/objectMonitor.hpp > > - ObjectMonitor::INotify() return type is now "void" > > src/share/vm/runtime/synchronizer.cpp > > - clarify/rewrite comments, add additional comments > - cleanup variables in ObjectSynchronizer::quick_notify > - refactor loop to be more clear > - delete unused enum MaximumRecheckInterval > > The easiest way to review the delta is to download the two patch > files and compare them in something like jfilemerge: > > http://cr.openjdk.java.net/~dcubed/8075171-webrev/0-jdk9-hs-rt/hotspot.patch > http://cr.openjdk.java.net/~dcubed/8075171-webrev/1-jdk9-hs-rt/hotspot.patch > > Dan > > > On 5/18/15 2:07 PM, Daniel D. Daugherty wrote: >> Greetings, >> >> I have the Contended Locking fast notify bucket ready for review. >> >> The code changes in this bucket are the final piece in the triad >> of {fast-enter, fast-exit, fast-notify} changes. There are no >> macro assembler changes in this bucket (yeah!), but there are >> code review cleanups motivated by comments on other buckets, e.g., >> changing variables like 'Tally' -> 'tally'. >> >> This work is being tracked by the following bug ID: >> >> JDK-8075171 Contended Locking fast notify bucket >> https://bugs.openjdk.java.net/browse/JDK-8075171 >> >> Here is the webrev URL: >> >> http://cr.openjdk.java.net/~dcubed/8075171-webrev/0-jdk9-hs-rt/ >> >> Here is the JEP link: >> >> https://bugs.openjdk.java.net/browse/JDK-8046133 >> >> Testing: >> >> - Aurora Adhoc RT/SVC baseline batch >> - JPRT test jobs >> - MonitorWaitNotifyStresser micro-benchmark (in process) >> - CallTimerGrid stress testing (in process) >> - Aurora performance testing: >> - out of the box for the "promotion" and 32-bit server configs >> - heavy weight monitors for the "promotion" and 32-bit server configs >> (-XX:-UseBiasedLocking -XX:+UseHeavyMonitors) >> (in process) >> >> The hang somehow introduced by the "fast enter" bucket is still >> unresolved, but progress is being made. That work is being tracked >> by the following bug: >> >> JDK-8077392 Stream fork/join tasks occasionally fail to complete >> https://bugs.openjdk.java.net/browse/JDK-8077392 >> >> You'll see a change that re-enables the "fast enter" bucket in this >> webrev, but that change will not be pushed when we're done with the >> review of this bucket unless JDK-8077392 is resolved. >> >> Thanks, in advance, for any comments, questions or suggestions. >> >> Gory details about the changes are below... >> >> Dan >> >> >> 8075171 summary of changes: >> >> src/share/vm/classfile/vmSymbols.hpp >> - Add do_intrinsic() entries for _notify and _notifyAll >> >> src/share/vm/opto/library_call.cpp >> - Add optional inline_notify() that is controlled by new >> '-XX:[+-]InlineNotify' option >> >> src/share/vm/opto/runtime.cpp >> src/share/vm/opto/runtime.hpp >> - Add OptoRuntime::monitor_notify_C() and >> OptoRuntime::monitor_notifyAll_C() functions to support >> the new "fast notify" code paths >> - Add new OptoRuntime::monitor_notify_Type() to support >> the above two new functions >> >> src/share/vm/runtime/globals.hpp >> - Add '-XX:[+-]InlineNotify' option; default option value is >> enabled (true) >> >> src/share/vm/runtime/objectMonitor.cpp >> src/share/vm/runtime/objectMonitor.hpp >> - Refactor ObjectMonitor::notify() and ObjectMonitor::notifyAll() >> into wrappers that call the new ObjectMonitor::INotify() >> - Add new ObjectMonitor::INotify() to reduce code duplication >> between "notify" and "notifyAll" code paths >> >> src/share/vm/runtime/sharedRuntime.cpp >> - Temporarily re-enable the "fast enter" optimization in order >> to do performance testing. JDK-8077392 is still unresolved, >> but progress is being made. >> >> src/share/vm/runtime/synchronizer.cpp >> src/share/vm/runtime/synchronizer.hpp >> - Add ObjectSynchronizer::quick_notify() that implements the >> new "fast notify" code paths >> - The new code handles a couple of special cases where the >> "notify" can be done without the heavy weight slow-path >> (thread state transitions and other baggage) >> >> > From daniel.daugherty at oracle.com Wed Jul 8 18:06:31 2015 From: daniel.daugherty at oracle.com (Daniel D. Daugherty) Date: Wed, 08 Jul 2015 12:06:31 -0600 Subject: RFR(S) Contended Locking fast notify bucket (8075171) In-Reply-To: <59B99866-C9BB-46F8-87C3-7E6FA8122227@oracle.com> References: <555A4678.7020308@oracle.com> <559724B0.6000507@oracle.com> <59B99866-C9BB-46F8-87C3-7E6FA8122227@oracle.com> Message-ID: <559D66A7.6040902@oracle.com> On 7/8/15 11:53 AM, Karen Kinnear wrote: > Dan, > > Looks good. > > Only comment is - > > In ObjectMonitor::INotify - lines 1668-1671 > the default value of policy is "2" > -- which basically is "b" not "a" unless the EntryList is empty. Nice catch! For folks on the alias that don't have this code tattooed on the inside of their eyelids. This is the relevant code: src/share/vm/runtime/objectMonitor.cpp: 136 static int Knob_MoveNotifyee = 2; // notify() - disposition of notifyee 1659 void ObjectMonitor::INotify(Thread * Self) { 1660 const int policy = Knob_MoveNotifyee; 1668 // Disposition - what might we do with iterator ? 1669 // a. add it directly to the EntryList - either tail or head. 1670 // b. push it onto the front of the _cxq. 1671 // For now we use (a). 1710 } else if (policy == 2) { // prepend to cxq I will update the comment. Dan > > thanks, > Karen > > On Jul 3, 2015, at 8:11 PM, Daniel D. Daugherty wrote: > >> Greetings, >> >> I've updated the patch for Contended Locking fast notify bucket >> based on David H's and Karen's comments. >> >> This work is being tracked by the following bug ID: >> >> JDK-8075171 Contended Locking fast notify bucket >> https://bugs.openjdk.java.net/browse/JDK-8075171 >> >> Here is the webrev URL: >> >> http://cr.openjdk.java.net/~dcubed/8075171-webrev/1-jdk9-hs-rt/ >> >> Here is the JEP link: >> >> https://bugs.openjdk.java.net/browse/JDK-8046133 >> >> Testing: >> >> - RBT vm.quick batches (in process) >> - JPRT test jobs >> - MonitorWaitNotifyStresser micro-benchmark (in process) >> - CallTimerGrid stress testing (in process) >> >> >> The changes in this round are in only four of the files: >> >> src/share/vm/opto/runtime.cpp >> >> - deleted comment about hashCode() that belongs in a different bucket >> >> src/share/vm/runtime/objectMonitor.cpp >> >> - add MAX_RECHECK_INTERVAL define for use in ObjectMonitor::EnterI() >> - cleanup recheck interval code >> - ObjectMonitor::INotify() return type is now "void" >> - delete duplicate comments, clarify/rewrite some comments >> >> src/share/vm/runtime/objectMonitor.hpp >> >> - ObjectMonitor::INotify() return type is now "void" >> >> src/share/vm/runtime/synchronizer.cpp >> >> - clarify/rewrite comments, add additional comments >> - cleanup variables in ObjectSynchronizer::quick_notify >> - refactor loop to be more clear >> - delete unused enum MaximumRecheckInterval >> >> The easiest way to review the delta is to download the two patch >> files and compare them in something like jfilemerge: >> >> http://cr.openjdk.java.net/~dcubed/8075171-webrev/0-jdk9-hs-rt/hotspot.patch >> http://cr.openjdk.java.net/~dcubed/8075171-webrev/1-jdk9-hs-rt/hotspot.patch >> >> Dan >> >> >> On 5/18/15 2:07 PM, Daniel D. Daugherty wrote: >>> Greetings, >>> >>> I have the Contended Locking fast notify bucket ready for review. >>> >>> The code changes in this bucket are the final piece in the triad >>> of {fast-enter, fast-exit, fast-notify} changes. There are no >>> macro assembler changes in this bucket (yeah!), but there are >>> code review cleanups motivated by comments on other buckets, e.g., >>> changing variables like 'Tally' -> 'tally'. >>> >>> This work is being tracked by the following bug ID: >>> >>> JDK-8075171 Contended Locking fast notify bucket >>> https://bugs.openjdk.java.net/browse/JDK-8075171 >>> >>> Here is the webrev URL: >>> >>> http://cr.openjdk.java.net/~dcubed/8075171-webrev/0-jdk9-hs-rt/ >>> >>> Here is the JEP link: >>> >>> https://bugs.openjdk.java.net/browse/JDK-8046133 >>> >>> Testing: >>> >>> - Aurora Adhoc RT/SVC baseline batch >>> - JPRT test jobs >>> - MonitorWaitNotifyStresser micro-benchmark (in process) >>> - CallTimerGrid stress testing (in process) >>> - Aurora performance testing: >>> - out of the box for the "promotion" and 32-bit server configs >>> - heavy weight monitors for the "promotion" and 32-bit server configs >>> (-XX:-UseBiasedLocking -XX:+UseHeavyMonitors) >>> (in process) >>> >>> The hang somehow introduced by the "fast enter" bucket is still >>> unresolved, but progress is being made. That work is being tracked >>> by the following bug: >>> >>> JDK-8077392 Stream fork/join tasks occasionally fail to complete >>> https://bugs.openjdk.java.net/browse/JDK-8077392 >>> >>> You'll see a change that re-enables the "fast enter" bucket in this >>> webrev, but that change will not be pushed when we're done with the >>> review of this bucket unless JDK-8077392 is resolved. >>> >>> Thanks, in advance, for any comments, questions or suggestions. >>> >>> Gory details about the changes are below... >>> >>> Dan >>> >>> >>> 8075171 summary of changes: >>> >>> src/share/vm/classfile/vmSymbols.hpp >>> - Add do_intrinsic() entries for _notify and _notifyAll >>> >>> src/share/vm/opto/library_call.cpp >>> - Add optional inline_notify() that is controlled by new >>> '-XX:[+-]InlineNotify' option >>> >>> src/share/vm/opto/runtime.cpp >>> src/share/vm/opto/runtime.hpp >>> - Add OptoRuntime::monitor_notify_C() and >>> OptoRuntime::monitor_notifyAll_C() functions to support >>> the new "fast notify" code paths >>> - Add new OptoRuntime::monitor_notify_Type() to support >>> the above two new functions >>> >>> src/share/vm/runtime/globals.hpp >>> - Add '-XX:[+-]InlineNotify' option; default option value is >>> enabled (true) >>> >>> src/share/vm/runtime/objectMonitor.cpp >>> src/share/vm/runtime/objectMonitor.hpp >>> - Refactor ObjectMonitor::notify() and ObjectMonitor::notifyAll() >>> into wrappers that call the new ObjectMonitor::INotify() >>> - Add new ObjectMonitor::INotify() to reduce code duplication >>> between "notify" and "notifyAll" code paths >>> >>> src/share/vm/runtime/sharedRuntime.cpp >>> - Temporarily re-enable the "fast enter" optimization in order >>> to do performance testing. JDK-8077392 is still unresolved, >>> but progress is being made. >>> >>> src/share/vm/runtime/synchronizer.cpp >>> src/share/vm/runtime/synchronizer.hpp >>> - Add ObjectSynchronizer::quick_notify() that implements the >>> new "fast notify" code paths >>> - The new code handles a couple of special cases where the >>> "notify" can be done without the heavy weight slow-path >>> (thread state transitions and other baggage) >>> >>> From karen.kinnear at oracle.com Wed Jul 8 19:26:33 2015 From: karen.kinnear at oracle.com (Karen Kinnear) Date: Wed, 8 Jul 2015 15:26:33 -0400 Subject: Open code review for 8061999 Enhance VM option parsing to allow options to be specified In-Reply-To: <5591EABE.6030301@oracle.com> References: <3d1df3cb-fe69-4c3b-b8e1-db8801d5a68f@default> <5588EA9F.3020001@oracle.com> <725f7631-425d-4918-8a92-230005d5b5ec@default> <558A1AE7.6010607@oracle.com> <224EF327-B898-4DAC-9343-4FE238604276@oracle.com> <558AD8AD.6020009@oracle.com> <558AF2AB.7040407@oracle.com> <558B8B45.4060307@oracle.com> <558BA1CC.6040100@oracle.com> <558BA53E.1010600@oracle.com> <558C312F.4070606@oracle.com> <558CEB04.5040905@oracle.com> <558D9423.1010903@oracle.com> <5591EABE.6030301@oracle.com> Message-ID: <99352AD6-77D3-42ED-AEE8-1EABD1EEA7B6@oracle.com> David, It is true that this option will not handle options that are targeted at the java launcher. And we should make that very clear in documentation - perhaps even spelling out which options are handled by the java launcher. Worth double-checking that with Kumar. There is another rfe going in for the launcher itself - which is JDK-8027634. That will cover options to the java launcher as well as to the vm and jdk via @argfiles, they same way apparently javac handles long command-lines today. Unfortunately that option only works for the specific launchers that support it. For folks who embed the jvm in their own applications, e.g. other language users, the new vm option allows them to pass in arguments to the jvm (and then up to the jdk) which the java launcher changes doesn't make possible. It might make sense as we figure out how to document this, to document the java launcher @argfiles as the usual approach for customers running java. And to document the new VM option explicitly for those who have their own launchers and call JNI_CreateJavaVM? Ron & Dmitry, A couple of test requests (you may already have these, I didn't see a code review out for 8073331) 1) tests with a jni launcher that calls JNI_CreateJavaVM 2) is there a maximum length to the options read in from the file? Also - Dmitry - can you please share your tests for this option with Henry Jen - he may want to modify them for tests for the java @argfiles. And we'll want to test the two new options together :-) thanks, Karen On Jun 29, 2015, at 9:02 PM, David Holmes wrote: > On 27/06/2015 4:04 AM, Daniel D. Daugherty wrote: >> On 6/26/15 12:02 AM, David Holmes wrote: >>> On 26/06/2015 2:49 AM, Daniel D. Daugherty wrote: >>>> On 6/25/15 12:52 AM, David Holmes wrote: >>>>> On 25/06/2015 4:38 PM, Dmitry Dmitriev wrote: >>>>>> Hello David, >>>>>> >>>>>> I mean that we can define "-Dmy.property=value" inside VM Option file. >>>>> >>>>> Okay - that isn't necessarily a good thing. This is blurring the >>>>> division of responsibility between the launcher and the VM when it >>>>> comes to argument processing. I don't see why a VM option file should >>>>> need to handle -Dxxx arguments - that suggests a need for a more >>>>> general command-file approach processed by the launcher. >>>> >>>> Hmmm... The above makes it sound like you think only the launcher >>>> handles '-DXXX' options. >>> >>> No I'm aware that some properties get passed through specifically for >>> the VM to act upon (though arguably that was a bad decision back in >>> the day and the launcher could have used the properties to set VM >>> specific options); and also that the VM will set some properties for >>> the launcher and also JDK libs to act upon. This highlights just how >>> messy property processing is. By allowing properties to be set in a >>> VMOption file you are increasing the level of mess - in particular if >>> a property is examined by the launcher before it creates the VM, then >>> that property can not be specified in the VMOptions file. So now you >>> have something that will often work but for some special cases won't >>> work. >> >> Two things: >> >> 1) >> >> > in particular if a property is examined by the launcher before it >> > creates the VM, then that property can not be specified in the >> > VMOptions file. >> >> The new support for the '-XX:VMOptionsFile=foo' option simply >> provides another path to get options into our wonderfully >> complicated options processing mechanism. It uses the same >> processing path as the existing VM cmd line options mechanism >> so it has the same capabilities (and pitfalls) as that >> mechanism. > > I don't quite see it that way. It isn't at all obvious to anyone what options on a long complex command-line get handled by whom and when. Anything in the VMOptions file will be invisible to the launcher, but that won't be obvious either. > >> If there is an option that must be handled by the launcher, >> then that option cannot be specified on the cmd line (as >> passed by the JNI invoke stuff). The new VMOptions file >> support is similarly limited. This same limitation applies >> to any other means of invoking the JVM without using our >> launcher. Nothing new here. > > Your use of "cmd line" is confusing me here. The "cmd line" is what the user types in their shell and can contain any option. What options you can pass via the JNI invocation API is quite different to a command-line. I agree the VMOptions file is akin to the options you could pass via the invocation API to be processed only by the VM. > >> I believe Ron's write-up discusses launcher only options and >> when he returns next week he should be able to attach that >> document to the bug report. >> >> 2) >> >> > the VM will set some properties for the launcher and also >> > JDK libs to act upon >> >> I can see how the VM can set properties for the JDK libs >> and that is exactly what supporting the -Dfoo stuff is all >> about, but how/where is the VM setting properties for the >> launcher? > > Sorry my mistake. I was mis-remembering what we do to force headless mode in some cases. But the launcher isn't involved in that. The launcher can't see properties set by the VM (unless it uses JNI to access the Java level data structures). > >> >>> >>> Just makes me wonder whether this is something that should be handled >>> by the VM or by the launcher. Or (dare I say it) even by a shell >>> script. ;-) >> >> At least one version of Ron's write-up talked about where >> to put this new mechanism between the launcher and the >> VM... We'll have to see what the current draft says... >> >> Shell script? Bite your tongue! :-) > > :) > > Cheers, > David > > >> Dan >> >> >>> >>> Cheers, >>> David >>> ----- >>> >>>> That is not correct... Here's the current >>>> code: >>>> >>>> src/share/vm/runtime/arguments.cpp >>>> >>>> 2691 // -D >>>> 2692 } else if (match_option(option, "-D", &tail)) { >>>> 2693 const char* value; >>>> 2694 if (match_option(option, "-Djava.endorsed.dirs=", >>>> &value) && >>>> 2695 *value!= '\0' && strcmp(value, "\"\"") != 0) { >>>> 2696 // abort if -Djava.endorsed.dirs is set >>>> 2697 jio_fprintf(defaultStream::output_stream(), >>>> 2698 "-Djava.endorsed.dirs=%s is not supported. Endorsed >>>> standards >>>> and standalone APIs\n" >>>> 2699 "in modular form will be supported via the concept of >>>> upgradea >>>> ble modules.\n", value); >>>> 2700 return JNI_EINVAL; >>>> 2701 } >>>> 2702 if (match_option(option, "-Djava.ext.dirs=", &value) && >>>> 2703 *value != '\0' && strcmp(value, "\"\"") != 0) { >>>> 2704 // abort if -Djava.ext.dirs is set >>>> 2705 jio_fprintf(defaultStream::output_stream(), >>>> 2706 "-Djava.ext.dirs=%s is not supported. Use -classpath >>>> instead. >>>> \n", value); >>>> 2707 return JNI_EINVAL; >>>> 2708 } >>>> 2709 >>>> 2710 if (!add_property(tail)) { >>>> 2711 return JNI_ENOMEM; >>>> 2712 } >>>> 2713 // Out of the box management support >>>> 2714 if (match_option(option, "-Dcom.sun.management", >>>> &tail)) { >>>> 2715 #if INCLUDE_MANAGEMENT >>>> 2716 if (FLAG_SET_CMDLINE(bool, ManagementServer, true) != >>>> Flag::SUCC >>>> ESS) { >>>> 2717 return JNI_EINVAL; >>>> 2718 } >>>> 2719 #else >>>> 2720 jio_fprintf(defaultStream::output_stream(), >>>> 2721 "-Dcom.sun.management is not supported in this >>>> VM.\n"); >>>> 2722 return JNI_ERR; >>>> 2723 #endif >>>> 2724 } >>>> >>>> >>>> L2710 is where we add a property that is not already >>>> handled by special logic above that. >>>> >>>> $ java -showversion -XX:+PrintVMOptions -Dmy.property="This is my >>>> special property." DumpMyProperty >>>> VM option '+PrintVMOptions' >>>> java version "1.9.0-ea" >>>> Java(TM) SE Runtime Environment (build 1.9.0-ea-b69) >>>> Java HotSpot(TM) 64-Bit Server VM (build 1.9.0-ea-b69, mixed mode) >>>> >>>> my.property=This is my special property. >>>> >>>> >>>> In the above example, the "my.property" Java property is parsed >>>> by the above code in the VM. The launcher doesn't care about this >>>> particular property. >>>> >>>> Dan >>>> >>>> >>>> >>>>> >>>>> David >>>>> ----- >>>>> >>>>> >>>>>> Thanks, >>>>>> Dmitry >>>>>> >>>>>> On 25.06.2015 8:01, David Holmes wrote: >>>>>>> On 25/06/2015 4:10 AM, Dmitry Dmitriev wrote: >>>>>>>> Hello Dan, >>>>>>>> I just want to add following: new VM Options file feature allow to >>>>>>>> define property inside option file. >>>>>>> >>>>>>> What do you mean by that? >>>>>>> >>>>>>> David >>>>>>> >>>>>>>> Thanks, >>>>>>>> Dmitry >>>>>>>> >>>>>>>> On 24.06.2015 19:19, Daniel D. Daugherty wrote: >>>>>>>>> On 6/23/15 10:43 PM, John Rose wrote: >>>>>>>>>> On Jun 23, 2015, at 7:50 PM, David Holmes >>>>>>>>>> >>>>>>>>>> wrote: >>>>>>>>>>> On 24/06/2015 3:43 AM, Ron Durbin wrote: >>>>>>>>>>>> David, >>>>>>>>>>>> >>>>>>>>>>>> The '-XX:Flags' option was considered during the research phase >>>>>>>>>>>> of this project and was rejected because of its limitations. The >>>>>>>>>>>> '-XX:Flags' option only works for boolean flag options and it >>>>>>>>>>>> uses a different syntax for the options than the command line. >>>>>>>>>>>> For example, '-XX:+UseSerialGC' would be specified as >>>>>>>>>>>> '+UseSerialGC' >>>>>>>>>>>> in the '-XX:Flags' option file. >>>>>>>>>>> I'm a little surprised the Flags option wasn't extended to cover >>>>>>>>>>> these additional requirements. But presumably it should now be >>>>>>>>>>> deprecated as we (again presumably) don't want to have two >>>>>>>>>>> mechanisms for doing this. >>>>>>>>>> I thought the Flags option used to handle any command line >>>>>>>>>> options, >>>>>>>>>> and like David I'm surprised the right answer is to get rid of it >>>>>>>>>> and >>>>>>>>>> make a new option that does what I think the Flags option >>>>>>>>>> should be >>>>>>>>>> doing. >>>>>>>>>> >>>>>>>>>> ? John >>>>>>>>> >>>>>>>>> Greetings, >>>>>>>>> >>>>>>>>> Ron is out of the office until next week so I'll provide a little >>>>>>>>> bit of background... >>>>>>>>> >>>>>>>>> Ron has a detailed write-up documenting all the research that he >>>>>>>>> did on the various command line option mechanisms. We had planned >>>>>>>>> to attach that write-up to the bug report, but we dropped the ball >>>>>>>>> (Sorry Mary!) After Ron returns, we'll make a final editing pass >>>>>>>>> on the document and attach it to the bug report. >>>>>>>>> >>>>>>>>> I fleshed out the '-XX:Flags' test cases that Ron posted earlier >>>>>>>>> in the thread: >>>>>>>>> >>>>>>>>> $ more flags.input.*:::::::::::::: >>>>>>>>> flags.input.boolean >>>>>>>>> :::::::::::::: >>>>>>>>> +UseSerialGC >>>>>>>>> :::::::::::::: >>>>>>>>> flags.input.ccstr >>>>>>>>> :::::::::::::: >>>>>>>>> ErrorFile=my_error_file >>>>>>>>> :::::::::::::: >>>>>>>>> flags.input.uintx >>>>>>>>> :::::::::::::: >>>>>>>>> MinRAMFraction=8 >>>>>>>>> >>>>>>>>> $ java -XX:+PrintVMOptions -XX:Flags=flags.input.boolean -version >>>>>>>>> VM option '+UseSerialGC' >>>>>>>>> VM option '+PrintVMOptions' >>>>>>>>> VM option 'Flags=flags.input.boolean' >>>>>>>>> java version "1.9.0-ea" >>>>>>>>> Java(TM) SE Runtime Environment (build 1.9.0-ea-b69) >>>>>>>>> Java HotSpot(TM) 64-Bit Server VM (build 1.9.0-ea-b69, mixed mode) >>>>>>>>> >>>>>>>>> $ java -XX:+PrintVMOptions -XX:Flags=flags.input.ccstr -version >>>>>>>>> VM option 'ErrorFile=my_error_file' >>>>>>>>> VM option '+PrintVMOptions' >>>>>>>>> VM option 'Flags=flags.input.ccstr' >>>>>>>>> java version "1.9.0-ea" >>>>>>>>> Java(TM) SE Runtime Environment (build 1.9.0-ea-b69) >>>>>>>>> Java HotSpot(TM) 64-Bit Server VM (build 1.9.0-ea-b69, mixed mode) >>>>>>>>> >>>>>>>>> $ java -XX:+PrintVMOptions -XX:Flags=flags.input.uintx -version >>>>>>>>> VM option 'MinRAMFraction=8' >>>>>>>>> VM option '+PrintVMOptions' >>>>>>>>> VM option 'Flags=flags.input.uintx' >>>>>>>>> java version "1.9.0-ea" >>>>>>>>> Java(TM) SE Runtime Environment (build 1.9.0-ea-b69) >>>>>>>>> Java HotSpot(TM) 64-Bit Server VM (build 1.9.0-ea-b69, mixed mode) >>>>>>>>> >>>>>>>>> >>>>>>>>> It looks like the '-XX:Flags' option does work for 'bool', 'uintx' >>>>>>>>> and 'ccstr' options. Clearly Ron and I didn't remember the exact >>>>>>>>> reason that he ruled out using the '-XX:Flags' option. This part >>>>>>>>> of the review thread will have to be resolved after Ron returns. >>>>>>>>> >>>>>>>>> Dan >>>>>>>> >>>>>> >>>> >> From ioi.lam at oracle.com Wed Jul 8 19:46:20 2015 From: ioi.lam at oracle.com (Ioi Lam) Date: Wed, 08 Jul 2015 12:46:20 -0700 Subject: RFR(XS) 8130669: VM prohibits methods with return values In-Reply-To: <559D2666.5010209@oracle.com> References: <559D2666.5010209@oracle.com> Message-ID: <559D7E0C.6030102@oracle.com> Hi Harold, Is there any reason why the ignoredClinit needs to be written in a jcod file and not a jasm file? jasm files would be a lot easier to read and maintain than jcod. Thanks - Ioi On 7/8/15 6:32 AM, harold seigel wrote: > Hi, > > Please review this small change to fix bug JDK-8130669. The JVM > incorrectly throws ClassFormatError exceptions for non-void methods > named . But, the JVM Spec 8 says that such methods > should be ignored. See > http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-2.html#jvms-2.9 > for details. > > The fix changes the JVM to, in this case, only throw ClassFormatError > exceptions for non-void methods. > > Open Webrev: http://cr.openjdk.java.net/~hseigel/bug_8130669/ > > JBS Bug: https://bugs.openjdk.java.net/browse/JDK-8130669 > > The fix was tested with JCK Lang and VM tests, the UTE quick and > split_verifier tests, and the hotspot, java/io, java/lang, and > java/util JTreg tests. > > Thanks, Harold From harold.seigel at oracle.com Wed Jul 8 19:49:28 2015 From: harold.seigel at oracle.com (harold seigel) Date: Wed, 08 Jul 2015 15:49:28 -0400 Subject: RFR(XS) 8130669: VM prohibits methods with return values In-Reply-To: <559D7E0C.6030102@oracle.com> References: <559D2666.5010209@oracle.com> <559D7E0C.6030102@oracle.com> Message-ID: <559D7EC8.8000005@oracle.com> Hi Ioi, I'll rewrite it in .jasm. I just took the .jcod test from the test case attached to the bug. Thanks, Harold On 7/8/2015 3:46 PM, Ioi Lam wrote: > Hi Harold, > > Is there any reason why the ignoredClinit needs to be written in a > jcod file and not a jasm file? jasm files would be a lot easier to > read and maintain than jcod. > > Thanks > - Ioi > > On 7/8/15 6:32 AM, harold seigel wrote: >> Hi, >> >> Please review this small change to fix bug JDK-8130669. The JVM >> incorrectly throws ClassFormatError exceptions for non-void methods >> named . But, the JVM Spec 8 says that such methods >> should be ignored. See >> http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-2.html#jvms-2.9 for >> details. >> >> The fix changes the JVM to, in this case, only throw ClassFormatError >> exceptions for non-void methods. >> >> Open Webrev: http://cr.openjdk.java.net/~hseigel/bug_8130669/ >> >> JBS Bug: https://bugs.openjdk.java.net/browse/JDK-8130669 >> >> The fix was tested with JCK Lang and VM tests, the UTE quick and >> split_verifier tests, and the hotspot, java/io, java/lang, and >> java/util JTreg tests. >> >> Thanks, Harold > From harold.seigel at oracle.com Wed Jul 8 20:08:37 2015 From: harold.seigel at oracle.com (harold seigel) Date: Wed, 08 Jul 2015 16:08:37 -0400 Subject: RFR(XS) 8130669: VM prohibits methods with return values In-Reply-To: <559D7E0C.6030102@oracle.com> References: <559D2666.5010209@oracle.com> <559D7E0C.6030102@oracle.com> Message-ID: <559D8345.5060709@oracle.com> Hi Ioi, Here's an updated webrev with ignoredClinit as a .jasm file. Please let me know if it looks okay. http://cr.openjdk.java.net/~hseigel/bug_8130669.1/ Thanks, Harold On 7/8/2015 3:46 PM, Ioi Lam wrote: > Hi Harold, > > Is there any reason why the ignoredClinit needs to be written in a > jcod file and not a jasm file? jasm files would be a lot easier to > read and maintain than jcod. > > Thanks > - Ioi > > On 7/8/15 6:32 AM, harold seigel wrote: >> Hi, >> >> Please review this small change to fix bug JDK-8130669. The JVM >> incorrectly throws ClassFormatError exceptions for non-void methods >> named . But, the JVM Spec 8 says that such methods >> should be ignored. See >> http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-2.html#jvms-2.9 for >> details. >> >> The fix changes the JVM to, in this case, only throw ClassFormatError >> exceptions for non-void methods. >> >> Open Webrev: http://cr.openjdk.java.net/~hseigel/bug_8130669/ >> >> JBS Bug: https://bugs.openjdk.java.net/browse/JDK-8130669 >> >> The fix was tested with JCK Lang and VM tests, the UTE quick and >> split_verifier tests, and the hotspot, java/io, java/lang, and >> java/util JTreg tests. >> >> Thanks, Harold > From dmitry.dmitriev at oracle.com Wed Jul 8 20:29:58 2015 From: dmitry.dmitriev at oracle.com (Dmitry Dmitriev) Date: Wed, 8 Jul 2015 23:29:58 +0300 Subject: Open code review for 8061999 Enhance VM option parsing to allow options to be specified In-Reply-To: <99352AD6-77D3-42ED-AEE8-1EABD1EEA7B6@oracle.com> References: <3d1df3cb-fe69-4c3b-b8e1-db8801d5a68f@default> <5588EA9F.3020001@oracle.com> <725f7631-425d-4918-8a92-230005d5b5ec@default> <558A1AE7.6010607@oracle.com> <224EF327-B898-4DAC-9343-4FE238604276@oracle.com> <558AD8AD.6020009@oracle.com> <558AF2AB.7040407@oracle.com> <558B8B45.4060307@oracle.com> <558BA1CC.6040100@oracle.com> <558BA53E.1010600@oracle.com> <558C312F.4070606@oracle.com> <558CEB04.5040905@oracle.com> <558D9423.1010903@oracle.com> <5591EABE.6030301@oracle.com> <99352AD6-77D3-42ED-AEE8-1EABD1EEA7B6@oracle.com> Message-ID: <559D8846.7060803@oracle.com> Hello Karen, On 08.07.2015 22:26, Karen Kinnear wrote: > David, > > It is true that this option will not handle options that are targeted at the java > launcher. And we should make that very clear in documentation - perhaps even spelling > out which options are handled by the java launcher. Worth double-checking that > with Kumar. > > There is another rfe going in for the launcher itself - which is JDK-8027634. > That will cover options to the java launcher as well as to the vm and jdk via @argfiles, they same > way apparently javac handles long command-lines today. > > Unfortunately that option only works for the specific launchers that support it. > For folks who embed the jvm in their own applications, e.g. other language users, > the new vm option allows them to pass in arguments to the jvm (and then up to the jdk) > which the java launcher changes doesn't make possible. > > It might make sense as we figure out how to document this, to document the java > launcher @argfiles as the usual approach for customers running java. > > And to document the new VM option explicitly for those who have their own launchers > and call JNI_CreateJavaVM? > > Ron & Dmitry, > > A couple of test requests (you may already have these, I didn't see a code review out for 8073331) > 1) tests with a jni launcher that calls JNI_CreateJavaVM No, I don't have such test, because I don't think from that point of view. I will think about that. > 2) is there a maximum length to the options read in from the file? The current implemented limitations are following: only one VM option file can be specified, maximum size of the file is 1024 bytes, up to 64 VM options > > Also - Dmitry - can you please share your tests for this option with Henry Jen - he may want to modify them > for tests for the java @argfiles. > > And we'll want to test the two new options together :-) Yes, sure. I will contact with Henry and share tests. Thanks, Dmitry > > thanks, > Karen > > On Jun 29, 2015, at 9:02 PM, David Holmes wrote: > >> On 27/06/2015 4:04 AM, Daniel D. Daugherty wrote: >>> On 6/26/15 12:02 AM, David Holmes wrote: >>>> On 26/06/2015 2:49 AM, Daniel D. Daugherty wrote: >>>>> On 6/25/15 12:52 AM, David Holmes wrote: >>>>>> On 25/06/2015 4:38 PM, Dmitry Dmitriev wrote: >>>>>>> Hello David, >>>>>>> >>>>>>> I mean that we can define "-Dmy.property=value" inside VM Option file. >>>>>> Okay - that isn't necessarily a good thing. This is blurring the >>>>>> division of responsibility between the launcher and the VM when it >>>>>> comes to argument processing. I don't see why a VM option file should >>>>>> need to handle -Dxxx arguments - that suggests a need for a more >>>>>> general command-file approach processed by the launcher. >>>>> Hmmm... The above makes it sound like you think only the launcher >>>>> handles '-DXXX' options. >>>> No I'm aware that some properties get passed through specifically for >>>> the VM to act upon (though arguably that was a bad decision back in >>>> the day and the launcher could have used the properties to set VM >>>> specific options); and also that the VM will set some properties for >>>> the launcher and also JDK libs to act upon. This highlights just how >>>> messy property processing is. By allowing properties to be set in a >>>> VMOption file you are increasing the level of mess - in particular if >>>> a property is examined by the launcher before it creates the VM, then >>>> that property can not be specified in the VMOptions file. So now you >>>> have something that will often work but for some special cases won't >>>> work. >>> Two things: >>> >>> 1) >>> >>>> in particular if a property is examined by the launcher before it >>>> creates the VM, then that property can not be specified in the >>>> VMOptions file. >>> The new support for the '-XX:VMOptionsFile=foo' option simply >>> provides another path to get options into our wonderfully >>> complicated options processing mechanism. It uses the same >>> processing path as the existing VM cmd line options mechanism >>> so it has the same capabilities (and pitfalls) as that >>> mechanism. >> I don't quite see it that way. It isn't at all obvious to anyone what options on a long complex command-line get handled by whom and when. Anything in the VMOptions file will be invisible to the launcher, but that won't be obvious either. >> >>> If there is an option that must be handled by the launcher, >>> then that option cannot be specified on the cmd line (as >>> passed by the JNI invoke stuff). The new VMOptions file >>> support is similarly limited. This same limitation applies >>> to any other means of invoking the JVM without using our >>> launcher. Nothing new here. >> Your use of "cmd line" is confusing me here. The "cmd line" is what the user types in their shell and can contain any option. What options you can pass via the JNI invocation API is quite different to a command-line. I agree the VMOptions file is akin to the options you could pass via the invocation API to be processed only by the VM. >> >>> I believe Ron's write-up discusses launcher only options and >>> when he returns next week he should be able to attach that >>> document to the bug report. >>> >>> 2) >>> >>>> the VM will set some properties for the launcher and also >>>> JDK libs to act upon >>> I can see how the VM can set properties for the JDK libs >>> and that is exactly what supporting the -Dfoo stuff is all >>> about, but how/where is the VM setting properties for the >>> launcher? >> Sorry my mistake. I was mis-remembering what we do to force headless mode in some cases. But the launcher isn't involved in that. The launcher can't see properties set by the VM (unless it uses JNI to access the Java level data structures). >> >>>> Just makes me wonder whether this is something that should be handled >>>> by the VM or by the launcher. Or (dare I say it) even by a shell >>>> script. ;-) >>> At least one version of Ron's write-up talked about where >>> to put this new mechanism between the launcher and the >>> VM... We'll have to see what the current draft says... >>> >>> Shell script? Bite your tongue! :-) >> :) >> >> Cheers, >> David >> >> >>> Dan >>> >>> >>>> Cheers, >>>> David >>>> ----- >>>> >>>>> That is not correct... Here's the current >>>>> code: >>>>> >>>>> src/share/vm/runtime/arguments.cpp >>>>> >>>>> 2691 // -D >>>>> 2692 } else if (match_option(option, "-D", &tail)) { >>>>> 2693 const char* value; >>>>> 2694 if (match_option(option, "-Djava.endorsed.dirs=", >>>>> &value) && >>>>> 2695 *value!= '\0' && strcmp(value, "\"\"") != 0) { >>>>> 2696 // abort if -Djava.endorsed.dirs is set >>>>> 2697 jio_fprintf(defaultStream::output_stream(), >>>>> 2698 "-Djava.endorsed.dirs=%s is not supported. Endorsed >>>>> standards >>>>> and standalone APIs\n" >>>>> 2699 "in modular form will be supported via the concept of >>>>> upgradea >>>>> ble modules.\n", value); >>>>> 2700 return JNI_EINVAL; >>>>> 2701 } >>>>> 2702 if (match_option(option, "-Djava.ext.dirs=", &value) && >>>>> 2703 *value != '\0' && strcmp(value, "\"\"") != 0) { >>>>> 2704 // abort if -Djava.ext.dirs is set >>>>> 2705 jio_fprintf(defaultStream::output_stream(), >>>>> 2706 "-Djava.ext.dirs=%s is not supported. Use -classpath >>>>> instead. >>>>> \n", value); >>>>> 2707 return JNI_EINVAL; >>>>> 2708 } >>>>> 2709 >>>>> 2710 if (!add_property(tail)) { >>>>> 2711 return JNI_ENOMEM; >>>>> 2712 } >>>>> 2713 // Out of the box management support >>>>> 2714 if (match_option(option, "-Dcom.sun.management", >>>>> &tail)) { >>>>> 2715 #if INCLUDE_MANAGEMENT >>>>> 2716 if (FLAG_SET_CMDLINE(bool, ManagementServer, true) != >>>>> Flag::SUCC >>>>> ESS) { >>>>> 2717 return JNI_EINVAL; >>>>> 2718 } >>>>> 2719 #else >>>>> 2720 jio_fprintf(defaultStream::output_stream(), >>>>> 2721 "-Dcom.sun.management is not supported in this >>>>> VM.\n"); >>>>> 2722 return JNI_ERR; >>>>> 2723 #endif >>>>> 2724 } >>>>> >>>>> >>>>> L2710 is where we add a property that is not already >>>>> handled by special logic above that. >>>>> >>>>> $ java -showversion -XX:+PrintVMOptions -Dmy.property="This is my >>>>> special property." DumpMyProperty >>>>> VM option '+PrintVMOptions' >>>>> java version "1.9.0-ea" >>>>> Java(TM) SE Runtime Environment (build 1.9.0-ea-b69) >>>>> Java HotSpot(TM) 64-Bit Server VM (build 1.9.0-ea-b69, mixed mode) >>>>> >>>>> my.property=This is my special property. >>>>> >>>>> >>>>> In the above example, the "my.property" Java property is parsed >>>>> by the above code in the VM. The launcher doesn't care about this >>>>> particular property. >>>>> >>>>> Dan >>>>> >>>>> >>>>> >>>>>> David >>>>>> ----- >>>>>> >>>>>> >>>>>>> Thanks, >>>>>>> Dmitry >>>>>>> >>>>>>> On 25.06.2015 8:01, David Holmes wrote: >>>>>>>> On 25/06/2015 4:10 AM, Dmitry Dmitriev wrote: >>>>>>>>> Hello Dan, >>>>>>>>> I just want to add following: new VM Options file feature allow to >>>>>>>>> define property inside option file. >>>>>>>> What do you mean by that? >>>>>>>> >>>>>>>> David >>>>>>>> >>>>>>>>> Thanks, >>>>>>>>> Dmitry >>>>>>>>> >>>>>>>>> On 24.06.2015 19:19, Daniel D. Daugherty wrote: >>>>>>>>>> On 6/23/15 10:43 PM, John Rose wrote: >>>>>>>>>>> On Jun 23, 2015, at 7:50 PM, David Holmes >>>>>>>>>>> >>>>>>>>>>> wrote: >>>>>>>>>>>> On 24/06/2015 3:43 AM, Ron Durbin wrote: >>>>>>>>>>>>> David, >>>>>>>>>>>>> >>>>>>>>>>>>> The '-XX:Flags' option was considered during the research phase >>>>>>>>>>>>> of this project and was rejected because of its limitations. The >>>>>>>>>>>>> '-XX:Flags' option only works for boolean flag options and it >>>>>>>>>>>>> uses a different syntax for the options than the command line. >>>>>>>>>>>>> For example, '-XX:+UseSerialGC' would be specified as >>>>>>>>>>>>> '+UseSerialGC' >>>>>>>>>>>>> in the '-XX:Flags' option file. >>>>>>>>>>>> I'm a little surprised the Flags option wasn't extended to cover >>>>>>>>>>>> these additional requirements. But presumably it should now be >>>>>>>>>>>> deprecated as we (again presumably) don't want to have two >>>>>>>>>>>> mechanisms for doing this. >>>>>>>>>>> I thought the Flags option used to handle any command line >>>>>>>>>>> options, >>>>>>>>>>> and like David I'm surprised the right answer is to get rid of it >>>>>>>>>>> and >>>>>>>>>>> make a new option that does what I think the Flags option >>>>>>>>>>> should be >>>>>>>>>>> doing. >>>>>>>>>>> >>>>>>>>>>> ? John >>>>>>>>>> Greetings, >>>>>>>>>> >>>>>>>>>> Ron is out of the office until next week so I'll provide a little >>>>>>>>>> bit of background... >>>>>>>>>> >>>>>>>>>> Ron has a detailed write-up documenting all the research that he >>>>>>>>>> did on the various command line option mechanisms. We had planned >>>>>>>>>> to attach that write-up to the bug report, but we dropped the ball >>>>>>>>>> (Sorry Mary!) After Ron returns, we'll make a final editing pass >>>>>>>>>> on the document and attach it to the bug report. >>>>>>>>>> >>>>>>>>>> I fleshed out the '-XX:Flags' test cases that Ron posted earlier >>>>>>>>>> in the thread: >>>>>>>>>> >>>>>>>>>> $ more flags.input.*:::::::::::::: >>>>>>>>>> flags.input.boolean >>>>>>>>>> :::::::::::::: >>>>>>>>>> +UseSerialGC >>>>>>>>>> :::::::::::::: >>>>>>>>>> flags.input.ccstr >>>>>>>>>> :::::::::::::: >>>>>>>>>> ErrorFile=my_error_file >>>>>>>>>> :::::::::::::: >>>>>>>>>> flags.input.uintx >>>>>>>>>> :::::::::::::: >>>>>>>>>> MinRAMFraction=8 >>>>>>>>>> >>>>>>>>>> $ java -XX:+PrintVMOptions -XX:Flags=flags.input.boolean -version >>>>>>>>>> VM option '+UseSerialGC' >>>>>>>>>> VM option '+PrintVMOptions' >>>>>>>>>> VM option 'Flags=flags.input.boolean' >>>>>>>>>> java version "1.9.0-ea" >>>>>>>>>> Java(TM) SE Runtime Environment (build 1.9.0-ea-b69) >>>>>>>>>> Java HotSpot(TM) 64-Bit Server VM (build 1.9.0-ea-b69, mixed mode) >>>>>>>>>> >>>>>>>>>> $ java -XX:+PrintVMOptions -XX:Flags=flags.input.ccstr -version >>>>>>>>>> VM option 'ErrorFile=my_error_file' >>>>>>>>>> VM option '+PrintVMOptions' >>>>>>>>>> VM option 'Flags=flags.input.ccstr' >>>>>>>>>> java version "1.9.0-ea" >>>>>>>>>> Java(TM) SE Runtime Environment (build 1.9.0-ea-b69) >>>>>>>>>> Java HotSpot(TM) 64-Bit Server VM (build 1.9.0-ea-b69, mixed mode) >>>>>>>>>> >>>>>>>>>> $ java -XX:+PrintVMOptions -XX:Flags=flags.input.uintx -version >>>>>>>>>> VM option 'MinRAMFraction=8' >>>>>>>>>> VM option '+PrintVMOptions' >>>>>>>>>> VM option 'Flags=flags.input.uintx' >>>>>>>>>> java version "1.9.0-ea" >>>>>>>>>> Java(TM) SE Runtime Environment (build 1.9.0-ea-b69) >>>>>>>>>> Java HotSpot(TM) 64-Bit Server VM (build 1.9.0-ea-b69, mixed mode) >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> It looks like the '-XX:Flags' option does work for 'bool', 'uintx' >>>>>>>>>> and 'ccstr' options. Clearly Ron and I didn't remember the exact >>>>>>>>>> reason that he ruled out using the '-XX:Flags' option. This part >>>>>>>>>> of the review thread will have to be resolved after Ron returns. >>>>>>>>>> >>>>>>>>>> Dan From karen.kinnear at oracle.com Wed Jul 8 20:35:10 2015 From: karen.kinnear at oracle.com (Karen Kinnear) Date: Wed, 8 Jul 2015 16:35:10 -0400 Subject: Open code review for 8061999 Enhance VM option parsing to allow options to be specified In-Reply-To: <559D8846.7060803@oracle.com> References: <3d1df3cb-fe69-4c3b-b8e1-db8801d5a68f@default> <5588EA9F.3020001@oracle.com> <725f7631-425d-4918-8a92-230005d5b5ec@default> <558A1AE7.6010607@oracle.com> <224EF327-B898-4DAC-9343-4FE238604276@oracle.com> <558AD8AD.6020009@oracle.com> <558AF2AB.7040407@oracle.com> <558B8B45.4060307@oracle.com> <558BA1CC.6040100@oracle.com> <558BA53E.1010600@oracle.com> <558C312F.4070606@oracle.com> <558CEB04.5040905@oracle.com> <558D9423.1010903@oracle.com> <5591EABE.6030301@oracle.com> <99352AD6-77D3-42ED-AEE8-1EABD1EEA7B6@oracle.com> <559D8846.7060803@oracle.com> Message-ID: <1F03563A-C8C5-4B08-8DDC-34A89785DE44@oracle.com> Many thanks Dmitry! Karen On Jul 8, 2015, at 4:29 PM, Dmitry Dmitriev wrote: > Hello Karen, > > On 08.07.2015 22:26, Karen Kinnear wrote: >> David, >> >> It is true that this option will not handle options that are targeted at the java >> launcher. And we should make that very clear in documentation - perhaps even spelling >> out which options are handled by the java launcher. Worth double-checking that >> with Kumar. >> >> There is another rfe going in for the launcher itself - which is JDK-8027634. >> That will cover options to the java launcher as well as to the vm and jdk via @argfiles, they same >> way apparently javac handles long command-lines today. >> >> Unfortunately that option only works for the specific launchers that support it. >> For folks who embed the jvm in their own applications, e.g. other language users, >> the new vm option allows them to pass in arguments to the jvm (and then up to the jdk) >> which the java launcher changes doesn't make possible. >> >> It might make sense as we figure out how to document this, to document the java >> launcher @argfiles as the usual approach for customers running java. >> >> And to document the new VM option explicitly for those who have their own launchers >> and call JNI_CreateJavaVM? >> >> Ron & Dmitry, >> >> A couple of test requests (you may already have these, I didn't see a code review out for 8073331) >> 1) tests with a jni launcher that calls JNI_CreateJavaVM > No, I don't have such test, because I don't think from that point of view. I will think about that. >> 2) is there a maximum length to the options read in from the file? > The current implemented limitations are following: only one VM option file can be specified, maximum size of the file is 1024 bytes, up to 64 VM options >> >> Also - Dmitry - can you please share your tests for this option with Henry Jen - he may want to modify them >> for tests for the java @argfiles. >> >> And we'll want to test the two new options together :-) > Yes, sure. I will contact with Henry and share tests. > > Thanks, > Dmitry > >> >> thanks, >> Karen >> >> On Jun 29, 2015, at 9:02 PM, David Holmes wrote: >> >>> On 27/06/2015 4:04 AM, Daniel D. Daugherty wrote: >>>> On 6/26/15 12:02 AM, David Holmes wrote: >>>>> On 26/06/2015 2:49 AM, Daniel D. Daugherty wrote: >>>>>> On 6/25/15 12:52 AM, David Holmes wrote: >>>>>>> On 25/06/2015 4:38 PM, Dmitry Dmitriev wrote: >>>>>>>> Hello David, >>>>>>>> >>>>>>>> I mean that we can define "-Dmy.property=value" inside VM Option file. >>>>>>> Okay - that isn't necessarily a good thing. This is blurring the >>>>>>> division of responsibility between the launcher and the VM when it >>>>>>> comes to argument processing. I don't see why a VM option file should >>>>>>> need to handle -Dxxx arguments - that suggests a need for a more >>>>>>> general command-file approach processed by the launcher. >>>>>> Hmmm... The above makes it sound like you think only the launcher >>>>>> handles '-DXXX' options. >>>>> No I'm aware that some properties get passed through specifically for >>>>> the VM to act upon (though arguably that was a bad decision back in >>>>> the day and the launcher could have used the properties to set VM >>>>> specific options); and also that the VM will set some properties for >>>>> the launcher and also JDK libs to act upon. This highlights just how >>>>> messy property processing is. By allowing properties to be set in a >>>>> VMOption file you are increasing the level of mess - in particular if >>>>> a property is examined by the launcher before it creates the VM, then >>>>> that property can not be specified in the VMOptions file. So now you >>>>> have something that will often work but for some special cases won't >>>>> work. >>>> Two things: >>>> >>>> 1) >>>> >>>>> in particular if a property is examined by the launcher before it >>>>> creates the VM, then that property can not be specified in the >>>>> VMOptions file. >>>> The new support for the '-XX:VMOptionsFile=foo' option simply >>>> provides another path to get options into our wonderfully >>>> complicated options processing mechanism. It uses the same >>>> processing path as the existing VM cmd line options mechanism >>>> so it has the same capabilities (and pitfalls) as that >>>> mechanism. >>> I don't quite see it that way. It isn't at all obvious to anyone what options on a long complex command-line get handled by whom and when. Anything in the VMOptions file will be invisible to the launcher, but that won't be obvious either. >>> >>>> If there is an option that must be handled by the launcher, >>>> then that option cannot be specified on the cmd line (as >>>> passed by the JNI invoke stuff). The new VMOptions file >>>> support is similarly limited. This same limitation applies >>>> to any other means of invoking the JVM without using our >>>> launcher. Nothing new here. >>> Your use of "cmd line" is confusing me here. The "cmd line" is what the user types in their shell and can contain any option. What options you can pass via the JNI invocation API is quite different to a command-line. I agree the VMOptions file is akin to the options you could pass via the invocation API to be processed only by the VM. >>> >>>> I believe Ron's write-up discusses launcher only options and >>>> when he returns next week he should be able to attach that >>>> document to the bug report. >>>> >>>> 2) >>>> >>>>> the VM will set some properties for the launcher and also >>>>> JDK libs to act upon >>>> I can see how the VM can set properties for the JDK libs >>>> and that is exactly what supporting the -Dfoo stuff is all >>>> about, but how/where is the VM setting properties for the >>>> launcher? >>> Sorry my mistake. I was mis-remembering what we do to force headless mode in some cases. But the launcher isn't involved in that. The launcher can't see properties set by the VM (unless it uses JNI to access the Java level data structures). >>> >>>>> Just makes me wonder whether this is something that should be handled >>>>> by the VM or by the launcher. Or (dare I say it) even by a shell >>>>> script. ;-) >>>> At least one version of Ron's write-up talked about where >>>> to put this new mechanism between the launcher and the >>>> VM... We'll have to see what the current draft says... >>>> >>>> Shell script? Bite your tongue! :-) >>> :) >>> >>> Cheers, >>> David >>> >>> >>>> Dan >>>> >>>> >>>>> Cheers, >>>>> David >>>>> ----- >>>>> >>>>>> That is not correct... Here's the current >>>>>> code: >>>>>> >>>>>> src/share/vm/runtime/arguments.cpp >>>>>> >>>>>> 2691 // -D >>>>>> 2692 } else if (match_option(option, "-D", &tail)) { >>>>>> 2693 const char* value; >>>>>> 2694 if (match_option(option, "-Djava.endorsed.dirs=", >>>>>> &value) && >>>>>> 2695 *value!= '\0' && strcmp(value, "\"\"") != 0) { >>>>>> 2696 // abort if -Djava.endorsed.dirs is set >>>>>> 2697 jio_fprintf(defaultStream::output_stream(), >>>>>> 2698 "-Djava.endorsed.dirs=%s is not supported. Endorsed >>>>>> standards >>>>>> and standalone APIs\n" >>>>>> 2699 "in modular form will be supported via the concept of >>>>>> upgradea >>>>>> ble modules.\n", value); >>>>>> 2700 return JNI_EINVAL; >>>>>> 2701 } >>>>>> 2702 if (match_option(option, "-Djava.ext.dirs=", &value) && >>>>>> 2703 *value != '\0' && strcmp(value, "\"\"") != 0) { >>>>>> 2704 // abort if -Djava.ext.dirs is set >>>>>> 2705 jio_fprintf(defaultStream::output_stream(), >>>>>> 2706 "-Djava.ext.dirs=%s is not supported. Use -classpath >>>>>> instead. >>>>>> \n", value); >>>>>> 2707 return JNI_EINVAL; >>>>>> 2708 } >>>>>> 2709 >>>>>> 2710 if (!add_property(tail)) { >>>>>> 2711 return JNI_ENOMEM; >>>>>> 2712 } >>>>>> 2713 // Out of the box management support >>>>>> 2714 if (match_option(option, "-Dcom.sun.management", >>>>>> &tail)) { >>>>>> 2715 #if INCLUDE_MANAGEMENT >>>>>> 2716 if (FLAG_SET_CMDLINE(bool, ManagementServer, true) != >>>>>> Flag::SUCC >>>>>> ESS) { >>>>>> 2717 return JNI_EINVAL; >>>>>> 2718 } >>>>>> 2719 #else >>>>>> 2720 jio_fprintf(defaultStream::output_stream(), >>>>>> 2721 "-Dcom.sun.management is not supported in this >>>>>> VM.\n"); >>>>>> 2722 return JNI_ERR; >>>>>> 2723 #endif >>>>>> 2724 } >>>>>> >>>>>> >>>>>> L2710 is where we add a property that is not already >>>>>> handled by special logic above that. >>>>>> >>>>>> $ java -showversion -XX:+PrintVMOptions -Dmy.property="This is my >>>>>> special property." DumpMyProperty >>>>>> VM option '+PrintVMOptions' >>>>>> java version "1.9.0-ea" >>>>>> Java(TM) SE Runtime Environment (build 1.9.0-ea-b69) >>>>>> Java HotSpot(TM) 64-Bit Server VM (build 1.9.0-ea-b69, mixed mode) >>>>>> >>>>>> my.property=This is my special property. >>>>>> >>>>>> >>>>>> In the above example, the "my.property" Java property is parsed >>>>>> by the above code in the VM. The launcher doesn't care about this >>>>>> particular property. >>>>>> >>>>>> Dan >>>>>> >>>>>> >>>>>> >>>>>>> David >>>>>>> ----- >>>>>>> >>>>>>> >>>>>>>> Thanks, >>>>>>>> Dmitry >>>>>>>> >>>>>>>> On 25.06.2015 8:01, David Holmes wrote: >>>>>>>>> On 25/06/2015 4:10 AM, Dmitry Dmitriev wrote: >>>>>>>>>> Hello Dan, >>>>>>>>>> I just want to add following: new VM Options file feature allow to >>>>>>>>>> define property inside option file. >>>>>>>>> What do you mean by that? >>>>>>>>> >>>>>>>>> David >>>>>>>>> >>>>>>>>>> Thanks, >>>>>>>>>> Dmitry >>>>>>>>>> >>>>>>>>>> On 24.06.2015 19:19, Daniel D. Daugherty wrote: >>>>>>>>>>> On 6/23/15 10:43 PM, John Rose wrote: >>>>>>>>>>>> On Jun 23, 2015, at 7:50 PM, David Holmes >>>>>>>>>>>> >>>>>>>>>>>> wrote: >>>>>>>>>>>>> On 24/06/2015 3:43 AM, Ron Durbin wrote: >>>>>>>>>>>>>> David, >>>>>>>>>>>>>> >>>>>>>>>>>>>> The '-XX:Flags' option was considered during the research phase >>>>>>>>>>>>>> of this project and was rejected because of its limitations. The >>>>>>>>>>>>>> '-XX:Flags' option only works for boolean flag options and it >>>>>>>>>>>>>> uses a different syntax for the options than the command line. >>>>>>>>>>>>>> For example, '-XX:+UseSerialGC' would be specified as >>>>>>>>>>>>>> '+UseSerialGC' >>>>>>>>>>>>>> in the '-XX:Flags' option file. >>>>>>>>>>>>> I'm a little surprised the Flags option wasn't extended to cover >>>>>>>>>>>>> these additional requirements. But presumably it should now be >>>>>>>>>>>>> deprecated as we (again presumably) don't want to have two >>>>>>>>>>>>> mechanisms for doing this. >>>>>>>>>>>> I thought the Flags option used to handle any command line >>>>>>>>>>>> options, >>>>>>>>>>>> and like David I'm surprised the right answer is to get rid of it >>>>>>>>>>>> and >>>>>>>>>>>> make a new option that does what I think the Flags option >>>>>>>>>>>> should be >>>>>>>>>>>> doing. >>>>>>>>>>>> >>>>>>>>>>>> ? John >>>>>>>>>>> Greetings, >>>>>>>>>>> >>>>>>>>>>> Ron is out of the office until next week so I'll provide a little >>>>>>>>>>> bit of background... >>>>>>>>>>> >>>>>>>>>>> Ron has a detailed write-up documenting all the research that he >>>>>>>>>>> did on the various command line option mechanisms. We had planned >>>>>>>>>>> to attach that write-up to the bug report, but we dropped the ball >>>>>>>>>>> (Sorry Mary!) After Ron returns, we'll make a final editing pass >>>>>>>>>>> on the document and attach it to the bug report. >>>>>>>>>>> >>>>>>>>>>> I fleshed out the '-XX:Flags' test cases that Ron posted earlier >>>>>>>>>>> in the thread: >>>>>>>>>>> >>>>>>>>>>> $ more flags.input.*:::::::::::::: >>>>>>>>>>> flags.input.boolean >>>>>>>>>>> :::::::::::::: >>>>>>>>>>> +UseSerialGC >>>>>>>>>>> :::::::::::::: >>>>>>>>>>> flags.input.ccstr >>>>>>>>>>> :::::::::::::: >>>>>>>>>>> ErrorFile=my_error_file >>>>>>>>>>> :::::::::::::: >>>>>>>>>>> flags.input.uintx >>>>>>>>>>> :::::::::::::: >>>>>>>>>>> MinRAMFraction=8 >>>>>>>>>>> >>>>>>>>>>> $ java -XX:+PrintVMOptions -XX:Flags=flags.input.boolean -version >>>>>>>>>>> VM option '+UseSerialGC' >>>>>>>>>>> VM option '+PrintVMOptions' >>>>>>>>>>> VM option 'Flags=flags.input.boolean' >>>>>>>>>>> java version "1.9.0-ea" >>>>>>>>>>> Java(TM) SE Runtime Environment (build 1.9.0-ea-b69) >>>>>>>>>>> Java HotSpot(TM) 64-Bit Server VM (build 1.9.0-ea-b69, mixed mode) >>>>>>>>>>> >>>>>>>>>>> $ java -XX:+PrintVMOptions -XX:Flags=flags.input.ccstr -version >>>>>>>>>>> VM option 'ErrorFile=my_error_file' >>>>>>>>>>> VM option '+PrintVMOptions' >>>>>>>>>>> VM option 'Flags=flags.input.ccstr' >>>>>>>>>>> java version "1.9.0-ea" >>>>>>>>>>> Java(TM) SE Runtime Environment (build 1.9.0-ea-b69) >>>>>>>>>>> Java HotSpot(TM) 64-Bit Server VM (build 1.9.0-ea-b69, mixed mode) >>>>>>>>>>> >>>>>>>>>>> $ java -XX:+PrintVMOptions -XX:Flags=flags.input.uintx -version >>>>>>>>>>> VM option 'MinRAMFraction=8' >>>>>>>>>>> VM option '+PrintVMOptions' >>>>>>>>>>> VM option 'Flags=flags.input.uintx' >>>>>>>>>>> java version "1.9.0-ea" >>>>>>>>>>> Java(TM) SE Runtime Environment (build 1.9.0-ea-b69) >>>>>>>>>>> Java HotSpot(TM) 64-Bit Server VM (build 1.9.0-ea-b69, mixed mode) >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> It looks like the '-XX:Flags' option does work for 'bool', 'uintx' >>>>>>>>>>> and 'ccstr' options. Clearly Ron and I didn't remember the exact >>>>>>>>>>> reason that he ruled out using the '-XX:Flags' option. This part >>>>>>>>>>> of the review thread will have to be resolved after Ron returns. >>>>>>>>>>> >>>>>>>>>>> Dan > From ioi.lam at oracle.com Wed Jul 8 20:59:06 2015 From: ioi.lam at oracle.com (Ioi Lam) Date: Wed, 08 Jul 2015 13:59:06 -0700 Subject: RFR(XS) 8130669: VM prohibits methods with return values In-Reply-To: <559D8345.5060709@oracle.com> References: <559D2666.5010209@oracle.com> <559D7E0C.6030102@oracle.com> <559D8345.5060709@oracle.com> Message-ID: <559D8F1A.1000803@oracle.com> Looks good to me. Thanks - Ioi On 7/8/15 1:08 PM, harold seigel wrote: > Hi Ioi, > > Here's an updated webrev with ignoredClinit as a .jasm file. Please > let me know if it looks okay. > > http://cr.openjdk.java.net/~hseigel/bug_8130669.1/ > > Thanks, Harold > > On 7/8/2015 3:46 PM, Ioi Lam wrote: >> Hi Harold, >> >> Is there any reason why the ignoredClinit needs to be written in a >> jcod file and not a jasm file? jasm files would be a lot easier to >> read and maintain than jcod. >> >> Thanks >> - Ioi >> >> On 7/8/15 6:32 AM, harold seigel wrote: >>> Hi, >>> >>> Please review this small change to fix bug JDK-8130669. The JVM >>> incorrectly throws ClassFormatError exceptions for non-void methods >>> named . But, the JVM Spec 8 says that such methods >>> should be ignored. See >>> http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-2.html#jvms-2.9 >>> for details. >>> >>> The fix changes the JVM to, in this case, only throw >>> ClassFormatError exceptions for non-void methods. >>> >>> Open Webrev: http://cr.openjdk.java.net/~hseigel/bug_8130669/ >>> >>> JBS Bug: https://bugs.openjdk.java.net/browse/JDK-8130669 >>> >>> The fix was tested with JCK Lang and VM tests, the UTE quick and >>> split_verifier tests, and the hotspot, java/io, java/lang, and >>> java/util JTreg tests. >>> >>> Thanks, Harold >> > From daniel.daugherty at oracle.com Wed Jul 8 21:33:02 2015 From: daniel.daugherty at oracle.com (Daniel D. Daugherty) Date: Wed, 08 Jul 2015 15:33:02 -0600 Subject: RFR(S) 8130448: thread dump improvements, comment, additions, new diagnostics inspired by 8077392 In-Reply-To: <55972558.6060905@oracle.com> References: <55972558.6060905@oracle.com> Message-ID: <559D970E.7000905@oracle.com> Greetings, I've updated this patch based on David H's comments along with some additional cleanup. This work is being tracked by the following bug ID: JDK-8130448 8077392 inspired thread dump improvements, comment additions, new diagnostics https://bugs.openjdk.java.net/browse/JDK-8130448 Here is the webrev URL: http://cr.openjdk.java.net/~dcubed/8130448-webrev/1-jdk9-hs-rt/ The easiest way to review the delta is to download the two patch files and compare them in something like jfilemerge: http://cr.openjdk.java.net/~dcubed/8130448-webrev/0-jdk9-hs-rt/hotspot.patch http://cr.openjdk.java.net/~dcubed/8130448-webrev/1-jdk9-hs-rt/hotspot.patch Testing: - Aurora Adhoc RT/SVC nightly batches (in process) - JPRT test jobs Thanks, in advance, for any comments, questions or suggestions. Gory details about the changes are below... Dan Changes between CR0 and CR1 are: src/cpu/x86/vm/macroAssembler_x86.cpp - fix comment typos, clarify comment wording src/share/vm/oops/markOop.cpp - clarify output messages - get rid of confusing local variable src/share/vm/runtime/globals.hpp - drop VerboseStackTrace, GuaranteeOnMonitorMismatch and JavaThreadExitReleasesMonitors options - there are no longer changes to this file src/share/vm/runtime/objectMonitor.cpp - add ObjectMonitor::Knob_ExitRelease suboption to replace JavaThreadExitReleasesMonitors - add ObjectMonitor::Knob_VerifyMatch suboption to replace GuaranteeOnMonitorMismatch - cleanup messy logging: - switch from '::printf()' -> 'tty->print_cr()' - switch from '::fflush()' -> 'tty->flush()' src/share/vm/runtime/objectMonitor.hpp - add ObjectMonitor::Knob_ExitRelease suboption - add ObjectMonitor::Knob_VerifyMatch suboption - cleanup messy logging src/share/vm/runtime/synchronizer.cpp - cleanup messy logging - switch from GuaranteeOnMonitorMismatch to ObjectMonitor::Knob_VerifyMatch - add diagnostic information about the locked object when ReleaseJavaMonitorsClosure::do_monitor() finds a problem src/share/vm/runtime/thread.cpp - clarify comments - switch from JavaThreadExitReleasesMonitors to ObjectMonitor::Knob_ExitRelease src/share/vm/runtime/vframe.cpp - print_locked_object_class_name() is now public - clarify comments - clarify output messages - switch from VerboseStackTrace to the already existing ObjectMonitor::Knob_Verbose src/share/vm/runtime/vframe.hpp - print_locked_object_class_name() is now public On 7/3/15 6:14 PM, Daniel D. Daugherty wrote: > Greetings, > > The hunt for the following bug: > > JDK-8077392 Stream fork/join tasks occasionally fail to complete > > and David C's work on the following bug: > > JDK-8069412 Locks need better debug-printing support > > have inspired additional thread dump improvements, comment additions > to some Java monitor code and some new diagnostic options. > > This work is being tracked by the following bug ID: > > JDK-8130448 8077392 inspired thread dump improvements, comment > additions, new diagnostics > https://bugs.openjdk.java.net/browse/JDK-8130448 > > Here is the webrev URL: > > http://cr.openjdk.java.net/~dcubed/8130448-webrev/0-jdk9-hs-rt/ > > Testing: > > - RBT vm.quick batches (in process) > - JPRT test jobs > > Thanks, in advance, for any comments, questions or suggestions. > > Gory details about the changes are below... > > Dan > > 8130448 summary of changes: > > src/cpu/x86/vm/macroAssembler_x86.cpp > - comment additions for the assembly code > > src/share/vm/oops/markOop.cpp > - has_monitor() has to be checked before is_locked() since > the has_monitor() bits are a superset of the is_locked() bits > - code style fixes > > src/share/vm/runtime/globals.hpp > - add VerboseStackTrace diagnostic option > - add GuaranteeOnMonitorMismatch diagnostic option > - add JavaThreadExitReleasesMonitors product option; > this is the Java equivalent of JNIDetachReleasesMonitors > > src/share/vm/runtime/objectMonitor.cpp > - delete unused ObjectMonitor::try_enter() > - fix assert wording > > src/share/vm/runtime/objectMonitor.hpp > - delete unused ObjectMonitor::try_enter() > > src/share/vm/runtime/synchronizer.cpp > - add GuaranteeOnMonitorMismatch support with some > diagnostic output > > src/share/vm/runtime/thread.cpp > - add JavaThreadExitReleasesMonitors support > > src/share/vm/runtime/vframe.cpp > - clarify existing comments > - add comments to clarify what "waiting on" means > - add line to show when we are "waiting on", but > there are no locals available (previously we were > "waiting on" silently) > - add support for "waiting to relock" which can happen > for any of the monitors and not just the top monitor > - switch mark->print_on() verbose output to new > VerboseStackTrace switch; thread dumps are not enabled > with a specific switch so the '-XX:+Verbose' model of > being a modifier for another option does not fit > > From daniel.daugherty at oracle.com Wed Jul 8 22:10:03 2015 From: daniel.daugherty at oracle.com (Daniel D. Daugherty) Date: Wed, 08 Jul 2015 16:10:03 -0600 Subject: RFR(S) Contended Locking fast notify bucket (8075171) In-Reply-To: <559D66A7.6040902@oracle.com> References: <555A4678.7020308@oracle.com> <559724B0.6000507@oracle.com> <59B99866-C9BB-46F8-87C3-7E6FA8122227@oracle.com> <559D66A7.6040902@oracle.com> Message-ID: <559D9FBB.6020503@oracle.com> On 7/8/15 12:06 PM, Daniel D. Daugherty wrote: > On 7/8/15 11:53 AM, Karen Kinnear wrote: >> Dan, >> >> Looks good. >> >> Only comment is - >> >> In ObjectMonitor::INotify - lines 1668-1671 >> the default value of policy is "2" >> -- which basically is "b" not "a" unless the EntryList is empty. > > Nice catch! For folks on the alias that don't have this code > tattooed on the inside of their eyelids. This is the relevant code: > > src/share/vm/runtime/objectMonitor.cpp: > > 136 static int Knob_MoveNotifyee = 2; // notify() - > disposition of notifyee > > > > 1659 void ObjectMonitor::INotify(Thread * Self) { > 1660 const int policy = Knob_MoveNotifyee; > > > > 1668 // Disposition - what might we do with iterator ? > 1669 // a. add it directly to the EntryList - either tail or head. > 1670 // b. push it onto the front of the _cxq. > 1671 // For now we use (a). > > > > 1710 } else if (policy == 2) { // prepend to cxq > > I will update the comment. Don't think this update is worth a new webrev so here are the diffs instead: $ diff src/share/vm/runtime/objectMonitor.cpp{.cr1,} 1669,1671c1669,1672 < // a. add it directly to the EntryList - either tail or head. < // b. push it onto the front of the _cxq. < // For now we use (a). --- > // a. add it directly to the EntryList - either tail (policy == 1) > // or head (policy == 0). > // b. push it onto the front of the _cxq (policy == 2). > // For now we use (b). Thanks again for the catch! Dan > > Dan > > >> >> thanks, >> Karen >> >> On Jul 3, 2015, at 8:11 PM, Daniel D. Daugherty wrote: >> >>> Greetings, >>> >>> I've updated the patch for Contended Locking fast notify bucket >>> based on David H's and Karen's comments. >>> >>> This work is being tracked by the following bug ID: >>> >>> JDK-8075171 Contended Locking fast notify bucket >>> https://bugs.openjdk.java.net/browse/JDK-8075171 >>> >>> Here is the webrev URL: >>> >>> http://cr.openjdk.java.net/~dcubed/8075171-webrev/1-jdk9-hs-rt/ >>> >>> Here is the JEP link: >>> >>> https://bugs.openjdk.java.net/browse/JDK-8046133 >>> >>> Testing: >>> >>> - RBT vm.quick batches (in process) >>> - JPRT test jobs >>> - MonitorWaitNotifyStresser micro-benchmark (in process) >>> - CallTimerGrid stress testing (in process) >>> >>> >>> The changes in this round are in only four of the files: >>> >>> src/share/vm/opto/runtime.cpp >>> >>> - deleted comment about hashCode() that belongs in a different bucket >>> >>> src/share/vm/runtime/objectMonitor.cpp >>> >>> - add MAX_RECHECK_INTERVAL define for use in ObjectMonitor::EnterI() >>> - cleanup recheck interval code >>> - ObjectMonitor::INotify() return type is now "void" >>> - delete duplicate comments, clarify/rewrite some comments >>> >>> src/share/vm/runtime/objectMonitor.hpp >>> >>> - ObjectMonitor::INotify() return type is now "void" >>> >>> src/share/vm/runtime/synchronizer.cpp >>> >>> - clarify/rewrite comments, add additional comments >>> - cleanup variables in ObjectSynchronizer::quick_notify >>> - refactor loop to be more clear >>> - delete unused enum MaximumRecheckInterval >>> >>> The easiest way to review the delta is to download the two patch >>> files and compare them in something like jfilemerge: >>> >>> http://cr.openjdk.java.net/~dcubed/8075171-webrev/0-jdk9-hs-rt/hotspot.patch >>> >>> http://cr.openjdk.java.net/~dcubed/8075171-webrev/1-jdk9-hs-rt/hotspot.patch >>> >>> >>> Dan >>> >>> >>> On 5/18/15 2:07 PM, Daniel D. Daugherty wrote: >>>> Greetings, >>>> >>>> I have the Contended Locking fast notify bucket ready for review. >>>> >>>> The code changes in this bucket are the final piece in the triad >>>> of {fast-enter, fast-exit, fast-notify} changes. There are no >>>> macro assembler changes in this bucket (yeah!), but there are >>>> code review cleanups motivated by comments on other buckets, e.g., >>>> changing variables like 'Tally' -> 'tally'. >>>> >>>> This work is being tracked by the following bug ID: >>>> >>>> JDK-8075171 Contended Locking fast notify bucket >>>> https://bugs.openjdk.java.net/browse/JDK-8075171 >>>> >>>> Here is the webrev URL: >>>> >>>> http://cr.openjdk.java.net/~dcubed/8075171-webrev/0-jdk9-hs-rt/ >>>> >>>> Here is the JEP link: >>>> >>>> https://bugs.openjdk.java.net/browse/JDK-8046133 >>>> >>>> Testing: >>>> >>>> - Aurora Adhoc RT/SVC baseline batch >>>> - JPRT test jobs >>>> - MonitorWaitNotifyStresser micro-benchmark (in process) >>>> - CallTimerGrid stress testing (in process) >>>> - Aurora performance testing: >>>> - out of the box for the "promotion" and 32-bit server configs >>>> - heavy weight monitors for the "promotion" and 32-bit server >>>> configs >>>> (-XX:-UseBiasedLocking -XX:+UseHeavyMonitors) >>>> (in process) >>>> >>>> The hang somehow introduced by the "fast enter" bucket is still >>>> unresolved, but progress is being made. That work is being tracked >>>> by the following bug: >>>> >>>> JDK-8077392 Stream fork/join tasks occasionally fail to complete >>>> https://bugs.openjdk.java.net/browse/JDK-8077392 >>>> >>>> You'll see a change that re-enables the "fast enter" bucket in this >>>> webrev, but that change will not be pushed when we're done with the >>>> review of this bucket unless JDK-8077392 is resolved. >>>> >>>> Thanks, in advance, for any comments, questions or suggestions. >>>> >>>> Gory details about the changes are below... >>>> >>>> Dan >>>> >>>> >>>> 8075171 summary of changes: >>>> >>>> src/share/vm/classfile/vmSymbols.hpp >>>> - Add do_intrinsic() entries for _notify and _notifyAll >>>> >>>> src/share/vm/opto/library_call.cpp >>>> - Add optional inline_notify() that is controlled by new >>>> '-XX:[+-]InlineNotify' option >>>> >>>> src/share/vm/opto/runtime.cpp >>>> src/share/vm/opto/runtime.hpp >>>> - Add OptoRuntime::monitor_notify_C() and >>>> OptoRuntime::monitor_notifyAll_C() functions to support >>>> the new "fast notify" code paths >>>> - Add new OptoRuntime::monitor_notify_Type() to support >>>> the above two new functions >>>> >>>> src/share/vm/runtime/globals.hpp >>>> - Add '-XX:[+-]InlineNotify' option; default option value is >>>> enabled (true) >>>> >>>> src/share/vm/runtime/objectMonitor.cpp >>>> src/share/vm/runtime/objectMonitor.hpp >>>> - Refactor ObjectMonitor::notify() and ObjectMonitor::notifyAll() >>>> into wrappers that call the new ObjectMonitor::INotify() >>>> - Add new ObjectMonitor::INotify() to reduce code duplication >>>> between "notify" and "notifyAll" code paths >>>> >>>> src/share/vm/runtime/sharedRuntime.cpp >>>> - Temporarily re-enable the "fast enter" optimization in order >>>> to do performance testing. JDK-8077392 is still unresolved, >>>> but progress is being made. >>>> >>>> src/share/vm/runtime/synchronizer.cpp >>>> src/share/vm/runtime/synchronizer.hpp >>>> - Add ObjectSynchronizer::quick_notify() that implements the >>>> new "fast notify" code paths >>>> - The new code handles a couple of special cases where the >>>> "notify" can be done without the heavy weight slow-path >>>> (thread state transitions and other baggage) >>>> >>>> > > > From david.holmes at oracle.com Thu Jul 9 05:06:45 2015 From: david.holmes at oracle.com (David Holmes) Date: Thu, 9 Jul 2015 15:06:45 +1000 Subject: Open code review for 8061999 Enhance VM option parsing to allow options to be specified In-Reply-To: <559D8846.7060803@oracle.com> References: <3d1df3cb-fe69-4c3b-b8e1-db8801d5a68f@default> <5588EA9F.3020001@oracle.com> <725f7631-425d-4918-8a92-230005d5b5ec@default> <558A1AE7.6010607@oracle.com> <224EF327-B898-4DAC-9343-4FE238604276@oracle.com> <558AD8AD.6020009@oracle.com> <558AF2AB.7040407@oracle.com> <558B8B45.4060307@oracle.com> <558BA1CC.6040100@oracle.com> <558BA53E.1010600@oracle.com> <558C312F.4070606@oracle.com> <558CEB04.5040905@oracle.com> <558D9423.1010903@oracle.com> <5591EABE.6030301@oracle.com> <99352AD6-77D3-42ED-AEE8-1EABD1EEA7B6@oracle.com> <559D8846.7060803@oracle.com> Message-ID: <559E0165.3040902@oracle.com> On 9/07/2015 6:29 AM, Dmitry Dmitriev wrote: > On 08.07.2015 22:26, Karen Kinnear wrote: >> 2) is there a maximum length to the options read in from the file? > The current implemented limitations are following: only one VM option > file can be specified, maximum size of the file is 1024 bytes, up to 64 > VM options That seems extremely limiting. Why should there be a maximum size, why can't you just read the file line by line and keep processing until it is all read ?? Thanks, David From david.holmes at oracle.com Thu Jul 9 05:13:48 2015 From: david.holmes at oracle.com (David Holmes) Date: Thu, 9 Jul 2015 15:13:48 +1000 Subject: RFR(S) 8130448: thread dump improvements, comment, additions, new diagnostics inspired by 8077392 In-Reply-To: <559C0C4D.8090504@oracle.com> References: <55972558.6060905@oracle.com> <559A2397.2010409@oracle.com> <559AE96D.6010508@oracle.com> <559B7BAA.8070705@oracle.com> <559C0C4D.8090504@oracle.com> Message-ID: <559E030C.8010603@oracle.com> On 8/07/2015 3:28 AM, Daniel D. Daugherty wrote: > On 7/7/15 1:11 AM, David Holmes wrote: >> Hi Dan, >> >> Top posting as I'm lazy and running late :) > > No problem with the top posting. It makes your remaining > concerns earlier to see and address. > > >> Okay ... I'm still uneasy about adding two additional flags for the >> "release monitors on exit" situation. I hear what you are saying about >> the cost of the monitor check - I had thought we kept easy access to >> the set of monitors owned by a thread but it seems not, so trawling >> the global monitor list is indeed an expensive operation. :( So okay >> but I don't like it :) > > Since JavaThreadExitReleasesMonitors and GuaranteeOnMonitorMismatch > are targeted at finding/working around bugs in the Java Monitor > implementation, I'm going to take a look at moving the flag support > down into Java Monitor subsystem's implementation specific options. > That will get the options out of the global space and they won't > have to be counted against the "cap and trade" limit :-) > > >> I also take your point about viewing the new flag as a superset of the >> JNI-detach case. That's fair enough, but of course that aspect needs >> to be documented. > > I'm starting to wonder why we have the 'JNIDetachReleasesMonitors' > option at all. Is there a good reason to be able to turn off this > piece of code? My recollection is that hotspot did not implement that part of the spec. Simply switching the behaviour with no way to restore the original behaviour could break existing apps. Hence a flag, on by default. Of course by now apps should be spec compliant themselves so this seems a flag that should itself be deprecated in 9 and targetted for removal in 10. (That will help with the 'conservation of flags' problem :) ). > > >> I was left unclear about your position on the VerboseStackTrace. I >> agree the new output was likely put under a flag to avoid disturbing >> existing output formats. But I don't see that it warrants its own flag >> - to me using Verbose okay (though the fact it is a develop flag is >> limiting). > > Thanks for reminding me that '-XX:+Verbose' is a develop flag. > That's another reason for not using that flag. Combined with > the fact that '-XX:+Verbose' is considered a modifier to other > flags and thread dumps aren't enabled/triggered by a flag means > (to me anyway) that '-XX:+Verbose' is still not a good match. > > However, I have a vague memory that the Java Monitor subsystem > has its own "verbose" flag. I'll take a look at switching to > that... Okay > Will be working on the next round... Thanks, David > Dan > > > >> >> Thanks, >> David >> >> On 7/07/2015 6:47 AM, Daniel D. Daugherty wrote: >>> On 7/6/15 12:43 AM, David Holmes wrote: >>>> Hi Dan, >>>> >>>> Metacomment: Could I suggest that in a RFR your subject line has the >>>> form : , rather than (bugid) - especially >>>> when the synopsis actually starts with a bug id :) Thanks. >>> >>> Yup that bug synopsis is/was a mess: >>> >>> Changed the synopsis line to : >>> >>> thread dump improvements, comment additions, new diagnostics >>> inspired by 8077392 >>> >>> Also updated the e-mail thread subject line to your suggested format. >>> Will try to remember to switch to that style in the future. >>> >>> >>>> Mostly okay but some major concerns around the can of worms that >>>> JavaThreadExitReleasesMonitors opens up. >>> >>> This is Java monitors so "can of worms" is familiar! :-) >>> >>> >>>> >>>> On 4/07/2015 10:14 AM, Daniel D. Daugherty wrote: >>>>> Greetings, >>>>> >>>>> The hunt for the following bug: >>>>> >>>>> JDK-8077392 Stream fork/join tasks occasionally fail to complete >>>>> >>>>> and David C's work on the following bug: >>>>> >>>>> JDK-8069412 Locks need better debug-printing support >>>>> >>>>> have inspired additional thread dump improvements, comment additions >>>>> to some Java monitor code and some new diagnostic options. >>>> >>>> src/cpu/x86/vm/macroAssembler_x86.cpp >>>> >>>> 1821 // update _owner from from BasicLock to thread >>>> >>>> Typo: from from >>> >>> Will fix. >>> >>> >>>> 2091 // the placeholder value. If that didn't work, then another >>>> 2092 // grabbed the lock so we're done (and exit was a success). >>>> >>>> another -> another thread ? >>> >>> Yes, "another thread" is better. Will fix. >>> >>> >>>> 2201 // If that didn't work, then another grabbed the lock >>>> 2202 // so we're done (and exit was a success). >>>> >>>> another -> another thread ? >>> >>> Yes, "another thread" is better. Will fix. >>> >>> >>>> --- >>>> >>>> src/share/vm/oops/markOop.cpp >>>> >>>> 40 st->print("NULL"); // this should not happen >>>> >>>> Shouldn't that be an assert or guarantee in that case? Or at a minimum >>>> print something like: "NULL (but you should never see this!)" >>> >>> This is a relocated line from David C's change: >>> >>> old 49: st->print("monitor=NULL"); >>> >>> I simply added a comment to it. I don't think I like the idea of the >>> thread dump code assert()'ing or guarantee()'ing because there might >>> be other useful info that would have been printed after the assert() >>> or guarantee() failure. >>> >>> I do like the idea of changing the message to: >>> >>> 40: st->print("NULL (this should never be seen!)"); >>> >>> >>>> 42 BasicLock * bl = (BasicLock *) mon->owner(); >>>> >>>> What information has told us this is a BasicLock* not a Thread* ? But >>>> as all you do is print bl why not just p2i(mon->owner()) ? >>> >>> Again, this is a relocated line from David C's change: >>> >>> old 51: BasicLock * bl = (BasicLock *) mon->owner(); >>> >>> I'm going to guess that David C had some other code in there before >>> that needed/assumed that the field is a "BasicLock *", but that code >>> didn't make it into his final version. >>> >>> I will drop the 'bl' local and update the p2i() call to use >>> mon->owner() directly. >>> >>> >>>> --- >>>> >>>> src/share/vm/runtime/globals.hpp >>>> >>>> JavaThreadExitReleasesMonitors has me perplexed. The JNI DetachThread >>>> case seems to be a concession to badly written code that fails to >>>> release locks on error paths. >>> >>> I don't think I would call the JNIDetachReleasesMonitors case a >>> concession >>> to badly written JNI code. 6282335 is very clear that this code was >>> added >>> to meet the JNI spec. The JNI spec words might be considered a >>> concession... >>> >>> http://docs.oracle.com/javase/8/docs/technotes/guides/jni/spec/invocation.html#DetachCurrentThread >>> >>> >>> >>> > DetachCurrentThread >>> > >>> > jint DetachCurrentThread(JavaVM *vm); >>> > >>> > Detaches the current thread from a Java VM. All Java monitors >>> > held by this thread are released. All Java threads waiting for >>> > this thread to die are notified. >>> > >>> > The main thread can be detached from the VM. >>> >>> >>> >>>> The equivalent for a Java thread would again involve lock acquisition >>>> via JNI. But I don't recall ever seeing a bug report or RFE related to >>>> this. What seems to have motivated this new flag is the potential for >>>> a broken VM to actually leave the monitor locked (e.g. because >>>> compiled code failed to do the unlock on all paths). >>> >>> 8077392 and bugs like it are exactly the reason for adding these >>> two options. >>> >>> JavaThreadExitReleasesMonitors is added to provide a work around >>> until the underlying bug or bugs are fixed. This option is targeted >>> at folks that are chasing their own bugs and don't care about this >>> one. >>> >>> GuaranteeOnMonitorMismatch is added to help hunt 8077392 specifically >>> and to sanity check for similar issues generally. I can see using the >>> two options in combination with existing test suites as a stress test >>> for the Java monitor subsystem. >>> >>> >>>> To address that I'd be inclined to simply have a guarantee in the Java >>>> thread exit path, rather than a flag to do the clean up and another >>>> flag to control a guarantee. >>> >>> The check for an unexited Java monitor is not cheap. >>> >>> The existing check under the JNIDetachReleasesMonitors flag is >>> positioned to only affect threads using JNI DetachCurrentThread() >>> and that cost is justified as part of meeting the JNI spec. >>> >>> Adding the unexited Java monitor check to all exiting Java >>> threads should not be done lightly due to the cost. If the >>> VM is functioning correctly, then why impose this cost on >>> all exiting Java threads? >>> >>> >>>> I don't think two new command-line options (has this gone through CCC >>>> yet?) are justified. >>> >>> No, this has not gone through CCC yet. My preference is to get >>> code review feedback (like this) before submitting a CCC. >>> >>> I suppose I could have simply added more sub-options to the >>> existing Java monitor subsystem knobs and switches, but it >>> seemed to make sense to model JavaThreadExitReleasesMonitors >>> on the existing JNIDetachReleasesMonitors. >>> >>> >>>> Also note that allowing for JVM induced missing unlocks is something >>>> that can affect JNI attached threads as well as regular Java threads. >>>> I'll take this up in discussing thread.cpp below. >>>> >>>> That aside, the comment, which was modelled on the JNI DetachThread >>>> variant, does not really work in this case: >>>> >>>> 2801 "JavaThread exit() releases monitors owned by thread") >>>> \ >>>> >>>> JavaThread is not a programming concept but an internal JVM >>>> abstraction. I would suggest something like: >>>> >>>> "Java thread termination releases monitors unexpectedly still owned by >>>> thread" >>> >>> I'll switch to your description text if we end up keeping the >>> new options. >>> >>> >>>> --- >>>> >>>> src/share/vm/runtime/objectMonitor.cpp >>>> src/share/vm/runtime/objectMonitor.hpp >>>> >>>> No comments >>>> >>>> --- >>>> >>>> src/share/vm/runtime/synchronizer.cpp >>>> >>>> If we find the unexpected locked monitor it would be useful to see >>>> more Java level information about the Thread (in the non-detaching >>>> case) and the object that is locked. >>> >>> I can probably steal some code from the thread dump side to >>> give us more info about the Object associated with the Java >>> monitor... >>> >>> >>>> --- >>>> >>>> src/share/vm/runtime/thread.cpp >>>> >>>> As noted previously JNI attached threads can also be affected by JVM >>>> induced locking bugs. So the comment block: >>>> >>>> 1804 // 6282335 JNI DetachCurrentThread spec states that all Java >>>> monitors >>>> 1805 // held by this thread must be released. A detach operation >>>> must only >>>> 1806 // get here if there are no Java frames on the stack. >>>> Therefore, any >>>> 1807 // owned monitors at this point MUST be JNI-acquired monitors >>>> which are >>>> 1808 // pre-inflated and in the monitor cache. >>>> >>>> is not strictly correct as it is presuming a correctly operating JVM. >>> >>> I actually disagree with the last two sentences in that comment block, >>> but I didn't have a good rewrite in mind. I'll think about it more. >>> >>> >>> >>>> Further the logic now applied: >>>> >>>> 1816 if ((exit_type == jni_detach && JNIDetachReleasesMonitors) || >>>> 1817 JavaThreadExitReleasesMonitors) { >>>> >>>> is also not "correct" because if we have >>>> JavaThreadExitReleasesMonitors true while JNIDetachReleasesMonitors is >>>> false, we will in fact release any JNI acquired monitors because we >>>> can't make the distinction. >>> >>> I don't think JNIDetachReleasesMonitors only has to deal with >>> JNI-acquired >>> monitors and I don't think that JavaThreadExitReleasesMonitors only >>> has to >>> deal with Java code acquired monitors. I see these options as >>> applying to >>> "how you got to the Java thread exit path" and not applying to "what >>> needs >>> to be cleaned up". >>> >>> I see JNIDetachReleasesMonitors as a way of cleaning up unexited Java >>> monitors when we're executing the JNI DetachCurrentThread() code path. >>> I don't really care why the Java monitors are unexited... and I think >>> the spec wording is clear that all unexited Java monitors are cleaned >>> up... not just JNI-acquired monitors. >>> >>> I see JavaThreadExitReleasesMonitors as a way of cleaning up unexited >>> Java monitors in any code path where we are exiting the Java thread. >>> I see >>> JavaThreadExitReleasesMonitors as a superset of >>> JNIDetachReleasesMonitors. >>> >>> >>>> Given we can't make the distinction I don't see any way for these >>>> separate flags to actually work well together. >>> >>> I think they work well together when JavaThreadExitReleasesMonitors >>> is seen as a superset of JNIDetachReleasesMonitors. Of course, that >>> hinges on my opinion that JNIDetachReleasesMonitors applies to any >>> unexited Java monitor and not just JNI-acquired Java monitors. >>> >>> >>>> As I said above I'm more inclined to just add a guarantee to the >>>> non-detach case, than add two new flags. (Even though this means there >>>> won't be detection for such bugs when JNI attached threads encounter >>>> them - including the main thread :( ). >>> >>> I really don't want to add this check to all Java thread exit >>> paths since it is expensive. >>> >>> >>>> As I said this has me perplexed. :( >>> >>> Hopefully, I've explained it better now. >>> >>> >>>> --- >>>> >>>> src/share/vm/runtime/vframe.cpp >>>> >>>> 170 // It would be nice to distinguish between "waiting on" and >>>> 171 // "waited on". Currently, "waiting on" here with a >>>> 172 // java.lang.Thread.State == "WAITING (on object monitor)" >>>> 173 // earlier in the output means that the monitor has not yet >>>> been >>>> 174 // notified and java.lang.Thread.State == "BLOCKED (on object >>>> 175 // monitor)" earlier in the output means that the monitor has >>>> 176 // been notified and the thread is blocked on reentry. >>>> >>>> That's a very long sentence that can be quite difficult to parse and >>>> could probably be reworded to describe how the output should be >>>> interpreted eg: >>>> >>>> // If earlier in the output we reported java.lang.Thread.State == >>>> // "WAITING (on object monitor)" and now we report "waited on", then >>>> // we are still waiting for notification [or timeout?]. Otherwise if >>>> // we earlier reported java.lang.Thread.State == "BLOCKED (on object >>>> // monitor)", then we are actually waiting to reacquire the monitor >>>> // lock. At this level we can't distinguish the two cases to report >>>> // "waited on" rather than "waiting on" for the second case. >>> >>> I'll take a look at rewriting the comment and may just take your >>> version entirely. >>> >>> >>>> I wonder if we can prod deeper into VM state to try and make the >>>> distinction? >>> >>> I played around with doing just that, but it seems like the M&M >>> code that fetches similar state probes the state stored in the >>> java.lang.Thread object. I didn't want to go there. >>> >>> >>>> >>>> 184 } else { >>>> 185 st->print_cr("\t- %s ", wait_state); >>>> >>>> The concept of "locals" is confusing here. Isn't the "local" in this >>>> case just the object that we have waited upon? In which case we should >>>> say "no object reference available". >>> >>> I got the phrase "locals" from the compiler code that was trying to >>> decode the object reference. I can change to "no object reference >>> available". >>> I definitely want to say _something_ here. The existing code is just >>> silent. >>> >>> >>>> Though I would have thought/hoped there must be a way to find the >>>> object reference even in a compiled frame? >>> >>> Yes, if you deopt... I didn't want to go there. >>> >>> >>>> 195 // Print out all monitors that we have locked, are trying to lock >>>> 196 // or are trying to relock after a wait(). >>>> >>>> that makes it sound like there are three cases when really a "relock" >>>> is just a specific case of lock. I would suggest: >>>> >>>> // Print out all monitors that we have locked, or are trying to >>>> // lock, including re-locking when returning from a wait(). >>> >>> Making it more clear that the "re-locking" is coming from "wait()" >>> is an improvement. I'll fix this. >>> >>> >>>> 252 lock_state = "waiting to relock"; >>>> >>>> I prefer "waiting to re-lock in wait()", if that isn't too long. >>>> Otherwise "relock" needs to be a concept people are familiar with. >>> >>> I like "waiting to re-lock in wait()". >>> >>> >>>> 260 if (VerboseStackTrace && mark != NULL) { >>>> 261 st->print("\t- lockbits="); >>>> 262 mark->print_on(st); >>>> >>>> This really doesn't seem to warrant a new diagnostic flag, regardless >>>> of whether we think applying -XX:+Verbose is a good fit or not. >>> >>> I suspect that David C didn't want to change the default output format >>> and neither do I. We have some tests that try to parse out specific >>> things from thread dumps to verify certain bug fixes and we don't want >>> to break those. I'm thinking of the "duplicate owner" bug fix that we >>> fixed in thread dumps, but I can't pull up the bug ID (yet)... >>> >>> Thanks for the thorough review. I have to say that I wasn't expecting >>> much comment on this review at all. :-) >>> >>> >>> Dan >>> >>> >>>> >>>> Thanks, >>>> David >>>> ------- >>>> >>>>> This work is being tracked by the following bug ID: >>>>> >>>>> JDK-8130448 8077392 inspired thread dump improvements, comment >>>>> additions, new diagnostics >>>>> https://bugs.openjdk.java.net/browse/JDK-8130448 >>>>> >>>>> Here is the webrev URL: >>>>> >>>>> http://cr.openjdk.java.net/~dcubed/8130448-webrev/0-jdk9-hs-rt/ >>>>> >>>>> Testing: >>>>> >>>>> - RBT vm.quick batches (in process) >>>>> - JPRT test jobs >>>>> >>>>> Thanks, in advance, for any comments, questions or suggestions. >>>>> >>>>> Gory details about the changes are below... >>>>> >>>>> Dan >>>>> >>>>> 8130448 summary of changes: >>>>> >>>>> src/cpu/x86/vm/macroAssembler_x86.cpp >>>>> - comment additions for the assembly code >>>>> >>>>> src/share/vm/oops/markOop.cpp >>>>> - has_monitor() has to be checked before is_locked() since >>>>> the has_monitor() bits are a superset of the is_locked() bits >>>>> - code style fixes >>>>> >>>>> src/share/vm/runtime/globals.hpp >>>>> - add VerboseStackTrace diagnostic option >>>>> - add GuaranteeOnMonitorMismatch diagnostic option >>>>> - add JavaThreadExitReleasesMonitors product option; >>>>> this is the Java equivalent of JNIDetachReleasesMonitors >>>>> >>>>> src/share/vm/runtime/objectMonitor.cpp >>>>> - delete unused ObjectMonitor::try_enter() >>>>> - fix assert wording >>>>> >>>>> src/share/vm/runtime/objectMonitor.hpp >>>>> - delete unused ObjectMonitor::try_enter() >>>>> >>>>> src/share/vm/runtime/synchronizer.cpp >>>>> - add GuaranteeOnMonitorMismatch support with some >>>>> diagnostic output >>>>> >>>>> src/share/vm/runtime/thread.cpp >>>>> - add JavaThreadExitReleasesMonitors support >>>>> >>>>> src/share/vm/runtime/vframe.cpp >>>>> - clarify existing comments >>>>> - add comments to clarify what "waiting on" means >>>>> - add line to show when we are "waiting on", but >>>>> there are no locals available (previously we were >>>>> "waiting on" silently) >>>>> - add support for "waiting to relock" which can happen >>>>> for any of the monitors and not just the top monitor >>>>> - switch mark->print_on() verbose output to new >>>>> VerboseStackTrace switch; thread dumps are not enabled >>>>> with a specific switch so the '-XX:+Verbose' model of >>>>> being a modifier for another option does not fit >>> > From david.holmes at oracle.com Thu Jul 9 06:34:57 2015 From: david.holmes at oracle.com (David Holmes) Date: Thu, 9 Jul 2015 16:34:57 +1000 Subject: RFR(S) 8130448: thread dump improvements, comment, additions, new diagnostics inspired by 8077392 In-Reply-To: <559D970E.7000905@oracle.com> References: <55972558.6060905@oracle.com> <559D970E.7000905@oracle.com> Message-ID: <559E1611.2070803@oracle.com> Hi Dan, On 9/07/2015 7:33 AM, Daniel D. Daugherty wrote: > Greetings, > > I've updated this patch based on David H's comments along with > some additional cleanup. So to address the high-level changes: - Use ObjectMonitor::Knob_Verbose as the verbosity flag for printing the lockbits in the stack dump. Okay - though I do wonder why the SyncVerbose flag also exists? - Use ObjectMonitor::Knob_ExitRelease to control whether Java threads are checked for locked monitors when they exit - Use ObjectMonitor::Knob_VerifyMatch to control whether finding a locked (hence unmatched) monitor causes an abort That seems like a good way to work within the existing mechanism for customizing the sync logic - and no new global options (though SQE will still need tests for using these knobs I think). Some specific comments below ... > This work is being tracked by the following bug ID: > > JDK-8130448 8077392 inspired thread dump improvements, comment > additions, new diagnostics > https://bugs.openjdk.java.net/browse/JDK-8130448 > > Here is the webrev URL: > > http://cr.openjdk.java.net/~dcubed/8130448-webrev/1-jdk9-hs-rt/ src/share/vm/runtime/objectMonitor.cpp 2393 if (Knob_ReportSettings && v != NULL) { 2394 tty->print_cr("INFO: SyncKnob: %s %d(%d)", Key, rslt, Default) ; 2395 tty->flush(); 2396 } I suspect these were not tty using because this might get called before the tty has been initialized - but I can't see how that might arise (nor can I be certain it can't). Ditto for similar changes throughout. --- src/share/vm/runtime/synchronizer.cpp 1648 void do_monitor(ObjectMonitor* mid) { 1649 if (mid->owner() == THREAD) { 1650 if (ObjectMonitor::Knob_VerifyMatch != 0) { 1651 Handle obj((oop) mid->object()); 1652 tty->print("INFO: unexpected locked object:"); 1653 javaVFrame::print_locked_object_class_name(tty, obj, "locked"); 1654 } 1655 guarantee(ObjectMonitor::Knob_VerifyMatch == 0, 1656 err_msg("exiting JavaThread=" INTPTR_FORMAT 1657 " unexpectedly owns ObjectMonitor=" INTPTR_FORMAT, 1658 THREAD, mid)); 1659 (void)mid->complete_exit(CHECK); 1660 } 1661 } Took me a while to figure out the expected control flow here. Doesn't the above simplify to: void do_monitor(ObjectMonitor* mid) { if (mid->owner() == THREAD) { if (ObjectMonitor::Knob_VerifyMatch != 0) { Handle obj((oop) mid->object()); tty->print("INFO: unexpected locked object:"); javaVFrame::print_locked_object_class_name(tty, obj, "locked"); fatal(err_msg("exiting JavaThread=" INTPTR_FORMAT " unexpectedly owns ObjectMonitor=" INTPTR_FORMAT, THREAD, mid)); } (void)mid->complete_exit(CHECK); } } ? Thanks, David > > The easiest way to review the delta is to download the two patch > files and compare them in something like jfilemerge: > > http://cr.openjdk.java.net/~dcubed/8130448-webrev/0-jdk9-hs-rt/hotspot.patch > > http://cr.openjdk.java.net/~dcubed/8130448-webrev/1-jdk9-hs-rt/hotspot.patch > > > Testing: > > - Aurora Adhoc RT/SVC nightly batches (in process) > - JPRT test jobs > > Thanks, in advance, for any comments, questions or suggestions. > > Gory details about the changes are below... > > Dan > > Changes between CR0 and CR1 are: > > src/cpu/x86/vm/macroAssembler_x86.cpp > > - fix comment typos, clarify comment wording > > src/share/vm/oops/markOop.cpp > > - clarify output messages > - get rid of confusing local variable > > src/share/vm/runtime/globals.hpp > > - drop VerboseStackTrace, GuaranteeOnMonitorMismatch > and JavaThreadExitReleasesMonitors options > - there are no longer changes to this file > > src/share/vm/runtime/objectMonitor.cpp > > - add ObjectMonitor::Knob_ExitRelease suboption to replace > JavaThreadExitReleasesMonitors > - add ObjectMonitor::Knob_VerifyMatch suboption to replace > GuaranteeOnMonitorMismatch > - cleanup messy logging: > - switch from '::printf()' -> 'tty->print_cr()' > - switch from '::fflush()' -> 'tty->flush()' > > src/share/vm/runtime/objectMonitor.hpp > > - add ObjectMonitor::Knob_ExitRelease suboption > - add ObjectMonitor::Knob_VerifyMatch suboption > - cleanup messy logging > > src/share/vm/runtime/synchronizer.cpp > > - cleanup messy logging > - switch from GuaranteeOnMonitorMismatch to > ObjectMonitor::Knob_VerifyMatch > - add diagnostic information about the locked object > when ReleaseJavaMonitorsClosure::do_monitor() finds > a problem > > src/share/vm/runtime/thread.cpp > > - clarify comments > - switch from JavaThreadExitReleasesMonitors to > ObjectMonitor::Knob_ExitRelease > > src/share/vm/runtime/vframe.cpp > > - print_locked_object_class_name() is now public > - clarify comments > - clarify output messages > - switch from VerboseStackTrace to the already existing > ObjectMonitor::Knob_Verbose > > src/share/vm/runtime/vframe.hpp > > - print_locked_object_class_name() is now public > > > On 7/3/15 6:14 PM, Daniel D. Daugherty wrote: >> Greetings, >> >> The hunt for the following bug: >> >> JDK-8077392 Stream fork/join tasks occasionally fail to complete >> >> and David C's work on the following bug: >> >> JDK-8069412 Locks need better debug-printing support >> >> have inspired additional thread dump improvements, comment additions >> to some Java monitor code and some new diagnostic options. >> >> This work is being tracked by the following bug ID: >> >> JDK-8130448 8077392 inspired thread dump improvements, comment >> additions, new diagnostics >> https://bugs.openjdk.java.net/browse/JDK-8130448 >> >> Here is the webrev URL: >> >> http://cr.openjdk.java.net/~dcubed/8130448-webrev/0-jdk9-hs-rt/ >> >> Testing: >> >> - RBT vm.quick batches (in process) >> - JPRT test jobs >> >> Thanks, in advance, for any comments, questions or suggestions. >> >> Gory details about the changes are below... >> >> Dan >> >> 8130448 summary of changes: >> >> src/cpu/x86/vm/macroAssembler_x86.cpp >> - comment additions for the assembly code >> >> src/share/vm/oops/markOop.cpp >> - has_monitor() has to be checked before is_locked() since >> the has_monitor() bits are a superset of the is_locked() bits >> - code style fixes >> >> src/share/vm/runtime/globals.hpp >> - add VerboseStackTrace diagnostic option >> - add GuaranteeOnMonitorMismatch diagnostic option >> - add JavaThreadExitReleasesMonitors product option; >> this is the Java equivalent of JNIDetachReleasesMonitors >> >> src/share/vm/runtime/objectMonitor.cpp >> - delete unused ObjectMonitor::try_enter() >> - fix assert wording >> >> src/share/vm/runtime/objectMonitor.hpp >> - delete unused ObjectMonitor::try_enter() >> >> src/share/vm/runtime/synchronizer.cpp >> - add GuaranteeOnMonitorMismatch support with some >> diagnostic output >> >> src/share/vm/runtime/thread.cpp >> - add JavaThreadExitReleasesMonitors support >> >> src/share/vm/runtime/vframe.cpp >> - clarify existing comments >> - add comments to clarify what "waiting on" means >> - add line to show when we are "waiting on", but >> there are no locals available (previously we were >> "waiting on" silently) >> - add support for "waiting to relock" which can happen >> for any of the monitors and not just the top monitor >> - switch mark->print_on() verbose output to new >> VerboseStackTrace switch; thread dumps are not enabled >> with a specific switch so the '-XX:+Verbose' model of >> being a modifier for another option does not fit >> >> > From david.holmes at oracle.com Thu Jul 9 06:40:00 2015 From: david.holmes at oracle.com (David Holmes) Date: Thu, 9 Jul 2015 16:40:00 +1000 Subject: RFR(S) Contended Locking fast notify bucket (8075171) In-Reply-To: <559D9FBB.6020503@oracle.com> References: <555A4678.7020308@oracle.com> <559724B0.6000507@oracle.com> <59B99866-C9BB-46F8-87C3-7E6FA8122227@oracle.com> <559D66A7.6040902@oracle.com> <559D9FBB.6020503@oracle.com> Message-ID: <559E1740.6040007@oracle.com> On 9/07/2015 8:10 AM, Daniel D. Daugherty wrote: > > On 7/8/15 12:06 PM, Daniel D. Daugherty wrote: >> On 7/8/15 11:53 AM, Karen Kinnear wrote: >>> Dan, >>> >>> Looks good. >>> >>> Only comment is - >>> >>> In ObjectMonitor::INotify - lines 1668-1671 >>> the default value of policy is "2" >>> -- which basically is "b" not "a" unless the EntryList is empty. >> >> Nice catch! For folks on the alias that don't have this code >> tattooed on the inside of their eyelids. This is the relevant code: >> >> src/share/vm/runtime/objectMonitor.cpp: >> >> 136 static int Knob_MoveNotifyee = 2; // notify() - >> disposition of notifyee >> >> >> >> 1659 void ObjectMonitor::INotify(Thread * Self) { >> 1660 const int policy = Knob_MoveNotifyee; >> >> >> >> 1668 // Disposition - what might we do with iterator ? >> 1669 // a. add it directly to the EntryList - either tail or head. >> 1670 // b. push it onto the front of the _cxq. >> 1671 // For now we use (a). >> >> >> >> 1710 } else if (policy == 2) { // prepend to cxq >> >> I will update the comment. > > Don't think this update is worth a new webrev so here > are the diffs instead: > > $ diff src/share/vm/runtime/objectMonitor.cpp{.cr1,} > 1669,1671c1669,1672 > < // a. add it directly to the EntryList - either tail or head. > < // b. push it onto the front of the _cxq. > < // For now we use (a). > --- > > // a. add it directly to the EntryList - either tail (policy == 1) > > // or head (policy == 0). > > // b. push it onto the front of the _cxq (policy == 2). > > // For now we use (b). > > Thanks again for the catch! Yep good catch! David > Dan > > >> >> Dan >> >> >>> >>> thanks, >>> Karen >>> >>> On Jul 3, 2015, at 8:11 PM, Daniel D. Daugherty wrote: >>> >>>> Greetings, >>>> >>>> I've updated the patch for Contended Locking fast notify bucket >>>> based on David H's and Karen's comments. >>>> >>>> This work is being tracked by the following bug ID: >>>> >>>> JDK-8075171 Contended Locking fast notify bucket >>>> https://bugs.openjdk.java.net/browse/JDK-8075171 >>>> >>>> Here is the webrev URL: >>>> >>>> http://cr.openjdk.java.net/~dcubed/8075171-webrev/1-jdk9-hs-rt/ >>>> >>>> Here is the JEP link: >>>> >>>> https://bugs.openjdk.java.net/browse/JDK-8046133 >>>> >>>> Testing: >>>> >>>> - RBT vm.quick batches (in process) >>>> - JPRT test jobs >>>> - MonitorWaitNotifyStresser micro-benchmark (in process) >>>> - CallTimerGrid stress testing (in process) >>>> >>>> >>>> The changes in this round are in only four of the files: >>>> >>>> src/share/vm/opto/runtime.cpp >>>> >>>> - deleted comment about hashCode() that belongs in a different bucket >>>> >>>> src/share/vm/runtime/objectMonitor.cpp >>>> >>>> - add MAX_RECHECK_INTERVAL define for use in ObjectMonitor::EnterI() >>>> - cleanup recheck interval code >>>> - ObjectMonitor::INotify() return type is now "void" >>>> - delete duplicate comments, clarify/rewrite some comments >>>> >>>> src/share/vm/runtime/objectMonitor.hpp >>>> >>>> - ObjectMonitor::INotify() return type is now "void" >>>> >>>> src/share/vm/runtime/synchronizer.cpp >>>> >>>> - clarify/rewrite comments, add additional comments >>>> - cleanup variables in ObjectSynchronizer::quick_notify >>>> - refactor loop to be more clear >>>> - delete unused enum MaximumRecheckInterval >>>> >>>> The easiest way to review the delta is to download the two patch >>>> files and compare them in something like jfilemerge: >>>> >>>> http://cr.openjdk.java.net/~dcubed/8075171-webrev/0-jdk9-hs-rt/hotspot.patch >>>> >>>> http://cr.openjdk.java.net/~dcubed/8075171-webrev/1-jdk9-hs-rt/hotspot.patch >>>> >>>> >>>> Dan >>>> >>>> >>>> On 5/18/15 2:07 PM, Daniel D. Daugherty wrote: >>>>> Greetings, >>>>> >>>>> I have the Contended Locking fast notify bucket ready for review. >>>>> >>>>> The code changes in this bucket are the final piece in the triad >>>>> of {fast-enter, fast-exit, fast-notify} changes. There are no >>>>> macro assembler changes in this bucket (yeah!), but there are >>>>> code review cleanups motivated by comments on other buckets, e.g., >>>>> changing variables like 'Tally' -> 'tally'. >>>>> >>>>> This work is being tracked by the following bug ID: >>>>> >>>>> JDK-8075171 Contended Locking fast notify bucket >>>>> https://bugs.openjdk.java.net/browse/JDK-8075171 >>>>> >>>>> Here is the webrev URL: >>>>> >>>>> http://cr.openjdk.java.net/~dcubed/8075171-webrev/0-jdk9-hs-rt/ >>>>> >>>>> Here is the JEP link: >>>>> >>>>> https://bugs.openjdk.java.net/browse/JDK-8046133 >>>>> >>>>> Testing: >>>>> >>>>> - Aurora Adhoc RT/SVC baseline batch >>>>> - JPRT test jobs >>>>> - MonitorWaitNotifyStresser micro-benchmark (in process) >>>>> - CallTimerGrid stress testing (in process) >>>>> - Aurora performance testing: >>>>> - out of the box for the "promotion" and 32-bit server configs >>>>> - heavy weight monitors for the "promotion" and 32-bit server >>>>> configs >>>>> (-XX:-UseBiasedLocking -XX:+UseHeavyMonitors) >>>>> (in process) >>>>> >>>>> The hang somehow introduced by the "fast enter" bucket is still >>>>> unresolved, but progress is being made. That work is being tracked >>>>> by the following bug: >>>>> >>>>> JDK-8077392 Stream fork/join tasks occasionally fail to complete >>>>> https://bugs.openjdk.java.net/browse/JDK-8077392 >>>>> >>>>> You'll see a change that re-enables the "fast enter" bucket in this >>>>> webrev, but that change will not be pushed when we're done with the >>>>> review of this bucket unless JDK-8077392 is resolved. >>>>> >>>>> Thanks, in advance, for any comments, questions or suggestions. >>>>> >>>>> Gory details about the changes are below... >>>>> >>>>> Dan >>>>> >>>>> >>>>> 8075171 summary of changes: >>>>> >>>>> src/share/vm/classfile/vmSymbols.hpp >>>>> - Add do_intrinsic() entries for _notify and _notifyAll >>>>> >>>>> src/share/vm/opto/library_call.cpp >>>>> - Add optional inline_notify() that is controlled by new >>>>> '-XX:[+-]InlineNotify' option >>>>> >>>>> src/share/vm/opto/runtime.cpp >>>>> src/share/vm/opto/runtime.hpp >>>>> - Add OptoRuntime::monitor_notify_C() and >>>>> OptoRuntime::monitor_notifyAll_C() functions to support >>>>> the new "fast notify" code paths >>>>> - Add new OptoRuntime::monitor_notify_Type() to support >>>>> the above two new functions >>>>> >>>>> src/share/vm/runtime/globals.hpp >>>>> - Add '-XX:[+-]InlineNotify' option; default option value is >>>>> enabled (true) >>>>> >>>>> src/share/vm/runtime/objectMonitor.cpp >>>>> src/share/vm/runtime/objectMonitor.hpp >>>>> - Refactor ObjectMonitor::notify() and ObjectMonitor::notifyAll() >>>>> into wrappers that call the new ObjectMonitor::INotify() >>>>> - Add new ObjectMonitor::INotify() to reduce code duplication >>>>> between "notify" and "notifyAll" code paths >>>>> >>>>> src/share/vm/runtime/sharedRuntime.cpp >>>>> - Temporarily re-enable the "fast enter" optimization in order >>>>> to do performance testing. JDK-8077392 is still unresolved, >>>>> but progress is being made. >>>>> >>>>> src/share/vm/runtime/synchronizer.cpp >>>>> src/share/vm/runtime/synchronizer.hpp >>>>> - Add ObjectSynchronizer::quick_notify() that implements the >>>>> new "fast notify" code paths >>>>> - The new code handles a couple of special cases where the >>>>> "notify" can be done without the heavy weight slow-path >>>>> (thread state transitions and other baggage) >>>>> >>>>> >> >> >> > From david.holmes at oracle.com Thu Jul 9 09:27:43 2015 From: david.holmes at oracle.com (David Holmes) Date: Thu, 9 Jul 2015 19:27:43 +1000 Subject: RFR: 8130728: Disable WorkAroundNPTLTimedWaitHang by default Message-ID: <559E3E8F.9020300@oracle.com> https://bugs.openjdk.java.net/browse/JDK-8130728 The workaround triggered by WorkAroundNPTLTimedWaitHang (an experimental flag set to 1 by default) was to alleviate a hang that could occur on a pthread_cond_timedwait on Linux, if the timeout value was a time in the past - see JDK-6314875. This glibc bug was fixed in 2005 in glibc 2.3.5-3 https://lists.debian.org/debian-glibc/2005/08/msg00201.html but the workaround persists and was (unfortunately) copied into the BSD and AIX ports. It is time to remove that workaround but before we can do that we need to be sure that we are not in fact hitting the workaround code. To that end I propose to use this bug to switch the flag's value to 0 to verify correct operation. If that goes well then we can remove the code either later in JDK 9 or early in JDK 10. To be clear the flag impacts both the wait and the signal part of the condvar usage (park and unpark). On the wait side we have: status = pthread_cond_timedwait(_cond, _mutex, &abst); if (status != 0 && WorkAroundNPTLTimedWaitHang) { pthread_cond_destroy(_cond); pthread_cond_init(_cond, os::Linux::condAttr()); } so we will now skip this potential recovery code. On the signal side we signal while holding the mutex if the workaround is enabled, and we signal after dropping the mutex otherwise. So this code will now be using a new path. Here is the code in PlatformEvent::unpark assert(AnyWaiters == 0 || AnyWaiters == 1, "invariant"); if (AnyWaiters != 0 && WorkAroundNPTLTimedWaitHang) { AnyWaiters = 0; pthread_cond_signal(_cond); } status = pthread_mutex_unlock(_mutex); assert_status(status == 0, status, "mutex_unlock"); if (AnyWaiters != 0) { // Note that we signal() *after* dropping the lock for "immortal" Events. // This is safe and avoids a common class of futile wakeups. In rare // circumstances this can cause a thread to return prematurely from // cond_{timed}wait() but the spurious wakeup is benign and the victim // will simply re-test the condition and re-park itself. // This provides particular benefit if the underlying platform does not // provide wait morphing. status = pthread_cond_signal(_cond); assert_status(status == 0, status, "cond_signal"); } and similarly in Parker::unpark if (WorkAroundNPTLTimedWaitHang) { status = pthread_cond_signal(&_cond[_cur_index]); assert(status == 0, "invariant"); status = pthread_mutex_unlock(_mutex); assert(status == 0, "invariant"); } else { status = pthread_mutex_unlock(_mutex); assert(status == 0, "invariant"); status = pthread_cond_signal(&_cond[_cur_index]); assert(status == 0, "invariant"); } This may cause performance perturbations that will need to be investigated - but in theory, as per the comment above, signalling outside the lock should be beneficial in the linux case because there is no wait-morphing (where a signal simply takes a waiting thread and places it into the mutex queue thereby avoiding the need to awaken the thread so it can enqueue itself). The change itself is of course trivial: http://cr.openjdk.java.net/~dholmes/8130728/webrev/ I'd appreciate any comments/concerns particularly from the BSD and AIX folk who acquired this unnecessary workaround. If deemed necessary we could add a flag that controls whether the signal happens with or without the lock held. Thanks, David From dmitry.dmitriev at oracle.com Thu Jul 9 10:55:24 2015 From: dmitry.dmitriev at oracle.com (Dmitry Dmitriev) Date: Thu, 9 Jul 2015 13:55:24 +0300 Subject: Open code review for 8061999 Enhance VM option parsing to allow options to be specified In-Reply-To: <559E0165.3040902@oracle.com> References: <3d1df3cb-fe69-4c3b-b8e1-db8801d5a68f@default> <5588EA9F.3020001@oracle.com> <725f7631-425d-4918-8a92-230005d5b5ec@default> <558A1AE7.6010607@oracle.com> <224EF327-B898-4DAC-9343-4FE238604276@oracle.com> <558AD8AD.6020009@oracle.com> <558AF2AB.7040407@oracle.com> <558B8B45.4060307@oracle.com> <558BA1CC.6040100@oracle.com> <558BA53E.1010600@oracle.com> <558C312F.4070606@oracle.com> <558CEB04.5040905@oracle.com> <558D9423.1010903@oracle.com> <5591EABE.6030301@oracle.com> <99352AD6-77D3-42ED-AEE8-1EABD1EEA7B6@oracle.com> <559D8846.7060803@oracle.com> <559E0165.3040902@oracle.com> Message-ID: <559E531C.40103@oracle.com> Hello David, I think that it look like same limitations which was applied to the options in environment variables before JDK-8074895 fix. I think Ron can add more information about that. Thanks, Dmitry On 09.07.2015 8:06, David Holmes wrote: > > > On 9/07/2015 6:29 AM, Dmitry Dmitriev wrote: >> On 08.07.2015 22:26, Karen Kinnear wrote: >>> 2) is there a maximum length to the options read in from the file? >> The current implemented limitations are following: only one VM option >> file can be specified, maximum size of the file is 1024 bytes, up to 64 >> VM options > > That seems extremely limiting. Why should there be a maximum size, why > can't you just read the file line by line and keep processing until it > is all read ?? > > Thanks, > David From david.holmes at oracle.com Thu Jul 9 11:14:48 2015 From: david.holmes at oracle.com (David Holmes) Date: Thu, 9 Jul 2015 21:14:48 +1000 Subject: Open code review for 8061999 Enhance VM option parsing to allow options to be specified In-Reply-To: <559E531C.40103@oracle.com> References: <3d1df3cb-fe69-4c3b-b8e1-db8801d5a68f@default> <5588EA9F.3020001@oracle.com> <725f7631-425d-4918-8a92-230005d5b5ec@default> <558A1AE7.6010607@oracle.com> <224EF327-B898-4DAC-9343-4FE238604276@oracle.com> <558AD8AD.6020009@oracle.com> <558AF2AB.7040407@oracle.com> <558B8B45.4060307@oracle.com> <558BA1CC.6040100@oracle.com> <558BA53E.1010600@oracle.com> <558C312F.4070606@oracle.com> <558CEB04.5040905@oracle.com> <558D9423.1010903@oracle.com> <5591EABE.6030301@oracle.com> <99352AD6-77D3-42ED-AEE8-1EABD1EEA7B6@oracle.com> <559D8846.7060803@oracle.com> <559E0165.3040902@oracle.com> <559E531C.40103@oracle.com> Message-ID: <559E57A8.2060600@oracle.com> On 9/07/2015 8:55 PM, Dmitry Dmitriev wrote: > Hello David, > > I think that it look like same limitations which was applied to the > options in environment variables before JDK-8074895 > fix. I think Ron can > add more information about that. You can't read an environment variable line-by-line so we have to have fixed buffer. A file can be read line-by-line. Cheers, David > Thanks, > Dmitry > > On 09.07.2015 8:06, David Holmes wrote: >> >> >> On 9/07/2015 6:29 AM, Dmitry Dmitriev wrote: >>> On 08.07.2015 22:26, Karen Kinnear wrote: >>>> 2) is there a maximum length to the options read in from the file? >>> The current implemented limitations are following: only one VM option >>> file can be specified, maximum size of the file is 1024 bytes, up to 64 >>> VM options >> >> That seems extremely limiting. Why should there be a maximum size, why >> can't you just read the file line by line and keep processing until it >> is all read ?? >> >> Thanks, >> David > From daniel.daugherty at oracle.com Thu Jul 9 12:54:59 2015 From: daniel.daugherty at oracle.com (Daniel D. Daugherty) Date: Thu, 09 Jul 2015 06:54:59 -0600 Subject: Open code review for 8061999 Enhance VM option parsing to allow options to be specified In-Reply-To: <559E57A8.2060600@oracle.com> References: <3d1df3cb-fe69-4c3b-b8e1-db8801d5a68f@default> <5588EA9F.3020001@oracle.com> <725f7631-425d-4918-8a92-230005d5b5ec@default> <558A1AE7.6010607@oracle.com> <224EF327-B898-4DAC-9343-4FE238604276@oracle.com> <558AD8AD.6020009@oracle.com> <558AF2AB.7040407@oracle.com> <558B8B45.4060307@oracle.com> <558BA1CC.6040100@oracle.com> <558BA53E.1010600@oracle.com> <558C312F.4070606@oracle.com> <558CEB04.5040905@oracle.com> <558D9423.1010903@oracle.com> <5591EABE.6030301@oracle.com> <99352AD6-77D3-42ED-AEE8-1EABD1EEA7B6@oracle.com> <559D8846.7060803@oracle.com> <559E0165.3040902@oracle.com> <559E531C.40103@oracle.com> <559E57A8.2060600@oracle.com> Message-ID: <559E6F23.6080007@oracle.com> Dimitry is correct that the current limitations on the options file implementation are based on the previous limitations on the options environment variables. We did track the fix for JDK-8074895 as it made its way into the system, but we made the choice to not change the options file implementation at this time in order to reduce the risk to this rather large change. In the "Future Work" section of Ron's soon to be posted document, there are entries for removing both the 1024 byte limit and the 64 option limit. Dan On 7/9/15 5:14 AM, David Holmes wrote: > On 9/07/2015 8:55 PM, Dmitry Dmitriev wrote: >> Hello David, >> >> I think that it look like same limitations which was applied to the >> options in environment variables before JDK-8074895 >> fix. I think Ron can >> add more information about that. > > You can't read an environment variable line-by-line so we have to have > fixed buffer. A file can be read line-by-line. > > Cheers, > David > >> Thanks, >> Dmitry >> >> On 09.07.2015 8:06, David Holmes wrote: >>> >>> >>> On 9/07/2015 6:29 AM, Dmitry Dmitriev wrote: >>>> On 08.07.2015 22:26, Karen Kinnear wrote: >>>>> 2) is there a maximum length to the options read in from the file? >>>> The current implemented limitations are following: only one VM option >>>> file can be specified, maximum size of the file is 1024 bytes, up >>>> to 64 >>>> VM options >>> >>> That seems extremely limiting. Why should there be a maximum size, why >>> can't you just read the file line by line and keep processing until it >>> is all read ?? >>> >>> Thanks, >>> David >> From daniel.daugherty at oracle.com Thu Jul 9 13:00:25 2015 From: daniel.daugherty at oracle.com (Daniel D. Daugherty) Date: Thu, 09 Jul 2015 07:00:25 -0600 Subject: RFR(S) 8130448: thread dump improvements, comment, additions, new diagnostics inspired by 8077392 In-Reply-To: <559E030C.8010603@oracle.com> References: <55972558.6060905@oracle.com> <559A2397.2010409@oracle.com> <559AE96D.6010508@oracle.com> <559B7BAA.8070705@oracle.com> <559C0C4D.8090504@oracle.com> <559E030C.8010603@oracle.com> Message-ID: <559E7069.7030302@oracle.com> On 7/8/15 11:13 PM, David Holmes wrote: > On 8/07/2015 3:28 AM, Daniel D. Daugherty wrote: >> On 7/7/15 1:11 AM, David Holmes wrote: >>> Hi Dan, >>> >>> Top posting as I'm lazy and running late :) >> >> No problem with the top posting. It makes your remaining >> concerns earlier to see and address. >> >> >>> Okay ... I'm still uneasy about adding two additional flags for the >>> "release monitors on exit" situation. I hear what you are saying about >>> the cost of the monitor check - I had thought we kept easy access to >>> the set of monitors owned by a thread but it seems not, so trawling >>> the global monitor list is indeed an expensive operation. :( So okay >>> but I don't like it :) >> >> Since JavaThreadExitReleasesMonitors and GuaranteeOnMonitorMismatch >> are targeted at finding/working around bugs in the Java Monitor >> implementation, I'm going to take a look at moving the flag support >> down into Java Monitor subsystem's implementation specific options. >> That will get the options out of the global space and they won't >> have to be counted against the "cap and trade" limit :-) >> >> >>> I also take your point about viewing the new flag as a superset of the >>> JNI-detach case. That's fair enough, but of course that aspect needs >>> to be documented. >> >> I'm starting to wonder why we have the 'JNIDetachReleasesMonitors' >> option at all. Is there a good reason to be able to turn off this >> piece of code? > > My recollection is that hotspot did not implement that part of the > spec. Simply switching the behaviour with no way to restore the > original behaviour could break existing apps. Hence a flag, on by > default. That's very likely the case. I'll poke around in my historical archive and see what shakes out. > Of course by now apps should be spec compliant themselves so this > seems a flag that should itself be deprecated in 9 and targetted for > removal in 10. (That will help with the 'conservation of flags' > problem :) ). Sounds like a good RFE. Dan > >> >> >>> I was left unclear about your position on the VerboseStackTrace. I >>> agree the new output was likely put under a flag to avoid disturbing >>> existing output formats. But I don't see that it warrants its own flag >>> - to me using Verbose okay (though the fact it is a develop flag is >>> limiting). >> >> Thanks for reminding me that '-XX:+Verbose' is a develop flag. >> That's another reason for not using that flag. Combined with >> the fact that '-XX:+Verbose' is considered a modifier to other >> flags and thread dumps aren't enabled/triggered by a flag means >> (to me anyway) that '-XX:+Verbose' is still not a good match. >> >> However, I have a vague memory that the Java Monitor subsystem >> has its own "verbose" flag. I'll take a look at switching to >> that... > > Okay > >> Will be working on the next round... > > Thanks, > David > >> Dan >> >> >> >>> >>> Thanks, >>> David >>> >>> On 7/07/2015 6:47 AM, Daniel D. Daugherty wrote: >>>> On 7/6/15 12:43 AM, David Holmes wrote: >>>>> Hi Dan, >>>>> >>>>> Metacomment: Could I suggest that in a RFR your subject line has the >>>>> form : , rather than (bugid) - especially >>>>> when the synopsis actually starts with a bug id :) Thanks. >>>> >>>> Yup that bug synopsis is/was a mess: >>>> >>>> Changed the synopsis line to : >>>> >>>> thread dump improvements, comment additions, new diagnostics >>>> inspired by 8077392 >>>> >>>> Also updated the e-mail thread subject line to your suggested format. >>>> Will try to remember to switch to that style in the future. >>>> >>>> >>>>> Mostly okay but some major concerns around the can of worms that >>>>> JavaThreadExitReleasesMonitors opens up. >>>> >>>> This is Java monitors so "can of worms" is familiar! :-) >>>> >>>> >>>>> >>>>> On 4/07/2015 10:14 AM, Daniel D. Daugherty wrote: >>>>>> Greetings, >>>>>> >>>>>> The hunt for the following bug: >>>>>> >>>>>> JDK-8077392 Stream fork/join tasks occasionally fail to >>>>>> complete >>>>>> >>>>>> and David C's work on the following bug: >>>>>> >>>>>> JDK-8069412 Locks need better debug-printing support >>>>>> >>>>>> have inspired additional thread dump improvements, comment additions >>>>>> to some Java monitor code and some new diagnostic options. >>>>> >>>>> src/cpu/x86/vm/macroAssembler_x86.cpp >>>>> >>>>> 1821 // update _owner from from BasicLock to thread >>>>> >>>>> Typo: from from >>>> >>>> Will fix. >>>> >>>> >>>>> 2091 // the placeholder value. If that didn't work, then >>>>> another >>>>> 2092 // grabbed the lock so we're done (and exit was a >>>>> success). >>>>> >>>>> another -> another thread ? >>>> >>>> Yes, "another thread" is better. Will fix. >>>> >>>> >>>>> 2201 // If that didn't work, then another grabbed the lock >>>>> 2202 // so we're done (and exit was a success). >>>>> >>>>> another -> another thread ? >>>> >>>> Yes, "another thread" is better. Will fix. >>>> >>>> >>>>> --- >>>>> >>>>> src/share/vm/oops/markOop.cpp >>>>> >>>>> 40 st->print("NULL"); // this should not happen >>>>> >>>>> Shouldn't that be an assert or guarantee in that case? Or at a >>>>> minimum >>>>> print something like: "NULL (but you should never see this!)" >>>> >>>> This is a relocated line from David C's change: >>>> >>>> old 49: st->print("monitor=NULL"); >>>> >>>> I simply added a comment to it. I don't think I like the idea of the >>>> thread dump code assert()'ing or guarantee()'ing because there might >>>> be other useful info that would have been printed after the assert() >>>> or guarantee() failure. >>>> >>>> I do like the idea of changing the message to: >>>> >>>> 40: st->print("NULL (this should never be seen!)"); >>>> >>>> >>>>> 42 BasicLock * bl = (BasicLock *) mon->owner(); >>>>> >>>>> What information has told us this is a BasicLock* not a Thread* ? But >>>>> as all you do is print bl why not just p2i(mon->owner()) ? >>>> >>>> Again, this is a relocated line from David C's change: >>>> >>>> old 51: BasicLock * bl = (BasicLock *) mon->owner(); >>>> >>>> I'm going to guess that David C had some other code in there before >>>> that needed/assumed that the field is a "BasicLock *", but that code >>>> didn't make it into his final version. >>>> >>>> I will drop the 'bl' local and update the p2i() call to use >>>> mon->owner() directly. >>>> >>>> >>>>> --- >>>>> >>>>> src/share/vm/runtime/globals.hpp >>>>> >>>>> JavaThreadExitReleasesMonitors has me perplexed. The JNI DetachThread >>>>> case seems to be a concession to badly written code that fails to >>>>> release locks on error paths. >>>> >>>> I don't think I would call the JNIDetachReleasesMonitors case a >>>> concession >>>> to badly written JNI code. 6282335 is very clear that this code was >>>> added >>>> to meet the JNI spec. The JNI spec words might be considered a >>>> concession... >>>> >>>> http://docs.oracle.com/javase/8/docs/technotes/guides/jni/spec/invocation.html#DetachCurrentThread >>>> >>>> >>>> >>>> >>>> > DetachCurrentThread >>>> > >>>> > jint DetachCurrentThread(JavaVM *vm); >>>> > >>>> > Detaches the current thread from a Java VM. All Java monitors >>>> > held by this thread are released. All Java threads waiting for >>>> > this thread to die are notified. >>>> > >>>> > The main thread can be detached from the VM. >>>> >>>> >>>> >>>>> The equivalent for a Java thread would again involve lock acquisition >>>>> via JNI. But I don't recall ever seeing a bug report or RFE >>>>> related to >>>>> this. What seems to have motivated this new flag is the potential for >>>>> a broken VM to actually leave the monitor locked (e.g. because >>>>> compiled code failed to do the unlock on all paths). >>>> >>>> 8077392 and bugs like it are exactly the reason for adding these >>>> two options. >>>> >>>> JavaThreadExitReleasesMonitors is added to provide a work around >>>> until the underlying bug or bugs are fixed. This option is targeted >>>> at folks that are chasing their own bugs and don't care about this >>>> one. >>>> >>>> GuaranteeOnMonitorMismatch is added to help hunt 8077392 specifically >>>> and to sanity check for similar issues generally. I can see using the >>>> two options in combination with existing test suites as a stress test >>>> for the Java monitor subsystem. >>>> >>>> >>>>> To address that I'd be inclined to simply have a guarantee in the >>>>> Java >>>>> thread exit path, rather than a flag to do the clean up and another >>>>> flag to control a guarantee. >>>> >>>> The check for an unexited Java monitor is not cheap. >>>> >>>> The existing check under the JNIDetachReleasesMonitors flag is >>>> positioned to only affect threads using JNI DetachCurrentThread() >>>> and that cost is justified as part of meeting the JNI spec. >>>> >>>> Adding the unexited Java monitor check to all exiting Java >>>> threads should not be done lightly due to the cost. If the >>>> VM is functioning correctly, then why impose this cost on >>>> all exiting Java threads? >>>> >>>> >>>>> I don't think two new command-line options (has this gone through CCC >>>>> yet?) are justified. >>>> >>>> No, this has not gone through CCC yet. My preference is to get >>>> code review feedback (like this) before submitting a CCC. >>>> >>>> I suppose I could have simply added more sub-options to the >>>> existing Java monitor subsystem knobs and switches, but it >>>> seemed to make sense to model JavaThreadExitReleasesMonitors >>>> on the existing JNIDetachReleasesMonitors. >>>> >>>> >>>>> Also note that allowing for JVM induced missing unlocks is something >>>>> that can affect JNI attached threads as well as regular Java threads. >>>>> I'll take this up in discussing thread.cpp below. >>>>> >>>>> That aside, the comment, which was modelled on the JNI DetachThread >>>>> variant, does not really work in this case: >>>>> >>>>> 2801 "JavaThread exit() releases monitors owned by thread") >>>>> \ >>>>> >>>>> JavaThread is not a programming concept but an internal JVM >>>>> abstraction. I would suggest something like: >>>>> >>>>> "Java thread termination releases monitors unexpectedly still >>>>> owned by >>>>> thread" >>>> >>>> I'll switch to your description text if we end up keeping the >>>> new options. >>>> >>>> >>>>> --- >>>>> >>>>> src/share/vm/runtime/objectMonitor.cpp >>>>> src/share/vm/runtime/objectMonitor.hpp >>>>> >>>>> No comments >>>>> >>>>> --- >>>>> >>>>> src/share/vm/runtime/synchronizer.cpp >>>>> >>>>> If we find the unexpected locked monitor it would be useful to see >>>>> more Java level information about the Thread (in the non-detaching >>>>> case) and the object that is locked. >>>> >>>> I can probably steal some code from the thread dump side to >>>> give us more info about the Object associated with the Java >>>> monitor... >>>> >>>> >>>>> --- >>>>> >>>>> src/share/vm/runtime/thread.cpp >>>>> >>>>> As noted previously JNI attached threads can also be affected by JVM >>>>> induced locking bugs. So the comment block: >>>>> >>>>> 1804 // 6282335 JNI DetachCurrentThread spec states that all Java >>>>> monitors >>>>> 1805 // held by this thread must be released. A detach operation >>>>> must only >>>>> 1806 // get here if there are no Java frames on the stack. >>>>> Therefore, any >>>>> 1807 // owned monitors at this point MUST be JNI-acquired monitors >>>>> which are >>>>> 1808 // pre-inflated and in the monitor cache. >>>>> >>>>> is not strictly correct as it is presuming a correctly operating JVM. >>>> >>>> I actually disagree with the last two sentences in that comment block, >>>> but I didn't have a good rewrite in mind. I'll think about it more. >>>> >>>> >>>> >>>>> Further the logic now applied: >>>>> >>>>> 1816 if ((exit_type == jni_detach && JNIDetachReleasesMonitors) || >>>>> 1817 JavaThreadExitReleasesMonitors) { >>>>> >>>>> is also not "correct" because if we have >>>>> JavaThreadExitReleasesMonitors true while >>>>> JNIDetachReleasesMonitors is >>>>> false, we will in fact release any JNI acquired monitors because we >>>>> can't make the distinction. >>>> >>>> I don't think JNIDetachReleasesMonitors only has to deal with >>>> JNI-acquired >>>> monitors and I don't think that JavaThreadExitReleasesMonitors only >>>> has to >>>> deal with Java code acquired monitors. I see these options as >>>> applying to >>>> "how you got to the Java thread exit path" and not applying to "what >>>> needs >>>> to be cleaned up". >>>> >>>> I see JNIDetachReleasesMonitors as a way of cleaning up unexited Java >>>> monitors when we're executing the JNI DetachCurrentThread() code path. >>>> I don't really care why the Java monitors are unexited... and I think >>>> the spec wording is clear that all unexited Java monitors are cleaned >>>> up... not just JNI-acquired monitors. >>>> >>>> I see JavaThreadExitReleasesMonitors as a way of cleaning up unexited >>>> Java monitors in any code path where we are exiting the Java thread. >>>> I see >>>> JavaThreadExitReleasesMonitors as a superset of >>>> JNIDetachReleasesMonitors. >>>> >>>> >>>>> Given we can't make the distinction I don't see any way for these >>>>> separate flags to actually work well together. >>>> >>>> I think they work well together when JavaThreadExitReleasesMonitors >>>> is seen as a superset of JNIDetachReleasesMonitors. Of course, that >>>> hinges on my opinion that JNIDetachReleasesMonitors applies to any >>>> unexited Java monitor and not just JNI-acquired Java monitors. >>>> >>>> >>>>> As I said above I'm more inclined to just add a guarantee to the >>>>> non-detach case, than add two new flags. (Even though this means >>>>> there >>>>> won't be detection for such bugs when JNI attached threads encounter >>>>> them - including the main thread :( ). >>>> >>>> I really don't want to add this check to all Java thread exit >>>> paths since it is expensive. >>>> >>>> >>>>> As I said this has me perplexed. :( >>>> >>>> Hopefully, I've explained it better now. >>>> >>>> >>>>> --- >>>>> >>>>> src/share/vm/runtime/vframe.cpp >>>>> >>>>> 170 // It would be nice to distinguish between "waiting on" and >>>>> 171 // "waited on". Currently, "waiting on" here with a >>>>> 172 // java.lang.Thread.State == "WAITING (on object monitor)" >>>>> 173 // earlier in the output means that the monitor has not yet >>>>> been >>>>> 174 // notified and java.lang.Thread.State == "BLOCKED (on >>>>> object >>>>> 175 // monitor)" earlier in the output means that the >>>>> monitor has >>>>> 176 // been notified and the thread is blocked on reentry. >>>>> >>>>> That's a very long sentence that can be quite difficult to parse and >>>>> could probably be reworded to describe how the output should be >>>>> interpreted eg: >>>>> >>>>> // If earlier in the output we reported java.lang.Thread.State == >>>>> // "WAITING (on object monitor)" and now we report "waited on", then >>>>> // we are still waiting for notification [or timeout?]. Otherwise if >>>>> // we earlier reported java.lang.Thread.State == "BLOCKED (on object >>>>> // monitor)", then we are actually waiting to reacquire the monitor >>>>> // lock. At this level we can't distinguish the two cases to report >>>>> // "waited on" rather than "waiting on" for the second case. >>>> >>>> I'll take a look at rewriting the comment and may just take your >>>> version entirely. >>>> >>>> >>>>> I wonder if we can prod deeper into VM state to try and make the >>>>> distinction? >>>> >>>> I played around with doing just that, but it seems like the M&M >>>> code that fetches similar state probes the state stored in the >>>> java.lang.Thread object. I didn't want to go there. >>>> >>>> >>>>> >>>>> 184 } else { >>>>> 185 st->print_cr("\t- %s ", wait_state); >>>>> >>>>> The concept of "locals" is confusing here. Isn't the "local" in this >>>>> case just the object that we have waited upon? In which case we >>>>> should >>>>> say "no object reference available". >>>> >>>> I got the phrase "locals" from the compiler code that was trying to >>>> decode the object reference. I can change to "no object reference >>>> available". >>>> I definitely want to say _something_ here. The existing code is just >>>> silent. >>>> >>>> >>>>> Though I would have thought/hoped there must be a way to find the >>>>> object reference even in a compiled frame? >>>> >>>> Yes, if you deopt... I didn't want to go there. >>>> >>>> >>>>> 195 // Print out all monitors that we have locked, are trying to >>>>> lock >>>>> 196 // or are trying to relock after a wait(). >>>>> >>>>> that makes it sound like there are three cases when really a "relock" >>>>> is just a specific case of lock. I would suggest: >>>>> >>>>> // Print out all monitors that we have locked, or are trying to >>>>> // lock, including re-locking when returning from a wait(). >>>> >>>> Making it more clear that the "re-locking" is coming from "wait()" >>>> is an improvement. I'll fix this. >>>> >>>> >>>>> 252 lock_state = "waiting to relock"; >>>>> >>>>> I prefer "waiting to re-lock in wait()", if that isn't too long. >>>>> Otherwise "relock" needs to be a concept people are familiar with. >>>> >>>> I like "waiting to re-lock in wait()". >>>> >>>> >>>>> 260 if (VerboseStackTrace && mark != NULL) { >>>>> 261 st->print("\t- lockbits="); >>>>> 262 mark->print_on(st); >>>>> >>>>> This really doesn't seem to warrant a new diagnostic flag, regardless >>>>> of whether we think applying -XX:+Verbose is a good fit or not. >>>> >>>> I suspect that David C didn't want to change the default output format >>>> and neither do I. We have some tests that try to parse out specific >>>> things from thread dumps to verify certain bug fixes and we don't want >>>> to break those. I'm thinking of the "duplicate owner" bug fix that we >>>> fixed in thread dumps, but I can't pull up the bug ID (yet)... >>>> >>>> Thanks for the thorough review. I have to say that I wasn't expecting >>>> much comment on this review at all. :-) >>>> >>>> >>>> Dan >>>> >>>> >>>>> >>>>> Thanks, >>>>> David >>>>> ------- >>>>> >>>>>> This work is being tracked by the following bug ID: >>>>>> >>>>>> JDK-8130448 8077392 inspired thread dump improvements, comment >>>>>> additions, new diagnostics >>>>>> https://bugs.openjdk.java.net/browse/JDK-8130448 >>>>>> >>>>>> Here is the webrev URL: >>>>>> >>>>>> http://cr.openjdk.java.net/~dcubed/8130448-webrev/0-jdk9-hs-rt/ >>>>>> >>>>>> Testing: >>>>>> >>>>>> - RBT vm.quick batches (in process) >>>>>> - JPRT test jobs >>>>>> >>>>>> Thanks, in advance, for any comments, questions or suggestions. >>>>>> >>>>>> Gory details about the changes are below... >>>>>> >>>>>> Dan >>>>>> >>>>>> 8130448 summary of changes: >>>>>> >>>>>> src/cpu/x86/vm/macroAssembler_x86.cpp >>>>>> - comment additions for the assembly code >>>>>> >>>>>> src/share/vm/oops/markOop.cpp >>>>>> - has_monitor() has to be checked before is_locked() since >>>>>> the has_monitor() bits are a superset of the is_locked() bits >>>>>> - code style fixes >>>>>> >>>>>> src/share/vm/runtime/globals.hpp >>>>>> - add VerboseStackTrace diagnostic option >>>>>> - add GuaranteeOnMonitorMismatch diagnostic option >>>>>> - add JavaThreadExitReleasesMonitors product option; >>>>>> this is the Java equivalent of JNIDetachReleasesMonitors >>>>>> >>>>>> src/share/vm/runtime/objectMonitor.cpp >>>>>> - delete unused ObjectMonitor::try_enter() >>>>>> - fix assert wording >>>>>> >>>>>> src/share/vm/runtime/objectMonitor.hpp >>>>>> - delete unused ObjectMonitor::try_enter() >>>>>> >>>>>> src/share/vm/runtime/synchronizer.cpp >>>>>> - add GuaranteeOnMonitorMismatch support with some >>>>>> diagnostic output >>>>>> >>>>>> src/share/vm/runtime/thread.cpp >>>>>> - add JavaThreadExitReleasesMonitors support >>>>>> >>>>>> src/share/vm/runtime/vframe.cpp >>>>>> - clarify existing comments >>>>>> - add comments to clarify what "waiting on" means >>>>>> - add line to show when we are "waiting on", but >>>>>> there are no locals available (previously we were >>>>>> "waiting on" silently) >>>>>> - add support for "waiting to relock" which can happen >>>>>> for any of the monitors and not just the top monitor >>>>>> - switch mark->print_on() verbose output to new >>>>>> VerboseStackTrace switch; thread dumps are not enabled >>>>>> with a specific switch so the '-XX:+Verbose' model of >>>>>> being a modifier for another option does not fit >>>> >> From daniel.daugherty at oracle.com Thu Jul 9 13:08:41 2015 From: daniel.daugherty at oracle.com (Daniel D. Daugherty) Date: Thu, 09 Jul 2015 07:08:41 -0600 Subject: RFR(S) 8130448: thread dump improvements, comment, additions, new diagnostics inspired by 8077392 In-Reply-To: <559E1611.2070803@oracle.com> References: <55972558.6060905@oracle.com> <559D970E.7000905@oracle.com> <559E1611.2070803@oracle.com> Message-ID: <559E7259.1070605@oracle.com> David, Thanks for the quick re-review! Responses embedded below... On 7/9/15 12:34 AM, David Holmes wrote: > Hi Dan, > > On 9/07/2015 7:33 AM, Daniel D. Daugherty wrote: >> Greetings, >> >> I've updated this patch based on David H's comments along with >> some additional cleanup. > > So to address the high-level changes: > > - Use ObjectMonitor::Knob_Verbose as the verbosity flag for printing > the lockbits in the stack dump. Okay - though I do wonder why the > SyncVerbose flag also exists? I'll ping Dice to see if there's a reason for two different verbose flags in the monitor subsystem. I have to admit that I didn't notice that one in the large collection of knobs and switches... :-( > - Use ObjectMonitor::Knob_ExitRelease to control whether Java threads > are checked for locked monitors when they exit > - Use ObjectMonitor::Knob_VerifyMatch to control whether finding a > locked (hence unmatched) monitor causes an abort > > That seems like a good way to work within the existing mechanism for > customizing the sync logic - and no new global options (though SQE > will still need tests for using these knobs I think). Glad that this version is more acceptable. > Some specific comments below ... > >> This work is being tracked by the following bug ID: >> >> JDK-8130448 8077392 inspired thread dump improvements, comment >> additions, new diagnostics >> https://bugs.openjdk.java.net/browse/JDK-8130448 >> >> Here is the webrev URL: >> >> http://cr.openjdk.java.net/~dcubed/8130448-webrev/1-jdk9-hs-rt/ > > src/share/vm/runtime/objectMonitor.cpp > > 2393 if (Knob_ReportSettings && v != NULL) { > 2394 tty->print_cr("INFO: SyncKnob: %s %d(%d)", Key, rslt, Default) ; > 2395 tty->flush(); > 2396 } > > I suspect these were not tty using because this might get called > before the tty has been initialized - but I can't see how that might > arise (nor can I be certain it can't). I couldn't see how tty could not be initialized at these points either. My current plan is to go with this change to 'tty' and if we run into an early use case, then we do something else _and_ comment it. Although with unified logging coming... this may be moot (but the tty version will be easier to port...) > > Ditto for similar changes throughout. > > --- > > src/share/vm/runtime/synchronizer.cpp > > 1648 void do_monitor(ObjectMonitor* mid) { > 1649 if (mid->owner() == THREAD) { > 1650 if (ObjectMonitor::Knob_VerifyMatch != 0) { > 1651 Handle obj((oop) mid->object()); > 1652 tty->print("INFO: unexpected locked object:"); > 1653 javaVFrame::print_locked_object_class_name(tty, obj, > "locked"); > 1654 } > 1655 guarantee(ObjectMonitor::Knob_VerifyMatch == 0, > 1656 err_msg("exiting JavaThread=" INTPTR_FORMAT > 1657 " unexpectedly owns ObjectMonitor=" > INTPTR_FORMAT, > 1658 THREAD, mid)); > 1659 (void)mid->complete_exit(CHECK); > 1660 } > 1661 } > > Took me a while to figure out the expected control flow here. Doesn't > the above simplify to: > > void do_monitor(ObjectMonitor* mid) { > if (mid->owner() == THREAD) { > if (ObjectMonitor::Knob_VerifyMatch != 0) { > Handle obj((oop) mid->object()); > tty->print("INFO: unexpected locked object:"); > javaVFrame::print_locked_object_class_name(tty, obj, "locked"); > fatal(err_msg("exiting JavaThread=" INTPTR_FORMAT > " unexpectedly owns ObjectMonitor=" INTPTR_FORMAT, > THREAD, mid)); > } > (void)mid->complete_exit(CHECK); > } > } > > ? Yes, your version is cleaner. Any particular reason to use "fatal(...)" instead of "guarantee(false, ...)". I've seen both... Dan > > Thanks, > David > >> >> The easiest way to review the delta is to download the two patch >> files and compare them in something like jfilemerge: >> >> http://cr.openjdk.java.net/~dcubed/8130448-webrev/0-jdk9-hs-rt/hotspot.patch >> >> >> http://cr.openjdk.java.net/~dcubed/8130448-webrev/1-jdk9-hs-rt/hotspot.patch >> >> >> >> Testing: >> >> - Aurora Adhoc RT/SVC nightly batches (in process) >> - JPRT test jobs >> >> Thanks, in advance, for any comments, questions or suggestions. >> >> Gory details about the changes are below... >> >> Dan >> >> Changes between CR0 and CR1 are: >> >> src/cpu/x86/vm/macroAssembler_x86.cpp >> >> - fix comment typos, clarify comment wording >> >> src/share/vm/oops/markOop.cpp >> >> - clarify output messages >> - get rid of confusing local variable >> >> src/share/vm/runtime/globals.hpp >> >> - drop VerboseStackTrace, GuaranteeOnMonitorMismatch >> and JavaThreadExitReleasesMonitors options >> - there are no longer changes to this file >> >> src/share/vm/runtime/objectMonitor.cpp >> >> - add ObjectMonitor::Knob_ExitRelease suboption to replace >> JavaThreadExitReleasesMonitors >> - add ObjectMonitor::Knob_VerifyMatch suboption to replace >> GuaranteeOnMonitorMismatch >> - cleanup messy logging: >> - switch from '::printf()' -> 'tty->print_cr()' >> - switch from '::fflush()' -> 'tty->flush()' >> >> src/share/vm/runtime/objectMonitor.hpp >> >> - add ObjectMonitor::Knob_ExitRelease suboption >> - add ObjectMonitor::Knob_VerifyMatch suboption >> - cleanup messy logging >> >> src/share/vm/runtime/synchronizer.cpp >> >> - cleanup messy logging >> - switch from GuaranteeOnMonitorMismatch to >> ObjectMonitor::Knob_VerifyMatch >> - add diagnostic information about the locked object >> when ReleaseJavaMonitorsClosure::do_monitor() finds >> a problem >> >> src/share/vm/runtime/thread.cpp >> >> - clarify comments >> - switch from JavaThreadExitReleasesMonitors to >> ObjectMonitor::Knob_ExitRelease >> >> src/share/vm/runtime/vframe.cpp >> >> - print_locked_object_class_name() is now public >> - clarify comments >> - clarify output messages >> - switch from VerboseStackTrace to the already existing >> ObjectMonitor::Knob_Verbose >> >> src/share/vm/runtime/vframe.hpp >> >> - print_locked_object_class_name() is now public >> >> >> On 7/3/15 6:14 PM, Daniel D. Daugherty wrote: >>> Greetings, >>> >>> The hunt for the following bug: >>> >>> JDK-8077392 Stream fork/join tasks occasionally fail to complete >>> >>> and David C's work on the following bug: >>> >>> JDK-8069412 Locks need better debug-printing support >>> >>> have inspired additional thread dump improvements, comment additions >>> to some Java monitor code and some new diagnostic options. >>> >>> This work is being tracked by the following bug ID: >>> >>> JDK-8130448 8077392 inspired thread dump improvements, comment >>> additions, new diagnostics >>> https://bugs.openjdk.java.net/browse/JDK-8130448 >>> >>> Here is the webrev URL: >>> >>> http://cr.openjdk.java.net/~dcubed/8130448-webrev/0-jdk9-hs-rt/ >>> >>> Testing: >>> >>> - RBT vm.quick batches (in process) >>> - JPRT test jobs >>> >>> Thanks, in advance, for any comments, questions or suggestions. >>> >>> Gory details about the changes are below... >>> >>> Dan >>> >>> 8130448 summary of changes: >>> >>> src/cpu/x86/vm/macroAssembler_x86.cpp >>> - comment additions for the assembly code >>> >>> src/share/vm/oops/markOop.cpp >>> - has_monitor() has to be checked before is_locked() since >>> the has_monitor() bits are a superset of the is_locked() bits >>> - code style fixes >>> >>> src/share/vm/runtime/globals.hpp >>> - add VerboseStackTrace diagnostic option >>> - add GuaranteeOnMonitorMismatch diagnostic option >>> - add JavaThreadExitReleasesMonitors product option; >>> this is the Java equivalent of JNIDetachReleasesMonitors >>> >>> src/share/vm/runtime/objectMonitor.cpp >>> - delete unused ObjectMonitor::try_enter() >>> - fix assert wording >>> >>> src/share/vm/runtime/objectMonitor.hpp >>> - delete unused ObjectMonitor::try_enter() >>> >>> src/share/vm/runtime/synchronizer.cpp >>> - add GuaranteeOnMonitorMismatch support with some >>> diagnostic output >>> >>> src/share/vm/runtime/thread.cpp >>> - add JavaThreadExitReleasesMonitors support >>> >>> src/share/vm/runtime/vframe.cpp >>> - clarify existing comments >>> - add comments to clarify what "waiting on" means >>> - add line to show when we are "waiting on", but >>> there are no locals available (previously we were >>> "waiting on" silently) >>> - add support for "waiting to relock" which can happen >>> for any of the monitors and not just the top monitor >>> - switch mark->print_on() verbose output to new >>> VerboseStackTrace switch; thread dumps are not enabled >>> with a specific switch so the '-XX:+Verbose' model of >>> being a modifier for another option does not fit >>> >>> >> From karen.kinnear at oracle.com Thu Jul 9 13:20:48 2015 From: karen.kinnear at oracle.com (Karen Kinnear) Date: Thu, 9 Jul 2015 09:20:48 -0400 Subject: RFR(S) Contended Locking fast notify bucket (8075171) In-Reply-To: <559E1740.6040007@oracle.com> References: <555A4678.7020308@oracle.com> <559724B0.6000507@oracle.com> <59B99866-C9BB-46F8-87C3-7E6FA8122227@oracle.com> <559D66A7.6040902@oracle.com> <559D9FBB.6020503@oracle.com> <559E1740.6040007@oracle.com> Message-ID: Dan, ship it! thanks, Karen On Jul 9, 2015, at 2:40 AM, David Holmes wrote: > On 9/07/2015 8:10 AM, Daniel D. Daugherty wrote: >> >> On 7/8/15 12:06 PM, Daniel D. Daugherty wrote: >>> On 7/8/15 11:53 AM, Karen Kinnear wrote: >>>> Dan, >>>> >>>> Looks good. >>>> >>>> Only comment is - >>>> >>>> In ObjectMonitor::INotify - lines 1668-1671 >>>> the default value of policy is "2" >>>> -- which basically is "b" not "a" unless the EntryList is empty. >>> >>> Nice catch! For folks on the alias that don't have this code >>> tattooed on the inside of their eyelids. This is the relevant code: >>> >>> src/share/vm/runtime/objectMonitor.cpp: >>> >>> 136 static int Knob_MoveNotifyee = 2; // notify() - >>> disposition of notifyee >>> >>> >>> >>> 1659 void ObjectMonitor::INotify(Thread * Self) { >>> 1660 const int policy = Knob_MoveNotifyee; >>> >>> >>> >>> 1668 // Disposition - what might we do with iterator ? >>> 1669 // a. add it directly to the EntryList - either tail or head. >>> 1670 // b. push it onto the front of the _cxq. >>> 1671 // For now we use (a). >>> >>> >>> >>> 1710 } else if (policy == 2) { // prepend to cxq >>> >>> I will update the comment. >> >> Don't think this update is worth a new webrev so here >> are the diffs instead: >> >> $ diff src/share/vm/runtime/objectMonitor.cpp{.cr1,} >> 1669,1671c1669,1672 >> < // a. add it directly to the EntryList - either tail or head. >> < // b. push it onto the front of the _cxq. >> < // For now we use (a). >> --- >> > // a. add it directly to the EntryList - either tail (policy == 1) >> > // or head (policy == 0). >> > // b. push it onto the front of the _cxq (policy == 2). >> > // For now we use (b). >> >> Thanks again for the catch! > > Yep good catch! > > David > >> Dan >> >> >>> >>> Dan >>> >>> >>>> >>>> thanks, >>>> Karen >>>> >>>> On Jul 3, 2015, at 8:11 PM, Daniel D. Daugherty wrote: >>>> >>>>> Greetings, >>>>> >>>>> I've updated the patch for Contended Locking fast notify bucket >>>>> based on David H's and Karen's comments. >>>>> >>>>> This work is being tracked by the following bug ID: >>>>> >>>>> JDK-8075171 Contended Locking fast notify bucket >>>>> https://bugs.openjdk.java.net/browse/JDK-8075171 >>>>> >>>>> Here is the webrev URL: >>>>> >>>>> http://cr.openjdk.java.net/~dcubed/8075171-webrev/1-jdk9-hs-rt/ >>>>> >>>>> Here is the JEP link: >>>>> >>>>> https://bugs.openjdk.java.net/browse/JDK-8046133 >>>>> >>>>> Testing: >>>>> >>>>> - RBT vm.quick batches (in process) >>>>> - JPRT test jobs >>>>> - MonitorWaitNotifyStresser micro-benchmark (in process) >>>>> - CallTimerGrid stress testing (in process) >>>>> >>>>> >>>>> The changes in this round are in only four of the files: >>>>> >>>>> src/share/vm/opto/runtime.cpp >>>>> >>>>> - deleted comment about hashCode() that belongs in a different bucket >>>>> >>>>> src/share/vm/runtime/objectMonitor.cpp >>>>> >>>>> - add MAX_RECHECK_INTERVAL define for use in ObjectMonitor::EnterI() >>>>> - cleanup recheck interval code >>>>> - ObjectMonitor::INotify() return type is now "void" >>>>> - delete duplicate comments, clarify/rewrite some comments >>>>> >>>>> src/share/vm/runtime/objectMonitor.hpp >>>>> >>>>> - ObjectMonitor::INotify() return type is now "void" >>>>> >>>>> src/share/vm/runtime/synchronizer.cpp >>>>> >>>>> - clarify/rewrite comments, add additional comments >>>>> - cleanup variables in ObjectSynchronizer::quick_notify >>>>> - refactor loop to be more clear >>>>> - delete unused enum MaximumRecheckInterval >>>>> >>>>> The easiest way to review the delta is to download the two patch >>>>> files and compare them in something like jfilemerge: >>>>> >>>>> http://cr.openjdk.java.net/~dcubed/8075171-webrev/0-jdk9-hs-rt/hotspot.patch >>>>> >>>>> http://cr.openjdk.java.net/~dcubed/8075171-webrev/1-jdk9-hs-rt/hotspot.patch >>>>> >>>>> >>>>> Dan >>>>> >>>>> >>>>> On 5/18/15 2:07 PM, Daniel D. Daugherty wrote: >>>>>> Greetings, >>>>>> >>>>>> I have the Contended Locking fast notify bucket ready for review. >>>>>> >>>>>> The code changes in this bucket are the final piece in the triad >>>>>> of {fast-enter, fast-exit, fast-notify} changes. There are no >>>>>> macro assembler changes in this bucket (yeah!), but there are >>>>>> code review cleanups motivated by comments on other buckets, e.g., >>>>>> changing variables like 'Tally' -> 'tally'. >>>>>> >>>>>> This work is being tracked by the following bug ID: >>>>>> >>>>>> JDK-8075171 Contended Locking fast notify bucket >>>>>> https://bugs.openjdk.java.net/browse/JDK-8075171 >>>>>> >>>>>> Here is the webrev URL: >>>>>> >>>>>> http://cr.openjdk.java.net/~dcubed/8075171-webrev/0-jdk9-hs-rt/ >>>>>> >>>>>> Here is the JEP link: >>>>>> >>>>>> https://bugs.openjdk.java.net/browse/JDK-8046133 >>>>>> >>>>>> Testing: >>>>>> >>>>>> - Aurora Adhoc RT/SVC baseline batch >>>>>> - JPRT test jobs >>>>>> - MonitorWaitNotifyStresser micro-benchmark (in process) >>>>>> - CallTimerGrid stress testing (in process) >>>>>> - Aurora performance testing: >>>>>> - out of the box for the "promotion" and 32-bit server configs >>>>>> - heavy weight monitors for the "promotion" and 32-bit server >>>>>> configs >>>>>> (-XX:-UseBiasedLocking -XX:+UseHeavyMonitors) >>>>>> (in process) >>>>>> >>>>>> The hang somehow introduced by the "fast enter" bucket is still >>>>>> unresolved, but progress is being made. That work is being tracked >>>>>> by the following bug: >>>>>> >>>>>> JDK-8077392 Stream fork/join tasks occasionally fail to complete >>>>>> https://bugs.openjdk.java.net/browse/JDK-8077392 >>>>>> >>>>>> You'll see a change that re-enables the "fast enter" bucket in this >>>>>> webrev, but that change will not be pushed when we're done with the >>>>>> review of this bucket unless JDK-8077392 is resolved. >>>>>> >>>>>> Thanks, in advance, for any comments, questions or suggestions. >>>>>> >>>>>> Gory details about the changes are below... >>>>>> >>>>>> Dan >>>>>> >>>>>> >>>>>> 8075171 summary of changes: >>>>>> >>>>>> src/share/vm/classfile/vmSymbols.hpp >>>>>> - Add do_intrinsic() entries for _notify and _notifyAll >>>>>> >>>>>> src/share/vm/opto/library_call.cpp >>>>>> - Add optional inline_notify() that is controlled by new >>>>>> '-XX:[+-]InlineNotify' option >>>>>> >>>>>> src/share/vm/opto/runtime.cpp >>>>>> src/share/vm/opto/runtime.hpp >>>>>> - Add OptoRuntime::monitor_notify_C() and >>>>>> OptoRuntime::monitor_notifyAll_C() functions to support >>>>>> the new "fast notify" code paths >>>>>> - Add new OptoRuntime::monitor_notify_Type() to support >>>>>> the above two new functions >>>>>> >>>>>> src/share/vm/runtime/globals.hpp >>>>>> - Add '-XX:[+-]InlineNotify' option; default option value is >>>>>> enabled (true) >>>>>> >>>>>> src/share/vm/runtime/objectMonitor.cpp >>>>>> src/share/vm/runtime/objectMonitor.hpp >>>>>> - Refactor ObjectMonitor::notify() and ObjectMonitor::notifyAll() >>>>>> into wrappers that call the new ObjectMonitor::INotify() >>>>>> - Add new ObjectMonitor::INotify() to reduce code duplication >>>>>> between "notify" and "notifyAll" code paths >>>>>> >>>>>> src/share/vm/runtime/sharedRuntime.cpp >>>>>> - Temporarily re-enable the "fast enter" optimization in order >>>>>> to do performance testing. JDK-8077392 is still unresolved, >>>>>> but progress is being made. >>>>>> >>>>>> src/share/vm/runtime/synchronizer.cpp >>>>>> src/share/vm/runtime/synchronizer.hpp >>>>>> - Add ObjectSynchronizer::quick_notify() that implements the >>>>>> new "fast notify" code paths >>>>>> - The new code handles a couple of special cases where the >>>>>> "notify" can be done without the heavy weight slow-path >>>>>> (thread state transitions and other baggage) >>>>>> >>>>>> >>> >>> >>> >> From daniel.daugherty at oracle.com Thu Jul 9 13:23:18 2015 From: daniel.daugherty at oracle.com (Daniel D. Daugherty) Date: Thu, 09 Jul 2015 07:23:18 -0600 Subject: RFR(S) Contended Locking fast notify bucket (8075171) In-Reply-To: References: <555A4678.7020308@oracle.com> <559724B0.6000507@oracle.com> <59B99866-C9BB-46F8-87C3-7E6FA8122227@oracle.com> <559D66A7.6040902@oracle.com> <559D9FBB.6020503@oracle.com> <559E1740.6040007@oracle.com> Message-ID: <559E75C6.2030107@oracle.com> Thanks for closing the loop on this one. Dan On 7/9/15 7:20 AM, Karen Kinnear wrote: > Dan, > > ship it! > > thanks, > Karen > > On Jul 9, 2015, at 2:40 AM, David Holmes wrote: > >> On 9/07/2015 8:10 AM, Daniel D. Daugherty wrote: >>> On 7/8/15 12:06 PM, Daniel D. Daugherty wrote: >>>> On 7/8/15 11:53 AM, Karen Kinnear wrote: >>>>> Dan, >>>>> >>>>> Looks good. >>>>> >>>>> Only comment is - >>>>> >>>>> In ObjectMonitor::INotify - lines 1668-1671 >>>>> the default value of policy is "2" >>>>> -- which basically is "b" not "a" unless the EntryList is empty. >>>> Nice catch! For folks on the alias that don't have this code >>>> tattooed on the inside of their eyelids. This is the relevant code: >>>> >>>> src/share/vm/runtime/objectMonitor.cpp: >>>> >>>> 136 static int Knob_MoveNotifyee = 2; // notify() - >>>> disposition of notifyee >>>> >>>> >>>> >>>> 1659 void ObjectMonitor::INotify(Thread * Self) { >>>> 1660 const int policy = Knob_MoveNotifyee; >>>> >>>> >>>> >>>> 1668 // Disposition - what might we do with iterator ? >>>> 1669 // a. add it directly to the EntryList - either tail or head. >>>> 1670 // b. push it onto the front of the _cxq. >>>> 1671 // For now we use (a). >>>> >>>> >>>> >>>> 1710 } else if (policy == 2) { // prepend to cxq >>>> >>>> I will update the comment. >>> Don't think this update is worth a new webrev so here >>> are the diffs instead: >>> >>> $ diff src/share/vm/runtime/objectMonitor.cpp{.cr1,} >>> 1669,1671c1669,1672 >>> < // a. add it directly to the EntryList - either tail or head. >>> < // b. push it onto the front of the _cxq. >>> < // For now we use (a). >>> --- >>>> // a. add it directly to the EntryList - either tail (policy == 1) >>>> // or head (policy == 0). >>>> // b. push it onto the front of the _cxq (policy == 2). >>>> // For now we use (b). >>> Thanks again for the catch! >> Yep good catch! >> >> David >> >>> Dan >>> >>> >>>> Dan >>>> >>>> >>>>> thanks, >>>>> Karen >>>>> >>>>> On Jul 3, 2015, at 8:11 PM, Daniel D. Daugherty wrote: >>>>> >>>>>> Greetings, >>>>>> >>>>>> I've updated the patch for Contended Locking fast notify bucket >>>>>> based on David H's and Karen's comments. >>>>>> >>>>>> This work is being tracked by the following bug ID: >>>>>> >>>>>> JDK-8075171 Contended Locking fast notify bucket >>>>>> https://bugs.openjdk.java.net/browse/JDK-8075171 >>>>>> >>>>>> Here is the webrev URL: >>>>>> >>>>>> http://cr.openjdk.java.net/~dcubed/8075171-webrev/1-jdk9-hs-rt/ >>>>>> >>>>>> Here is the JEP link: >>>>>> >>>>>> https://bugs.openjdk.java.net/browse/JDK-8046133 >>>>>> >>>>>> Testing: >>>>>> >>>>>> - RBT vm.quick batches (in process) >>>>>> - JPRT test jobs >>>>>> - MonitorWaitNotifyStresser micro-benchmark (in process) >>>>>> - CallTimerGrid stress testing (in process) >>>>>> >>>>>> >>>>>> The changes in this round are in only four of the files: >>>>>> >>>>>> src/share/vm/opto/runtime.cpp >>>>>> >>>>>> - deleted comment about hashCode() that belongs in a different bucket >>>>>> >>>>>> src/share/vm/runtime/objectMonitor.cpp >>>>>> >>>>>> - add MAX_RECHECK_INTERVAL define for use in ObjectMonitor::EnterI() >>>>>> - cleanup recheck interval code >>>>>> - ObjectMonitor::INotify() return type is now "void" >>>>>> - delete duplicate comments, clarify/rewrite some comments >>>>>> >>>>>> src/share/vm/runtime/objectMonitor.hpp >>>>>> >>>>>> - ObjectMonitor::INotify() return type is now "void" >>>>>> >>>>>> src/share/vm/runtime/synchronizer.cpp >>>>>> >>>>>> - clarify/rewrite comments, add additional comments >>>>>> - cleanup variables in ObjectSynchronizer::quick_notify >>>>>> - refactor loop to be more clear >>>>>> - delete unused enum MaximumRecheckInterval >>>>>> >>>>>> The easiest way to review the delta is to download the two patch >>>>>> files and compare them in something like jfilemerge: >>>>>> >>>>>> http://cr.openjdk.java.net/~dcubed/8075171-webrev/0-jdk9-hs-rt/hotspot.patch >>>>>> >>>>>> http://cr.openjdk.java.net/~dcubed/8075171-webrev/1-jdk9-hs-rt/hotspot.patch >>>>>> >>>>>> >>>>>> Dan >>>>>> >>>>>> >>>>>> On 5/18/15 2:07 PM, Daniel D. Daugherty wrote: >>>>>>> Greetings, >>>>>>> >>>>>>> I have the Contended Locking fast notify bucket ready for review. >>>>>>> >>>>>>> The code changes in this bucket are the final piece in the triad >>>>>>> of {fast-enter, fast-exit, fast-notify} changes. There are no >>>>>>> macro assembler changes in this bucket (yeah!), but there are >>>>>>> code review cleanups motivated by comments on other buckets, e.g., >>>>>>> changing variables like 'Tally' -> 'tally'. >>>>>>> >>>>>>> This work is being tracked by the following bug ID: >>>>>>> >>>>>>> JDK-8075171 Contended Locking fast notify bucket >>>>>>> https://bugs.openjdk.java.net/browse/JDK-8075171 >>>>>>> >>>>>>> Here is the webrev URL: >>>>>>> >>>>>>> http://cr.openjdk.java.net/~dcubed/8075171-webrev/0-jdk9-hs-rt/ >>>>>>> >>>>>>> Here is the JEP link: >>>>>>> >>>>>>> https://bugs.openjdk.java.net/browse/JDK-8046133 >>>>>>> >>>>>>> Testing: >>>>>>> >>>>>>> - Aurora Adhoc RT/SVC baseline batch >>>>>>> - JPRT test jobs >>>>>>> - MonitorWaitNotifyStresser micro-benchmark (in process) >>>>>>> - CallTimerGrid stress testing (in process) >>>>>>> - Aurora performance testing: >>>>>>> - out of the box for the "promotion" and 32-bit server configs >>>>>>> - heavy weight monitors for the "promotion" and 32-bit server >>>>>>> configs >>>>>>> (-XX:-UseBiasedLocking -XX:+UseHeavyMonitors) >>>>>>> (in process) >>>>>>> >>>>>>> The hang somehow introduced by the "fast enter" bucket is still >>>>>>> unresolved, but progress is being made. That work is being tracked >>>>>>> by the following bug: >>>>>>> >>>>>>> JDK-8077392 Stream fork/join tasks occasionally fail to complete >>>>>>> https://bugs.openjdk.java.net/browse/JDK-8077392 >>>>>>> >>>>>>> You'll see a change that re-enables the "fast enter" bucket in this >>>>>>> webrev, but that change will not be pushed when we're done with the >>>>>>> review of this bucket unless JDK-8077392 is resolved. >>>>>>> >>>>>>> Thanks, in advance, for any comments, questions or suggestions. >>>>>>> >>>>>>> Gory details about the changes are below... >>>>>>> >>>>>>> Dan >>>>>>> >>>>>>> >>>>>>> 8075171 summary of changes: >>>>>>> >>>>>>> src/share/vm/classfile/vmSymbols.hpp >>>>>>> - Add do_intrinsic() entries for _notify and _notifyAll >>>>>>> >>>>>>> src/share/vm/opto/library_call.cpp >>>>>>> - Add optional inline_notify() that is controlled by new >>>>>>> '-XX:[+-]InlineNotify' option >>>>>>> >>>>>>> src/share/vm/opto/runtime.cpp >>>>>>> src/share/vm/opto/runtime.hpp >>>>>>> - Add OptoRuntime::monitor_notify_C() and >>>>>>> OptoRuntime::monitor_notifyAll_C() functions to support >>>>>>> the new "fast notify" code paths >>>>>>> - Add new OptoRuntime::monitor_notify_Type() to support >>>>>>> the above two new functions >>>>>>> >>>>>>> src/share/vm/runtime/globals.hpp >>>>>>> - Add '-XX:[+-]InlineNotify' option; default option value is >>>>>>> enabled (true) >>>>>>> >>>>>>> src/share/vm/runtime/objectMonitor.cpp >>>>>>> src/share/vm/runtime/objectMonitor.hpp >>>>>>> - Refactor ObjectMonitor::notify() and ObjectMonitor::notifyAll() >>>>>>> into wrappers that call the new ObjectMonitor::INotify() >>>>>>> - Add new ObjectMonitor::INotify() to reduce code duplication >>>>>>> between "notify" and "notifyAll" code paths >>>>>>> >>>>>>> src/share/vm/runtime/sharedRuntime.cpp >>>>>>> - Temporarily re-enable the "fast enter" optimization in order >>>>>>> to do performance testing. JDK-8077392 is still unresolved, >>>>>>> but progress is being made. >>>>>>> >>>>>>> src/share/vm/runtime/synchronizer.cpp >>>>>>> src/share/vm/runtime/synchronizer.hpp >>>>>>> - Add ObjectSynchronizer::quick_notify() that implements the >>>>>>> new "fast notify" code paths >>>>>>> - The new code handles a couple of special cases where the >>>>>>> "notify" can be done without the heavy weight slow-path >>>>>>> (thread state transitions and other baggage) >>>>>>> >>>>>>> >>>> >>>> > > From daniel.daugherty at oracle.com Thu Jul 9 13:32:33 2015 From: daniel.daugherty at oracle.com (Daniel D. Daugherty) Date: Thu, 09 Jul 2015 07:32:33 -0600 Subject: RFR: 8130728: Disable WorkAroundNPTLTimedWaitHang by default In-Reply-To: <559E3E8F.9020300@oracle.com> References: <559E3E8F.9020300@oracle.com> Message-ID: <559E77F1.4090408@oracle.com> > http://cr.openjdk.java.net/~dholmes/8130728/webrev/ src/share/vm/runtime/globals.hpp No comments. Thumbs up. Time to see what shakes out with this option turned off. The BSD/MacOS X blame belongs to me. Our thinking at the time was to keep the "bsd" files matching the "linux" version unless we had a specific reason for changing the code. Of course, we thought we would come back later and clean things up... which just didn't happen... I don't know the AIX history. Dan On 7/9/15 3:27 AM, David Holmes wrote: > https://bugs.openjdk.java.net/browse/JDK-8130728 > > The workaround triggered by WorkAroundNPTLTimedWaitHang (an > experimental flag set to 1 by default) was to alleviate a hang that > could occur on a pthread_cond_timedwait on Linux, if the timeout value > was a time in the past - see JDK-6314875. This glibc bug was fixed in > 2005 in glibc 2.3.5-3 > > https://lists.debian.org/debian-glibc/2005/08/msg00201.html > > but the workaround persists and was (unfortunately) copied into the > BSD and AIX ports. > > It is time to remove that workaround but before we can do that we need > to be sure that we are not in fact hitting the workaround code. To > that end I propose to use this bug to switch the flag's value to 0 to > verify correct operation. > > If that goes well then we can remove the code either later in JDK 9 or > early in JDK 10. > > To be clear the flag impacts both the wait and the signal part of the > condvar usage (park and unpark). On the wait side we have: > > status = pthread_cond_timedwait(_cond, _mutex, &abst); > if (status != 0 && WorkAroundNPTLTimedWaitHang) { > pthread_cond_destroy(_cond); > pthread_cond_init(_cond, os::Linux::condAttr()); > } > > so we will now skip this potential recovery code. > > On the signal side we signal while holding the mutex if the workaround > is enabled, and we signal after dropping the mutex otherwise. So this > code will now be using a new path. Here is the code in > PlatformEvent::unpark > > assert(AnyWaiters == 0 || AnyWaiters == 1, "invariant"); > if (AnyWaiters != 0 && WorkAroundNPTLTimedWaitHang) { > AnyWaiters = 0; > pthread_cond_signal(_cond); > } > status = pthread_mutex_unlock(_mutex); > assert_status(status == 0, status, "mutex_unlock"); > if (AnyWaiters != 0) { > // Note that we signal() *after* dropping the lock for "immortal" > Events. > // This is safe and avoids a common class of futile wakeups. In rare > // circumstances this can cause a thread to return prematurely from > // cond_{timed}wait() but the spurious wakeup is benign and the > victim > // will simply re-test the condition and re-park itself. > // This provides particular benefit if the underlying platform > does not > // provide wait morphing. > status = pthread_cond_signal(_cond); > assert_status(status == 0, status, "cond_signal"); > } > > and similarly in Parker::unpark > > if (WorkAroundNPTLTimedWaitHang) { > status = pthread_cond_signal(&_cond[_cur_index]); > assert(status == 0, "invariant"); > status = pthread_mutex_unlock(_mutex); > assert(status == 0, "invariant"); > } else { > status = pthread_mutex_unlock(_mutex); > assert(status == 0, "invariant"); > status = pthread_cond_signal(&_cond[_cur_index]); > assert(status == 0, "invariant"); > } > > This may cause performance perturbations that will need to be > investigated - but in theory, as per the comment above, signalling > outside the lock should be beneficial in the linux case because there > is no wait-morphing (where a signal simply takes a waiting thread and > places it into the mutex queue thereby avoiding the need to awaken the > thread so it can enqueue itself). > > The change itself is of course trivial: > > http://cr.openjdk.java.net/~dholmes/8130728/webrev/ > > I'd appreciate any comments/concerns particularly from the BSD and AIX > folk who acquired this unnecessary workaround. > > If deemed necessary we could add a flag that controls whether the > signal happens with or without the lock held. > > Thanks, > David From karen.kinnear at oracle.com Thu Jul 9 13:42:30 2015 From: karen.kinnear at oracle.com (Karen Kinnear) Date: Thu, 9 Jul 2015 09:42:30 -0400 Subject: RFR(XS) 8130669: VM prohibits methods with return values In-Reply-To: <559D8F1A.1000803@oracle.com> References: <559D2666.5010209@oracle.com> <559D7E0C.6030102@oracle.com> <559D8345.5060709@oracle.com> <559D8F1A.1000803@oracle.com> Message-ID: <1E6AA085-9F7D-4A6A-87CA-A29D990F885A@oracle.com> Looks good. Actually that is easier to read. thanks, Karen On Jul 8, 2015, at 4:59 PM, Ioi Lam wrote: > Looks good to me. Thanks > - Ioi > > On 7/8/15 1:08 PM, harold seigel wrote: >> Hi Ioi, >> >> Here's an updated webrev with ignoredClinit as a .jasm file. Please let me know if it looks okay. >> >> http://cr.openjdk.java.net/~hseigel/bug_8130669.1/ >> >> Thanks, Harold >> >> On 7/8/2015 3:46 PM, Ioi Lam wrote: >>> Hi Harold, >>> >>> Is there any reason why the ignoredClinit needs to be written in a jcod file and not a jasm file? jasm files would be a lot easier to read and maintain than jcod. >>> >>> Thanks >>> - Ioi >>> >>> On 7/8/15 6:32 AM, harold seigel wrote: >>>> Hi, >>>> >>>> Please review this small change to fix bug JDK-8130669. The JVM incorrectly throws ClassFormatError exceptions for non-void methods named . But, the JVM Spec 8 says that such methods should be ignored. See http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-2.html#jvms-2.9 for details. >>>> >>>> The fix changes the JVM to, in this case, only throw ClassFormatError exceptions for non-void methods. >>>> >>>> Open Webrev: http://cr.openjdk.java.net/~hseigel/bug_8130669/ >>>> >>>> JBS Bug: https://bugs.openjdk.java.net/browse/JDK-8130669 >>>> >>>> The fix was tested with JCK Lang and VM tests, the UTE quick and split_verifier tests, and the hotspot, java/io, java/lang, and java/util JTreg tests. >>>> >>>> Thanks, Harold >>> >> > From daniel.daugherty at oracle.com Thu Jul 9 13:55:38 2015 From: daniel.daugherty at oracle.com (Daniel D. Daugherty) Date: Thu, 09 Jul 2015 07:55:38 -0600 Subject: RFR(S) 8130448: thread dump improvements, comment, additions, new diagnostics inspired by 8077392 In-Reply-To: <559E7259.1070605@oracle.com> References: <55972558.6060905@oracle.com> <559D970E.7000905@oracle.com> <559E1611.2070803@oracle.com> <559E7259.1070605@oracle.com> Message-ID: <559E7D5A.2040900@oracle.com> > Any particular reason to use "fatal(...)" instead of > "guarantee(false, ...)". I've seen both... Answering my own question... :-) fatal() and guarantee() both reach the same place (report_vm_error()) with the same bells-and-whistles on the way... So "guarantee(false, ...)" is the same as "fatal(...)" so I'll switch to the more direct "fatal(...)". I don't think that change requires a re-review, please let me know if you disagree... Dan On 7/9/15 7:08 AM, Daniel D. Daugherty wrote: > David, > > Thanks for the quick re-review! > > Responses embedded below... > > On 7/9/15 12:34 AM, David Holmes wrote: >> Hi Dan, >> >> On 9/07/2015 7:33 AM, Daniel D. Daugherty wrote: >>> Greetings, >>> >>> I've updated this patch based on David H's comments along with >>> some additional cleanup. >> >> So to address the high-level changes: >> >> - Use ObjectMonitor::Knob_Verbose as the verbosity flag for printing >> the lockbits in the stack dump. Okay - though I do wonder why the >> SyncVerbose flag also exists? > > I'll ping Dice to see if there's a reason for two different verbose > flags in the monitor subsystem. I have to admit that I didn't notice > that one in the large collection of knobs and switches... :-( > > >> - Use ObjectMonitor::Knob_ExitRelease to control whether Java threads >> are checked for locked monitors when they exit >> - Use ObjectMonitor::Knob_VerifyMatch to control whether finding a >> locked (hence unmatched) monitor causes an abort >> >> That seems like a good way to work within the existing mechanism for >> customizing the sync logic - and no new global options (though SQE >> will still need tests for using these knobs I think). > > Glad that this version is more acceptable. > > >> Some specific comments below ... >> >>> This work is being tracked by the following bug ID: >>> >>> JDK-8130448 8077392 inspired thread dump improvements, comment >>> additions, new diagnostics >>> https://bugs.openjdk.java.net/browse/JDK-8130448 >>> >>> Here is the webrev URL: >>> >>> http://cr.openjdk.java.net/~dcubed/8130448-webrev/1-jdk9-hs-rt/ >> >> src/share/vm/runtime/objectMonitor.cpp >> >> 2393 if (Knob_ReportSettings && v != NULL) { >> 2394 tty->print_cr("INFO: SyncKnob: %s %d(%d)", Key, rslt, >> Default) ; >> 2395 tty->flush(); >> 2396 } >> >> I suspect these were not tty using because this might get called >> before the tty has been initialized - but I can't see how that might >> arise (nor can I be certain it can't). > > I couldn't see how tty could not be initialized at these points either. > My current plan is to go with this change to 'tty' and if we run into > an early use case, then we do something else _and_ comment it. > > Although with unified logging coming... this may be moot (but the > tty version will be easier to port...) > > >> >> Ditto for similar changes throughout. >> >> --- >> >> src/share/vm/runtime/synchronizer.cpp >> >> 1648 void do_monitor(ObjectMonitor* mid) { >> 1649 if (mid->owner() == THREAD) { >> 1650 if (ObjectMonitor::Knob_VerifyMatch != 0) { >> 1651 Handle obj((oop) mid->object()); >> 1652 tty->print("INFO: unexpected locked object:"); >> 1653 javaVFrame::print_locked_object_class_name(tty, obj, >> "locked"); >> 1654 } >> 1655 guarantee(ObjectMonitor::Knob_VerifyMatch == 0, >> 1656 err_msg("exiting JavaThread=" INTPTR_FORMAT >> 1657 " unexpectedly owns ObjectMonitor=" >> INTPTR_FORMAT, >> 1658 THREAD, mid)); >> 1659 (void)mid->complete_exit(CHECK); >> 1660 } >> 1661 } >> >> Took me a while to figure out the expected control flow here. Doesn't >> the above simplify to: >> >> void do_monitor(ObjectMonitor* mid) { >> if (mid->owner() == THREAD) { >> if (ObjectMonitor::Knob_VerifyMatch != 0) { >> Handle obj((oop) mid->object()); >> tty->print("INFO: unexpected locked object:"); >> javaVFrame::print_locked_object_class_name(tty, obj, "locked"); >> fatal(err_msg("exiting JavaThread=" INTPTR_FORMAT >> " unexpectedly owns ObjectMonitor=" INTPTR_FORMAT, >> THREAD, mid)); >> } >> (void)mid->complete_exit(CHECK); >> } >> } >> >> ? > > Yes, your version is cleaner. > > Any particular reason to use "fatal(...)" instead of > "guarantee(false, ...)". I've seen both... > > Dan > > >> >> Thanks, >> David >> >>> >>> The easiest way to review the delta is to download the two patch >>> files and compare them in something like jfilemerge: >>> >>> http://cr.openjdk.java.net/~dcubed/8130448-webrev/0-jdk9-hs-rt/hotspot.patch >>> >>> >>> http://cr.openjdk.java.net/~dcubed/8130448-webrev/1-jdk9-hs-rt/hotspot.patch >>> >>> >>> >>> Testing: >>> >>> - Aurora Adhoc RT/SVC nightly batches (in process) >>> - JPRT test jobs >>> >>> Thanks, in advance, for any comments, questions or suggestions. >>> >>> Gory details about the changes are below... >>> >>> Dan >>> >>> Changes between CR0 and CR1 are: >>> >>> src/cpu/x86/vm/macroAssembler_x86.cpp >>> >>> - fix comment typos, clarify comment wording >>> >>> src/share/vm/oops/markOop.cpp >>> >>> - clarify output messages >>> - get rid of confusing local variable >>> >>> src/share/vm/runtime/globals.hpp >>> >>> - drop VerboseStackTrace, GuaranteeOnMonitorMismatch >>> and JavaThreadExitReleasesMonitors options >>> - there are no longer changes to this file >>> >>> src/share/vm/runtime/objectMonitor.cpp >>> >>> - add ObjectMonitor::Knob_ExitRelease suboption to replace >>> JavaThreadExitReleasesMonitors >>> - add ObjectMonitor::Knob_VerifyMatch suboption to replace >>> GuaranteeOnMonitorMismatch >>> - cleanup messy logging: >>> - switch from '::printf()' -> 'tty->print_cr()' >>> - switch from '::fflush()' -> 'tty->flush()' >>> >>> src/share/vm/runtime/objectMonitor.hpp >>> >>> - add ObjectMonitor::Knob_ExitRelease suboption >>> - add ObjectMonitor::Knob_VerifyMatch suboption >>> - cleanup messy logging >>> >>> src/share/vm/runtime/synchronizer.cpp >>> >>> - cleanup messy logging >>> - switch from GuaranteeOnMonitorMismatch to >>> ObjectMonitor::Knob_VerifyMatch >>> - add diagnostic information about the locked object >>> when ReleaseJavaMonitorsClosure::do_monitor() finds >>> a problem >>> >>> src/share/vm/runtime/thread.cpp >>> >>> - clarify comments >>> - switch from JavaThreadExitReleasesMonitors to >>> ObjectMonitor::Knob_ExitRelease >>> >>> src/share/vm/runtime/vframe.cpp >>> >>> - print_locked_object_class_name() is now public >>> - clarify comments >>> - clarify output messages >>> - switch from VerboseStackTrace to the already existing >>> ObjectMonitor::Knob_Verbose >>> >>> src/share/vm/runtime/vframe.hpp >>> >>> - print_locked_object_class_name() is now public >>> >>> >>> On 7/3/15 6:14 PM, Daniel D. Daugherty wrote: >>>> Greetings, >>>> >>>> The hunt for the following bug: >>>> >>>> JDK-8077392 Stream fork/join tasks occasionally fail to complete >>>> >>>> and David C's work on the following bug: >>>> >>>> JDK-8069412 Locks need better debug-printing support >>>> >>>> have inspired additional thread dump improvements, comment additions >>>> to some Java monitor code and some new diagnostic options. >>>> >>>> This work is being tracked by the following bug ID: >>>> >>>> JDK-8130448 8077392 inspired thread dump improvements, comment >>>> additions, new diagnostics >>>> https://bugs.openjdk.java.net/browse/JDK-8130448 >>>> >>>> Here is the webrev URL: >>>> >>>> http://cr.openjdk.java.net/~dcubed/8130448-webrev/0-jdk9-hs-rt/ >>>> >>>> Testing: >>>> >>>> - RBT vm.quick batches (in process) >>>> - JPRT test jobs >>>> >>>> Thanks, in advance, for any comments, questions or suggestions. >>>> >>>> Gory details about the changes are below... >>>> >>>> Dan >>>> >>>> 8130448 summary of changes: >>>> >>>> src/cpu/x86/vm/macroAssembler_x86.cpp >>>> - comment additions for the assembly code >>>> >>>> src/share/vm/oops/markOop.cpp >>>> - has_monitor() has to be checked before is_locked() since >>>> the has_monitor() bits are a superset of the is_locked() bits >>>> - code style fixes >>>> >>>> src/share/vm/runtime/globals.hpp >>>> - add VerboseStackTrace diagnostic option >>>> - add GuaranteeOnMonitorMismatch diagnostic option >>>> - add JavaThreadExitReleasesMonitors product option; >>>> this is the Java equivalent of JNIDetachReleasesMonitors >>>> >>>> src/share/vm/runtime/objectMonitor.cpp >>>> - delete unused ObjectMonitor::try_enter() >>>> - fix assert wording >>>> >>>> src/share/vm/runtime/objectMonitor.hpp >>>> - delete unused ObjectMonitor::try_enter() >>>> >>>> src/share/vm/runtime/synchronizer.cpp >>>> - add GuaranteeOnMonitorMismatch support with some >>>> diagnostic output >>>> >>>> src/share/vm/runtime/thread.cpp >>>> - add JavaThreadExitReleasesMonitors support >>>> >>>> src/share/vm/runtime/vframe.cpp >>>> - clarify existing comments >>>> - add comments to clarify what "waiting on" means >>>> - add line to show when we are "waiting on", but >>>> there are no locals available (previously we were >>>> "waiting on" silently) >>>> - add support for "waiting to relock" which can happen >>>> for any of the monitors and not just the top monitor >>>> - switch mark->print_on() verbose output to new >>>> VerboseStackTrace switch; thread dumps are not enabled >>>> with a specific switch so the '-XX:+Verbose' model of >>>> being a modifier for another option does not fit >>>> >>>> >>> > > From daniel.daugherty at oracle.com Thu Jul 9 14:11:28 2015 From: daniel.daugherty at oracle.com (Daniel D. Daugherty) Date: Thu, 09 Jul 2015 08:11:28 -0600 Subject: RFR(S) 8130448: thread dump improvements, comment, additions, new diagnostics inspired by 8077392 In-Reply-To: <559E7D5A.2040900@oracle.com> References: <55972558.6060905@oracle.com> <559D970E.7000905@oracle.com> <559E1611.2070803@oracle.com> <559E7259.1070605@oracle.com> <559E7D5A.2040900@oracle.com> Message-ID: <559E8110.40706@oracle.com> On 7/9/15 7:55 AM, Daniel D. Daugherty wrote: > > Any particular reason to use "fatal(...)" instead of > > "guarantee(false, ...)". I've seen both... > > Answering my own question... :-) > > fatal() and guarantee() both reach the same place (report_vm_error()) > with the same bells-and-whistles on the way... > > So "guarantee(false, ...)" is the same as "fatal(...)" > so I'll switch to the more direct "fatal(...)". > > I don't think that change requires a re-review, please let me know > if you disagree... Sigh... I meant "webrev"... Here's the diffs: $ diff -c src/share/vm/runtime/synchronizer.cpp{.cr1,} *** src/share/vm/runtime/synchronizer.cpp.cr1 Wed Jul 8 07:15:07 2015 --- src/share/vm/runtime/synchronizer.cpp Thu Jul 9 07:07:28 2015 *************** *** 1651,1661 **** Handle obj((oop) mid->object()); tty->print("INFO: unexpected locked object:"); javaVFrame::print_locked_object_class_name(tty, obj, "locked"); } - guarantee(ObjectMonitor::Knob_VerifyMatch == 0, - err_msg("exiting JavaThread=" INTPTR_FORMAT - " unexpectedly owns ObjectMonitor=" INTPTR_FORMAT, - THREAD, mid)); (void)mid->complete_exit(CHECK); } } --- 1651,1660 ---- Handle obj((oop) mid->object()); tty->print("INFO: unexpected locked object:"); javaVFrame::print_locked_object_class_name(tty, obj, "locked"); + fatal(err_msg("exiting JavaThread=" INTPTR_FORMAT + " unexpectedly owns ObjectMonitor=" INTPTR_FORMAT, + THREAD, mid)); } (void)mid->complete_exit(CHECK); } } Dan > > Dan > > > On 7/9/15 7:08 AM, Daniel D. Daugherty wrote: >> David, >> >> Thanks for the quick re-review! >> >> Responses embedded below... >> >> On 7/9/15 12:34 AM, David Holmes wrote: >>> Hi Dan, >>> >>> On 9/07/2015 7:33 AM, Daniel D. Daugherty wrote: >>>> Greetings, >>>> >>>> I've updated this patch based on David H's comments along with >>>> some additional cleanup. >>> >>> So to address the high-level changes: >>> >>> - Use ObjectMonitor::Knob_Verbose as the verbosity flag for printing >>> the lockbits in the stack dump. Okay - though I do wonder why the >>> SyncVerbose flag also exists? >> >> I'll ping Dice to see if there's a reason for two different verbose >> flags in the monitor subsystem. I have to admit that I didn't notice >> that one in the large collection of knobs and switches... :-( >> >> >>> - Use ObjectMonitor::Knob_ExitRelease to control whether Java >>> threads are checked for locked monitors when they exit >>> - Use ObjectMonitor::Knob_VerifyMatch to control whether finding a >>> locked (hence unmatched) monitor causes an abort >>> >>> That seems like a good way to work within the existing mechanism for >>> customizing the sync logic - and no new global options (though SQE >>> will still need tests for using these knobs I think). >> >> Glad that this version is more acceptable. >> >> >>> Some specific comments below ... >>> >>>> This work is being tracked by the following bug ID: >>>> >>>> JDK-8130448 8077392 inspired thread dump improvements, comment >>>> additions, new diagnostics >>>> https://bugs.openjdk.java.net/browse/JDK-8130448 >>>> >>>> Here is the webrev URL: >>>> >>>> http://cr.openjdk.java.net/~dcubed/8130448-webrev/1-jdk9-hs-rt/ >>> >>> src/share/vm/runtime/objectMonitor.cpp >>> >>> 2393 if (Knob_ReportSettings && v != NULL) { >>> 2394 tty->print_cr("INFO: SyncKnob: %s %d(%d)", Key, rslt, >>> Default) ; >>> 2395 tty->flush(); >>> 2396 } >>> >>> I suspect these were not tty using because this might get called >>> before the tty has been initialized - but I can't see how that might >>> arise (nor can I be certain it can't). >> >> I couldn't see how tty could not be initialized at these points either. >> My current plan is to go with this change to 'tty' and if we run into >> an early use case, then we do something else _and_ comment it. >> >> Although with unified logging coming... this may be moot (but the >> tty version will be easier to port...) >> >> >>> >>> Ditto for similar changes throughout. >>> >>> --- >>> >>> src/share/vm/runtime/synchronizer.cpp >>> >>> 1648 void do_monitor(ObjectMonitor* mid) { >>> 1649 if (mid->owner() == THREAD) { >>> 1650 if (ObjectMonitor::Knob_VerifyMatch != 0) { >>> 1651 Handle obj((oop) mid->object()); >>> 1652 tty->print("INFO: unexpected locked object:"); >>> 1653 javaVFrame::print_locked_object_class_name(tty, obj, >>> "locked"); >>> 1654 } >>> 1655 guarantee(ObjectMonitor::Knob_VerifyMatch == 0, >>> 1656 err_msg("exiting JavaThread=" INTPTR_FORMAT >>> 1657 " unexpectedly owns ObjectMonitor=" >>> INTPTR_FORMAT, >>> 1658 THREAD, mid)); >>> 1659 (void)mid->complete_exit(CHECK); >>> 1660 } >>> 1661 } >>> >>> Took me a while to figure out the expected control flow here. >>> Doesn't the above simplify to: >>> >>> void do_monitor(ObjectMonitor* mid) { >>> if (mid->owner() == THREAD) { >>> if (ObjectMonitor::Knob_VerifyMatch != 0) { >>> Handle obj((oop) mid->object()); >>> tty->print("INFO: unexpected locked object:"); >>> javaVFrame::print_locked_object_class_name(tty, obj, >>> "locked"); >>> fatal(err_msg("exiting JavaThread=" INTPTR_FORMAT >>> " unexpectedly owns ObjectMonitor=" INTPTR_FORMAT, >>> THREAD, mid)); >>> } >>> (void)mid->complete_exit(CHECK); >>> } >>> } >>> >>> ? >> >> Yes, your version is cleaner. >> >> Any particular reason to use "fatal(...)" instead of >> "guarantee(false, ...)". I've seen both... >> >> Dan >> >> >>> >>> Thanks, >>> David >>> >>>> >>>> The easiest way to review the delta is to download the two patch >>>> files and compare them in something like jfilemerge: >>>> >>>> http://cr.openjdk.java.net/~dcubed/8130448-webrev/0-jdk9-hs-rt/hotspot.patch >>>> >>>> >>>> http://cr.openjdk.java.net/~dcubed/8130448-webrev/1-jdk9-hs-rt/hotspot.patch >>>> >>>> >>>> >>>> Testing: >>>> >>>> - Aurora Adhoc RT/SVC nightly batches (in process) >>>> - JPRT test jobs >>>> >>>> Thanks, in advance, for any comments, questions or suggestions. >>>> >>>> Gory details about the changes are below... >>>> >>>> Dan >>>> >>>> Changes between CR0 and CR1 are: >>>> >>>> src/cpu/x86/vm/macroAssembler_x86.cpp >>>> >>>> - fix comment typos, clarify comment wording >>>> >>>> src/share/vm/oops/markOop.cpp >>>> >>>> - clarify output messages >>>> - get rid of confusing local variable >>>> >>>> src/share/vm/runtime/globals.hpp >>>> >>>> - drop VerboseStackTrace, GuaranteeOnMonitorMismatch >>>> and JavaThreadExitReleasesMonitors options >>>> - there are no longer changes to this file >>>> >>>> src/share/vm/runtime/objectMonitor.cpp >>>> >>>> - add ObjectMonitor::Knob_ExitRelease suboption to replace >>>> JavaThreadExitReleasesMonitors >>>> - add ObjectMonitor::Knob_VerifyMatch suboption to replace >>>> GuaranteeOnMonitorMismatch >>>> - cleanup messy logging: >>>> - switch from '::printf()' -> 'tty->print_cr()' >>>> - switch from '::fflush()' -> 'tty->flush()' >>>> >>>> src/share/vm/runtime/objectMonitor.hpp >>>> >>>> - add ObjectMonitor::Knob_ExitRelease suboption >>>> - add ObjectMonitor::Knob_VerifyMatch suboption >>>> - cleanup messy logging >>>> >>>> src/share/vm/runtime/synchronizer.cpp >>>> >>>> - cleanup messy logging >>>> - switch from GuaranteeOnMonitorMismatch to >>>> ObjectMonitor::Knob_VerifyMatch >>>> - add diagnostic information about the locked object >>>> when ReleaseJavaMonitorsClosure::do_monitor() finds >>>> a problem >>>> >>>> src/share/vm/runtime/thread.cpp >>>> >>>> - clarify comments >>>> - switch from JavaThreadExitReleasesMonitors to >>>> ObjectMonitor::Knob_ExitRelease >>>> >>>> src/share/vm/runtime/vframe.cpp >>>> >>>> - print_locked_object_class_name() is now public >>>> - clarify comments >>>> - clarify output messages >>>> - switch from VerboseStackTrace to the already existing >>>> ObjectMonitor::Knob_Verbose >>>> >>>> src/share/vm/runtime/vframe.hpp >>>> >>>> - print_locked_object_class_name() is now public >>>> >>>> >>>> On 7/3/15 6:14 PM, Daniel D. Daugherty wrote: >>>>> Greetings, >>>>> >>>>> The hunt for the following bug: >>>>> >>>>> JDK-8077392 Stream fork/join tasks occasionally fail to complete >>>>> >>>>> and David C's work on the following bug: >>>>> >>>>> JDK-8069412 Locks need better debug-printing support >>>>> >>>>> have inspired additional thread dump improvements, comment additions >>>>> to some Java monitor code and some new diagnostic options. >>>>> >>>>> This work is being tracked by the following bug ID: >>>>> >>>>> JDK-8130448 8077392 inspired thread dump improvements, comment >>>>> additions, new diagnostics >>>>> https://bugs.openjdk.java.net/browse/JDK-8130448 >>>>> >>>>> Here is the webrev URL: >>>>> >>>>> http://cr.openjdk.java.net/~dcubed/8130448-webrev/0-jdk9-hs-rt/ >>>>> >>>>> Testing: >>>>> >>>>> - RBT vm.quick batches (in process) >>>>> - JPRT test jobs >>>>> >>>>> Thanks, in advance, for any comments, questions or suggestions. >>>>> >>>>> Gory details about the changes are below... >>>>> >>>>> Dan >>>>> >>>>> 8130448 summary of changes: >>>>> >>>>> src/cpu/x86/vm/macroAssembler_x86.cpp >>>>> - comment additions for the assembly code >>>>> >>>>> src/share/vm/oops/markOop.cpp >>>>> - has_monitor() has to be checked before is_locked() since >>>>> the has_monitor() bits are a superset of the is_locked() bits >>>>> - code style fixes >>>>> >>>>> src/share/vm/runtime/globals.hpp >>>>> - add VerboseStackTrace diagnostic option >>>>> - add GuaranteeOnMonitorMismatch diagnostic option >>>>> - add JavaThreadExitReleasesMonitors product option; >>>>> this is the Java equivalent of JNIDetachReleasesMonitors >>>>> >>>>> src/share/vm/runtime/objectMonitor.cpp >>>>> - delete unused ObjectMonitor::try_enter() >>>>> - fix assert wording >>>>> >>>>> src/share/vm/runtime/objectMonitor.hpp >>>>> - delete unused ObjectMonitor::try_enter() >>>>> >>>>> src/share/vm/runtime/synchronizer.cpp >>>>> - add GuaranteeOnMonitorMismatch support with some >>>>> diagnostic output >>>>> >>>>> src/share/vm/runtime/thread.cpp >>>>> - add JavaThreadExitReleasesMonitors support >>>>> >>>>> src/share/vm/runtime/vframe.cpp >>>>> - clarify existing comments >>>>> - add comments to clarify what "waiting on" means >>>>> - add line to show when we are "waiting on", but >>>>> there are no locals available (previously we were >>>>> "waiting on" silently) >>>>> - add support for "waiting to relock" which can happen >>>>> for any of the monitors and not just the top monitor >>>>> - switch mark->print_on() verbose output to new >>>>> VerboseStackTrace switch; thread dumps are not enabled >>>>> with a specific switch so the '-XX:+Verbose' model of >>>>> being a modifier for another option does not fit >>>>> >>>>> >>>> >> >> > From daniel.daugherty at oracle.com Thu Jul 9 15:17:48 2015 From: daniel.daugherty at oracle.com (Daniel D. Daugherty) Date: Thu, 09 Jul 2015 09:17:48 -0600 Subject: RFR(S) 8130448: thread dump improvements, comment, additions, new diagnostics inspired by 8077392 In-Reply-To: <559D970E.7000905@oracle.com> References: <55972558.6060905@oracle.com> <559D970E.7000905@oracle.com> Message-ID: <559E909C.8050309@oracle.com> Here are a couple of examples of the new options at work in the hunt for 8077392: In this example, ObjectMonitor::Knob_ExitRelease == 1 and ObjectMonitor::Knob_VerifyMatch == 1 so we catch a JavaThread exiting while a Java monitor is locked: config java.util.stream.LoggingTestCase.before(): success INFO: unexpected locked object: - locked <0xfffffd7be05e9478> (a java.util.stream.Nodes$CollectorTask$OfInt) # # A fatal error has been detected by the Java Runtime Environment: # # Internal Error (synchronizer.cpp:1658), pid=10768, tid=0x0000000000000049 # guarantee(ObjectMonitor::Knob_VerifyMatch == 0) failed: exiting JavaThread=0x0000000001069800 unexpectedly owns ObjectMonitor=0x000000000116de00 # # JRE version: Java(TM) SE Runtime Environment (9.0) (build 1.9.0-internal-20150708151346.ddaugher.8130448_for_jdk9-b00) # Java VM: Java HotSpot(TM) 64-Bit Server VM (1.9.0-internal-20150708151346.ddaugher.8130448_for_jdk9-b00 mixed mode solaris-amd64 compressed oops) The "INFO" line shows details about the Object and the guarantee() line shows info about the offending thread and the ObjectMonitor itself. With the latest change, the guarantee() will change to a fatal()... In this example, ObjectMonitor::Knob_ExitRelease == 0, ObjectMonitor::Knob_VerifyMatch == 0 and ObjectMonitor::Knob_Verbose == 1 so when we hit the hang in the hunt for 8077392, we'll see a more detailed thread dump: Full thread dump Java HotSpot(TM) 64-Bit Server VM (1.9.0-internal-2015070815134 6.ddaugher.8130448_for_jdk9-b00 mixed mode): "MainThread" #11 prio=5 os_prio=64 tid=0x0000000000a1e800 nid=0x43 in Object.wai t() [0xfffffd7bba9fc000] java.lang.Thread.State: BLOCKED (on object monitor) at java.lang.Object.wait(Native Method) - waiting on at java.util.concurrent.ForkJoinTask.externalAwaitDone(ForkJoinTask.java :334) - waiting to re-lock in wait() <0xfffffd7be69350c8> (a java.util.stream. Nodes$CollectorTask$OfInt) - lockbits= monitor(0x0000000001975502)={count=0x0000000000000000,waiter s=0x0000000000000001,recursions=0x0000000000000000,owner=0x0000000001311000} at java.util.concurrent.ForkJoinTask.doInvoke(ForkJoinTask.java:405) at java.util.concurrent.ForkJoinTask.invoke(ForkJoinTask.java:734) With the changes for this bug (8130448): - This line is new: - waiting on and it tells us that this compiled code instead of interpreted code. Prior to 8130448, the "waiting on ..." line would not be present. - This line is new: - waiting to re-lock in wait() <0xfffffd7be69350c8> (a java.util.stream. Nodes$CollectorTask$OfInt) and it tells us that the Java monitor has been notified and the thread is waiting to re-lock the Java monitor. Prior to 8130448, the "waiting to re-lock ..." line would not be present. - This line was new with David C's changes: - lockbits= monitor(0x0000000001975502)={count=0x0000000000000000,waiter s=0x0000000000000001,recursions=0x0000000000000000,owner=0x0000000001311000} and it tells us which JavaThread owns the Java monitor: 0x0000000001311000. A search of the rest of the thread dump would show no such thread exists. Adding instrumentation to the thread-start and thread-exit code paths shows that such a thread did exist and exited just before this hang happened. I think that's it for a demo of the new options... Dan On 7/8/15 3:33 PM, Daniel D. Daugherty wrote: > Greetings, > > I've updated this patch based on David H's comments along with > some additional cleanup. > > This work is being tracked by the following bug ID: > > JDK-8130448 8077392 inspired thread dump improvements, comment > additions, new diagnostics > https://bugs.openjdk.java.net/browse/JDK-8130448 > > Here is the webrev URL: > > http://cr.openjdk.java.net/~dcubed/8130448-webrev/1-jdk9-hs-rt/ > > The easiest way to review the delta is to download the two patch > files and compare them in something like jfilemerge: > > http://cr.openjdk.java.net/~dcubed/8130448-webrev/0-jdk9-hs-rt/hotspot.patch > > http://cr.openjdk.java.net/~dcubed/8130448-webrev/1-jdk9-hs-rt/hotspot.patch > > > Testing: > > - Aurora Adhoc RT/SVC nightly batches (in process) > - JPRT test jobs > > Thanks, in advance, for any comments, questions or suggestions. > > Gory details about the changes are below... > > Dan > > Changes between CR0 and CR1 are: > > src/cpu/x86/vm/macroAssembler_x86.cpp > > - fix comment typos, clarify comment wording > > src/share/vm/oops/markOop.cpp > > - clarify output messages > - get rid of confusing local variable > > src/share/vm/runtime/globals.hpp > > - drop VerboseStackTrace, GuaranteeOnMonitorMismatch > and JavaThreadExitReleasesMonitors options > - there are no longer changes to this file > > src/share/vm/runtime/objectMonitor.cpp > > - add ObjectMonitor::Knob_ExitRelease suboption to replace > JavaThreadExitReleasesMonitors > - add ObjectMonitor::Knob_VerifyMatch suboption to replace > GuaranteeOnMonitorMismatch > - cleanup messy logging: > - switch from '::printf()' -> 'tty->print_cr()' > - switch from '::fflush()' -> 'tty->flush()' > > src/share/vm/runtime/objectMonitor.hpp > > - add ObjectMonitor::Knob_ExitRelease suboption > - add ObjectMonitor::Knob_VerifyMatch suboption > - cleanup messy logging > > src/share/vm/runtime/synchronizer.cpp > > - cleanup messy logging > - switch from GuaranteeOnMonitorMismatch to > ObjectMonitor::Knob_VerifyMatch > - add diagnostic information about the locked object > when ReleaseJavaMonitorsClosure::do_monitor() finds > a problem > > src/share/vm/runtime/thread.cpp > > - clarify comments > - switch from JavaThreadExitReleasesMonitors to > ObjectMonitor::Knob_ExitRelease > > src/share/vm/runtime/vframe.cpp > > - print_locked_object_class_name() is now public > - clarify comments > - clarify output messages > - switch from VerboseStackTrace to the already existing > ObjectMonitor::Knob_Verbose > > src/share/vm/runtime/vframe.hpp > > - print_locked_object_class_name() is now public > > > On 7/3/15 6:14 PM, Daniel D. Daugherty wrote: >> Greetings, >> >> The hunt for the following bug: >> >> JDK-8077392 Stream fork/join tasks occasionally fail to complete >> >> and David C's work on the following bug: >> >> JDK-8069412 Locks need better debug-printing support >> >> have inspired additional thread dump improvements, comment additions >> to some Java monitor code and some new diagnostic options. >> >> This work is being tracked by the following bug ID: >> >> JDK-8130448 8077392 inspired thread dump improvements, comment >> additions, new diagnostics >> https://bugs.openjdk.java.net/browse/JDK-8130448 >> >> Here is the webrev URL: >> >> http://cr.openjdk.java.net/~dcubed/8130448-webrev/0-jdk9-hs-rt/ >> >> Testing: >> >> - RBT vm.quick batches (in process) >> - JPRT test jobs >> >> Thanks, in advance, for any comments, questions or suggestions. >> >> Gory details about the changes are below... >> >> Dan >> >> 8130448 summary of changes: >> >> src/cpu/x86/vm/macroAssembler_x86.cpp >> - comment additions for the assembly code >> >> src/share/vm/oops/markOop.cpp >> - has_monitor() has to be checked before is_locked() since >> the has_monitor() bits are a superset of the is_locked() bits >> - code style fixes >> >> src/share/vm/runtime/globals.hpp >> - add VerboseStackTrace diagnostic option >> - add GuaranteeOnMonitorMismatch diagnostic option >> - add JavaThreadExitReleasesMonitors product option; >> this is the Java equivalent of JNIDetachReleasesMonitors >> >> src/share/vm/runtime/objectMonitor.cpp >> - delete unused ObjectMonitor::try_enter() >> - fix assert wording >> >> src/share/vm/runtime/objectMonitor.hpp >> - delete unused ObjectMonitor::try_enter() >> >> src/share/vm/runtime/synchronizer.cpp >> - add GuaranteeOnMonitorMismatch support with some >> diagnostic output >> >> src/share/vm/runtime/thread.cpp >> - add JavaThreadExitReleasesMonitors support >> >> src/share/vm/runtime/vframe.cpp >> - clarify existing comments >> - add comments to clarify what "waiting on" means >> - add line to show when we are "waiting on", but >> there are no locals available (previously we were >> "waiting on" silently) >> - add support for "waiting to relock" which can happen >> for any of the monitors and not just the top monitor >> - switch mark->print_on() verbose output to new >> VerboseStackTrace switch; thread dumps are not enabled >> with a specific switch so the '-XX:+Verbose' model of >> being a modifier for another option does not fit >> >> > > > From jeremymanson at google.com Thu Jul 9 18:20:40 2015 From: jeremymanson at google.com (Jeremy Manson) Date: Thu, 9 Jul 2015 11:20:40 -0700 Subject: RFR: 8079301: Some command line options not settable via JAVA_TOOL_OPTIONS In-Reply-To: <559D237C.2060702@oracle.com> References: <554839B4.3020800@oracle.com> <559D237C.2060702@oracle.com> Message-ID: Thanks for looking at this, Coleen. I merged this with the latest version of hs-rt, but Ron is or I am going to have to do some merging for 8061999. The changes are relatively orthogonal, but they touch a couple of the same places. How far away is Ron's checkin? Updated webrev: http://cr.openjdk.java.net/~jmanson/8079301/webrev.01/ Updated test: http://cr.openjdk.java.net/~jmanson/8079301t/webrev.01/ (Mild complaining on my part: the conflicts wouldn't have been an issue if someone had looked at this two months ago, when I first asked. I suspect Ron hadn't even started his change at that point. And if external developers were able to submit changes to Hotspot, we wouldn't have had to bother Oracle engineers at all. Neither of these is your fault or your problem, of course - I'm grateful you were able to take a look.) Jeremy On Wed, Jul 8, 2015 at 6:19 AM, Coleen Phillimore < coleen.phillimore at oracle.com> wrote: > I'll sponsor it but can you repost the RFR? > > There has been a fair bit of work to command line processing lately so I'd > like to have the others look at it too. Have you merged this up with the > latest version of hs-rt repository and were there conflicts? Also, have > you looked at the RFR: > > "Open code review for 8061999 Enhance VM option parsing to allow options > to be specified" > > and are there conflicts with this? > > The hotspot change looks good to me. > > > http://cr.openjdk.java.net/~jmanson/8079301t/webrev.00/test/com/sun/management/HotSpotDiagnosticMXBean/CheckOrigin.java.udiff.html > > "UseCerealGC" LOL > Can you use a different option than PrintOopAddress in this test? I don't > know why this command line option exists or would be useful for, and seems > to be a good candidate for removal. If you need a valid argument, that is > unlikely to go away, TraceExceptions would be good. > > Thanks, > Coleen > > > On 7/7/15 8:00 PM, Jeremy Manson wrote: > >> No love? Is there a code owner here I should pester more directly? >> >> Jeremy >> >> On Fri, Jun 26, 2015 at 3:00 PM, Martin Buchholz >> wrote: >> >> As usual with Google patches, they are in use locally. This one has been >>> stable for a while without complaints. Please sponsor. >>> >>> On Fri, Jun 26, 2015 at 1:53 PM, Jeremy Manson >>> wrote: >>> >>> All this talk about IgnoreUnrecognizedVMOptions reminded me that this >>>> review is still outstanding. Any takers? >>>> >>>> Jeremy >>>> >>>> On Tue, May 5, 2015 at 10:01 AM, Jeremy Manson >>> > >>>> wrote: >>>> >>>> Hi David, >>>>> >>>>> Thanks for taking a look. >>>>> >>>>> On Mon, May 4, 2015 at 8:32 PM, David Holmes >>>>> wrote: >>>>> >>>>> Hi Jeremy, >>>>>> >>>>>> On 5/05/2015 6:51 AM, Jeremy Manson wrote: >>>>>> >>>>>> Not sure who might be willing to sponsor this. David? You did the >>>>>>> last >>>>>>> one. :) >>>>>>> >>>>>>> Might be a while before I can get to it. I did have a quick look >>>>>> (and >>>>>> will need a longer one). >>>>>> >>>>> >>>>> I understand. I'm just happy it's possible to upstream this stuff at >>>>> all[1]. >>>>> >>>>> [1] With the eternal caveat that I'd be happier if we didn't *have* to >>>>> go through you folks, but we've learned to live with it. >>>>> >>>>> >>>>> >>>>> Context: A number of command line options are not settable via >>>>>> >>>>>>> JAVA_TOOL_OPTIONS and _JAVA_OPTIONS: >>>>>>> >>>>>>> - PrintVMOptions >>>>>>> >>>>>>> So you have changed the semantics of this to print out the options >>>>>> from >>>>>> the command-line and each of the two env vars. Seems reasonable but >>>>>> may be >>>>>> better to know which option came from where as we can now see the same >>>>>> option (or conflicting variants thereof) multiple times. >>>>>> >>>>>> I'd be happy to do this. Any preferred syntax? Does someone >>>>> actually >>>>> own this feature? >>>>> >>>>> I'm unclear what the current processing order is for the different >>>>> >>>>>> sources of options, and whether the changes affect that order? >>>>>> >>>>>> Nope. I go through sad contortions to keep the processing order the >>>>> same. It's JAVA_TOOL_OPTIONS, then command line, then _JAVA_OPTIONS. >>>>> See >>>>> lines 2549-2567. >>>>> >>>>> >>>>> - IgnoreUnrecognizedVMOptions >>>>>> >>>>>>> - PrintFlagsInitial >>>>>>> >>>>>>> Unclear what "initial" actually means - is it the default? >>>>>> >>>>> >>>>> More or less. If you stick, for example, IgnoreUnrecognizedVMOptions >>>>> in >>>>> there first, it will get printed out as "true". I haven't really >>>>> changed >>>>> the semantics here either - I've just added processing of the envvars. >>>>> >>>>> - NativeMemoryTracking >>>>> >>>>>> - PrintFlagsWithComments >>>>>>> >>>>>>> This is because these flags have to be processed before processing >>>>>>> other >>>>>>> flags, and no one ever bothered to do that for the flags coming from >>>>>>> environment variables. This patch fixes that problem. >>>>>>> >>>>>>> I have a test, but it is a modification to a JDK test instead of a HS >>>>>>> test, >>>>>>> so it can go in separately (I guess). >>>>>>> >>>>>>> They can be pushed together to different repos in the same forest. >>>>>> >>>>>> Okay. Here's the test change: >>>>> >>>>> http://cr.openjdk.java.net/~jmanson/8079301t/webrev.00/ >>>>> >>>>> >>>>> As I said I'll have to get back to this. And hopefully someone else in >>>>>> runtime will take a good look as well ;-) >>>>>> >>>>>> I'd be happy to toss it over to whomever owns this, if anyone. >>>>> Thanks! >>>>> >>>>> Jeremy >>>>> >>>>> >>>>> >>>>> Bug: >>>>>> >>>>>>> https://bugs.openjdk.java.net/browse/JDK-8079301 >>>>>>> >>>>>>> Webrev: >>>>>>> http://cr.openjdk.java.net/~jmanson/8079301/webrev.00/ >>>>>>> >>>>>>> Jeremy >>>>>>> >>>>>>> >>>>>>> > From dmitry.dmitriev at oracle.com Thu Jul 9 21:52:23 2015 From: dmitry.dmitriev at oracle.com (Dmitry Dmitriev) Date: Fri, 10 Jul 2015 00:52:23 +0300 Subject: RFR: 8079301: Some command line options not settable via JAVA_TOOL_OPTIONS In-Reply-To: References: <554839B4.3020800@oracle.com> <559D237C.2060702@oracle.com> Message-ID: <559EED17.4060109@oracle.com> Hello Jeremy, Correct me if I am wrong, but I see small memory leak in your implementation. In Arguments::parse_options_environment_variable function memory for 'buffer' allocated by strdup function on line 3415, but now it not freed in this function because data from this buffer is used later. On the other hand when we are done with env variables, we free only options array(lines 3703-3705) and not free previously allocated memory for 'buffer' because we lost track for it. Thanks, Dmitry On 09.07.2015 21:20, Jeremy Manson wrote: > Thanks for looking at this, Coleen. > > I merged this with the latest version of hs-rt, but Ron is or I am going to > have to do some merging for 8061999. The changes are relatively > orthogonal, but they touch a couple of the same places. How far away is > Ron's checkin? > > Updated webrev: > > http://cr.openjdk.java.net/~jmanson/8079301/webrev.01/ > > Updated test: > > http://cr.openjdk.java.net/~jmanson/8079301t/webrev.01/ > > (Mild complaining on my part: the conflicts wouldn't have been an issue if > someone had looked at this two months ago, when I first asked. I suspect > Ron hadn't even started his change at that point. And if external > developers were able to submit changes to Hotspot, we wouldn't have had to > bother Oracle engineers at all. Neither of these is your fault or your > problem, of course - I'm grateful you were able to take a look.) > > Jeremy > > On Wed, Jul 8, 2015 at 6:19 AM, Coleen Phillimore < > coleen.phillimore at oracle.com> wrote: > >> I'll sponsor it but can you repost the RFR? >> >> There has been a fair bit of work to command line processing lately so I'd >> like to have the others look at it too. Have you merged this up with the >> latest version of hs-rt repository and were there conflicts? Also, have >> you looked at the RFR: >> >> "Open code review for 8061999 Enhance VM option parsing to allow options >> to be specified" >> >> and are there conflicts with this? >> >> The hotspot change looks good to me. >> >> >> http://cr.openjdk.java.net/~jmanson/8079301t/webrev.00/test/com/sun/management/HotSpotDiagnosticMXBean/CheckOrigin.java.udiff.html >> >> "UseCerealGC" LOL >> Can you use a different option than PrintOopAddress in this test? I don't >> know why this command line option exists or would be useful for, and seems >> to be a good candidate for removal. If you need a valid argument, that is >> unlikely to go away, TraceExceptions would be good. >> >> Thanks, >> Coleen >> >> >> On 7/7/15 8:00 PM, Jeremy Manson wrote: >> >>> No love? Is there a code owner here I should pester more directly? >>> >>> Jeremy >>> >>> On Fri, Jun 26, 2015 at 3:00 PM, Martin Buchholz >>> wrote: >>> >>> As usual with Google patches, they are in use locally. This one has been >>>> stable for a while without complaints. Please sponsor. >>>> >>>> On Fri, Jun 26, 2015 at 1:53 PM, Jeremy Manson >>>> wrote: >>>> >>>> All this talk about IgnoreUnrecognizedVMOptions reminded me that this >>>>> review is still outstanding. Any takers? >>>>> >>>>> Jeremy >>>>> >>>>> On Tue, May 5, 2015 at 10:01 AM, Jeremy Manson >>>> wrote: >>>>> >>>>> Hi David, >>>>>> Thanks for taking a look. >>>>>> >>>>>> On Mon, May 4, 2015 at 8:32 PM, David Holmes >>>>>> wrote: >>>>>> >>>>>> Hi Jeremy, >>>>>>> On 5/05/2015 6:51 AM, Jeremy Manson wrote: >>>>>>> >>>>>>> Not sure who might be willing to sponsor this. David? You did the >>>>>>>> last >>>>>>>> one. :) >>>>>>>> >>>>>>>> Might be a while before I can get to it. I did have a quick look >>>>>>> (and >>>>>>> will need a longer one). >>>>>>> >>>>>> I understand. I'm just happy it's possible to upstream this stuff at >>>>>> all[1]. >>>>>> >>>>>> [1] With the eternal caveat that I'd be happier if we didn't *have* to >>>>>> go through you folks, but we've learned to live with it. >>>>>> >>>>>> >>>>>> >>>>>> Context: A number of command line options are not settable via >>>>>>>> JAVA_TOOL_OPTIONS and _JAVA_OPTIONS: >>>>>>>> >>>>>>>> - PrintVMOptions >>>>>>>> >>>>>>>> So you have changed the semantics of this to print out the options >>>>>>> from >>>>>>> the command-line and each of the two env vars. Seems reasonable but >>>>>>> may be >>>>>>> better to know which option came from where as we can now see the same >>>>>>> option (or conflicting variants thereof) multiple times. >>>>>>> >>>>>>> I'd be happy to do this. Any preferred syntax? Does someone >>>>>> actually >>>>>> own this feature? >>>>>> >>>>>> I'm unclear what the current processing order is for the different >>>>>> >>>>>>> sources of options, and whether the changes affect that order? >>>>>>> >>>>>>> Nope. I go through sad contortions to keep the processing order the >>>>>> same. It's JAVA_TOOL_OPTIONS, then command line, then _JAVA_OPTIONS. >>>>>> See >>>>>> lines 2549-2567. >>>>>> >>>>>> >>>>>> - IgnoreUnrecognizedVMOptions >>>>>>>> - PrintFlagsInitial >>>>>>>> >>>>>>>> Unclear what "initial" actually means - is it the default? >>>>>> More or less. If you stick, for example, IgnoreUnrecognizedVMOptions >>>>>> in >>>>>> there first, it will get printed out as "true". I haven't really >>>>>> changed >>>>>> the semantics here either - I've just added processing of the envvars. >>>>>> >>>>>> - NativeMemoryTracking >>>>>> >>>>>>> - PrintFlagsWithComments >>>>>>>> This is because these flags have to be processed before processing >>>>>>>> other >>>>>>>> flags, and no one ever bothered to do that for the flags coming from >>>>>>>> environment variables. This patch fixes that problem. >>>>>>>> >>>>>>>> I have a test, but it is a modification to a JDK test instead of a HS >>>>>>>> test, >>>>>>>> so it can go in separately (I guess). >>>>>>>> >>>>>>>> They can be pushed together to different repos in the same forest. >>>>>>> Okay. Here's the test change: >>>>>> http://cr.openjdk.java.net/~jmanson/8079301t/webrev.00/ >>>>>> >>>>>> >>>>>> As I said I'll have to get back to this. And hopefully someone else in >>>>>>> runtime will take a good look as well ;-) >>>>>>> >>>>>>> I'd be happy to toss it over to whomever owns this, if anyone. >>>>>> Thanks! >>>>>> >>>>>> Jeremy >>>>>> >>>>>> >>>>>> >>>>>> Bug: >>>>>>>> https://bugs.openjdk.java.net/browse/JDK-8079301 >>>>>>>> >>>>>>>> Webrev: >>>>>>>> http://cr.openjdk.java.net/~jmanson/8079301/webrev.00/ >>>>>>>> >>>>>>>> Jeremy >>>>>>>> >>>>>>>> >>>>>>>> From claes.redestad at oracle.com Thu Jul 9 22:05:57 2015 From: claes.redestad at oracle.com (Claes Redestad) Date: Fri, 10 Jul 2015 00:05:57 +0200 Subject: RFR [8u60]: 8081590: The CDS classlist needs to be updated for 8u60 In-Reply-To: <5579965B.7000709@oracle.com> References: <5579965B.7000709@oracle.com> Message-ID: <559EF045.10307@oracle.com> Hi, new refresh up: http://cr.openjdk.java.net/~redestad/8081590/webrev.02/ The refresh was put on hold earlier due to an incoming startup optimization, which affected the classlist (mostly order). I've rerun relevant tests, verified -Xshare:dump doesn't log any warnings and checked that footprint and startup improve. Thanks! /Claes On 2015-06-11 16:08, Claes Redestad wrote: > Hi, > > classlists have been slowly deteriorating since the last refresh > (https://bugs.openjdk.java.net/browse/JDK-8023041), > contributing to a small but significant degradation in startup and > footprint characteristics. > > While there are also classlist files for Solaris, Mac and AIX, we > cannot run the same set of applications we run on > 32-bit platforms on non-32-bit platforms (due to an application with a > bundled 32-bit dependency). > > Rather than generating new classlists using a different set of > applications without ability to verify that it helps, I'd > rather limit this 8u60 refresh to Linux and Windows where we can > verify the benefit and do a more thorough > investigation into modernizing the representative set of applications > for JDK9 and onwards. > > Webrev: http://cr.openjdk.java.net/~redestad/8081590/webrev.00/ > Bug: https://bugs.openjdk.java.net/browse/JDK-8081590 > > I'll need a sponsor to push this to 8u60. > > /Claes From david.holmes at oracle.com Fri Jul 10 00:08:56 2015 From: david.holmes at oracle.com (David Holmes) Date: Fri, 10 Jul 2015 10:08:56 +1000 Subject: RFR(S) 8130448: thread dump improvements, comment, additions, new diagnostics inspired by 8077392 In-Reply-To: <559E7259.1070605@oracle.com> References: <55972558.6060905@oracle.com> <559D970E.7000905@oracle.com> <559E1611.2070803@oracle.com> <559E7259.1070605@oracle.com> Message-ID: <559F0D18.3090406@oracle.com> On 9/07/2015 11:08 PM, Daniel D. Daugherty wrote: > David, > > Thanks for the quick re-review! > > Responses embedded below... > > On 7/9/15 12:34 AM, David Holmes wrote: >> Hi Dan, >> >> On 9/07/2015 7:33 AM, Daniel D. Daugherty wrote: >>> Greetings, >>> >>> I've updated this patch based on David H's comments along with >>> some additional cleanup. >> >> So to address the high-level changes: >> >> - Use ObjectMonitor::Knob_Verbose as the verbosity flag for printing >> the lockbits in the stack dump. Okay - though I do wonder why the >> SyncVerbose flag also exists? > > I'll ping Dice to see if there's a reason for two different verbose > flags in the monitor subsystem. I have to admit that I didn't notice > that one in the large collection of knobs and switches... :-( > > >> - Use ObjectMonitor::Knob_ExitRelease to control whether Java threads >> are checked for locked monitors when they exit >> - Use ObjectMonitor::Knob_VerifyMatch to control whether finding a >> locked (hence unmatched) monitor causes an abort >> >> That seems like a good way to work within the existing mechanism for >> customizing the sync logic - and no new global options (though SQE >> will still need tests for using these knobs I think). > > Glad that this version is more acceptable. > > >> Some specific comments below ... >> >>> This work is being tracked by the following bug ID: >>> >>> JDK-8130448 8077392 inspired thread dump improvements, comment >>> additions, new diagnostics >>> https://bugs.openjdk.java.net/browse/JDK-8130448 >>> >>> Here is the webrev URL: >>> >>> http://cr.openjdk.java.net/~dcubed/8130448-webrev/1-jdk9-hs-rt/ >> >> src/share/vm/runtime/objectMonitor.cpp >> >> 2393 if (Knob_ReportSettings && v != NULL) { >> 2394 tty->print_cr("INFO: SyncKnob: %s %d(%d)", Key, rslt, Default) ; >> 2395 tty->flush(); >> 2396 } >> >> I suspect these were not tty using because this might get called >> before the tty has been initialized - but I can't see how that might >> arise (nor can I be certain it can't). > > I couldn't see how tty could not be initialized at these points either. > My current plan is to go with this change to 'tty' and if we run into > an early use case, then we do something else _and_ comment it. > > Although with unified logging coming... this may be moot (but the > tty version will be easier to port...) > > >> >> Ditto for similar changes throughout. >> >> --- >> >> src/share/vm/runtime/synchronizer.cpp >> >> 1648 void do_monitor(ObjectMonitor* mid) { >> 1649 if (mid->owner() == THREAD) { >> 1650 if (ObjectMonitor::Knob_VerifyMatch != 0) { >> 1651 Handle obj((oop) mid->object()); >> 1652 tty->print("INFO: unexpected locked object:"); >> 1653 javaVFrame::print_locked_object_class_name(tty, obj, >> "locked"); >> 1654 } >> 1655 guarantee(ObjectMonitor::Knob_VerifyMatch == 0, >> 1656 err_msg("exiting JavaThread=" INTPTR_FORMAT >> 1657 " unexpectedly owns ObjectMonitor=" >> INTPTR_FORMAT, >> 1658 THREAD, mid)); >> 1659 (void)mid->complete_exit(CHECK); >> 1660 } >> 1661 } >> >> Took me a while to figure out the expected control flow here. Doesn't >> the above simplify to: >> >> void do_monitor(ObjectMonitor* mid) { >> if (mid->owner() == THREAD) { >> if (ObjectMonitor::Knob_VerifyMatch != 0) { >> Handle obj((oop) mid->object()); >> tty->print("INFO: unexpected locked object:"); >> javaVFrame::print_locked_object_class_name(tty, obj, "locked"); >> fatal(err_msg("exiting JavaThread=" INTPTR_FORMAT >> " unexpectedly owns ObjectMonitor=" INTPTR_FORMAT, >> THREAD, mid)); >> } >> (void)mid->complete_exit(CHECK); >> } >> } >> >> ? > > Yes, your version is cleaner. > > Any particular reason to use "fatal(...)" instead of > "guarantee(false, ...)". I've seen both... A guarantee that always fires seems like a fatal to me. But as you say both get used. David ----- > Dan > > >> >> Thanks, >> David >> >>> >>> The easiest way to review the delta is to download the two patch >>> files and compare them in something like jfilemerge: >>> >>> http://cr.openjdk.java.net/~dcubed/8130448-webrev/0-jdk9-hs-rt/hotspot.patch >>> >>> >>> http://cr.openjdk.java.net/~dcubed/8130448-webrev/1-jdk9-hs-rt/hotspot.patch >>> >>> >>> >>> Testing: >>> >>> - Aurora Adhoc RT/SVC nightly batches (in process) >>> - JPRT test jobs >>> >>> Thanks, in advance, for any comments, questions or suggestions. >>> >>> Gory details about the changes are below... >>> >>> Dan >>> >>> Changes between CR0 and CR1 are: >>> >>> src/cpu/x86/vm/macroAssembler_x86.cpp >>> >>> - fix comment typos, clarify comment wording >>> >>> src/share/vm/oops/markOop.cpp >>> >>> - clarify output messages >>> - get rid of confusing local variable >>> >>> src/share/vm/runtime/globals.hpp >>> >>> - drop VerboseStackTrace, GuaranteeOnMonitorMismatch >>> and JavaThreadExitReleasesMonitors options >>> - there are no longer changes to this file >>> >>> src/share/vm/runtime/objectMonitor.cpp >>> >>> - add ObjectMonitor::Knob_ExitRelease suboption to replace >>> JavaThreadExitReleasesMonitors >>> - add ObjectMonitor::Knob_VerifyMatch suboption to replace >>> GuaranteeOnMonitorMismatch >>> - cleanup messy logging: >>> - switch from '::printf()' -> 'tty->print_cr()' >>> - switch from '::fflush()' -> 'tty->flush()' >>> >>> src/share/vm/runtime/objectMonitor.hpp >>> >>> - add ObjectMonitor::Knob_ExitRelease suboption >>> - add ObjectMonitor::Knob_VerifyMatch suboption >>> - cleanup messy logging >>> >>> src/share/vm/runtime/synchronizer.cpp >>> >>> - cleanup messy logging >>> - switch from GuaranteeOnMonitorMismatch to >>> ObjectMonitor::Knob_VerifyMatch >>> - add diagnostic information about the locked object >>> when ReleaseJavaMonitorsClosure::do_monitor() finds >>> a problem >>> >>> src/share/vm/runtime/thread.cpp >>> >>> - clarify comments >>> - switch from JavaThreadExitReleasesMonitors to >>> ObjectMonitor::Knob_ExitRelease >>> >>> src/share/vm/runtime/vframe.cpp >>> >>> - print_locked_object_class_name() is now public >>> - clarify comments >>> - clarify output messages >>> - switch from VerboseStackTrace to the already existing >>> ObjectMonitor::Knob_Verbose >>> >>> src/share/vm/runtime/vframe.hpp >>> >>> - print_locked_object_class_name() is now public >>> >>> >>> On 7/3/15 6:14 PM, Daniel D. Daugherty wrote: >>>> Greetings, >>>> >>>> The hunt for the following bug: >>>> >>>> JDK-8077392 Stream fork/join tasks occasionally fail to complete >>>> >>>> and David C's work on the following bug: >>>> >>>> JDK-8069412 Locks need better debug-printing support >>>> >>>> have inspired additional thread dump improvements, comment additions >>>> to some Java monitor code and some new diagnostic options. >>>> >>>> This work is being tracked by the following bug ID: >>>> >>>> JDK-8130448 8077392 inspired thread dump improvements, comment >>>> additions, new diagnostics >>>> https://bugs.openjdk.java.net/browse/JDK-8130448 >>>> >>>> Here is the webrev URL: >>>> >>>> http://cr.openjdk.java.net/~dcubed/8130448-webrev/0-jdk9-hs-rt/ >>>> >>>> Testing: >>>> >>>> - RBT vm.quick batches (in process) >>>> - JPRT test jobs >>>> >>>> Thanks, in advance, for any comments, questions or suggestions. >>>> >>>> Gory details about the changes are below... >>>> >>>> Dan >>>> >>>> 8130448 summary of changes: >>>> >>>> src/cpu/x86/vm/macroAssembler_x86.cpp >>>> - comment additions for the assembly code >>>> >>>> src/share/vm/oops/markOop.cpp >>>> - has_monitor() has to be checked before is_locked() since >>>> the has_monitor() bits are a superset of the is_locked() bits >>>> - code style fixes >>>> >>>> src/share/vm/runtime/globals.hpp >>>> - add VerboseStackTrace diagnostic option >>>> - add GuaranteeOnMonitorMismatch diagnostic option >>>> - add JavaThreadExitReleasesMonitors product option; >>>> this is the Java equivalent of JNIDetachReleasesMonitors >>>> >>>> src/share/vm/runtime/objectMonitor.cpp >>>> - delete unused ObjectMonitor::try_enter() >>>> - fix assert wording >>>> >>>> src/share/vm/runtime/objectMonitor.hpp >>>> - delete unused ObjectMonitor::try_enter() >>>> >>>> src/share/vm/runtime/synchronizer.cpp >>>> - add GuaranteeOnMonitorMismatch support with some >>>> diagnostic output >>>> >>>> src/share/vm/runtime/thread.cpp >>>> - add JavaThreadExitReleasesMonitors support >>>> >>>> src/share/vm/runtime/vframe.cpp >>>> - clarify existing comments >>>> - add comments to clarify what "waiting on" means >>>> - add line to show when we are "waiting on", but >>>> there are no locals available (previously we were >>>> "waiting on" silently) >>>> - add support for "waiting to relock" which can happen >>>> for any of the monitors and not just the top monitor >>>> - switch mark->print_on() verbose output to new >>>> VerboseStackTrace switch; thread dumps are not enabled >>>> with a specific switch so the '-XX:+Verbose' model of >>>> being a modifier for another option does not fit >>>> >>>> >>> > From david.holmes at oracle.com Fri Jul 10 00:17:17 2015 From: david.holmes at oracle.com (David Holmes) Date: Fri, 10 Jul 2015 10:17:17 +1000 Subject: RFR(S) 8130448: thread dump improvements, comment, additions, new diagnostics inspired by 8077392 In-Reply-To: <559E8110.40706@oracle.com> References: <55972558.6060905@oracle.com> <559D970E.7000905@oracle.com> <559E1611.2070803@oracle.com> <559E7259.1070605@oracle.com> <559E7D5A.2040900@oracle.com> <559E8110.40706@oracle.com> Message-ID: <559F0F0D.6080108@oracle.com> Sorry I missed this update before previous reply. Thumbs up! David On 10/07/2015 12:11 AM, Daniel D. Daugherty wrote: > On 7/9/15 7:55 AM, Daniel D. Daugherty wrote: >> > Any particular reason to use "fatal(...)" instead of >> > "guarantee(false, ...)". I've seen both... >> >> Answering my own question... :-) >> >> fatal() and guarantee() both reach the same place (report_vm_error()) >> with the same bells-and-whistles on the way... >> >> So "guarantee(false, ...)" is the same as "fatal(...)" >> so I'll switch to the more direct "fatal(...)". >> >> I don't think that change requires a re-review, please let me know >> if you disagree... > > Sigh... I meant "webrev"... Here's the diffs: > > $ diff -c src/share/vm/runtime/synchronizer.cpp{.cr1,} > *** src/share/vm/runtime/synchronizer.cpp.cr1 Wed Jul 8 07:15:07 2015 > --- src/share/vm/runtime/synchronizer.cpp Thu Jul 9 07:07:28 2015 > *************** > *** 1651,1661 **** > Handle obj((oop) mid->object()); > tty->print("INFO: unexpected locked object:"); > javaVFrame::print_locked_object_class_name(tty, obj, "locked"); > } > - guarantee(ObjectMonitor::Knob_VerifyMatch == 0, > - err_msg("exiting JavaThread=" INTPTR_FORMAT > - " unexpectedly owns ObjectMonitor=" > INTPTR_FORMAT, > - THREAD, mid)); > (void)mid->complete_exit(CHECK); > } > } > --- 1651,1660 ---- > Handle obj((oop) mid->object()); > tty->print("INFO: unexpected locked object:"); > javaVFrame::print_locked_object_class_name(tty, obj, "locked"); > + fatal(err_msg("exiting JavaThread=" INTPTR_FORMAT > + " unexpectedly owns ObjectMonitor=" INTPTR_FORMAT, > + THREAD, mid)); > } > (void)mid->complete_exit(CHECK); > } > } > > Dan > > >> >> Dan >> >> >> On 7/9/15 7:08 AM, Daniel D. Daugherty wrote: >>> David, >>> >>> Thanks for the quick re-review! >>> >>> Responses embedded below... >>> >>> On 7/9/15 12:34 AM, David Holmes wrote: >>>> Hi Dan, >>>> >>>> On 9/07/2015 7:33 AM, Daniel D. Daugherty wrote: >>>>> Greetings, >>>>> >>>>> I've updated this patch based on David H's comments along with >>>>> some additional cleanup. >>>> >>>> So to address the high-level changes: >>>> >>>> - Use ObjectMonitor::Knob_Verbose as the verbosity flag for printing >>>> the lockbits in the stack dump. Okay - though I do wonder why the >>>> SyncVerbose flag also exists? >>> >>> I'll ping Dice to see if there's a reason for two different verbose >>> flags in the monitor subsystem. I have to admit that I didn't notice >>> that one in the large collection of knobs and switches... :-( >>> >>> >>>> - Use ObjectMonitor::Knob_ExitRelease to control whether Java >>>> threads are checked for locked monitors when they exit >>>> - Use ObjectMonitor::Knob_VerifyMatch to control whether finding a >>>> locked (hence unmatched) monitor causes an abort >>>> >>>> That seems like a good way to work within the existing mechanism for >>>> customizing the sync logic - and no new global options (though SQE >>>> will still need tests for using these knobs I think). >>> >>> Glad that this version is more acceptable. >>> >>> >>>> Some specific comments below ... >>>> >>>>> This work is being tracked by the following bug ID: >>>>> >>>>> JDK-8130448 8077392 inspired thread dump improvements, comment >>>>> additions, new diagnostics >>>>> https://bugs.openjdk.java.net/browse/JDK-8130448 >>>>> >>>>> Here is the webrev URL: >>>>> >>>>> http://cr.openjdk.java.net/~dcubed/8130448-webrev/1-jdk9-hs-rt/ >>>> >>>> src/share/vm/runtime/objectMonitor.cpp >>>> >>>> 2393 if (Knob_ReportSettings && v != NULL) { >>>> 2394 tty->print_cr("INFO: SyncKnob: %s %d(%d)", Key, rslt, >>>> Default) ; >>>> 2395 tty->flush(); >>>> 2396 } >>>> >>>> I suspect these were not tty using because this might get called >>>> before the tty has been initialized - but I can't see how that might >>>> arise (nor can I be certain it can't). >>> >>> I couldn't see how tty could not be initialized at these points either. >>> My current plan is to go with this change to 'tty' and if we run into >>> an early use case, then we do something else _and_ comment it. >>> >>> Although with unified logging coming... this may be moot (but the >>> tty version will be easier to port...) >>> >>> >>>> >>>> Ditto for similar changes throughout. >>>> >>>> --- >>>> >>>> src/share/vm/runtime/synchronizer.cpp >>>> >>>> 1648 void do_monitor(ObjectMonitor* mid) { >>>> 1649 if (mid->owner() == THREAD) { >>>> 1650 if (ObjectMonitor::Knob_VerifyMatch != 0) { >>>> 1651 Handle obj((oop) mid->object()); >>>> 1652 tty->print("INFO: unexpected locked object:"); >>>> 1653 javaVFrame::print_locked_object_class_name(tty, obj, >>>> "locked"); >>>> 1654 } >>>> 1655 guarantee(ObjectMonitor::Knob_VerifyMatch == 0, >>>> 1656 err_msg("exiting JavaThread=" INTPTR_FORMAT >>>> 1657 " unexpectedly owns ObjectMonitor=" >>>> INTPTR_FORMAT, >>>> 1658 THREAD, mid)); >>>> 1659 (void)mid->complete_exit(CHECK); >>>> 1660 } >>>> 1661 } >>>> >>>> Took me a while to figure out the expected control flow here. >>>> Doesn't the above simplify to: >>>> >>>> void do_monitor(ObjectMonitor* mid) { >>>> if (mid->owner() == THREAD) { >>>> if (ObjectMonitor::Knob_VerifyMatch != 0) { >>>> Handle obj((oop) mid->object()); >>>> tty->print("INFO: unexpected locked object:"); >>>> javaVFrame::print_locked_object_class_name(tty, obj, >>>> "locked"); >>>> fatal(err_msg("exiting JavaThread=" INTPTR_FORMAT >>>> " unexpectedly owns ObjectMonitor=" INTPTR_FORMAT, >>>> THREAD, mid)); >>>> } >>>> (void)mid->complete_exit(CHECK); >>>> } >>>> } >>>> >>>> ? >>> >>> Yes, your version is cleaner. >>> >>> Any particular reason to use "fatal(...)" instead of >>> "guarantee(false, ...)". I've seen both... >>> >>> Dan >>> >>> >>>> >>>> Thanks, >>>> David >>>> >>>>> >>>>> The easiest way to review the delta is to download the two patch >>>>> files and compare them in something like jfilemerge: >>>>> >>>>> http://cr.openjdk.java.net/~dcubed/8130448-webrev/0-jdk9-hs-rt/hotspot.patch >>>>> >>>>> >>>>> http://cr.openjdk.java.net/~dcubed/8130448-webrev/1-jdk9-hs-rt/hotspot.patch >>>>> >>>>> >>>>> >>>>> Testing: >>>>> >>>>> - Aurora Adhoc RT/SVC nightly batches (in process) >>>>> - JPRT test jobs >>>>> >>>>> Thanks, in advance, for any comments, questions or suggestions. >>>>> >>>>> Gory details about the changes are below... >>>>> >>>>> Dan >>>>> >>>>> Changes between CR0 and CR1 are: >>>>> >>>>> src/cpu/x86/vm/macroAssembler_x86.cpp >>>>> >>>>> - fix comment typos, clarify comment wording >>>>> >>>>> src/share/vm/oops/markOop.cpp >>>>> >>>>> - clarify output messages >>>>> - get rid of confusing local variable >>>>> >>>>> src/share/vm/runtime/globals.hpp >>>>> >>>>> - drop VerboseStackTrace, GuaranteeOnMonitorMismatch >>>>> and JavaThreadExitReleasesMonitors options >>>>> - there are no longer changes to this file >>>>> >>>>> src/share/vm/runtime/objectMonitor.cpp >>>>> >>>>> - add ObjectMonitor::Knob_ExitRelease suboption to replace >>>>> JavaThreadExitReleasesMonitors >>>>> - add ObjectMonitor::Knob_VerifyMatch suboption to replace >>>>> GuaranteeOnMonitorMismatch >>>>> - cleanup messy logging: >>>>> - switch from '::printf()' -> 'tty->print_cr()' >>>>> - switch from '::fflush()' -> 'tty->flush()' >>>>> >>>>> src/share/vm/runtime/objectMonitor.hpp >>>>> >>>>> - add ObjectMonitor::Knob_ExitRelease suboption >>>>> - add ObjectMonitor::Knob_VerifyMatch suboption >>>>> - cleanup messy logging >>>>> >>>>> src/share/vm/runtime/synchronizer.cpp >>>>> >>>>> - cleanup messy logging >>>>> - switch from GuaranteeOnMonitorMismatch to >>>>> ObjectMonitor::Knob_VerifyMatch >>>>> - add diagnostic information about the locked object >>>>> when ReleaseJavaMonitorsClosure::do_monitor() finds >>>>> a problem >>>>> >>>>> src/share/vm/runtime/thread.cpp >>>>> >>>>> - clarify comments >>>>> - switch from JavaThreadExitReleasesMonitors to >>>>> ObjectMonitor::Knob_ExitRelease >>>>> >>>>> src/share/vm/runtime/vframe.cpp >>>>> >>>>> - print_locked_object_class_name() is now public >>>>> - clarify comments >>>>> - clarify output messages >>>>> - switch from VerboseStackTrace to the already existing >>>>> ObjectMonitor::Knob_Verbose >>>>> >>>>> src/share/vm/runtime/vframe.hpp >>>>> >>>>> - print_locked_object_class_name() is now public >>>>> >>>>> >>>>> On 7/3/15 6:14 PM, Daniel D. Daugherty wrote: >>>>>> Greetings, >>>>>> >>>>>> The hunt for the following bug: >>>>>> >>>>>> JDK-8077392 Stream fork/join tasks occasionally fail to complete >>>>>> >>>>>> and David C's work on the following bug: >>>>>> >>>>>> JDK-8069412 Locks need better debug-printing support >>>>>> >>>>>> have inspired additional thread dump improvements, comment additions >>>>>> to some Java monitor code and some new diagnostic options. >>>>>> >>>>>> This work is being tracked by the following bug ID: >>>>>> >>>>>> JDK-8130448 8077392 inspired thread dump improvements, comment >>>>>> additions, new diagnostics >>>>>> https://bugs.openjdk.java.net/browse/JDK-8130448 >>>>>> >>>>>> Here is the webrev URL: >>>>>> >>>>>> http://cr.openjdk.java.net/~dcubed/8130448-webrev/0-jdk9-hs-rt/ >>>>>> >>>>>> Testing: >>>>>> >>>>>> - RBT vm.quick batches (in process) >>>>>> - JPRT test jobs >>>>>> >>>>>> Thanks, in advance, for any comments, questions or suggestions. >>>>>> >>>>>> Gory details about the changes are below... >>>>>> >>>>>> Dan >>>>>> >>>>>> 8130448 summary of changes: >>>>>> >>>>>> src/cpu/x86/vm/macroAssembler_x86.cpp >>>>>> - comment additions for the assembly code >>>>>> >>>>>> src/share/vm/oops/markOop.cpp >>>>>> - has_monitor() has to be checked before is_locked() since >>>>>> the has_monitor() bits are a superset of the is_locked() bits >>>>>> - code style fixes >>>>>> >>>>>> src/share/vm/runtime/globals.hpp >>>>>> - add VerboseStackTrace diagnostic option >>>>>> - add GuaranteeOnMonitorMismatch diagnostic option >>>>>> - add JavaThreadExitReleasesMonitors product option; >>>>>> this is the Java equivalent of JNIDetachReleasesMonitors >>>>>> >>>>>> src/share/vm/runtime/objectMonitor.cpp >>>>>> - delete unused ObjectMonitor::try_enter() >>>>>> - fix assert wording >>>>>> >>>>>> src/share/vm/runtime/objectMonitor.hpp >>>>>> - delete unused ObjectMonitor::try_enter() >>>>>> >>>>>> src/share/vm/runtime/synchronizer.cpp >>>>>> - add GuaranteeOnMonitorMismatch support with some >>>>>> diagnostic output >>>>>> >>>>>> src/share/vm/runtime/thread.cpp >>>>>> - add JavaThreadExitReleasesMonitors support >>>>>> >>>>>> src/share/vm/runtime/vframe.cpp >>>>>> - clarify existing comments >>>>>> - add comments to clarify what "waiting on" means >>>>>> - add line to show when we are "waiting on", but >>>>>> there are no locals available (previously we were >>>>>> "waiting on" silently) >>>>>> - add support for "waiting to relock" which can happen >>>>>> for any of the monitors and not just the top monitor >>>>>> - switch mark->print_on() verbose output to new >>>>>> VerboseStackTrace switch; thread dumps are not enabled >>>>>> with a specific switch so the '-XX:+Verbose' model of >>>>>> being a modifier for another option does not fit >>>>>> >>>>>> >>>>> >>> >>> >> > From daniel.daugherty at oracle.com Fri Jul 10 00:22:52 2015 From: daniel.daugherty at oracle.com (Daniel D. Daugherty) Date: Thu, 09 Jul 2015 18:22:52 -0600 Subject: RFR(S) 8130448: thread dump improvements, comment, additions, new diagnostics inspired by 8077392 In-Reply-To: <559F0F0D.6080108@oracle.com> References: <55972558.6060905@oracle.com> <559D970E.7000905@oracle.com> <559E1611.2070803@oracle.com> <559E7259.1070605@oracle.com> <559E7D5A.2040900@oracle.com> <559E8110.40706@oracle.com> <559F0F0D.6080108@oracle.com> Message-ID: <559F105C.5020606@oracle.com> Thanks! Dan On 7/9/15 6:17 PM, David Holmes wrote: > Sorry I missed this update before previous reply. > > Thumbs up! > > David > > On 10/07/2015 12:11 AM, Daniel D. Daugherty wrote: >> On 7/9/15 7:55 AM, Daniel D. Daugherty wrote: >>> > Any particular reason to use "fatal(...)" instead of >>> > "guarantee(false, ...)". I've seen both... >>> >>> Answering my own question... :-) >>> >>> fatal() and guarantee() both reach the same place (report_vm_error()) >>> with the same bells-and-whistles on the way... >>> >>> So "guarantee(false, ...)" is the same as "fatal(...)" >>> so I'll switch to the more direct "fatal(...)". >>> >>> I don't think that change requires a re-review, please let me know >>> if you disagree... >> >> Sigh... I meant "webrev"... Here's the diffs: >> >> $ diff -c src/share/vm/runtime/synchronizer.cpp{.cr1,} >> *** src/share/vm/runtime/synchronizer.cpp.cr1 Wed Jul 8 07:15:07 2015 >> --- src/share/vm/runtime/synchronizer.cpp Thu Jul 9 07:07:28 2015 >> *************** >> *** 1651,1661 **** >> Handle obj((oop) mid->object()); >> tty->print("INFO: unexpected locked object:"); >> javaVFrame::print_locked_object_class_name(tty, obj, >> "locked"); >> } >> - guarantee(ObjectMonitor::Knob_VerifyMatch == 0, >> - err_msg("exiting JavaThread=" INTPTR_FORMAT >> - " unexpectedly owns ObjectMonitor=" >> INTPTR_FORMAT, >> - THREAD, mid)); >> (void)mid->complete_exit(CHECK); >> } >> } >> --- 1651,1660 ---- >> Handle obj((oop) mid->object()); >> tty->print("INFO: unexpected locked object:"); >> javaVFrame::print_locked_object_class_name(tty, obj, >> "locked"); >> + fatal(err_msg("exiting JavaThread=" INTPTR_FORMAT >> + " unexpectedly owns ObjectMonitor=" >> INTPTR_FORMAT, >> + THREAD, mid)); >> } >> (void)mid->complete_exit(CHECK); >> } >> } >> >> Dan >> >> >>> >>> Dan >>> >>> >>> On 7/9/15 7:08 AM, Daniel D. Daugherty wrote: >>>> David, >>>> >>>> Thanks for the quick re-review! >>>> >>>> Responses embedded below... >>>> >>>> On 7/9/15 12:34 AM, David Holmes wrote: >>>>> Hi Dan, >>>>> >>>>> On 9/07/2015 7:33 AM, Daniel D. Daugherty wrote: >>>>>> Greetings, >>>>>> >>>>>> I've updated this patch based on David H's comments along with >>>>>> some additional cleanup. >>>>> >>>>> So to address the high-level changes: >>>>> >>>>> - Use ObjectMonitor::Knob_Verbose as the verbosity flag for printing >>>>> the lockbits in the stack dump. Okay - though I do wonder why the >>>>> SyncVerbose flag also exists? >>>> >>>> I'll ping Dice to see if there's a reason for two different verbose >>>> flags in the monitor subsystem. I have to admit that I didn't notice >>>> that one in the large collection of knobs and switches... :-( >>>> >>>> >>>>> - Use ObjectMonitor::Knob_ExitRelease to control whether Java >>>>> threads are checked for locked monitors when they exit >>>>> - Use ObjectMonitor::Knob_VerifyMatch to control whether finding a >>>>> locked (hence unmatched) monitor causes an abort >>>>> >>>>> That seems like a good way to work within the existing mechanism for >>>>> customizing the sync logic - and no new global options (though SQE >>>>> will still need tests for using these knobs I think). >>>> >>>> Glad that this version is more acceptable. >>>> >>>> >>>>> Some specific comments below ... >>>>> >>>>>> This work is being tracked by the following bug ID: >>>>>> >>>>>> JDK-8130448 8077392 inspired thread dump improvements, comment >>>>>> additions, new diagnostics >>>>>> https://bugs.openjdk.java.net/browse/JDK-8130448 >>>>>> >>>>>> Here is the webrev URL: >>>>>> >>>>>> http://cr.openjdk.java.net/~dcubed/8130448-webrev/1-jdk9-hs-rt/ >>>>> >>>>> src/share/vm/runtime/objectMonitor.cpp >>>>> >>>>> 2393 if (Knob_ReportSettings && v != NULL) { >>>>> 2394 tty->print_cr("INFO: SyncKnob: %s %d(%d)", Key, rslt, >>>>> Default) ; >>>>> 2395 tty->flush(); >>>>> 2396 } >>>>> >>>>> I suspect these were not tty using because this might get called >>>>> before the tty has been initialized - but I can't see how that might >>>>> arise (nor can I be certain it can't). >>>> >>>> I couldn't see how tty could not be initialized at these points >>>> either. >>>> My current plan is to go with this change to 'tty' and if we run into >>>> an early use case, then we do something else _and_ comment it. >>>> >>>> Although with unified logging coming... this may be moot (but the >>>> tty version will be easier to port...) >>>> >>>> >>>>> >>>>> Ditto for similar changes throughout. >>>>> >>>>> --- >>>>> >>>>> src/share/vm/runtime/synchronizer.cpp >>>>> >>>>> 1648 void do_monitor(ObjectMonitor* mid) { >>>>> 1649 if (mid->owner() == THREAD) { >>>>> 1650 if (ObjectMonitor::Knob_VerifyMatch != 0) { >>>>> 1651 Handle obj((oop) mid->object()); >>>>> 1652 tty->print("INFO: unexpected locked object:"); >>>>> 1653 javaVFrame::print_locked_object_class_name(tty, obj, >>>>> "locked"); >>>>> 1654 } >>>>> 1655 guarantee(ObjectMonitor::Knob_VerifyMatch == 0, >>>>> 1656 err_msg("exiting JavaThread=" INTPTR_FORMAT >>>>> 1657 " unexpectedly owns ObjectMonitor=" >>>>> INTPTR_FORMAT, >>>>> 1658 THREAD, mid)); >>>>> 1659 (void)mid->complete_exit(CHECK); >>>>> 1660 } >>>>> 1661 } >>>>> >>>>> Took me a while to figure out the expected control flow here. >>>>> Doesn't the above simplify to: >>>>> >>>>> void do_monitor(ObjectMonitor* mid) { >>>>> if (mid->owner() == THREAD) { >>>>> if (ObjectMonitor::Knob_VerifyMatch != 0) { >>>>> Handle obj((oop) mid->object()); >>>>> tty->print("INFO: unexpected locked object:"); >>>>> javaVFrame::print_locked_object_class_name(tty, obj, >>>>> "locked"); >>>>> fatal(err_msg("exiting JavaThread=" INTPTR_FORMAT >>>>> " unexpectedly owns ObjectMonitor=" INTPTR_FORMAT, >>>>> THREAD, mid)); >>>>> } >>>>> (void)mid->complete_exit(CHECK); >>>>> } >>>>> } >>>>> >>>>> ? >>>> >>>> Yes, your version is cleaner. >>>> >>>> Any particular reason to use "fatal(...)" instead of >>>> "guarantee(false, ...)". I've seen both... >>>> >>>> Dan >>>> >>>> >>>>> >>>>> Thanks, >>>>> David >>>>> >>>>>> >>>>>> The easiest way to review the delta is to download the two patch >>>>>> files and compare them in something like jfilemerge: >>>>>> >>>>>> http://cr.openjdk.java.net/~dcubed/8130448-webrev/0-jdk9-hs-rt/hotspot.patch >>>>>> >>>>>> >>>>>> >>>>>> http://cr.openjdk.java.net/~dcubed/8130448-webrev/1-jdk9-hs-rt/hotspot.patch >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> Testing: >>>>>> >>>>>> - Aurora Adhoc RT/SVC nightly batches (in process) >>>>>> - JPRT test jobs >>>>>> >>>>>> Thanks, in advance, for any comments, questions or suggestions. >>>>>> >>>>>> Gory details about the changes are below... >>>>>> >>>>>> Dan >>>>>> >>>>>> Changes between CR0 and CR1 are: >>>>>> >>>>>> src/cpu/x86/vm/macroAssembler_x86.cpp >>>>>> >>>>>> - fix comment typos, clarify comment wording >>>>>> >>>>>> src/share/vm/oops/markOop.cpp >>>>>> >>>>>> - clarify output messages >>>>>> - get rid of confusing local variable >>>>>> >>>>>> src/share/vm/runtime/globals.hpp >>>>>> >>>>>> - drop VerboseStackTrace, GuaranteeOnMonitorMismatch >>>>>> and JavaThreadExitReleasesMonitors options >>>>>> - there are no longer changes to this file >>>>>> >>>>>> src/share/vm/runtime/objectMonitor.cpp >>>>>> >>>>>> - add ObjectMonitor::Knob_ExitRelease suboption to replace >>>>>> JavaThreadExitReleasesMonitors >>>>>> - add ObjectMonitor::Knob_VerifyMatch suboption to replace >>>>>> GuaranteeOnMonitorMismatch >>>>>> - cleanup messy logging: >>>>>> - switch from '::printf()' -> 'tty->print_cr()' >>>>>> - switch from '::fflush()' -> 'tty->flush()' >>>>>> >>>>>> src/share/vm/runtime/objectMonitor.hpp >>>>>> >>>>>> - add ObjectMonitor::Knob_ExitRelease suboption >>>>>> - add ObjectMonitor::Knob_VerifyMatch suboption >>>>>> - cleanup messy logging >>>>>> >>>>>> src/share/vm/runtime/synchronizer.cpp >>>>>> >>>>>> - cleanup messy logging >>>>>> - switch from GuaranteeOnMonitorMismatch to >>>>>> ObjectMonitor::Knob_VerifyMatch >>>>>> - add diagnostic information about the locked object >>>>>> when ReleaseJavaMonitorsClosure::do_monitor() finds >>>>>> a problem >>>>>> >>>>>> src/share/vm/runtime/thread.cpp >>>>>> >>>>>> - clarify comments >>>>>> - switch from JavaThreadExitReleasesMonitors to >>>>>> ObjectMonitor::Knob_ExitRelease >>>>>> >>>>>> src/share/vm/runtime/vframe.cpp >>>>>> >>>>>> - print_locked_object_class_name() is now public >>>>>> - clarify comments >>>>>> - clarify output messages >>>>>> - switch from VerboseStackTrace to the already existing >>>>>> ObjectMonitor::Knob_Verbose >>>>>> >>>>>> src/share/vm/runtime/vframe.hpp >>>>>> >>>>>> - print_locked_object_class_name() is now public >>>>>> >>>>>> >>>>>> On 7/3/15 6:14 PM, Daniel D. Daugherty wrote: >>>>>>> Greetings, >>>>>>> >>>>>>> The hunt for the following bug: >>>>>>> >>>>>>> JDK-8077392 Stream fork/join tasks occasionally fail to >>>>>>> complete >>>>>>> >>>>>>> and David C's work on the following bug: >>>>>>> >>>>>>> JDK-8069412 Locks need better debug-printing support >>>>>>> >>>>>>> have inspired additional thread dump improvements, comment >>>>>>> additions >>>>>>> to some Java monitor code and some new diagnostic options. >>>>>>> >>>>>>> This work is being tracked by the following bug ID: >>>>>>> >>>>>>> JDK-8130448 8077392 inspired thread dump improvements, comment >>>>>>> additions, new diagnostics >>>>>>> https://bugs.openjdk.java.net/browse/JDK-8130448 >>>>>>> >>>>>>> Here is the webrev URL: >>>>>>> >>>>>>> http://cr.openjdk.java.net/~dcubed/8130448-webrev/0-jdk9-hs-rt/ >>>>>>> >>>>>>> Testing: >>>>>>> >>>>>>> - RBT vm.quick batches (in process) >>>>>>> - JPRT test jobs >>>>>>> >>>>>>> Thanks, in advance, for any comments, questions or suggestions. >>>>>>> >>>>>>> Gory details about the changes are below... >>>>>>> >>>>>>> Dan >>>>>>> >>>>>>> 8130448 summary of changes: >>>>>>> >>>>>>> src/cpu/x86/vm/macroAssembler_x86.cpp >>>>>>> - comment additions for the assembly code >>>>>>> >>>>>>> src/share/vm/oops/markOop.cpp >>>>>>> - has_monitor() has to be checked before is_locked() since >>>>>>> the has_monitor() bits are a superset of the is_locked() bits >>>>>>> - code style fixes >>>>>>> >>>>>>> src/share/vm/runtime/globals.hpp >>>>>>> - add VerboseStackTrace diagnostic option >>>>>>> - add GuaranteeOnMonitorMismatch diagnostic option >>>>>>> - add JavaThreadExitReleasesMonitors product option; >>>>>>> this is the Java equivalent of JNIDetachReleasesMonitors >>>>>>> >>>>>>> src/share/vm/runtime/objectMonitor.cpp >>>>>>> - delete unused ObjectMonitor::try_enter() >>>>>>> - fix assert wording >>>>>>> >>>>>>> src/share/vm/runtime/objectMonitor.hpp >>>>>>> - delete unused ObjectMonitor::try_enter() >>>>>>> >>>>>>> src/share/vm/runtime/synchronizer.cpp >>>>>>> - add GuaranteeOnMonitorMismatch support with some >>>>>>> diagnostic output >>>>>>> >>>>>>> src/share/vm/runtime/thread.cpp >>>>>>> - add JavaThreadExitReleasesMonitors support >>>>>>> >>>>>>> src/share/vm/runtime/vframe.cpp >>>>>>> - clarify existing comments >>>>>>> - add comments to clarify what "waiting on" means >>>>>>> - add line to show when we are "waiting on", but >>>>>>> there are no locals available (previously we were >>>>>>> "waiting on" silently) >>>>>>> - add support for "waiting to relock" which can happen >>>>>>> for any of the monitors and not just the top monitor >>>>>>> - switch mark->print_on() verbose output to new >>>>>>> VerboseStackTrace switch; thread dumps are not enabled >>>>>>> with a specific switch so the '-XX:+Verbose' model of >>>>>>> being a modifier for another option does not fit >>>>>>> >>>>>>> >>>>>> >>>> >>>> >>> >> From jeremymanson at google.com Fri Jul 10 00:23:52 2015 From: jeremymanson at google.com (Jeremy Manson) Date: Thu, 9 Jul 2015 17:23:52 -0700 Subject: RFR: 8079301: Some command line options not settable via JAVA_TOOL_OPTIONS In-Reply-To: <559EED17.4060109@oracle.com> References: <554839B4.3020800@oracle.com> <559D237C.2060702@oracle.com> <559EED17.4060109@oracle.com> Message-ID: Hey Dmitry, Thanks for looking at it. The leak was deliberate (under the theory that the command line flags were leaked, too), but it was silly that I didn't fix it. Anyway, fixed. See: http://cr.openjdk.java.net/~jmanson/8079301/webrev.03 Jeremy On Thu, Jul 9, 2015 at 2:52 PM, Dmitry Dmitriev wrote: > Hello Jeremy, > > Correct me if I am wrong, but I see small memory leak in your > implementation. > In Arguments::parse_options_environment_variable function memory for > 'buffer' allocated by strdup function on line 3415, but now it not freed in > this function because data from this buffer is used later. On the other > hand when we are done with env variables, we free only options array(lines > 3703-3705) and not free previously allocated memory for 'buffer' because we > lost track for it. > > Thanks, > Dmitry > > > On 09.07.2015 21:20, Jeremy Manson wrote: > >> Thanks for looking at this, Coleen. >> >> I merged this with the latest version of hs-rt, but Ron is or I am going >> to >> have to do some merging for 8061999. The changes are relatively >> orthogonal, but they touch a couple of the same places. How far away is >> Ron's checkin? >> >> Updated webrev: >> >> http://cr.openjdk.java.net/~jmanson/8079301/webrev.01/ >> >> Updated test: >> >> http://cr.openjdk.java.net/~jmanson/8079301t/webrev.01/ >> >> (Mild complaining on my part: the conflicts wouldn't have been an issue if >> someone had looked at this two months ago, when I first asked. I suspect >> Ron hadn't even started his change at that point. And if external >> developers were able to submit changes to Hotspot, we wouldn't have had to >> bother Oracle engineers at all. Neither of these is your fault or your >> problem, of course - I'm grateful you were able to take a look.) >> >> Jeremy >> >> On Wed, Jul 8, 2015 at 6:19 AM, Coleen Phillimore < >> coleen.phillimore at oracle.com> wrote: >> >> I'll sponsor it but can you repost the RFR? >>> >>> There has been a fair bit of work to command line processing lately so >>> I'd >>> like to have the others look at it too. Have you merged this up with the >>> latest version of hs-rt repository and were there conflicts? Also, have >>> you looked at the RFR: >>> >>> "Open code review for 8061999 Enhance VM option parsing to allow options >>> to be specified" >>> >>> and are there conflicts with this? >>> >>> The hotspot change looks good to me. >>> >>> >>> >>> http://cr.openjdk.java.net/~jmanson/8079301t/webrev.00/test/com/sun/management/HotSpotDiagnosticMXBean/CheckOrigin.java.udiff.html >>> >>> "UseCerealGC" LOL >>> Can you use a different option than PrintOopAddress in this test? I >>> don't >>> know why this command line option exists or would be useful for, and >>> seems >>> to be a good candidate for removal. If you need a valid argument, that >>> is >>> unlikely to go away, TraceExceptions would be good. >>> >>> Thanks, >>> Coleen >>> >>> >>> On 7/7/15 8:00 PM, Jeremy Manson wrote: >>> >>> No love? Is there a code owner here I should pester more directly? >>>> >>>> Jeremy >>>> >>>> On Fri, Jun 26, 2015 at 3:00 PM, Martin Buchholz >>>> wrote: >>>> >>>> As usual with Google patches, they are in use locally. This one has >>>> been >>>> >>>>> stable for a while without complaints. Please sponsor. >>>>> >>>>> On Fri, Jun 26, 2015 at 1:53 PM, Jeremy Manson < >>>>> jeremymanson at google.com> >>>>> wrote: >>>>> >>>>> All this talk about IgnoreUnrecognizedVMOptions reminded me that this >>>>> >>>>>> review is still outstanding. Any takers? >>>>>> >>>>>> Jeremy >>>>>> >>>>>> On Tue, May 5, 2015 at 10:01 AM, Jeremy Manson < >>>>>> jeremymanson at google.com >>>>>> wrote: >>>>>> >>>>>> Hi David, >>>>>> >>>>>>> Thanks for taking a look. >>>>>>> >>>>>>> On Mon, May 4, 2015 at 8:32 PM, David Holmes < >>>>>>> david.holmes at oracle.com> >>>>>>> wrote: >>>>>>> >>>>>>> Hi Jeremy, >>>>>>> >>>>>>>> On 5/05/2015 6:51 AM, Jeremy Manson wrote: >>>>>>>> >>>>>>>> Not sure who might be willing to sponsor this. David? You did >>>>>>>> the >>>>>>>> >>>>>>>>> last >>>>>>>>> one. :) >>>>>>>>> >>>>>>>>> Might be a while before I can get to it. I did have a quick look >>>>>>>>> >>>>>>>> (and >>>>>>>> will need a longer one). >>>>>>>> >>>>>>>> I understand. I'm just happy it's possible to upstream this stuff >>>>>>> at >>>>>>> all[1]. >>>>>>> >>>>>>> [1] With the eternal caveat that I'd be happier if we didn't *have* >>>>>>> to >>>>>>> go through you folks, but we've learned to live with it. >>>>>>> >>>>>>> >>>>>>> >>>>>>> Context: A number of command line options are not settable via >>>>>>> >>>>>>>> JAVA_TOOL_OPTIONS and _JAVA_OPTIONS: >>>>>>>>> >>>>>>>>> - PrintVMOptions >>>>>>>>> >>>>>>>>> So you have changed the semantics of this to print out the >>>>>>>>> options >>>>>>>>> >>>>>>>> from >>>>>>>> the command-line and each of the two env vars. Seems reasonable but >>>>>>>> may be >>>>>>>> better to know which option came from where as we can now see the >>>>>>>> same >>>>>>>> option (or conflicting variants thereof) multiple times. >>>>>>>> >>>>>>>> I'd be happy to do this. Any preferred syntax? Does someone >>>>>>>> >>>>>>> actually >>>>>>> own this feature? >>>>>>> >>>>>>> I'm unclear what the current processing order is for the different >>>>>>> >>>>>>> sources of options, and whether the changes affect that order? >>>>>>>> >>>>>>>> Nope. I go through sad contortions to keep the processing order >>>>>>>> the >>>>>>>> >>>>>>> same. It's JAVA_TOOL_OPTIONS, then command line, then _JAVA_OPTIONS. >>>>>>> See >>>>>>> lines 2549-2567. >>>>>>> >>>>>>> >>>>>>> - IgnoreUnrecognizedVMOptions >>>>>>> >>>>>>>> - PrintFlagsInitial >>>>>>>>> >>>>>>>>> Unclear what "initial" actually means - is it the default? >>>>>>>>> >>>>>>>> More or less. If you stick, for example, >>>>>>> IgnoreUnrecognizedVMOptions >>>>>>> in >>>>>>> there first, it will get printed out as "true". I haven't really >>>>>>> changed >>>>>>> the semantics here either - I've just added processing of the >>>>>>> envvars. >>>>>>> >>>>>>> - NativeMemoryTracking >>>>>>> >>>>>>> - PrintFlagsWithComments >>>>>>>> >>>>>>>>> This is because these flags have to be processed before processing >>>>>>>>> other >>>>>>>>> flags, and no one ever bothered to do that for the flags coming >>>>>>>>> from >>>>>>>>> environment variables. This patch fixes that problem. >>>>>>>>> >>>>>>>>> I have a test, but it is a modification to a JDK test instead of a >>>>>>>>> HS >>>>>>>>> test, >>>>>>>>> so it can go in separately (I guess). >>>>>>>>> >>>>>>>>> They can be pushed together to different repos in the same >>>>>>>>> forest. >>>>>>>>> >>>>>>>> Okay. Here's the test change: >>>>>>>> >>>>>>> http://cr.openjdk.java.net/~jmanson/8079301t/webrev.00/ >>>>>>> >>>>>>> >>>>>>> As I said I'll have to get back to this. And hopefully someone >>>>>>> else in >>>>>>> >>>>>>>> runtime will take a good look as well ;-) >>>>>>>> >>>>>>>> I'd be happy to toss it over to whomever owns this, if anyone. >>>>>>>> >>>>>>> Thanks! >>>>>>> >>>>>>> Jeremy >>>>>>> >>>>>>> >>>>>>> >>>>>>> Bug: >>>>>>> >>>>>>>> https://bugs.openjdk.java.net/browse/JDK-8079301 >>>>>>>>> >>>>>>>>> Webrev: >>>>>>>>> http://cr.openjdk.java.net/~jmanson/8079301/webrev.00/ >>>>>>>>> >>>>>>>>> Jeremy >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> > From yumin.qi at oracle.com Fri Jul 10 04:34:35 2015 From: yumin.qi at oracle.com (Yumin Qi) Date: Thu, 09 Jul 2015 21:34:35 -0700 Subject: RFR: 8025692: Add trace to find out what methods are used at runtime. In-Reply-To: References: <5514C1CB.7020009@oracle.com> <55711388.4090402@oracle.com> Message-ID: <559F4B5B.60203@oracle.com> Hi, Karen Just informed you that RBT testing for quick testing seems will not get back a completed result(I have tried several times those days). After 11 hours, there still 4 jobs running: 26 of 34 succeeded, 4 failed, 4 still running. Those running jobs already run at least 6+ hours. The 4 failed jobs are dtrace on linux-x64 which are OK, since dtrace is disabled on it. Also, I added -Xint to test case, and tested with jtreg on test/runtime showed no new failures found. I am going to push the changes if you are OK with current result. Seems the testing with RBT will never come back. Updated webrev: http://cr.openjdk.java.net/~minqi/8025692/webrev02/ Thanks Yumin On 6/18/2015 1:01 PM, Karen Kinnear wrote: > Yumin, > > Thank you very much for the updates.And the PERM_REFCOUNT rather than -1 :-) > Looks good. > > Thank you for testing this -Xint. If there is an easy way to add an -Xint line > to the test that would be useful - but not critical. > > So I presume that the "aurora default test suites" includes: > jcks, jtreg hotspot and Christian's new "quick" tests. > > thanks, > Karen > > On Jun 4, 2015, at 11:12 PM, Yumin Qi wrote: > >> HI, All >> >> After several round of codereviews and discussion, now the second version is at: >> http://cr.openjdk.java.net/~minqi/8025692/webrev02/ >> >> The flag names changed: >> >> TraceMethodUsge => LogTouchedMethods >> PrintMethodUsageAtExit => PrintTouchedMethodsAtExit >> >> The two flags now are diagnostic flags. >> >> Also similar, there changed in related variable names. >> Also fixed a flaw which is not found during last round of review: append new TouchedMethodRecord to end of hash bucket list. >> >> Make change to interpreter method entry generation(for both native and normal) to enable build_method_counter called. This is necessary since if run -Xint, the call will be skipped so our code will be skipped so no logging for touched methods. >> >> Added test case for jcmd: jcmd VM.print_touched_methods. >> >> Tests: JPRT, aurora default test suites (in progress). >> >> Thanks >> Yumin >> >> >> On 3/26/2015 7:34 PM, Yumin Qi wrote: >>> Please review: >>> >>> bug: https://bugs.openjdk.java.net/browse/JDK-8025692 >>> webrev: http://cr.openjdk.java.net/~minqi/8025692/webrev01/ >>> >>> Summary: Add two flags to help list all java methods called in runtime, this is also in product and can help CDS to rearrange methods in shared archive to avoid loading infrequent methods into memory. >>> >>> Tests: vm.runtime.quick.testlist, JPRT >>> >>> >>> Thanks >>> Yumin >>> >>> From david.holmes at oracle.com Fri Jul 10 05:56:48 2015 From: david.holmes at oracle.com (David Holmes) Date: Fri, 10 Jul 2015 15:56:48 +1000 Subject: Open code review for 8061999 Enhance VM option parsing to allow options to be specified In-Reply-To: <5589B912.2050003@oracle.com> References: <3d1df3cb-fe69-4c3b-b8e1-db8801d5a68f@default> <5589B912.2050003@oracle.com> Message-ID: <559F5EA0.2080500@oracle.com> Is there an updated webrev addressing Gerard's comments? Thanks, David On 24/06/2015 5:52 AM, Gerard Ziemski wrote: > hi Ron, > > I'm sending you partial feedback, since I am starting to get a bit > tired. I will spend more time reviewing your webrev tomorrow, but here > is what I have so far: > > --- > src/share/vm/utilities/globalDefinitions.hpp > > 1. Should we name the method "is_white()", not "iswhite()" since it's > part of our code base? But then since it's a macro, shouldn't it > actually be "IS_WHITE()"? > > --- > src/share/vm/runtime/arguments.hpp > > 1. > > All the arguments in alloc_JVM_options_list(), > copy_JVM_options_from_buf() and parse_JVM_options_file() use underscores > in the arguments names except for merge_JVM_options_file(). I think the > merge_JVM_options_file() should be: > > + static jint merge_JVM_options_file(const struct JavaVMInitArgs *args_in, > + struct JavaVMInitArgs **args_out); > > > --- > src/share/vm/runtime/arguments.cpp > > 1. Why do FreeVMOptions, DumpVMOptions, DumpVMOption and DumpOption > start with capital letters? Shouldn?t their names start with a lower > case letter? > > 2. Line 4306. The pattern in Arguments::parse() seems to be to print out > error message and return the error value if something goes wrong, but we > do vm_exit(1) instead? > > 3. Line 4309. I was told that when it comes to NULL pointer check we > should do (NULL == args), not the other way around. > > 4. Line 4375. Don't we need FreeVMOptions() here? Line 4382 as well? > > 5. Question. Why do we need N_MAX_OPTIONS? > > 6. Question. Why do we need OPTION_BUFFER_SIZE? Can?t we use ?int > bytes_needed = fseek(stream, 0, SEEK_END); rewind(stream)? and have the > code dynamically allocate memory without hard coded limits? > > 7. Line 3965. Can that comparison ever succeed? ?read()? will not read > more bytes (only less) than as specified by ?bytes_alloc? and if it did, > we would overwrite memory since our buf is only ?bytes_alloc? big. > > > > cheers > > > On 6/22/2015 7:52 AM, Ron Durbin wrote: >> Webrev URL: >> http://cr.openjdk.java.net/~rdurbin/8061999_OCR0_JDK9_webrev >> >> >> RFE request: >> https://bugs.openjdk.java.net/browse/JDK-8061999 >> >> This RFE allows a file to be specified that holds VM Options that >> would otherwise be specified on the command line or in an environment >> variable. >> Only one options file may be specified on the command line and no >> options file >> may be specified in either of the following environment variables >> "JAVA_TOOL_OPTIONS" or "_JAVA_OPTIONS". >> >> The options file feature supports all VM options currently supported on >> the command line, except the options file option. The option to >> specify an >> options file is "-XX:VMOptionsFile=". >> The options file feature supports an options file up to 1024 bytes in >> size >> and up to 64 options. >> >> This feature has been tested on: >> OS: >> Solaris, MAC, Windows, Linux >> Tests: >> Manual unit tests >> JPRT with -testset hotspot (including the SQE proposed test >> coverage for this feature.) >> >> > From david.holmes at oracle.com Fri Jul 10 06:03:10 2015 From: david.holmes at oracle.com (David Holmes) Date: Fri, 10 Jul 2015 16:03:10 +1000 Subject: RFR [8u60]: 8081590: The CDS classlist needs to be updated for 8u60 In-Reply-To: <559EF045.10307@oracle.com> References: <5579965B.7000709@oracle.com> <559EF045.10307@oracle.com> Message-ID: <559F601E.3000907@oracle.com> On 10/07/2015 8:05 AM, Claes Redestad wrote: > Hi, > > new refresh up: > > http://cr.openjdk.java.net/~redestad/8081590/webrev.02/ > > The refresh was put on hold earlier due to an incoming startup > optimization, which affected the classlist (mostly > order). > > I've rerun relevant tests, verified -Xshare:dump doesn't log any > warnings and checked that footprint and startup improve. Seems okay. This can go to jdk8u/hs-dev for 8u66 and 8u60. Thanks, David > Thanks! > > /Claes > > On 2015-06-11 16:08, Claes Redestad wrote: >> Hi, >> >> classlists have been slowly deteriorating since the last refresh >> (https://bugs.openjdk.java.net/browse/JDK-8023041), >> contributing to a small but significant degradation in startup and >> footprint characteristics. >> >> While there are also classlist files for Solaris, Mac and AIX, we >> cannot run the same set of applications we run on >> 32-bit platforms on non-32-bit platforms (due to an application with a >> bundled 32-bit dependency). >> >> Rather than generating new classlists using a different set of >> applications without ability to verify that it helps, I'd >> rather limit this 8u60 refresh to Linux and Windows where we can >> verify the benefit and do a more thorough >> investigation into modernizing the representative set of applications >> for JDK9 and onwards. >> >> Webrev: http://cr.openjdk.java.net/~redestad/8081590/webrev.00/ >> Bug: https://bugs.openjdk.java.net/browse/JDK-8081590 >> >> I'll need a sponsor to push this to 8u60. >> >> /Claes > From david.holmes at oracle.com Fri Jul 10 06:53:23 2015 From: david.holmes at oracle.com (David Holmes) Date: Fri, 10 Jul 2015 16:53:23 +1000 Subject: RFR: 8079301: Some command line options not settable via JAVA_TOOL_OPTIONS In-Reply-To: References: <554839B4.3020800@oracle.com> <559D237C.2060702@oracle.com> <559EED17.4060109@oracle.com> Message-ID: <559F6BE3.9080002@oracle.com> Hi Jeremy, On 10/07/2015 10:23 AM, Jeremy Manson wrote: > Hey Dmitry, > > Thanks for looking at it. The leak was deliberate (under the theory that > the command line flags were leaked, too), but it was silly that I didn't > fix it. > > Anyway, fixed. See: > > http://cr.openjdk.java.net/~jmanson/8079301/webrev.03 I'm not sure you've changed anything in this regard but it seems to me to me that if -XX:Flags=flags-file is specified on the command-line, and the environment variable(s) then the last setting wins - which would be the _JAVA_OPTIONS setting. Or maybe that is the way this whole thing works ie last setting wins? David > Jeremy > > On Thu, Jul 9, 2015 at 2:52 PM, Dmitry Dmitriev > wrote: > >> Hello Jeremy, >> >> Correct me if I am wrong, but I see small memory leak in your >> implementation. >> In Arguments::parse_options_environment_variable function memory for >> 'buffer' allocated by strdup function on line 3415, but now it not freed in >> this function because data from this buffer is used later. On the other >> hand when we are done with env variables, we free only options array(lines >> 3703-3705) and not free previously allocated memory for 'buffer' because we >> lost track for it. >> >> Thanks, >> Dmitry >> >> >> On 09.07.2015 21:20, Jeremy Manson wrote: >> >>> Thanks for looking at this, Coleen. >>> >>> I merged this with the latest version of hs-rt, but Ron is or I am going >>> to >>> have to do some merging for 8061999. The changes are relatively >>> orthogonal, but they touch a couple of the same places. How far away is >>> Ron's checkin? >>> >>> Updated webrev: >>> >>> http://cr.openjdk.java.net/~jmanson/8079301/webrev.01/ >>> >>> Updated test: >>> >>> http://cr.openjdk.java.net/~jmanson/8079301t/webrev.01/ >>> >>> (Mild complaining on my part: the conflicts wouldn't have been an issue if >>> someone had looked at this two months ago, when I first asked. I suspect >>> Ron hadn't even started his change at that point. And if external >>> developers were able to submit changes to Hotspot, we wouldn't have had to >>> bother Oracle engineers at all. Neither of these is your fault or your >>> problem, of course - I'm grateful you were able to take a look.) >>> >>> Jeremy >>> >>> On Wed, Jul 8, 2015 at 6:19 AM, Coleen Phillimore < >>> coleen.phillimore at oracle.com> wrote: >>> >>> I'll sponsor it but can you repost the RFR? >>>> >>>> There has been a fair bit of work to command line processing lately so >>>> I'd >>>> like to have the others look at it too. Have you merged this up with the >>>> latest version of hs-rt repository and were there conflicts? Also, have >>>> you looked at the RFR: >>>> >>>> "Open code review for 8061999 Enhance VM option parsing to allow options >>>> to be specified" >>>> >>>> and are there conflicts with this? >>>> >>>> The hotspot change looks good to me. >>>> >>>> >>>> >>>> http://cr.openjdk.java.net/~jmanson/8079301t/webrev.00/test/com/sun/management/HotSpotDiagnosticMXBean/CheckOrigin.java.udiff.html >>>> >>>> "UseCerealGC" LOL >>>> Can you use a different option than PrintOopAddress in this test? I >>>> don't >>>> know why this command line option exists or would be useful for, and >>>> seems >>>> to be a good candidate for removal. If you need a valid argument, that >>>> is >>>> unlikely to go away, TraceExceptions would be good. >>>> >>>> Thanks, >>>> Coleen >>>> >>>> >>>> On 7/7/15 8:00 PM, Jeremy Manson wrote: >>>> >>>> No love? Is there a code owner here I should pester more directly? >>>>> >>>>> Jeremy >>>>> >>>>> On Fri, Jun 26, 2015 at 3:00 PM, Martin Buchholz >>>>> wrote: >>>>> >>>>> As usual with Google patches, they are in use locally. This one has >>>>> been >>>>> >>>>>> stable for a while without complaints. Please sponsor. >>>>>> >>>>>> On Fri, Jun 26, 2015 at 1:53 PM, Jeremy Manson < >>>>>> jeremymanson at google.com> >>>>>> wrote: >>>>>> >>>>>> All this talk about IgnoreUnrecognizedVMOptions reminded me that this >>>>>> >>>>>>> review is still outstanding. Any takers? >>>>>>> >>>>>>> Jeremy >>>>>>> >>>>>>> On Tue, May 5, 2015 at 10:01 AM, Jeremy Manson < >>>>>>> jeremymanson at google.com >>>>>>> wrote: >>>>>>> >>>>>>> Hi David, >>>>>>> >>>>>>>> Thanks for taking a look. >>>>>>>> >>>>>>>> On Mon, May 4, 2015 at 8:32 PM, David Holmes < >>>>>>>> david.holmes at oracle.com> >>>>>>>> wrote: >>>>>>>> >>>>>>>> Hi Jeremy, >>>>>>>> >>>>>>>>> On 5/05/2015 6:51 AM, Jeremy Manson wrote: >>>>>>>>> >>>>>>>>> Not sure who might be willing to sponsor this. David? You did >>>>>>>>> the >>>>>>>>> >>>>>>>>>> last >>>>>>>>>> one. :) >>>>>>>>>> >>>>>>>>>> Might be a while before I can get to it. I did have a quick look >>>>>>>>>> >>>>>>>>> (and >>>>>>>>> will need a longer one). >>>>>>>>> >>>>>>>>> I understand. I'm just happy it's possible to upstream this stuff >>>>>>>> at >>>>>>>> all[1]. >>>>>>>> >>>>>>>> [1] With the eternal caveat that I'd be happier if we didn't *have* >>>>>>>> to >>>>>>>> go through you folks, but we've learned to live with it. >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> Context: A number of command line options are not settable via >>>>>>>> >>>>>>>>> JAVA_TOOL_OPTIONS and _JAVA_OPTIONS: >>>>>>>>>> >>>>>>>>>> - PrintVMOptions >>>>>>>>>> >>>>>>>>>> So you have changed the semantics of this to print out the >>>>>>>>>> options >>>>>>>>>> >>>>>>>>> from >>>>>>>>> the command-line and each of the two env vars. Seems reasonable but >>>>>>>>> may be >>>>>>>>> better to know which option came from where as we can now see the >>>>>>>>> same >>>>>>>>> option (or conflicting variants thereof) multiple times. >>>>>>>>> >>>>>>>>> I'd be happy to do this. Any preferred syntax? Does someone >>>>>>>>> >>>>>>>> actually >>>>>>>> own this feature? >>>>>>>> >>>>>>>> I'm unclear what the current processing order is for the different >>>>>>>> >>>>>>>> sources of options, and whether the changes affect that order? >>>>>>>>> >>>>>>>>> Nope. I go through sad contortions to keep the processing order >>>>>>>>> the >>>>>>>>> >>>>>>>> same. It's JAVA_TOOL_OPTIONS, then command line, then _JAVA_OPTIONS. >>>>>>>> See >>>>>>>> lines 2549-2567. >>>>>>>> >>>>>>>> >>>>>>>> - IgnoreUnrecognizedVMOptions >>>>>>>> >>>>>>>>> - PrintFlagsInitial >>>>>>>>>> >>>>>>>>>> Unclear what "initial" actually means - is it the default? >>>>>>>>>> >>>>>>>>> More or less. If you stick, for example, >>>>>>>> IgnoreUnrecognizedVMOptions >>>>>>>> in >>>>>>>> there first, it will get printed out as "true". I haven't really >>>>>>>> changed >>>>>>>> the semantics here either - I've just added processing of the >>>>>>>> envvars. >>>>>>>> >>>>>>>> - NativeMemoryTracking >>>>>>>> >>>>>>>> - PrintFlagsWithComments >>>>>>>>> >>>>>>>>>> This is because these flags have to be processed before processing >>>>>>>>>> other >>>>>>>>>> flags, and no one ever bothered to do that for the flags coming >>>>>>>>>> from >>>>>>>>>> environment variables. This patch fixes that problem. >>>>>>>>>> >>>>>>>>>> I have a test, but it is a modification to a JDK test instead of a >>>>>>>>>> HS >>>>>>>>>> test, >>>>>>>>>> so it can go in separately (I guess). >>>>>>>>>> >>>>>>>>>> They can be pushed together to different repos in the same >>>>>>>>>> forest. >>>>>>>>>> >>>>>>>>> Okay. Here's the test change: >>>>>>>>> >>>>>>>> http://cr.openjdk.java.net/~jmanson/8079301t/webrev.00/ >>>>>>>> >>>>>>>> >>>>>>>> As I said I'll have to get back to this. And hopefully someone >>>>>>>> else in >>>>>>>> >>>>>>>>> runtime will take a good look as well ;-) >>>>>>>>> >>>>>>>>> I'd be happy to toss it over to whomever owns this, if anyone. >>>>>>>>> >>>>>>>> Thanks! >>>>>>>> >>>>>>>> Jeremy >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> Bug: >>>>>>>> >>>>>>>>> https://bugs.openjdk.java.net/browse/JDK-8079301 >>>>>>>>>> >>>>>>>>>> Webrev: >>>>>>>>>> http://cr.openjdk.java.net/~jmanson/8079301/webrev.00/ >>>>>>>>>> >>>>>>>>>> Jeremy >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >> From andreas.eriksson at oracle.com Fri Jul 10 11:20:58 2015 From: andreas.eriksson at oracle.com (Andreas Eriksson) Date: Fri, 10 Jul 2015 13:20:58 +0200 Subject: Jdk8 backports of 6904403 and 8044364 Message-ID: <559FAA9A.6030608@oracle.com> Hi, Just a heads up that I'm backporting these fixes to jdk8: https://bugs.openjdk.java.net/browse/JDK-6904403: assert(f == k->has_finalizer(),"inconsistent has_finalizer") with debug VM https://bugs.openjdk.java.net/browse/JDK-8044364: [TESTBUG] runtime/RedefineFinalizer test fails on windows Both of them applies cleanly from the jdk9 changesets (so no review required). http://hg.openjdk.java.net/jdk9/jdk9/hotspot/rev/c597dc3eb862 http://hg.openjdk.java.net/jdk9/hs-rt/hotspot/rev/29d15865d20f Unless someone objects I'll get them pushed later today. - Andreas From dmitry.dmitriev at oracle.com Fri Jul 10 11:36:43 2015 From: dmitry.dmitriev at oracle.com (Dmitry Dmitriev) Date: Fri, 10 Jul 2015 14:36:43 +0300 Subject: RFR: 8079301: Some command line options not settable via JAVA_TOOL_OPTIONS In-Reply-To: References: <554839B4.3020800@oracle.com> <559D237C.2060702@oracle.com> <559EED17.4060109@oracle.com> Message-ID: <559FAE4B.5060505@oracle.com> Hello Jeremy, Thank you for fixing that! But in this case we still have minor issue when quotes processing failed(lines 3438-3444). Here is my suggestion: leave 'while' cycle(lines 3423-3462) as I was in your previous webrev(without 'start' and etc.) and call strdup when copy 'options' to 'options_arr' on lines 3472-3474, i.e. make lines 3472-3474 like this: 3472 for (int i = 0; i < options->length(); i++) { 3473 options_arr[i] = options->at(i); 3474 options_arr[i].optionString = os::strdup(options_arr[i].optionString); 3475 } What you think about that? Regards, Dmitry On 10.07.2015 3:23, Jeremy Manson wrote: > Hey Dmitry, > > Thanks for looking at it. The leak was deliberate (under the theory > that the command line flags were leaked, too), but it was silly that I > didn't fix it. > > Anyway, fixed. See: > > http://cr.openjdk.java.net/~jmanson/8079301/webrev.03 > > > Jeremy > > On Thu, Jul 9, 2015 at 2:52 PM, Dmitry Dmitriev > > wrote: > > Hello Jeremy, > > Correct me if I am wrong, but I see small memory leak in your > implementation. > In Arguments::parse_options_environment_variable function memory > for 'buffer' allocated by strdup function on line 3415, but now it > not freed in this function because data from this buffer is used > later. On the other hand when we are done with env variables, we > free only options array(lines 3703-3705) and not free previously > allocated memory for 'buffer' because we lost track for it. > > Thanks, > Dmitry > > > On 09.07.2015 21:20, Jeremy Manson wrote: > > Thanks for looking at this, Coleen. > > I merged this with the latest version of hs-rt, but Ron is or > I am going to > have to do some merging for 8061999. The changes are relatively > orthogonal, but they touch a couple of the same places. How > far away is > Ron's checkin? > > Updated webrev: > > http://cr.openjdk.java.net/~jmanson/8079301/webrev.01/ > > > Updated test: > > http://cr.openjdk.java.net/~jmanson/8079301t/webrev.01/ > > > (Mild complaining on my part: the conflicts wouldn't have been > an issue if > someone had looked at this two months ago, when I first > asked. I suspect > Ron hadn't even started his change at that point. And if external > developers were able to submit changes to Hotspot, we wouldn't > have had to > bother Oracle engineers at all. Neither of these is your > fault or your > problem, of course - I'm grateful you were able to take a look.) > > Jeremy > > On Wed, Jul 8, 2015 at 6:19 AM, Coleen Phillimore < > coleen.phillimore at oracle.com > > wrote: > > I'll sponsor it but can you repost the RFR? > > There has been a fair bit of work to command line > processing lately so I'd > like to have the others look at it too. Have you merged > this up with the > latest version of hs-rt repository and were there > conflicts? Also, have > you looked at the RFR: > > "Open code review for 8061999 Enhance VM option parsing to > allow options > to be specified" > > and are there conflicts with this? > > The hotspot change looks good to me. > > > http://cr.openjdk.java.net/~jmanson/8079301t/webrev.00/test/com/sun/management/HotSpotDiagnosticMXBean/CheckOrigin.java.udiff.html > > > "UseCerealGC" LOL > Can you use a different option than PrintOopAddress in > this test? I don't > know why this command line option exists or would be > useful for, and seems > to be a good candidate for removal. If you need a valid > argument, that is > unlikely to go away, TraceExceptions would be good. > > Thanks, > Coleen > > > On 7/7/15 8:00 PM, Jeremy Manson wrote: > > No love? Is there a code owner here I should pester > more directly? > > Jeremy > > On Fri, Jun 26, 2015 at 3:00 PM, Martin Buchholz > > > wrote: > > As usual with Google patches, they are in use > locally. This one has been > > stable for a while without complaints. Please > sponsor. > > On Fri, Jun 26, 2015 at 1:53 PM, Jeremy Manson > > > wrote: > > All this talk about IgnoreUnrecognizedVMOptions > reminded me that this > > review is still outstanding. Any takers? > > Jeremy > > On Tue, May 5, 2015 at 10:01 AM, Jeremy Manson > > wrote: > > Hi David, > > Thanks for taking a look. > > On Mon, May 4, 2015 at 8:32 PM, David > Holmes > > wrote: > > Hi Jeremy, > > On 5/05/2015 6:51 AM, Jeremy Manson wrote: > > Not sure who might be willing to > sponsor this. David? You did the > > last > one. :) > > Might be a while before I can > get to it. I did have a quick look > > (and > will need a longer one). > > I understand. I'm just happy it's > possible to upstream this stuff at > all[1]. > > [1] With the eternal caveat that I'd be > happier if we didn't *have* to > go through you folks, but we've learned to > live with it. > > > > Context: A number of command line > options are not settable via > > JAVA_TOOL_OPTIONS and _JAVA_OPTIONS: > > - PrintVMOptions > > So you have changed the > semantics of this to print out the > options > > from > the command-line and each of the two > env vars. Seems reasonable but > may be > better to know which option came from > where as we can now see the same > option (or conflicting variants > thereof) multiple times. > > I'd be happy to do this. Any > preferred syntax? Does someone > > actually > own this feature? > > I'm unclear what the current processing > order is for the different > > sources of options, and whether the > changes affect that order? > > Nope. I go through sad contortions > to keep the processing order the > > same. It's JAVA_TOOL_OPTIONS, then > command line, then _JAVA_OPTIONS. > See > lines 2549-2567. > > > - IgnoreUnrecognizedVMOptions > > - PrintFlagsInitial > > Unclear what "initial" actually > means - is it the default? > > More or less. If you stick, for example, > IgnoreUnrecognizedVMOptions > in > there first, it will get printed out as > "true". I haven't really > changed > the semantics here either - I've just > added processing of the envvars. > > - NativeMemoryTracking > > - PrintFlagsWithComments > > This is because these flags have > to be processed before processing > other > flags, and no one ever bothered to > do that for the flags coming from > environment variables. This patch > fixes that problem. > > I have a test, but it is a > modification to a JDK test instead > of a HS > test, > so it can go in separately (I guess). > > They can be pushed together to > different repos in the same forest. > > Okay. Here's the test change: > > http://cr.openjdk.java.net/~jmanson/8079301t/webrev.00/ > > > > As I said I'll have to get back to this. > And hopefully someone else in > > runtime will take a good look as well ;-) > > I'd be happy to toss it over to > whomever owns this, if anyone. > > Thanks! > > Jeremy > > > > Bug: > > https://bugs.openjdk.java.net/browse/JDK-8079301 > > Webrev: > http://cr.openjdk.java.net/~jmanson/8079301/webrev.00/ > > > Jeremy > > > > > From ron.durbin at oracle.com Fri Jul 10 12:33:17 2015 From: ron.durbin at oracle.com (Ron Durbin) Date: Fri, 10 Jul 2015 05:33:17 -0700 (PDT) Subject: Open code review for 8061999 Enhance VM option parsing to allow options to be specified In-Reply-To: <559F5EA0.2080500@oracle.com> References: <3d1df3cb-fe69-4c3b-b8e1-db8801d5a68f@default> <5589B912.2050003@oracle.com> <559F5EA0.2080500@oracle.com> Message-ID: <6f8e0dae-fc8a-4b72-ae83-af20aec7bf46@default> Not yet >-----Original Message----- >From: David Holmes >Sent: Thursday, July 09, 2015 11:57 PM >To: hotspot-runtime-dev at openjdk.java.net >Subject: Re: Open code review for 8061999 Enhance VM option parsing to allow options to be specified > >Is there an updated webrev addressing Gerard's comments? > >Thanks, >David > >On 24/06/2015 5:52 AM, Gerard Ziemski wrote: >> hi Ron, >> >> I'm sending you partial feedback, since I am starting to get a bit >> tired. I will spend more time reviewing your webrev tomorrow, but here >> is what I have so far: >> >> --- >> src/share/vm/utilities/globalDefinitions.hpp >> >> 1. Should we name the method "is_white()", not "iswhite()" since it's >> part of our code base? But then since it's a macro, shouldn't it >> actually be "IS_WHITE()"? >> >> --- >> src/share/vm/runtime/arguments.hpp >> >> 1. >> >> All the arguments in alloc_JVM_options_list(), >> copy_JVM_options_from_buf() and parse_JVM_options_file() use underscores >> in the arguments names except for merge_JVM_options_file(). I think the >> merge_JVM_options_file() should be: >> >> + static jint merge_JVM_options_file(const struct JavaVMInitArgs *args_in, >> + struct JavaVMInitArgs **args_out); >> >> >> --- >> src/share/vm/runtime/arguments.cpp >> >> 1. Why do FreeVMOptions, DumpVMOptions, DumpVMOption and DumpOption >> start with capital letters? Shouldn't their names start with a lower >> case letter? >> >> 2. Line 4306. The pattern in Arguments::parse() seems to be to print out >> error message and return the error value if something goes wrong, but we >> do vm_exit(1) instead? >> >> 3. Line 4309. I was told that when it comes to NULL pointer check we >> should do (NULL == args), not the other way around. >> >> 4. Line 4375. Don't we need FreeVMOptions() here? Line 4382 as well? >> >> 5. Question. Why do we need N_MAX_OPTIONS? >> >> 6. Question. Why do we need OPTION_BUFFER_SIZE? Can't we use "int >> bytes_needed = fseek(stream, 0, SEEK_END); rewind(stream)" and have the >> code dynamically allocate memory without hard coded limits? >> >> 7. Line 3965. Can that comparison ever succeed? "read()" will not read >> more bytes (only less) than as specified by "bytes_alloc" and if it did, >> we would overwrite memory since our buf is only "bytes_alloc" big. >> >> >> >> cheers >> >> >> On 6/22/2015 7:52 AM, Ron Durbin wrote: >>> Webrev URL: >>> http://cr.openjdk.java.net/~rdurbin/8061999_OCR0_JDK9_webrev >>> >>> >>> RFE request: >>> https://bugs.openjdk.java.net/browse/JDK-8061999 >>> >>> This RFE allows a file to be specified that holds VM Options that >>> would otherwise be specified on the command line or in an environment >>> variable. >>> Only one options file may be specified on the command line and no >>> options file >>> may be specified in either of the following environment variables >>> "JAVA_TOOL_OPTIONS" or "_JAVA_OPTIONS". >>> >>> The options file feature supports all VM options currently supported on >>> the command line, except the options file option. The option to >>> specify an >>> options file is "-XX:VMOptionsFile=". >>> The options file feature supports an options file up to 1024 bytes in >>> size >>> and up to 64 options. >>> >>> This feature has been tested on: >>> OS: >>> Solaris, MAC, Windows, Linux >>> Tests: >>> Manual unit tests >>> JPRT with -testset hotspot (including the SQE proposed test >>> coverage for this feature.) >>> >>> >> From dmitry.dmitriev at oracle.com Fri Jul 10 12:52:11 2015 From: dmitry.dmitriev at oracle.com (Dmitry Dmitriev) Date: Fri, 10 Jul 2015 15:52:11 +0300 Subject: RFR: 8079301: Some command line options not settable via JAVA_TOOL_OPTIONS In-Reply-To: <559FAE4B.5060505@oracle.com> References: <554839B4.3020800@oracle.com> <559D237C.2060702@oracle.com> <559EED17.4060109@oracle.com> <559FAE4B.5060505@oracle.com> Message-ID: <559FBFFB.3060206@oracle.com> Jeremy, Two additional comments which I didn't catch earlier... 1) Order of processing command line options is following(Arguments::parse_vm_init_args function): options from JAVA_TOOL_OPTIONS environment variable, then options from command line and then options from _JAVA_OPTIONS environment variable. And last argument wins! You not change this order in Arguments::parse_vm_init_args function, but it seems that order in several other places is changed. Lines 3665-3667: 3665 match_special_option_and_act(args, &flags_file); 3666 match_special_option_and_act(&java_tool_options_args, &flags_file); 3667 match_special_option_and_act(&java_options_args, &flags_file); Here we see that order is following: options from command line, then options from JAVA_TOOL_OPTIONS environment variable and then options from _JAVA_OPTIONS environment variable. Thus, in this case "-XX:+IgnoreUnrecognizedVMOptions" option in JAVA_TOOL_OPTIONS environment variable will have bigger priority than in command line(last argument wins), but this is differ from processing options in Arguments::parse_vm_init_args function. Thus, I think that you need to swap 3665 and 3666 lines: 3665 match_special_option_and_act(&java_tool_options_args, &flags_file); 3666 match_special_option_and_act(args, &flags_file); 3667 match_special_option_and_act(&java_options_args, &flags_file); Similar situation on lines 3696-3700: 3696 if (PrintVMOptions) { 3697 print_options(args); 3698 print_options(&java_tool_options_args); 3699 print_options(&java_options_args); 3700 } Command line options are printed before options from JAVA_TOOL_OPTIONS environment variable. Thus, I think that you need to swap 3697 and 3698 lines: 3696 if (PrintVMOptions) { 3697 print_options(&java_tool_options_args); 3698 print_options(args); 3699 print_options(&java_options_args); 3700 } 2) One more thing about error processing :) I think it will be great to free allocated memory for environment variables when error occured on lines 3661-3663, 3679-3681 and 3685-3687. My suggestion is to add some static function which free memory for env variables, something like that: static void free_memory_for_environment_variables( JavaVMInitArgs *options_args ) { for (int i = 0; i < options_args->nOptions; i++) { os::free(options_args->options[i].optionString); } FREE_C_HEAP_ARRAY(JavaVMOption, options_args->options); } And change lines 3661-3663 to following: 3661 if (code != JNI_OK) { 3662 free_memory_for_environment_variables(&java_tool_options_args); 3663 return code; 3664 } Lines 3679-3681 to following: 3679 if (!process_settings_file(flags_file, true, args->ignoreUnrecognized)) { 3680 free_memory_for_environment_variables(&java_tool_options_args); 3681 free_memory_for_environment_variables(&java_options_args); 3682 return JNI_EINVAL; 3683 } Lines 3685-3687 to following: 3685 if (!process_settings_file(".hotspotrc", false, args->ignoreUnrecognized)) { 3680 free_memory_for_environment_variables(&java_tool_options_args); 3681 free_memory_for_environment_variables(&java_options_args); 3686 return JNI_EINVAL; 3687 } And lines 3706-3715 to following: 3706 // Done with the envvars 3707 free_memory_for_environment_variables(&java_tool_options_args); 3708 free_memory_for_environment_variables(&java_options_args); Thank you, Dmitry On 10.07.2015 14:36, Dmitry Dmitriev wrote: > Hello Jeremy, > > Thank you for fixing that! But in this case we still have minor issue > when quotes processing failed(lines 3438-3444). Here is my suggestion: > leave 'while' cycle(lines 3423-3462) as I was in your previous > webrev(without 'start' and etc.) and call strdup when copy 'options' > to 'options_arr' on lines 3472-3474, i.e. make lines 3472-3474 like this: > > 3472 for (int i = 0; i < options->length(); i++) { > 3473 options_arr[i] = options->at(i); > 3474 options_arr[i].optionString = > os::strdup(options_arr[i].optionString); > 3475 } > > What you think about that? > > Regards, > Dmitry > > On 10.07.2015 3:23, Jeremy Manson wrote: >> Hey Dmitry, >> >> Thanks for looking at it. The leak was deliberate (under the theory >> that the command line flags were leaked, too), but it was silly that >> I didn't fix it. >> >> Anyway, fixed. See: >> >> http://cr.openjdk.java.net/~jmanson/8079301/webrev.03 >> >> >> Jeremy >> >> On Thu, Jul 9, 2015 at 2:52 PM, Dmitry Dmitriev >> > wrote: >> >> Hello Jeremy, >> >> Correct me if I am wrong, but I see small memory leak in your >> implementation. >> In Arguments::parse_options_environment_variable function memory >> for 'buffer' allocated by strdup function on line 3415, but now it >> not freed in this function because data from this buffer is used >> later. On the other hand when we are done with env variables, we >> free only options array(lines 3703-3705) and not free previously >> allocated memory for 'buffer' because we lost track for it. >> >> Thanks, >> Dmitry >> >> >> On 09.07.2015 21:20, Jeremy Manson wrote: >> >> Thanks for looking at this, Coleen. >> >> I merged this with the latest version of hs-rt, but Ron is or >> I am going to >> have to do some merging for 8061999. The changes are relatively >> orthogonal, but they touch a couple of the same places. How >> far away is >> Ron's checkin? >> >> Updated webrev: >> >> http://cr.openjdk.java.net/~jmanson/8079301/webrev.01/ >> >> >> Updated test: >> >> http://cr.openjdk.java.net/~jmanson/8079301t/webrev.01/ >> >> >> (Mild complaining on my part: the conflicts wouldn't have been >> an issue if >> someone had looked at this two months ago, when I first >> asked. I suspect >> Ron hadn't even started his change at that point. And if >> external >> developers were able to submit changes to Hotspot, we wouldn't >> have had to >> bother Oracle engineers at all. Neither of these is your >> fault or your >> problem, of course - I'm grateful you were able to take a look.) >> >> Jeremy >> >> On Wed, Jul 8, 2015 at 6:19 AM, Coleen Phillimore < >> coleen.phillimore at oracle.com >> > wrote: >> >> I'll sponsor it but can you repost the RFR? >> >> There has been a fair bit of work to command line >> processing lately so I'd >> like to have the others look at it too. Have you merged >> this up with the >> latest version of hs-rt repository and were there >> conflicts? Also, have >> you looked at the RFR: >> >> "Open code review for 8061999 Enhance VM option parsing to >> allow options >> to be specified" >> >> and are there conflicts with this? >> >> The hotspot change looks good to me. >> >> >> http://cr.openjdk.java.net/~jmanson/8079301t/webrev.00/test/com/sun/management/HotSpotDiagnosticMXBean/CheckOrigin.java.udiff.html >> >> >> "UseCerealGC" LOL >> Can you use a different option than PrintOopAddress in >> this test? I don't >> know why this command line option exists or would be >> useful for, and seems >> to be a good candidate for removal. If you need a valid >> argument, that is >> unlikely to go away, TraceExceptions would be good. >> >> Thanks, >> Coleen >> >> >> On 7/7/15 8:00 PM, Jeremy Manson wrote: >> >> No love? Is there a code owner here I should pester >> more directly? >> >> Jeremy >> >> On Fri, Jun 26, 2015 at 3:00 PM, Martin Buchholz >> > >> wrote: >> >> As usual with Google patches, they are in use >> locally. This one has been >> >> stable for a while without complaints. Please >> sponsor. >> >> On Fri, Jun 26, 2015 at 1:53 PM, Jeremy Manson >> > > >> wrote: >> >> All this talk about IgnoreUnrecognizedVMOptions >> reminded me that this >> >> review is still outstanding. Any takers? >> >> Jeremy >> >> On Tue, May 5, 2015 at 10:01 AM, Jeremy Manson >> > >> wrote: >> >> Hi David, >> >> Thanks for taking a look. >> >> On Mon, May 4, 2015 at 8:32 PM, David >> Holmes > > >> wrote: >> >> Hi Jeremy, >> >> On 5/05/2015 6:51 AM, Jeremy Manson >> wrote: >> >> Not sure who might be willing to >> sponsor this. David? You did the >> >> last >> one. :) >> >> Might be a while before I can >> get to it. I did have a quick look >> >> (and >> will need a longer one). >> >> I understand. I'm just happy it's >> possible to upstream this stuff at >> all[1]. >> >> [1] With the eternal caveat that I'd be >> happier if we didn't *have* to >> go through you folks, but we've learned to >> live with it. >> >> >> >> Context: A number of command line >> options are not settable via >> >> JAVA_TOOL_OPTIONS and _JAVA_OPTIONS: >> >> - PrintVMOptions >> >> So you have changed the >> semantics of this to print out the >> options >> >> from >> the command-line and each of the two >> env vars. Seems reasonable but >> may be >> better to know which option came from >> where as we can now see the same >> option (or conflicting variants >> thereof) multiple times. >> >> I'd be happy to do this. Any >> preferred syntax? Does someone >> >> actually >> own this feature? >> >> I'm unclear what the current processing >> order is for the different >> >> sources of options, and whether the >> changes affect that order? >> >> Nope. I go through sad contortions >> to keep the processing order the >> >> same. It's JAVA_TOOL_OPTIONS, then >> command line, then _JAVA_OPTIONS. >> See >> lines 2549-2567. >> >> >> - IgnoreUnrecognizedVMOptions >> >> - PrintFlagsInitial >> >> Unclear what "initial" actually >> means - is it the default? >> >> More or less. If you stick, for example, >> IgnoreUnrecognizedVMOptions >> in >> there first, it will get printed out as >> "true". I haven't really >> changed >> the semantics here either - I've just >> added processing of the envvars. >> >> - NativeMemoryTracking >> >> - PrintFlagsWithComments >> >> This is because these flags have >> to be processed before processing >> other >> flags, and no one ever bothered to >> do that for the flags coming from >> environment variables. This patch >> fixes that problem. >> >> I have a test, but it is a >> modification to a JDK test instead >> of a HS >> test, >> so it can go in separately (I >> guess). >> >> They can be pushed together to >> different repos in the same forest. >> >> Okay. Here's the test change: >> >> http://cr.openjdk.java.net/~jmanson/8079301t/webrev.00/ >> >> >> >> As I said I'll have to get back to this. >> And hopefully someone else in >> >> runtime will take a good look as well >> ;-) >> >> I'd be happy to toss it over to >> whomever owns this, if anyone. >> >> Thanks! >> >> Jeremy >> >> >> >> Bug: >> >> https://bugs.openjdk.java.net/browse/JDK-8079301 >> >> Webrev: >> http://cr.openjdk.java.net/~jmanson/8079301/webrev.00/ >> >> >> Jeremy >> >> >> >> >> > From mikhailo.seledtsov at oracle.com Fri Jul 10 16:33:58 2015 From: mikhailo.seledtsov at oracle.com (Mikhailo Seledtsov) Date: Fri, 10 Jul 2015 09:33:58 -0700 Subject: RFR: 8025692: Add trace to find out what methods are used at runtime. In-Reply-To: <559F4B5B.60203@oracle.com> References: <5514C1CB.7020009@oracle.com> <55711388.4090402@oracle.com> <559F4B5B.60203@oracle.com> Message-ID: <559FF3F6.7060400@oracle.com> It is a known issue with Aurora; the RBT jobs get stuck on Win-x64. The fix's ETA is on 13-July during next Aurora patch deployemnt. You could still check status of testing on jobs that complete: - go to your main RBT status for your job (e.g. http://sla03.se.oracle.com:3000/rbt/rbt-mikhailo.seledtsov-hs-rt-20150709-1543-2147) For overall status, just see the summary under "Test Failures" tab For details on particular failures, do: - Under "Test Progress"-> x of Y jobs succeeded, click the "wheel" symbol -> Main - this will lead you to your Aurora main jobs page - there, you could click "Go to batch results", see a table of new failures, and look into them in detail Hope this helps, Misha On 7/9/2015 9:34 PM, Yumin Qi wrote: > Hi, Karen > > Just informed you that RBT testing for quick testing seems will not > get back a completed result(I have tried several times those days). > After 11 hours, there still 4 jobs running: > > 26 of 34 succeeded, 4 failed, 4 still running. > > Those running jobs already run at least 6+ hours. > The 4 failed jobs are dtrace on linux-x64 which are OK, since > dtrace is disabled on it. > > Also, I added -Xint to test case, and tested with jtreg on > test/runtime showed no new failures found. > I am going to push the changes if you are OK with current result. > Seems the testing with RBT will never come back. Updated webrev: > > http://cr.openjdk.java.net/~minqi/8025692/webrev02/ > > Thanks > Yumin > > On 6/18/2015 1:01 PM, Karen Kinnear wrote: >> Yumin, >> >> Thank you very much for the updates.And the PERM_REFCOUNT rather than >> -1 :-) >> Looks good. >> >> Thank you for testing this -Xint. If there is an easy way to add an >> -Xint line >> to the test that would be useful - but not critical. >> >> So I presume that the "aurora default test suites" includes: >> jcks, jtreg hotspot and Christian's new "quick" tests. >> >> thanks, >> Karen >> >> On Jun 4, 2015, at 11:12 PM, Yumin Qi wrote: >> >>> HI, All >>> >>> After several round of codereviews and discussion, now the second >>> version is at: >>> http://cr.openjdk.java.net/~minqi/8025692/webrev02/ >>> >>> The flag names changed: >>> >>> TraceMethodUsge => LogTouchedMethods >>> PrintMethodUsageAtExit => PrintTouchedMethodsAtExit >>> >>> The two flags now are diagnostic flags. >>> >>> Also similar, there changed in related variable names. >>> Also fixed a flaw which is not found during last round of review: >>> append new TouchedMethodRecord to end of hash bucket list. >>> >>> Make change to interpreter method entry generation(for both >>> native and normal) to enable build_method_counter called. This is >>> necessary since if run -Xint, the call will be skipped so our code >>> will be skipped so no logging for touched methods. >>> >>> Added test case for jcmd: jcmd VM.print_touched_methods. >>> >>> Tests: JPRT, aurora default test suites (in progress). >>> >>> Thanks >>> Yumin >>> >>> >>> On 3/26/2015 7:34 PM, Yumin Qi wrote: >>>> Please review: >>>> >>>> bug: https://bugs.openjdk.java.net/browse/JDK-8025692 >>>> webrev: http://cr.openjdk.java.net/~minqi/8025692/webrev01/ >>>> >>>> Summary: Add two flags to help list all java methods called in >>>> runtime, this is also in product and can help CDS to rearrange >>>> methods in shared archive to avoid loading infrequent methods into >>>> memory. >>>> >>>> Tests: vm.runtime.quick.testlist, JPRT >>>> >>>> >>>> Thanks >>>> Yumin >>>> >>>> > From jeremymanson at google.com Fri Jul 10 17:15:19 2015 From: jeremymanson at google.com (Jeremy Manson) Date: Fri, 10 Jul 2015 10:15:19 -0700 Subject: RFR: 8079301: Some command line options not settable via JAVA_TOOL_OPTIONS In-Reply-To: <559FBFFB.3060206@oracle.com> References: <554839B4.3020800@oracle.com> <559D237C.2060702@oracle.com> <559EED17.4060109@oracle.com> <559FAE4B.5060505@oracle.com> <559FBFFB.3060206@oracle.com> Message-ID: Thanks for the detailed look, Dmitry. I have taken your advice, with a couple of exceptions: 1) I named the method free_memory_for_vm_init_args instead of free_memory_for_environment_variables. 2) I did not free the memory in 3661-3663 or in 3679-3681, because those are error paths where the memory may not have been allocated in the first place. So freeing it might lead to a crash. New Rev: http://cr.openjdk.java.net/~jmanson/8079301/webrev.04/ Jeremy On Fri, Jul 10, 2015 at 5:52 AM, Dmitry Dmitriev wrote: > Jeremy, > > Two additional comments which I didn't catch earlier... > > 1) Order of processing command line options is > following(Arguments::parse_vm_init_args function): options from > JAVA_TOOL_OPTIONS environment variable, then options from command line and > then options from _JAVA_OPTIONS environment variable. And last argument > wins! > > You not change this order in Arguments::parse_vm_init_args function, but > it seems that order in several other places is changed. > > Lines 3665-3667: > > 3665 match_special_option_and_act(args, &flags_file); > 3666 match_special_option_and_act(&java_tool_options_args, &flags_file); > 3667 match_special_option_and_act(&java_options_args, &flags_file); > > Here we see that order is following: options from command line, then > options from JAVA_TOOL_OPTIONS environment variable and then options from > _JAVA_OPTIONS environment variable. Thus, in this case > "-XX:+IgnoreUnrecognizedVMOptions" option in JAVA_TOOL_OPTIONS environment > variable will have bigger priority than in command line(last argument > wins), but this is differ from processing options in > Arguments::parse_vm_init_args function. Thus, I think that you need to swap > 3665 and 3666 lines: > > 3665 match_special_option_and_act(&java_tool_options_args, &flags_file); > 3666 match_special_option_and_act(args, &flags_file); > 3667 match_special_option_and_act(&java_options_args, &flags_file); > > Similar situation on lines 3696-3700: > > 3696 if (PrintVMOptions) { > 3697 print_options(args); > 3698 print_options(&java_tool_options_args); > 3699 print_options(&java_options_args); > 3700 } > > Command line options are printed before options from JAVA_TOOL_OPTIONS > environment variable. Thus, I think that you need to swap 3697 and 3698 > lines: > > 3696 if (PrintVMOptions) { > 3697 print_options(&java_tool_options_args); > 3698 print_options(args); > 3699 print_options(&java_options_args); > 3700 } > > > 2) One more thing about error processing :) > I think it will be great to free allocated memory for environment > variables when error occured on lines 3661-3663, 3679-3681 and 3685-3687. > My suggestion is to add some static function which free memory for env > variables, something like that: > static void free_memory_for_environment_variables( JavaVMInitArgs > *options_args ) { > for (int i = 0; i < options_args->nOptions; i++) { > os::free(options_args->options[i].optionString); > } > FREE_C_HEAP_ARRAY(JavaVMOption, options_args->options); > } > > And change lines 3661-3663 to following: > > 3661 if (code != JNI_OK) { > 3662 free_memory_for_environment_variables(&java_tool_options_args); > 3663 return code; > 3664 } > > Lines 3679-3681 to following: > > 3679 if (!process_settings_file(flags_file, true, > args->ignoreUnrecognized)) { > 3680 free_memory_for_environment_variables(&java_tool_options_args); > 3681 free_memory_for_environment_variables(&java_options_args); > 3682 return JNI_EINVAL; > 3683 } > > Lines 3685-3687 to following: > > 3685 if (!process_settings_file(".hotspotrc", false, > args->ignoreUnrecognized)) { > 3680 free_memory_for_environment_variables(&java_tool_options_args); > 3681 free_memory_for_environment_variables(&java_options_args); > 3686 return JNI_EINVAL; > 3687 } > > And lines 3706-3715 to following: > > 3706 // Done with the envvars > 3707 free_memory_for_environment_variables(&java_tool_options_args); > 3708 free_memory_for_environment_variables(&java_options_args); > > > Thank you, > Dmitry > > > On 10.07.2015 14:36, Dmitry Dmitriev wrote: > >> Hello Jeremy, >> >> Thank you for fixing that! But in this case we still have minor issue >> when quotes processing failed(lines 3438-3444). Here is my suggestion: >> leave 'while' cycle(lines 3423-3462) as I was in your previous >> webrev(without 'start' and etc.) and call strdup when copy 'options' to >> 'options_arr' on lines 3472-3474, i.e. make lines 3472-3474 like this: >> >> 3472 for (int i = 0; i < options->length(); i++) { >> 3473 options_arr[i] = options->at(i); >> 3474 options_arr[i].optionString = >> os::strdup(options_arr[i].optionString); >> 3475 } >> >> What you think about that? >> >> Regards, >> Dmitry >> >> On 10.07.2015 3:23, Jeremy Manson wrote: >> >>> Hey Dmitry, >>> >>> Thanks for looking at it. The leak was deliberate (under the theory >>> that the command line flags were leaked, too), but it was silly that I >>> didn't fix it. >>> >>> Anyway, fixed. See: >>> >>> http://cr.openjdk.java.net/~jmanson/8079301/webrev.03 < >>> http://cr.openjdk.java.net/%7Ejmanson/8079301/webrev.03> >>> >>> Jeremy >>> >>> On Thu, Jul 9, 2015 at 2:52 PM, Dmitry Dmitriev < >>> dmitry.dmitriev at oracle.com > wrote: >>> >>> Hello Jeremy, >>> >>> Correct me if I am wrong, but I see small memory leak in your >>> implementation. >>> In Arguments::parse_options_environment_variable function memory >>> for 'buffer' allocated by strdup function on line 3415, but now it >>> not freed in this function because data from this buffer is used >>> later. On the other hand when we are done with env variables, we >>> free only options array(lines 3703-3705) and not free previously >>> allocated memory for 'buffer' because we lost track for it. >>> >>> Thanks, >>> Dmitry >>> >>> >>> On 09.07.2015 21:20, Jeremy Manson wrote: >>> >>> Thanks for looking at this, Coleen. >>> >>> I merged this with the latest version of hs-rt, but Ron is or >>> I am going to >>> have to do some merging for 8061999. The changes are relatively >>> orthogonal, but they touch a couple of the same places. How >>> far away is >>> Ron's checkin? >>> >>> Updated webrev: >>> >>> http://cr.openjdk.java.net/~jmanson/8079301/webrev.01/ >>> >>> >>> Updated test: >>> >>> http://cr.openjdk.java.net/~jmanson/8079301t/webrev.01/ >>> >>> >>> (Mild complaining on my part: the conflicts wouldn't have been >>> an issue if >>> someone had looked at this two months ago, when I first >>> asked. I suspect >>> Ron hadn't even started his change at that point. And if >>> external >>> developers were able to submit changes to Hotspot, we wouldn't >>> have had to >>> bother Oracle engineers at all. Neither of these is your >>> fault or your >>> problem, of course - I'm grateful you were able to take a look.) >>> >>> Jeremy >>> >>> On Wed, Jul 8, 2015 at 6:19 AM, Coleen Phillimore < >>> coleen.phillimore at oracle.com >>> > wrote: >>> >>> I'll sponsor it but can you repost the RFR? >>> >>> There has been a fair bit of work to command line >>> processing lately so I'd >>> like to have the others look at it too. Have you merged >>> this up with the >>> latest version of hs-rt repository and were there >>> conflicts? Also, have >>> you looked at the RFR: >>> >>> "Open code review for 8061999 Enhance VM option parsing to >>> allow options >>> to be specified" >>> >>> and are there conflicts with this? >>> >>> The hotspot change looks good to me. >>> >>> >>> >>> http://cr.openjdk.java.net/~jmanson/8079301t/webrev.00/test/com/sun/management/HotSpotDiagnosticMXBean/CheckOrigin.java.udiff.html >>> < >>> http://cr.openjdk.java.net/%7Ejmanson/8079301t/webrev.00/test/com/sun/management/HotSpotDiagnosticMXBean/CheckOrigin.java.udiff.html >>> > >>> >>> "UseCerealGC" LOL >>> Can you use a different option than PrintOopAddress in >>> this test? I don't >>> know why this command line option exists or would be >>> useful for, and seems >>> to be a good candidate for removal. If you need a valid >>> argument, that is >>> unlikely to go away, TraceExceptions would be good. >>> >>> Thanks, >>> Coleen >>> >>> >>> On 7/7/15 8:00 PM, Jeremy Manson wrote: >>> >>> No love? Is there a code owner here I should pester >>> more directly? >>> >>> Jeremy >>> >>> On Fri, Jun 26, 2015 at 3:00 PM, Martin Buchholz >>> > >>> wrote: >>> >>> As usual with Google patches, they are in use >>> locally. This one has been >>> >>> stable for a while without complaints. Please >>> sponsor. >>> >>> On Fri, Jun 26, 2015 at 1:53 PM, Jeremy Manson >>> >> > >>> wrote: >>> >>> All this talk about IgnoreUnrecognizedVMOptions >>> reminded me that this >>> >>> review is still outstanding. Any takers? >>> >>> Jeremy >>> >>> On Tue, May 5, 2015 at 10:01 AM, Jeremy Manson >>> >> >>> wrote: >>> >>> Hi David, >>> >>> Thanks for taking a look. >>> >>> On Mon, May 4, 2015 at 8:32 PM, David >>> Holmes >> > >>> >>> wrote: >>> >>> Hi Jeremy, >>> >>> On 5/05/2015 6:51 AM, Jeremy Manson >>> wrote: >>> >>> Not sure who might be willing to >>> sponsor this. David? You did the >>> >>> last >>> one. :) >>> >>> Might be a while before I can >>> get to it. I did have a quick look >>> >>> (and >>> will need a longer one). >>> >>> I understand. I'm just happy it's >>> possible to upstream this stuff at >>> all[1]. >>> >>> [1] With the eternal caveat that I'd be >>> happier if we didn't *have* to >>> go through you folks, but we've learned to >>> live with it. >>> >>> >>> >>> Context: A number of command line >>> options are not settable via >>> >>> JAVA_TOOL_OPTIONS and _JAVA_OPTIONS: >>> >>> - PrintVMOptions >>> >>> So you have changed the >>> semantics of this to print out the >>> options >>> >>> from >>> the command-line and each of the two >>> env vars. Seems reasonable but >>> may be >>> better to know which option came from >>> where as we can now see the same >>> option (or conflicting variants >>> thereof) multiple times. >>> >>> I'd be happy to do this. Any >>> preferred syntax? Does someone >>> >>> actually >>> own this feature? >>> >>> I'm unclear what the current processing >>> order is for the different >>> >>> sources of options, and whether the >>> changes affect that order? >>> >>> Nope. I go through sad contortions >>> to keep the processing order the >>> >>> same. It's JAVA_TOOL_OPTIONS, then >>> command line, then _JAVA_OPTIONS. >>> See >>> lines 2549-2567. >>> >>> >>> - IgnoreUnrecognizedVMOptions >>> >>> - PrintFlagsInitial >>> >>> Unclear what "initial" actually >>> means - is it the default? >>> >>> More or less. If you stick, for example, >>> IgnoreUnrecognizedVMOptions >>> in >>> there first, it will get printed out as >>> "true". I haven't really >>> changed >>> the semantics here either - I've just >>> added processing of the envvars. >>> >>> - NativeMemoryTracking >>> >>> - PrintFlagsWithComments >>> >>> This is because these flags have >>> to be processed before processing >>> other >>> flags, and no one ever bothered to >>> do that for the flags coming from >>> environment variables. This patch >>> fixes that problem. >>> >>> I have a test, but it is a >>> modification to a JDK test instead >>> of a HS >>> test, >>> so it can go in separately (I guess). >>> >>> They can be pushed together to >>> different repos in the same forest. >>> >>> Okay. Here's the test change: >>> >>> http://cr.openjdk.java.net/~jmanson/8079301t/webrev.00/ >>> >>> >>> >>> As I said I'll have to get back to this. >>> And hopefully someone else in >>> >>> runtime will take a good look as well ;-) >>> >>> I'd be happy to toss it over to >>> whomever owns this, if anyone. >>> >>> Thanks! >>> >>> Jeremy >>> >>> >>> >>> Bug: >>> >>> https://bugs.openjdk.java.net/browse/JDK-8079301 >>> >>> Webrev: >>> http://cr.openjdk.java.net/~jmanson/8079301/webrev.00/ >>> >>> >>> Jeremy >>> >>> >>> >>> >>> >>> >> > From jeremymanson at google.com Fri Jul 10 17:16:14 2015 From: jeremymanson at google.com (Jeremy Manson) Date: Fri, 10 Jul 2015 10:16:14 -0700 Subject: RFR: 8079301: Some command line options not settable via JAVA_TOOL_OPTIONS In-Reply-To: <559F6BE3.9080002@oracle.com> References: <554839B4.3020800@oracle.com> <559D237C.2060702@oracle.com> <559EED17.4060109@oracle.com> <559F6BE3.9080002@oracle.com> Message-ID: On Thu, Jul 9, 2015 at 11:53 PM, David Holmes wrote: > Hi Jeremy, > > On 10/07/2015 10:23 AM, Jeremy Manson wrote: > >> Hey Dmitry, >> >> Thanks for looking at it. The leak was deliberate (under the theory that >> the command line flags were leaked, too), but it was silly that I didn't >> fix it. >> >> Anyway, fixed. See: >> >> http://cr.openjdk.java.net/~jmanson/8079301/webrev.03 >> > > I'm not sure you've changed anything in this regard but it seems to me to > me that if -XX:Flags=flags-file is specified on the command-line, and the > environment variable(s) then the last setting wins - which would be the > _JAVA_OPTIONS setting. > > Or maybe that is the way this whole thing works ie last setting wins? Yep - last setting is supposed to win. I tried to keep the behavior consistent with what was there for the other flags. Jeremy From derek.white at oracle.com Fri Jul 10 15:40:30 2015 From: derek.white at oracle.com (Derek White) Date: Fri, 10 Jul 2015 11:40:30 -0400 Subject: Runtime command-line deprecation (Was Re: RFR: 8066821(S) Enhance command line processing to manage deprecating and obsoleting -XX command line arguments In-Reply-To: <559AEC80.3010907@oracle.com> References: <54B44661.8070007@oracle.com> <54B84E91.1050708@oracle.com> <54D15A0B.6030501@oracle.com> <87B07B03-3423-4738-9617-0C7B72A74A6E@oracle.com> <559AEC80.3010907@oracle.com> Message-ID: <559FE76E.2060009@oracle.com> Hi Karen, Coleen, FYI - I'm getting back to this (was waiting for Gerard's big change). Once I have this merged and tested I'll send it out for review sometime next week. To the right alias this time :-) - Derek On 7/6/15 5:00 PM, Coleen Phillimore wrote: > > Hi, > > I'm happy for more clarity in the process of removing command line > arguments. I have some questions and comments below. > > On 6/26/15 4:09 PM, Karen Kinnear wrote: >> Derek, >> >> ... > So this is my question which is around the code review in question. > Note, Derek, can you resend the RFR to hotspot-dev at openjdk.java.net so > it gets to all of us (even the compiler team may want to share in the > mechanism). From dmitry.dmitriev at oracle.com Fri Jul 10 18:40:04 2015 From: dmitry.dmitriev at oracle.com (Dmitry Dmitriev) Date: Fri, 10 Jul 2015 21:40:04 +0300 Subject: RFR: 8079301: Some command line options not settable via JAVA_TOOL_OPTIONS In-Reply-To: References: <554839B4.3020800@oracle.com> <559D237C.2060702@oracle.com> <559EED17.4060109@oracle.com> <559FAE4B.5060505@oracle.com> <559FBFFB.3060206@oracle.com> Message-ID: <55A01184.7080102@oracle.com> Jeremy, thank you for fixing that! Please, see my comments inline for 2 item and one more comment. On 10.07.2015 20:15, Jeremy Manson wrote: > Thanks for the detailed look, Dmitry. I have taken your advice, with > a couple of exceptions: > > 1) I named the method free_memory_for_vm_init_args instead > of free_memory_for_environment_variables. > 2) I did not free the memory in 3661-3663 or in 3679-3681, because > those are error paths where the memory may not have been allocated in > the first place. So freeing it might lead to a crash. Yes, you are right. But I think we can guard from this by adding check for args->options in new free_memory_for_vm_init_args function and free memory in all execution paths. If args->options is not NULL, then memory is allocated and must be freed: 3485 static void free_memory_for_vm_init_args(JavaVMInitArgs* args) { 3486 if( args->options != NULL ) { 3487 for (int i = 0; i < args->nOptions; i++) { 3488 os::free(args->options[i].optionString); 3489 } 3490 FREE_C_HEAP_ARRAY(JavaVMOption, args->options); 3491 } 3492 } As I see you add free memory for error paths at lines(webrev.04) 3668-3671 and 3687-3691. Thus, with that guard you can add two calls to free_memory_for_vm_init_args function before "return JNI_EINVAL;" on line 3696: 3693 #ifdef ASSERT 3694 // Parse default .hotspotrc settings file 3695 if (!process_settings_file(".hotspotrc", false, args->ignoreUnrecognized)) { 3696 return JNI_EINVAL; 3697 } 3698 #else And one more comment. Unfortunately I oversight this before... You not check return value from 'match_special_option_and_act' new function on lines 3673-3675, but in one case it can return error(JNI_ERR) when "-XX:NativeMemoryTracking" is specified and INCLUDE_NMT is not defined. Thus, I think that check for return value should be added(with freeing memory for env variables in case of error). Thank you, Dmitry > > New Rev: > > http://cr.openjdk.java.net/~jmanson/8079301/webrev.04/ > > > Jeremy > > On Fri, Jul 10, 2015 at 5:52 AM, Dmitry Dmitriev > > wrote: > > Jeremy, > > Two additional comments which I didn't catch earlier... > > 1) Order of processing command line options is > following(Arguments::parse_vm_init_args function): options from > JAVA_TOOL_OPTIONS environment variable, then options from command > line and then options from _JAVA_OPTIONS environment variable. And > last argument wins! > > You not change this order in Arguments::parse_vm_init_args > function, but it seems that order in several other places is changed. > > Lines 3665-3667: > > 3665 match_special_option_and_act(args, &flags_file); > 3666 match_special_option_and_act(&java_tool_options_args, > &flags_file); > 3667 match_special_option_and_act(&java_options_args, &flags_file); > > Here we see that order is following: options from command line, > then options from JAVA_TOOL_OPTIONS environment variable and then > options from _JAVA_OPTIONS environment variable. Thus, in this > case "-XX:+IgnoreUnrecognizedVMOptions" option in > JAVA_TOOL_OPTIONS environment variable will have bigger priority > than in command line(last argument wins), but this is differ from > processing options in Arguments::parse_vm_init_args function. > Thus, I think that you need to swap 3665 and 3666 lines: > > 3665 match_special_option_and_act(&java_tool_options_args, > &flags_file); > 3666 match_special_option_and_act(args, &flags_file); > 3667 match_special_option_and_act(&java_options_args, &flags_file); > > Similar situation on lines 3696-3700: > > 3696 if (PrintVMOptions) { > 3697 print_options(args); > 3698 print_options(&java_tool_options_args); > 3699 print_options(&java_options_args); > 3700 } > > Command line options are printed before options from > JAVA_TOOL_OPTIONS environment variable. Thus, I think that you > need to swap 3697 and 3698 lines: > > 3696 if (PrintVMOptions) { > 3697 print_options(&java_tool_options_args); > 3698 print_options(args); > 3699 print_options(&java_options_args); > 3700 } > > > 2) One more thing about error processing :) > I think it will be great to free allocated memory for environment > variables when error occured on lines 3661-3663, 3679-3681 and > 3685-3687. > My suggestion is to add some static function which free memory for > env variables, something like that: > static void free_memory_for_environment_variables( JavaVMInitArgs > *options_args ) { > for (int i = 0; i < options_args->nOptions; i++) { > os::free(options_args->options[i].optionString); > } > FREE_C_HEAP_ARRAY(JavaVMOption, options_args->options); > } > > And change lines 3661-3663 to following: > > 3661 if (code != JNI_OK) { > 3662 free_memory_for_environment_variables(&java_tool_options_args); > 3663 return code; > 3664 } > > Lines 3679-3681 to following: > > 3679 if (!process_settings_file(flags_file, true, > args->ignoreUnrecognized)) { > 3680 free_memory_for_environment_variables(&java_tool_options_args); > 3681 free_memory_for_environment_variables(&java_options_args); > 3682 return JNI_EINVAL; > 3683 } > > Lines 3685-3687 to following: > > 3685 if (!process_settings_file(".hotspotrc", false, > args->ignoreUnrecognized)) { > 3680 free_memory_for_environment_variables(&java_tool_options_args); > 3681 free_memory_for_environment_variables(&java_options_args); > 3686 return JNI_EINVAL; > 3687 } > > And lines 3706-3715 to following: > > 3706 // Done with the envvars > 3707 free_memory_for_environment_variables(&java_tool_options_args); > 3708 free_memory_for_environment_variables(&java_options_args); > > > Thank you, > Dmitry > > > On 10.07.2015 14:36, Dmitry Dmitriev wrote: > > Hello Jeremy, > > Thank you for fixing that! But in this case we still have > minor issue when quotes processing failed(lines 3438-3444). > Here is my suggestion: leave 'while' cycle(lines 3423-3462) as > I was in your previous webrev(without 'start' and etc.) and > call strdup when copy 'options' to 'options_arr' on lines > 3472-3474, i.e. make lines 3472-3474 like this: > > 3472 for (int i = 0; i < options->length(); i++) { > 3473 options_arr[i] = options->at(i); > 3474 options_arr[i].optionString = > os::strdup(options_arr[i].optionString); > 3475 } > > What you think about that? > > Regards, > Dmitry > > On 10.07.2015 3:23, Jeremy Manson wrote: > > Hey Dmitry, > > Thanks for looking at it. The leak was deliberate (under > the theory that the command line flags were leaked, too), > but it was silly that I didn't fix it. > > Anyway, fixed. See: > > http://cr.openjdk.java.net/~jmanson/8079301/webrev.03 > > > > Jeremy > > On Thu, Jul 9, 2015 at 2:52 PM, Dmitry Dmitriev > > >> wrote: > > Hello Jeremy, > > Correct me if I am wrong, but I see small memory leak > in your > implementation. > In Arguments::parse_options_environment_variable > function memory > for 'buffer' allocated by strdup function on line > 3415, but now it > not freed in this function because data from this > buffer is used > later. On the other hand when we are done with env > variables, we > free only options array(lines 3703-3705) and not free > previously > allocated memory for 'buffer' because we lost track > for it. > > Thanks, > Dmitry > > > On 09.07.2015 21:20, Jeremy Manson wrote: > > Thanks for looking at this, Coleen. > > I merged this with the latest version of hs-rt, > but Ron is or > I am going to > have to do some merging for 8061999. The changes > are relatively > orthogonal, but they touch a couple of the same > places. How > far away is > Ron's checkin? > > Updated webrev: > > http://cr.openjdk.java.net/~jmanson/8079301/webrev.01/ > > > > Updated test: > > http://cr.openjdk.java.net/~jmanson/8079301t/webrev.01/ > > > > (Mild complaining on my part: the conflicts > wouldn't have been > an issue if > someone had looked at this two months ago, when I > first > asked. I suspect > Ron hadn't even started his change at that point. > And if external > developers were able to submit changes to Hotspot, > we wouldn't > have had to > bother Oracle engineers at all. Neither of these > is your > fault or your > problem, of course - I'm grateful you were able to > take a look.) > > Jeremy > > On Wed, Jul 8, 2015 at 6:19 AM, Coleen Phillimore < > coleen.phillimore at oracle.com > > >> wrote: > > I'll sponsor it but can you repost the RFR? > > There has been a fair bit of work to command line > processing lately so I'd > like to have the others look at it too. Have > you merged > this up with the > latest version of hs-rt repository and were there > conflicts? Also, have > you looked at the RFR: > > "Open code review for 8061999 Enhance VM > option parsing to > allow options > to be specified" > > and are there conflicts with this? > > The hotspot change looks good to me. > > > http://cr.openjdk.java.net/~jmanson/8079301t/webrev.00/test/com/sun/management/HotSpotDiagnosticMXBean/CheckOrigin.java.udiff.html > > > > "UseCerealGC" LOL > Can you use a different option than > PrintOopAddress in > this test? I don't > know why this command line option exists or > would be > useful for, and seems > to be a good candidate for removal. If you > need a valid > argument, that is > unlikely to go away, TraceExceptions would be > good. > > Thanks, > Coleen > > > On 7/7/15 8:00 PM, Jeremy Manson wrote: > > No love? Is there a code owner here I > should pester > more directly? > > Jeremy > > On Fri, Jun 26, 2015 at 3:00 PM, Martin > Buchholz > >> > wrote: > > As usual with Google patches, they are > in use > locally. This one has been > > stable for a while without complaints. > Please > sponsor. > > On Fri, Jun 26, 2015 at 1:53 PM, > Jeremy Manson > > >> > wrote: > > All this talk about > IgnoreUnrecognizedVMOptions > reminded me that this > > review is still outstanding. Any > takers? > > Jeremy > > On Tue, May 5, 2015 at 10:01 AM, > Jeremy Manson > > > > wrote: > > Hi David, > > Thanks for taking a look. > > On Mon, May 4, 2015 at 8:32 > PM, David > Holmes > > >> > > wrote: > > Hi Jeremy, > > On 5/05/2015 6:51 AM, > Jeremy Manson wrote: > > Not sure who might be > willing to > sponsor this. David? You > did the > > last > one. :) > > Might be a while > before I can > get to it. I did have > a quick look > > (and > will need a longer one). > > I understand. I'm just happy it's > possible to upstream this stuff at > all[1]. > > [1] With the eternal caveat > that I'd be > happier if we didn't *have* to > go through you folks, but > we've learned to > live with it. > > > > Context: A number of > command line > options are not settable via > > JAVA_TOOL_OPTIONS and _JAVA_OPTIONS: > > - PrintVMOptions > > So you have changed the > semantics of this to > print out the > options > > from > the command-line and each > of the two > env vars. Seems reasonable but > may be > better to know which > option came from > where as we can now see > the same > option (or conflicting > variants > thereof) multiple times. > > I'd be happy to do > this. Any > preferred syntax? Does someone > > actually > own this feature? > > I'm unclear what the current > processing > order is for the different > > sources of options, and > whether the > changes affect that order? > > Nope. I go through sad > contortions > to keep the processing > order the > > same. It's JAVA_TOOL_OPTIONS, > then > command line, then _JAVA_OPTIONS. > See > lines 2549-2567. > > > - > IgnoreUnrecognizedVMOptions > > - PrintFlagsInitial > > Unclear what > "initial" actually > means - is it the default? > > More or less. If you stick, > for example, > IgnoreUnrecognizedVMOptions > in > there first, it will get > printed out as > "true". I haven't really > changed > the semantics here either - > I've just > added processing of the envvars. > > - NativeMemoryTracking > > - PrintFlagsWithComments > > This is because these > flags have > to be processed before > processing > other > flags, and no one ever > bothered to > do that for the flags > coming from > environment > variables. This patch > fixes that problem. > > I have a test, but it is a > modification to a JDK > test instead > of a HS > test, > so it can go in > separately (I guess). > > They can be pushed > together to > different repos in the > same forest. > > Okay. Here's the test > change: > > http://cr.openjdk.java.net/~jmanson/8079301t/webrev.00/ > > > > > As I said I'll have to get > back to this. > And hopefully someone else in > > runtime will take a good > look as well ;-) > > I'd be happy to toss it > over to > whomever owns this, if anyone. > > Thanks! > > Jeremy > > > > Bug: > > https://bugs.openjdk.java.net/browse/JDK-8079301 > > Webrev: > http://cr.openjdk.java.net/~jmanson/8079301/webrev.00/ > > > > Jeremy > > > > > > > > From yumin.qi at oracle.com Fri Jul 10 20:37:50 2015 From: yumin.qi at oracle.com (Yumin Qi) Date: Fri, 10 Jul 2015 13:37:50 -0700 Subject: RFR: 8025692: Add trace to find out what methods are used at runtime. In-Reply-To: <559FF3F6.7060400@oracle.com> References: <5514C1CB.7020009@oracle.com> <55711388.4090402@oracle.com> <559F4B5B.60203@oracle.com> <559FF3F6.7060400@oracle.com> Message-ID: <55A02D1E.10404@oracle.com> Thanks, Misha The failure of the failed 4 jobs, some of dependency error, which I think is dtrace, some are agent download encountered 'check sum' which I think is configuration problem. Still, the 4 running jobs just hang there and no progress --- may as you said, it is Windows problem. Yumin On 7/10/2015 9:33 AM, Mikhailo Seledtsov wrote: > It is a known issue with Aurora; the RBT jobs get stuck on Win-x64. > The fix's ETA is on 13-July during next Aurora patch deployemnt. > > You could still check status of testing on jobs that complete: > - go to your main RBT status for your job (e.g. > http://sla03.se.oracle.com:3000/rbt/rbt-mikhailo.seledtsov-hs-rt-20150709-1543-2147) > > For overall status, just see the summary under "Test Failures" tab > > For details on particular failures, do: > - Under "Test Progress"-> x of Y jobs succeeded, click the "wheel" > symbol -> Main > - this will lead you to your Aurora main jobs page > - there, you could click "Go to batch results", see a table of new > failures, and look into them in detail > > Hope this helps, > Misha > > > On 7/9/2015 9:34 PM, Yumin Qi wrote: >> Hi, Karen >> >> Just informed you that RBT testing for quick testing seems will not >> get back a completed result(I have tried several times those days). >> After 11 hours, there still 4 jobs running: >> >> 26 of 34 succeeded, 4 failed, 4 still running. >> >> Those running jobs already run at least 6+ hours. >> The 4 failed jobs are dtrace on linux-x64 which are OK, since >> dtrace is disabled on it. >> >> Also, I added -Xint to test case, and tested with jtreg on >> test/runtime showed no new failures found. >> I am going to push the changes if you are OK with current result. >> Seems the testing with RBT will never come back. Updated webrev: >> >> http://cr.openjdk.java.net/~minqi/8025692/webrev02/ >> >> Thanks >> Yumin >> >> On 6/18/2015 1:01 PM, Karen Kinnear wrote: >>> Yumin, >>> >>> Thank you very much for the updates.And the PERM_REFCOUNT rather >>> than -1 :-) >>> Looks good. >>> >>> Thank you for testing this -Xint. If there is an easy way to add an >>> -Xint line >>> to the test that would be useful - but not critical. >>> >>> So I presume that the "aurora default test suites" includes: >>> jcks, jtreg hotspot and Christian's new "quick" tests. >>> >>> thanks, >>> Karen >>> >>> On Jun 4, 2015, at 11:12 PM, Yumin Qi wrote: >>> >>>> HI, All >>>> >>>> After several round of codereviews and discussion, now the second >>>> version is at: >>>> http://cr.openjdk.java.net/~minqi/8025692/webrev02/ >>>> >>>> The flag names changed: >>>> >>>> TraceMethodUsge => LogTouchedMethods >>>> PrintMethodUsageAtExit => PrintTouchedMethodsAtExit >>>> >>>> The two flags now are diagnostic flags. >>>> >>>> Also similar, there changed in related variable names. >>>> Also fixed a flaw which is not found during last round of >>>> review: append new TouchedMethodRecord to end of hash bucket list. >>>> >>>> Make change to interpreter method entry generation(for both >>>> native and normal) to enable build_method_counter called. This is >>>> necessary since if run -Xint, the call will be skipped so our code >>>> will be skipped so no logging for touched methods. >>>> >>>> Added test case for jcmd: jcmd VM.print_touched_methods. >>>> >>>> Tests: JPRT, aurora default test suites (in progress). >>>> >>>> Thanks >>>> Yumin >>>> >>>> >>>> On 3/26/2015 7:34 PM, Yumin Qi wrote: >>>>> Please review: >>>>> >>>>> bug: https://bugs.openjdk.java.net/browse/JDK-8025692 >>>>> webrev: http://cr.openjdk.java.net/~minqi/8025692/webrev01/ >>>>> >>>>> Summary: Add two flags to help list all java methods called in >>>>> runtime, this is also in product and can help CDS to rearrange >>>>> methods in shared archive to avoid loading infrequent methods into >>>>> memory. >>>>> >>>>> Tests: vm.runtime.quick.testlist, JPRT >>>>> >>>>> >>>>> Thanks >>>>> Yumin >>>>> >>>>> >> > From coleen.phillimore at oracle.com Fri Jul 10 21:16:11 2015 From: coleen.phillimore at oracle.com (Coleen Phillimore) Date: Fri, 10 Jul 2015 17:16:11 -0400 Subject: RFR: 8079301: Some command line options not settable via JAVA_TOOL_OPTIONS In-Reply-To: <55A01184.7080102@oracle.com> References: <554839B4.3020800@oracle.com> <559D237C.2060702@oracle.com> <559EED17.4060109@oracle.com> <559FAE4B.5060505@oracle.com> <559FBFFB.3060206@oracle.com> <55A01184.7080102@oracle.com> Message-ID: <55A0361B.2060307@oracle.com> Hi, I have a couple of suggestions. Can you add a destructor to JavaVMInitArgs which will delete the options things if they exist? Then you won't need these free_memory_for_vm_init_args functions. I think this would work. Secondly, I was also going to comment about match_special_option_and_act not using it's return value. The destructor code would make this less cumbersome. I like the refactoring though. Thanks, Coleen On 7/10/15 2:40 PM, Dmitry Dmitriev wrote: > Jeremy, thank you for fixing that! Please, see my comments inline for > 2 item and one more comment. > > On 10.07.2015 20:15, Jeremy Manson wrote: >> Thanks for the detailed look, Dmitry. I have taken your advice, with >> a couple of exceptions: >> >> 1) I named the method free_memory_for_vm_init_args instead of >> free_memory_for_environment_variables. >> 2) I did not free the memory in 3661-3663 or in 3679-3681, because >> those are error paths where the memory may not have been allocated in >> the first place. So freeing it might lead to a crash. > Yes, you are right. But I think we can guard from this by adding check > for args->options in new free_memory_for_vm_init_args function and > free memory in all execution paths. If args->options is not NULL, then > memory is allocated and must be freed: > > 3485 static void free_memory_for_vm_init_args(JavaVMInitArgs* args) { > 3486 if( args->options != NULL ) { > 3487 for (int i = 0; i < args->nOptions; i++) { > 3488 os::free(args->options[i].optionString); > 3489 } > 3490 FREE_C_HEAP_ARRAY(JavaVMOption, args->options); > 3491 } > 3492 } > > As I see you add free memory for error paths at lines(webrev.04) > 3668-3671 and 3687-3691. Thus, with that guard you can add two calls > to free_memory_for_vm_init_args function before "return JNI_EINVAL;" > on line 3696: > > 3693 #ifdef ASSERT > 3694 // Parse default .hotspotrc settings file > 3695 if (!process_settings_file(".hotspotrc", false, > args->ignoreUnrecognized)) { > 3696 return JNI_EINVAL; > 3697 } > 3698 #else > > > And one more comment. Unfortunately I oversight this before... You not > check return value from 'match_special_option_and_act' new function on > lines 3673-3675, but in one case it can return error(JNI_ERR) when > "-XX:NativeMemoryTracking" is specified and INCLUDE_NMT is not > defined. Thus, I think that check for return value should be > added(with freeing memory for env variables in case of error). > > Thank you, > Dmitry > >> >> New Rev: >> >> http://cr.openjdk.java.net/~jmanson/8079301/webrev.04/ >> >> >> Jeremy >> >> On Fri, Jul 10, 2015 at 5:52 AM, Dmitry Dmitriev >> > wrote: >> >> Jeremy, >> >> Two additional comments which I didn't catch earlier... >> >> 1) Order of processing command line options is >> following(Arguments::parse_vm_init_args function): options from >> JAVA_TOOL_OPTIONS environment variable, then options from command >> line and then options from _JAVA_OPTIONS environment variable. And >> last argument wins! >> >> You not change this order in Arguments::parse_vm_init_args >> function, but it seems that order in several other places is >> changed. >> >> Lines 3665-3667: >> >> 3665 match_special_option_and_act(args, &flags_file); >> 3666 match_special_option_and_act(&java_tool_options_args, >> &flags_file); >> 3667 match_special_option_and_act(&java_options_args, &flags_file); >> >> Here we see that order is following: options from command line, >> then options from JAVA_TOOL_OPTIONS environment variable and then >> options from _JAVA_OPTIONS environment variable. Thus, in this >> case "-XX:+IgnoreUnrecognizedVMOptions" option in >> JAVA_TOOL_OPTIONS environment variable will have bigger priority >> than in command line(last argument wins), but this is differ from >> processing options in Arguments::parse_vm_init_args function. >> Thus, I think that you need to swap 3665 and 3666 lines: >> >> 3665 match_special_option_and_act(&java_tool_options_args, >> &flags_file); >> 3666 match_special_option_and_act(args, &flags_file); >> 3667 match_special_option_and_act(&java_options_args, &flags_file); >> >> Similar situation on lines 3696-3700: >> >> 3696 if (PrintVMOptions) { >> 3697 print_options(args); >> 3698 print_options(&java_tool_options_args); >> 3699 print_options(&java_options_args); >> 3700 } >> >> Command line options are printed before options from >> JAVA_TOOL_OPTIONS environment variable. Thus, I think that you >> need to swap 3697 and 3698 lines: >> >> 3696 if (PrintVMOptions) { >> 3697 print_options(&java_tool_options_args); >> 3698 print_options(args); >> 3699 print_options(&java_options_args); >> 3700 } >> >> >> 2) One more thing about error processing :) >> I think it will be great to free allocated memory for environment >> variables when error occured on lines 3661-3663, 3679-3681 and >> 3685-3687. >> My suggestion is to add some static function which free memory for >> env variables, something like that: >> static void free_memory_for_environment_variables( JavaVMInitArgs >> *options_args ) { >> for (int i = 0; i < options_args->nOptions; i++) { >> os::free(options_args->options[i].optionString); >> } >> FREE_C_HEAP_ARRAY(JavaVMOption, options_args->options); >> } >> >> And change lines 3661-3663 to following: >> >> 3661 if (code != JNI_OK) { >> 3662 free_memory_for_environment_variables(&java_tool_options_args); >> 3663 return code; >> 3664 } >> >> Lines 3679-3681 to following: >> >> 3679 if (!process_settings_file(flags_file, true, >> args->ignoreUnrecognized)) { >> 3680 free_memory_for_environment_variables(&java_tool_options_args); >> 3681 free_memory_for_environment_variables(&java_options_args); >> 3682 return JNI_EINVAL; >> 3683 } >> >> Lines 3685-3687 to following: >> >> 3685 if (!process_settings_file(".hotspotrc", false, >> args->ignoreUnrecognized)) { >> 3680 free_memory_for_environment_variables(&java_tool_options_args); >> 3681 free_memory_for_environment_variables(&java_options_args); >> 3686 return JNI_EINVAL; >> 3687 } >> >> And lines 3706-3715 to following: >> >> 3706 // Done with the envvars >> 3707 free_memory_for_environment_variables(&java_tool_options_args); >> 3708 free_memory_for_environment_variables(&java_options_args); >> >> >> Thank you, >> Dmitry >> >> >> On 10.07.2015 14:36, Dmitry Dmitriev wrote: >> >> Hello Jeremy, >> >> Thank you for fixing that! But in this case we still have >> minor issue when quotes processing failed(lines 3438-3444). >> Here is my suggestion: leave 'while' cycle(lines 3423-3462) as >> I was in your previous webrev(without 'start' and etc.) and >> call strdup when copy 'options' to 'options_arr' on lines >> 3472-3474, i.e. make lines 3472-3474 like this: >> >> 3472 for (int i = 0; i < options->length(); i++) { >> 3473 options_arr[i] = options->at(i); >> 3474 options_arr[i].optionString = >> os::strdup(options_arr[i].optionString); >> 3475 } >> >> What you think about that? >> >> Regards, >> Dmitry >> >> On 10.07.2015 3:23, Jeremy Manson wrote: >> >> Hey Dmitry, >> >> Thanks for looking at it. The leak was deliberate (under >> the theory that the command line flags were leaked, too), >> but it was silly that I didn't fix it. >> >> Anyway, fixed. See: >> >> http://cr.openjdk.java.net/~jmanson/8079301/webrev.03 >> >> >> >> Jeremy >> >> On Thu, Jul 9, 2015 at 2:52 PM, Dmitry Dmitriev >> > >> > >> wrote: >> >> Hello Jeremy, >> >> Correct me if I am wrong, but I see small memory leak >> in your >> implementation. >> In Arguments::parse_options_environment_variable >> function memory >> for 'buffer' allocated by strdup function on line >> 3415, but now it >> not freed in this function because data from this >> buffer is used >> later. On the other hand when we are done with env >> variables, we >> free only options array(lines 3703-3705) and not free >> previously >> allocated memory for 'buffer' because we lost track >> for it. >> >> Thanks, >> Dmitry >> >> >> On 09.07.2015 21:20, Jeremy Manson wrote: >> >> Thanks for looking at this, Coleen. >> >> I merged this with the latest version of hs-rt, >> but Ron is or >> I am going to >> have to do some merging for 8061999. The changes >> are relatively >> orthogonal, but they touch a couple of the same >> places. How >> far away is >> Ron's checkin? >> >> Updated webrev: >> >> http://cr.openjdk.java.net/~jmanson/8079301/webrev.01/ >> >> >> >> Updated test: >> >> http://cr.openjdk.java.net/~jmanson/8079301t/webrev.01/ >> >> >> >> (Mild complaining on my part: the conflicts >> wouldn't have been >> an issue if >> someone had looked at this two months ago, when I >> first >> asked. I suspect >> Ron hadn't even started his change at that point. >> And if external >> developers were able to submit changes to Hotspot, >> we wouldn't >> have had to >> bother Oracle engineers at all. Neither of these >> is your >> fault or your >> problem, of course - I'm grateful you were able to >> take a look.) >> >> Jeremy >> >> On Wed, Jul 8, 2015 at 6:19 AM, Coleen Phillimore < >> coleen.phillimore at oracle.com >> >> > >> wrote: >> >> I'll sponsor it but can you repost the RFR? >> >> There has been a fair bit of work to command >> line >> processing lately so I'd >> like to have the others look at it too. Have >> you merged >> this up with the >> latest version of hs-rt repository and were >> there >> conflicts? Also, have >> you looked at the RFR: >> >> "Open code review for 8061999 Enhance VM >> option parsing to >> allow options >> to be specified" >> >> and are there conflicts with this? >> >> The hotspot change looks good to me. >> >> >> http://cr.openjdk.java.net/~jmanson/8079301t/webrev.00/test/com/sun/management/HotSpotDiagnosticMXBean/CheckOrigin.java.udiff.html >> >> >> >> "UseCerealGC" LOL >> Can you use a different option than >> PrintOopAddress in >> this test? I don't >> know why this command line option exists or >> would be >> useful for, and seems >> to be a good candidate for removal. If you >> need a valid >> argument, that is >> unlikely to go away, TraceExceptions would be >> good. >> >> Thanks, >> Coleen >> >> >> On 7/7/15 8:00 PM, Jeremy Manson wrote: >> >> No love? Is there a code owner here I >> should pester >> more directly? >> >> Jeremy >> >> On Fri, Jun 26, 2015 at 3:00 PM, Martin >> Buchholz >> > > >> >> wrote: >> >> As usual with Google patches, they are >> in use >> locally. This one has been >> >> stable for a while without complaints. >> Please >> sponsor. >> >> On Fri, Jun 26, 2015 at 1:53 PM, >> Jeremy Manson >> > >> > >> >> wrote: >> >> All this talk about >> IgnoreUnrecognizedVMOptions >> reminded me that this >> >> review is still outstanding. Any >> takers? >> >> Jeremy >> >> On Tue, May 5, 2015 at 10:01 AM, >> Jeremy Manson >> > >> > > >> wrote: >> >> Hi David, >> >> Thanks for taking a look. >> >> On Mon, May 4, 2015 at 8:32 >> PM, David >> Holmes >> >> > >> >> >> wrote: >> >> Hi Jeremy, >> >> On 5/05/2015 6:51 AM, >> Jeremy Manson wrote: >> >> Not sure who might be >> willing to >> sponsor this. David? You >> did the >> >> last >> one. :) >> >> Might be a while >> before I can >> get to it. I did have >> a quick look >> >> (and >> will need a longer one). >> >> I understand. I'm just happy >> it's >> possible to upstream this >> stuff at >> all[1]. >> >> [1] With the eternal caveat >> that I'd be >> happier if we didn't *have* to >> go through you folks, but >> we've learned to >> live with it. >> >> >> >> Context: A number of >> command line >> options are not settable via >> >> JAVA_TOOL_OPTIONS and _JAVA_OPTIONS: >> >> - PrintVMOptions >> >> So you have changed >> the >> semantics of this to >> print out the >> options >> >> from >> the command-line and each >> of the two >> env vars. Seems >> reasonable but >> may be >> better to know which >> option came from >> where as we can now see >> the same >> option (or conflicting >> variants >> thereof) multiple times. >> >> I'd be happy to do >> this. Any >> preferred syntax? Does >> someone >> >> actually >> own this feature? >> >> I'm unclear what the current >> processing >> order is for the different >> >> sources of options, and >> whether the >> changes affect that order? >> >> Nope. I go through sad >> contortions >> to keep the processing >> order the >> >> same. It's JAVA_TOOL_OPTIONS, >> then >> command line, then >> _JAVA_OPTIONS. >> See >> lines 2549-2567. >> >> >> - >> IgnoreUnrecognizedVMOptions >> >> - PrintFlagsInitial >> >> Unclear what >> "initial" actually >> means - is it the >> default? >> >> More or less. If you stick, >> for example, >> IgnoreUnrecognizedVMOptions >> in >> there first, it will get >> printed out as >> "true". I haven't really >> changed >> the semantics here either - >> I've just >> added processing of the envvars. >> >> - NativeMemoryTracking >> >> - >> PrintFlagsWithComments >> >> This is because these >> flags have >> to be processed before >> processing >> other >> flags, and no one ever >> bothered to >> do that for the flags >> coming from >> environment >> variables. This patch >> fixes that problem. >> >> I have a test, but it >> is a >> modification to a JDK >> test instead >> of a HS >> test, >> so it can go in >> separately (I guess). >> >> They can be pushed >> together to >> different repos in the >> same forest. >> >> Okay. Here's the test >> change: >> >> http://cr.openjdk.java.net/~jmanson/8079301t/webrev.00/ >> >> >> >> >> As I said I'll have to get >> back to this. >> And hopefully someone else in >> >> runtime will take a good >> look as well ;-) >> >> I'd be happy to toss it >> over to >> whomever owns this, if >> anyone. >> >> Thanks! >> >> Jeremy >> >> >> >> Bug: >> >> https://bugs.openjdk.java.net/browse/JDK-8079301 >> >> Webrev: >> http://cr.openjdk.java.net/~jmanson/8079301/webrev.00/ >> >> >> >> Jeremy >> >> >> >> >> >> >> >> > From chenyt.cs.sjtu at gmail.com Fri Jul 10 21:32:24 2015 From: chenyt.cs.sjtu at gmail.com (Yuting Chen) Date: Fri, 10 Jul 2015 14:32:24 -0700 Subject: Fwd: An undefined behavior w.r.t. In-Reply-To: References: Message-ID: >>Reported to jls-jvms-spec-comments, and so far no response. >>Thus I report the problem here again. Hello, I recently feel puzzling about the JVM behaviors when an illegal is met. The specification may not be complete in this part. In the specification (jvms-2.9, se8), we have the words: "In a class file whose version number is 51.0 or above, the method must additionally have its ACC_STATIC flag (?4.6) set in order to be the class or interface initialization method." However, the behavior is undefined if the ACC_STATIC flag is not set. Thus when a class without an ACC_STATIC flag may either be accepted or be rejected, depending on the JVM developers. The results can be unpredictable. I checked this by running a class on OpenJDK8-HotSpot and IBM J9, and found different results. The class can be run on HotSpot without triggering any exceptions (i.e., is of no consequence). However, IBM J9 can throw out a FormatError (Exception in thread "main" java.lang.ClassFormatError: JVMCFRE074 no Code attribute specified; class=M1436188543, method=()V, pc=0). I checked the specification and still could not decide which JVM behaves correctly. (I thought the question again, and believed that it can be better if HotSpot can also report a ClassFormatError.) The class is attached, and the decompiled code is given next: class M1436188543 minor version: 0 major version: 51 flags: ACC_SUPER Constant pool: #1 = Utf8 java/lang/Object #2 = Utf8 #3 = Utf8 SourceFile #4 = Utf8 M1436188543 #5 = Utf8 main #6 = Class #4 // M1436188543 #7 = Utf8 Code #8 = Utf8 ([Ljava/lang/String;)V #9 = Utf8 ()V #10 = Utf8 Jasmin #11 = Class #1 // java/lang/Object { public abstract {}; descriptor: ()V flags: ACC_PUBLIC, ACC_ABSTRACT public static void main(java.lang.String[]); descriptor: ([Ljava/lang/String;)V flags: ACC_PUBLIC, ACC_STATIC Code: stack=0, locals=1, args_size=1 0: return } From duboscq at ssw.jku.at Sun Jul 12 11:36:36 2015 From: duboscq at ssw.jku.at (Gilles Duboscq) Date: Sun, 12 Jul 2015 11:36:36 +0000 Subject: An undefined behavior w.r.t. In-Reply-To: References: Message-ID: Hi Yuting, I think the behaviour is well defined even if the method is not ACC_STATIC: in this case if the class version is >= 51.0 then this method is *not* the special "class initializer" method and it will not be called during class initialization. To cite jvms: "Other methods named in a class file are of no consequence. They are not class or interface initialization methods." I do not think the JVM should throw any exception because of this. Your example is interesting for an other reason though. The class file was stripped by the mailing list system but from the javap dump it looks like your method is abstract and has no code. If the class file version was < 51.0, i'm not exactly sure what should happen. Gilles On Fri, Jul 10, 2015 at 11:34 PM Yuting Chen wrote: > >>Reported to jls-jvms-spec-comments, and so far no response. > >>Thus I report the problem here again. > > Hello, I recently feel puzzling about the JVM behaviors when an > illegal is met. The specification may not be complete in this > part. > > In the specification (jvms-2.9, se8), we have the words: "In a class > file whose version number is 51.0 or above, the method must > additionally have its ACC_STATIC flag (?4.6) set in order to be the > class or interface initialization method." > > However, the behavior is undefined if the ACC_STATIC flag is not set. > Thus when a class without an ACC_STATIC flag may either be accepted or > be rejected, depending on the JVM developers. The results can be > unpredictable. > > I checked this by running a class on OpenJDK8-HotSpot and IBM J9, and > found different results. The class can be run on HotSpot without > triggering any exceptions (i.e., is of no consequence). > However, IBM J9 can throw out a FormatError (Exception in thread > "main" java.lang.ClassFormatError: JVMCFRE074 no Code attribute > specified; class=M1436188543, method=()V, pc=0). I checked the > specification and still could not decide which JVM behaves correctly. > > (I thought the question again, and believed that it can be better if > HotSpot can also report a ClassFormatError.) > > The class is attached, and the decompiled code is given next: > > class M1436188543 > minor version: 0 > major version: 51 > flags: ACC_SUPER > Constant pool: > #1 = Utf8 java/lang/Object > #2 = Utf8 > #3 = Utf8 SourceFile > #4 = Utf8 M1436188543 > #5 = Utf8 main > #6 = Class #4 // M1436188543 > #7 = Utf8 Code > #8 = Utf8 ([Ljava/lang/String;)V > #9 = Utf8 ()V > #10 = Utf8 Jasmin > #11 = Class #1 // java/lang/Object > { > public abstract {}; > descriptor: ()V > flags: ACC_PUBLIC, ACC_ABSTRACT > > public static void main(java.lang.String[]); > descriptor: ([Ljava/lang/String;)V > flags: ACC_PUBLIC, ACC_STATIC > Code: > stack=0, locals=1, args_size=1 > 0: return > } > From dmitry.dmitriev at oracle.com Sun Jul 12 14:27:26 2015 From: dmitry.dmitriev at oracle.com (Dmitry Dmitriev) Date: Sun, 12 Jul 2015 17:27:26 +0300 Subject: RFR: 8079301: Some command line options not settable via JAVA_TOOL_OPTIONS In-Reply-To: <55A0361B.2060307@oracle.com> References: <554839B4.3020800@oracle.com> <559D237C.2060702@oracle.com> <559EED17.4060109@oracle.com> <559FAE4B.5060505@oracle.com> <559FBFFB.3060206@oracle.com> <55A01184.7080102@oracle.com> <55A0361B.2060307@oracle.com> Message-ID: <55A2794E.20502@oracle.com> Hello Coleen, I think that adding destructor not help with this, since all this code with free_memory_for_vm_init_args is a special workaround for processing options in env variables and not applied to the options from command line which passed in 'args' to the Arguments::parse function. About match_special_option_and_act. Probably it can be processed in the following way(raw idea): code = match_special_option_and_act(&java_tool_options_args, &flags_file); if (code == JNI_OK) { // call next code = match_special_option_and_act(args, &flags_file); } if (code == JNI_OK) { // call next code = match_special_option_and_act(&java_options_args, &flags_file); } if (code != JNI_OK) { free_memory_for_vm_init_args(&java_tool_options_args); free_memory_for_vm_init_args(&java_options_args); return code; } Thanks, Dmitry On 11.07.2015 0:16, Coleen Phillimore wrote: > > Hi, I have a couple of suggestions. > > Can you add a destructor to JavaVMInitArgs which will delete the > options things if they exist? Then you won't need these > free_memory_for_vm_init_args functions. I think this would work. > > Secondly, I was also going to comment about > match_special_option_and_act not using it's return value. The > destructor code would make this less cumbersome. I like the > refactoring though. > > Thanks, > Coleen > > On 7/10/15 2:40 PM, Dmitry Dmitriev wrote: >> Jeremy, thank you for fixing that! Please, see my comments inline for >> 2 item and one more comment. >> >> On 10.07.2015 20:15, Jeremy Manson wrote: >>> Thanks for the detailed look, Dmitry. I have taken your advice, >>> with a couple of exceptions: >>> >>> 1) I named the method free_memory_for_vm_init_args instead of >>> free_memory_for_environment_variables. >>> 2) I did not free the memory in 3661-3663 or in 3679-3681, because >>> those are error paths where the memory may not have been allocated >>> in the first place. So freeing it might lead to a crash. >> Yes, you are right. But I think we can guard from this by adding >> check for args->options in new free_memory_for_vm_init_args function >> and free memory in all execution paths. If args->options is not NULL, >> then memory is allocated and must be freed: >> >> 3485 static void free_memory_for_vm_init_args(JavaVMInitArgs* args) { >> 3486 if( args->options != NULL ) { >> 3487 for (int i = 0; i < args->nOptions; i++) { >> 3488 os::free(args->options[i].optionString); >> 3489 } >> 3490 FREE_C_HEAP_ARRAY(JavaVMOption, args->options); >> 3491 } >> 3492 } >> >> As I see you add free memory for error paths at lines(webrev.04) >> 3668-3671 and 3687-3691. Thus, with that guard you can add two calls >> to free_memory_for_vm_init_args function before "return JNI_EINVAL;" >> on line 3696: >> >> 3693 #ifdef ASSERT >> 3694 // Parse default .hotspotrc settings file >> 3695 if (!process_settings_file(".hotspotrc", false, >> args->ignoreUnrecognized)) { >> 3696 return JNI_EINVAL; >> 3697 } >> 3698 #else >> >> >> And one more comment. Unfortunately I oversight this before... You >> not check return value from 'match_special_option_and_act' new >> function on lines 3673-3675, but in one case it can return >> error(JNI_ERR) when "-XX:NativeMemoryTracking" is specified and >> INCLUDE_NMT is not defined. Thus, I think that check for return value >> should be added(with freeing memory for env variables in case of error). >> >> Thank you, >> Dmitry >> >>> >>> New Rev: >>> >>> http://cr.openjdk.java.net/~jmanson/8079301/webrev.04/ >>> >>> >>> Jeremy >>> >>> On Fri, Jul 10, 2015 at 5:52 AM, Dmitry Dmitriev >>> > wrote: >>> >>> Jeremy, >>> >>> Two additional comments which I didn't catch earlier... >>> >>> 1) Order of processing command line options is >>> following(Arguments::parse_vm_init_args function): options from >>> JAVA_TOOL_OPTIONS environment variable, then options from command >>> line and then options from _JAVA_OPTIONS environment variable. And >>> last argument wins! >>> >>> You not change this order in Arguments::parse_vm_init_args >>> function, but it seems that order in several other places is >>> changed. >>> >>> Lines 3665-3667: >>> >>> 3665 match_special_option_and_act(args, &flags_file); >>> 3666 match_special_option_and_act(&java_tool_options_args, >>> &flags_file); >>> 3667 match_special_option_and_act(&java_options_args, &flags_file); >>> >>> Here we see that order is following: options from command line, >>> then options from JAVA_TOOL_OPTIONS environment variable and then >>> options from _JAVA_OPTIONS environment variable. Thus, in this >>> case "-XX:+IgnoreUnrecognizedVMOptions" option in >>> JAVA_TOOL_OPTIONS environment variable will have bigger priority >>> than in command line(last argument wins), but this is differ from >>> processing options in Arguments::parse_vm_init_args function. >>> Thus, I think that you need to swap 3665 and 3666 lines: >>> >>> 3665 match_special_option_and_act(&java_tool_options_args, >>> &flags_file); >>> 3666 match_special_option_and_act(args, &flags_file); >>> 3667 match_special_option_and_act(&java_options_args, &flags_file); >>> >>> Similar situation on lines 3696-3700: >>> >>> 3696 if (PrintVMOptions) { >>> 3697 print_options(args); >>> 3698 print_options(&java_tool_options_args); >>> 3699 print_options(&java_options_args); >>> 3700 } >>> >>> Command line options are printed before options from >>> JAVA_TOOL_OPTIONS environment variable. Thus, I think that you >>> need to swap 3697 and 3698 lines: >>> >>> 3696 if (PrintVMOptions) { >>> 3697 print_options(&java_tool_options_args); >>> 3698 print_options(args); >>> 3699 print_options(&java_options_args); >>> 3700 } >>> >>> >>> 2) One more thing about error processing :) >>> I think it will be great to free allocated memory for environment >>> variables when error occured on lines 3661-3663, 3679-3681 and >>> 3685-3687. >>> My suggestion is to add some static function which free memory for >>> env variables, something like that: >>> static void free_memory_for_environment_variables( JavaVMInitArgs >>> *options_args ) { >>> for (int i = 0; i < options_args->nOptions; i++) { >>> os::free(options_args->options[i].optionString); >>> } >>> FREE_C_HEAP_ARRAY(JavaVMOption, options_args->options); >>> } >>> >>> And change lines 3661-3663 to following: >>> >>> 3661 if (code != JNI_OK) { >>> 3662 >>> free_memory_for_environment_variables(&java_tool_options_args); >>> 3663 return code; >>> 3664 } >>> >>> Lines 3679-3681 to following: >>> >>> 3679 if (!process_settings_file(flags_file, true, >>> args->ignoreUnrecognized)) { >>> 3680 >>> free_memory_for_environment_variables(&java_tool_options_args); >>> 3681 free_memory_for_environment_variables(&java_options_args); >>> 3682 return JNI_EINVAL; >>> 3683 } >>> >>> Lines 3685-3687 to following: >>> >>> 3685 if (!process_settings_file(".hotspotrc", false, >>> args->ignoreUnrecognized)) { >>> 3680 >>> free_memory_for_environment_variables(&java_tool_options_args); >>> 3681 free_memory_for_environment_variables(&java_options_args); >>> 3686 return JNI_EINVAL; >>> 3687 } >>> >>> And lines 3706-3715 to following: >>> >>> 3706 // Done with the envvars >>> 3707 >>> free_memory_for_environment_variables(&java_tool_options_args); >>> 3708 free_memory_for_environment_variables(&java_options_args); >>> >>> >>> Thank you, >>> Dmitry >>> >>> >>> On 10.07.2015 14:36, Dmitry Dmitriev wrote: >>> >>> Hello Jeremy, >>> >>> Thank you for fixing that! But in this case we still have >>> minor issue when quotes processing failed(lines 3438-3444). >>> Here is my suggestion: leave 'while' cycle(lines 3423-3462) as >>> I was in your previous webrev(without 'start' and etc.) and >>> call strdup when copy 'options' to 'options_arr' on lines >>> 3472-3474, i.e. make lines 3472-3474 like this: >>> >>> 3472 for (int i = 0; i < options->length(); i++) { >>> 3473 options_arr[i] = options->at(i); >>> 3474 options_arr[i].optionString = >>> os::strdup(options_arr[i].optionString); >>> 3475 } >>> >>> What you think about that? >>> >>> Regards, >>> Dmitry >>> >>> On 10.07.2015 3:23, Jeremy Manson wrote: >>> >>> Hey Dmitry, >>> >>> Thanks for looking at it. The leak was deliberate (under >>> the theory that the command line flags were leaked, too), >>> but it was silly that I didn't fix it. >>> >>> Anyway, fixed. See: >>> >>> http://cr.openjdk.java.net/~jmanson/8079301/webrev.03 >>> >>> >>> >>> Jeremy >>> >>> On Thu, Jul 9, 2015 at 2:52 PM, Dmitry Dmitriev >>> >> >>> >> >> wrote: >>> >>> Hello Jeremy, >>> >>> Correct me if I am wrong, but I see small memory leak >>> in your >>> implementation. >>> In Arguments::parse_options_environment_variable >>> function memory >>> for 'buffer' allocated by strdup function on line >>> 3415, but now it >>> not freed in this function because data from this >>> buffer is used >>> later. On the other hand when we are done with env >>> variables, we >>> free only options array(lines 3703-3705) and not free >>> previously >>> allocated memory for 'buffer' because we lost track >>> for it. >>> >>> Thanks, >>> Dmitry >>> >>> >>> On 09.07.2015 21:20, Jeremy Manson wrote: >>> >>> Thanks for looking at this, Coleen. >>> >>> I merged this with the latest version of hs-rt, >>> but Ron is or >>> I am going to >>> have to do some merging for 8061999. The changes >>> are relatively >>> orthogonal, but they touch a couple of the same >>> places. How >>> far away is >>> Ron's checkin? >>> >>> Updated webrev: >>> >>> http://cr.openjdk.java.net/~jmanson/8079301/webrev.01/ >>> >>> >>> >>> Updated test: >>> >>> http://cr.openjdk.java.net/~jmanson/8079301t/webrev.01/ >>> >>> >>> >>> (Mild complaining on my part: the conflicts >>> wouldn't have been >>> an issue if >>> someone had looked at this two months ago, when I >>> first >>> asked. I suspect >>> Ron hadn't even started his change at that >>> point. And if external >>> developers were able to submit changes to Hotspot, >>> we wouldn't >>> have had to >>> bother Oracle engineers at all. Neither of these >>> is your >>> fault or your >>> problem, of course - I'm grateful you were able to >>> take a look.) >>> >>> Jeremy >>> >>> On Wed, Jul 8, 2015 at 6:19 AM, Coleen Phillimore < >>> coleen.phillimore at oracle.com >>> >>> >> >> wrote: >>> >>> I'll sponsor it but can you repost the RFR? >>> >>> There has been a fair bit of work to command >>> line >>> processing lately so I'd >>> like to have the others look at it too. Have >>> you merged >>> this up with the >>> latest version of hs-rt repository and were >>> there >>> conflicts? Also, have >>> you looked at the RFR: >>> >>> "Open code review for 8061999 Enhance VM >>> option parsing to >>> allow options >>> to be specified" >>> >>> and are there conflicts with this? >>> >>> The hotspot change looks good to me. >>> >>> >>> http://cr.openjdk.java.net/~jmanson/8079301t/webrev.00/test/com/sun/management/HotSpotDiagnosticMXBean/CheckOrigin.java.udiff.html >>> >>> >>> >>> >>> >>> >>> "UseCerealGC" LOL >>> Can you use a different option than >>> PrintOopAddress in >>> this test? I don't >>> know why this command line option exists or >>> would be >>> useful for, and seems >>> to be a good candidate for removal. If you >>> need a valid >>> argument, that is >>> unlikely to go away, TraceExceptions would be >>> good. >>> >>> Thanks, >>> Coleen >>> >>> >>> On 7/7/15 8:00 PM, Jeremy Manson wrote: >>> >>> No love? Is there a code owner here I >>> should pester >>> more directly? >>> >>> Jeremy >>> >>> On Fri, Jun 26, 2015 at 3:00 PM, Martin >>> Buchholz >>> >> >> >> >>> wrote: >>> >>> As usual with Google patches, they are >>> in use >>> locally. This one has been >>> >>> stable for a while without complaints. >>> Please >>> sponsor. >>> >>> On Fri, Jun 26, 2015 at 1:53 PM, >>> Jeremy Manson >>> >> >>> >> >> >>> wrote: >>> >>> All this talk about >>> IgnoreUnrecognizedVMOptions >>> reminded me that this >>> >>> review is still outstanding. Any >>> takers? >>> >>> Jeremy >>> >>> On Tue, May 5, 2015 at 10:01 AM, >>> Jeremy Manson >>> >> >>> >> > >>> wrote: >>> >>> Hi David, >>> >>> Thanks for taking a look. >>> >>> On Mon, May 4, 2015 at 8:32 >>> PM, David >>> Holmes >>> >>> >> >> >>> >>> wrote: >>> >>> Hi Jeremy, >>> >>> On 5/05/2015 6:51 AM, >>> Jeremy Manson wrote: >>> >>> Not sure who might be >>> willing to >>> sponsor this. David? You >>> did the >>> >>> last >>> one. :) >>> >>> Might be a while >>> before I can >>> get to it. I did have >>> a quick look >>> >>> (and >>> will need a longer one). >>> >>> I understand. I'm just >>> happy it's >>> possible to upstream this >>> stuff at >>> all[1]. >>> >>> [1] With the eternal caveat >>> that I'd be >>> happier if we didn't *have* to >>> go through you folks, but >>> we've learned to >>> live with it. >>> >>> >>> >>> Context: A number of >>> command line >>> options are not settable via >>> >>> JAVA_TOOL_OPTIONS and _JAVA_OPTIONS: >>> >>> - PrintVMOptions >>> >>> So you have >>> changed the >>> semantics of this to >>> print out the >>> options >>> >>> from >>> the command-line and each >>> of the two >>> env vars. Seems >>> reasonable but >>> may be >>> better to know which >>> option came from >>> where as we can now see >>> the same >>> option (or conflicting >>> variants >>> thereof) multiple times. >>> >>> I'd be happy to do >>> this. Any >>> preferred syntax? Does >>> someone >>> >>> actually >>> own this feature? >>> >>> I'm unclear what the current >>> processing >>> order is for the different >>> >>> sources of options, and >>> whether the >>> changes affect that order? >>> >>> Nope. I go through sad >>> contortions >>> to keep the processing >>> order the >>> >>> same. It's JAVA_TOOL_OPTIONS, >>> then >>> command line, then >>> _JAVA_OPTIONS. >>> See >>> lines 2549-2567. >>> >>> >>> - >>> IgnoreUnrecognizedVMOptions >>> >>> - >>> PrintFlagsInitial >>> >>> Unclear what >>> "initial" actually >>> means - is it the >>> default? >>> >>> More or less. If you stick, >>> for example, >>> IgnoreUnrecognizedVMOptions >>> in >>> there first, it will get >>> printed out as >>> "true". I haven't really >>> changed >>> the semantics here either - >>> I've just >>> added processing of the >>> envvars. >>> >>> - NativeMemoryTracking >>> >>> - >>> PrintFlagsWithComments >>> >>> This is because these >>> flags have >>> to be processed before >>> processing >>> other >>> flags, and no one ever >>> bothered to >>> do that for the flags >>> coming from >>> environment >>> variables. This patch >>> fixes that problem. >>> >>> I have a test, but >>> it is a >>> modification to a JDK >>> test instead >>> of a HS >>> test, >>> so it can go in >>> separately (I guess). >>> >>> They can be pushed >>> together to >>> different repos in the >>> same forest. >>> >>> Okay. Here's the test >>> change: >>> >>> http://cr.openjdk.java.net/~jmanson/8079301t/webrev.00/ >>> >>> >>> >>> >>> As I said I'll have to get >>> back to this. >>> And hopefully someone else in >>> >>> runtime will take a good >>> look as well ;-) >>> >>> I'd be happy to toss it >>> over to >>> whomever owns this, if >>> anyone. >>> >>> Thanks! >>> >>> Jeremy >>> >>> >>> >>> Bug: >>> >>> https://bugs.openjdk.java.net/browse/JDK-8079301 >>> >>> Webrev: >>> http://cr.openjdk.java.net/~jmanson/8079301/webrev.00/ >>> >>> >>> >>> Jeremy >>> >>> >>> >>> >>> >>> >>> >>> >> > From chenyt at cs.sjtu.edu.cn Sun Jul 12 16:54:10 2015 From: chenyt at cs.sjtu.edu.cn (Yuting Chen) Date: Sun, 12 Jul 2015 09:54:10 -0700 Subject: An undefined behavior w.r.t. In-Reply-To: References: Message-ID: Hi, Gilles, thank you for your information. I read jvms again, and indeed, it says " 1. A class or interface has at most one class or interface initialization method and is initialized (?5.5) by invoking that method. The initialization method of a class or interface has the special name , takes no arguments, and is void (?4.3.3). 2. Other methods named in a class file are of no consequence. They are not class or interface initialization methods. They cannot be invoked by any Java Virtual Machine instruction and are never invoked by the Java Virtual Machine itself. 3. In a class file whose version number is 51.0 or above, the method must additionally have its ACC_STATIC flag (?4.6) set in order to be the class or interface initialization method. 4. This requirement was introduced in Java SE 7. In a class file whose version number is 50.0 or below, a method named that is void and takes no arguments is considered the class or interface initialization method regardless of the setting of its ACC_STATIC flag. " Wait..., the sentence still reads a little strange, because the method in my class is "public abstract void ();" and I still cannot decide whether it should have any consequence or not, even though it may not be an initialization method because it does not have an ACC_STATIC flag. (it seems that the order of the paragraphs should be changed to 1->3->4->2.) In any case, the method has an invalid name (because it has a name ) or invalid signature (because it does not have an ACC_STATIC flag). I am afraid that it still should be rejected by HotSpot for some format error. For you question, if the class has a version number less than 51, a format error will be thrown out when it is run on HotSpot and IBMJ9 ("Exception in thread "main" java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file M1436188543_V46"). The results are different only when the version number is greater than 51. The two classes are attached. Hope that you can get them. Yuting Chen On Sun, Jul 12, 2015 at 4:36 AM, Gilles Duboscq wrote: > Hi Yuting, > > I think the behaviour is well defined even if the method is not > ACC_STATIC: in this case if the class version is >= 51.0 then this method is > *not* the special "class initializer" method and it will not be called > during class initialization. > > To cite jvms: "Other methods named in a class file are of no > consequence. They are not class or interface initialization methods." > I do not think the JVM should throw any exception because of this. > > Your example is interesting for an other reason though. The class file was > stripped by the mailing list system but from the javap dump it looks like > your method is abstract and has no code. > If the class file version was < 51.0, i'm not exactly sure what should > happen. > > Gilles > > > On Fri, Jul 10, 2015 at 11:34 PM Yuting Chen > wrote: >> >> >>Reported to jls-jvms-spec-comments, and so far no response. >> >>Thus I report the problem here again. >> >> Hello, I recently feel puzzling about the JVM behaviors when an >> illegal is met. The specification may not be complete in this >> part. >> >> In the specification (jvms-2.9, se8), we have the words: "In a class >> file whose version number is 51.0 or above, the method must >> additionally have its ACC_STATIC flag (?4.6) set in order to be the >> class or interface initialization method." >> >> However, the behavior is undefined if the ACC_STATIC flag is not set. >> Thus when a class without an ACC_STATIC flag may either be accepted or >> be rejected, depending on the JVM developers. The results can be >> unpredictable. >> >> I checked this by running a class on OpenJDK8-HotSpot and IBM J9, and >> found different results. The class can be run on HotSpot without >> triggering any exceptions (i.e., is of no consequence). >> However, IBM J9 can throw out a FormatError (Exception in thread >> "main" java.lang.ClassFormatError: JVMCFRE074 no Code attribute >> specified; class=M1436188543, method=()V, pc=0). I checked the >> specification and still could not decide which JVM behaves correctly. >> >> (I thought the question again, and believed that it can be better if >> HotSpot can also report a ClassFormatError.) >> >> The class is attached, and the decompiled code is given next: >> >> class M1436188543 >> minor version: 0 >> major version: 51 >> flags: ACC_SUPER >> Constant pool: >> #1 = Utf8 java/lang/Object >> #2 = Utf8 >> #3 = Utf8 SourceFile >> #4 = Utf8 M1436188543 >> #5 = Utf8 main >> #6 = Class #4 // M1436188543 >> #7 = Utf8 Code >> #8 = Utf8 ([Ljava/lang/String;)V >> #9 = Utf8 ()V >> #10 = Utf8 Jasmin >> #11 = Class #1 // java/lang/Object >> { >> public abstract {}; >> descriptor: ()V >> flags: ACC_PUBLIC, ACC_ABSTRACT >> >> public static void main(java.lang.String[]); >> descriptor: ([Ljava/lang/String;)V >> flags: ACC_PUBLIC, ACC_STATIC >> Code: >> stack=0, locals=1, args_size=1 >> 0: return >> } From chenyt.cs.sjtu at gmail.com Sun Jul 12 17:02:30 2015 From: chenyt.cs.sjtu at gmail.com (Yuting Chen) Date: Sun, 12 Jul 2015 10:02:30 -0700 Subject: Fwd: An undefined behavior w.r.t. In-Reply-To: References: Message-ID: Hi, Gilles, thank you for your information. I read jvms again, and indeed, it says " 1. A class or interface has at most one class or interface initialization method and is initialized (?5.5) by invoking that method. The initialization method of a class or interface has the special name , takes no arguments, and is void (?4.3.3). 2. Other methods named in a class file are of no consequence. They are not class or interface initialization methods. They cannot be invoked by any Java Virtual Machine instruction and are never invoked by the Java Virtual Machine itself. 3. In a class file whose version number is 51.0 or above, the method must additionally have its ACC_STATIC flag (?4.6) set in order to be the class or interface initialization method. 4. This requirement was introduced in Java SE 7. In a class file whose version number is 50.0 or below, a method named that is void and takes no arguments is considered the class or interface initialization method regardless of the setting of its ACC_STATIC flag. " Wait..., the sentence still reads a little strange, because the method in my class is "public abstract void ();" and I still cannot decide whether it should have any consequence or not, even though it may not be an initialization method because it does not have an ACC_STATIC flag. (it seems that the order of the paragraphs should be changed to 1->3->4->2.) In any case, the method has an invalid name (because it has a name ) or invalid signature (because it does not have an ACC_STATIC flag). I am afraid that it still should be rejected by HotSpot for some format error. For you question, if the class has a version number less than 51, a format error will be thrown out when it is run on HotSpot and IBMJ9 ("Exception in thread "main" java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file M1436188543_V46"). The results are different only when the version number is greater than 51. The two classes are attached. Hope that you can get them. Yuting Chen From chenyt.cs.sjtu at gmail.com Sun Jul 12 19:15:59 2015 From: chenyt.cs.sjtu at gmail.com (Yuting Chen) Date: Sun, 12 Jul 2015 12:15:59 -0700 Subject: An undefined behavior w.r.t. In-Reply-To: References: Message-ID: In jvms, 4.2.2, it also says, "Note that a field name or interface method name may be or , but no method invocation instruction may reference and only the invokespecial instruction (?invokespecial) may reference ." Still cannot find any words in jvms for this: class XXX{ //version 51 public abstract void (); } It could be better if in jvms 2.9, we have Other methods named in a class file are of no consequence. They are not class or interface initialization methods. They cannot be invoked by any Java Virtual Machine instruction and are never invoked by the Java Virtual Machine itself. => Other methods named are not class or interface initialization methods. They cannot be invoked by any Java Virtual Machine instruction and are never invoked by the Java Virtual Machine itself. Methods named of no consequence if they are not class or interface initialization methods. On Sun, Jul 12, 2015 at 10:02 AM, Yuting Chen wrote: > Hi, Gilles, thank you for your information. I read jvms again, and > indeed, it says > > " > 1. A class or interface has at most one class or interface > initialization method and is initialized (?5.5) by invoking that > method. The initialization method of a class or interface has the > special name , takes no arguments, and is void (?4.3.3). > > 2. Other methods named in a class file are of no consequence. > They are not class or interface initialization methods. They cannot be > invoked by any Java Virtual Machine instruction and are never invoked > by the Java Virtual Machine itself. > > 3. In a class file whose version number is 51.0 or above, the method > must additionally have its ACC_STATIC flag (?4.6) set in order to be > the class or interface initialization method. > > 4. This requirement was introduced in Java SE 7. In a class file whose > version number is 50.0 or below, a method named that is void > and takes no arguments is considered the class or interface > initialization method regardless of the setting of its ACC_STATIC > flag. > " > > Wait..., the sentence still reads a little strange, because the method > in my class is "public abstract void ();" and I still cannot > decide whether it should have any consequence or not, even though it > may not be an initialization method because it does not have an > ACC_STATIC flag. (it seems that the order of the paragraphs should be > changed to 1->3->4->2.) > > In any case, the method has an invalid name (because it has a name > ) or invalid signature (because it does not have an ACC_STATIC > flag). I am afraid that it still should be rejected by HotSpot for > some format error. > > For you question, if the class has a version number less than 51, a > format error will be thrown out when it is run on HotSpot and IBMJ9 > ("Exception in thread "main" java.lang.ClassFormatError: Absent Code > attribute in method that is not native or abstract in class file > M1436188543_V46"). The results are different only when the version > number is greater than 51. > > The two classes are attached. Hope that you can get them. > > Yuting Chen From david.holmes at oracle.com Mon Jul 13 02:56:14 2015 From: david.holmes at oracle.com (David Holmes) Date: Mon, 13 Jul 2015 12:56:14 +1000 Subject: RFR: 8130728: Disable WorkAroundNPTLTimedWaitHang by default In-Reply-To: <559E77F1.4090408@oracle.com> References: <559E3E8F.9020300@oracle.com> <559E77F1.4090408@oracle.com> Message-ID: <55A328CE.7060703@oracle.com> Thanks Dan. As there are no other opinions/concerns with this I will push it. David On 9/07/2015 11:32 PM, Daniel D. Daugherty wrote: > > http://cr.openjdk.java.net/~dholmes/8130728/webrev/ > > src/share/vm/runtime/globals.hpp > No comments. > > Thumbs up. > > Time to see what shakes out with this option turned off. > > The BSD/MacOS X blame belongs to me. Our thinking at the time was > to keep the "bsd" files matching the "linux" version unless we > had a specific reason for changing the code. Of course, we thought > we would come back later and clean things up... which just didn't > happen... I don't know the AIX history. > > Dan > > > On 7/9/15 3:27 AM, David Holmes wrote: >> https://bugs.openjdk.java.net/browse/JDK-8130728 >> >> The workaround triggered by WorkAroundNPTLTimedWaitHang (an >> experimental flag set to 1 by default) was to alleviate a hang that >> could occur on a pthread_cond_timedwait on Linux, if the timeout value >> was a time in the past - see JDK-6314875. This glibc bug was fixed in >> 2005 in glibc 2.3.5-3 >> >> https://lists.debian.org/debian-glibc/2005/08/msg00201.html >> >> but the workaround persists and was (unfortunately) copied into the >> BSD and AIX ports. >> >> It is time to remove that workaround but before we can do that we need >> to be sure that we are not in fact hitting the workaround code. To >> that end I propose to use this bug to switch the flag's value to 0 to >> verify correct operation. >> >> If that goes well then we can remove the code either later in JDK 9 or >> early in JDK 10. >> >> To be clear the flag impacts both the wait and the signal part of the >> condvar usage (park and unpark). On the wait side we have: >> >> status = pthread_cond_timedwait(_cond, _mutex, &abst); >> if (status != 0 && WorkAroundNPTLTimedWaitHang) { >> pthread_cond_destroy(_cond); >> pthread_cond_init(_cond, os::Linux::condAttr()); >> } >> >> so we will now skip this potential recovery code. >> >> On the signal side we signal while holding the mutex if the workaround >> is enabled, and we signal after dropping the mutex otherwise. So this >> code will now be using a new path. Here is the code in >> PlatformEvent::unpark >> >> assert(AnyWaiters == 0 || AnyWaiters == 1, "invariant"); >> if (AnyWaiters != 0 && WorkAroundNPTLTimedWaitHang) { >> AnyWaiters = 0; >> pthread_cond_signal(_cond); >> } >> status = pthread_mutex_unlock(_mutex); >> assert_status(status == 0, status, "mutex_unlock"); >> if (AnyWaiters != 0) { >> // Note that we signal() *after* dropping the lock for "immortal" >> Events. >> // This is safe and avoids a common class of futile wakeups. In rare >> // circumstances this can cause a thread to return prematurely from >> // cond_{timed}wait() but the spurious wakeup is benign and the >> victim >> // will simply re-test the condition and re-park itself. >> // This provides particular benefit if the underlying platform >> does not >> // provide wait morphing. >> status = pthread_cond_signal(_cond); >> assert_status(status == 0, status, "cond_signal"); >> } >> >> and similarly in Parker::unpark >> >> if (WorkAroundNPTLTimedWaitHang) { >> status = pthread_cond_signal(&_cond[_cur_index]); >> assert(status == 0, "invariant"); >> status = pthread_mutex_unlock(_mutex); >> assert(status == 0, "invariant"); >> } else { >> status = pthread_mutex_unlock(_mutex); >> assert(status == 0, "invariant"); >> status = pthread_cond_signal(&_cond[_cur_index]); >> assert(status == 0, "invariant"); >> } >> >> This may cause performance perturbations that will need to be >> investigated - but in theory, as per the comment above, signalling >> outside the lock should be beneficial in the linux case because there >> is no wait-morphing (where a signal simply takes a waiting thread and >> places it into the mutex queue thereby avoiding the need to awaken the >> thread so it can enqueue itself). >> >> The change itself is of course trivial: >> >> http://cr.openjdk.java.net/~dholmes/8130728/webrev/ >> >> I'd appreciate any comments/concerns particularly from the BSD and AIX >> folk who acquired this unnecessary workaround. >> >> If deemed necessary we could add a flag that controls whether the >> signal happens with or without the lock held. >> >> Thanks, >> David > From david.holmes at oracle.com Mon Jul 13 06:58:18 2015 From: david.holmes at oracle.com (David Holmes) Date: Mon, 13 Jul 2015 16:58:18 +1000 Subject: RFR(S) 8130448: thread dump improvements, comment, additions, new diagnostics inspired by 8077392 In-Reply-To: <559E7069.7030302@oracle.com> References: <55972558.6060905@oracle.com> <559A2397.2010409@oracle.com> <559AE96D.6010508@oracle.com> <559B7BAA.8070705@oracle.com> <559C0C4D.8090504@oracle.com> <559E030C.8010603@oracle.com> <559E7069.7030302@oracle.com> Message-ID: <55A3618A.20809@oracle.com> On 9/07/2015 11:00 PM, Daniel D. Daugherty wrote: > On 7/8/15 11:13 PM, David Holmes wrote: >> On 8/07/2015 3:28 AM, Daniel D. Daugherty wrote: >>> On 7/7/15 1:11 AM, David Holmes wrote: >>>> Hi Dan, >>>> >>>> Top posting as I'm lazy and running late :) >>> >>> No problem with the top posting. It makes your remaining >>> concerns earlier to see and address. >>> >>> >>>> Okay ... I'm still uneasy about adding two additional flags for the >>>> "release monitors on exit" situation. I hear what you are saying about >>>> the cost of the monitor check - I had thought we kept easy access to >>>> the set of monitors owned by a thread but it seems not, so trawling >>>> the global monitor list is indeed an expensive operation. :( So okay >>>> but I don't like it :) >>> >>> Since JavaThreadExitReleasesMonitors and GuaranteeOnMonitorMismatch >>> are targeted at finding/working around bugs in the Java Monitor >>> implementation, I'm going to take a look at moving the flag support >>> down into Java Monitor subsystem's implementation specific options. >>> That will get the options out of the global space and they won't >>> have to be counted against the "cap and trade" limit :-) >>> >>> >>>> I also take your point about viewing the new flag as a superset of the >>>> JNI-detach case. That's fair enough, but of course that aspect needs >>>> to be documented. >>> >>> I'm starting to wonder why we have the 'JNIDetachReleasesMonitors' >>> option at all. Is there a good reason to be able to turn off this >>> piece of code? >> >> My recollection is that hotspot did not implement that part of the >> spec. Simply switching the behaviour with no way to restore the >> original behaviour could break existing apps. Hence a flag, on by >> default. > > That's very likely the case. I'll poke around in my historical > archive and see what shakes out. https://bugs.openjdk.java.net/browse/JDK-6336479 > >> Of course by now apps should be spec compliant themselves so this >> seems a flag that should itself be deprecated in 9 and targetted for >> removal in 10. (That will help with the 'conservation of flags' >> problem :) ). > > Sounds like a good RFE. Filed: https://bugs.openjdk.java.net/browse/JDK-8131045 Cheers, David > Dan > > >> >>> >>> >>>> I was left unclear about your position on the VerboseStackTrace. I >>>> agree the new output was likely put under a flag to avoid disturbing >>>> existing output formats. But I don't see that it warrants its own flag >>>> - to me using Verbose okay (though the fact it is a develop flag is >>>> limiting). >>> >>> Thanks for reminding me that '-XX:+Verbose' is a develop flag. >>> That's another reason for not using that flag. Combined with >>> the fact that '-XX:+Verbose' is considered a modifier to other >>> flags and thread dumps aren't enabled/triggered by a flag means >>> (to me anyway) that '-XX:+Verbose' is still not a good match. >>> >>> However, I have a vague memory that the Java Monitor subsystem >>> has its own "verbose" flag. I'll take a look at switching to >>> that... >> >> Okay >> >>> Will be working on the next round... >> >> Thanks, >> David >> >>> Dan >>> >>> >>> >>>> >>>> Thanks, >>>> David >>>> >>>> On 7/07/2015 6:47 AM, Daniel D. Daugherty wrote: >>>>> On 7/6/15 12:43 AM, David Holmes wrote: >>>>>> Hi Dan, >>>>>> >>>>>> Metacomment: Could I suggest that in a RFR your subject line has the >>>>>> form : , rather than (bugid) - especially >>>>>> when the synopsis actually starts with a bug id :) Thanks. >>>>> >>>>> Yup that bug synopsis is/was a mess: >>>>> >>>>> Changed the synopsis line to : >>>>> >>>>> thread dump improvements, comment additions, new diagnostics >>>>> inspired by 8077392 >>>>> >>>>> Also updated the e-mail thread subject line to your suggested format. >>>>> Will try to remember to switch to that style in the future. >>>>> >>>>> >>>>>> Mostly okay but some major concerns around the can of worms that >>>>>> JavaThreadExitReleasesMonitors opens up. >>>>> >>>>> This is Java monitors so "can of worms" is familiar! :-) >>>>> >>>>> >>>>>> >>>>>> On 4/07/2015 10:14 AM, Daniel D. Daugherty wrote: >>>>>>> Greetings, >>>>>>> >>>>>>> The hunt for the following bug: >>>>>>> >>>>>>> JDK-8077392 Stream fork/join tasks occasionally fail to >>>>>>> complete >>>>>>> >>>>>>> and David C's work on the following bug: >>>>>>> >>>>>>> JDK-8069412 Locks need better debug-printing support >>>>>>> >>>>>>> have inspired additional thread dump improvements, comment additions >>>>>>> to some Java monitor code and some new diagnostic options. >>>>>> >>>>>> src/cpu/x86/vm/macroAssembler_x86.cpp >>>>>> >>>>>> 1821 // update _owner from from BasicLock to thread >>>>>> >>>>>> Typo: from from >>>>> >>>>> Will fix. >>>>> >>>>> >>>>>> 2091 // the placeholder value. If that didn't work, then >>>>>> another >>>>>> 2092 // grabbed the lock so we're done (and exit was a >>>>>> success). >>>>>> >>>>>> another -> another thread ? >>>>> >>>>> Yes, "another thread" is better. Will fix. >>>>> >>>>> >>>>>> 2201 // If that didn't work, then another grabbed the lock >>>>>> 2202 // so we're done (and exit was a success). >>>>>> >>>>>> another -> another thread ? >>>>> >>>>> Yes, "another thread" is better. Will fix. >>>>> >>>>> >>>>>> --- >>>>>> >>>>>> src/share/vm/oops/markOop.cpp >>>>>> >>>>>> 40 st->print("NULL"); // this should not happen >>>>>> >>>>>> Shouldn't that be an assert or guarantee in that case? Or at a >>>>>> minimum >>>>>> print something like: "NULL (but you should never see this!)" >>>>> >>>>> This is a relocated line from David C's change: >>>>> >>>>> old 49: st->print("monitor=NULL"); >>>>> >>>>> I simply added a comment to it. I don't think I like the idea of the >>>>> thread dump code assert()'ing or guarantee()'ing because there might >>>>> be other useful info that would have been printed after the assert() >>>>> or guarantee() failure. >>>>> >>>>> I do like the idea of changing the message to: >>>>> >>>>> 40: st->print("NULL (this should never be seen!)"); >>>>> >>>>> >>>>>> 42 BasicLock * bl = (BasicLock *) mon->owner(); >>>>>> >>>>>> What information has told us this is a BasicLock* not a Thread* ? But >>>>>> as all you do is print bl why not just p2i(mon->owner()) ? >>>>> >>>>> Again, this is a relocated line from David C's change: >>>>> >>>>> old 51: BasicLock * bl = (BasicLock *) mon->owner(); >>>>> >>>>> I'm going to guess that David C had some other code in there before >>>>> that needed/assumed that the field is a "BasicLock *", but that code >>>>> didn't make it into his final version. >>>>> >>>>> I will drop the 'bl' local and update the p2i() call to use >>>>> mon->owner() directly. >>>>> >>>>> >>>>>> --- >>>>>> >>>>>> src/share/vm/runtime/globals.hpp >>>>>> >>>>>> JavaThreadExitReleasesMonitors has me perplexed. The JNI DetachThread >>>>>> case seems to be a concession to badly written code that fails to >>>>>> release locks on error paths. >>>>> >>>>> I don't think I would call the JNIDetachReleasesMonitors case a >>>>> concession >>>>> to badly written JNI code. 6282335 is very clear that this code was >>>>> added >>>>> to meet the JNI spec. The JNI spec words might be considered a >>>>> concession... >>>>> >>>>> http://docs.oracle.com/javase/8/docs/technotes/guides/jni/spec/invocation.html#DetachCurrentThread >>>>> >>>>> >>>>> >>>>> >>>>> > DetachCurrentThread >>>>> > >>>>> > jint DetachCurrentThread(JavaVM *vm); >>>>> > >>>>> > Detaches the current thread from a Java VM. All Java monitors >>>>> > held by this thread are released. All Java threads waiting for >>>>> > this thread to die are notified. >>>>> > >>>>> > The main thread can be detached from the VM. >>>>> >>>>> >>>>> >>>>>> The equivalent for a Java thread would again involve lock acquisition >>>>>> via JNI. But I don't recall ever seeing a bug report or RFE >>>>>> related to >>>>>> this. What seems to have motivated this new flag is the potential for >>>>>> a broken VM to actually leave the monitor locked (e.g. because >>>>>> compiled code failed to do the unlock on all paths). >>>>> >>>>> 8077392 and bugs like it are exactly the reason for adding these >>>>> two options. >>>>> >>>>> JavaThreadExitReleasesMonitors is added to provide a work around >>>>> until the underlying bug or bugs are fixed. This option is targeted >>>>> at folks that are chasing their own bugs and don't care about this >>>>> one. >>>>> >>>>> GuaranteeOnMonitorMismatch is added to help hunt 8077392 specifically >>>>> and to sanity check for similar issues generally. I can see using the >>>>> two options in combination with existing test suites as a stress test >>>>> for the Java monitor subsystem. >>>>> >>>>> >>>>>> To address that I'd be inclined to simply have a guarantee in the >>>>>> Java >>>>>> thread exit path, rather than a flag to do the clean up and another >>>>>> flag to control a guarantee. >>>>> >>>>> The check for an unexited Java monitor is not cheap. >>>>> >>>>> The existing check under the JNIDetachReleasesMonitors flag is >>>>> positioned to only affect threads using JNI DetachCurrentThread() >>>>> and that cost is justified as part of meeting the JNI spec. >>>>> >>>>> Adding the unexited Java monitor check to all exiting Java >>>>> threads should not be done lightly due to the cost. If the >>>>> VM is functioning correctly, then why impose this cost on >>>>> all exiting Java threads? >>>>> >>>>> >>>>>> I don't think two new command-line options (has this gone through CCC >>>>>> yet?) are justified. >>>>> >>>>> No, this has not gone through CCC yet. My preference is to get >>>>> code review feedback (like this) before submitting a CCC. >>>>> >>>>> I suppose I could have simply added more sub-options to the >>>>> existing Java monitor subsystem knobs and switches, but it >>>>> seemed to make sense to model JavaThreadExitReleasesMonitors >>>>> on the existing JNIDetachReleasesMonitors. >>>>> >>>>> >>>>>> Also note that allowing for JVM induced missing unlocks is something >>>>>> that can affect JNI attached threads as well as regular Java threads. >>>>>> I'll take this up in discussing thread.cpp below. >>>>>> >>>>>> That aside, the comment, which was modelled on the JNI DetachThread >>>>>> variant, does not really work in this case: >>>>>> >>>>>> 2801 "JavaThread exit() releases monitors owned by thread") >>>>>> \ >>>>>> >>>>>> JavaThread is not a programming concept but an internal JVM >>>>>> abstraction. I would suggest something like: >>>>>> >>>>>> "Java thread termination releases monitors unexpectedly still >>>>>> owned by >>>>>> thread" >>>>> >>>>> I'll switch to your description text if we end up keeping the >>>>> new options. >>>>> >>>>> >>>>>> --- >>>>>> >>>>>> src/share/vm/runtime/objectMonitor.cpp >>>>>> src/share/vm/runtime/objectMonitor.hpp >>>>>> >>>>>> No comments >>>>>> >>>>>> --- >>>>>> >>>>>> src/share/vm/runtime/synchronizer.cpp >>>>>> >>>>>> If we find the unexpected locked monitor it would be useful to see >>>>>> more Java level information about the Thread (in the non-detaching >>>>>> case) and the object that is locked. >>>>> >>>>> I can probably steal some code from the thread dump side to >>>>> give us more info about the Object associated with the Java >>>>> monitor... >>>>> >>>>> >>>>>> --- >>>>>> >>>>>> src/share/vm/runtime/thread.cpp >>>>>> >>>>>> As noted previously JNI attached threads can also be affected by JVM >>>>>> induced locking bugs. So the comment block: >>>>>> >>>>>> 1804 // 6282335 JNI DetachCurrentThread spec states that all Java >>>>>> monitors >>>>>> 1805 // held by this thread must be released. A detach operation >>>>>> must only >>>>>> 1806 // get here if there are no Java frames on the stack. >>>>>> Therefore, any >>>>>> 1807 // owned monitors at this point MUST be JNI-acquired monitors >>>>>> which are >>>>>> 1808 // pre-inflated and in the monitor cache. >>>>>> >>>>>> is not strictly correct as it is presuming a correctly operating JVM. >>>>> >>>>> I actually disagree with the last two sentences in that comment block, >>>>> but I didn't have a good rewrite in mind. I'll think about it more. >>>>> >>>>> >>>>> >>>>>> Further the logic now applied: >>>>>> >>>>>> 1816 if ((exit_type == jni_detach && JNIDetachReleasesMonitors) || >>>>>> 1817 JavaThreadExitReleasesMonitors) { >>>>>> >>>>>> is also not "correct" because if we have >>>>>> JavaThreadExitReleasesMonitors true while >>>>>> JNIDetachReleasesMonitors is >>>>>> false, we will in fact release any JNI acquired monitors because we >>>>>> can't make the distinction. >>>>> >>>>> I don't think JNIDetachReleasesMonitors only has to deal with >>>>> JNI-acquired >>>>> monitors and I don't think that JavaThreadExitReleasesMonitors only >>>>> has to >>>>> deal with Java code acquired monitors. I see these options as >>>>> applying to >>>>> "how you got to the Java thread exit path" and not applying to "what >>>>> needs >>>>> to be cleaned up". >>>>> >>>>> I see JNIDetachReleasesMonitors as a way of cleaning up unexited Java >>>>> monitors when we're executing the JNI DetachCurrentThread() code path. >>>>> I don't really care why the Java monitors are unexited... and I think >>>>> the spec wording is clear that all unexited Java monitors are cleaned >>>>> up... not just JNI-acquired monitors. >>>>> >>>>> I see JavaThreadExitReleasesMonitors as a way of cleaning up unexited >>>>> Java monitors in any code path where we are exiting the Java thread. >>>>> I see >>>>> JavaThreadExitReleasesMonitors as a superset of >>>>> JNIDetachReleasesMonitors. >>>>> >>>>> >>>>>> Given we can't make the distinction I don't see any way for these >>>>>> separate flags to actually work well together. >>>>> >>>>> I think they work well together when JavaThreadExitReleasesMonitors >>>>> is seen as a superset of JNIDetachReleasesMonitors. Of course, that >>>>> hinges on my opinion that JNIDetachReleasesMonitors applies to any >>>>> unexited Java monitor and not just JNI-acquired Java monitors. >>>>> >>>>> >>>>>> As I said above I'm more inclined to just add a guarantee to the >>>>>> non-detach case, than add two new flags. (Even though this means >>>>>> there >>>>>> won't be detection for such bugs when JNI attached threads encounter >>>>>> them - including the main thread :( ). >>>>> >>>>> I really don't want to add this check to all Java thread exit >>>>> paths since it is expensive. >>>>> >>>>> >>>>>> As I said this has me perplexed. :( >>>>> >>>>> Hopefully, I've explained it better now. >>>>> >>>>> >>>>>> --- >>>>>> >>>>>> src/share/vm/runtime/vframe.cpp >>>>>> >>>>>> 170 // It would be nice to distinguish between "waiting on" and >>>>>> 171 // "waited on". Currently, "waiting on" here with a >>>>>> 172 // java.lang.Thread.State == "WAITING (on object monitor)" >>>>>> 173 // earlier in the output means that the monitor has not yet >>>>>> been >>>>>> 174 // notified and java.lang.Thread.State == "BLOCKED (on >>>>>> object >>>>>> 175 // monitor)" earlier in the output means that the >>>>>> monitor has >>>>>> 176 // been notified and the thread is blocked on reentry. >>>>>> >>>>>> That's a very long sentence that can be quite difficult to parse and >>>>>> could probably be reworded to describe how the output should be >>>>>> interpreted eg: >>>>>> >>>>>> // If earlier in the output we reported java.lang.Thread.State == >>>>>> // "WAITING (on object monitor)" and now we report "waited on", then >>>>>> // we are still waiting for notification [or timeout?]. Otherwise if >>>>>> // we earlier reported java.lang.Thread.State == "BLOCKED (on object >>>>>> // monitor)", then we are actually waiting to reacquire the monitor >>>>>> // lock. At this level we can't distinguish the two cases to report >>>>>> // "waited on" rather than "waiting on" for the second case. >>>>> >>>>> I'll take a look at rewriting the comment and may just take your >>>>> version entirely. >>>>> >>>>> >>>>>> I wonder if we can prod deeper into VM state to try and make the >>>>>> distinction? >>>>> >>>>> I played around with doing just that, but it seems like the M&M >>>>> code that fetches similar state probes the state stored in the >>>>> java.lang.Thread object. I didn't want to go there. >>>>> >>>>> >>>>>> >>>>>> 184 } else { >>>>>> 185 st->print_cr("\t- %s ", wait_state); >>>>>> >>>>>> The concept of "locals" is confusing here. Isn't the "local" in this >>>>>> case just the object that we have waited upon? In which case we >>>>>> should >>>>>> say "no object reference available". >>>>> >>>>> I got the phrase "locals" from the compiler code that was trying to >>>>> decode the object reference. I can change to "no object reference >>>>> available". >>>>> I definitely want to say _something_ here. The existing code is just >>>>> silent. >>>>> >>>>> >>>>>> Though I would have thought/hoped there must be a way to find the >>>>>> object reference even in a compiled frame? >>>>> >>>>> Yes, if you deopt... I didn't want to go there. >>>>> >>>>> >>>>>> 195 // Print out all monitors that we have locked, are trying to >>>>>> lock >>>>>> 196 // or are trying to relock after a wait(). >>>>>> >>>>>> that makes it sound like there are three cases when really a "relock" >>>>>> is just a specific case of lock. I would suggest: >>>>>> >>>>>> // Print out all monitors that we have locked, or are trying to >>>>>> // lock, including re-locking when returning from a wait(). >>>>> >>>>> Making it more clear that the "re-locking" is coming from "wait()" >>>>> is an improvement. I'll fix this. >>>>> >>>>> >>>>>> 252 lock_state = "waiting to relock"; >>>>>> >>>>>> I prefer "waiting to re-lock in wait()", if that isn't too long. >>>>>> Otherwise "relock" needs to be a concept people are familiar with. >>>>> >>>>> I like "waiting to re-lock in wait()". >>>>> >>>>> >>>>>> 260 if (VerboseStackTrace && mark != NULL) { >>>>>> 261 st->print("\t- lockbits="); >>>>>> 262 mark->print_on(st); >>>>>> >>>>>> This really doesn't seem to warrant a new diagnostic flag, regardless >>>>>> of whether we think applying -XX:+Verbose is a good fit or not. >>>>> >>>>> I suspect that David C didn't want to change the default output format >>>>> and neither do I. We have some tests that try to parse out specific >>>>> things from thread dumps to verify certain bug fixes and we don't want >>>>> to break those. I'm thinking of the "duplicate owner" bug fix that we >>>>> fixed in thread dumps, but I can't pull up the bug ID (yet)... >>>>> >>>>> Thanks for the thorough review. I have to say that I wasn't expecting >>>>> much comment on this review at all. :-) >>>>> >>>>> >>>>> Dan >>>>> >>>>> >>>>>> >>>>>> Thanks, >>>>>> David >>>>>> ------- >>>>>> >>>>>>> This work is being tracked by the following bug ID: >>>>>>> >>>>>>> JDK-8130448 8077392 inspired thread dump improvements, comment >>>>>>> additions, new diagnostics >>>>>>> https://bugs.openjdk.java.net/browse/JDK-8130448 >>>>>>> >>>>>>> Here is the webrev URL: >>>>>>> >>>>>>> http://cr.openjdk.java.net/~dcubed/8130448-webrev/0-jdk9-hs-rt/ >>>>>>> >>>>>>> Testing: >>>>>>> >>>>>>> - RBT vm.quick batches (in process) >>>>>>> - JPRT test jobs >>>>>>> >>>>>>> Thanks, in advance, for any comments, questions or suggestions. >>>>>>> >>>>>>> Gory details about the changes are below... >>>>>>> >>>>>>> Dan >>>>>>> >>>>>>> 8130448 summary of changes: >>>>>>> >>>>>>> src/cpu/x86/vm/macroAssembler_x86.cpp >>>>>>> - comment additions for the assembly code >>>>>>> >>>>>>> src/share/vm/oops/markOop.cpp >>>>>>> - has_monitor() has to be checked before is_locked() since >>>>>>> the has_monitor() bits are a superset of the is_locked() bits >>>>>>> - code style fixes >>>>>>> >>>>>>> src/share/vm/runtime/globals.hpp >>>>>>> - add VerboseStackTrace diagnostic option >>>>>>> - add GuaranteeOnMonitorMismatch diagnostic option >>>>>>> - add JavaThreadExitReleasesMonitors product option; >>>>>>> this is the Java equivalent of JNIDetachReleasesMonitors >>>>>>> >>>>>>> src/share/vm/runtime/objectMonitor.cpp >>>>>>> - delete unused ObjectMonitor::try_enter() >>>>>>> - fix assert wording >>>>>>> >>>>>>> src/share/vm/runtime/objectMonitor.hpp >>>>>>> - delete unused ObjectMonitor::try_enter() >>>>>>> >>>>>>> src/share/vm/runtime/synchronizer.cpp >>>>>>> - add GuaranteeOnMonitorMismatch support with some >>>>>>> diagnostic output >>>>>>> >>>>>>> src/share/vm/runtime/thread.cpp >>>>>>> - add JavaThreadExitReleasesMonitors support >>>>>>> >>>>>>> src/share/vm/runtime/vframe.cpp >>>>>>> - clarify existing comments >>>>>>> - add comments to clarify what "waiting on" means >>>>>>> - add line to show when we are "waiting on", but >>>>>>> there are no locals available (previously we were >>>>>>> "waiting on" silently) >>>>>>> - add support for "waiting to relock" which can happen >>>>>>> for any of the monitors and not just the top monitor >>>>>>> - switch mark->print_on() verbose output to new >>>>>>> VerboseStackTrace switch; thread dumps are not enabled >>>>>>> with a specific switch so the '-XX:+Verbose' model of >>>>>>> being a modifier for another option does not fit >>>>> >>> > From daniel.daugherty at oracle.com Mon Jul 13 20:36:22 2015 From: daniel.daugherty at oracle.com (Daniel D. Daugherty) Date: Mon, 13 Jul 2015 14:36:22 -0600 Subject: Open code review for 8061999 Enhance VM option parsing to allow options to be specified In-Reply-To: <558AD8AD.6020009@oracle.com> References: <3d1df3cb-fe69-4c3b-b8e1-db8801d5a68f@default> <5588EA9F.3020001@oracle.com> <725f7631-425d-4918-8a92-230005d5b5ec@default> <558A1AE7.6010607@oracle.com> <224EF327-B898-4DAC-9343-4FE238604276@oracle.com> <558AD8AD.6020009@oracle.com> Message-ID: <55A42146.4070403@oracle.com> > Ron has a detailed write-up documenting all the research that he > did on the various command line option mechanisms. We had planned > to attach that write-up to the bug report, but we dropped the ball > (Sorry Mary!) After Ron returns, we'll make a final editing pass > on the document and attach it to the bug report. Ron has attached the following document to JDK-8061999: ORV1.0_The_State_of_Options_Parsing_in_the_JVM.txt That attachment should address most if not all of the historical and architectural comments in this review thread. Dan On 6/24/15 10:19 AM, Daniel D. Daugherty wrote: > On 6/23/15 10:43 PM, John Rose wrote: >> On Jun 23, 2015, at 7:50 PM, David Holmes >> wrote: >>> On 24/06/2015 3:43 AM, Ron Durbin wrote: >>>> David, >>>> >>>> The '-XX:Flags' option was considered during the research phase >>>> of this project and was rejected because of its limitations. The >>>> '-XX:Flags' option only works for boolean flag options and it >>>> uses a different syntax for the options than the command line. >>>> For example, '-XX:+UseSerialGC' would be specified as '+UseSerialGC' >>>> in the '-XX:Flags' option file. >>> I'm a little surprised the Flags option wasn't extended to cover >>> these additional requirements. But presumably it should now be >>> deprecated as we (again presumably) don't want to have two >>> mechanisms for doing this. >> I thought the Flags option used to handle any command line options, >> and like David I'm surprised the right answer is to get rid of it and >> make a new option that does what I think the Flags option should be >> doing. >> >> ? John > > Greetings, > > Ron is out of the office until next week so I'll provide a little > bit of background... > > Ron has a detailed write-up documenting all the research that he > did on the various command line option mechanisms. We had planned > to attach that write-up to the bug report, but we dropped the ball > (Sorry Mary!) After Ron returns, we'll make a final editing pass > on the document and attach it to the bug report. > > I fleshed out the '-XX:Flags' test cases that Ron posted earlier > in the thread: > > $ more flags.input.*:::::::::::::: > flags.input.boolean > :::::::::::::: > +UseSerialGC > :::::::::::::: > flags.input.ccstr > :::::::::::::: > ErrorFile=my_error_file > :::::::::::::: > flags.input.uintx > :::::::::::::: > MinRAMFraction=8 > > $ java -XX:+PrintVMOptions -XX:Flags=flags.input.boolean -version > VM option '+UseSerialGC' > VM option '+PrintVMOptions' > VM option 'Flags=flags.input.boolean' > java version "1.9.0-ea" > Java(TM) SE Runtime Environment (build 1.9.0-ea-b69) > Java HotSpot(TM) 64-Bit Server VM (build 1.9.0-ea-b69, mixed mode) > > $ java -XX:+PrintVMOptions -XX:Flags=flags.input.ccstr -version > VM option 'ErrorFile=my_error_file' > VM option '+PrintVMOptions' > VM option 'Flags=flags.input.ccstr' > java version "1.9.0-ea" > Java(TM) SE Runtime Environment (build 1.9.0-ea-b69) > Java HotSpot(TM) 64-Bit Server VM (build 1.9.0-ea-b69, mixed mode) > > $ java -XX:+PrintVMOptions -XX:Flags=flags.input.uintx -version > VM option 'MinRAMFraction=8' > VM option '+PrintVMOptions' > VM option 'Flags=flags.input.uintx' > java version "1.9.0-ea" > Java(TM) SE Runtime Environment (build 1.9.0-ea-b69) > Java HotSpot(TM) 64-Bit Server VM (build 1.9.0-ea-b69, mixed mode) > > > It looks like the '-XX:Flags' option does work for 'bool', 'uintx' > and 'ccstr' options. Clearly Ron and I didn't remember the exact > reason that he ruled out using the '-XX:Flags' option. This part > of the review thread will have to be resolved after Ron returns. > > Dan > From daniel.daugherty at oracle.com Mon Jul 13 21:53:47 2015 From: daniel.daugherty at oracle.com (Daniel D. Daugherty) Date: Mon, 13 Jul 2015 15:53:47 -0600 Subject: RFR(S) 8130448: thread dump improvements, comment, additions, new diagnostics inspired by 8077392 In-Reply-To: <55A3618A.20809@oracle.com> References: <55972558.6060905@oracle.com> <559A2397.2010409@oracle.com> <559AE96D.6010508@oracle.com> <559B7BAA.8070705@oracle.com> <559C0C4D.8090504@oracle.com> <559E030C.8010603@oracle.com> <559E7069.7030302@oracle.com> <55A3618A.20809@oracle.com> Message-ID: <55A4336B.9050102@oracle.com> On 7/13/15 12:58 AM, David Holmes wrote: > On 9/07/2015 11:00 PM, Daniel D. Daugherty wrote: >> On 7/8/15 11:13 PM, David Holmes wrote: >>> On 8/07/2015 3:28 AM, Daniel D. Daugherty wrote: >>>> On 7/7/15 1:11 AM, David Holmes wrote: >>>>> Hi Dan, >>>>> >>>>> Top posting as I'm lazy and running late :) >>>> >>>> No problem with the top posting. It makes your remaining >>>> concerns earlier to see and address. >>>> >>>> >>>>> Okay ... I'm still uneasy about adding two additional flags for the >>>>> "release monitors on exit" situation. I hear what you are saying >>>>> about >>>>> the cost of the monitor check - I had thought we kept easy access to >>>>> the set of monitors owned by a thread but it seems not, so trawling >>>>> the global monitor list is indeed an expensive operation. :( So okay >>>>> but I don't like it :) >>>> >>>> Since JavaThreadExitReleasesMonitors and GuaranteeOnMonitorMismatch >>>> are targeted at finding/working around bugs in the Java Monitor >>>> implementation, I'm going to take a look at moving the flag support >>>> down into Java Monitor subsystem's implementation specific options. >>>> That will get the options out of the global space and they won't >>>> have to be counted against the "cap and trade" limit :-) >>>> >>>> >>>>> I also take your point about viewing the new flag as a superset of >>>>> the >>>>> JNI-detach case. That's fair enough, but of course that aspect needs >>>>> to be documented. >>>> >>>> I'm starting to wonder why we have the 'JNIDetachReleasesMonitors' >>>> option at all. Is there a good reason to be able to turn off this >>>> piece of code? >>> >>> My recollection is that hotspot did not implement that part of the >>> spec. Simply switching the behaviour with no way to restore the >>> original behaviour could break existing apps. Hence a flag, on by >>> default. >> >> That's very likely the case. I'll poke around in my historical >> archive and see what shakes out. > > https://bugs.openjdk.java.net/browse/JDK-6336479 Thanks! The bug mentioned in the comments (6282335) was used to update docs and 6336479 was used to update the code. > >> >>> Of course by now apps should be spec compliant themselves so this >>> seems a flag that should itself be deprecated in 9 and targetted for >>> removal in 10. (That will help with the 'conservation of flags' >>> problem :) ). >> >> Sounds like a good RFE. > > Filed: https://bugs.openjdk.java.net/browse/JDK-8131045 Thanks again! Dan > > Cheers, > David > > >> Dan >> >> >>> >>>> >>>> >>>>> I was left unclear about your position on the VerboseStackTrace. I >>>>> agree the new output was likely put under a flag to avoid disturbing >>>>> existing output formats. But I don't see that it warrants its own >>>>> flag >>>>> - to me using Verbose okay (though the fact it is a develop flag is >>>>> limiting). >>>> >>>> Thanks for reminding me that '-XX:+Verbose' is a develop flag. >>>> That's another reason for not using that flag. Combined with >>>> the fact that '-XX:+Verbose' is considered a modifier to other >>>> flags and thread dumps aren't enabled/triggered by a flag means >>>> (to me anyway) that '-XX:+Verbose' is still not a good match. >>>> >>>> However, I have a vague memory that the Java Monitor subsystem >>>> has its own "verbose" flag. I'll take a look at switching to >>>> that... >>> >>> Okay >>> >>>> Will be working on the next round... >>> >>> Thanks, >>> David >>> >>>> Dan >>>> >>>> >>>> >>>>> >>>>> Thanks, >>>>> David >>>>> >>>>> On 7/07/2015 6:47 AM, Daniel D. Daugherty wrote: >>>>>> On 7/6/15 12:43 AM, David Holmes wrote: >>>>>>> Hi Dan, >>>>>>> >>>>>>> Metacomment: Could I suggest that in a RFR your subject line has >>>>>>> the >>>>>>> form : , rather than (bugid) - >>>>>>> especially >>>>>>> when the synopsis actually starts with a bug id :) Thanks. >>>>>> >>>>>> Yup that bug synopsis is/was a mess: >>>>>> >>>>>> Changed the synopsis line to : >>>>>> >>>>>> thread dump improvements, comment additions, new diagnostics >>>>>> inspired by 8077392 >>>>>> >>>>>> Also updated the e-mail thread subject line to your suggested >>>>>> format. >>>>>> Will try to remember to switch to that style in the future. >>>>>> >>>>>> >>>>>>> Mostly okay but some major concerns around the can of worms that >>>>>>> JavaThreadExitReleasesMonitors opens up. >>>>>> >>>>>> This is Java monitors so "can of worms" is familiar! :-) >>>>>> >>>>>> >>>>>>> >>>>>>> On 4/07/2015 10:14 AM, Daniel D. Daugherty wrote: >>>>>>>> Greetings, >>>>>>>> >>>>>>>> The hunt for the following bug: >>>>>>>> >>>>>>>> JDK-8077392 Stream fork/join tasks occasionally fail to >>>>>>>> complete >>>>>>>> >>>>>>>> and David C's work on the following bug: >>>>>>>> >>>>>>>> JDK-8069412 Locks need better debug-printing support >>>>>>>> >>>>>>>> have inspired additional thread dump improvements, comment >>>>>>>> additions >>>>>>>> to some Java monitor code and some new diagnostic options. >>>>>>> >>>>>>> src/cpu/x86/vm/macroAssembler_x86.cpp >>>>>>> >>>>>>> 1821 // update _owner from from BasicLock to thread >>>>>>> >>>>>>> Typo: from from >>>>>> >>>>>> Will fix. >>>>>> >>>>>> >>>>>>> 2091 // the placeholder value. If that didn't work, then >>>>>>> another >>>>>>> 2092 // grabbed the lock so we're done (and exit was a >>>>>>> success). >>>>>>> >>>>>>> another -> another thread ? >>>>>> >>>>>> Yes, "another thread" is better. Will fix. >>>>>> >>>>>> >>>>>>> 2201 // If that didn't work, then another grabbed the lock >>>>>>> 2202 // so we're done (and exit was a success). >>>>>>> >>>>>>> another -> another thread ? >>>>>> >>>>>> Yes, "another thread" is better. Will fix. >>>>>> >>>>>> >>>>>>> --- >>>>>>> >>>>>>> src/share/vm/oops/markOop.cpp >>>>>>> >>>>>>> 40 st->print("NULL"); // this should not happen >>>>>>> >>>>>>> Shouldn't that be an assert or guarantee in that case? Or at a >>>>>>> minimum >>>>>>> print something like: "NULL (but you should never see this!)" >>>>>> >>>>>> This is a relocated line from David C's change: >>>>>> >>>>>> old 49: st->print("monitor=NULL"); >>>>>> >>>>>> I simply added a comment to it. I don't think I like the idea of the >>>>>> thread dump code assert()'ing or guarantee()'ing because there might >>>>>> be other useful info that would have been printed after the assert() >>>>>> or guarantee() failure. >>>>>> >>>>>> I do like the idea of changing the message to: >>>>>> >>>>>> 40: st->print("NULL (this should never be seen!)"); >>>>>> >>>>>> >>>>>>> 42 BasicLock * bl = (BasicLock *) mon->owner(); >>>>>>> >>>>>>> What information has told us this is a BasicLock* not a Thread* >>>>>>> ? But >>>>>>> as all you do is print bl why not just p2i(mon->owner()) ? >>>>>> >>>>>> Again, this is a relocated line from David C's change: >>>>>> >>>>>> old 51: BasicLock * bl = (BasicLock *) mon->owner(); >>>>>> >>>>>> I'm going to guess that David C had some other code in there before >>>>>> that needed/assumed that the field is a "BasicLock *", but that code >>>>>> didn't make it into his final version. >>>>>> >>>>>> I will drop the 'bl' local and update the p2i() call to use >>>>>> mon->owner() directly. >>>>>> >>>>>> >>>>>>> --- >>>>>>> >>>>>>> src/share/vm/runtime/globals.hpp >>>>>>> >>>>>>> JavaThreadExitReleasesMonitors has me perplexed. The JNI >>>>>>> DetachThread >>>>>>> case seems to be a concession to badly written code that fails to >>>>>>> release locks on error paths. >>>>>> >>>>>> I don't think I would call the JNIDetachReleasesMonitors case a >>>>>> concession >>>>>> to badly written JNI code. 6282335 is very clear that this code was >>>>>> added >>>>>> to meet the JNI spec. The JNI spec words might be considered a >>>>>> concession... >>>>>> >>>>>> http://docs.oracle.com/javase/8/docs/technotes/guides/jni/spec/invocation.html#DetachCurrentThread >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> > DetachCurrentThread >>>>>> > >>>>>> > jint DetachCurrentThread(JavaVM *vm); >>>>>> > >>>>>> > Detaches the current thread from a Java VM. All Java monitors >>>>>> > held by this thread are released. All Java threads waiting for >>>>>> > this thread to die are notified. >>>>>> > >>>>>> > The main thread can be detached from the VM. >>>>>> >>>>>> >>>>>> >>>>>>> The equivalent for a Java thread would again involve lock >>>>>>> acquisition >>>>>>> via JNI. But I don't recall ever seeing a bug report or RFE >>>>>>> related to >>>>>>> this. What seems to have motivated this new flag is the >>>>>>> potential for >>>>>>> a broken VM to actually leave the monitor locked (e.g. because >>>>>>> compiled code failed to do the unlock on all paths). >>>>>> >>>>>> 8077392 and bugs like it are exactly the reason for adding these >>>>>> two options. >>>>>> >>>>>> JavaThreadExitReleasesMonitors is added to provide a work around >>>>>> until the underlying bug or bugs are fixed. This option is targeted >>>>>> at folks that are chasing their own bugs and don't care about this >>>>>> one. >>>>>> >>>>>> GuaranteeOnMonitorMismatch is added to help hunt 8077392 >>>>>> specifically >>>>>> and to sanity check for similar issues generally. I can see using >>>>>> the >>>>>> two options in combination with existing test suites as a stress >>>>>> test >>>>>> for the Java monitor subsystem. >>>>>> >>>>>> >>>>>>> To address that I'd be inclined to simply have a guarantee in the >>>>>>> Java >>>>>>> thread exit path, rather than a flag to do the clean up and another >>>>>>> flag to control a guarantee. >>>>>> >>>>>> The check for an unexited Java monitor is not cheap. >>>>>> >>>>>> The existing check under the JNIDetachReleasesMonitors flag is >>>>>> positioned to only affect threads using JNI DetachCurrentThread() >>>>>> and that cost is justified as part of meeting the JNI spec. >>>>>> >>>>>> Adding the unexited Java monitor check to all exiting Java >>>>>> threads should not be done lightly due to the cost. If the >>>>>> VM is functioning correctly, then why impose this cost on >>>>>> all exiting Java threads? >>>>>> >>>>>> >>>>>>> I don't think two new command-line options (has this gone >>>>>>> through CCC >>>>>>> yet?) are justified. >>>>>> >>>>>> No, this has not gone through CCC yet. My preference is to get >>>>>> code review feedback (like this) before submitting a CCC. >>>>>> >>>>>> I suppose I could have simply added more sub-options to the >>>>>> existing Java monitor subsystem knobs and switches, but it >>>>>> seemed to make sense to model JavaThreadExitReleasesMonitors >>>>>> on the existing JNIDetachReleasesMonitors. >>>>>> >>>>>> >>>>>>> Also note that allowing for JVM induced missing unlocks is >>>>>>> something >>>>>>> that can affect JNI attached threads as well as regular Java >>>>>>> threads. >>>>>>> I'll take this up in discussing thread.cpp below. >>>>>>> >>>>>>> That aside, the comment, which was modelled on the JNI DetachThread >>>>>>> variant, does not really work in this case: >>>>>>> >>>>>>> 2801 "JavaThread exit() releases monitors owned by >>>>>>> thread") >>>>>>> \ >>>>>>> >>>>>>> JavaThread is not a programming concept but an internal JVM >>>>>>> abstraction. I would suggest something like: >>>>>>> >>>>>>> "Java thread termination releases monitors unexpectedly still >>>>>>> owned by >>>>>>> thread" >>>>>> >>>>>> I'll switch to your description text if we end up keeping the >>>>>> new options. >>>>>> >>>>>> >>>>>>> --- >>>>>>> >>>>>>> src/share/vm/runtime/objectMonitor.cpp >>>>>>> src/share/vm/runtime/objectMonitor.hpp >>>>>>> >>>>>>> No comments >>>>>>> >>>>>>> --- >>>>>>> >>>>>>> src/share/vm/runtime/synchronizer.cpp >>>>>>> >>>>>>> If we find the unexpected locked monitor it would be useful to see >>>>>>> more Java level information about the Thread (in the non-detaching >>>>>>> case) and the object that is locked. >>>>>> >>>>>> I can probably steal some code from the thread dump side to >>>>>> give us more info about the Object associated with the Java >>>>>> monitor... >>>>>> >>>>>> >>>>>>> --- >>>>>>> >>>>>>> src/share/vm/runtime/thread.cpp >>>>>>> >>>>>>> As noted previously JNI attached threads can also be affected by >>>>>>> JVM >>>>>>> induced locking bugs. So the comment block: >>>>>>> >>>>>>> 1804 // 6282335 JNI DetachCurrentThread spec states that all Java >>>>>>> monitors >>>>>>> 1805 // held by this thread must be released. A detach operation >>>>>>> must only >>>>>>> 1806 // get here if there are no Java frames on the stack. >>>>>>> Therefore, any >>>>>>> 1807 // owned monitors at this point MUST be JNI-acquired >>>>>>> monitors >>>>>>> which are >>>>>>> 1808 // pre-inflated and in the monitor cache. >>>>>>> >>>>>>> is not strictly correct as it is presuming a correctly operating >>>>>>> JVM. >>>>>> >>>>>> I actually disagree with the last two sentences in that comment >>>>>> block, >>>>>> but I didn't have a good rewrite in mind. I'll think about it more. >>>>>> >>>>>> >>>>>> >>>>>>> Further the logic now applied: >>>>>>> >>>>>>> 1816 if ((exit_type == jni_detach && >>>>>>> JNIDetachReleasesMonitors) || >>>>>>> 1817 JavaThreadExitReleasesMonitors) { >>>>>>> >>>>>>> is also not "correct" because if we have >>>>>>> JavaThreadExitReleasesMonitors true while >>>>>>> JNIDetachReleasesMonitors is >>>>>>> false, we will in fact release any JNI acquired monitors because we >>>>>>> can't make the distinction. >>>>>> >>>>>> I don't think JNIDetachReleasesMonitors only has to deal with >>>>>> JNI-acquired >>>>>> monitors and I don't think that JavaThreadExitReleasesMonitors only >>>>>> has to >>>>>> deal with Java code acquired monitors. I see these options as >>>>>> applying to >>>>>> "how you got to the Java thread exit path" and not applying to "what >>>>>> needs >>>>>> to be cleaned up". >>>>>> >>>>>> I see JNIDetachReleasesMonitors as a way of cleaning up unexited >>>>>> Java >>>>>> monitors when we're executing the JNI DetachCurrentThread() code >>>>>> path. >>>>>> I don't really care why the Java monitors are unexited... and I >>>>>> think >>>>>> the spec wording is clear that all unexited Java monitors are >>>>>> cleaned >>>>>> up... not just JNI-acquired monitors. >>>>>> >>>>>> I see JavaThreadExitReleasesMonitors as a way of cleaning up >>>>>> unexited >>>>>> Java monitors in any code path where we are exiting the Java thread. >>>>>> I see >>>>>> JavaThreadExitReleasesMonitors as a superset of >>>>>> JNIDetachReleasesMonitors. >>>>>> >>>>>> >>>>>>> Given we can't make the distinction I don't see any way for these >>>>>>> separate flags to actually work well together. >>>>>> >>>>>> I think they work well together when JavaThreadExitReleasesMonitors >>>>>> is seen as a superset of JNIDetachReleasesMonitors. Of course, that >>>>>> hinges on my opinion that JNIDetachReleasesMonitors applies to any >>>>>> unexited Java monitor and not just JNI-acquired Java monitors. >>>>>> >>>>>> >>>>>>> As I said above I'm more inclined to just add a guarantee to the >>>>>>> non-detach case, than add two new flags. (Even though this means >>>>>>> there >>>>>>> won't be detection for such bugs when JNI attached threads >>>>>>> encounter >>>>>>> them - including the main thread :( ). >>>>>> >>>>>> I really don't want to add this check to all Java thread exit >>>>>> paths since it is expensive. >>>>>> >>>>>> >>>>>>> As I said this has me perplexed. :( >>>>>> >>>>>> Hopefully, I've explained it better now. >>>>>> >>>>>> >>>>>>> --- >>>>>>> >>>>>>> src/share/vm/runtime/vframe.cpp >>>>>>> >>>>>>> 170 // It would be nice to distinguish between "waiting >>>>>>> on" and >>>>>>> 171 // "waited on". Currently, "waiting on" here with a >>>>>>> 172 // java.lang.Thread.State == "WAITING (on object >>>>>>> monitor)" >>>>>>> 173 // earlier in the output means that the monitor has >>>>>>> not yet >>>>>>> been >>>>>>> 174 // notified and java.lang.Thread.State == "BLOCKED (on >>>>>>> object >>>>>>> 175 // monitor)" earlier in the output means that the >>>>>>> monitor has >>>>>>> 176 // been notified and the thread is blocked on reentry. >>>>>>> >>>>>>> That's a very long sentence that can be quite difficult to parse >>>>>>> and >>>>>>> could probably be reworded to describe how the output should be >>>>>>> interpreted eg: >>>>>>> >>>>>>> // If earlier in the output we reported java.lang.Thread.State == >>>>>>> // "WAITING (on object monitor)" and now we report "waited on", >>>>>>> then >>>>>>> // we are still waiting for notification [or timeout?]. >>>>>>> Otherwise if >>>>>>> // we earlier reported java.lang.Thread.State == "BLOCKED (on >>>>>>> object >>>>>>> // monitor)", then we are actually waiting to reacquire the monitor >>>>>>> // lock. At this level we can't distinguish the two cases to report >>>>>>> // "waited on" rather than "waiting on" for the second case. >>>>>> >>>>>> I'll take a look at rewriting the comment and may just take your >>>>>> version entirely. >>>>>> >>>>>> >>>>>>> I wonder if we can prod deeper into VM state to try and make the >>>>>>> distinction? >>>>>> >>>>>> I played around with doing just that, but it seems like the M&M >>>>>> code that fetches similar state probes the state stored in the >>>>>> java.lang.Thread object. I didn't want to go there. >>>>>> >>>>>> >>>>>>> >>>>>>> 184 } else { >>>>>>> 185 st->print_cr("\t- %s ", >>>>>>> wait_state); >>>>>>> >>>>>>> The concept of "locals" is confusing here. Isn't the "local" in >>>>>>> this >>>>>>> case just the object that we have waited upon? In which case we >>>>>>> should >>>>>>> say "no object reference available". >>>>>> >>>>>> I got the phrase "locals" from the compiler code that was trying to >>>>>> decode the object reference. I can change to "no object reference >>>>>> available". >>>>>> I definitely want to say _something_ here. The existing code is just >>>>>> silent. >>>>>> >>>>>> >>>>>>> Though I would have thought/hoped there must be a way to find the >>>>>>> object reference even in a compiled frame? >>>>>> >>>>>> Yes, if you deopt... I didn't want to go there. >>>>>> >>>>>> >>>>>>> 195 // Print out all monitors that we have locked, are trying to >>>>>>> lock >>>>>>> 196 // or are trying to relock after a wait(). >>>>>>> >>>>>>> that makes it sound like there are three cases when really a >>>>>>> "relock" >>>>>>> is just a specific case of lock. I would suggest: >>>>>>> >>>>>>> // Print out all monitors that we have locked, or are trying to >>>>>>> // lock, including re-locking when returning from a wait(). >>>>>> >>>>>> Making it more clear that the "re-locking" is coming from "wait()" >>>>>> is an improvement. I'll fix this. >>>>>> >>>>>> >>>>>>> 252 lock_state = "waiting to relock"; >>>>>>> >>>>>>> I prefer "waiting to re-lock in wait()", if that isn't too long. >>>>>>> Otherwise "relock" needs to be a concept people are familiar with. >>>>>> >>>>>> I like "waiting to re-lock in wait()". >>>>>> >>>>>> >>>>>>> 260 if (VerboseStackTrace && mark != NULL) { >>>>>>> 261 st->print("\t- lockbits="); >>>>>>> 262 mark->print_on(st); >>>>>>> >>>>>>> This really doesn't seem to warrant a new diagnostic flag, >>>>>>> regardless >>>>>>> of whether we think applying -XX:+Verbose is a good fit or not. >>>>>> >>>>>> I suspect that David C didn't want to change the default output >>>>>> format >>>>>> and neither do I. We have some tests that try to parse out specific >>>>>> things from thread dumps to verify certain bug fixes and we don't >>>>>> want >>>>>> to break those. I'm thinking of the "duplicate owner" bug fix >>>>>> that we >>>>>> fixed in thread dumps, but I can't pull up the bug ID (yet)... >>>>>> >>>>>> Thanks for the thorough review. I have to say that I wasn't >>>>>> expecting >>>>>> much comment on this review at all. :-) >>>>>> >>>>>> >>>>>> Dan >>>>>> >>>>>> >>>>>>> >>>>>>> Thanks, >>>>>>> David >>>>>>> ------- >>>>>>> >>>>>>>> This work is being tracked by the following bug ID: >>>>>>>> >>>>>>>> JDK-8130448 8077392 inspired thread dump improvements, >>>>>>>> comment >>>>>>>> additions, new diagnostics >>>>>>>> https://bugs.openjdk.java.net/browse/JDK-8130448 >>>>>>>> >>>>>>>> Here is the webrev URL: >>>>>>>> >>>>>>>> http://cr.openjdk.java.net/~dcubed/8130448-webrev/0-jdk9-hs-rt/ >>>>>>>> >>>>>>>> Testing: >>>>>>>> >>>>>>>> - RBT vm.quick batches (in process) >>>>>>>> - JPRT test jobs >>>>>>>> >>>>>>>> Thanks, in advance, for any comments, questions or suggestions. >>>>>>>> >>>>>>>> Gory details about the changes are below... >>>>>>>> >>>>>>>> Dan >>>>>>>> >>>>>>>> 8130448 summary of changes: >>>>>>>> >>>>>>>> src/cpu/x86/vm/macroAssembler_x86.cpp >>>>>>>> - comment additions for the assembly code >>>>>>>> >>>>>>>> src/share/vm/oops/markOop.cpp >>>>>>>> - has_monitor() has to be checked before is_locked() since >>>>>>>> the has_monitor() bits are a superset of the is_locked() bits >>>>>>>> - code style fixes >>>>>>>> >>>>>>>> src/share/vm/runtime/globals.hpp >>>>>>>> - add VerboseStackTrace diagnostic option >>>>>>>> - add GuaranteeOnMonitorMismatch diagnostic option >>>>>>>> - add JavaThreadExitReleasesMonitors product option; >>>>>>>> this is the Java equivalent of JNIDetachReleasesMonitors >>>>>>>> >>>>>>>> src/share/vm/runtime/objectMonitor.cpp >>>>>>>> - delete unused ObjectMonitor::try_enter() >>>>>>>> - fix assert wording >>>>>>>> >>>>>>>> src/share/vm/runtime/objectMonitor.hpp >>>>>>>> - delete unused ObjectMonitor::try_enter() >>>>>>>> >>>>>>>> src/share/vm/runtime/synchronizer.cpp >>>>>>>> - add GuaranteeOnMonitorMismatch support with some >>>>>>>> diagnostic output >>>>>>>> >>>>>>>> src/share/vm/runtime/thread.cpp >>>>>>>> - add JavaThreadExitReleasesMonitors support >>>>>>>> >>>>>>>> src/share/vm/runtime/vframe.cpp >>>>>>>> - clarify existing comments >>>>>>>> - add comments to clarify what "waiting on" means >>>>>>>> - add line to show when we are "waiting on", but >>>>>>>> there are no locals available (previously we were >>>>>>>> "waiting on" silently) >>>>>>>> - add support for "waiting to relock" which can happen >>>>>>>> for any of the monitors and not just the top monitor >>>>>>>> - switch mark->print_on() verbose output to new >>>>>>>> VerboseStackTrace switch; thread dumps are not enabled >>>>>>>> with a specific switch so the '-XX:+Verbose' model of >>>>>>>> being a modifier for another option does not fit >>>>>> >>>> >> From daniel.daugherty at oracle.com Mon Jul 13 21:57:53 2015 From: daniel.daugherty at oracle.com (Daniel D. Daugherty) Date: Mon, 13 Jul 2015 15:57:53 -0600 Subject: RFR(S) 8130448: thread dump improvements, comment, additions, new diagnostics inspired by 8077392 In-Reply-To: <559D970E.7000905@oracle.com> References: <55972558.6060905@oracle.com> <559D970E.7000905@oracle.com> Message-ID: <55A43461.9090406@oracle.com> Need a second reviewer for this bug fix. One minor tweak has been done relative to the webrev below: $ diff -c src/share/vm/runtime/synchronizer.cpp{.cr1,} *** src/share/vm/runtime/synchronizer.cpp.cr1 Wed Jul 8 07:15:07 2015 --- src/share/vm/runtime/synchronizer.cpp Thu Jul 9 07:07:28 2015 *************** *** 1651,1661 **** Handle obj((oop) mid->object()); tty->print("INFO: unexpected locked object:"); javaVFrame::print_locked_object_class_name(tty, obj, "locked"); } - guarantee(ObjectMonitor::Knob_VerifyMatch == 0, - err_msg("exiting JavaThread=" INTPTR_FORMAT - " unexpectedly owns ObjectMonitor=" INTPTR_FORMAT, - THREAD, mid)); (void)mid->complete_exit(CHECK); } } --- 1651,1660 ---- Handle obj((oop) mid->object()); tty->print("INFO: unexpected locked object:"); javaVFrame::print_locked_object_class_name(tty, obj, "locked"); + fatal(err_msg("exiting JavaThread=" INTPTR_FORMAT + " unexpectedly owns ObjectMonitor=" INTPTR_FORMAT, + THREAD, mid)); } (void)mid->complete_exit(CHECK); } } Dan On 7/8/15 3:33 PM, Daniel D. Daugherty wrote: > Greetings, > > I've updated this patch based on David H's comments along with > some additional cleanup. > > This work is being tracked by the following bug ID: > > JDK-8130448 8077392 inspired thread dump improvements, comment > additions, new diagnostics > https://bugs.openjdk.java.net/browse/JDK-8130448 > > Here is the webrev URL: > > http://cr.openjdk.java.net/~dcubed/8130448-webrev/1-jdk9-hs-rt/ > > The easiest way to review the delta is to download the two patch > files and compare them in something like jfilemerge: > > http://cr.openjdk.java.net/~dcubed/8130448-webrev/0-jdk9-hs-rt/hotspot.patch > > http://cr.openjdk.java.net/~dcubed/8130448-webrev/1-jdk9-hs-rt/hotspot.patch > > > Testing: > > - Aurora Adhoc RT/SVC nightly batches (in process) > - JPRT test jobs > > Thanks, in advance, for any comments, questions or suggestions. > > Gory details about the changes are below... > > Dan > > Changes between CR0 and CR1 are: > > src/cpu/x86/vm/macroAssembler_x86.cpp > > - fix comment typos, clarify comment wording > > src/share/vm/oops/markOop.cpp > > - clarify output messages > - get rid of confusing local variable > > src/share/vm/runtime/globals.hpp > > - drop VerboseStackTrace, GuaranteeOnMonitorMismatch > and JavaThreadExitReleasesMonitors options > - there are no longer changes to this file > > src/share/vm/runtime/objectMonitor.cpp > > - add ObjectMonitor::Knob_ExitRelease suboption to replace > JavaThreadExitReleasesMonitors > - add ObjectMonitor::Knob_VerifyMatch suboption to replace > GuaranteeOnMonitorMismatch > - cleanup messy logging: > - switch from '::printf()' -> 'tty->print_cr()' > - switch from '::fflush()' -> 'tty->flush()' > > src/share/vm/runtime/objectMonitor.hpp > > - add ObjectMonitor::Knob_ExitRelease suboption > - add ObjectMonitor::Knob_VerifyMatch suboption > - cleanup messy logging > > src/share/vm/runtime/synchronizer.cpp > > - cleanup messy logging > - switch from GuaranteeOnMonitorMismatch to > ObjectMonitor::Knob_VerifyMatch > - add diagnostic information about the locked object > when ReleaseJavaMonitorsClosure::do_monitor() finds > a problem > > src/share/vm/runtime/thread.cpp > > - clarify comments > - switch from JavaThreadExitReleasesMonitors to > ObjectMonitor::Knob_ExitRelease > > src/share/vm/runtime/vframe.cpp > > - print_locked_object_class_name() is now public > - clarify comments > - clarify output messages > - switch from VerboseStackTrace to the already existing > ObjectMonitor::Knob_Verbose > > src/share/vm/runtime/vframe.hpp > > - print_locked_object_class_name() is now public > > > On 7/3/15 6:14 PM, Daniel D. Daugherty wrote: >> Greetings, >> >> The hunt for the following bug: >> >> JDK-8077392 Stream fork/join tasks occasionally fail to complete >> >> and David C's work on the following bug: >> >> JDK-8069412 Locks need better debug-printing support >> >> have inspired additional thread dump improvements, comment additions >> to some Java monitor code and some new diagnostic options. >> >> This work is being tracked by the following bug ID: >> >> JDK-8130448 8077392 inspired thread dump improvements, comment >> additions, new diagnostics >> https://bugs.openjdk.java.net/browse/JDK-8130448 >> >> Here is the webrev URL: >> >> http://cr.openjdk.java.net/~dcubed/8130448-webrev/0-jdk9-hs-rt/ >> >> Testing: >> >> - RBT vm.quick batches (in process) >> - JPRT test jobs >> >> Thanks, in advance, for any comments, questions or suggestions. >> >> Gory details about the changes are below... >> >> Dan >> >> 8130448 summary of changes: >> >> src/cpu/x86/vm/macroAssembler_x86.cpp >> - comment additions for the assembly code >> >> src/share/vm/oops/markOop.cpp >> - has_monitor() has to be checked before is_locked() since >> the has_monitor() bits are a superset of the is_locked() bits >> - code style fixes >> >> src/share/vm/runtime/globals.hpp >> - add VerboseStackTrace diagnostic option >> - add GuaranteeOnMonitorMismatch diagnostic option >> - add JavaThreadExitReleasesMonitors product option; >> this is the Java equivalent of JNIDetachReleasesMonitors >> >> src/share/vm/runtime/objectMonitor.cpp >> - delete unused ObjectMonitor::try_enter() >> - fix assert wording >> >> src/share/vm/runtime/objectMonitor.hpp >> - delete unused ObjectMonitor::try_enter() >> >> src/share/vm/runtime/synchronizer.cpp >> - add GuaranteeOnMonitorMismatch support with some >> diagnostic output >> >> src/share/vm/runtime/thread.cpp >> - add JavaThreadExitReleasesMonitors support >> >> src/share/vm/runtime/vframe.cpp >> - clarify existing comments >> - add comments to clarify what "waiting on" means >> - add line to show when we are "waiting on", but >> there are no locals available (previously we were >> "waiting on" silently) >> - add support for "waiting to relock" which can happen >> for any of the monitors and not just the top monitor >> - switch mark->print_on() verbose output to new >> VerboseStackTrace switch; thread dumps are not enabled >> with a specific switch so the '-XX:+Verbose' model of >> being a modifier for another option does not fit >> >> > > > From coleen.phillimore at oracle.com Tue Jul 14 14:18:46 2015 From: coleen.phillimore at oracle.com (Coleen Phillimore) Date: Tue, 14 Jul 2015 10:18:46 -0400 Subject: RFR(S) 8130448: thread dump improvements, comment, additions, new diagnostics inspired by 8077392 In-Reply-To: <55A43461.9090406@oracle.com> References: <55972558.6060905@oracle.com> <559D970E.7000905@oracle.com> <55A43461.9090406@oracle.com> Message-ID: <55A51A46.7050403@oracle.com> Dan, This looks really good and a nice cleanup of wrong logging code (raw printfs) and an unused function (?). I didn't read the whole thread but adding Knobs for printing seems consistent with the other knobs. I'd thought you'd added more command line arguments. At some point, these logging knobs would be candidates for conversion to the new logging system (TBD). Thanks, Coleen On 7/13/15 5:57 PM, Daniel D. Daugherty wrote: > Need a second reviewer for this bug fix. > > One minor tweak has been done relative to the webrev below: > > $ diff -c src/share/vm/runtime/synchronizer.cpp{.cr1,} > *** src/share/vm/runtime/synchronizer.cpp.cr1 Wed Jul 8 07:15:07 2015 > --- src/share/vm/runtime/synchronizer.cpp Thu Jul 9 07:07:28 2015 > *************** > *** 1651,1661 **** > Handle obj((oop) mid->object()); > tty->print("INFO: unexpected locked object:"); > javaVFrame::print_locked_object_class_name(tty, obj, "locked"); > } > - guarantee(ObjectMonitor::Knob_VerifyMatch == 0, > - err_msg("exiting JavaThread=" INTPTR_FORMAT > - " unexpectedly owns ObjectMonitor=" > INTPTR_FORMAT, > - THREAD, mid)); > (void)mid->complete_exit(CHECK); > } > } > --- 1651,1660 ---- > Handle obj((oop) mid->object()); > tty->print("INFO: unexpected locked object:"); > javaVFrame::print_locked_object_class_name(tty, obj, "locked"); > + fatal(err_msg("exiting JavaThread=" INTPTR_FORMAT > + " unexpectedly owns ObjectMonitor=" > INTPTR_FORMAT, > + THREAD, mid)); > } > (void)mid->complete_exit(CHECK); > } > } > > Dan > > > On 7/8/15 3:33 PM, Daniel D. Daugherty wrote: >> Greetings, >> >> I've updated this patch based on David H's comments along with >> some additional cleanup. >> >> This work is being tracked by the following bug ID: >> >> JDK-8130448 8077392 inspired thread dump improvements, comment >> additions, new diagnostics >> https://bugs.openjdk.java.net/browse/JDK-8130448 >> >> Here is the webrev URL: >> >> http://cr.openjdk.java.net/~dcubed/8130448-webrev/1-jdk9-hs-rt/ >> >> The easiest way to review the delta is to download the two patch >> files and compare them in something like jfilemerge: >> >> http://cr.openjdk.java.net/~dcubed/8130448-webrev/0-jdk9-hs-rt/hotspot.patch >> >> http://cr.openjdk.java.net/~dcubed/8130448-webrev/1-jdk9-hs-rt/hotspot.patch >> >> >> Testing: >> >> - Aurora Adhoc RT/SVC nightly batches (in process) >> - JPRT test jobs >> >> Thanks, in advance, for any comments, questions or suggestions. >> >> Gory details about the changes are below... >> >> Dan >> >> Changes between CR0 and CR1 are: >> >> src/cpu/x86/vm/macroAssembler_x86.cpp >> >> - fix comment typos, clarify comment wording >> >> src/share/vm/oops/markOop.cpp >> >> - clarify output messages >> - get rid of confusing local variable >> >> src/share/vm/runtime/globals.hpp >> >> - drop VerboseStackTrace, GuaranteeOnMonitorMismatch >> and JavaThreadExitReleasesMonitors options >> - there are no longer changes to this file >> >> src/share/vm/runtime/objectMonitor.cpp >> >> - add ObjectMonitor::Knob_ExitRelease suboption to replace >> JavaThreadExitReleasesMonitors >> - add ObjectMonitor::Knob_VerifyMatch suboption to replace >> GuaranteeOnMonitorMismatch >> - cleanup messy logging: >> - switch from '::printf()' -> 'tty->print_cr()' >> - switch from '::fflush()' -> 'tty->flush()' >> >> src/share/vm/runtime/objectMonitor.hpp >> >> - add ObjectMonitor::Knob_ExitRelease suboption >> - add ObjectMonitor::Knob_VerifyMatch suboption >> - cleanup messy logging >> >> src/share/vm/runtime/synchronizer.cpp >> >> - cleanup messy logging >> - switch from GuaranteeOnMonitorMismatch to >> ObjectMonitor::Knob_VerifyMatch >> - add diagnostic information about the locked object >> when ReleaseJavaMonitorsClosure::do_monitor() finds >> a problem >> >> src/share/vm/runtime/thread.cpp >> >> - clarify comments >> - switch from JavaThreadExitReleasesMonitors to >> ObjectMonitor::Knob_ExitRelease >> >> src/share/vm/runtime/vframe.cpp >> >> - print_locked_object_class_name() is now public >> - clarify comments >> - clarify output messages >> - switch from VerboseStackTrace to the already existing >> ObjectMonitor::Knob_Verbose >> >> src/share/vm/runtime/vframe.hpp >> >> - print_locked_object_class_name() is now public >> >> >> On 7/3/15 6:14 PM, Daniel D. Daugherty wrote: >>> Greetings, >>> >>> The hunt for the following bug: >>> >>> JDK-8077392 Stream fork/join tasks occasionally fail to complete >>> >>> and David C's work on the following bug: >>> >>> JDK-8069412 Locks need better debug-printing support >>> >>> have inspired additional thread dump improvements, comment additions >>> to some Java monitor code and some new diagnostic options. >>> >>> This work is being tracked by the following bug ID: >>> >>> JDK-8130448 8077392 inspired thread dump improvements, comment >>> additions, new diagnostics >>> https://bugs.openjdk.java.net/browse/JDK-8130448 >>> >>> Here is the webrev URL: >>> >>> http://cr.openjdk.java.net/~dcubed/8130448-webrev/0-jdk9-hs-rt/ >>> >>> Testing: >>> >>> - RBT vm.quick batches (in process) >>> - JPRT test jobs >>> >>> Thanks, in advance, for any comments, questions or suggestions. >>> >>> Gory details about the changes are below... >>> >>> Dan >>> >>> 8130448 summary of changes: >>> >>> src/cpu/x86/vm/macroAssembler_x86.cpp >>> - comment additions for the assembly code >>> >>> src/share/vm/oops/markOop.cpp >>> - has_monitor() has to be checked before is_locked() since >>> the has_monitor() bits are a superset of the is_locked() bits >>> - code style fixes >>> >>> src/share/vm/runtime/globals.hpp >>> - add VerboseStackTrace diagnostic option >>> - add GuaranteeOnMonitorMismatch diagnostic option >>> - add JavaThreadExitReleasesMonitors product option; >>> this is the Java equivalent of JNIDetachReleasesMonitors >>> >>> src/share/vm/runtime/objectMonitor.cpp >>> - delete unused ObjectMonitor::try_enter() >>> - fix assert wording >>> >>> src/share/vm/runtime/objectMonitor.hpp >>> - delete unused ObjectMonitor::try_enter() >>> >>> src/share/vm/runtime/synchronizer.cpp >>> - add GuaranteeOnMonitorMismatch support with some >>> diagnostic output >>> >>> src/share/vm/runtime/thread.cpp >>> - add JavaThreadExitReleasesMonitors support >>> >>> src/share/vm/runtime/vframe.cpp >>> - clarify existing comments >>> - add comments to clarify what "waiting on" means >>> - add line to show when we are "waiting on", but >>> there are no locals available (previously we were >>> "waiting on" silently) >>> - add support for "waiting to relock" which can happen >>> for any of the monitors and not just the top monitor >>> - switch mark->print_on() verbose output to new >>> VerboseStackTrace switch; thread dumps are not enabled >>> with a specific switch so the '-XX:+Verbose' model of >>> being a modifier for another option does not fit >>> >>> >> >> >> > From daniel.daugherty at oracle.com Tue Jul 14 15:20:30 2015 From: daniel.daugherty at oracle.com (Daniel D. Daugherty) Date: Tue, 14 Jul 2015 09:20:30 -0600 Subject: RFR(XXS) 8131128: fix merge error in jprt.properties Message-ID: <55A528BE.8020807@oracle.com> Greetings, I have a fix for the following bug: JDK-8131128 Merge error in jprt.properties leads to missing devkit argument https://bugs.openjdk.java.net/browse/JDK-8131128 I made a merge error on 2015.07.03 during my gatekeeping work for a Main_Baseline -> RT_Baseline sync-down. Thanks for Mikael for finding this issue. Webrev URL: http://cr.openjdk.java.net/~dcubed/8131128-webrev/0-jdk9-hs-rt/ If you're interested in the whitespace changes that I made along with adding the line break, you'll need to use the 'cdiffs' link. Thanks, in advance, for any comments, questions or suggestions. Dan From daniel.daugherty at oracle.com Tue Jul 14 15:38:49 2015 From: daniel.daugherty at oracle.com (Daniel D. Daugherty) Date: Tue, 14 Jul 2015 09:38:49 -0600 Subject: RFR(S) 8130448: thread dump improvements, comment, additions, new diagnostics inspired by 8077392 In-Reply-To: <55A51A46.7050403@oracle.com> References: <55972558.6060905@oracle.com> <559D970E.7000905@oracle.com> <55A43461.9090406@oracle.com> <55A51A46.7050403@oracle.com> Message-ID: <55A52D09.7010700@oracle.com> Coleen, Thanks for the review! Replies embedded below. On 7/14/15 8:18 AM, Coleen Phillimore wrote: > > Dan, > > This looks really good and a nice cleanup of wrong logging code (raw > printfs) and an unused function (?). Thanks! For those that have been playing along at home, this bug fix is coming from the "cleanup" bucket in the Contended Java Locking project. > I didn't read the whole thread but adding Knobs for printing seems > consistent with the other knobs. I'd thought you'd added more command > line arguments. David H. rightly objected to me adding three more command line options in Code Review Round 0 so we switched to using the already existing SyncKnobs mechanism. As Misha has pointed out, we are under "cap and trade" limits on command line options! :-) > At some point, these logging knobs would be candidates for conversion > to the new logging system (TBD). And that's one of the reasons I switched from raw printfs to the more normal tty->print_cr() stuff. Thanks again for the review! Dan > > Thanks, > Coleen > > On 7/13/15 5:57 PM, Daniel D. Daugherty wrote: >> Need a second reviewer for this bug fix. >> >> One minor tweak has been done relative to the webrev below: >> >> $ diff -c src/share/vm/runtime/synchronizer.cpp{.cr1,} >> *** src/share/vm/runtime/synchronizer.cpp.cr1 Wed Jul 8 07:15:07 2015 >> --- src/share/vm/runtime/synchronizer.cpp Thu Jul 9 07:07:28 2015 >> *************** >> *** 1651,1661 **** >> Handle obj((oop) mid->object()); >> tty->print("INFO: unexpected locked object:"); >> javaVFrame::print_locked_object_class_name(tty, obj, >> "locked"); >> } >> - guarantee(ObjectMonitor::Knob_VerifyMatch == 0, >> - err_msg("exiting JavaThread=" INTPTR_FORMAT >> - " unexpectedly owns ObjectMonitor=" >> INTPTR_FORMAT, >> - THREAD, mid)); >> (void)mid->complete_exit(CHECK); >> } >> } >> --- 1651,1660 ---- >> Handle obj((oop) mid->object()); >> tty->print("INFO: unexpected locked object:"); >> javaVFrame::print_locked_object_class_name(tty, obj, >> "locked"); >> + fatal(err_msg("exiting JavaThread=" INTPTR_FORMAT >> + " unexpectedly owns ObjectMonitor=" >> INTPTR_FORMAT, >> + THREAD, mid)); >> } >> (void)mid->complete_exit(CHECK); >> } >> } >> >> Dan >> >> >> On 7/8/15 3:33 PM, Daniel D. Daugherty wrote: >>> Greetings, >>> >>> I've updated this patch based on David H's comments along with >>> some additional cleanup. >>> >>> This work is being tracked by the following bug ID: >>> >>> JDK-8130448 8077392 inspired thread dump improvements, comment >>> additions, new diagnostics >>> https://bugs.openjdk.java.net/browse/JDK-8130448 >>> >>> Here is the webrev URL: >>> >>> http://cr.openjdk.java.net/~dcubed/8130448-webrev/1-jdk9-hs-rt/ >>> >>> The easiest way to review the delta is to download the two patch >>> files and compare them in something like jfilemerge: >>> >>> http://cr.openjdk.java.net/~dcubed/8130448-webrev/0-jdk9-hs-rt/hotspot.patch >>> >>> http://cr.openjdk.java.net/~dcubed/8130448-webrev/1-jdk9-hs-rt/hotspot.patch >>> >>> >>> Testing: >>> >>> - Aurora Adhoc RT/SVC nightly batches (in process) >>> - JPRT test jobs >>> >>> Thanks, in advance, for any comments, questions or suggestions. >>> >>> Gory details about the changes are below... >>> >>> Dan >>> >>> Changes between CR0 and CR1 are: >>> >>> src/cpu/x86/vm/macroAssembler_x86.cpp >>> >>> - fix comment typos, clarify comment wording >>> >>> src/share/vm/oops/markOop.cpp >>> >>> - clarify output messages >>> - get rid of confusing local variable >>> >>> src/share/vm/runtime/globals.hpp >>> >>> - drop VerboseStackTrace, GuaranteeOnMonitorMismatch >>> and JavaThreadExitReleasesMonitors options >>> - there are no longer changes to this file >>> >>> src/share/vm/runtime/objectMonitor.cpp >>> >>> - add ObjectMonitor::Knob_ExitRelease suboption to replace >>> JavaThreadExitReleasesMonitors >>> - add ObjectMonitor::Knob_VerifyMatch suboption to replace >>> GuaranteeOnMonitorMismatch >>> - cleanup messy logging: >>> - switch from '::printf()' -> 'tty->print_cr()' >>> - switch from '::fflush()' -> 'tty->flush()' >>> >>> src/share/vm/runtime/objectMonitor.hpp >>> >>> - add ObjectMonitor::Knob_ExitRelease suboption >>> - add ObjectMonitor::Knob_VerifyMatch suboption >>> - cleanup messy logging >>> >>> src/share/vm/runtime/synchronizer.cpp >>> >>> - cleanup messy logging >>> - switch from GuaranteeOnMonitorMismatch to >>> ObjectMonitor::Knob_VerifyMatch >>> - add diagnostic information about the locked object >>> when ReleaseJavaMonitorsClosure::do_monitor() finds >>> a problem >>> >>> src/share/vm/runtime/thread.cpp >>> >>> - clarify comments >>> - switch from JavaThreadExitReleasesMonitors to >>> ObjectMonitor::Knob_ExitRelease >>> >>> src/share/vm/runtime/vframe.cpp >>> >>> - print_locked_object_class_name() is now public >>> - clarify comments >>> - clarify output messages >>> - switch from VerboseStackTrace to the already existing >>> ObjectMonitor::Knob_Verbose >>> >>> src/share/vm/runtime/vframe.hpp >>> >>> - print_locked_object_class_name() is now public >>> >>> >>> On 7/3/15 6:14 PM, Daniel D. Daugherty wrote: >>>> Greetings, >>>> >>>> The hunt for the following bug: >>>> >>>> JDK-8077392 Stream fork/join tasks occasionally fail to complete >>>> >>>> and David C's work on the following bug: >>>> >>>> JDK-8069412 Locks need better debug-printing support >>>> >>>> have inspired additional thread dump improvements, comment additions >>>> to some Java monitor code and some new diagnostic options. >>>> >>>> This work is being tracked by the following bug ID: >>>> >>>> JDK-8130448 8077392 inspired thread dump improvements, comment >>>> additions, new diagnostics >>>> https://bugs.openjdk.java.net/browse/JDK-8130448 >>>> >>>> Here is the webrev URL: >>>> >>>> http://cr.openjdk.java.net/~dcubed/8130448-webrev/0-jdk9-hs-rt/ >>>> >>>> Testing: >>>> >>>> - RBT vm.quick batches (in process) >>>> - JPRT test jobs >>>> >>>> Thanks, in advance, for any comments, questions or suggestions. >>>> >>>> Gory details about the changes are below... >>>> >>>> Dan >>>> >>>> 8130448 summary of changes: >>>> >>>> src/cpu/x86/vm/macroAssembler_x86.cpp >>>> - comment additions for the assembly code >>>> >>>> src/share/vm/oops/markOop.cpp >>>> - has_monitor() has to be checked before is_locked() since >>>> the has_monitor() bits are a superset of the is_locked() bits >>>> - code style fixes >>>> >>>> src/share/vm/runtime/globals.hpp >>>> - add VerboseStackTrace diagnostic option >>>> - add GuaranteeOnMonitorMismatch diagnostic option >>>> - add JavaThreadExitReleasesMonitors product option; >>>> this is the Java equivalent of JNIDetachReleasesMonitors >>>> >>>> src/share/vm/runtime/objectMonitor.cpp >>>> - delete unused ObjectMonitor::try_enter() >>>> - fix assert wording >>>> >>>> src/share/vm/runtime/objectMonitor.hpp >>>> - delete unused ObjectMonitor::try_enter() >>>> >>>> src/share/vm/runtime/synchronizer.cpp >>>> - add GuaranteeOnMonitorMismatch support with some >>>> diagnostic output >>>> >>>> src/share/vm/runtime/thread.cpp >>>> - add JavaThreadExitReleasesMonitors support >>>> >>>> src/share/vm/runtime/vframe.cpp >>>> - clarify existing comments >>>> - add comments to clarify what "waiting on" means >>>> - add line to show when we are "waiting on", but >>>> there are no locals available (previously we were >>>> "waiting on" silently) >>>> - add support for "waiting to relock" which can happen >>>> for any of the monitors and not just the top monitor >>>> - switch mark->print_on() verbose output to new >>>> VerboseStackTrace switch; thread dumps are not enabled >>>> with a specific switch so the '-XX:+Verbose' model of >>>> being a modifier for another option does not fit >>>> >>>> >>> >>> >>> >> > From vladimir.kempik at oracle.com Tue Jul 14 15:51:34 2015 From: vladimir.kempik at oracle.com (Vladimir Kempik) Date: Tue, 14 Jul 2015 18:51:34 +0300 Subject: RFR: 8048353: jstack -l crashes VM when a Java mirror for a primitive type is locked Message-ID: <55A53006.1030307@oracle.com> Hello, Please review the patch to fix 8048353. Customer has an issue with this bug when running jstack on jdk7. He tested FVB and cofirmed it has fixed the issue. Before pushing jdk7 backport I need to get the fix to 9 and 8. Webrev: http://cr.openjdk.java.net/~vkempik/8048353/webrev.00/ JBS bug: https://bugs.openjdk.java.net/browse/JDK-8048353 testing: JPRT. Thanks, Vladimir. From daniel.daugherty at oracle.com Tue Jul 14 15:56:18 2015 From: daniel.daugherty at oracle.com (Daniel D. Daugherty) Date: Tue, 14 Jul 2015 09:56:18 -0600 Subject: RFR: 8048353: jstack -l crashes VM when a Java mirror for a primitive type is locked In-Reply-To: <55A53006.1030307@oracle.com> References: <55A53006.1030307@oracle.com> Message-ID: <55A53122.8000409@oracle.com> Adding serviceability-dev at ... since jstack belongs to the Serviceability team... The jstack and/or tmtools tests should also be run... Dan On 7/14/15 9:51 AM, Vladimir Kempik wrote: > Hello, > > Please review the patch to fix 8048353. > Customer has an issue with this bug when running jstack on jdk7. > He tested FVB and cofirmed it has fixed the issue. > Before pushing jdk7 backport I need to get the fix to 9 and 8. > > Webrev: http://cr.openjdk.java.net/~vkempik/8048353/webrev.00/ > JBS bug: https://bugs.openjdk.java.net/browse/JDK-8048353 > > testing: JPRT. > > Thanks, Vladimir. From tim.bell at oracle.com Tue Jul 14 16:19:50 2015 From: tim.bell at oracle.com (Tim Bell) Date: Tue, 14 Jul 2015 09:19:50 -0700 Subject: RFR(XXS) 8131128: fix merge error in jprt.properties In-Reply-To: <55A528BE.8020807@oracle.com> References: <55A528BE.8020807@oracle.com> Message-ID: <55A536A6.40407@oracle.com> Hi Dan: > I have a fix for the following bug: > > JDK-8131128 Merge error in jprt.properties leads to missing devkit > argument > https://bugs.openjdk.java.net/browse/JDK-8131128 > > I made a merge error on 2015.07.03 during my gatekeeping work for a > Main_Baseline -> RT_Baseline sync-down. Thanks for Mikael for finding > this issue. > > Webrev URL: > http://cr.openjdk.java.net/~dcubed/8131128-webrev/0-jdk9-hs-rt/ > > If you're interested in the whitespace changes that I made along > with adding the line break, you'll need to use the 'cdiffs' link. Looks good to me. That is a very tricky file to change. Tim From daniel.daugherty at oracle.com Tue Jul 14 16:21:22 2015 From: daniel.daugherty at oracle.com (Daniel D. Daugherty) Date: Tue, 14 Jul 2015 10:21:22 -0600 Subject: RFR: 8048353: jstack -l crashes VM when a Java mirror for a primitive type is locked In-Reply-To: <55A53122.8000409@oracle.com> References: <55A53006.1030307@oracle.com> <55A53122.8000409@oracle.com> Message-ID: <55A53702.6000309@oracle.com> > Webrev: http://cr.openjdk.java.net/~vkempik/8048353/webrev.00/ src/share/vm/classfile/javaClasses.cpp No comments. (Thanks for including the "" case.) src/share/vm/classfile/javaClasses.hpp No comments. src/share/vm/runtime/vframe.cpp No comments. Thumbs up (modulo running the proper tests). Dan On 7/14/15 9:56 AM, Daniel D. Daugherty wrote: > Adding serviceability-dev at ... since jstack belongs to the > Serviceability team... > > The jstack and/or tmtools tests should also be run... > > Dan > > > On 7/14/15 9:51 AM, Vladimir Kempik wrote: >> Hello, >> >> Please review the patch to fix 8048353. >> Customer has an issue with this bug when running jstack on jdk7. >> He tested FVB and cofirmed it has fixed the issue. >> Before pushing jdk7 backport I need to get the fix to 9 and 8. >> >> Webrev: http://cr.openjdk.java.net/~vkempik/8048353/webrev.00/ >> JBS bug: https://bugs.openjdk.java.net/browse/JDK-8048353 >> >> testing: JPRT. >> >> Thanks, Vladimir. > From daniel.daugherty at oracle.com Tue Jul 14 16:22:35 2015 From: daniel.daugherty at oracle.com (Daniel D. Daugherty) Date: Tue, 14 Jul 2015 10:22:35 -0600 Subject: RFR(XXS) 8131128: fix merge error in jprt.properties In-Reply-To: <55A536A6.40407@oracle.com> References: <55A528BE.8020807@oracle.com> <55A536A6.40407@oracle.com> Message-ID: <55A5374B.4020602@oracle.com> On 7/14/15 10:19 AM, Tim Bell wrote: > Hi Dan: > >> I have a fix for the following bug: >> >> JDK-8131128 Merge error in jprt.properties leads to missing >> devkit argument >> https://bugs.openjdk.java.net/browse/JDK-8131128 >> >> I made a merge error on 2015.07.03 during my gatekeeping work for a >> Main_Baseline -> RT_Baseline sync-down. Thanks for Mikael for finding >> this issue. >> >> Webrev URL: >> http://cr.openjdk.java.net/~dcubed/8131128-webrev/0-jdk9-hs-rt/ >> >> If you're interested in the whitespace changes that I made along >> with adding the line break, you'll need to use the 'cdiffs' link. > > Looks good to me. That is a very tricky file to change. Tim, Thanks for the fast review! Folks, I need (R)eviewer to take a look here. Dan > > Tim > From vladimir.kozlov at oracle.com Tue Jul 14 16:24:10 2015 From: vladimir.kozlov at oracle.com (Vladimir Kozlov) Date: Tue, 14 Jul 2015 09:24:10 -0700 Subject: RFR(XXS) 8131128: fix merge error in jprt.properties In-Reply-To: <55A5374B.4020602@oracle.com> References: <55A528BE.8020807@oracle.com> <55A536A6.40407@oracle.com> <55A5374B.4020602@oracle.com> Message-ID: <55A537AA.3040008@oracle.com> Good. Thanks, Vladimir On 7/14/15 9:22 AM, Daniel D. Daugherty wrote: > On 7/14/15 10:19 AM, Tim Bell wrote: >> Hi Dan: >> >>> I have a fix for the following bug: >>> >>> JDK-8131128 Merge error in jprt.properties leads to missing devkit argument >>> https://bugs.openjdk.java.net/browse/JDK-8131128 >>> >>> I made a merge error on 2015.07.03 during my gatekeeping work for a >>> Main_Baseline -> RT_Baseline sync-down. Thanks for Mikael for finding >>> this issue. >>> >>> Webrev URL: http://cr.openjdk.java.net/~dcubed/8131128-webrev/0-jdk9-hs-rt/ >>> >>> If you're interested in the whitespace changes that I made along >>> with adding the line break, you'll need to use the 'cdiffs' link. >> >> Looks good to me. That is a very tricky file to change. > > Tim, > > Thanks for the fast review! > > Folks, I need (R)eviewer to take a look here. > > Dan > > >> >> Tim >> > From daniel.daugherty at oracle.com Tue Jul 14 16:26:33 2015 From: daniel.daugherty at oracle.com (Daniel D. Daugherty) Date: Tue, 14 Jul 2015 10:26:33 -0600 Subject: RFR(XXS) 8131128: fix merge error in jprt.properties In-Reply-To: <55A537AA.3040008@oracle.com> References: <55A528BE.8020807@oracle.com> <55A536A6.40407@oracle.com> <55A5374B.4020602@oracle.com> <55A537AA.3040008@oracle.com> Message-ID: <55A53839.9090300@oracle.com> Vladimir, Thanks for the fast review! Folks, I believe we are now covered for reviews. Dan On 7/14/15 10:24 AM, Vladimir Kozlov wrote: > Good. > > Thanks, > Vladimir > > On 7/14/15 9:22 AM, Daniel D. Daugherty wrote: >> On 7/14/15 10:19 AM, Tim Bell wrote: >>> Hi Dan: >>> >>>> I have a fix for the following bug: >>>> >>>> JDK-8131128 Merge error in jprt.properties leads to missing >>>> devkit argument >>>> https://bugs.openjdk.java.net/browse/JDK-8131128 >>>> >>>> I made a merge error on 2015.07.03 during my gatekeeping work for a >>>> Main_Baseline -> RT_Baseline sync-down. Thanks for Mikael for finding >>>> this issue. >>>> >>>> Webrev URL: >>>> http://cr.openjdk.java.net/~dcubed/8131128-webrev/0-jdk9-hs-rt/ >>>> >>>> If you're interested in the whitespace changes that I made along >>>> with adding the line break, you'll need to use the 'cdiffs' link. >>> >>> Looks good to me. That is a very tricky file to change. >> >> Tim, >> >> Thanks for the fast review! >> >> Folks, I need (R)eviewer to take a look here. >> >> Dan >> >> >>> >>> Tim >>> >> From coleen.phillimore at oracle.com Tue Jul 14 17:28:52 2015 From: coleen.phillimore at oracle.com (Coleen Phillimore) Date: Tue, 14 Jul 2015 13:28:52 -0400 Subject: RFR: 8048353: jstack -l crashes VM when a Java mirror for a primitive type is locked In-Reply-To: <55A53006.1030307@oracle.com> References: <55A53006.1030307@oracle.com> Message-ID: <55A546D4.2090600@oracle.com> This looks good to me. Thank you for fixing it. Coleen On 7/14/15 11:51 AM, Vladimir Kempik wrote: > Hello, > > Please review the patch to fix 8048353. > Customer has an issue with this bug when running jstack on jdk7. > He tested FVB and cofirmed it has fixed the issue. > Before pushing jdk7 backport I need to get the fix to 9 and 8. > > Webrev: http://cr.openjdk.java.net/~vkempik/8048353/webrev.00/ > JBS bug: https://bugs.openjdk.java.net/browse/JDK-8048353 > > testing: JPRT. > > Thanks, Vladimir. From daniel.daugherty at oracle.com Tue Jul 14 17:32:14 2015 From: daniel.daugherty at oracle.com (Daniel D. Daugherty) Date: Tue, 14 Jul 2015 11:32:14 -0600 Subject: RFR: 8048353: jstack -l crashes VM when a Java mirror for a primitive type is locked In-Reply-To: <55A546D4.2090600@oracle.com> References: <55A53006.1030307@oracle.com> <55A546D4.2090600@oracle.com> Message-ID: <55A5479E.1010407@oracle.com> Adding in serviceability-dev at ... so that both aliases see that we now have two (R)eviews. Dan On 7/14/15 11:28 AM, Coleen Phillimore wrote: > > This looks good to me. Thank you for fixing it. > Coleen > > On 7/14/15 11:51 AM, Vladimir Kempik wrote: >> Hello, >> >> Please review the patch to fix 8048353. >> Customer has an issue with this bug when running jstack on jdk7. >> He tested FVB and cofirmed it has fixed the issue. >> Before pushing jdk7 backport I need to get the fix to 9 and 8. >> >> Webrev: http://cr.openjdk.java.net/~vkempik/8048353/webrev.00/ >> JBS bug: https://bugs.openjdk.java.net/browse/JDK-8048353 >> >> testing: JPRT. >> >> Thanks, Vladimir. > From coleen.phillimore at oracle.com Tue Jul 14 19:46:27 2015 From: coleen.phillimore at oracle.com (Coleen Phillimore) Date: Tue, 14 Jul 2015 15:46:27 -0400 Subject: RFR: 8079301: Some command line options not settable via JAVA_TOOL_OPTIONS In-Reply-To: <55A2794E.20502@oracle.com> References: <554839B4.3020800@oracle.com> <559D237C.2060702@oracle.com> <559EED17.4060109@oracle.com> <559FAE4B.5060505@oracle.com> <559FBFFB.3060206@oracle.com> <55A01184.7080102@oracle.com> <55A0361B.2060307@oracle.com> <55A2794E.20502@oracle.com> Message-ID: <55A56713.8090308@oracle.com> On 7/12/15 10:27 AM, Dmitry Dmitriev wrote: > Hello Coleen, > > I think that adding destructor not help with this, since all this code > with free_memory_for_vm_init_args is a special workaround for > processing options in env variables and not applied to the options > from command line which passed in 'args' to the Arguments::parse > function. I see - JavaVMInitArgs is a C struct in jni.h If you wrap JavaVMInitArgs for the options for environment variables in a scoped object that calls the destructor to clean up JavaVMInitArgs, this would eliminate all these extra calls that you have to make to free_memory_for_vm_init_args: class EnvInitArgs : public StackObj { JavaVMInitArgs _args; public: ~EnvInitArgs() { // Code to conditionally delete option memory that you have in free_memory_for_vm_init_args } JavaVMInitArgs* init_args() const { return &_args; } } You can put this in the constructor: + vm_args->version = JNI_VERSION_1_2; + vm_args->options = NULL; + vm_args->nOptions = 0; + vm_args->ignoreUnrecognized = false; I think this would be neater than having to check for JNI_OK and call free everywhere. Coleen > > About match_special_option_and_act. Probably it can be processed in > the following way(raw idea): > code = match_special_option_and_act(&java_tool_options_args, > &flags_file); > if (code == JNI_OK) { > // call next > code = match_special_option_and_act(args, &flags_file); > } > > if (code == JNI_OK) { > // call next > code = match_special_option_and_act(&java_options_args, &flags_file); > } > > if (code != JNI_OK) { > free_memory_for_vm_init_args(&java_tool_options_args); > free_memory_for_vm_init_args(&java_options_args); > return code; > } > > Thanks, > Dmitry > > On 11.07.2015 0:16, Coleen Phillimore wrote: >> >> Hi, I have a couple of suggestions. >> >> Can you add a destructor to JavaVMInitArgs which will delete the >> options things if they exist? Then you won't need these >> free_memory_for_vm_init_args functions. I think this would work. >> >> Secondly, I was also going to comment about >> match_special_option_and_act not using it's return value. The >> destructor code would make this less cumbersome. I like the >> refactoring though. >> >> Thanks, >> Coleen >> >> On 7/10/15 2:40 PM, Dmitry Dmitriev wrote: >>> Jeremy, thank you for fixing that! Please, see my comments inline >>> for 2 item and one more comment. >>> >>> On 10.07.2015 20:15, Jeremy Manson wrote: >>>> Thanks for the detailed look, Dmitry. I have taken your advice, >>>> with a couple of exceptions: >>>> >>>> 1) I named the method free_memory_for_vm_init_args instead of >>>> free_memory_for_environment_variables. >>>> 2) I did not free the memory in 3661-3663 or in 3679-3681, because >>>> those are error paths where the memory may not have been allocated >>>> in the first place. So freeing it might lead to a crash. >>> Yes, you are right. But I think we can guard from this by adding >>> check for args->options in new free_memory_for_vm_init_args function >>> and free memory in all execution paths. If args->options is not >>> NULL, then memory is allocated and must be freed: >>> >>> 3485 static void free_memory_for_vm_init_args(JavaVMInitArgs* args) { >>> 3486 if( args->options != NULL ) { >>> 3487 for (int i = 0; i < args->nOptions; i++) { >>> 3488 os::free(args->options[i].optionString); >>> 3489 } >>> 3490 FREE_C_HEAP_ARRAY(JavaVMOption, args->options); >>> 3491 } >>> 3492 } >>> >>> As I see you add free memory for error paths at lines(webrev.04) >>> 3668-3671 and 3687-3691. Thus, with that guard you can add two calls >>> to free_memory_for_vm_init_args function before "return JNI_EINVAL;" >>> on line 3696: >>> >>> 3693 #ifdef ASSERT >>> 3694 // Parse default .hotspotrc settings file >>> 3695 if (!process_settings_file(".hotspotrc", false, >>> args->ignoreUnrecognized)) { >>> 3696 return JNI_EINVAL; >>> 3697 } >>> 3698 #else >>> >>> >>> And one more comment. Unfortunately I oversight this before... You >>> not check return value from 'match_special_option_and_act' new >>> function on lines 3673-3675, but in one case it can return >>> error(JNI_ERR) when "-XX:NativeMemoryTracking" is specified and >>> INCLUDE_NMT is not defined. Thus, I think that check for return >>> value should be added(with freeing memory for env variables in case >>> of error). >>> >>> Thank you, >>> Dmitry >>> >>>> >>>> New Rev: >>>> >>>> http://cr.openjdk.java.net/~jmanson/8079301/webrev.04/ >>>> >>>> >>>> Jeremy >>>> >>>> On Fri, Jul 10, 2015 at 5:52 AM, Dmitry Dmitriev >>>> > >>>> wrote: >>>> >>>> Jeremy, >>>> >>>> Two additional comments which I didn't catch earlier... >>>> >>>> 1) Order of processing command line options is >>>> following(Arguments::parse_vm_init_args function): options from >>>> JAVA_TOOL_OPTIONS environment variable, then options from command >>>> line and then options from _JAVA_OPTIONS environment variable. And >>>> last argument wins! >>>> >>>> You not change this order in Arguments::parse_vm_init_args >>>> function, but it seems that order in several other places is >>>> changed. >>>> >>>> Lines 3665-3667: >>>> >>>> 3665 match_special_option_and_act(args, &flags_file); >>>> 3666 match_special_option_and_act(&java_tool_options_args, >>>> &flags_file); >>>> 3667 match_special_option_and_act(&java_options_args, >>>> &flags_file); >>>> >>>> Here we see that order is following: options from command line, >>>> then options from JAVA_TOOL_OPTIONS environment variable and then >>>> options from _JAVA_OPTIONS environment variable. Thus, in this >>>> case "-XX:+IgnoreUnrecognizedVMOptions" option in >>>> JAVA_TOOL_OPTIONS environment variable will have bigger priority >>>> than in command line(last argument wins), but this is differ from >>>> processing options in Arguments::parse_vm_init_args function. >>>> Thus, I think that you need to swap 3665 and 3666 lines: >>>> >>>> 3665 match_special_option_and_act(&java_tool_options_args, >>>> &flags_file); >>>> 3666 match_special_option_and_act(args, &flags_file); >>>> 3667 match_special_option_and_act(&java_options_args, >>>> &flags_file); >>>> >>>> Similar situation on lines 3696-3700: >>>> >>>> 3696 if (PrintVMOptions) { >>>> 3697 print_options(args); >>>> 3698 print_options(&java_tool_options_args); >>>> 3699 print_options(&java_options_args); >>>> 3700 } >>>> >>>> Command line options are printed before options from >>>> JAVA_TOOL_OPTIONS environment variable. Thus, I think that you >>>> need to swap 3697 and 3698 lines: >>>> >>>> 3696 if (PrintVMOptions) { >>>> 3697 print_options(&java_tool_options_args); >>>> 3698 print_options(args); >>>> 3699 print_options(&java_options_args); >>>> 3700 } >>>> >>>> >>>> 2) One more thing about error processing :) >>>> I think it will be great to free allocated memory for environment >>>> variables when error occured on lines 3661-3663, 3679-3681 and >>>> 3685-3687. >>>> My suggestion is to add some static function which free memory for >>>> env variables, something like that: >>>> static void free_memory_for_environment_variables( JavaVMInitArgs >>>> *options_args ) { >>>> for (int i = 0; i < options_args->nOptions; i++) { >>>> os::free(options_args->options[i].optionString); >>>> } >>>> FREE_C_HEAP_ARRAY(JavaVMOption, options_args->options); >>>> } >>>> >>>> And change lines 3661-3663 to following: >>>> >>>> 3661 if (code != JNI_OK) { >>>> 3662 >>>> free_memory_for_environment_variables(&java_tool_options_args); >>>> 3663 return code; >>>> 3664 } >>>> >>>> Lines 3679-3681 to following: >>>> >>>> 3679 if (!process_settings_file(flags_file, true, >>>> args->ignoreUnrecognized)) { >>>> 3680 >>>> free_memory_for_environment_variables(&java_tool_options_args); >>>> 3681 free_memory_for_environment_variables(&java_options_args); >>>> 3682 return JNI_EINVAL; >>>> 3683 } >>>> >>>> Lines 3685-3687 to following: >>>> >>>> 3685 if (!process_settings_file(".hotspotrc", false, >>>> args->ignoreUnrecognized)) { >>>> 3680 >>>> free_memory_for_environment_variables(&java_tool_options_args); >>>> 3681 free_memory_for_environment_variables(&java_options_args); >>>> 3686 return JNI_EINVAL; >>>> 3687 } >>>> >>>> And lines 3706-3715 to following: >>>> >>>> 3706 // Done with the envvars >>>> 3707 >>>> free_memory_for_environment_variables(&java_tool_options_args); >>>> 3708 free_memory_for_environment_variables(&java_options_args); >>>> >>>> >>>> Thank you, >>>> Dmitry >>>> >>>> >>>> On 10.07.2015 14:36, Dmitry Dmitriev wrote: >>>> >>>> Hello Jeremy, >>>> >>>> Thank you for fixing that! But in this case we still have >>>> minor issue when quotes processing failed(lines 3438-3444). >>>> Here is my suggestion: leave 'while' cycle(lines 3423-3462) as >>>> I was in your previous webrev(without 'start' and etc.) and >>>> call strdup when copy 'options' to 'options_arr' on lines >>>> 3472-3474, i.e. make lines 3472-3474 like this: >>>> >>>> 3472 for (int i = 0; i < options->length(); i++) { >>>> 3473 options_arr[i] = options->at(i); >>>> 3474 options_arr[i].optionString = >>>> os::strdup(options_arr[i].optionString); >>>> 3475 } >>>> >>>> What you think about that? >>>> >>>> Regards, >>>> Dmitry >>>> >>>> On 10.07.2015 3:23, Jeremy Manson wrote: >>>> >>>> Hey Dmitry, >>>> >>>> Thanks for looking at it. The leak was deliberate (under >>>> the theory that the command line flags were leaked, too), >>>> but it was silly that I didn't fix it. >>>> >>>> Anyway, fixed. See: >>>> >>>> http://cr.openjdk.java.net/~jmanson/8079301/webrev.03 >>>> >>>> >>>> >>>> Jeremy >>>> >>>> On Thu, Jul 9, 2015 at 2:52 PM, Dmitry Dmitriev >>>> >>> >>>> >>> >> wrote: >>>> >>>> Hello Jeremy, >>>> >>>> Correct me if I am wrong, but I see small memory leak >>>> in your >>>> implementation. >>>> In Arguments::parse_options_environment_variable >>>> function memory >>>> for 'buffer' allocated by strdup function on line >>>> 3415, but now it >>>> not freed in this function because data from this >>>> buffer is used >>>> later. On the other hand when we are done with env >>>> variables, we >>>> free only options array(lines 3703-3705) and not free >>>> previously >>>> allocated memory for 'buffer' because we lost track >>>> for it. >>>> >>>> Thanks, >>>> Dmitry >>>> >>>> >>>> On 09.07.2015 21:20, Jeremy Manson wrote: >>>> >>>> Thanks for looking at this, Coleen. >>>> >>>> I merged this with the latest version of hs-rt, >>>> but Ron is or >>>> I am going to >>>> have to do some merging for 8061999. The changes >>>> are relatively >>>> orthogonal, but they touch a couple of the same >>>> places. How >>>> far away is >>>> Ron's checkin? >>>> >>>> Updated webrev: >>>> >>>> http://cr.openjdk.java.net/~jmanson/8079301/webrev.01/ >>>> >>>> >>>> >>>> Updated test: >>>> >>>> http://cr.openjdk.java.net/~jmanson/8079301t/webrev.01/ >>>> >>>> >>>> >>>> (Mild complaining on my part: the conflicts >>>> wouldn't have been >>>> an issue if >>>> someone had looked at this two months ago, when I >>>> first >>>> asked. I suspect >>>> Ron hadn't even started his change at that >>>> point. And if external >>>> developers were able to submit changes to Hotspot, >>>> we wouldn't >>>> have had to >>>> bother Oracle engineers at all. Neither of these >>>> is your >>>> fault or your >>>> problem, of course - I'm grateful you were able to >>>> take a look.) >>>> >>>> Jeremy >>>> >>>> On Wed, Jul 8, 2015 at 6:19 AM, Coleen >>>> Phillimore < >>>> coleen.phillimore at oracle.com >>>> >>>> >>> >> wrote: >>>> >>>> I'll sponsor it but can you repost the RFR? >>>> >>>> There has been a fair bit of work to >>>> command line >>>> processing lately so I'd >>>> like to have the others look at it too. Have >>>> you merged >>>> this up with the >>>> latest version of hs-rt repository and were >>>> there >>>> conflicts? Also, have >>>> you looked at the RFR: >>>> >>>> "Open code review for 8061999 Enhance VM >>>> option parsing to >>>> allow options >>>> to be specified" >>>> >>>> and are there conflicts with this? >>>> >>>> The hotspot change looks good to me. >>>> >>>> >>>> http://cr.openjdk.java.net/~jmanson/8079301t/webrev.00/test/com/sun/management/HotSpotDiagnosticMXBean/CheckOrigin.java.udiff.html >>>> >>>> >>>> >>>> >>>> >>>> >>>> "UseCerealGC" LOL >>>> Can you use a different option than >>>> PrintOopAddress in >>>> this test? I don't >>>> know why this command line option exists or >>>> would be >>>> useful for, and seems >>>> to be a good candidate for removal. If you >>>> need a valid >>>> argument, that is >>>> unlikely to go away, TraceExceptions would be >>>> good. >>>> >>>> Thanks, >>>> Coleen >>>> >>>> >>>> On 7/7/15 8:00 PM, Jeremy Manson wrote: >>>> >>>> No love? Is there a code owner here I >>>> should pester >>>> more directly? >>>> >>>> Jeremy >>>> >>>> On Fri, Jun 26, 2015 at 3:00 PM, Martin >>>> Buchholz >>>> >>> >>> >> >>>> wrote: >>>> >>>> As usual with Google patches, they are >>>> in use >>>> locally. This one has been >>>> >>>> stable for a while without complaints. >>>> Please >>>> sponsor. >>>> >>>> On Fri, Jun 26, 2015 at 1:53 PM, >>>> Jeremy Manson >>>> >>> >>>> >>> >> >>>> wrote: >>>> >>>> All this talk about >>>> IgnoreUnrecognizedVMOptions >>>> reminded me that this >>>> >>>> review is still outstanding. Any >>>> takers? >>>> >>>> Jeremy >>>> >>>> On Tue, May 5, 2015 at 10:01 AM, >>>> Jeremy Manson >>>> >>> >>>> >>> > >>>> wrote: >>>> >>>> Hi David, >>>> >>>> Thanks for taking a look. >>>> >>>> On Mon, May 4, 2015 at 8:32 >>>> PM, David >>>> Holmes >>>> >>>> >>> >> >>>> >>>> wrote: >>>> >>>> Hi Jeremy, >>>> >>>> On 5/05/2015 6:51 AM, >>>> Jeremy Manson wrote: >>>> >>>> Not sure who might be >>>> willing to >>>> sponsor this. David? You >>>> did the >>>> >>>> last >>>> one. :) >>>> >>>> Might be a while >>>> before I can >>>> get to it. I did have >>>> a quick look >>>> >>>> (and >>>> will need a longer one). >>>> >>>> I understand. I'm just >>>> happy it's >>>> possible to upstream this >>>> stuff at >>>> all[1]. >>>> >>>> [1] With the eternal caveat >>>> that I'd be >>>> happier if we didn't *have* to >>>> go through you folks, but >>>> we've learned to >>>> live with it. >>>> >>>> >>>> >>>> Context: A number of >>>> command line >>>> options are not settable via >>>> >>>> JAVA_TOOL_OPTIONS and _JAVA_OPTIONS: >>>> >>>> - PrintVMOptions >>>> >>>> So you have >>>> changed the >>>> semantics of this to >>>> print out the >>>> options >>>> >>>> from >>>> the command-line and each >>>> of the two >>>> env vars. Seems >>>> reasonable but >>>> may be >>>> better to know which >>>> option came from >>>> where as we can now see >>>> the same >>>> option (or conflicting >>>> variants >>>> thereof) multiple times. >>>> >>>> I'd be happy to do >>>> this. Any >>>> preferred syntax? Does >>>> someone >>>> >>>> actually >>>> own this feature? >>>> >>>> I'm unclear what the current >>>> processing >>>> order is for the different >>>> >>>> sources of options, and >>>> whether the >>>> changes affect that order? >>>> >>>> Nope. I go through sad >>>> contortions >>>> to keep the processing >>>> order the >>>> >>>> same. It's JAVA_TOOL_OPTIONS, >>>> then >>>> command line, then >>>> _JAVA_OPTIONS. >>>> See >>>> lines 2549-2567. >>>> >>>> >>>> - >>>> IgnoreUnrecognizedVMOptions >>>> >>>> - >>>> PrintFlagsInitial >>>> >>>> Unclear what >>>> "initial" actually >>>> means - is it the >>>> default? >>>> >>>> More or less. If you stick, >>>> for example, >>>> IgnoreUnrecognizedVMOptions >>>> in >>>> there first, it will get >>>> printed out as >>>> "true". I haven't really >>>> changed >>>> the semantics here either - >>>> I've just >>>> added processing of the >>>> envvars. >>>> >>>> - NativeMemoryTracking >>>> >>>> - >>>> PrintFlagsWithComments >>>> >>>> This is because these >>>> flags have >>>> to be processed before >>>> processing >>>> other >>>> flags, and no one ever >>>> bothered to >>>> do that for the flags >>>> coming from >>>> environment >>>> variables. This patch >>>> fixes that problem. >>>> >>>> I have a test, but >>>> it is a >>>> modification to a JDK >>>> test instead >>>> of a HS >>>> test, >>>> so it can go in >>>> separately (I guess). >>>> >>>> They can be pushed >>>> together to >>>> different repos in the >>>> same forest. >>>> >>>> Okay. Here's the test >>>> change: >>>> >>>> http://cr.openjdk.java.net/~jmanson/8079301t/webrev.00/ >>>> >>>> >>>> >>>> >>>> As I said I'll have to get >>>> back to this. >>>> And hopefully someone else in >>>> >>>> runtime will take a good >>>> look as well ;-) >>>> >>>> I'd be happy to toss it >>>> over to >>>> whomever owns this, if >>>> anyone. >>>> >>>> Thanks! >>>> >>>> Jeremy >>>> >>>> >>>> >>>> Bug: >>>> >>>> https://bugs.openjdk.java.net/browse/JDK-8079301 >>>> >>>> Webrev: >>>> http://cr.openjdk.java.net/~jmanson/8079301/webrev.00/ >>>> >>>> >>>> >>>> Jeremy >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>> >> > From dmitry.dmitriev at oracle.com Tue Jul 14 20:26:05 2015 From: dmitry.dmitriev at oracle.com (Dmitry Dmitriev) Date: Tue, 14 Jul 2015 23:26:05 +0300 Subject: RFR: 8079301: Some command line options not settable via JAVA_TOOL_OPTIONS In-Reply-To: <55A56713.8090308@oracle.com> References: <554839B4.3020800@oracle.com> <559D237C.2060702@oracle.com> <559EED17.4060109@oracle.com> <559FAE4B.5060505@oracle.com> <559FBFFB.3060206@oracle.com> <55A01184.7080102@oracle.com> <55A0361B.2060307@oracle.com> <55A2794E.20502@oracle.com> <55A56713.8090308@oracle.com> Message-ID: <55A5705D.9080500@oracle.com> Hello Coleen, Yes, I like your approach. It seems more accurate. Thus, desctructor can be something like that: ~EnvInitArgs() { if( _args.options != NULL ) { for (int i = 0; i < _args.nOptions; i++) { os::free(_args.options[i].optionString); } FREE_C_HEAP_ARRAY(JavaVMOption, _args.options); } } Jeremy, what you think about that? Thank you, Dmitry On 14.07.2015 22:46, Coleen Phillimore wrote: > > > On 7/12/15 10:27 AM, Dmitry Dmitriev wrote: >> Hello Coleen, >> >> I think that adding destructor not help with this, since all this >> code with free_memory_for_vm_init_args is a special workaround for >> processing options in env variables and not applied to the options >> from command line which passed in 'args' to the Arguments::parse >> function. > > I see - JavaVMInitArgs is a C struct in jni.h > > If you wrap JavaVMInitArgs for the options for environment variables > in a scoped object that calls the destructor to clean up > JavaVMInitArgs, this would eliminate all these extra calls that you > have to make to free_memory_for_vm_init_args: > > class EnvInitArgs : public StackObj { > JavaVMInitArgs _args; > public: > ~EnvInitArgs() { > // Code to conditionally delete option memory that you have in > free_memory_for_vm_init_args > } > JavaVMInitArgs* init_args() const { return &_args; } > } > > You can put this in the constructor: > > + vm_args->version = JNI_VERSION_1_2; > + vm_args->options = NULL; > + vm_args->nOptions = 0; > + vm_args->ignoreUnrecognized = false; > I think this would be neater than having to check for JNI_OK and call > free everywhere. > > Coleen > >> >> About match_special_option_and_act. Probably it can be processed in >> the following way(raw idea): >> code = match_special_option_and_act(&java_tool_options_args, >> &flags_file); >> if (code == JNI_OK) { >> // call next >> code = match_special_option_and_act(args, &flags_file); >> } >> >> if (code == JNI_OK) { >> // call next >> code = match_special_option_and_act(&java_options_args, &flags_file); >> } >> >> if (code != JNI_OK) { >> free_memory_for_vm_init_args(&java_tool_options_args); >> free_memory_for_vm_init_args(&java_options_args); >> return code; >> } >> >> Thanks, >> Dmitry >> >> On 11.07.2015 0:16, Coleen Phillimore wrote: >>> >>> Hi, I have a couple of suggestions. >>> >>> Can you add a destructor to JavaVMInitArgs which will delete the >>> options things if they exist? Then you won't need these >>> free_memory_for_vm_init_args functions. I think this would work. >>> >>> Secondly, I was also going to comment about >>> match_special_option_and_act not using it's return value. The >>> destructor code would make this less cumbersome. I like the >>> refactoring though. >>> >>> Thanks, >>> Coleen >>> >>> On 7/10/15 2:40 PM, Dmitry Dmitriev wrote: >>>> Jeremy, thank you for fixing that! Please, see my comments inline >>>> for 2 item and one more comment. >>>> >>>> On 10.07.2015 20:15, Jeremy Manson wrote: >>>>> Thanks for the detailed look, Dmitry. I have taken your advice, >>>>> with a couple of exceptions: >>>>> >>>>> 1) I named the method free_memory_for_vm_init_args instead of >>>>> free_memory_for_environment_variables. >>>>> 2) I did not free the memory in 3661-3663 or in 3679-3681, because >>>>> those are error paths where the memory may not have been allocated >>>>> in the first place. So freeing it might lead to a crash. >>>> Yes, you are right. But I think we can guard from this by adding >>>> check for args->options in new free_memory_for_vm_init_args >>>> function and free memory in all execution paths. If args->options >>>> is not NULL, then memory is allocated and must be freed: >>>> >>>> 3485 static void free_memory_for_vm_init_args(JavaVMInitArgs* args) { >>>> 3486 if( args->options != NULL ) { >>>> 3487 for (int i = 0; i < args->nOptions; i++) { >>>> 3488 os::free(args->options[i].optionString); >>>> 3489 } >>>> 3490 FREE_C_HEAP_ARRAY(JavaVMOption, args->options); >>>> 3491 } >>>> 3492 } >>>> >>>> As I see you add free memory for error paths at lines(webrev.04) >>>> 3668-3671 and 3687-3691. Thus, with that guard you can add two >>>> calls to free_memory_for_vm_init_args function before "return >>>> JNI_EINVAL;" on line 3696: >>>> >>>> 3693 #ifdef ASSERT >>>> 3694 // Parse default .hotspotrc settings file >>>> 3695 if (!process_settings_file(".hotspotrc", false, >>>> args->ignoreUnrecognized)) { >>>> 3696 return JNI_EINVAL; >>>> 3697 } >>>> 3698 #else >>>> >>>> >>>> And one more comment. Unfortunately I oversight this before... You >>>> not check return value from 'match_special_option_and_act' new >>>> function on lines 3673-3675, but in one case it can return >>>> error(JNI_ERR) when "-XX:NativeMemoryTracking" is specified and >>>> INCLUDE_NMT is not defined. Thus, I think that check for return >>>> value should be added(with freeing memory for env variables in case >>>> of error). >>>> >>>> Thank you, >>>> Dmitry >>>> >>>>> >>>>> New Rev: >>>>> >>>>> http://cr.openjdk.java.net/~jmanson/8079301/webrev.04/ >>>>> >>>>> >>>>> Jeremy >>>>> >>>>> On Fri, Jul 10, 2015 at 5:52 AM, Dmitry Dmitriev >>>>> > >>>>> wrote: >>>>> >>>>> Jeremy, >>>>> >>>>> Two additional comments which I didn't catch earlier... >>>>> >>>>> 1) Order of processing command line options is >>>>> following(Arguments::parse_vm_init_args function): options from >>>>> JAVA_TOOL_OPTIONS environment variable, then options from command >>>>> line and then options from _JAVA_OPTIONS environment variable. >>>>> And >>>>> last argument wins! >>>>> >>>>> You not change this order in Arguments::parse_vm_init_args >>>>> function, but it seems that order in several other places is >>>>> changed. >>>>> >>>>> Lines 3665-3667: >>>>> >>>>> 3665 match_special_option_and_act(args, &flags_file); >>>>> 3666 match_special_option_and_act(&java_tool_options_args, >>>>> &flags_file); >>>>> 3667 match_special_option_and_act(&java_options_args, >>>>> &flags_file); >>>>> >>>>> Here we see that order is following: options from command line, >>>>> then options from JAVA_TOOL_OPTIONS environment variable and then >>>>> options from _JAVA_OPTIONS environment variable. Thus, in this >>>>> case "-XX:+IgnoreUnrecognizedVMOptions" option in >>>>> JAVA_TOOL_OPTIONS environment variable will have bigger priority >>>>> than in command line(last argument wins), but this is differ from >>>>> processing options in Arguments::parse_vm_init_args function. >>>>> Thus, I think that you need to swap 3665 and 3666 lines: >>>>> >>>>> 3665 match_special_option_and_act(&java_tool_options_args, >>>>> &flags_file); >>>>> 3666 match_special_option_and_act(args, &flags_file); >>>>> 3667 match_special_option_and_act(&java_options_args, >>>>> &flags_file); >>>>> >>>>> Similar situation on lines 3696-3700: >>>>> >>>>> 3696 if (PrintVMOptions) { >>>>> 3697 print_options(args); >>>>> 3698 print_options(&java_tool_options_args); >>>>> 3699 print_options(&java_options_args); >>>>> 3700 } >>>>> >>>>> Command line options are printed before options from >>>>> JAVA_TOOL_OPTIONS environment variable. Thus, I think that you >>>>> need to swap 3697 and 3698 lines: >>>>> >>>>> 3696 if (PrintVMOptions) { >>>>> 3697 print_options(&java_tool_options_args); >>>>> 3698 print_options(args); >>>>> 3699 print_options(&java_options_args); >>>>> 3700 } >>>>> >>>>> >>>>> 2) One more thing about error processing :) >>>>> I think it will be great to free allocated memory for environment >>>>> variables when error occured on lines 3661-3663, 3679-3681 and >>>>> 3685-3687. >>>>> My suggestion is to add some static function which free memory >>>>> for >>>>> env variables, something like that: >>>>> static void free_memory_for_environment_variables( JavaVMInitArgs >>>>> *options_args ) { >>>>> for (int i = 0; i < options_args->nOptions; i++) { >>>>> os::free(options_args->options[i].optionString); >>>>> } >>>>> FREE_C_HEAP_ARRAY(JavaVMOption, options_args->options); >>>>> } >>>>> >>>>> And change lines 3661-3663 to following: >>>>> >>>>> 3661 if (code != JNI_OK) { >>>>> 3662 >>>>> free_memory_for_environment_variables(&java_tool_options_args); >>>>> 3663 return code; >>>>> 3664 } >>>>> >>>>> Lines 3679-3681 to following: >>>>> >>>>> 3679 if (!process_settings_file(flags_file, true, >>>>> args->ignoreUnrecognized)) { >>>>> 3680 >>>>> free_memory_for_environment_variables(&java_tool_options_args); >>>>> 3681 free_memory_for_environment_variables(&java_options_args); >>>>> 3682 return JNI_EINVAL; >>>>> 3683 } >>>>> >>>>> Lines 3685-3687 to following: >>>>> >>>>> 3685 if (!process_settings_file(".hotspotrc", false, >>>>> args->ignoreUnrecognized)) { >>>>> 3680 >>>>> free_memory_for_environment_variables(&java_tool_options_args); >>>>> 3681 free_memory_for_environment_variables(&java_options_args); >>>>> 3686 return JNI_EINVAL; >>>>> 3687 } >>>>> >>>>> And lines 3706-3715 to following: >>>>> >>>>> 3706 // Done with the envvars >>>>> 3707 >>>>> free_memory_for_environment_variables(&java_tool_options_args); >>>>> 3708 free_memory_for_environment_variables(&java_options_args); >>>>> >>>>> >>>>> Thank you, >>>>> Dmitry >>>>> >>>>> >>>>> On 10.07.2015 14:36, Dmitry Dmitriev wrote: >>>>> >>>>> Hello Jeremy, >>>>> >>>>> Thank you for fixing that! But in this case we still have >>>>> minor issue when quotes processing failed(lines 3438-3444). >>>>> Here is my suggestion: leave 'while' cycle(lines >>>>> 3423-3462) as >>>>> I was in your previous webrev(without 'start' and etc.) and >>>>> call strdup when copy 'options' to 'options_arr' on lines >>>>> 3472-3474, i.e. make lines 3472-3474 like this: >>>>> >>>>> 3472 for (int i = 0; i < options->length(); i++) { >>>>> 3473 options_arr[i] = options->at(i); >>>>> 3474 options_arr[i].optionString = >>>>> os::strdup(options_arr[i].optionString); >>>>> 3475 } >>>>> >>>>> What you think about that? >>>>> >>>>> Regards, >>>>> Dmitry >>>>> >>>>> On 10.07.2015 3:23, Jeremy Manson wrote: >>>>> >>>>> Hey Dmitry, >>>>> >>>>> Thanks for looking at it. The leak was deliberate (under >>>>> the theory that the command line flags were leaked, too), >>>>> but it was silly that I didn't fix it. >>>>> >>>>> Anyway, fixed. See: >>>>> >>>>> http://cr.openjdk.java.net/~jmanson/8079301/webrev.03 >>>>> >>>>> >>>>> >>>>> Jeremy >>>>> >>>>> On Thu, Jul 9, 2015 at 2:52 PM, Dmitry Dmitriev >>>>> >>>> >>>>> >>>> >> wrote: >>>>> >>>>> Hello Jeremy, >>>>> >>>>> Correct me if I am wrong, but I see small memory leak >>>>> in your >>>>> implementation. >>>>> In Arguments::parse_options_environment_variable >>>>> function memory >>>>> for 'buffer' allocated by strdup function on line >>>>> 3415, but now it >>>>> not freed in this function because data from this >>>>> buffer is used >>>>> later. On the other hand when we are done with env >>>>> variables, we >>>>> free only options array(lines 3703-3705) and not free >>>>> previously >>>>> allocated memory for 'buffer' because we lost track >>>>> for it. >>>>> >>>>> Thanks, >>>>> Dmitry >>>>> >>>>> >>>>> On 09.07.2015 21:20, Jeremy Manson wrote: >>>>> >>>>> Thanks for looking at this, Coleen. >>>>> >>>>> I merged this with the latest version of hs-rt, >>>>> but Ron is or >>>>> I am going to >>>>> have to do some merging for 8061999. The changes >>>>> are relatively >>>>> orthogonal, but they touch a couple of the same >>>>> places. How >>>>> far away is >>>>> Ron's checkin? >>>>> >>>>> Updated webrev: >>>>> >>>>> http://cr.openjdk.java.net/~jmanson/8079301/webrev.01/ >>>>> >>>>> >>>>> >>>>> Updated test: >>>>> >>>>> http://cr.openjdk.java.net/~jmanson/8079301t/webrev.01/ >>>>> >>>>> >>>>> >>>>> (Mild complaining on my part: the conflicts >>>>> wouldn't have been >>>>> an issue if >>>>> someone had looked at this two months ago, when I >>>>> first >>>>> asked. I suspect >>>>> Ron hadn't even started his change at that >>>>> point. And if external >>>>> developers were able to submit changes to >>>>> Hotspot, >>>>> we wouldn't >>>>> have had to >>>>> bother Oracle engineers at all. Neither of these >>>>> is your >>>>> fault or your >>>>> problem, of course - I'm grateful you were >>>>> able to >>>>> take a look.) >>>>> >>>>> Jeremy >>>>> >>>>> On Wed, Jul 8, 2015 at 6:19 AM, Coleen >>>>> Phillimore < >>>>> coleen.phillimore at oracle.com >>>>> >>>>> >>>> >> wrote: >>>>> >>>>> I'll sponsor it but can you repost the RFR? >>>>> >>>>> There has been a fair bit of work to >>>>> command line >>>>> processing lately so I'd >>>>> like to have the others look at it too. Have >>>>> you merged >>>>> this up with the >>>>> latest version of hs-rt repository and >>>>> were there >>>>> conflicts? Also, have >>>>> you looked at the RFR: >>>>> >>>>> "Open code review for 8061999 Enhance VM >>>>> option parsing to >>>>> allow options >>>>> to be specified" >>>>> >>>>> and are there conflicts with this? >>>>> >>>>> The hotspot change looks good to me. >>>>> >>>>> >>>>> http://cr.openjdk.java.net/~jmanson/8079301t/webrev.00/test/com/sun/management/HotSpotDiagnosticMXBean/CheckOrigin.java.udiff.html >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> "UseCerealGC" LOL >>>>> Can you use a different option than >>>>> PrintOopAddress in >>>>> this test? I don't >>>>> know why this command line option exists or >>>>> would be >>>>> useful for, and seems >>>>> to be a good candidate for removal. If you >>>>> need a valid >>>>> argument, that is >>>>> unlikely to go away, TraceExceptions would be >>>>> good. >>>>> >>>>> Thanks, >>>>> Coleen >>>>> >>>>> >>>>> On 7/7/15 8:00 PM, Jeremy Manson wrote: >>>>> >>>>> No love? Is there a code owner here I >>>>> should pester >>>>> more directly? >>>>> >>>>> Jeremy >>>>> >>>>> On Fri, Jun 26, 2015 at 3:00 PM, Martin >>>>> Buchholz >>>>> >>>> >>>> >> >>>>> wrote: >>>>> >>>>> As usual with Google patches, they are >>>>> in use >>>>> locally. This one has been >>>>> >>>>> stable for a while without >>>>> complaints. >>>>> Please >>>>> sponsor. >>>>> >>>>> On Fri, Jun 26, 2015 at 1:53 PM, >>>>> Jeremy Manson >>>>> >>>> >>>>> >>>> >> >>>>> wrote: >>>>> >>>>> All this talk about >>>>> IgnoreUnrecognizedVMOptions >>>>> reminded me that this >>>>> >>>>> review is still outstanding. Any >>>>> takers? >>>>> >>>>> Jeremy >>>>> >>>>> On Tue, May 5, 2015 at 10:01 AM, >>>>> Jeremy Manson >>>>> >>>> >>>>> >>>> > >>>>> wrote: >>>>> >>>>> Hi David, >>>>> >>>>> Thanks for taking a look. >>>>> >>>>> On Mon, May 4, 2015 at 8:32 >>>>> PM, David >>>>> Holmes >>>>> >>>>> >>>> >> >>>>> >>>>> wrote: >>>>> >>>>> Hi Jeremy, >>>>> >>>>> On 5/05/2015 6:51 AM, >>>>> Jeremy Manson wrote: >>>>> >>>>> Not sure who might be >>>>> willing to >>>>> sponsor this. David? You >>>>> did the >>>>> >>>>> last >>>>> one. :) >>>>> >>>>> Might be a while >>>>> before I can >>>>> get to it. I did have >>>>> a quick look >>>>> >>>>> (and >>>>> will need a longer one). >>>>> >>>>> I understand. I'm just >>>>> happy it's >>>>> possible to upstream this >>>>> stuff at >>>>> all[1]. >>>>> >>>>> [1] With the eternal caveat >>>>> that I'd be >>>>> happier if we didn't >>>>> *have* to >>>>> go through you folks, but >>>>> we've learned to >>>>> live with it. >>>>> >>>>> >>>>> >>>>> Context: A number of >>>>> command line >>>>> options are not settable via >>>>> >>>>> JAVA_TOOL_OPTIONS and _JAVA_OPTIONS: >>>>> >>>>> - PrintVMOptions >>>>> >>>>> So you have >>>>> changed the >>>>> semantics of this to >>>>> print out the >>>>> options >>>>> >>>>> from >>>>> the command-line and each >>>>> of the two >>>>> env vars. Seems >>>>> reasonable but >>>>> may be >>>>> better to know which >>>>> option came from >>>>> where as we can now see >>>>> the same >>>>> option (or conflicting >>>>> variants >>>>> thereof) multiple times. >>>>> >>>>> I'd be happy to do >>>>> this. Any >>>>> preferred syntax? Does >>>>> someone >>>>> >>>>> actually >>>>> own this feature? >>>>> >>>>> I'm unclear what the current >>>>> processing >>>>> order is for the different >>>>> >>>>> sources of options, and >>>>> whether the >>>>> changes affect that >>>>> order? >>>>> >>>>> Nope. I go through sad >>>>> contortions >>>>> to keep the processing >>>>> order the >>>>> >>>>> same. It's >>>>> JAVA_TOOL_OPTIONS, >>>>> then >>>>> command line, then >>>>> _JAVA_OPTIONS. >>>>> See >>>>> lines 2549-2567. >>>>> >>>>> >>>>> - >>>>> IgnoreUnrecognizedVMOptions >>>>> >>>>> - >>>>> PrintFlagsInitial >>>>> >>>>> Unclear what >>>>> "initial" actually >>>>> means - is it the >>>>> default? >>>>> >>>>> More or less. If you stick, >>>>> for example, >>>>> IgnoreUnrecognizedVMOptions >>>>> in >>>>> there first, it will get >>>>> printed out as >>>>> "true". I haven't really >>>>> changed >>>>> the semantics here either - >>>>> I've just >>>>> added processing of the >>>>> envvars. >>>>> >>>>> - NativeMemoryTracking >>>>> >>>>> - >>>>> PrintFlagsWithComments >>>>> >>>>> This is because these >>>>> flags have >>>>> to be processed >>>>> before >>>>> processing >>>>> other >>>>> flags, and no one >>>>> ever >>>>> bothered to >>>>> do that for the flags >>>>> coming from >>>>> environment >>>>> variables. This patch >>>>> fixes that problem. >>>>> >>>>> I have a test, but >>>>> it is a >>>>> modification to a JDK >>>>> test instead >>>>> of a HS >>>>> test, >>>>> so it can go in >>>>> separately (I guess). >>>>> >>>>> They can be pushed >>>>> together to >>>>> different repos in >>>>> the >>>>> same forest. >>>>> >>>>> Okay. Here's the test >>>>> change: >>>>> >>>>> http://cr.openjdk.java.net/~jmanson/8079301t/webrev.00/ >>>>> >>>>> >>>>> >>>>> >>>>> As I said I'll have to get >>>>> back to this. >>>>> And hopefully someone else in >>>>> >>>>> runtime will take a good >>>>> look as well ;-) >>>>> >>>>> I'd be happy to toss it >>>>> over to >>>>> whomever owns this, if >>>>> anyone. >>>>> >>>>> Thanks! >>>>> >>>>> Jeremy >>>>> >>>>> >>>>> >>>>> Bug: >>>>> >>>>> https://bugs.openjdk.java.net/browse/JDK-8079301 >>>>> >>>>> Webrev: >>>>> http://cr.openjdk.java.net/~jmanson/8079301/webrev.00/ >>>>> >>>>> >>>>> >>>>> Jeremy >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>> >>> >> > From ron.durbin at oracle.com Tue Jul 14 22:21:10 2015 From: ron.durbin at oracle.com (Ron Durbin) Date: Tue, 14 Jul 2015 15:21:10 -0700 (PDT) Subject: Open code review for 8061999 Enhance VM option parsing to allow options to be specified Message-ID: <6b67beb6-3936-4c3c-bd33-cd314be5e8e5@default> Gerard, Thanks for your time in reviewing the code and providing comments. My responses to your comments inline below: >-----Original Message----- >From: Gerard Ziemski >Sent: Tuesday, June 23, 2015 1:53 PM >To: hotspot-runtime-dev at openjdk.java.net >Cc: Ron Durbin >Subject: Re: Open code review for 8061999 Enhance VM option parsing to allow options to be specified > >hi Ron, > >I'm sending you partial feedback, since I am starting to get a bit tired. I will spend more time reviewing your >webrev tomorrow, but here is what I have so far: > >--- >src/share/vm/utilities/globalDefinitions.hp > >1. Should we name the method "is_white()", not "iswhite()" since it's part of our code base? But then since it's >a macro, shouldn't it actually be "IS_WHITE()" ? >--- >src/share/vm/runtime/arguments.hpp >[ [Ron] While researching my answer to this comment, I realized that I should have used the already existing isspace() function instead of creating the iswhite() macro. Will fix. >1. > >All the arguments in alloc_JVM_options_list(), copy_JVM_options_from_buf() and parse_JVM_options_file() use >underscores in the arguments names except for merge_JVM_options_file(). I think the merge_JVM_options_file() >should be: > >+ static jint merge_JVM_options_file(const struct JavaVMInitArgs *args_in, >+ struct JavaVMInitArgs **args_out); > [Ron] This one is a reasonable clean up > >--- >src/share/vm/runtime/arguments.cpp > >1. Why do FreeVMOptions, DumpVMOptions, DumpVMOption and DumpOption start with capital letters? Shouldn't their >names start with a lower case letter? > [Ron] This one is a reasonable clean up >2. Line 4306. The pattern in Arguments::parse() seems to be to print out error message and return the error >value if something goes wrong, but we do vm_exit(1) instead? > [Ron ] The cases that will trigger this exit on fail are extreme: - missing or otherwise in accessible options files - Un-parsable options file, too big, too many options, nonwhite space terminated options - Unable to allocate memory for options files processing >3. Line 4309. I was told that when it comes to NULL pointer check we should do (NULL == args), not the other way >around. > [Ron] This one is a reasonable clean up >4. Line 4375. Don't we need FreeVMOptions() here? Line 4382 as well? [Ron] Gerard this one is a reasonable clean up >5. Question. Why do we need N_MAX_OPTIONS? [Ron] Until recently N_MAX_OPTIONS applied to environment variables too N_MAX_OTIIONS is used to limit the number of options and thus the memory allocated. A future enhancement will be to refactor the options file processing to grow memory like the environment variables do now. > >6. Question. Why do we need OPTION_BUFFER_SIZE? Can't we use "int bytes_needed = fseek(stream, 0, SEEK_END); >rewind(stream)" and have the code dynamically allocate memory without hard coded limits? > [Ron>] Until recently OPTION_BUFFER_SIZE applied to environment variables too. \ OPTION_BUFFER_SIZE is used to limit the memory allocated for reading the options. A future enhancement will be to refactor the options file processing to grow memory like the environment variables do now. >7. Line 3965. Can that comparison ever succeed? "read()" will not read more bytes (only less) than as specified >by "bytes_alloc" and if it did, we would overwrite memory since our buf is only "bytes_alloc" big. > [Ron>] Yes that comparison can succeed. We only support an options file that is <= OPTION_BUFFER_SIZE bytes in size. We allocate a read buffer that is OPTION_BUFFER_SIZE + 1 bytes in size for two reasons: 1) to have space for a NULL terminator when the options file is the maximum number of bytes in length 2) easy detection of an options file that is too large; we try to read OPTION_BUFFER_SIZE + 1 bytes. If we succeed, then the file is too big. > > >cheers > > >On 6/22/2015 7:52 AM, Ron Durbin wrote: >Webrev URL: >http://cr.openjdk.java.net/~rdurbin/8061999_OCR0_JDK9_webrev > > >RFE request: >https://bugs.openjdk.java.net/browse/JDK-8061999 > >This RFE allows a file to be specified that holds VM Options that >would otherwise be specified on the command line or in an environment variable. >Only one options file may be specified on the command line and no options file >may be specified in either of the following environment variables >"JAVA_TOOL_OPTIONS" or "_JAVA_OPTIONS". > >The options file feature supports all VM options currently supported on >the command line, except the options file option. The option to specify an >options file is "-XX:VMOptionsFile=". >The options file feature supports an options file up to 1024 bytes in size >and up to 64 options. > >This feature has been tested on: > OS: > Solaris, MAC, Windows, Linux > Tests: > Manual unit tests > JPRT with -testset hotspot (including the SQE proposed test coverage for this feature.) > > > From ron.durbin at oracle.com Tue Jul 14 22:21:32 2015 From: ron.durbin at oracle.com (Ron Durbin) Date: Tue, 14 Jul 2015 15:21:32 -0700 (PDT) Subject: Open code review for 8061999 Enhance VM option parsing to allow options to be specified Message-ID: <54a5e72a-9626-462b-a1d1-a5b1db134355@default> Dmitry, Thanks for your time in reviewing the code and providing comments. My responses to your comments inline below: >-----Original Message----- >From: Dmitry Dmitriev >Sent: Wednesday, June 24, 2015 3:26 AM >To: Ron Durbin; hotspot-runtime-dev at openjdk.java.net >Subject: Re: Open code review for 8061999 Enhance VM option parsing to allow options to be specified > >Hello Ron, > >Several comments for src/share/vm/runtime/arguments.cpp file: > >1) You can call os::close just after read on line 3945, because os::close is called in all execution paths. >After that you can remove os::close on lines 3950, 3960, 3968 and 3975. > [Ron>] Great code cleanup. Will do >2) Unneeded 'buf = NULL;' on lines 3949, 3959, 3967, 4026 and 4054. > [Ron>] While these particular cases are obvious that memory is free, I am following a consistent style that forces all code to address zero if a pointer is not set explicitly to an allocated memory block. >3) Unneeded 'options_file = NULL;' on lines 4103, 4144, 4155, 4180, 4227, 4256 and 4276. > [Ron>] See previous reply >4) Unneeded 'buff = NULL;' on lines 4178, 4225, 4254 and 4274 > [Ron>] See previous reply >5) You can call 'FreeVMOptions(&args, argsin);' just after parse_vm_init_args function call on line 4423, >because FreeVMOptions is called in all execution paths. After that you can remove 'FreeVMOptions(&args, >argsin);' on lines 4425 and 4429. > [Ron>] Great code cleanup. Will do. >Thank you, >Dmitry > > >On 22.06.2015 15:52, Ron Durbin wrote: > > > Webrev URL: > http://cr.openjdk.java.net/~rdurbin/8061999_OCR0_JDK9_webrev > > > RFE request: > https://bugs.openjdk.java.net/browse/JDK-8061999 > > This RFE allows a file to be specified that holds VM Options that > would otherwise be specified on the command line or in an environment variable. > Only one options file may be specified on the command line and no options file > may be specified in either of the following environment variables > "JAVA_TOOL_OPTIONS" or "_JAVA_OPTIONS". > > The options file feature supports all VM options currently supported on > the command line, except the options file option. The option to specify an > options file is "-XX:VMOptionsFile=". > The options file feature supports an options file up to 1024 bytes in size > and up to 64 options. > > This feature has been tested on: > OS: > Solaris, MAC, Windows, Linux > Tests: > Manual unit tests > JPRT with -testset hotspot (including the SQE proposed test coverage for this feature.) > > > From david.holmes at oracle.com Wed Jul 15 00:13:04 2015 From: david.holmes at oracle.com (David Holmes) Date: Wed, 15 Jul 2015 10:13:04 +1000 Subject: RFR: 8048353: jstack -l crashes VM when a Java mirror for a primitive type is locked In-Reply-To: <55A53702.6000309@oracle.com> References: <55A53006.1030307@oracle.com> <55A53122.8000409@oracle.com> <55A53702.6000309@oracle.com> Message-ID: <55A5A590.9020100@oracle.com> I'll add a third Review :) My only query is whether just type2name is the right choice here - I'm not sure what the actual output will display in context? Thanks, David On 15/07/2015 2:21 AM, Daniel D. Daugherty wrote: > > Webrev: http://cr.openjdk.java.net/~vkempik/8048353/webrev.00/ > > src/share/vm/classfile/javaClasses.cpp > No comments. (Thanks for including the "" case.) > > src/share/vm/classfile/javaClasses.hpp > No comments. > > src/share/vm/runtime/vframe.cpp > No comments. > > Thumbs up (modulo running the proper tests). > > Dan > > > On 7/14/15 9:56 AM, Daniel D. Daugherty wrote: >> Adding serviceability-dev at ... since jstack belongs to the >> Serviceability team... >> >> The jstack and/or tmtools tests should also be run... >> >> Dan >> >> >> On 7/14/15 9:51 AM, Vladimir Kempik wrote: >>> Hello, >>> >>> Please review the patch to fix 8048353. >>> Customer has an issue with this bug when running jstack on jdk7. >>> He tested FVB and cofirmed it has fixed the issue. >>> Before pushing jdk7 backport I need to get the fix to 9 and 8. >>> >>> Webrev: http://cr.openjdk.java.net/~vkempik/8048353/webrev.00/ >>> JBS bug: https://bugs.openjdk.java.net/browse/JDK-8048353 >>> >>> testing: JPRT. >>> >>> Thanks, Vladimir. >> > From yumin.qi at oracle.com Wed Jul 15 01:28:30 2015 From: yumin.qi at oracle.com (Yumin Qi) Date: Tue, 14 Jul 2015 18:28:30 -0700 Subject: RFR: 8025692: Add trace to find out what methods are used at runtime. In-Reply-To: <55A02D1E.10404@oracle.com> References: <5514C1CB.7020009@oracle.com> <55711388.4090402@oracle.com> <559F4B5B.60203@oracle.com> <559FF3F6.7060400@oracle.com> <55A02D1E.10404@oracle.com> Message-ID: <55A5B73E.2090001@oracle.com> The test finally passed today! I will push the changes then. Thanks Yumin On 7/10/2015 1:37 PM, Yumin Qi wrote: > Thanks, Misha > > The failure of the failed 4 jobs, some of dependency error, which I > think is dtrace, some are agent download encountered 'check sum' which > I think is configuration problem. Still, the 4 running jobs just hang > there and no progress --- may as you said, it is Windows problem. > > Yumin > > On 7/10/2015 9:33 AM, Mikhailo Seledtsov wrote: >> It is a known issue with Aurora; the RBT jobs get stuck on Win-x64. >> The fix's ETA is on 13-July during next Aurora patch deployemnt. >> >> You could still check status of testing on jobs that complete: >> - go to your main RBT status for your job (e.g. >> http://sla03.se.oracle.com:3000/rbt/rbt-mikhailo.seledtsov-hs-rt-20150709-1543-2147) >> >> For overall status, just see the summary under "Test Failures" tab >> >> For details on particular failures, do: >> - Under "Test Progress"-> x of Y jobs succeeded, click the "wheel" >> symbol -> Main >> - this will lead you to your Aurora main jobs page >> - there, you could click "Go to batch results", see a table of new >> failures, and look into them in detail >> >> Hope this helps, >> Misha >> >> >> On 7/9/2015 9:34 PM, Yumin Qi wrote: >>> Hi, Karen >>> >>> Just informed you that RBT testing for quick testing seems will >>> not get back a completed result(I have tried several times those days). >>> After 11 hours, there still 4 jobs running: >>> >>> 26 of 34 succeeded, 4 failed, 4 still running. >>> >>> Those running jobs already run at least 6+ hours. >>> The 4 failed jobs are dtrace on linux-x64 which are OK, since >>> dtrace is disabled on it. >>> >>> Also, I added -Xint to test case, and tested with jtreg on >>> test/runtime showed no new failures found. >>> I am going to push the changes if you are OK with current result. >>> Seems the testing with RBT will never come back. Updated webrev: >>> >>> http://cr.openjdk.java.net/~minqi/8025692/webrev02/ >>> >>> Thanks >>> Yumin >>> >>> On 6/18/2015 1:01 PM, Karen Kinnear wrote: >>>> Yumin, >>>> >>>> Thank you very much for the updates.And the PERM_REFCOUNT rather >>>> than -1 :-) >>>> Looks good. >>>> >>>> Thank you for testing this -Xint. If there is an easy way to add an >>>> -Xint line >>>> to the test that would be useful - but not critical. >>>> >>>> So I presume that the "aurora default test suites" includes: >>>> jcks, jtreg hotspot and Christian's new "quick" tests. >>>> >>>> thanks, >>>> Karen >>>> >>>> On Jun 4, 2015, at 11:12 PM, Yumin Qi wrote: >>>> >>>>> HI, All >>>>> >>>>> After several round of codereviews and discussion, now the >>>>> second version is at: >>>>> http://cr.openjdk.java.net/~minqi/8025692/webrev02/ >>>>> >>>>> The flag names changed: >>>>> >>>>> TraceMethodUsge => LogTouchedMethods >>>>> PrintMethodUsageAtExit => PrintTouchedMethodsAtExit >>>>> >>>>> The two flags now are diagnostic flags. >>>>> >>>>> Also similar, there changed in related variable names. >>>>> Also fixed a flaw which is not found during last round of >>>>> review: append new TouchedMethodRecord to end of hash bucket list. >>>>> >>>>> Make change to interpreter method entry generation(for both >>>>> native and normal) to enable build_method_counter called. This is >>>>> necessary since if run -Xint, the call will be skipped so our code >>>>> will be skipped so no logging for touched methods. >>>>> >>>>> Added test case for jcmd: jcmd VM.print_touched_methods. >>>>> >>>>> Tests: JPRT, aurora default test suites (in progress). >>>>> >>>>> Thanks >>>>> Yumin >>>>> >>>>> >>>>> On 3/26/2015 7:34 PM, Yumin Qi wrote: >>>>>> Please review: >>>>>> >>>>>> bug: https://bugs.openjdk.java.net/browse/JDK-8025692 >>>>>> webrev: http://cr.openjdk.java.net/~minqi/8025692/webrev01/ >>>>>> >>>>>> Summary: Add two flags to help list all java methods called in >>>>>> runtime, this is also in product and can help CDS to rearrange >>>>>> methods in shared archive to avoid loading infrequent methods >>>>>> into memory. >>>>>> >>>>>> Tests: vm.runtime.quick.testlist, JPRT >>>>>> >>>>>> >>>>>> Thanks >>>>>> Yumin >>>>>> >>>>>> >>> >> > From andreas.eriksson at oracle.com Wed Jul 15 12:48:12 2015 From: andreas.eriksson at oracle.com (Andreas Eriksson) Date: Wed, 15 Jul 2015 14:48:12 +0200 Subject: RFR [jdk8u-hs-dev]: 8131333,,[TESTBUG] RedefineRunningMethodsWithResolutionErrors.java Improperly specified VM option 'TraceRedefineClasses=0x600' Message-ID: <55A6568C.5000703@oracle.com> Hi, Could I get a review for this small jdk8 test fix please. Jdk8 doesn't support 0x hex notation for vm options. Fix is to remove the option, since it's not important. https://bugs.openjdk.java.net/browse/JDK-8131333 http://cr.openjdk.java.net/~aeriksso/8131333/webrev/ Thanks, Andreas From serguei.spitsyn at oracle.com Wed Jul 15 12:55:56 2015 From: serguei.spitsyn at oracle.com (serguei.spitsyn at oracle.com) Date: Wed, 15 Jul 2015 05:55:56 -0700 Subject: RFR [jdk8u-hs-dev]: 8131333, , [TESTBUG] RedefineRunningMethodsWithResolutionErrors.java Improperly specified VM option 'TraceRedefineClasses=0x600' In-Reply-To: <55A6568C.5000703@oracle.com> References: <55A6568C.5000703@oracle.com> Message-ID: <55A6585C.3070305@oracle.com> Hi Andreas, What about to replace hex notation 0x600 with decimal 1536 ? Thanks, Serguei On 7/15/15 5:48 AM, Andreas Eriksson wrote: > Hi, > > Could I get a review for this small jdk8 test fix please. > Jdk8 doesn't support 0x hex notation for vm options. > Fix is to remove the option, since it's not important. > > https://bugs.openjdk.java.net/browse/JDK-8131333 > http://cr.openjdk.java.net/~aeriksso/8131333/webrev/ > > Thanks, > Andreas From andreas.eriksson at oracle.com Wed Jul 15 13:03:28 2015 From: andreas.eriksson at oracle.com (Andreas Eriksson) Date: Wed, 15 Jul 2015 15:03:28 +0200 Subject: RFR [jdk8u-hs-dev]: 8131333,,[TESTBUG] RedefineRunningMethodsWithResolutionErrors.java Improperly specified VM option 'TraceRedefineClasses=0x600' In-Reply-To: <55A6585C.3070305@oracle.com> References: <55A6568C.5000703@oracle.com> <55A6585C.3070305@oracle.com> Message-ID: <55A65A20.8020501@oracle.com> I could do that if you think it would be better, but the option is not needed for the test, I mainly used it when creating the test. - Andreas On 2015-07-15 14:55, serguei.spitsyn at oracle.com wrote: > Hi Andreas, > > What about to replace hex notation 0x600 with decimal 1536 ? > > Thanks, > Serguei > > On 7/15/15 5:48 AM, Andreas Eriksson wrote: >> Hi, >> >> Could I get a review for this small jdk8 test fix please. >> Jdk8 doesn't support 0x hex notation for vm options. >> Fix is to remove the option, since it's not important. >> >> https://bugs.openjdk.java.net/browse/JDK-8131333 >> http://cr.openjdk.java.net/~aeriksso/8131333/webrev/ >> >> Thanks, >> Andreas > From serguei.spitsyn at oracle.com Wed Jul 15 13:06:32 2015 From: serguei.spitsyn at oracle.com (serguei.spitsyn at oracle.com) Date: Wed, 15 Jul 2015 06:06:32 -0700 Subject: RFR [jdk8u-hs-dev]: 8131333, , [TESTBUG] RedefineRunningMethodsWithResolutionErrors.java Improperly specified VM option 'TraceRedefineClasses=0x600' In-Reply-To: <55A65A20.8020501@oracle.com> References: <55A6568C.5000703@oracle.com> <55A6585C.3070305@oracle.com> <55A65A20.8020501@oracle.com> Message-ID: <55A65AD8.3090803@oracle.com> I'm Ok with your fix. Thanks, Serguei On 7/15/15 6:03 AM, Andreas Eriksson wrote: > I could do that if you think it would be better, but the option is not > needed for the test, I mainly used it when creating the test. > > - Andreas > > On 2015-07-15 14:55, serguei.spitsyn at oracle.com wrote: >> Hi Andreas, >> >> What about to replace hex notation 0x600 with decimal 1536 ? >> >> Thanks, >> Serguei >> >> On 7/15/15 5:48 AM, Andreas Eriksson wrote: >>> Hi, >>> >>> Could I get a review for this small jdk8 test fix please. >>> Jdk8 doesn't support 0x hex notation for vm options. >>> Fix is to remove the option, since it's not important. >>> >>> https://bugs.openjdk.java.net/browse/JDK-8131333 >>> http://cr.openjdk.java.net/~aeriksso/8131333/webrev/ >>> >>> Thanks, >>> Andreas >> > From andreas.eriksson at oracle.com Wed Jul 15 13:08:05 2015 From: andreas.eriksson at oracle.com (Andreas Eriksson) Date: Wed, 15 Jul 2015 15:08:05 +0200 Subject: RFR [jdk8u-hs-dev]: 8131333,,[TESTBUG] RedefineRunningMethodsWithResolutionErrors.java Improperly specified VM option 'TraceRedefineClasses=0x600' In-Reply-To: <55A65AD8.3090803@oracle.com> References: <55A6568C.5000703@oracle.com> <55A6585C.3070305@oracle.com> <55A65A20.8020501@oracle.com> <55A65AD8.3090803@oracle.com> Message-ID: <55A65B35.20006@oracle.com> Thanks. On 2015-07-15 15:06, serguei.spitsyn at oracle.com wrote: > I'm Ok with your fix. > > Thanks, > Serguei > > On 7/15/15 6:03 AM, Andreas Eriksson wrote: >> I could do that if you think it would be better, but the option is >> not needed for the test, I mainly used it when creating the test. >> >> - Andreas >> >> On 2015-07-15 14:55, serguei.spitsyn at oracle.com wrote: >>> Hi Andreas, >>> >>> What about to replace hex notation 0x600 with decimal 1536 ? >>> >>> Thanks, >>> Serguei >>> >>> On 7/15/15 5:48 AM, Andreas Eriksson wrote: >>>> Hi, >>>> >>>> Could I get a review for this small jdk8 test fix please. >>>> Jdk8 doesn't support 0x hex notation for vm options. >>>> Fix is to remove the option, since it's not important. >>>> >>>> https://bugs.openjdk.java.net/browse/JDK-8131333 >>>> http://cr.openjdk.java.net/~aeriksso/8131333/webrev/ >>>> >>>> Thanks, >>>> Andreas >>> >> > From coleen.phillimore at oracle.com Wed Jul 15 13:23:38 2015 From: coleen.phillimore at oracle.com (Coleen Phillimore) Date: Wed, 15 Jul 2015 09:23:38 -0400 Subject: RFR [jdk8u-hs-dev]: 8131333, , [TESTBUG] RedefineRunningMethodsWithResolutionErrors.java Improperly specified VM option 'TraceRedefineClasses=0x600' In-Reply-To: <55A65AD8.3090803@oracle.com> References: <55A6568C.5000703@oracle.com> <55A6585C.3070305@oracle.com> <55A65A20.8020501@oracle.com> <55A65AD8.3090803@oracle.com> Message-ID: <55A65EDA.5030605@oracle.com> Me too. Your fix looks fine to me either way. Coleen On 7/15/15 9:06 AM, serguei.spitsyn at oracle.com wrote: > I'm Ok with your fix. > > Thanks, > Serguei > > On 7/15/15 6:03 AM, Andreas Eriksson wrote: >> I could do that if you think it would be better, but the option is >> not needed for the test, I mainly used it when creating the test. >> >> - Andreas >> >> On 2015-07-15 14:55, serguei.spitsyn at oracle.com wrote: >>> Hi Andreas, >>> >>> What about to replace hex notation 0x600 with decimal 1536 ? >>> >>> Thanks, >>> Serguei >>> >>> On 7/15/15 5:48 AM, Andreas Eriksson wrote: >>>> Hi, >>>> >>>> Could I get a review for this small jdk8 test fix please. >>>> Jdk8 doesn't support 0x hex notation for vm options. >>>> Fix is to remove the option, since it's not important. >>>> >>>> https://bugs.openjdk.java.net/browse/JDK-8131333 >>>> http://cr.openjdk.java.net/~aeriksso/8131333/webrev/ >>>> >>>> Thanks, >>>> Andreas >>> >> > From andreas.eriksson at oracle.com Wed Jul 15 13:31:04 2015 From: andreas.eriksson at oracle.com (Andreas Eriksson) Date: Wed, 15 Jul 2015 15:31:04 +0200 Subject: RFR [jdk8u-hs-dev]: 8131333,,[TESTBUG] RedefineRunningMethodsWithResolutionErrors.java Improperly specified VM option 'TraceRedefineClasses=0x600' In-Reply-To: <55A65EDA.5030605@oracle.com> References: <55A6568C.5000703@oracle.com> <55A6585C.3070305@oracle.com> <55A65A20.8020501@oracle.com> <55A65AD8.3090803@oracle.com> <55A65EDA.5030605@oracle.com> Message-ID: <55A66098.3040601@oracle.com> Thanks. On 2015-07-15 15:23, Coleen Phillimore wrote: > > Me too. Your fix looks fine to me either way. > Coleen > > On 7/15/15 9:06 AM, serguei.spitsyn at oracle.com wrote: >> I'm Ok with your fix. >> >> Thanks, >> Serguei >> >> On 7/15/15 6:03 AM, Andreas Eriksson wrote: >>> I could do that if you think it would be better, but the option is >>> not needed for the test, I mainly used it when creating the test. >>> >>> - Andreas >>> >>> On 2015-07-15 14:55, serguei.spitsyn at oracle.com wrote: >>>> Hi Andreas, >>>> >>>> What about to replace hex notation 0x600 with decimal 1536 ? >>>> >>>> Thanks, >>>> Serguei >>>> >>>> On 7/15/15 5:48 AM, Andreas Eriksson wrote: >>>>> Hi, >>>>> >>>>> Could I get a review for this small jdk8 test fix please. >>>>> Jdk8 doesn't support 0x hex notation for vm options. >>>>> Fix is to remove the option, since it's not important. >>>>> >>>>> https://bugs.openjdk.java.net/browse/JDK-8131333 >>>>> http://cr.openjdk.java.net/~aeriksso/8131333/webrev/ >>>>> >>>>> Thanks, >>>>> Andreas >>>> >>> >> > From vladimir.kempik at oracle.com Wed Jul 15 14:31:28 2015 From: vladimir.kempik at oracle.com (Vladimir Kempik) Date: Wed, 15 Jul 2015 17:31:28 +0300 Subject: RFR: 8048353: jstack -l crashes VM when a Java mirror for a primitive type is locked In-Reply-To: <55A53702.6000309@oracle.com> References: <55A53006.1030307@oracle.com> <55A53122.8000409@oracle.com> <55A53702.6000309@oracle.com> Message-ID: <55A66EC0.2020202@oracle.com> Hello Thanks for looking into this. Where can I find jstack/tmtools tests to run them ? Thanks, Vladimir. On 14.07.2015 19:21, Daniel D. Daugherty wrote: > > Webrev: http://cr.openjdk.java.net/~vkempik/8048353/webrev.00/ > > src/share/vm/classfile/javaClasses.cpp > No comments. (Thanks for including the "" case.) > > src/share/vm/classfile/javaClasses.hpp > No comments. > > src/share/vm/runtime/vframe.cpp > No comments. > > Thumbs up (modulo running the proper tests). > > Dan > > > On 7/14/15 9:56 AM, Daniel D. Daugherty wrote: >> Adding serviceability-dev at ... since jstack belongs to the >> Serviceability team... >> >> The jstack and/or tmtools tests should also be run... >> >> Dan >> >> >> On 7/14/15 9:51 AM, Vladimir Kempik wrote: >>> Hello, >>> >>> Please review the patch to fix 8048353. >>> Customer has an issue with this bug when running jstack on jdk7. >>> He tested FVB and cofirmed it has fixed the issue. >>> Before pushing jdk7 backport I need to get the fix to 9 and 8. >>> >>> Webrev: http://cr.openjdk.java.net/~vkempik/8048353/webrev.00/ >>> JBS bug: https://bugs.openjdk.java.net/browse/JDK-8048353 >>> >>> testing: JPRT. >>> >>> Thanks, Vladimir. >> > From christian.tornqvist at oracle.com Wed Jul 15 15:12:36 2015 From: christian.tornqvist at oracle.com (Christian Tornqvist) Date: Wed, 15 Jul 2015 11:12:36 -0400 Subject: RFR(XS): 8080733 - [TESTBUG] several runtime/ErrorHandling/* tests time out on Windows Message-ID: <03e001d0bf10$af56aee0$0e040ca0$@oracle.com> Hi everyone, Please review this small change that removes a few test cases from test/runtime/ErrorHandling/CreateCoredumpOnCrash.java and adds -XX:-CreateCoredumpOnCrash to TestOnError.java. We've been seeing hangs in these tests on Windows when running in our nightly. Most likely this is caused by https://bugs.openjdk.java.net/browse/JDK-8051995, it's more likely to happen when running tests concurrently which explains why it shows up in our nightly runs. Webrev: http://cr.openjdk.java.net/~ctornqvi/webrev/8080733/webrev.00/ Bug: https://bugs.openjdk.java.net/browse/JDK-8080733 Thanks, Christian From george.triantafillou at oracle.com Wed Jul 15 15:20:53 2015 From: george.triantafillou at oracle.com (George Triantafillou) Date: Wed, 15 Jul 2015 11:20:53 -0400 Subject: RFR(XS): 8080733 - [TESTBUG] several runtime/ErrorHandling/* tests time out on Windows In-Reply-To: <03e001d0bf10$af56aee0$0e040ca0$@oracle.com> References: <03e001d0bf10$af56aee0$0e040ca0$@oracle.com> Message-ID: <55A67A55.5040805@oracle.com> Hi Christian, This looks good. Thanks for fixing this. -George On 7/15/2015 11:12 AM, Christian Tornqvist wrote: > Hi everyone, > > > > Please review this small change that removes a few test cases from > test/runtime/ErrorHandling/CreateCoredumpOnCrash.java and adds > -XX:-CreateCoredumpOnCrash to TestOnError.java. We've been seeing hangs in > these tests on Windows when running in our nightly. Most likely this is > caused by https://bugs.openjdk.java.net/browse/JDK-8051995, it's more likely > to happen when running tests concurrently which explains why it shows up in > our nightly runs. > > > > Webrev: > > http://cr.openjdk.java.net/~ctornqvi/webrev/8080733/webrev.00/ > > > > Bug: > > https://bugs.openjdk.java.net/browse/JDK-8080733 > > > > Thanks, > > Christian > From coleen.phillimore at oracle.com Wed Jul 15 15:40:18 2015 From: coleen.phillimore at oracle.com (Coleen Phillimore) Date: Wed, 15 Jul 2015 11:40:18 -0400 Subject: RFR(XS): 8080733 - [TESTBUG] several runtime/ErrorHandling/* tests time out on Windows In-Reply-To: <03e001d0bf10$af56aee0$0e040ca0$@oracle.com> References: <03e001d0bf10$af56aee0$0e040ca0$@oracle.com> Message-ID: <55A67EE2.4010005@oracle.com> There are lots of our hotspot/test tests that intentionally crash. Can you add this option to all of them? Coleen On 7/15/15 11:12 AM, Christian Tornqvist wrote: > Hi everyone, > > > > Please review this small change that removes a few test cases from > test/runtime/ErrorHandling/CreateCoredumpOnCrash.java and adds > -XX:-CreateCoredumpOnCrash to TestOnError.java. We've been seeing hangs in > these tests on Windows when running in our nightly. Most likely this is > caused by https://bugs.openjdk.java.net/browse/JDK-8051995, it's more likely > to happen when running tests concurrently which explains why it shows up in > our nightly runs. > > > > Webrev: > > http://cr.openjdk.java.net/~ctornqvi/webrev/8080733/webrev.00/ > > > > Bug: > > https://bugs.openjdk.java.net/browse/JDK-8080733 > > > > Thanks, > > Christian > From christian.tornqvist at oracle.com Wed Jul 15 16:11:00 2015 From: christian.tornqvist at oracle.com (Christian Tornqvist) Date: Wed, 15 Jul 2015 12:11:00 -0400 Subject: RFR(XS): 8080733 - [TESTBUG] several runtime/ErrorHandling/* tests time out on Windows In-Reply-To: <55A67EE2.4010005@oracle.com> References: <03e001d0bf10$af56aee0$0e040ca0$@oracle.com> <55A67EE2.4010005@oracle.com> Message-ID: <03f101d0bf18$d7cd9840$8768c8c0$@oracle.com> Hi Coleen, Yes, I went through the tests I could find that intentionally crashes the JVM. Only found one that didn't already have the option. Updated webrev: http://cr.openjdk.java.net/~ctornqvi/webrev/8080733/webrev.01/ Thanks, Christian -----Original Message----- From: hotspot-runtime-dev [mailto:hotspot-runtime-dev-bounces at openjdk.java.net] On Behalf Of Coleen Phillimore Sent: Wednesday, July 15, 2015 11:40 AM To: hotspot-runtime-dev at openjdk.java.net Subject: Re: RFR(XS): 8080733 - [TESTBUG] several runtime/ErrorHandling/* tests time out on Windows There are lots of our hotspot/test tests that intentionally crash. Can you add this option to all of them? Coleen On 7/15/15 11:12 AM, Christian Tornqvist wrote: > Hi everyone, > > > > Please review this small change that removes a few test cases from > test/runtime/ErrorHandling/CreateCoredumpOnCrash.java and adds > -XX:-CreateCoredumpOnCrash to TestOnError.java. We've been seeing > hangs in these tests on Windows when running in our nightly. Most > likely this is caused by > https://bugs.openjdk.java.net/browse/JDK-8051995, it's more likely to > happen when running tests concurrently which explains why it shows up in our nightly runs. > > > > Webrev: > > http://cr.openjdk.java.net/~ctornqvi/webrev/8080733/webrev.00/ > > > > Bug: > > https://bugs.openjdk.java.net/browse/JDK-8080733 > > > > Thanks, > > Christian > From coleen.phillimore at oracle.com Wed Jul 15 16:14:13 2015 From: coleen.phillimore at oracle.com (Coleen Phillimore) Date: Wed, 15 Jul 2015 12:14:13 -0400 Subject: RFR(XS): 8080733 - [TESTBUG] several runtime/ErrorHandling/* tests time out on Windows In-Reply-To: <03f101d0bf18$d7cd9840$8768c8c0$@oracle.com> References: <03e001d0bf10$af56aee0$0e040ca0$@oracle.com> <55A67EE2.4010005@oracle.com> <03f101d0bf18$d7cd9840$8768c8c0$@oracle.com> Message-ID: <55A686D5.90707@oracle.com> Thanks! Ship it! Coleen On 7/15/15 12:11 PM, Christian Tornqvist wrote: > Hi Coleen, > > Yes, I went through the tests I could find that intentionally crashes the > JVM. Only found one that didn't already have the option. > > Updated webrev: > http://cr.openjdk.java.net/~ctornqvi/webrev/8080733/webrev.01/ > > Thanks, > Christian > > -----Original Message----- > From: hotspot-runtime-dev > [mailto:hotspot-runtime-dev-bounces at openjdk.java.net] On Behalf Of Coleen > Phillimore > Sent: Wednesday, July 15, 2015 11:40 AM > To: hotspot-runtime-dev at openjdk.java.net > Subject: Re: RFR(XS): 8080733 - [TESTBUG] several runtime/ErrorHandling/* > tests time out on Windows > > > There are lots of our hotspot/test tests that intentionally crash. > Can you add this option to all of them? > > Coleen > > On 7/15/15 11:12 AM, Christian Tornqvist wrote: >> Hi everyone, >> >> >> >> Please review this small change that removes a few test cases from >> test/runtime/ErrorHandling/CreateCoredumpOnCrash.java and adds >> -XX:-CreateCoredumpOnCrash to TestOnError.java. We've been seeing >> hangs in these tests on Windows when running in our nightly. Most >> likely this is caused by >> https://bugs.openjdk.java.net/browse/JDK-8051995, it's more likely to >> happen when running tests concurrently which explains why it shows up in > our nightly runs. >> >> >> Webrev: >> >> http://cr.openjdk.java.net/~ctornqvi/webrev/8080733/webrev.00/ >> >> >> >> Bug: >> >> https://bugs.openjdk.java.net/browse/JDK-8080733 >> >> >> >> Thanks, >> >> Christian >> > From karen.kinnear at oracle.com Wed Jul 15 16:40:30 2015 From: karen.kinnear at oracle.com (Karen Kinnear) Date: Wed, 15 Jul 2015 12:40:30 -0400 Subject: RFR: 8087342: crash in klassItable_initialize_itable_for_interface Message-ID: Please review for JDK9: bug: https://bugs.openjdk.java.net/browse/JDK-8087342 webrev: http://cr.openjdk.java.net/~acorn/8087342.2/webrev/ Crash occurs in product when we should through IncompatibleClassChangeError. testing: internal tests: Defmeth (updated), SelectionResolution - product and fastdebug jprt jck jtreg/hotspot_all jtreg/jdk_streams test,noncolo.testlist, -atk quick (jck and macosx testing in progress) thanks, Karen From yumin.qi at oracle.com Wed Jul 15 17:37:35 2015 From: yumin.qi at oracle.com (Yumin Qi) Date: Wed, 15 Jul 2015 10:37:35 -0700 Subject: RFR: 8130115: REDO - Reduce Symbol::_identity_hash to 2 bytes Message-ID: <55A69A5F.3070504@oracle.com> Hi, This is redo for bug 8087143, in that push, it caused failure on Serviceability Agent failed to get type for "_identity_hash": mistakenly used JShortField for it, but in fact it still is CIntegerField. In this change, besides of the original change in hotspot/src, I add code to calculate identity_hash in hotspot/agent based on the changed in hotspot. Old webrev for 8087143: bug: https://bugs.openjdk.java.net/browse/JDK-8087143 webrev: http://cr.openjdk.java.net/~minqi/8087143/webrev03/ Summary: _identity_hash is an integer in Symbol (SymbolBase), it is used to compute hash bucket index by modulus division of table size. Currently in hotspot, no table size is more than 65535 so we can use short instead. For case with table size over 65535 we can use the first two bytes of symbol data to be as the upper 16 bits for the calculation but rare cases. New webrev for 8130115: bug: https://bugs.openjdk.java.net/browse/JDK-8130115 webrev: http://cr.openjdk.java.net/~minqi/8130115/webrev01/ Tests: JPRT, SA manual tests, -atk quick, jtreg hotspot/runtime Also internal large application used for hashtable data analysis --- the No. of loaded classes is big(over 19K), and tested with different bucket sizes including over 65535 to see the new algorithm for identity_hash calculation, result shows the consistency before and after the fix. Thanks Yumin From KAREN.KINNEAR at oracle.com Wed Jul 15 18:09:56 2015 From: KAREN.KINNEAR at oracle.com (Karen Kinnear) Date: Wed, 15 Jul 2015 14:09:56 -0400 Subject: RFR: 8025692: Add trace to find out what methods are used at runtime. In-Reply-To: <55A02D1E.10404@oracle.com> References: <5514C1CB.7020009@oracle.com> <55711388.4090402@oracle.com> <559F4B5B.60203@oracle.com> <559FF3F6.7060400@oracle.com> <55A02D1E.10404@oracle.com> Message-ID: <6D88F249-39A0-4F5E-AF5F-04FB971A93D2@oracle.com> Yumin, The code looks good. Thank you for the additional testing and test result analysis. thanks, Karen On Jul 10, 2015, at 4:37 PM, Yumin Qi wrote: > Thanks, Misha > > The failure of the failed 4 jobs, some of dependency error, which I think is dtrace, some are agent download encountered 'check sum' which I think is configuration problem. Still, the 4 running jobs just hang there and no progress --- may as you said, it is Windows problem. > > Yumin > > On 7/10/2015 9:33 AM, Mikhailo Seledtsov wrote: >> It is a known issue with Aurora; the RBT jobs get stuck on Win-x64. >> The fix's ETA is on 13-July during next Aurora patch deployemnt. >> >> You could still check status of testing on jobs that complete: >> - go to your main RBT status for your job (e.g. http://sla03.se.oracle.com:3000/rbt/rbt-mikhailo.seledtsov-hs-rt-20150709-1543-2147) >> >> For overall status, just see the summary under "Test Failures" tab >> >> For details on particular failures, do: >> - Under "Test Progress"-> x of Y jobs succeeded, click the "wheel" symbol -> Main >> - this will lead you to your Aurora main jobs page >> - there, you could click "Go to batch results", see a table of new failures, and look into them in detail >> >> Hope this helps, >> Misha >> >> >> On 7/9/2015 9:34 PM, Yumin Qi wrote: >>> Hi, Karen >>> >>> Just informed you that RBT testing for quick testing seems will not get back a completed result(I have tried several times those days). >>> After 11 hours, there still 4 jobs running: >>> >>> 26 of 34 succeeded, 4 failed, 4 still running. >>> >>> Those running jobs already run at least 6+ hours. >>> The 4 failed jobs are dtrace on linux-x64 which are OK, since dtrace is disabled on it. >>> >>> Also, I added -Xint to test case, and tested with jtreg on test/runtime showed no new failures found. >>> I am going to push the changes if you are OK with current result. Seems the testing with RBT will never come back. Updated webrev: >>> >>> http://cr.openjdk.java.net/~minqi/8025692/webrev02/ >>> >>> Thanks >>> Yumin >>> >>> On 6/18/2015 1:01 PM, Karen Kinnear wrote: >>>> Yumin, >>>> >>>> Thank you very much for the updates.And the PERM_REFCOUNT rather than -1 :-) >>>> Looks good. >>>> >>>> Thank you for testing this -Xint. If there is an easy way to add an -Xint line >>>> to the test that would be useful - but not critical. >>>> >>>> So I presume that the "aurora default test suites" includes: >>>> jcks, jtreg hotspot and Christian's new "quick" tests. >>>> >>>> thanks, >>>> Karen >>>> >>>> On Jun 4, 2015, at 11:12 PM, Yumin Qi wrote: >>>> >>>>> HI, All >>>>> >>>>> After several round of codereviews and discussion, now the second version is at: >>>>> http://cr.openjdk.java.net/~minqi/8025692/webrev02/ >>>>> >>>>> The flag names changed: >>>>> >>>>> TraceMethodUsge => LogTouchedMethods >>>>> PrintMethodUsageAtExit => PrintTouchedMethodsAtExit >>>>> >>>>> The two flags now are diagnostic flags. >>>>> >>>>> Also similar, there changed in related variable names. >>>>> Also fixed a flaw which is not found during last round of review: append new TouchedMethodRecord to end of hash bucket list. >>>>> >>>>> Make change to interpreter method entry generation(for both native and normal) to enable build_method_counter called. This is necessary since if run -Xint, the call will be skipped so our code will be skipped so no logging for touched methods. >>>>> >>>>> Added test case for jcmd: jcmd VM.print_touched_methods. >>>>> >>>>> Tests: JPRT, aurora default test suites (in progress). >>>>> >>>>> Thanks >>>>> Yumin >>>>> >>>>> >>>>> On 3/26/2015 7:34 PM, Yumin Qi wrote: >>>>>> Please review: >>>>>> >>>>>> bug: https://bugs.openjdk.java.net/browse/JDK-8025692 >>>>>> webrev: http://cr.openjdk.java.net/~minqi/8025692/webrev01/ >>>>>> >>>>>> Summary: Add two flags to help list all java methods called in runtime, this is also in product and can help CDS to rearrange methods in shared archive to avoid loading infrequent methods into memory. >>>>>> >>>>>> Tests: vm.runtime.quick.testlist, JPRT >>>>>> >>>>>> >>>>>> Thanks >>>>>> Yumin >>>>>> >>>>>> >>> >> > From daniel.daugherty at oracle.com Wed Jul 15 22:06:10 2015 From: daniel.daugherty at oracle.com (Daniel D. Daugherty) Date: Wed, 15 Jul 2015 16:06:10 -0600 Subject: RFR(XXS) 8131331: make new thread dump output line optional Message-ID: <55A6D952.5040208@oracle.com> Greetings, The fix for the following bug: JDK-8130448 thread dump improvements, comment additions, new diagnostics inspired by 8077392 https://bugs.openjdk.java.net/browse/JDK-8130448 needs a small tweak in order to pass some internal jstack tests. This work is tracked by the following bug: JDK-8131331 tmtools/jstack/locks/wait_interrupt and wait_notify fail due to wrong number of lock records https://bugs.openjdk.java.net/browse/JDK-8131331 Here is the webrev URL: http://cr.openjdk.java.net/~dcubed/8131331-webrev/0-jdk9-hs-rt/ Testing: - vm.tmtools Aurora Adhoc run (in process) - JPRT test job Thanks, in advance, for any comments, questions or suggestions. Dan From jeremymanson at google.com Wed Jul 15 22:39:31 2015 From: jeremymanson at google.com (Jeremy Manson) Date: Wed, 15 Jul 2015 15:39:31 -0700 Subject: RFR: 8079301: Some command line options not settable via JAVA_TOOL_OPTIONS In-Reply-To: <55A5705D.9080500@oracle.com> References: <554839B4.3020800@oracle.com> <559D237C.2060702@oracle.com> <559EED17.4060109@oracle.com> <559FAE4B.5060505@oracle.com> <559FBFFB.3060206@oracle.com> <55A01184.7080102@oracle.com> <55A0361B.2060307@oracle.com> <55A2794E.20502@oracle.com> <55A56713.8090308@oracle.com> <55A5705D.9080500@oracle.com> Message-ID: Sorry about the delay. We were finally able to get JDK8 to the point where we could use it without our services falling apart, so we rolled it forward at Google. I've spent a lot of the last week putting out fires. Also, house renovations. :/ I think that it is long past time for Hotspot to start using the RAII classes everyone else in the world adopted years ago, and will be happy to implement one for this case. It was pretty hard for me to avoid the temptation when I was writing this code in the first place, but the general lack of them throughout the codebase made me think that they were unpopular. Some crazy day we might even consider rolling forward to the 21st century and starting to use unique_ptr in the source base. I'll ping the thread when there's a new rev. Jeremy On Tue, Jul 14, 2015 at 1:26 PM, Dmitry Dmitriev wrote: > Hello Coleen, > > Yes, I like your approach. It seems more accurate. Thus, desctructor can > be something like that: > ~EnvInitArgs() { > if( _args.options != NULL ) { > for (int i = 0; i < _args.nOptions; i++) { > os::free(_args.options[i].optionString); > } > FREE_C_HEAP_ARRAY(JavaVMOption, _args.options); > } > } > > Jeremy, what you think about that? > > Thank you, > Dmitry > > > On 14.07.2015 22:46, Coleen Phillimore wrote: > > > > On 7/12/15 10:27 AM, Dmitry Dmitriev wrote: > > Hello Coleen, > > I think that adding destructor not help with this, since all this code > with free_memory_for_vm_init_args is a special workaround for processing > options in env variables and not applied to the options from command line > which passed in 'args' to the Arguments::parse function. > > > I see - JavaVMInitArgs is a C struct in jni.h > > If you wrap JavaVMInitArgs for the options for environment variables in a > scoped object that calls the destructor to clean up JavaVMInitArgs, this > would eliminate all these extra calls that you have to make to > free_memory_for_vm_init_args: > > class EnvInitArgs : public StackObj { > JavaVMInitArgs _args; > public: > ~EnvInitArgs() { > // Code to conditionally delete option memory that you have in > free_memory_for_vm_init_args > } > JavaVMInitArgs* init_args() const { return &_args; } > } > > You can put this in the constructor: > > + vm_args->version = JNI_VERSION_1_2;+ vm_args->options = NULL;+ vm_args->nOptions = 0;+ vm_args->ignoreUnrecognized = false; > > I think this would be neater than having to check for JNI_OK and call free > everywhere. > > Coleen > > > > About match_special_option_and_act. Probably it can be processed in the > following way(raw idea): > code = match_special_option_and_act(&java_tool_options_args, &flags_file); > if (code == JNI_OK) { > // call next > code = match_special_option_and_act(args, &flags_file); > } > > if (code == JNI_OK) { > // call next > code = match_special_option_and_act(&java_options_args, &flags_file); > } > > if (code != JNI_OK) { > free_memory_for_vm_init_args(&java_tool_options_args); > free_memory_for_vm_init_args(&java_options_args); > return code; > } > > Thanks, > Dmitry > > On 11.07.2015 0:16, Coleen Phillimore wrote: > > > Hi, I have a couple of suggestions. > > Can you add a destructor to JavaVMInitArgs which will delete the options > things if they exist? Then you won't need these > free_memory_for_vm_init_args functions. I think this would work. > > Secondly, I was also going to comment about match_special_option_and_act > not using it's return value. The destructor code would make this less > cumbersome. I like the refactoring though. > > Thanks, > Coleen > > On 7/10/15 2:40 PM, Dmitry Dmitriev wrote: > > Jeremy, thank you for fixing that! Please, see my comments inline for 2 > item and one more comment. > > On 10.07.2015 20:15, Jeremy Manson wrote: > > Thanks for the detailed look, Dmitry. I have taken your advice, with a > couple of exceptions: > > 1) I named the method free_memory_for_vm_init_args instead of > free_memory_for_environment_variables. > 2) I did not free the memory in 3661-3663 or in 3679-3681, because those > are error paths where the memory may not have been allocated in the first > place. So freeing it might lead to a crash. > > Yes, you are right. But I think we can guard from this by adding check for > args->options in new free_memory_for_vm_init_args function and free memory > in all execution paths. If args->options is not NULL, then memory is > allocated and must be freed: > > 3485 static void free_memory_for_vm_init_args(JavaVMInitArgs* args) { > 3486 if( args->options != NULL ) { > 3487 for (int i = 0; i < args->nOptions; i++) { > 3488 os::free(args->options[i].optionString); > 3489 } > 3490 FREE_C_HEAP_ARRAY(JavaVMOption, args->options); > 3491 } > 3492 } > > As I see you add free memory for error paths at lines(webrev.04) 3668-3671 > and 3687-3691. Thus, with that guard you can add two calls to > free_memory_for_vm_init_args function before "return JNI_EINVAL;" on line > 3696: > > 3693 #ifdef ASSERT > 3694 // Parse default .hotspotrc settings file > 3695 if (!process_settings_file(".hotspotrc", false, > args->ignoreUnrecognized)) { > 3696 return JNI_EINVAL; > 3697 } > 3698 #else > > > And one more comment. Unfortunately I oversight this before... You not > check return value from 'match_special_option_and_act' new function on > lines 3673-3675, but in one case it can return error(JNI_ERR) when > "-XX:NativeMemoryTracking" is specified and INCLUDE_NMT is not defined. > Thus, I think that check for return value should be added(with freeing > memory for env variables in case of error). > > Thank you, > Dmitry > > > New Rev: > > http://cr.openjdk.java.net/~jmanson/8079301/webrev.04/ > > > > Jeremy > > On Fri, Jul 10, 2015 at 5:52 AM, Dmitry Dmitriev < > dmitry.dmitriev at oracle.com > > wrote: > > Jeremy, > > Two additional comments which I didn't catch earlier... > > 1) Order of processing command line options is > following(Arguments::parse_vm_init_args function): options from > JAVA_TOOL_OPTIONS environment variable, then options from command > line and then options from _JAVA_OPTIONS environment variable. And > last argument wins! > > You not change this order in Arguments::parse_vm_init_args > function, but it seems that order in several other places is changed. > > Lines 3665-3667: > > 3665 match_special_option_and_act(args, &flags_file); > 3666 match_special_option_and_act(&java_tool_options_args, > &flags_file); > 3667 match_special_option_and_act(&java_options_args, &flags_file); > > Here we see that order is following: options from command line, > then options from JAVA_TOOL_OPTIONS environment variable and then > options from _JAVA_OPTIONS environment variable. Thus, in this > case "-XX:+IgnoreUnrecognizedVMOptions" option in > JAVA_TOOL_OPTIONS environment variable will have bigger priority > than in command line(last argument wins), but this is differ from > processing options in Arguments::parse_vm_init_args function. > Thus, I think that you need to swap 3665 and 3666 lines: > > 3665 match_special_option_and_act(&java_tool_options_args, > &flags_file); > 3666 match_special_option_and_act(args, &flags_file); > 3667 match_special_option_and_act(&java_options_args, &flags_file); > > Similar situation on lines 3696-3700: > > 3696 if (PrintVMOptions) { > 3697 print_options(args); > 3698 print_options(&java_tool_options_args); > 3699 print_options(&java_options_args); > 3700 } > > Command line options are printed before options from > JAVA_TOOL_OPTIONS environment variable. Thus, I think that you > need to swap 3697 and 3698 lines: > > 3696 if (PrintVMOptions) { > 3697 print_options(&java_tool_options_args); > 3698 print_options(args); > 3699 print_options(&java_options_args); > 3700 } > > > 2) One more thing about error processing :) > I think it will be great to free allocated memory for environment > variables when error occured on lines 3661-3663, 3679-3681 and > 3685-3687. > My suggestion is to add some static function which free memory for > env variables, something like that: > static void free_memory_for_environment_variables( JavaVMInitArgs > *options_args ) { > for (int i = 0; i < options_args->nOptions; i++) { > os::free(options_args->options[i].optionString); > } > FREE_C_HEAP_ARRAY(JavaVMOption, options_args->options); > } > > And change lines 3661-3663 to following: > > 3661 if (code != JNI_OK) { > 3662 free_memory_for_environment_variables(&java_tool_options_args); > 3663 return code; > 3664 } > > Lines 3679-3681 to following: > > 3679 if (!process_settings_file(flags_file, true, > args->ignoreUnrecognized)) { > 3680 free_memory_for_environment_variables(&java_tool_options_args); > 3681 free_memory_for_environment_variables(&java_options_args); > 3682 return JNI_EINVAL; > 3683 } > > Lines 3685-3687 to following: > > 3685 if (!process_settings_file(".hotspotrc", false, > args->ignoreUnrecognized)) { > 3680 free_memory_for_environment_variables(&java_tool_options_args); > 3681 free_memory_for_environment_variables(&java_options_args); > 3686 return JNI_EINVAL; > 3687 } > > And lines 3706-3715 to following: > > 3706 // Done with the envvars > 3707 free_memory_for_environment_variables(&java_tool_options_args); > 3708 free_memory_for_environment_variables(&java_options_args); > > > Thank you, > Dmitry > > > On 10.07.2015 14:36, Dmitry Dmitriev wrote: > > Hello Jeremy, > > Thank you for fixing that! But in this case we still have > minor issue when quotes processing failed(lines 3438-3444). > Here is my suggestion: leave 'while' cycle(lines 3423-3462) as > I was in your previous webrev(without 'start' and etc.) and > call strdup when copy 'options' to 'options_arr' on lines > 3472-3474, i.e. make lines 3472-3474 like this: > > 3472 for (int i = 0; i < options->length(); i++) { > 3473 options_arr[i] = options->at(i); > 3474 options_arr[i].optionString = > os::strdup(options_arr[i].optionString); > 3475 } > > What you think about that? > > Regards, > Dmitry > > On 10.07.2015 3:23, Jeremy Manson wrote: > > Hey Dmitry, > > Thanks for looking at it. The leak was deliberate (under > the theory that the command line flags were leaked, too), > but it was silly that I didn't fix it. > > Anyway, fixed. See: > > http://cr.openjdk.java.net/~jmanson/8079301/webrev.03 > > > > > > Jeremy > > On Thu, Jul 9, 2015 at 2:52 PM, Dmitry Dmitriev > > > > > >> wrote: > > Hello Jeremy, > > Correct me if I am wrong, but I see small memory leak > in your > implementation. > In Arguments::parse_options_environment_variable > function memory > for 'buffer' allocated by strdup function on line > 3415, but now it > not freed in this function because data from this > buffer is used > later. On the other hand when we are done with env > variables, we > free only options array(lines 3703-3705) and not free > previously > allocated memory for 'buffer' because we lost track > for it. > > Thanks, > Dmitry > > > On 09.07.2015 21:20, Jeremy Manson wrote: > > Thanks for looking at this, Coleen. > > I merged this with the latest version of hs-rt, > but Ron is or > I am going to > have to do some merging for 8061999. The changes > are relatively > orthogonal, but they touch a couple of the same > places. How > far away is > Ron's checkin? > > Updated webrev: > > http://cr.openjdk.java.net/~jmanson/8079301/webrev.01/ > > > > > > Updated test: > > http://cr.openjdk.java.net/~jmanson/8079301t/webrev.01/ > > > > > > (Mild complaining on my part: the conflicts > wouldn't have been > an issue if > someone had looked at this two months ago, when I > first > asked. I suspect > Ron hadn't even started his change at that > point. And if external > developers were able to submit changes to Hotspot, > we wouldn't > have had to > bother Oracle engineers at all. Neither of these > is your > fault or your > problem, of course - I'm grateful you were able to > take a look.) > > Jeremy > > On Wed, Jul 8, 2015 at 6:19 AM, Coleen Phillimore < > coleen.phillimore at oracle.com > > > > >> > wrote: > > I'll sponsor it but can you repost the RFR? > > There has been a fair bit of work to command line > processing lately so I'd > like to have the others look at it too. Have > you merged > this up with the > latest version of hs-rt repository and were there > conflicts? Also, have > you looked at the RFR: > > "Open code review for 8061999 Enhance VM > option parsing to > allow options > to be specified" > > and are there conflicts with this? > > The hotspot change looks good to me. > > > > http://cr.openjdk.java.net/~jmanson/8079301t/webrev.00/test/com/sun/management/HotSpotDiagnosticMXBean/CheckOrigin.java.udiff.html > > > > > > > > "UseCerealGC" LOL > Can you use a different option than > PrintOopAddress in > this test? I don't > know why this command line option exists or > would be > useful for, and seems > to be a good candidate for removal. If you > need a valid > argument, that is > unlikely to go away, TraceExceptions would be > good. > > Thanks, > Coleen > > > On 7/7/15 8:00 PM, Jeremy Manson wrote: > > No love? Is there a code owner here I > should pester > more directly? > > Jeremy > > On Fri, Jun 26, 2015 at 3:00 PM, Martin > Buchholz > < > mailto:martinrb at google.com > >> > wrote: > > As usual with Google patches, they are > in use > locally. This one has been > > stable for a while without complaints. > Please > sponsor. > > On Fri, Jun 26, 2015 at 1:53 PM, > Jeremy Manson > < > jeremymanson at google.com > > > >> > wrote: > > All this talk about > IgnoreUnrecognizedVMOptions > reminded me that this > > review is still outstanding. Any > takers? > > Jeremy > > On Tue, May 5, 2015 at 10:01 AM, > Jeremy Manson > > > > > wrote: > > Hi David, > > Thanks for taking a look. > > On Mon, May 4, 2015 at 8:32 > PM, David > Holmes > > > > >> > > wrote: > > Hi Jeremy, > > On 5/05/2015 6:51 AM, > Jeremy Manson wrote: > > Not sure who might be > willing to > sponsor this. David? You > did the > > last > one. :) > > Might be a while > before I can > get to it. I did have > a quick look > > (and > will need a longer one). > > I understand. I'm just happy it's > possible to upstream this stuff at > all[1]. > > [1] With the eternal caveat > that I'd be > happier if we didn't *have* to > go through you folks, but > we've learned to > live with it. > > > > Context: A number of > command line > options are not settable via > > JAVA_TOOL_OPTIONS and _JAVA_OPTIONS: > > - PrintVMOptions > > So you have changed the > semantics of this to > print out the > options > > from > the command-line and each > of the two > env vars. Seems reasonable but > may be > better to know which > option came from > where as we can now see > the same > option (or conflicting > variants > thereof) multiple times. > > I'd be happy to do > this. Any > preferred syntax? Does someone > > actually > own this feature? > > I'm unclear what the current > processing > order is for the different > > sources of options, and > whether the > changes affect that order? > > Nope. I go through sad > contortions > to keep the processing > order the > > same. It's JAVA_TOOL_OPTIONS, > then > command line, then _JAVA_OPTIONS. > See > lines 2549-2567. > > > - > IgnoreUnrecognizedVMOptions > > - PrintFlagsInitial > > Unclear what > "initial" actually > means - is it the default? > > More or less. If you stick, > for example, > IgnoreUnrecognizedVMOptions > in > there first, it will get > printed out as > "true". I haven't really > changed > the semantics here either - > I've just > added processing of the envvars. > > - NativeMemoryTracking > > - PrintFlagsWithComments > > This is because these > flags have > to be processed before > processing > other > flags, and no one ever > bothered to > do that for the flags > coming from > environment > variables. This patch > fixes that problem. > > I have a test, but it is a > modification to a JDK > test instead > of a HS > test, > so it can go in > separately (I guess). > > They can be pushed > together to > different repos in the > same forest. > > Okay. Here's the test > change: > > http://cr.openjdk.java.net/~jmanson/8079301t/webrev.00/ > > > > > > > As I said I'll have to get > back to this. > And hopefully someone else in > > runtime will take a good > look as well ;-) > > I'd be happy to toss it > over to > whomever owns this, if anyone. > > Thanks! > > Jeremy > > > > Bug: > > https://bugs.openjdk.java.net/browse/JDK-8079301 > > Webrev: > http://cr.openjdk.java.net/~jmanson/8079301/webrev.00/ > > > > > > Jeremy > > > > > > > > > > > > > > From david.holmes at oracle.com Wed Jul 15 22:41:39 2015 From: david.holmes at oracle.com (David Holmes) Date: Thu, 16 Jul 2015 08:41:39 +1000 Subject: RFR(XXS) 8131331: make new thread dump output line optional In-Reply-To: <55A6D952.5040208@oracle.com> References: <55A6D952.5040208@oracle.com> Message-ID: <55A6E1A3.5040204@oracle.com> Looks good Dan! Thanks, David On 16/07/2015 8:06 AM, Daniel D. Daugherty wrote: > Greetings, > > The fix for the following bug: > > JDK-8130448 thread dump improvements, comment additions, new > diagnostics inspired by 8077392 > https://bugs.openjdk.java.net/browse/JDK-8130448 > > needs a small tweak in order to pass some internal jstack tests. > This work is tracked by the following bug: > > JDK-8131331 tmtools/jstack/locks/wait_interrupt and wait_notify > fail due to wrong number of lock records > https://bugs.openjdk.java.net/browse/JDK-8131331 > > Here is the webrev URL: > > http://cr.openjdk.java.net/~dcubed/8131331-webrev/0-jdk9-hs-rt/ > > Testing: > > - vm.tmtools Aurora Adhoc run (in process) > - JPRT test job > > Thanks, in advance, for any comments, questions or suggestions. > > Dan From daniel.daugherty at oracle.com Wed Jul 15 22:48:51 2015 From: daniel.daugherty at oracle.com (Daniel D. Daugherty) Date: Wed, 15 Jul 2015 16:48:51 -0600 Subject: RFR(XXS) 8131331: make new thread dump output line optional In-Reply-To: <55A6E1A3.5040204@oracle.com> References: <55A6D952.5040208@oracle.com> <55A6E1A3.5040204@oracle.com> Message-ID: <55A6E353.5030901@oracle.com> Thanks for the fast review! Very much faster than waiting for all the test jobs to finish :-) Current test results for vm.tmtools is: Linux X86 - 116/116 pass Linux X64 - 116/116 pass Solaris SPARC - 116/116 pass Solaris X64 - 116/116 pass Have 2 failures for each of those configs in my baseline testing from earlier this AM. I'm moving forward with this fix under the "trivial" rules... :-) Dan On 7/15/15 4:41 PM, David Holmes wrote: > Looks good Dan! > > Thanks, > David > > On 16/07/2015 8:06 AM, Daniel D. Daugherty wrote: >> Greetings, >> >> The fix for the following bug: >> >> JDK-8130448 thread dump improvements, comment additions, new >> diagnostics inspired by 8077392 >> https://bugs.openjdk.java.net/browse/JDK-8130448 >> >> needs a small tweak in order to pass some internal jstack tests. >> This work is tracked by the following bug: >> >> JDK-8131331 tmtools/jstack/locks/wait_interrupt and wait_notify >> fail due to wrong number of lock records >> https://bugs.openjdk.java.net/browse/JDK-8131331 >> >> Here is the webrev URL: >> >> http://cr.openjdk.java.net/~dcubed/8131331-webrev/0-jdk9-hs-rt/ >> >> Testing: >> >> - vm.tmtools Aurora Adhoc run (in process) >> - JPRT test job >> >> Thanks, in advance, for any comments, questions or suggestions. >> >> Dan From david.holmes at oracle.com Wed Jul 15 23:56:45 2015 From: david.holmes at oracle.com (David Holmes) Date: Thu, 16 Jul 2015 09:56:45 +1000 Subject: RFR(XS): 8080733 - [TESTBUG] several runtime/ErrorHandling/* tests time out on Windows In-Reply-To: <03e001d0bf10$af56aee0$0e040ca0$@oracle.com> References: <03e001d0bf10$af56aee0$0e040ca0$@oracle.com> Message-ID: <55A6F33D.6080207@oracle.com> Hi Christian, Doesn't this effectively remove all testing of +CreateCoreDumpOnCrash? David On 16/07/2015 1:12 AM, Christian Tornqvist wrote: > Hi everyone, > > > > Please review this small change that removes a few test cases from > test/runtime/ErrorHandling/CreateCoredumpOnCrash.java and adds > -XX:-CreateCoredumpOnCrash to TestOnError.java. We've been seeing hangs in > these tests on Windows when running in our nightly. Most likely this is > caused by https://bugs.openjdk.java.net/browse/JDK-8051995, it's more likely > to happen when running tests concurrently which explains why it shows up in > our nightly runs. > > > > Webrev: > > http://cr.openjdk.java.net/~ctornqvi/webrev/8080733/webrev.00/ > > > > Bug: > > https://bugs.openjdk.java.net/browse/JDK-8080733 > > > > Thanks, > > Christian > From david.holmes at oracle.com Thu Jul 16 00:08:00 2015 From: david.holmes at oracle.com (David Holmes) Date: Thu, 16 Jul 2015 10:08:00 +1000 Subject: RFR: 8087342: crash in klassItable_initialize_itable_for_interface In-Reply-To: References: Message-ID: <55A6F5E0.7020403@oracle.com> Hi Karen, On 16/07/2015 2:40 AM, Karen Kinnear wrote: > > Please review for JDK9: > > bug: https://bugs.openjdk.java.net/browse/JDK-8087342 > webrev: http://cr.openjdk.java.net/~acorn/8087342.2/webrev/ > > Crash occurs in product when we should through IncompatibleClassChangeError. Based on the description in the bug report and copious amount of rewritten comments, these changes seem quite reasonable - though I can't claim to be an expert in the details here. Bottom line is we need to skip private interface methods when checking other aspects. Thanks, David > testing: > internal tests: Defmeth (updated), SelectionResolution - product and fastdebug > jprt > jck > jtreg/hotspot_all > jtreg/jdk_streams > test,noncolo.testlist, -atk quick > > (jck and macosx testing in progress) > > thanks, > Karen > From lois.foltan at oracle.com Thu Jul 16 00:12:39 2015 From: lois.foltan at oracle.com (Lois Foltan) Date: Wed, 15 Jul 2015 20:12:39 -0400 Subject: RFR: 8087342: crash in klassItable_initialize_itable_for_interface In-Reply-To: References: Message-ID: <55A6F6F7.6040508@oracle.com> On 7/15/2015 12:40 PM, Karen Kinnear wrote: > Please review for JDK9: > > bug: https://bugs.openjdk.java.net/browse/JDK-8087342 > webrev: http://cr.openjdk.java.net/~acorn/8087342.2/webrev/ > > Crash occurs in product when we should through IncompatibleClassChangeError. Hi Karen, I think this looks good and I really like how straight forward klassVtable::is_miranda now is. Some minor clarification comments: - src/share/vm/instanceKlass.cpp comments for the find_local_method* were changed to state: +// note that the local methods array can have up to one overpass, one static +// and one instance (private or not) with the same name/signature I think there are two combinations that the code depends on not occurring, they are: 1. all 3 are in existence in the local methods array (one overpass, one static and one instance) 2. the combination of one static and one instance (private or not) In other words there has to be an overpass to cause more than one method with the same name/signature within the local methods array. And it is either an overpass and a static or an overpass and an instance, but not all 3. Correct me if I am wrong. - src/share/vm/oops/klassVtable.cpp Thank you for adding the improved comments ahead of is_miranda. My read is that overpass methods are not considered miranda methods and I agree with that statement. Yet, Klass::find_overpass is specified in the code. I think the code is correct, but based on the comment I would have thought Klass::skip_overpass should have been specified? Much like skip_static and skip_private. So based on your later statement that "Abstract methods may already have been handled via overpasses" it implies that overpass methods, although not miranda methods, can satisfy or stand in for an miranda during pass 2. So they must be found, did I understand that correctly? Again, looks good. I don't need to see another review. My comments were merely clarification based. Thanks, Lois > > testing: > internal tests: Defmeth (updated), SelectionResolution - product and fastdebug > jprt > jck > jtreg/hotspot_all > jtreg/jdk_streams > test,noncolo.testlist, -atk quick > > (jck and macosx testing in progress) > > thanks, > Karen > From jeremymanson at google.com Thu Jul 16 00:27:17 2015 From: jeremymanson at google.com (Jeremy Manson) Date: Wed, 15 Jul 2015 17:27:17 -0700 Subject: RFR: 8079301: Some command line options not settable via JAVA_TOOL_OPTIONS In-Reply-To: References: <554839B4.3020800@oracle.com> <559D237C.2060702@oracle.com> <559EED17.4060109@oracle.com> <559FAE4B.5060505@oracle.com> <559FBFFB.3060206@oracle.com> <55A01184.7080102@oracle.com> <55A0361B.2060307@oracle.com> <55A2794E.20502@oracle.com> <55A56713.8090308@oracle.com> <55A5705D.9080500@oracle.com> Message-ID: New rev: http://cr.openjdk.java.net/~jmanson/8079301/webrev.05/ Thanks for all the attention! On Wed, Jul 15, 2015 at 3:39 PM, Jeremy Manson wrote: > Sorry about the delay. We were finally able to get JDK8 to the point > where we could use it without our services falling apart, so we rolled it > forward at Google. I've spent a lot of the last week putting out fires. > Also, house renovations. :/ > > I think that it is long past time for Hotspot to start using the RAII > classes everyone else in the world adopted years ago, and will be happy to > implement one for this case. It was pretty hard for me to avoid the > temptation when I was writing this code in the first place, but the general > lack of them throughout the codebase made me think that they were unpopular. > > Some crazy day we might even consider rolling forward to the 21st century > and starting to use unique_ptr in the source base. > > I'll ping the thread when there's a new rev. > > Jeremy > > On Tue, Jul 14, 2015 at 1:26 PM, Dmitry Dmitriev < > dmitry.dmitriev at oracle.com> wrote: > >> Hello Coleen, >> >> Yes, I like your approach. It seems more accurate. Thus, desctructor can >> be something like that: >> ~EnvInitArgs() { >> if( _args.options != NULL ) { >> for (int i = 0; i < _args.nOptions; i++) { >> os::free(_args.options[i].optionString); >> } >> FREE_C_HEAP_ARRAY(JavaVMOption, _args.options); >> } >> } >> >> Jeremy, what you think about that? >> >> Thank you, >> Dmitry >> >> >> On 14.07.2015 22:46, Coleen Phillimore wrote: >> >> >> >> On 7/12/15 10:27 AM, Dmitry Dmitriev wrote: >> >> Hello Coleen, >> >> I think that adding destructor not help with this, since all this code >> with free_memory_for_vm_init_args is a special workaround for processing >> options in env variables and not applied to the options from command line >> which passed in 'args' to the Arguments::parse function. >> >> >> I see - JavaVMInitArgs is a C struct in jni.h >> >> If you wrap JavaVMInitArgs for the options for environment variables in a >> scoped object that calls the destructor to clean up JavaVMInitArgs, this >> would eliminate all these extra calls that you have to make to >> free_memory_for_vm_init_args: >> >> class EnvInitArgs : public StackObj { >> JavaVMInitArgs _args; >> public: >> ~EnvInitArgs() { >> // Code to conditionally delete option memory that you have in >> free_memory_for_vm_init_args >> } >> JavaVMInitArgs* init_args() const { return &_args; } >> } >> >> You can put this in the constructor: >> >> + vm_args->version = JNI_VERSION_1_2;+ vm_args->options = NULL;+ vm_args->nOptions = 0;+ vm_args->ignoreUnrecognized = false; >> >> I think this would be neater than having to check for JNI_OK and call >> free everywhere. >> >> Coleen >> >> >> >> About match_special_option_and_act. Probably it can be processed in the >> following way(raw idea): >> code = match_special_option_and_act(&java_tool_options_args, >> &flags_file); >> if (code == JNI_OK) { >> // call next >> code = match_special_option_and_act(args, &flags_file); >> } >> >> if (code == JNI_OK) { >> // call next >> code = match_special_option_and_act(&java_options_args, &flags_file); >> } >> >> if (code != JNI_OK) { >> free_memory_for_vm_init_args(&java_tool_options_args); >> free_memory_for_vm_init_args(&java_options_args); >> return code; >> } >> >> Thanks, >> Dmitry >> >> On 11.07.2015 0:16, Coleen Phillimore wrote: >> >> >> Hi, I have a couple of suggestions. >> >> Can you add a destructor to JavaVMInitArgs which will delete the options >> things if they exist? Then you won't need these >> free_memory_for_vm_init_args functions. I think this would work. >> >> Secondly, I was also going to comment about match_special_option_and_act >> not using it's return value. The destructor code would make this less >> cumbersome. I like the refactoring though. >> >> Thanks, >> Coleen >> >> On 7/10/15 2:40 PM, Dmitry Dmitriev wrote: >> >> Jeremy, thank you for fixing that! Please, see my comments inline for 2 >> item and one more comment. >> >> On 10.07.2015 20:15, Jeremy Manson wrote: >> >> Thanks for the detailed look, Dmitry. I have taken your advice, with a >> couple of exceptions: >> >> 1) I named the method free_memory_for_vm_init_args instead of >> free_memory_for_environment_variables. >> 2) I did not free the memory in 3661-3663 or in 3679-3681, because those >> are error paths where the memory may not have been allocated in the first >> place. So freeing it might lead to a crash. >> >> Yes, you are right. But I think we can guard from this by adding check >> for args->options in new free_memory_for_vm_init_args function and free >> memory in all execution paths. If args->options is not NULL, then memory is >> allocated and must be freed: >> >> 3485 static void free_memory_for_vm_init_args(JavaVMInitArgs* args) { >> 3486 if( args->options != NULL ) { >> 3487 for (int i = 0; i < args->nOptions; i++) { >> 3488 os::free(args->options[i].optionString); >> 3489 } >> 3490 FREE_C_HEAP_ARRAY(JavaVMOption, args->options); >> 3491 } >> 3492 } >> >> As I see you add free memory for error paths at lines(webrev.04) >> 3668-3671 and 3687-3691. Thus, with that guard you can add two calls to >> free_memory_for_vm_init_args function before "return JNI_EINVAL;" on line >> 3696: >> >> 3693 #ifdef ASSERT >> 3694 // Parse default .hotspotrc settings file >> 3695 if (!process_settings_file(".hotspotrc", false, >> args->ignoreUnrecognized)) { >> 3696 return JNI_EINVAL; >> 3697 } >> 3698 #else >> >> >> And one more comment. Unfortunately I oversight this before... You not >> check return value from 'match_special_option_and_act' new function on >> lines 3673-3675, but in one case it can return error(JNI_ERR) when >> "-XX:NativeMemoryTracking" is specified and INCLUDE_NMT is not defined. >> Thus, I think that check for return value should be added(with freeing >> memory for env variables in case of error). >> >> Thank you, >> Dmitry >> >> >> New Rev: >> >> http://cr.openjdk.java.net/~jmanson/8079301/webrev.04/ >> >> >> >> Jeremy >> >> On Fri, Jul 10, 2015 at 5:52 AM, Dmitry Dmitriev < >> dmitry.dmitriev at oracle.com >> > wrote: >> >> Jeremy, >> >> Two additional comments which I didn't catch earlier... >> >> 1) Order of processing command line options is >> following(Arguments::parse_vm_init_args function): options from >> JAVA_TOOL_OPTIONS environment variable, then options from command >> line and then options from _JAVA_OPTIONS environment variable. And >> last argument wins! >> >> You not change this order in Arguments::parse_vm_init_args >> function, but it seems that order in several other places is changed. >> >> Lines 3665-3667: >> >> 3665 match_special_option_and_act(args, &flags_file); >> 3666 match_special_option_and_act(&java_tool_options_args, >> &flags_file); >> 3667 match_special_option_and_act(&java_options_args, &flags_file); >> >> Here we see that order is following: options from command line, >> then options from JAVA_TOOL_OPTIONS environment variable and then >> options from _JAVA_OPTIONS environment variable. Thus, in this >> case "-XX:+IgnoreUnrecognizedVMOptions" option in >> JAVA_TOOL_OPTIONS environment variable will have bigger priority >> than in command line(last argument wins), but this is differ from >> processing options in Arguments::parse_vm_init_args function. >> Thus, I think that you need to swap 3665 and 3666 lines: >> >> 3665 match_special_option_and_act(&java_tool_options_args, >> &flags_file); >> 3666 match_special_option_and_act(args, &flags_file); >> 3667 match_special_option_and_act(&java_options_args, &flags_file); >> >> Similar situation on lines 3696-3700: >> >> 3696 if (PrintVMOptions) { >> 3697 print_options(args); >> 3698 print_options(&java_tool_options_args); >> 3699 print_options(&java_options_args); >> 3700 } >> >> Command line options are printed before options from >> JAVA_TOOL_OPTIONS environment variable. Thus, I think that you >> need to swap 3697 and 3698 lines: >> >> 3696 if (PrintVMOptions) { >> 3697 print_options(&java_tool_options_args); >> 3698 print_options(args); >> 3699 print_options(&java_options_args); >> 3700 } >> >> >> 2) One more thing about error processing :) >> I think it will be great to free allocated memory for environment >> variables when error occured on lines 3661-3663, 3679-3681 and >> 3685-3687. >> My suggestion is to add some static function which free memory for >> env variables, something like that: >> static void free_memory_for_environment_variables( JavaVMInitArgs >> *options_args ) { >> for (int i = 0; i < options_args->nOptions; i++) { >> os::free(options_args->options[i].optionString); >> } >> FREE_C_HEAP_ARRAY(JavaVMOption, options_args->options); >> } >> >> And change lines 3661-3663 to following: >> >> 3661 if (code != JNI_OK) { >> 3662 free_memory_for_environment_variables(&java_tool_options_args); >> 3663 return code; >> 3664 } >> >> Lines 3679-3681 to following: >> >> 3679 if (!process_settings_file(flags_file, true, >> args->ignoreUnrecognized)) { >> 3680 free_memory_for_environment_variables(&java_tool_options_args); >> 3681 free_memory_for_environment_variables(&java_options_args); >> 3682 return JNI_EINVAL; >> 3683 } >> >> Lines 3685-3687 to following: >> >> 3685 if (!process_settings_file(".hotspotrc", false, >> args->ignoreUnrecognized)) { >> 3680 free_memory_for_environment_variables(&java_tool_options_args); >> 3681 free_memory_for_environment_variables(&java_options_args); >> 3686 return JNI_EINVAL; >> 3687 } >> >> And lines 3706-3715 to following: >> >> 3706 // Done with the envvars >> 3707 free_memory_for_environment_variables(&java_tool_options_args); >> 3708 free_memory_for_environment_variables(&java_options_args); >> >> >> Thank you, >> Dmitry >> >> >> On 10.07.2015 14:36, Dmitry Dmitriev wrote: >> >> Hello Jeremy, >> >> Thank you for fixing that! But in this case we still have >> minor issue when quotes processing failed(lines 3438-3444). >> Here is my suggestion: leave 'while' cycle(lines 3423-3462) as >> I was in your previous webrev(without 'start' and etc.) and >> call strdup when copy 'options' to 'options_arr' on lines >> 3472-3474, i.e. make lines 3472-3474 like this: >> >> 3472 for (int i = 0; i < options->length(); i++) { >> 3473 options_arr[i] = options->at(i); >> 3474 options_arr[i].optionString = >> os::strdup(options_arr[i].optionString); >> 3475 } >> >> What you think about that? >> >> Regards, >> Dmitry >> >> On 10.07.2015 3:23, Jeremy Manson wrote: >> >> Hey Dmitry, >> >> Thanks for looking at it. The leak was deliberate (under >> the theory that the command line flags were leaked, too), >> but it was silly that I didn't fix it. >> >> Anyway, fixed. See: >> >> http://cr.openjdk.java.net/~jmanson/8079301/webrev.03 >> >> >> >> >> >> Jeremy >> >> On Thu, Jul 9, 2015 at 2:52 PM, Dmitry Dmitriev >> > >> >> > >> >> >> wrote: >> >> Hello Jeremy, >> >> Correct me if I am wrong, but I see small memory leak >> in your >> implementation. >> In Arguments::parse_options_environment_variable >> function memory >> for 'buffer' allocated by strdup function on line >> 3415, but now it >> not freed in this function because data from this >> buffer is used >> later. On the other hand when we are done with env >> variables, we >> free only options array(lines 3703-3705) and not free >> previously >> allocated memory for 'buffer' because we lost track >> for it. >> >> Thanks, >> Dmitry >> >> >> On 09.07.2015 21:20, Jeremy Manson wrote: >> >> Thanks for looking at this, Coleen. >> >> I merged this with the latest version of hs-rt, >> but Ron is or >> I am going to >> have to do some merging for 8061999. The changes >> are relatively >> orthogonal, but they touch a couple of the same >> places. How >> far away is >> Ron's checkin? >> >> Updated webrev: >> >> http://cr.openjdk.java.net/~jmanson/8079301/webrev.01/ >> >> >> >> >> >> Updated test: >> >> http://cr.openjdk.java.net/~jmanson/8079301t/webrev.01/ >> >> >> >> >> >> (Mild complaining on my part: the conflicts >> wouldn't have been >> an issue if >> someone had looked at this two months ago, when I >> first >> asked. I suspect >> Ron hadn't even started his change at that >> point. And if external >> developers were able to submit changes to Hotspot, >> we wouldn't >> have had to >> bother Oracle engineers at all. Neither of these >> is your >> fault or your >> problem, of course - I'm grateful you were able to >> take a look.) >> >> Jeremy >> >> On Wed, Jul 8, 2015 at 6:19 AM, Coleen Phillimore < >> coleen.phillimore at oracle.com >> >> >> > >> >> >> wrote: >> >> I'll sponsor it but can you repost the RFR? >> >> There has been a fair bit of work to command line >> processing lately so I'd >> like to have the others look at it too. Have >> you merged >> this up with the >> latest version of hs-rt repository and were there >> conflicts? Also, have >> you looked at the RFR: >> >> "Open code review for 8061999 Enhance VM >> option parsing to >> allow options >> to be specified" >> >> and are there conflicts with this? >> >> The hotspot change looks good to me. >> >> >> >> http://cr.openjdk.java.net/~jmanson/8079301t/webrev.00/test/com/sun/management/HotSpotDiagnosticMXBean/CheckOrigin.java.udiff.html >> >> >> >> >> >> >> >> "UseCerealGC" LOL >> Can you use a different option than >> PrintOopAddress in >> this test? I don't >> know why this command line option exists or >> would be >> useful for, and seems >> to be a good candidate for removal. If you >> need a valid >> argument, that is >> unlikely to go away, TraceExceptions would be >> good. >> >> Thanks, >> Coleen >> >> >> On 7/7/15 8:00 PM, Jeremy Manson wrote: >> >> No love? Is there a code owner here I >> should pester >> more directly? >> >> Jeremy >> >> On Fri, Jun 26, 2015 at 3:00 PM, Martin >> Buchholz >> > < >> mailto:martinrb at google.com >> >> >> wrote: >> >> As usual with Google patches, they are >> in use >> locally. This one has been >> >> stable for a while without complaints. >> Please >> sponsor. >> >> On Fri, Jun 26, 2015 at 1:53 PM, >> Jeremy Manson >> < >> jeremymanson at google.com >> >> >> >> >> wrote: >> >> All this talk about >> IgnoreUnrecognizedVMOptions >> reminded me that this >> >> review is still outstanding. Any >> takers? >> >> Jeremy >> >> On Tue, May 5, 2015 at 10:01 AM, >> Jeremy Manson >> > >> >> > >> wrote: >> >> Hi David, >> >> Thanks for taking a look. >> >> On Mon, May 4, 2015 at 8:32 >> PM, David >> Holmes >> >> >> >> >> >> >> wrote: >> >> Hi Jeremy, >> >> On 5/05/2015 6:51 AM, >> Jeremy Manson wrote: >> >> Not sure who might be >> willing to >> sponsor this. David? You >> did the >> >> last >> one. :) >> >> Might be a while >> before I can >> get to it. I did have >> a quick look >> >> (and >> will need a longer one). >> >> I understand. I'm just happy >> it's >> possible to upstream this stuff >> at >> all[1]. >> >> [1] With the eternal caveat >> that I'd be >> happier if we didn't *have* to >> go through you folks, but >> we've learned to >> live with it. >> >> >> >> Context: A number of >> command line >> options are not settable via >> >> JAVA_TOOL_OPTIONS and _JAVA_OPTIONS: >> >> - PrintVMOptions >> >> So you have changed the >> semantics of this to >> print out the >> options >> >> from >> the command-line and each >> of the two >> env vars. Seems reasonable >> but >> may be >> better to know which >> option came from >> where as we can now see >> the same >> option (or conflicting >> variants >> thereof) multiple times. >> >> I'd be happy to do >> this. Any >> preferred syntax? Does >> someone >> >> actually >> own this feature? >> >> I'm unclear what the current >> processing >> order is for the different >> >> sources of options, and >> whether the >> changes affect that order? >> >> Nope. I go through sad >> contortions >> to keep the processing >> order the >> >> same. It's JAVA_TOOL_OPTIONS, >> then >> command line, then _JAVA_OPTIONS. >> See >> lines 2549-2567. >> >> >> - >> IgnoreUnrecognizedVMOptions >> >> - PrintFlagsInitial >> >> Unclear what >> "initial" actually >> means - is it the >> default? >> >> More or less. If you stick, >> for example, >> IgnoreUnrecognizedVMOptions >> in >> there first, it will get >> printed out as >> "true". I haven't really >> changed >> the semantics here either - >> I've just >> added processing of the envvars. >> >> - NativeMemoryTracking >> >> - PrintFlagsWithComments >> >> This is because these >> flags have >> to be processed before >> processing >> other >> flags, and no one ever >> bothered to >> do that for the flags >> coming from >> environment >> variables. This patch >> fixes that problem. >> >> I have a test, but it is >> a >> modification to a JDK >> test instead >> of a HS >> test, >> so it can go in >> separately (I guess). >> >> They can be pushed >> together to >> different repos in the >> same forest. >> >> Okay. Here's the test >> change: >> >> http://cr.openjdk.java.net/~jmanson/8079301t/webrev.00/ >> >> >> >> >> >> >> As I said I'll have to get >> back to this. >> And hopefully someone else in >> >> runtime will take a good >> look as well ;-) >> >> I'd be happy to toss it >> over to >> whomever owns this, if >> anyone. >> >> Thanks! >> >> Jeremy >> >> >> >> Bug: >> >> https://bugs.openjdk.java.net/browse/JDK-8079301 >> >> Webrev: >> http://cr.openjdk.java.net/~jmanson/8079301/webrev.00/ >> >> >> >> >> >> Jeremy >> >> >> >> >> >> >> >> >> >> >> >> >> >> > From harold.seigel at oracle.com Thu Jul 16 00:40:15 2015 From: harold.seigel at oracle.com (harold seigel) Date: Wed, 15 Jul 2015 20:40:15 -0400 Subject: RFR(XXS) 8131331: make new thread dump output line optional In-Reply-To: <55A6D952.5040208@oracle.com> References: <55A6D952.5040208@oracle.com> Message-ID: <55A6FD6F.9070206@oracle.com> Hi Dan, The change looks good. Thanks, Harold On 7/15/2015 6:06 PM, Daniel D. Daugherty wrote: > Greetings, > > The fix for the following bug: > > JDK-8130448 thread dump improvements, comment additions, new > diagnostics inspired by 8077392 > https://bugs.openjdk.java.net/browse/JDK-8130448 > > needs a small tweak in order to pass some internal jstack tests. > This work is tracked by the following bug: > > JDK-8131331 tmtools/jstack/locks/wait_interrupt and wait_notify > fail due to wrong number of lock records > https://bugs.openjdk.java.net/browse/JDK-8131331 > > Here is the webrev URL: > > http://cr.openjdk.java.net/~dcubed/8131331-webrev/0-jdk9-hs-rt/ > > Testing: > > - vm.tmtools Aurora Adhoc run (in process) > - JPRT test job > > Thanks, in advance, for any comments, questions or suggestions. > > Dan From daniel.daugherty at oracle.com Thu Jul 16 02:04:29 2015 From: daniel.daugherty at oracle.com (Daniel D. Daugherty) Date: Wed, 15 Jul 2015 20:04:29 -0600 Subject: RFR(XXS) 8131331: make new thread dump output line optional In-Reply-To: <55A6FD6F.9070206@oracle.com> References: <55A6D952.5040208@oracle.com> <55A6FD6F.9070206@oracle.com> Message-ID: <55A7112D.7010002@oracle.com> On 7/15/15 6:40 PM, harold seigel wrote: > Hi Dan, > > The change looks good. Harold, Thanks for the review. I won't be able to list you as a reviewer since the JPRT job was already in flight before your review and is almost done... Dan > > Thanks, Harold > On 7/15/2015 6:06 PM, Daniel D. Daugherty wrote: >> Greetings, >> >> The fix for the following bug: >> >> JDK-8130448 thread dump improvements, comment additions, new >> diagnostics inspired by 8077392 >> https://bugs.openjdk.java.net/browse/JDK-8130448 >> >> needs a small tweak in order to pass some internal jstack tests. >> This work is tracked by the following bug: >> >> JDK-8131331 tmtools/jstack/locks/wait_interrupt and wait_notify >> fail due to wrong number of lock records >> https://bugs.openjdk.java.net/browse/JDK-8131331 >> >> Here is the webrev URL: >> >> http://cr.openjdk.java.net/~dcubed/8131331-webrev/0-jdk9-hs-rt/ >> >> Testing: >> >> - vm.tmtools Aurora Adhoc run (in process) >> - JPRT test job >> >> Thanks, in advance, for any comments, questions or suggestions. >> >> Dan > From christian.tornqvist at oracle.com Thu Jul 16 10:47:21 2015 From: christian.tornqvist at oracle.com (Christian Tornqvist) Date: Thu, 16 Jul 2015 06:47:21 -0400 Subject: RFR(XS): 8080733 - [TESTBUG] several runtime/ErrorHandling/* tests time out on Windows In-Reply-To: <55A6F33D.6080207@oracle.com> References: <03e001d0bf10$af56aee0$0e040ca0$@oracle.com> <55A6F33D.6080207@oracle.com> Message-ID: <043301d0bfb4$cb588920$62099b60$@oracle.com> Hi David, No, it removes some of the extra test cases I added for Windows. I can't think of a way around this that doesn't involve adding a sleep in the test to let the JVM start up, which is a really bad workaround since it'll be heavily dependent on what machine/concurrency you run with and will also slow down the test quite a lot. Thanks, Christian -----Original Message----- From: David Holmes [mailto:david.holmes at oracle.com] Sent: Wednesday, July 15, 2015 7:57 PM To: Christian Tornqvist ; hotspot-runtime-dev at openjdk.java.net Subject: Re: RFR(XS): 8080733 - [TESTBUG] several runtime/ErrorHandling/* tests time out on Windows Hi Christian, Doesn't this effectively remove all testing of +CreateCoreDumpOnCrash? David On 16/07/2015 1:12 AM, Christian Tornqvist wrote: > Hi everyone, > > > > Please review this small change that removes a few test cases from > test/runtime/ErrorHandling/CreateCoredumpOnCrash.java and adds > -XX:-CreateCoredumpOnCrash to TestOnError.java. We've been seeing > hangs in these tests on Windows when running in our nightly. Most > likely this is caused by > https://bugs.openjdk.java.net/browse/JDK-8051995, it's more likely to > happen when running tests concurrently which explains why it shows up in our nightly runs. > > > > Webrev: > > http://cr.openjdk.java.net/~ctornqvi/webrev/8080733/webrev.00/ > > > > Bug: > > https://bugs.openjdk.java.net/browse/JDK-8080733 > > > > Thanks, > > Christian > From dmitry.dmitriev at oracle.com Thu Jul 16 11:06:26 2015 From: dmitry.dmitriev at oracle.com (Dmitry Dmitriev) Date: Thu, 16 Jul 2015 14:06:26 +0300 Subject: RFR: 8079301: Some command line options not settable via JAVA_TOOL_OPTIONS In-Reply-To: References: <559D237C.2060702@oracle.com> <559EED17.4060109@oracle.com> <559FAE4B.5060505@oracle.com> <559FBFFB.3060206@oracle.com> <55A01184.7080102@oracle.com> <55A0361B.2060307@oracle.com> <55A2794E.20502@oracle.com> <55A56713.8090308@oracle.com> <55A5705D.9080500@oracle.com> Message-ID: <55A79032.3060709@oracle.com> Hello Jeremy, Thank you for doing this! Looks good, just few comments: 1) Latest code still not check return value of 'match_special_option_and_act' new function on lines 3702-3704. I repeat comment here from one of the e-mail below just in case if you missed it: In one case it can return error(JNI_ERR) when "-XX:NativeMemoryTracking" is specified and INCLUDE_NMT is not defined. Thus, I think that check for return value should be added. 2) There are some mix with int/jint variables and return values. I think that all these should be converted to jint. Here what I see: -change return value of new 'set_args' method on line 3415 to 'jint'. 'set_args' method called only once(on line 3515) and it return value is set to variable 'status' with 'jint' type. -change return value of new 'match_special_option_and_act' function on line 3602 to 'jint' -change type of 'code' variable on line 3691 to 'jint'. In some cases 'code' can be returned from Arguments::parse function, but return value of Arguments::parse function is 'jint'. Thank you, Dmitry On 16.07.2015 3:27, Jeremy Manson wrote: > New rev: > > http://cr.openjdk.java.net/~jmanson/8079301/webrev.05/ > > > Thanks for all the attention! > > On Wed, Jul 15, 2015 at 3:39 PM, Jeremy Manson > > wrote: > > Sorry about the delay. We were finally able to get JDK8 to the > point where we could use it without our services falling apart, so > we rolled it forward at Google. I've spent a lot of the last week > putting out fires. Also, house renovations. :/ > > I think that it is long past time for Hotspot to start using the > RAII classes everyone else in the world adopted years ago, and > will be happy to implement one for this case. It was pretty hard > for me to avoid the temptation when I was writing this code in the > first place, but the general lack of them throughout the codebase > made me think that they were unpopular. > > Some crazy day we might even consider rolling forward to the 21st > century and starting to use unique_ptr in the source base. > > I'll ping the thread when there's a new rev. > > Jeremy > > On Tue, Jul 14, 2015 at 1:26 PM, Dmitry Dmitriev > > > wrote: > > Hello Coleen, > > Yes, I like your approach. It seems more accurate. Thus, > desctructor can be something like that: > ~EnvInitArgs() { > if( _args.options != NULL ) { > for (int i = 0; i < _args.nOptions; i++) { > os::free(_args.options[i].optionString); > } > FREE_C_HEAP_ARRAY(JavaVMOption, _args.options); > } > } > > Jeremy, what you think about that? > > Thank you, > Dmitry > > > On 14.07.2015 22:46, Coleen Phillimore wrote: >> >> >> On 7/12/15 10:27 AM, Dmitry Dmitriev wrote: >>> Hello Coleen, >>> >>> I think that adding destructor not help with this, since all >>> this code with free_memory_for_vm_init_args is a special >>> workaround for processing options in env variables and not >>> applied to the options from command line which passed in >>> 'args' to the Arguments::parse function. >> >> I see - JavaVMInitArgs is a C struct in jni.h >> >> If you wrap JavaVMInitArgs for the options for environment >> variables in a scoped object that calls the destructor to >> clean up JavaVMInitArgs, this would eliminate all these extra >> calls that you have to make to free_memory_for_vm_init_args: >> >> class EnvInitArgs : public StackObj { >> JavaVMInitArgs _args; >> public: >> ~EnvInitArgs() { >> // Code to conditionally delete option memory that >> you have in free_memory_for_vm_init_args >> } >> JavaVMInitArgs* init_args() const { return &_args; } >> } >> >> You can put this in the constructor: >> >> + vm_args->version = JNI_VERSION_1_2; >> + vm_args->options = NULL; >> + vm_args->nOptions = 0; >> + vm_args->ignoreUnrecognized = false; >> I think this would be neater than having to check for JNI_OK >> and call free everywhere. >> >> Coleen >> >>> >>> About match_special_option_and_act. Probably it can be >>> processed in the following way(raw idea): >>> code = match_special_option_and_act(&java_tool_options_args, >>> &flags_file); >>> if (code == JNI_OK) { >>> // call next >>> code = match_special_option_and_act(args, &flags_file); >>> } >>> >>> if (code == JNI_OK) { >>> // call next >>> code = match_special_option_and_act(&java_options_args, >>> &flags_file); >>> } >>> >>> if (code != JNI_OK) { >>> free_memory_for_vm_init_args(&java_tool_options_args); >>> free_memory_for_vm_init_args(&java_options_args); >>> return code; >>> } >>> >>> Thanks, >>> Dmitry >>> >>> On 11.07.2015 0:16, Coleen Phillimore wrote: >>>> >>>> Hi, I have a couple of suggestions. >>>> >>>> Can you add a destructor to JavaVMInitArgs which will >>>> delete the options things if they exist? Then you won't >>>> need these free_memory_for_vm_init_args functions. I >>>> think this would work. >>>> >>>> Secondly, I was also going to comment about >>>> match_special_option_and_act not using it's return value. >>>> The destructor code would make this less cumbersome. I >>>> like the refactoring though. >>>> >>>> Thanks, >>>> Coleen >>>> >>>> On 7/10/15 2:40 PM, Dmitry Dmitriev wrote: >>>>> Jeremy, thank you for fixing that! Please, see my comments >>>>> inline for 2 item and one more comment. >>>>> >>>>> On 10.07.2015 20:15, Jeremy Manson wrote: >>>>>> Thanks for the detailed look, Dmitry. I have taken your >>>>>> advice, with a couple of exceptions: >>>>>> >>>>>> 1) I named the method free_memory_for_vm_init_args >>>>>> instead of free_memory_for_environment_variables. >>>>>> 2) I did not free the memory in 3661-3663 or in >>>>>> 3679-3681, because those are error paths where the memory >>>>>> may not have been allocated in the first place. So >>>>>> freeing it might lead to a crash. >>>>> Yes, you are right. But I think we can guard from this by >>>>> adding check for args->options in new >>>>> free_memory_for_vm_init_args function and free memory in >>>>> all execution paths. If args->options is not NULL, then >>>>> memory is allocated and must be freed: >>>>> >>>>> 3485 static void >>>>> free_memory_for_vm_init_args(JavaVMInitArgs* args) { >>>>> 3486 if( args->options != NULL ) { >>>>> 3487 for (int i = 0; i < args->nOptions; i++) { >>>>> 3488 os::free(args->options[i].optionString); >>>>> 3489 } >>>>> 3490 FREE_C_HEAP_ARRAY(JavaVMOption, args->options); >>>>> 3491 } >>>>> 3492 } >>>>> >>>>> As I see you add free memory for error paths at >>>>> lines(webrev.04) 3668-3671 and 3687-3691. Thus, with that >>>>> guard you can add two calls to >>>>> free_memory_for_vm_init_args function before "return >>>>> JNI_EINVAL;" on line 3696: >>>>> >>>>> 3693 #ifdef ASSERT >>>>> 3694 // Parse default .hotspotrc settings file >>>>> 3695 if (!process_settings_file(".hotspotrc", false, >>>>> args->ignoreUnrecognized)) { >>>>> 3696 return JNI_EINVAL; >>>>> 3697 } >>>>> 3698 #else >>>>> >>>>> >>>>> And one more comment. Unfortunately I oversight this >>>>> before... You not check return value from >>>>> 'match_special_option_and_act' new function on lines >>>>> 3673-3675, but in one case it can return error(JNI_ERR) >>>>> when "-XX:NativeMemoryTracking" is specified and >>>>> INCLUDE_NMT is not defined. Thus, I think that check for >>>>> return value should be added(with freeing memory for env >>>>> variables in case of error). >>>>> >>>>> Thank you, >>>>> Dmitry >>>>> >>>>>> >>>>>> New Rev: >>>>>> >>>>>> http://cr.openjdk.java.net/~jmanson/8079301/webrev.04/ >>>>>> >>>>>> >>>>>> >>>>>> Jeremy >>>>>> >>>>>> On Fri, Jul 10, 2015 at 5:52 AM, Dmitry Dmitriev >>>>>> >>>>> >>>>>> >>>>>> > wrote: >>>>>> >>>>>> Jeremy, >>>>>> >>>>>> Two additional comments which I didn't catch earlier... >>>>>> >>>>>> 1) Order of processing command line options is >>>>>> following(Arguments::parse_vm_init_args function): >>>>>> options from >>>>>> JAVA_TOOL_OPTIONS environment variable, then options >>>>>> from command >>>>>> line and then options from _JAVA_OPTIONS environment >>>>>> variable. And >>>>>> last argument wins! >>>>>> >>>>>> You not change this order in >>>>>> Arguments::parse_vm_init_args >>>>>> function, but it seems that order in several other >>>>>> places is changed. >>>>>> >>>>>> Lines 3665-3667: >>>>>> >>>>>> 3665 match_special_option_and_act(args, &flags_file); >>>>>> 3666 >>>>>> match_special_option_and_act(&java_tool_options_args, >>>>>> &flags_file); >>>>>> 3667 match_special_option_and_act(&java_options_args, >>>>>> &flags_file); >>>>>> >>>>>> Here we see that order is following: options from >>>>>> command line, >>>>>> then options from JAVA_TOOL_OPTIONS environment >>>>>> variable and then >>>>>> options from _JAVA_OPTIONS environment variable. >>>>>> Thus, in this >>>>>> case "-XX:+IgnoreUnrecognizedVMOptions" option in >>>>>> JAVA_TOOL_OPTIONS environment variable will have >>>>>> bigger priority >>>>>> than in command line(last argument wins), but this is >>>>>> differ from >>>>>> processing options in Arguments::parse_vm_init_args >>>>>> function. >>>>>> Thus, I think that you need to swap 3665 and 3666 lines: >>>>>> >>>>>> 3665 >>>>>> match_special_option_and_act(&java_tool_options_args, >>>>>> &flags_file); >>>>>> 3666 match_special_option_and_act(args, &flags_file); >>>>>> 3667 match_special_option_and_act(&java_options_args, >>>>>> &flags_file); >>>>>> >>>>>> Similar situation on lines 3696-3700: >>>>>> >>>>>> 3696 if (PrintVMOptions) { >>>>>> 3697 print_options(args); >>>>>> 3698 print_options(&java_tool_options_args); >>>>>> 3699 print_options(&java_options_args); >>>>>> 3700 } >>>>>> >>>>>> Command line options are printed before options from >>>>>> JAVA_TOOL_OPTIONS environment variable. Thus, I think >>>>>> that you >>>>>> need to swap 3697 and 3698 lines: >>>>>> >>>>>> 3696 if (PrintVMOptions) { >>>>>> 3697 print_options(&java_tool_options_args); >>>>>> 3698 print_options(args); >>>>>> 3699 print_options(&java_options_args); >>>>>> 3700 } >>>>>> >>>>>> >>>>>> 2) One more thing about error processing :) >>>>>> I think it will be great to free allocated memory for >>>>>> environment >>>>>> variables when error occured on lines 3661-3663, >>>>>> 3679-3681 and >>>>>> 3685-3687. >>>>>> My suggestion is to add some static function which >>>>>> free memory for >>>>>> env variables, something like that: >>>>>> static void free_memory_for_environment_variables( >>>>>> JavaVMInitArgs >>>>>> *options_args ) { >>>>>> for (int i = 0; i < options_args->nOptions; i++) { >>>>>> os::free(options_args->options[i].optionString); >>>>>> } >>>>>> FREE_C_HEAP_ARRAY(JavaVMOption, options_args->options); >>>>>> } >>>>>> >>>>>> And change lines 3661-3663 to following: >>>>>> >>>>>> 3661 if (code != JNI_OK) { >>>>>> 3662 >>>>>> free_memory_for_environment_variables(&java_tool_options_args); >>>>>> >>>>>> 3663 return code; >>>>>> 3664 } >>>>>> >>>>>> Lines 3679-3681 to following: >>>>>> >>>>>> 3679 if (!process_settings_file(flags_file, true, >>>>>> args->ignoreUnrecognized)) { >>>>>> 3680 >>>>>> free_memory_for_environment_variables(&java_tool_options_args); >>>>>> >>>>>> 3681 >>>>>> free_memory_for_environment_variables(&java_options_args); >>>>>> 3682 return JNI_EINVAL; >>>>>> 3683 } >>>>>> >>>>>> Lines 3685-3687 to following: >>>>>> >>>>>> 3685 if (!process_settings_file(".hotspotrc", false, >>>>>> args->ignoreUnrecognized)) { >>>>>> 3680 >>>>>> free_memory_for_environment_variables(&java_tool_options_args); >>>>>> >>>>>> 3681 >>>>>> free_memory_for_environment_variables(&java_options_args); >>>>>> 3686 return JNI_EINVAL; >>>>>> 3687 } >>>>>> >>>>>> And lines 3706-3715 to following: >>>>>> >>>>>> 3706 // Done with the envvars >>>>>> 3707 >>>>>> free_memory_for_environment_variables(&java_tool_options_args); >>>>>> >>>>>> 3708 >>>>>> free_memory_for_environment_variables(&java_options_args); >>>>>> >>>>>> >>>>>> Thank you, >>>>>> Dmitry >>>>>> >>>>>> >>>>>> On 10.07.2015 14:36, Dmitry Dmitriev wrote: >>>>>> >>>>>> Hello Jeremy, >>>>>> >>>>>> Thank you for fixing that! But in this case we >>>>>> still have >>>>>> minor issue when quotes processing failed(lines >>>>>> 3438-3444). >>>>>> Here is my suggestion: leave 'while' cycle(lines >>>>>> 3423-3462) as >>>>>> I was in your previous webrev(without 'start' and >>>>>> etc.) and >>>>>> call strdup when copy 'options' to 'options_arr' >>>>>> on lines >>>>>> 3472-3474, i.e. make lines 3472-3474 like this: >>>>>> >>>>>> 3472 for (int i = 0; i < options->length(); i++) { >>>>>> 3473 options_arr[i] = options->at(i); >>>>>> 3474 options_arr[i].optionString = >>>>>> os::strdup(options_arr[i].optionString); >>>>>> 3475 } >>>>>> >>>>>> What you think about that? >>>>>> >>>>>> Regards, >>>>>> Dmitry >>>>>> >>>>>> On 10.07.2015 3:23, Jeremy Manson wrote: >>>>>> >>>>>> Hey Dmitry, >>>>>> >>>>>> Thanks for looking at it. The leak was >>>>>> deliberate (under >>>>>> the theory that the command line flags were >>>>>> leaked, too), >>>>>> but it was silly that I didn't fix it. >>>>>> >>>>>> Anyway, fixed. See: >>>>>> >>>>>> http://cr.openjdk.java.net/~jmanson/8079301/webrev.03 >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> Jeremy >>>>>> >>>>>> On Thu, Jul 9, 2015 at 2:52 PM, Dmitry Dmitriev >>>>>> >>>>> >>>>>> >>>>>> >>>>>> >>>>> >>>>>> >> wrote: >>>>>> >>>>>> Hello Jeremy, >>>>>> >>>>>> Correct me if I am wrong, but I see small >>>>>> memory leak >>>>>> in your >>>>>> implementation. >>>>>> In >>>>>> Arguments::parse_options_environment_variable >>>>>> function memory >>>>>> for 'buffer' allocated by strdup function >>>>>> on line >>>>>> 3415, but now it >>>>>> not freed in this function because data >>>>>> from this >>>>>> buffer is used >>>>>> later. On the other hand when we are done >>>>>> with env >>>>>> variables, we >>>>>> free only options array(lines 3703-3705) >>>>>> and not free >>>>>> previously >>>>>> allocated memory for 'buffer' because we >>>>>> lost track >>>>>> for it. >>>>>> >>>>>> Thanks, >>>>>> Dmitry >>>>>> >>>>>> >>>>>> On 09.07.2015 21:20, Jeremy Manson wrote: >>>>>> >>>>>> Thanks for looking at this, Coleen. >>>>>> >>>>>> I merged this with the latest version >>>>>> of hs-rt, >>>>>> but Ron is or >>>>>> I am going to >>>>>> have to do some merging for 8061999. >>>>>> The changes >>>>>> are relatively >>>>>> orthogonal, but they touch a couple >>>>>> of the same >>>>>> places. How >>>>>> far away is >>>>>> Ron's checkin? >>>>>> >>>>>> Updated webrev: >>>>>> >>>>>> http://cr.openjdk.java.net/~jmanson/8079301/webrev.01/ >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> Updated test: >>>>>> >>>>>> http://cr.openjdk.java.net/~jmanson/8079301t/webrev.01/ >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> (Mild complaining on my part: the >>>>>> conflicts >>>>>> wouldn't have been >>>>>> an issue if >>>>>> someone had looked at this two months >>>>>> ago, when I >>>>>> first >>>>>> asked. I suspect >>>>>> Ron hadn't even started his change at >>>>>> that point. And if external >>>>>> developers were able to submit >>>>>> changes to Hotspot, >>>>>> we wouldn't >>>>>> have had to >>>>>> bother Oracle engineers at all. >>>>>> Neither of these >>>>>> is your >>>>>> fault or your >>>>>> problem, of course - I'm grateful you >>>>>> were able to >>>>>> take a look.) >>>>>> >>>>>> Jeremy >>>>>> >>>>>> On Wed, Jul 8, 2015 at 6:19 AM, >>>>>> Coleen Phillimore < >>>>>> coleen.phillimore at oracle.com >>>>>> >>>>>> >>>>>> >>>>>> >>>>> >>>>>> >> wrote: >>>>>> >>>>>> I'll sponsor it but can you >>>>>> repost the RFR? >>>>>> >>>>>> There has been a fair bit of work >>>>>> to command line >>>>>> processing lately so I'd >>>>>> like to have the others look at >>>>>> it too. Have >>>>>> you merged >>>>>> this up with the >>>>>> latest version of hs-rt >>>>>> repository and were there >>>>>> conflicts? Also, have >>>>>> you looked at the RFR: >>>>>> >>>>>> "Open code review for 8061999 >>>>>> Enhance VM >>>>>> option parsing to >>>>>> allow options >>>>>> to be specified" >>>>>> >>>>>> and are there conflicts with this? >>>>>> >>>>>> The hotspot change looks good to me. >>>>>> >>>>>> >>>>>> http://cr.openjdk.java.net/~jmanson/8079301t/webrev.00/test/com/sun/management/HotSpotDiagnosticMXBean/CheckOrigin.java.udiff.html >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> "UseCerealGC" LOL >>>>>> Can you use a different option than >>>>>> PrintOopAddress in >>>>>> this test? I don't >>>>>> know why this command line option >>>>>> exists or >>>>>> would be >>>>>> useful for, and seems >>>>>> to be a good candidate for >>>>>> removal. If you >>>>>> need a valid >>>>>> argument, that is >>>>>> unlikely to go away, >>>>>> TraceExceptions would be >>>>>> good. >>>>>> >>>>>> Thanks, >>>>>> Coleen >>>>>> >>>>>> >>>>>> On 7/7/15 8:00 PM, Jeremy Manson >>>>>> wrote: >>>>>> >>>>>> No love? Is there a code >>>>>> owner here I >>>>>> should pester >>>>>> more directly? >>>>>> >>>>>> Jeremy >>>>>> >>>>>> On Fri, Jun 26, 2015 at 3:00 >>>>>> PM, Martin >>>>>> Buchholz >>>>>> >>>>> >>>>>> >>>>>> >>>>> >> >>>>>> wrote: >>>>>> >>>>>> As usual with Google >>>>>> patches, they are >>>>>> in use >>>>>> locally. This one has been >>>>>> >>>>>> stable for a while without complaints. >>>>>> Please >>>>>> sponsor. >>>>>> >>>>>> On Fri, Jun 26, 2015 at 1:53 PM, >>>>>> Jeremy Manson >>>>>> >>>>>> >>>>>> >>>>>> >>>>> >>>>>> >> >>>>>> wrote: >>>>>> >>>>>> All this talk about >>>>>> IgnoreUnrecognizedVMOptions >>>>>> reminded me that this >>>>>> >>>>>> review is still outstanding. Any >>>>>> takers? >>>>>> >>>>>> Jeremy >>>>>> >>>>>> On Tue, May 5, 2015 at 10:01 AM, >>>>>> Jeremy Manson >>>>>> >>>>>> >>>>>> >>>>>> >>>>> >>>>>> > >>>>>> wrote: >>>>>> >>>>>> Hi David, >>>>>> >>>>>> Thanks for taking a look. >>>>>> >>>>>> On Mon, May 4, 2015 at 8:32 >>>>>> PM, David >>>>>> Holmes >>>>>> >>>>> >>>>>> >>>>>> >>>>>> >>>>> >>>>>> >> >>>>>> >>>>>> wrote: >>>>>> >>>>>> Hi Jeremy, >>>>>> >>>>>> On 5/05/2015 6:51 AM, >>>>>> Jeremy Manson wrote: >>>>>> >>>>>> Not sure who might be >>>>>> willing to >>>>>> sponsor this. David? You >>>>>> did the >>>>>> >>>>>> last >>>>>> one. :) >>>>>> >>>>>> Might be a while >>>>>> before I can >>>>>> get to it. I did have >>>>>> a quick look >>>>>> >>>>>> (and >>>>>> will need a longer one). >>>>>> >>>>>> I understand. I'm just happy it's >>>>>> possible to upstream this stuff at >>>>>> all[1]. >>>>>> >>>>>> [1] With the eternal caveat >>>>>> that I'd be >>>>>> happier if we didn't *have* to >>>>>> go through you folks, but >>>>>> we've learned to >>>>>> live with it. >>>>>> >>>>>> >>>>>> >>>>>> Context: A number of >>>>>> command line >>>>>> options are not settable via >>>>>> >>>>>> JAVA_TOOL_OPTIONS and _JAVA_OPTIONS: >>>>>> >>>>>> - PrintVMOptions >>>>>> >>>>>> So you have changed the >>>>>> semantics of this to >>>>>> print out the >>>>>> options >>>>>> >>>>>> from >>>>>> the command-line and each >>>>>> of the two >>>>>> env vars. Seems reasonable but >>>>>> may be >>>>>> better to know which >>>>>> option came from >>>>>> where as we can now see >>>>>> the same >>>>>> option (or conflicting >>>>>> variants >>>>>> thereof) multiple times. >>>>>> >>>>>> I'd be happy to do >>>>>> this. Any >>>>>> preferred syntax? Does someone >>>>>> >>>>>> actually >>>>>> own this feature? >>>>>> >>>>>> I'm unclear what the current >>>>>> processing >>>>>> order is for the different >>>>>> >>>>>> sources of options, and >>>>>> whether the >>>>>> changes affect that order? >>>>>> >>>>>> Nope. I go through sad >>>>>> contortions >>>>>> to keep the processing >>>>>> order the >>>>>> >>>>>> same. It's JAVA_TOOL_OPTIONS, >>>>>> then >>>>>> command line, then _JAVA_OPTIONS. >>>>>> See >>>>>> lines 2549-2567. >>>>>> >>>>>> >>>>>> - >>>>>> IgnoreUnrecognizedVMOptions >>>>>> >>>>>> - PrintFlagsInitial >>>>>> >>>>>> Unclear what >>>>>> "initial" actually >>>>>> means - is it the default? >>>>>> >>>>>> More or less. If you stick, >>>>>> for example, >>>>>> IgnoreUnrecognizedVMOptions >>>>>> in >>>>>> there first, it will get >>>>>> printed out as >>>>>> "true". I haven't really >>>>>> changed >>>>>> the semantics here either - >>>>>> I've just >>>>>> added processing of the envvars. >>>>>> >>>>>> - NativeMemoryTracking >>>>>> >>>>>> - PrintFlagsWithComments >>>>>> >>>>>> This is because these >>>>>> flags have >>>>>> to be processed before >>>>>> processing >>>>>> other >>>>>> flags, and no one ever >>>>>> bothered to >>>>>> do that for the flags >>>>>> coming from >>>>>> environment >>>>>> variables. This patch >>>>>> fixes that problem. >>>>>> >>>>>> I have a test, but it is a >>>>>> modification to a JDK >>>>>> test instead >>>>>> of a HS >>>>>> test, >>>>>> so it can go in >>>>>> separately (I guess). >>>>>> >>>>>> They can be pushed >>>>>> together to >>>>>> different repos in the >>>>>> same forest. >>>>>> >>>>>> Okay. Here's the test >>>>>> change: >>>>>> >>>>>> http://cr.openjdk.java.net/~jmanson/8079301t/webrev.00/ >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> As I said I'll have to get >>>>>> back to this. >>>>>> And hopefully someone else in >>>>>> >>>>>> runtime will take a good >>>>>> look as well ;-) >>>>>> >>>>>> I'd be happy to toss it >>>>>> over to >>>>>> whomever owns this, if anyone. >>>>>> >>>>>> Thanks! >>>>>> >>>>>> Jeremy >>>>>> >>>>>> >>>>>> >>>>>> Bug: >>>>>> >>>>>> https://bugs.openjdk.java.net/browse/JDK-8079301 >>>>>> >>>>>> Webrev: >>>>>> http://cr.openjdk.java.net/~jmanson/8079301/webrev.00/ >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> Jeremy >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>> >>>> >>> >> > > > From harold.seigel at oracle.com Thu Jul 16 13:06:28 2015 From: harold.seigel at oracle.com (harold seigel) Date: Thu, 16 Jul 2015 09:06:28 -0400 Subject: RFR: 8087342: crash in klassItable_initialize_itable_for_interface In-Reply-To: References: Message-ID: <55A7AC54.9090108@oracle.com> Hi Karen, The change looks good. Nice clean-up of the comments. Should this comment at line 1464 in instanceKlass.cpp say "any method*s* *array* to have ..." Thanks, Harold On 7/15/2015 12:40 PM, Karen Kinnear wrote: > Please review for JDK9: > > bug: https://bugs.openjdk.java.net/browse/JDK-8087342 > webrev: http://cr.openjdk.java.net/~acorn/8087342.2/webrev/ > > Crash occurs in product when we should through IncompatibleClassChangeError. > > testing: > internal tests: Defmeth (updated), SelectionResolution - product and fastdebug > jprt > jck > jtreg/hotspot_all > jtreg/jdk_streams > test,noncolo.testlist, -atk quick > > (jck and macosx testing in progress) > > thanks, > Karen > From karen.kinnear at oracle.com Thu Jul 16 14:27:06 2015 From: karen.kinnear at oracle.com (Karen Kinnear) Date: Thu, 16 Jul 2015 10:27:06 -0400 Subject: RFR: 8087342: crash in klassItable_initialize_itable_for_interface In-Reply-To: <55A7AC54.9090108@oracle.com> References: <55A7AC54.9090108@oracle.com> Message-ID: <60B46C78-D018-45D8-8264-BC01AAFD6EDC@oracle.com> Harold, Thank you for the quick review. Good catch - I changed it to any _method's array. thanks, Karen On Jul 16, 2015, at 9:06 AM, harold seigel wrote: > Hi Karen, > > The change looks good. Nice clean-up of the comments. > > Should this comment at line 1464 in instanceKlass.cpp say "any method*s* *array* to have ..." > > Thanks, Harold > > On 7/15/2015 12:40 PM, Karen Kinnear wrote: >> Please review for JDK9: >> >> bug: https://bugs.openjdk.java.net/browse/JDK-8087342 >> webrev: http://cr.openjdk.java.net/~acorn/8087342.2/webrev/ >> >> Crash occurs in product when we should through IncompatibleClassChangeError. >> >> testing: >> internal tests: Defmeth (updated), SelectionResolution - product and fastdebug >> jprt >> jck >> jtreg/hotspot_all >> jtreg/jdk_streams >> test,noncolo.testlist, -atk quick >> >> (jck and macosx testing in progress) >> >> thanks, >> Karen >> > From calvin.cheung at oracle.com Thu Jul 16 17:09:51 2015 From: calvin.cheung at oracle.com (Calvin Cheung) Date: Thu, 16 Jul 2015 10:09:51 -0700 Subject: RFR(XS): 8079825: Uninitialised variable in hotspot/src/share/vm & cpu/x86/vm (runtime) Message-ID: <55A7E55F.7060206@oracle.com> This is for fixing some warnings about uninitialized variables reported by our internal code analysis tool. JBS: https://bugs.openjdk.java.net/browse/JDK-8079825 (this is a confidential bug) webrev: http://cr.openjdk.java.net/~ccheung/8079825/webrev.00/ [1] Uninitialised pointer localvariable_type_table_start may be used as argument 8 when calling ClassFileParser::copy_localvariable_table at line 2465 of hotspot/src/share/vm/classfile/classFileParser.cpp in function ClassFileParser::parse_method Similar warning message for the other 3 local variables. The fix in classFileParser.cpp is for initializing the following variables to NULL: localvariable_table_length, localvariable_table_start, localvariable_type_table_length, localvariable_type_table_start They may not be defined if the execution path goes through the if block at line 2137: if (LoadLineNumberTables && _cp->symbol_at(code_attribute_name_index) == vmSymbols::tag_line_number_table()) { // Parse and compress line number table parse_linenumber_table(code_attribute_length, code_length, &linenumber_table, CHECK_(nullHandle)); [2] Uninitialised pointer rf may be used as argument 1 when calling RFrame::set_distance at line 96 of hotspot/src/share/vm/runtime/rframe.cpp in function RFrame::new_RFrame The fix in rframe.cpp is for initializing the rf to NULL. It isn't being initialized if the execution path goes to the else block: } else { assert(false, "Unhandled frame type"); } the assert is only for debug build. Testing: JPRT Aurora adhoc run including vm.quick on linux, windows (32- and 64-bit), and solaris sparc and x64 Thanks in advance for your review. Calvin From jeremymanson at google.com Thu Jul 16 17:20:58 2015 From: jeremymanson at google.com (Jeremy Manson) Date: Thu, 16 Jul 2015 10:20:58 -0700 Subject: RFR: 8079301: Some command line options not settable via JAVA_TOOL_OPTIONS In-Reply-To: <55A79032.3060709@oracle.com> References: <559D237C.2060702@oracle.com> <559EED17.4060109@oracle.com> <559FAE4B.5060505@oracle.com> <559FBFFB.3060206@oracle.com> <55A01184.7080102@oracle.com> <55A0361B.2060307@oracle.com> <55A2794E.20502@oracle.com> <55A56713.8090308@oracle.com> <55A5705D.9080500@oracle.com> <55A79032.3060709@oracle.com> Message-ID: Thanks for the thorough review. http://cr.openjdk.java.net/~jmanson/8079301/webrev.06/ As for other jint->int opportunities: the only ones I found were in loop bounds, and I decided it didn't improve the code to change those. Jeremy On Thu, Jul 16, 2015 at 4:06 AM, Dmitry Dmitriev wrote: > Hello Jeremy, > > Thank you for doing this! Looks good, just few comments: > 1) Latest code still not check return value of > 'match_special_option_and_act' new function on lines 3702-3704. > I repeat comment here from one of the e-mail below just in case if you > missed it: In one case it can return error(JNI_ERR) when > "-XX:NativeMemoryTracking" is specified and INCLUDE_NMT is not defined. > Thus, I think that check for return value should be added. > 2) There are some mix with int/jint variables and return values. I think > that all these should be converted to jint. > Here what I see: > -change return value of new 'set_args' method on line 3415 to 'jint'. > 'set_args' method called only once(on line 3515) and it return value is set > to variable 'status' with 'jint' type. > -change return value of new 'match_special_option_and_act' function on > line 3602 to 'jint' > -change type of 'code' variable on line 3691 to 'jint'. In some cases > 'code' can be returned from Arguments::parse function, but return value of > Arguments::parse function is 'jint'. > > Thank you, > Dmitry > > On 16.07.2015 3:27, Jeremy Manson wrote: > > New rev: > > http://cr.openjdk.java.net/~jmanson/8079301/webrev.05/ > > Thanks for all the attention! > > On Wed, Jul 15, 2015 at 3:39 PM, Jeremy Manson > wrote: > >> Sorry about the delay. We were finally able to get JDK8 to the point >> where we could use it without our services falling apart, so we rolled it >> forward at Google. I've spent a lot of the last week putting out fires. >> Also, house renovations. :/ >> >> I think that it is long past time for Hotspot to start using the RAII >> classes everyone else in the world adopted years ago, and will be happy to >> implement one for this case. It was pretty hard for me to avoid the >> temptation when I was writing this code in the first place, but the general >> lack of them throughout the codebase made me think that they were >> unpopular. >> >> Some crazy day we might even consider rolling forward to the 21st >> century and starting to use unique_ptr in the source base. >> >> I'll ping the thread when there's a new rev. >> >> Jeremy >> >> On Tue, Jul 14, 2015 at 1:26 PM, Dmitry Dmitriev < >> dmitry.dmitriev at oracle.com> wrote: >> >>> Hello Coleen, >>> >>> Yes, I like your approach. It seems more accurate. Thus, desctructor can >>> be something like that: >>> ~EnvInitArgs() { >>> if( _args.options != NULL ) { >>> for (int i = 0; i < _args.nOptions; i++) { >>> os::free(_args.options[i].optionString); >>> } >>> FREE_C_HEAP_ARRAY(JavaVMOption, _args.options); >>> } >>> } >>> >>> Jeremy, what you think about that? >>> >>> Thank you, >>> Dmitry >>> >>> >>> On 14.07.2015 22:46, Coleen Phillimore wrote: >>> >>> >>> >>> On 7/12/15 10:27 AM, Dmitry Dmitriev wrote: >>> >>> Hello Coleen, >>> >>> I think that adding destructor not help with this, since all this code >>> with free_memory_for_vm_init_args is a special workaround for processing >>> options in env variables and not applied to the options from command line >>> which passed in 'args' to the Arguments::parse function. >>> >>> >>> I see - JavaVMInitArgs is a C struct in jni.h >>> >>> If you wrap JavaVMInitArgs for the options for environment variables in >>> a scoped object that calls the destructor to clean up JavaVMInitArgs, this >>> would eliminate all these extra calls that you have to make to >>> free_memory_for_vm_init_args: >>> >>> class EnvInitArgs : public StackObj { >>> JavaVMInitArgs _args; >>> public: >>> ~EnvInitArgs() { >>> // Code to conditionally delete option memory that you have in >>> free_memory_for_vm_init_args >>> } >>> JavaVMInitArgs* init_args() const { return &_args; } >>> } >>> >>> You can put this in the constructor: >>> >>> + vm_args->version = JNI_VERSION_1_2;+ vm_args->options = NULL;+ vm_args->nOptions = 0;+ vm_args->ignoreUnrecognized = false; >>> >>> I think this would be neater than having to check for JNI_OK and call >>> free everywhere. >>> >>> Coleen >>> >>> >>> >>> About match_special_option_and_act. Probably it can be processed in the >>> following way(raw idea): >>> code = match_special_option_and_act(&java_tool_options_args, >>> &flags_file); >>> if (code == JNI_OK) { >>> // call next >>> code = match_special_option_and_act(args, &flags_file); >>> } >>> >>> if (code == JNI_OK) { >>> // call next >>> code = match_special_option_and_act(&java_options_args, &flags_file); >>> } >>> >>> if (code != JNI_OK) { >>> free_memory_for_vm_init_args(&java_tool_options_args); >>> free_memory_for_vm_init_args(&java_options_args); >>> return code; >>> } >>> >>> Thanks, >>> Dmitry >>> >>> On 11.07.2015 0:16, Coleen Phillimore wrote: >>> >>> >>> Hi, I have a couple of suggestions. >>> >>> Can you add a destructor to JavaVMInitArgs which will delete the options >>> things if they exist? Then you won't need these >>> free_memory_for_vm_init_args functions. I think this would work. >>> >>> Secondly, I was also going to comment about match_special_option_and_act >>> not using it's return value. The destructor code would make this less >>> cumbersome. I like the refactoring though. >>> >>> Thanks, >>> Coleen >>> >>> On 7/10/15 2:40 PM, Dmitry Dmitriev wrote: >>> >>> Jeremy, thank you for fixing that! Please, see my comments inline for 2 >>> item and one more comment. >>> >>> On 10.07.2015 20:15, Jeremy Manson wrote: >>> >>> Thanks for the detailed look, Dmitry. I have taken your advice, with a >>> couple of exceptions: >>> >>> 1) I named the method free_memory_for_vm_init_args instead of >>> free_memory_for_environment_variables. >>> 2) I did not free the memory in 3661-3663 or in 3679-3681, because those >>> are error paths where the memory may not have been allocated in the first >>> place. So freeing it might lead to a crash. >>> >>> Yes, you are right. But I think we can guard from this by adding check >>> for args->options in new free_memory_for_vm_init_args function and free >>> memory in all execution paths. If args->options is not NULL, then memory is >>> allocated and must be freed: >>> >>> 3485 static void free_memory_for_vm_init_args(JavaVMInitArgs* args) { >>> 3486 if( args->options != NULL ) { >>> 3487 for (int i = 0; i < args->nOptions; i++) { >>> 3488 os::free(args->options[i].optionString); >>> 3489 } >>> 3490 FREE_C_HEAP_ARRAY(JavaVMOption, args->options); >>> 3491 } >>> 3492 } >>> >>> As I see you add free memory for error paths at lines(webrev.04) >>> 3668-3671 and 3687-3691. Thus, with that guard you can add two calls to >>> free_memory_for_vm_init_args function before "return JNI_EINVAL;" on line >>> 3696: >>> >>> 3693 #ifdef ASSERT >>> 3694 // Parse default .hotspotrc settings file >>> 3695 if (!process_settings_file(".hotspotrc", false, >>> args->ignoreUnrecognized)) { >>> 3696 return JNI_EINVAL; >>> 3697 } >>> 3698 #else >>> >>> >>> And one more comment. Unfortunately I oversight this before... You not >>> check return value from 'match_special_option_and_act' new function on >>> lines 3673-3675, but in one case it can return error(JNI_ERR) when >>> "-XX:NativeMemoryTracking" is specified and INCLUDE_NMT is not defined. >>> Thus, I think that check for return value should be added(with freeing >>> memory for env variables in case of error). >>> >>> Thank you, >>> Dmitry >>> >>> >>> New Rev: >>> >>> http://cr.openjdk.java.net/~jmanson/8079301/webrev.04/ >>> >>> >>> >>> Jeremy >>> >>> On Fri, Jul 10, 2015 at 5:52 AM, Dmitry Dmitriev < >>> dmitry.dmitriev at oracle.com >>> > >>> wrote: >>> >>> Jeremy, >>> >>> Two additional comments which I didn't catch earlier... >>> >>> 1) Order of processing command line options is >>> following(Arguments::parse_vm_init_args function): options from >>> JAVA_TOOL_OPTIONS environment variable, then options from command >>> line and then options from _JAVA_OPTIONS environment variable. And >>> last argument wins! >>> >>> You not change this order in Arguments::parse_vm_init_args >>> function, but it seems that order in several other places is >>> changed. >>> >>> Lines 3665-3667: >>> >>> 3665 match_special_option_and_act(args, &flags_file); >>> 3666 match_special_option_and_act(&java_tool_options_args, >>> &flags_file); >>> 3667 match_special_option_and_act(&java_options_args, &flags_file); >>> >>> Here we see that order is following: options from command line, >>> then options from JAVA_TOOL_OPTIONS environment variable and then >>> options from _JAVA_OPTIONS environment variable. Thus, in this >>> case "-XX:+IgnoreUnrecognizedVMOptions" option in >>> JAVA_TOOL_OPTIONS environment variable will have bigger priority >>> than in command line(last argument wins), but this is differ from >>> processing options in Arguments::parse_vm_init_args function. >>> Thus, I think that you need to swap 3665 and 3666 lines: >>> >>> 3665 match_special_option_and_act(&java_tool_options_args, >>> &flags_file); >>> 3666 match_special_option_and_act(args, &flags_file); >>> 3667 match_special_option_and_act(&java_options_args, &flags_file); >>> >>> Similar situation on lines 3696-3700: >>> >>> 3696 if (PrintVMOptions) { >>> 3697 print_options(args); >>> 3698 print_options(&java_tool_options_args); >>> 3699 print_options(&java_options_args); >>> 3700 } >>> >>> Command line options are printed before options from >>> JAVA_TOOL_OPTIONS environment variable. Thus, I think that you >>> need to swap 3697 and 3698 lines: >>> >>> 3696 if (PrintVMOptions) { >>> 3697 print_options(&java_tool_options_args); >>> 3698 print_options(args); >>> 3699 print_options(&java_options_args); >>> 3700 } >>> >>> >>> 2) One more thing about error processing :) >>> I think it will be great to free allocated memory for environment >>> variables when error occured on lines 3661-3663, 3679-3681 and >>> 3685-3687. >>> My suggestion is to add some static function which free memory for >>> env variables, something like that: >>> static void free_memory_for_environment_variables( JavaVMInitArgs >>> *options_args ) { >>> for (int i = 0; i < options_args->nOptions; i++) { >>> os::free(options_args->options[i].optionString); >>> } >>> FREE_C_HEAP_ARRAY(JavaVMOption, options_args->options); >>> } >>> >>> And change lines 3661-3663 to following: >>> >>> 3661 if (code != JNI_OK) { >>> 3662 free_memory_for_environment_variables(&java_tool_options_args); >>> 3663 return code; >>> 3664 } >>> >>> Lines 3679-3681 to following: >>> >>> 3679 if (!process_settings_file(flags_file, true, >>> args->ignoreUnrecognized)) { >>> 3680 free_memory_for_environment_variables(&java_tool_options_args); >>> 3681 free_memory_for_environment_variables(&java_options_args); >>> 3682 return JNI_EINVAL; >>> 3683 } >>> >>> Lines 3685-3687 to following: >>> >>> 3685 if (!process_settings_file(".hotspotrc", false, >>> args->ignoreUnrecognized)) { >>> 3680 free_memory_for_environment_variables(&java_tool_options_args); >>> 3681 free_memory_for_environment_variables(&java_options_args); >>> 3686 return JNI_EINVAL; >>> 3687 } >>> >>> And lines 3706-3715 to following: >>> >>> 3706 // Done with the envvars >>> 3707 free_memory_for_environment_variables(&java_tool_options_args); >>> 3708 free_memory_for_environment_variables(&java_options_args); >>> >>> >>> Thank you, >>> Dmitry >>> >>> >>> On 10.07.2015 14:36, Dmitry Dmitriev wrote: >>> >>> Hello Jeremy, >>> >>> Thank you for fixing that! But in this case we still have >>> minor issue when quotes processing failed(lines 3438-3444). >>> Here is my suggestion: leave 'while' cycle(lines 3423-3462) as >>> I was in your previous webrev(without 'start' and etc.) and >>> call strdup when copy 'options' to 'options_arr' on lines >>> 3472-3474, i.e. make lines 3472-3474 like this: >>> >>> 3472 for (int i = 0; i < options->length(); i++) { >>> 3473 options_arr[i] = options->at(i); >>> 3474 options_arr[i].optionString = >>> os::strdup(options_arr[i].optionString); >>> 3475 } >>> >>> What you think about that? >>> >>> Regards, >>> Dmitry >>> >>> On 10.07.2015 3:23, Jeremy Manson wrote: >>> >>> Hey Dmitry, >>> >>> Thanks for looking at it. The leak was deliberate (under >>> the theory that the command line flags were leaked, too), >>> but it was silly that I didn't fix it. >>> >>> Anyway, fixed. See: >>> >>> http://cr.openjdk.java.net/~jmanson/8079301/webrev.03 >>> >>> >>> >>> >>> >>> Jeremy >>> >>> On Thu, Jul 9, 2015 at 2:52 PM, Dmitry Dmitriev >>> < dmitry.dmitriev at oracle.com >>> >>> >>> < >>> mailto:dmitry.dmitriev at oracle.com >>> >>> >> >>> wrote: >>> >>> Hello Jeremy, >>> >>> Correct me if I am wrong, but I see small memory leak >>> in your >>> implementation. >>> In Arguments::parse_options_environment_variable >>> function memory >>> for 'buffer' allocated by strdup function on line >>> 3415, but now it >>> not freed in this function because data from this >>> buffer is used >>> later. On the other hand when we are done with env >>> variables, we >>> free only options array(lines 3703-3705) and not free >>> previously >>> allocated memory for 'buffer' because we lost track >>> for it. >>> >>> Thanks, >>> Dmitry >>> >>> >>> On 09.07.2015 21:20, Jeremy Manson wrote: >>> >>> Thanks for looking at this, Coleen. >>> >>> I merged this with the latest version of hs-rt, >>> but Ron is or >>> I am going to >>> have to do some merging for 8061999. The changes >>> are relatively >>> orthogonal, but they touch a couple of the same >>> places. How >>> far away is >>> Ron's checkin? >>> >>> Updated webrev: >>> >>> http://cr.openjdk.java.net/~jmanson/8079301/webrev.01/ >>> >>> >>> >>> >>> >>> Updated test: >>> >>> http://cr.openjdk.java.net/~jmanson/8079301t/webrev.01/ >>> >>> >>> >>> >>> >>> (Mild complaining on my part: the conflicts >>> wouldn't have been >>> an issue if >>> someone had looked at this two months ago, when I >>> first >>> asked. I suspect >>> Ron hadn't even started his change at that >>> point. And if external >>> developers were able to submit changes to Hotspot, >>> we wouldn't >>> have had to >>> bother Oracle engineers at all. Neither of these >>> is your >>> fault or your >>> problem, of course - I'm grateful you were able to >>> take a look.) >>> >>> Jeremy >>> >>> On Wed, Jul 8, 2015 at 6:19 AM, Coleen Phillimore < >>> coleen.phillimore at oracle.com >>> >>> >>> < >>> mailto:coleen.phillimore at oracle.com >>> >> >>> wrote: >>> >>> I'll sponsor it but can you repost the RFR? >>> >>> There has been a fair bit of work to command >>> line >>> processing lately so I'd >>> like to have the others look at it too. Have >>> you merged >>> this up with the >>> latest version of hs-rt repository and were >>> there >>> conflicts? Also, have >>> you looked at the RFR: >>> >>> "Open code review for 8061999 Enhance VM >>> option parsing to >>> allow options >>> to be specified" >>> >>> and are there conflicts with this? >>> >>> The hotspot change looks good to me. >>> >>> >>> >>> http://cr.openjdk.java.net/~jmanson/8079301t/webrev.00/test/com/sun/management/HotSpotDiagnosticMXBean/CheckOrigin.java.udiff.html >>> >>> >>> >>> >>> >>> >>> >>> "UseCerealGC" LOL >>> Can you use a different option than >>> PrintOopAddress in >>> this test? I don't >>> know why this command line option exists or >>> would be >>> useful for, and seems >>> to be a good candidate for removal. If you >>> need a valid >>> argument, that is >>> unlikely to go away, TraceExceptions would be >>> good. >>> >>> Thanks, >>> Coleen >>> >>> >>> On 7/7/15 8:00 PM, Jeremy Manson wrote: >>> >>> No love? Is there a code owner here I >>> should pester >>> more directly? >>> >>> Jeremy >>> >>> On Fri, Jun 26, 2015 at 3:00 PM, Martin >>> Buchholz >>> < martinrb at google.com >>> >>> >>> >>> >> >>> wrote: >>> >>> As usual with Google patches, they are >>> in use >>> locally. This one has been >>> >>> stable for a while without complaints. >>> Please >>> sponsor. >>> >>> On Fri, Jun 26, 2015 at 1:53 PM, >>> Jeremy Manson >>> >> >>> >>> >>> >>> >> >>> wrote: >>> >>> All this talk about >>> IgnoreUnrecognizedVMOptions >>> reminded me that this >>> >>> review is still outstanding. Any >>> takers? >>> >>> Jeremy >>> >>> On Tue, May 5, 2015 at 10:01 AM, >>> Jeremy Manson >>> >> >>> >>> >>> >>> > >>> wrote: >>> >>> Hi David, >>> >>> Thanks for taking a look. >>> >>> On Mon, May 4, 2015 at 8:32 >>> PM, David >>> Holmes >>> < david.holmes at oracle.com >>> >>> < mailto:david.holmes at oracle.com >>> >>> >>> >> >>> >>> wrote: >>> >>> Hi Jeremy, >>> >>> On 5/05/2015 6:51 AM, >>> Jeremy Manson wrote: >>> >>> Not sure who might be >>> willing to >>> sponsor this. David? You >>> did the >>> >>> last >>> one. :) >>> >>> Might be a while >>> before I can >>> get to it. I did have >>> a quick look >>> >>> (and >>> will need a longer one). >>> >>> I understand. I'm just happy >>> it's >>> possible to upstream this stuff >>> at >>> all[1]. >>> >>> [1] With the eternal caveat >>> that I'd be >>> happier if we didn't *have* to >>> go through you folks, but >>> we've learned to >>> live with it. >>> >>> >>> >>> Context: A number of >>> command line >>> options are not settable via >>> >>> JAVA_TOOL_OPTIONS and _JAVA_OPTIONS: >>> >>> - PrintVMOptions >>> >>> So you have changed >>> the >>> semantics of this to >>> print out the >>> options >>> >>> from >>> the command-line and each >>> of the two >>> env vars. Seems reasonable >>> but >>> may be >>> better to know which >>> option came from >>> where as we can now see >>> the same >>> option (or conflicting >>> variants >>> thereof) multiple times. >>> >>> I'd be happy to do >>> this. Any >>> preferred syntax? Does >>> someone >>> >>> actually >>> own this feature? >>> >>> I'm unclear what the current >>> processing >>> order is for the different >>> >>> sources of options, and >>> whether the >>> changes affect that order? >>> >>> Nope. I go through sad >>> contortions >>> to keep the processing >>> order the >>> >>> same. It's JAVA_TOOL_OPTIONS, >>> then >>> command line, then >>> _JAVA_OPTIONS. >>> See >>> lines 2549-2567. >>> >>> >>> - >>> IgnoreUnrecognizedVMOptions >>> >>> - PrintFlagsInitial >>> >>> Unclear what >>> "initial" actually >>> means - is it the >>> default? >>> >>> More or less. If you stick, >>> for example, >>> IgnoreUnrecognizedVMOptions >>> in >>> there first, it will get >>> printed out as >>> "true". I haven't really >>> changed >>> the semantics here either - >>> I've just >>> added processing of the envvars. >>> >>> - NativeMemoryTracking >>> >>> - >>> PrintFlagsWithComments >>> >>> This is because these >>> flags have >>> to be processed before >>> processing >>> other >>> flags, and no one ever >>> bothered to >>> do that for the flags >>> coming from >>> environment >>> variables. This patch >>> fixes that problem. >>> >>> I have a test, but it is >>> a >>> modification to a JDK >>> test instead >>> of a HS >>> test, >>> so it can go in >>> separately (I guess). >>> >>> They can be pushed >>> together to >>> different repos in the >>> same forest. >>> >>> Okay. Here's the test >>> change: >>> >>> http://cr.openjdk.java.net/~jmanson/8079301t/webrev.00/ >>> >>> >>> >>> >>> >>> >>> As I said I'll have to get >>> back to this. >>> And hopefully someone else in >>> >>> runtime will take a good >>> look as well ;-) >>> >>> I'd be happy to toss it >>> over to >>> whomever owns this, if >>> anyone. >>> >>> Thanks! >>> >>> Jeremy >>> >>> >>> >>> Bug: >>> >>> >>> https://bugs.openjdk.java.net/browse/JDK-8079301 >>> >>> Webrev: >>> http://cr.openjdk.java.net/~jmanson/8079301/webrev.00/ >>> >>> >>> >>> >>> >>> Jeremy >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >> > > From dmitry.dmitriev at oracle.com Thu Jul 16 17:27:31 2015 From: dmitry.dmitriev at oracle.com (Dmitry Dmitriev) Date: Thu, 16 Jul 2015 20:27:31 +0300 Subject: RFR: 8079301: Some command line options not settable via JAVA_TOOL_OPTIONS In-Reply-To: References: <559D237C.2060702@oracle.com> <559EED17.4060109@oracle.com> <559FAE4B.5060505@oracle.com> <559FBFFB.3060206@oracle.com> <55A01184.7080102@oracle.com> <55A0361B.2060307@oracle.com> <55A2794E.20502@oracle.com> <55A56713.8090308@oracle.com> <55A5705D.9080500@oracle.com> <55A79032.3060709@oracle.com> Message-ID: <55A7E983.6050502@oracle.com> Jeremy, thank you! Looks good to me, but I am not a reviewer. Dmitry On 16.07.2015 20:20, Jeremy Manson wrote: > Thanks for the thorough review. > > http://cr.openjdk.java.net/~jmanson/8079301/webrev.06/ > > > As for other jint->int opportunities: the only ones I found were in > loop bounds, and I decided it didn't improve the code to change those. > > Jeremy > > On Thu, Jul 16, 2015 at 4:06 AM, Dmitry Dmitriev > > wrote: > > Hello Jeremy, > > Thank you for doing this! Looks good, just few comments: > 1) Latest code still not check return value of > 'match_special_option_and_act' new function on lines 3702-3704. > I repeat comment here from one of the e-mail below just in case if > you missed it: In one case it can return error(JNI_ERR) when > "-XX:NativeMemoryTracking" is specified and INCLUDE_NMT is not > defined. Thus, I think that check for return value should be added. > 2) There are some mix with int/jint variables and return values. I > think that all these should be converted to jint. > Here what I see: > -change return value of new 'set_args' method on line 3415 to > 'jint'. 'set_args' method called only once(on line 3515) and it > return value is set to variable 'status' with 'jint' type. > -change return value of new 'match_special_option_and_act' > function on line 3602 to 'jint' > -change type of 'code' variable on line 3691 to 'jint'. In some > cases 'code' can be returned from Arguments::parse function, but > return value of Arguments::parse function is 'jint'. > > Thank you, > Dmitry > > On 16.07.2015 3:27, Jeremy Manson wrote: >> New rev: >> >> http://cr.openjdk.java.net/~jmanson/8079301/webrev.05/ >> >> >> Thanks for all the attention! >> >> On Wed, Jul 15, 2015 at 3:39 PM, Jeremy Manson >> > wrote: >> >> Sorry about the delay. We were finally able to get JDK8 to >> the point where we could use it without our services falling >> apart, so we rolled it forward at Google. I've spent a lot of >> the last week putting out fires. Also, house renovations. :/ >> >> I think that it is long past time for Hotspot to start using >> the RAII classes everyone else in the world adopted years >> ago, and will be happy to implement one for this case. It >> was pretty hard for me to avoid the temptation when I was >> writing this code in the first place, but the general lack of >> them throughout the codebase made me think that they were >> unpopular. >> >> Some crazy day we might even consider rolling forward to the >> 21st century and starting to use unique_ptr in the source base. >> >> I'll ping the thread when there's a new rev. >> >> Jeremy >> >> On Tue, Jul 14, 2015 at 1:26 PM, Dmitry Dmitriev >> > > wrote: >> >> Hello Coleen, >> >> Yes, I like your approach. It seems more accurate. Thus, >> desctructor can be something like that: >> ~EnvInitArgs() { >> if( _args.options != NULL ) { >> for (int i = 0; i < _args.nOptions; i++) { >> os::free(_args.options[i].optionString); >> } >> FREE_C_HEAP_ARRAY(JavaVMOption, _args.options); >> } >> } >> >> Jeremy, what you think about that? >> >> Thank you, >> Dmitry >> >> >> On 14.07.2015 22:46, Coleen Phillimore wrote: >>> >>> >>> On 7/12/15 10:27 AM, Dmitry Dmitriev wrote: >>>> Hello Coleen, >>>> >>>> I think that adding destructor not help with this, >>>> since all this code with free_memory_for_vm_init_args >>>> is a special workaround for processing options in env >>>> variables and not applied to the options from command >>>> line which passed in 'args' to the Arguments::parse >>>> function. >>> >>> I see - JavaVMInitArgs is a C struct in jni.h >>> >>> If you wrap JavaVMInitArgs for the options for >>> environment variables in a scoped object that calls the >>> destructor to clean up JavaVMInitArgs, this would >>> eliminate all these extra calls that you have to make to >>> free_memory_for_vm_init_args: >>> >>> class EnvInitArgs : public StackObj { >>> JavaVMInitArgs _args; >>> public: >>> ~EnvInitArgs() { >>> // Code to conditionally delete option memory >>> that you have in free_memory_for_vm_init_args >>> } >>> JavaVMInitArgs* init_args() const { return &_args; } >>> } >>> >>> You can put this in the constructor: >>> >>> + vm_args->version = JNI_VERSION_1_2; >>> + vm_args->options = NULL; >>> + vm_args->nOptions = 0; >>> + vm_args->ignoreUnrecognized = false; >>> I think this would be neater than having to check for >>> JNI_OK and call free everywhere. >>> >>> Coleen >>> >>>> >>>> About match_special_option_and_act. Probably it can be >>>> processed in the following way(raw idea): >>>> code = >>>> match_special_option_and_act(&java_tool_options_args, >>>> &flags_file); >>>> if (code == JNI_OK) { >>>> // call next >>>> code = match_special_option_and_act(args, &flags_file); >>>> } >>>> >>>> if (code == JNI_OK) { >>>> // call next >>>> code = >>>> match_special_option_and_act(&java_options_args, >>>> &flags_file); >>>> } >>>> >>>> if (code != JNI_OK) { >>>> free_memory_for_vm_init_args(&java_tool_options_args); >>>> free_memory_for_vm_init_args(&java_options_args); >>>> return code; >>>> } >>>> >>>> Thanks, >>>> Dmitry >>>> >>>> On 11.07.2015 0:16, Coleen Phillimore wrote: >>>>> >>>>> Hi, I have a couple of suggestions. >>>>> >>>>> Can you add a destructor to JavaVMInitArgs which will >>>>> delete the options things if they exist? Then you >>>>> won't need these free_memory_for_vm_init_args >>>>> functions. I think this would work. >>>>> >>>>> Secondly, I was also going to comment about >>>>> match_special_option_and_act not using it's return >>>>> value. The destructor code would make this less >>>>> cumbersome. I like the refactoring though. >>>>> >>>>> Thanks, >>>>> Coleen >>>>> >>>>> On 7/10/15 2:40 PM, Dmitry Dmitriev wrote: >>>>>> Jeremy, thank you for fixing that! Please, see my >>>>>> comments inline for 2 item and one more comment. >>>>>> >>>>>> On 10.07.2015 20:15, Jeremy Manson wrote: >>>>>>> Thanks for the detailed look, Dmitry. I have taken >>>>>>> your advice, with a couple of exceptions: >>>>>>> >>>>>>> 1) I named the method free_memory_for_vm_init_args >>>>>>> instead of free_memory_for_environment_variables. >>>>>>> 2) I did not free the memory in 3661-3663 or in >>>>>>> 3679-3681, because those are error paths where the >>>>>>> memory may not have been allocated in the first >>>>>>> place. So freeing it might lead to a crash. >>>>>> Yes, you are right. But I think we can guard from >>>>>> this by adding check for args->options in new >>>>>> free_memory_for_vm_init_args function and free memory >>>>>> in all execution paths. If args->options is not NULL, >>>>>> then memory is allocated and must be freed: >>>>>> >>>>>> 3485 static void >>>>>> free_memory_for_vm_init_args(JavaVMInitArgs* args) { >>>>>> 3486 if( args->options != NULL ) { >>>>>> 3487 for (int i = 0; i < args->nOptions; i++) { >>>>>> 3488 os::free(args->options[i].optionString); >>>>>> 3489 } >>>>>> 3490 FREE_C_HEAP_ARRAY(JavaVMOption, args->options); >>>>>> 3491 } >>>>>> 3492 } >>>>>> >>>>>> As I see you add free memory for error paths at >>>>>> lines(webrev.04) 3668-3671 and 3687-3691. Thus, with >>>>>> that guard you can add two calls to >>>>>> free_memory_for_vm_init_args function before "return >>>>>> JNI_EINVAL;" on line 3696: >>>>>> >>>>>> 3693 #ifdef ASSERT >>>>>> 3694 // Parse default .hotspotrc settings file >>>>>> 3695 if (!process_settings_file(".hotspotrc", >>>>>> false, args->ignoreUnrecognized)) { >>>>>> 3696 return JNI_EINVAL; >>>>>> 3697 } >>>>>> 3698 #else >>>>>> >>>>>> >>>>>> And one more comment. Unfortunately I oversight this >>>>>> before... You not check return value from >>>>>> 'match_special_option_and_act' new function on lines >>>>>> 3673-3675, but in one case it can return >>>>>> error(JNI_ERR) when "-XX:NativeMemoryTracking" is >>>>>> specified and INCLUDE_NMT is not defined. Thus, I >>>>>> think that check for return value should be >>>>>> added(with freeing memory for env variables in case >>>>>> of error). >>>>>> >>>>>> Thank you, >>>>>> Dmitry >>>>>> >>>>>>> >>>>>>> New Rev: >>>>>>> >>>>>>> http://cr.openjdk.java.net/~jmanson/8079301/webrev.04/ >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> Jeremy >>>>>>> >>>>>>> On Fri, Jul 10, 2015 at 5:52 AM, Dmitry Dmitriev >>>>>>> >>>>>> >>>>>>> >>>>>>> > wrote: >>>>>>> >>>>>>> Jeremy, >>>>>>> >>>>>>> Two additional comments which I didn't catch >>>>>>> earlier... >>>>>>> >>>>>>> 1) Order of processing command line options is >>>>>>> following(Arguments::parse_vm_init_args function): >>>>>>> options from >>>>>>> JAVA_TOOL_OPTIONS environment variable, then options >>>>>>> from command >>>>>>> line and then options from _JAVA_OPTIONS >>>>>>> environment variable. And >>>>>>> last argument wins! >>>>>>> >>>>>>> You not change this order in >>>>>>> Arguments::parse_vm_init_args >>>>>>> function, but it seems that order in several >>>>>>> other places is changed. >>>>>>> >>>>>>> Lines 3665-3667: >>>>>>> >>>>>>> 3665 match_special_option_and_act(args, >>>>>>> &flags_file); >>>>>>> 3666 >>>>>>> match_special_option_and_act(&java_tool_options_args, >>>>>>> &flags_file); >>>>>>> 3667 >>>>>>> match_special_option_and_act(&java_options_args, >>>>>>> &flags_file); >>>>>>> >>>>>>> Here we see that order is following: options >>>>>>> from command line, >>>>>>> then options from JAVA_TOOL_OPTIONS environment >>>>>>> variable and then >>>>>>> options from _JAVA_OPTIONS environment variable. >>>>>>> Thus, in this >>>>>>> case "-XX:+IgnoreUnrecognizedVMOptions" option in >>>>>>> JAVA_TOOL_OPTIONS environment variable will have >>>>>>> bigger priority >>>>>>> than in command line(last argument wins), but >>>>>>> this is differ from >>>>>>> processing options in >>>>>>> Arguments::parse_vm_init_args function. >>>>>>> Thus, I think that you need to swap 3665 and >>>>>>> 3666 lines: >>>>>>> >>>>>>> 3665 >>>>>>> match_special_option_and_act(&java_tool_options_args, >>>>>>> &flags_file); >>>>>>> 3666 match_special_option_and_act(args, >>>>>>> &flags_file); >>>>>>> 3667 >>>>>>> match_special_option_and_act(&java_options_args, >>>>>>> &flags_file); >>>>>>> >>>>>>> Similar situation on lines 3696-3700: >>>>>>> >>>>>>> 3696 if (PrintVMOptions) { >>>>>>> 3697 print_options(args); >>>>>>> 3698 print_options(&java_tool_options_args); >>>>>>> 3699 print_options(&java_options_args); >>>>>>> 3700 } >>>>>>> >>>>>>> Command line options are printed before options >>>>>>> from >>>>>>> JAVA_TOOL_OPTIONS environment variable. Thus, I >>>>>>> think that you >>>>>>> need to swap 3697 and 3698 lines: >>>>>>> >>>>>>> 3696 if (PrintVMOptions) { >>>>>>> 3697 print_options(&java_tool_options_args); >>>>>>> 3698 print_options(args); >>>>>>> 3699 print_options(&java_options_args); >>>>>>> 3700 } >>>>>>> >>>>>>> >>>>>>> 2) One more thing about error processing :) >>>>>>> I think it will be great to free allocated >>>>>>> memory for environment >>>>>>> variables when error occured on lines 3661-3663, >>>>>>> 3679-3681 and >>>>>>> 3685-3687. >>>>>>> My suggestion is to add some static function >>>>>>> which free memory for >>>>>>> env variables, something like that: >>>>>>> static void >>>>>>> free_memory_for_environment_variables( JavaVMInitArgs >>>>>>> *options_args ) { >>>>>>> for (int i = 0; i < options_args->nOptions; >>>>>>> i++) { >>>>>>> os::free(options_args->options[i].optionString); >>>>>>> } >>>>>>> FREE_C_HEAP_ARRAY(JavaVMOption, options_args->options); >>>>>>> } >>>>>>> >>>>>>> And change lines 3661-3663 to following: >>>>>>> >>>>>>> 3661 if (code != JNI_OK) { >>>>>>> 3662 >>>>>>> free_memory_for_environment_variables(&java_tool_options_args); >>>>>>> >>>>>>> 3663 return code; >>>>>>> 3664 } >>>>>>> >>>>>>> Lines 3679-3681 to following: >>>>>>> >>>>>>> 3679 if (!process_settings_file(flags_file, >>>>>>> true, >>>>>>> args->ignoreUnrecognized)) { >>>>>>> 3680 >>>>>>> free_memory_for_environment_variables(&java_tool_options_args); >>>>>>> >>>>>>> 3681 >>>>>>> free_memory_for_environment_variables(&java_options_args); >>>>>>> >>>>>>> 3682 return JNI_EINVAL; >>>>>>> 3683 } >>>>>>> >>>>>>> Lines 3685-3687 to following: >>>>>>> >>>>>>> 3685 if >>>>>>> (!process_settings_file(".hotspotrc", false, >>>>>>> args->ignoreUnrecognized)) { >>>>>>> 3680 >>>>>>> free_memory_for_environment_variables(&java_tool_options_args); >>>>>>> >>>>>>> 3681 >>>>>>> free_memory_for_environment_variables(&java_options_args); >>>>>>> >>>>>>> 3686 return JNI_EINVAL; >>>>>>> 3687 } >>>>>>> >>>>>>> And lines 3706-3715 to following: >>>>>>> >>>>>>> 3706 // Done with the envvars >>>>>>> 3707 >>>>>>> free_memory_for_environment_variables(&java_tool_options_args); >>>>>>> >>>>>>> 3708 >>>>>>> free_memory_for_environment_variables(&java_options_args); >>>>>>> >>>>>>> >>>>>>> >>>>>>> Thank you, >>>>>>> Dmitry >>>>>>> >>>>>>> >>>>>>> On 10.07.2015 14:36, Dmitry Dmitriev wrote: >>>>>>> >>>>>>> Hello Jeremy, >>>>>>> >>>>>>> Thank you for fixing that! But in this case >>>>>>> we still have >>>>>>> minor issue when quotes processing >>>>>>> failed(lines 3438-3444). >>>>>>> Here is my suggestion: leave 'while' >>>>>>> cycle(lines 3423-3462) as >>>>>>> I was in your previous webrev(without >>>>>>> 'start' and etc.) and >>>>>>> call strdup when copy 'options' to >>>>>>> 'options_arr' on lines >>>>>>> 3472-3474, i.e. make lines 3472-3474 like this: >>>>>>> >>>>>>> 3472 for (int i = 0; i < options->length(); >>>>>>> i++) { >>>>>>> 3473 options_arr[i] = options->at(i); >>>>>>> 3474 options_arr[i].optionString = >>>>>>> os::strdup(options_arr[i].optionString); >>>>>>> 3475 } >>>>>>> >>>>>>> What you think about that? >>>>>>> >>>>>>> Regards, >>>>>>> Dmitry >>>>>>> >>>>>>> On 10.07.2015 3:23, Jeremy Manson wrote: >>>>>>> >>>>>>> Hey Dmitry, >>>>>>> >>>>>>> Thanks for looking at it. The leak was deliberate >>>>>>> (under >>>>>>> the theory that the command line flags >>>>>>> were leaked, too), >>>>>>> but it was silly that I didn't fix it. >>>>>>> >>>>>>> Anyway, fixed. See: >>>>>>> >>>>>>> http://cr.openjdk.java.net/~jmanson/8079301/webrev.03 >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> Jeremy >>>>>>> >>>>>>> On Thu, Jul 9, 2015 at 2:52 PM, Dmitry >>>>>>> Dmitriev >>>>>>> >>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>>>> >> wrote: >>>>>>> >>>>>>> Hello Jeremy, >>>>>>> >>>>>>> Correct me if I am wrong, but I see small memory leak >>>>>>> in your >>>>>>> implementation. >>>>>>> In Arguments::parse_options_environment_variable >>>>>>> function memory >>>>>>> for 'buffer' allocated by strdup function on line >>>>>>> 3415, but now it >>>>>>> not freed in this function because data from this >>>>>>> buffer is used >>>>>>> later. On the other hand when we are done with env >>>>>>> variables, we >>>>>>> free only options array(lines 3703-3705) and not free >>>>>>> previously >>>>>>> allocated memory for 'buffer' because we lost track >>>>>>> for it. >>>>>>> >>>>>>> Thanks, >>>>>>> Dmitry >>>>>>> >>>>>>> >>>>>>> On 09.07.2015 21:20, Jeremy Manson wrote: >>>>>>> >>>>>>> Thanks for looking at this, Coleen. >>>>>>> >>>>>>> I merged this with the latest version of hs-rt, >>>>>>> but Ron is or >>>>>>> I am going to >>>>>>> have to do some merging for 8061999. The changes >>>>>>> are relatively >>>>>>> orthogonal, but they touch a couple of the same >>>>>>> places. How >>>>>>> far away is >>>>>>> Ron's checkin? >>>>>>> >>>>>>> Updated webrev: >>>>>>> >>>>>>> http://cr.openjdk.java.net/~jmanson/8079301/webrev.01/ >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> Updated test: >>>>>>> >>>>>>> http://cr.openjdk.java.net/~jmanson/8079301t/webrev.01/ >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> (Mild complaining on my part: the conflicts >>>>>>> wouldn't have been >>>>>>> an issue if >>>>>>> someone had looked at this two months ago, when I >>>>>>> first >>>>>>> asked. I suspect >>>>>>> Ron hadn't even started his change at that point. >>>>>>> And if external >>>>>>> developers were able to submit changes to Hotspot, >>>>>>> we wouldn't >>>>>>> have had to >>>>>>> bother Oracle engineers at all. Neither of these >>>>>>> is your >>>>>>> fault or your >>>>>>> problem, of course - I'm grateful you were able to >>>>>>> take a look.) >>>>>>> >>>>>>> Jeremy >>>>>>> >>>>>>> On Wed, Jul 8, 2015 at 6:19 AM, Coleen Phillimore < >>>>>>> coleen.phillimore at oracle.com >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>>>> >> wrote: >>>>>>> >>>>>>> I'll sponsor it but can you repost the RFR? >>>>>>> >>>>>>> There has been a fair bit of work to command line >>>>>>> processing lately so I'd >>>>>>> like to have the others look at it too. Have >>>>>>> you merged >>>>>>> this up with the >>>>>>> latest version of hs-rt repository and were there >>>>>>> conflicts? Also, have >>>>>>> you looked at the RFR: >>>>>>> >>>>>>> "Open code review for 8061999 Enhance VM >>>>>>> option parsing to >>>>>>> allow options >>>>>>> to be specified" >>>>>>> >>>>>>> and are there conflicts with this? >>>>>>> >>>>>>> The hotspot change looks good to me. >>>>>>> >>>>>>> >>>>>>> http://cr.openjdk.java.net/~jmanson/8079301t/webrev.00/test/com/sun/management/HotSpotDiagnosticMXBean/CheckOrigin.java.udiff.html >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> "UseCerealGC" LOL >>>>>>> Can you use a different option than >>>>>>> PrintOopAddress in >>>>>>> this test? I don't >>>>>>> know why this command line option exists or >>>>>>> would be >>>>>>> useful for, and seems >>>>>>> to be a good candidate for removal. If you >>>>>>> need a valid >>>>>>> argument, that is >>>>>>> unlikely to go away, TraceExceptions would be >>>>>>> good. >>>>>>> >>>>>>> Thanks, >>>>>>> Coleen >>>>>>> >>>>>>> >>>>>>> On 7/7/15 8:00 PM, Jeremy Manson wrote: >>>>>>> >>>>>>> No love? Is there a code owner here I >>>>>>> should pester >>>>>>> more directly? >>>>>>> >>>>>>> Jeremy >>>>>>> >>>>>>> On Fri, Jun 26, 2015 at 3:00 PM, Martin >>>>>>> Buchholz >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>>>> >> >>>>>>> wrote: >>>>>>> >>>>>>> As usual with Google patches, they are >>>>>>> in use >>>>>>> locally. This one has been >>>>>>> >>>>>>> stable for a while without complaints. >>>>>>> Please >>>>>>> sponsor. >>>>>>> >>>>>>> On Fri, Jun 26, 2015 at 1:53 PM, >>>>>>> Jeremy Manson >>>>>>> >>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>>>> >> >>>>>>> wrote: >>>>>>> >>>>>>> All this talk about >>>>>>> IgnoreUnrecognizedVMOptions >>>>>>> reminded me that this >>>>>>> >>>>>>> review is still outstanding. Any >>>>>>> takers? >>>>>>> >>>>>>> Jeremy >>>>>>> >>>>>>> On Tue, May 5, 2015 at 10:01 AM, >>>>>>> Jeremy Manson >>>>>>> >>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>>>> > >>>>>>> wrote: >>>>>>> >>>>>>> Hi David, >>>>>>> >>>>>>> Thanks for taking a look. >>>>>>> >>>>>>> On Mon, May 4, 2015 at 8:32 >>>>>>> PM, David >>>>>>> Holmes >>>>>>> >>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>>>> >> >>>>>>> >>>>>>> wrote: >>>>>>> >>>>>>> Hi Jeremy, >>>>>>> >>>>>>> On 5/05/2015 6:51 AM, >>>>>>> Jeremy Manson wrote: >>>>>>> >>>>>>> Not sure who might be >>>>>>> willing to >>>>>>> sponsor this. David? You >>>>>>> did the >>>>>>> >>>>>>> last >>>>>>> one. :) >>>>>>> >>>>>>> Might be a while >>>>>>> before I can >>>>>>> get to it. I did have >>>>>>> a quick look >>>>>>> >>>>>>> (and >>>>>>> will need a longer one). >>>>>>> >>>>>>> I understand. I'm just happy it's >>>>>>> possible to upstream this stuff at >>>>>>> all[1]. >>>>>>> >>>>>>> [1] With the eternal caveat >>>>>>> that I'd be >>>>>>> happier if we didn't *have* to >>>>>>> go through you folks, but >>>>>>> we've learned to >>>>>>> live with it. >>>>>>> >>>>>>> >>>>>>> >>>>>>> Context: A number of >>>>>>> command line >>>>>>> options are not settable via >>>>>>> >>>>>>> JAVA_TOOL_OPTIONS and _JAVA_OPTIONS: >>>>>>> >>>>>>> - PrintVMOptions >>>>>>> >>>>>>> So you have changed the >>>>>>> semantics of this to >>>>>>> print out the >>>>>>> options >>>>>>> >>>>>>> from >>>>>>> the command-line and each >>>>>>> of the two >>>>>>> env vars. Seems reasonable but >>>>>>> may be >>>>>>> better to know which >>>>>>> option came from >>>>>>> where as we can now see >>>>>>> the same >>>>>>> option (or conflicting >>>>>>> variants >>>>>>> thereof) multiple times. >>>>>>> >>>>>>> I'd be happy to do >>>>>>> this. Any >>>>>>> preferred syntax? Does someone >>>>>>> >>>>>>> actually >>>>>>> own this feature? >>>>>>> >>>>>>> I'm unclear what the current >>>>>>> processing >>>>>>> order is for the different >>>>>>> >>>>>>> sources of options, and >>>>>>> whether the >>>>>>> changes affect that order? >>>>>>> >>>>>>> Nope. I go through sad >>>>>>> contortions >>>>>>> to keep the processing >>>>>>> order the >>>>>>> >>>>>>> same. It's JAVA_TOOL_OPTIONS, >>>>>>> then >>>>>>> command line, then _JAVA_OPTIONS. >>>>>>> See >>>>>>> lines 2549-2567. >>>>>>> >>>>>>> >>>>>>> - >>>>>>> IgnoreUnrecognizedVMOptions >>>>>>> >>>>>>> - PrintFlagsInitial >>>>>>> >>>>>>> Unclear what >>>>>>> "initial" actually >>>>>>> means - is it the default? >>>>>>> >>>>>>> More or less. If you stick, >>>>>>> for example, >>>>>>> IgnoreUnrecognizedVMOptions >>>>>>> in >>>>>>> there first, it will get >>>>>>> printed out as >>>>>>> "true". I haven't really >>>>>>> changed >>>>>>> the semantics here either - >>>>>>> I've just >>>>>>> added processing of the envvars. >>>>>>> >>>>>>> - NativeMemoryTracking >>>>>>> >>>>>>> - PrintFlagsWithComments >>>>>>> >>>>>>> This is because these >>>>>>> flags have >>>>>>> to be processed before >>>>>>> processing >>>>>>> other >>>>>>> flags, and no one ever >>>>>>> bothered to >>>>>>> do that for the flags >>>>>>> coming from >>>>>>> environment >>>>>>> variables. This patch >>>>>>> fixes that problem. >>>>>>> >>>>>>> I have a test, but it is a >>>>>>> modification to a JDK >>>>>>> test instead >>>>>>> of a HS >>>>>>> test, >>>>>>> so it can go in >>>>>>> separately (I guess). >>>>>>> >>>>>>> They can be pushed >>>>>>> together to >>>>>>> different repos in the >>>>>>> same forest. >>>>>>> >>>>>>> Okay. Here's the test >>>>>>> change: >>>>>>> >>>>>>> http://cr.openjdk.java.net/~jmanson/8079301t/webrev.00/ >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> As I said I'll have to get >>>>>>> back to this. >>>>>>> And hopefully someone else in >>>>>>> >>>>>>> runtime will take a good >>>>>>> look as well ;-) >>>>>>> >>>>>>> I'd be happy to toss it >>>>>>> over to >>>>>>> whomever owns this, if anyone. >>>>>>> >>>>>>> Thanks! >>>>>>> >>>>>>> Jeremy >>>>>>> >>>>>>> >>>>>>> >>>>>>> Bug: >>>>>>> >>>>>>> https://bugs.openjdk.java.net/browse/JDK-8079301 >>>>>>> >>>>>>> Webrev: >>>>>>> http://cr.openjdk.java.net/~jmanson/8079301/webrev.00/ >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> Jeremy >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>> >>>> >>> >> >> >> > > From coleen.phillimore at oracle.com Thu Jul 16 18:02:20 2015 From: coleen.phillimore at oracle.com (Coleen Phillimore) Date: Thu, 16 Jul 2015 14:02:20 -0400 Subject: RFR: 8079301: Some command line options not settable via JAVA_TOOL_OPTIONS In-Reply-To: References: <559D237C.2060702@oracle.com> <559EED17.4060109@oracle.com> <559FAE4B.5060505@oracle.com> <559FBFFB.3060206@oracle.com> <55A01184.7080102@oracle.com> <55A0361B.2060307@oracle.com> <55A2794E.20502@oracle.com> <55A56713.8090308@oracle.com> <55A5705D.9080500@oracle.com> <55A79032.3060709@oracle.com> Message-ID: <55A7F1AC.3010903@oracle.com> I think this looks good. I will sponsor it. Please send me the hg export of the changeset. Thanks! Coleen On 7/16/15 1:20 PM, Jeremy Manson wrote: > Thanks for the thorough review. > > http://cr.openjdk.java.net/~jmanson/8079301/webrev.06/ > > > As for other jint->int opportunities: the only ones I found were in > loop bounds, and I decided it didn't improve the code to change those. > > Jeremy > > On Thu, Jul 16, 2015 at 4:06 AM, Dmitry Dmitriev > > wrote: > > Hello Jeremy, > > Thank you for doing this! Looks good, just few comments: > 1) Latest code still not check return value of > 'match_special_option_and_act' new function on lines 3702-3704. > I repeat comment here from one of the e-mail below just in case if > you missed it: In one case it can return error(JNI_ERR) when > "-XX:NativeMemoryTracking" is specified and INCLUDE_NMT is not > defined. Thus, I think that check for return value should be added. > 2) There are some mix with int/jint variables and return values. I > think that all these should be converted to jint. > Here what I see: > -change return value of new 'set_args' method on line 3415 to > 'jint'. 'set_args' method called only once(on line 3515) and it > return value is set to variable 'status' with 'jint' type. > -change return value of new 'match_special_option_and_act' > function on line 3602 to 'jint' > -change type of 'code' variable on line 3691 to 'jint'. In some > cases 'code' can be returned from Arguments::parse function, but > return value of Arguments::parse function is 'jint'. > > Thank you, > Dmitry > > On 16.07.2015 3:27, Jeremy Manson wrote: >> New rev: >> >> http://cr.openjdk.java.net/~jmanson/8079301/webrev.05/ >> >> >> Thanks for all the attention! >> >> On Wed, Jul 15, 2015 at 3:39 PM, Jeremy Manson >> > wrote: >> >> Sorry about the delay. We were finally able to get JDK8 to >> the point where we could use it without our services falling >> apart, so we rolled it forward at Google. I've spent a lot of >> the last week putting out fires. Also, house renovations. :/ >> >> I think that it is long past time for Hotspot to start using >> the RAII classes everyone else in the world adopted years >> ago, and will be happy to implement one for this case. It >> was pretty hard for me to avoid the temptation when I was >> writing this code in the first place, but the general lack of >> them throughout the codebase made me think that they were >> unpopular. >> >> Some crazy day we might even consider rolling forward to the >> 21st century and starting to use unique_ptr in the source base. >> >> I'll ping the thread when there's a new rev. >> >> Jeremy >> >> On Tue, Jul 14, 2015 at 1:26 PM, Dmitry Dmitriev >> > > wrote: >> >> Hello Coleen, >> >> Yes, I like your approach. It seems more accurate. Thus, >> desctructor can be something like that: >> ~EnvInitArgs() { >> if( _args.options != NULL ) { >> for (int i = 0; i < _args.nOptions; i++) { >> os::free(_args.options[i].optionString); >> } >> FREE_C_HEAP_ARRAY(JavaVMOption, _args.options); >> } >> } >> >> Jeremy, what you think about that? >> >> Thank you, >> Dmitry >> >> >> On 14.07.2015 22:46, Coleen Phillimore wrote: >>> >>> >>> On 7/12/15 10:27 AM, Dmitry Dmitriev wrote: >>>> Hello Coleen, >>>> >>>> I think that adding destructor not help with this, >>>> since all this code with free_memory_for_vm_init_args >>>> is a special workaround for processing options in env >>>> variables and not applied to the options from command >>>> line which passed in 'args' to the Arguments::parse >>>> function. >>> >>> I see - JavaVMInitArgs is a C struct in jni.h >>> >>> If you wrap JavaVMInitArgs for the options for >>> environment variables in a scoped object that calls the >>> destructor to clean up JavaVMInitArgs, this would >>> eliminate all these extra calls that you have to make to >>> free_memory_for_vm_init_args: >>> >>> class EnvInitArgs : public StackObj { >>> JavaVMInitArgs _args; >>> public: >>> ~EnvInitArgs() { >>> // Code to conditionally delete option memory >>> that you have in free_memory_for_vm_init_args >>> } >>> JavaVMInitArgs* init_args() const { return &_args; } >>> } >>> >>> You can put this in the constructor: >>> >>> + vm_args->version = JNI_VERSION_1_2; >>> + vm_args->options = NULL; >>> + vm_args->nOptions = 0; >>> + vm_args->ignoreUnrecognized = false; >>> I think this would be neater than having to check for >>> JNI_OK and call free everywhere. >>> >>> Coleen >>> >>>> >>>> About match_special_option_and_act. Probably it can be >>>> processed in the following way(raw idea): >>>> code = >>>> match_special_option_and_act(&java_tool_options_args, >>>> &flags_file); >>>> if (code == JNI_OK) { >>>> // call next >>>> code = match_special_option_and_act(args, &flags_file); >>>> } >>>> >>>> if (code == JNI_OK) { >>>> // call next >>>> code = >>>> match_special_option_and_act(&java_options_args, >>>> &flags_file); >>>> } >>>> >>>> if (code != JNI_OK) { >>>> free_memory_for_vm_init_args(&java_tool_options_args); >>>> free_memory_for_vm_init_args(&java_options_args); >>>> return code; >>>> } >>>> >>>> Thanks, >>>> Dmitry >>>> >>>> On 11.07.2015 0:16, Coleen Phillimore wrote: >>>>> >>>>> Hi, I have a couple of suggestions. >>>>> >>>>> Can you add a destructor to JavaVMInitArgs which will >>>>> delete the options things if they exist? Then you >>>>> won't need these free_memory_for_vm_init_args >>>>> functions. I think this would work. >>>>> >>>>> Secondly, I was also going to comment about >>>>> match_special_option_and_act not using it's return >>>>> value. The destructor code would make this less >>>>> cumbersome. I like the refactoring though. >>>>> >>>>> Thanks, >>>>> Coleen >>>>> >>>>> On 7/10/15 2:40 PM, Dmitry Dmitriev wrote: >>>>>> Jeremy, thank you for fixing that! Please, see my >>>>>> comments inline for 2 item and one more comment. >>>>>> >>>>>> On 10.07.2015 20:15, Jeremy Manson wrote: >>>>>>> Thanks for the detailed look, Dmitry. I have taken >>>>>>> your advice, with a couple of exceptions: >>>>>>> >>>>>>> 1) I named the method free_memory_for_vm_init_args >>>>>>> instead of free_memory_for_environment_variables. >>>>>>> 2) I did not free the memory in 3661-3663 or in >>>>>>> 3679-3681, because those are error paths where the >>>>>>> memory may not have been allocated in the first >>>>>>> place. So freeing it might lead to a crash. >>>>>> Yes, you are right. But I think we can guard from >>>>>> this by adding check for args->options in new >>>>>> free_memory_for_vm_init_args function and free memory >>>>>> in all execution paths. If args->options is not NULL, >>>>>> then memory is allocated and must be freed: >>>>>> >>>>>> 3485 static void >>>>>> free_memory_for_vm_init_args(JavaVMInitArgs* args) { >>>>>> 3486 if( args->options != NULL ) { >>>>>> 3487 for (int i = 0; i < args->nOptions; i++) { >>>>>> 3488 os::free(args->options[i].optionString); >>>>>> 3489 } >>>>>> 3490 FREE_C_HEAP_ARRAY(JavaVMOption, args->options); >>>>>> 3491 } >>>>>> 3492 } >>>>>> >>>>>> As I see you add free memory for error paths at >>>>>> lines(webrev.04) 3668-3671 and 3687-3691. Thus, with >>>>>> that guard you can add two calls to >>>>>> free_memory_for_vm_init_args function before "return >>>>>> JNI_EINVAL;" on line 3696: >>>>>> >>>>>> 3693 #ifdef ASSERT >>>>>> 3694 // Parse default .hotspotrc settings file >>>>>> 3695 if (!process_settings_file(".hotspotrc", >>>>>> false, args->ignoreUnrecognized)) { >>>>>> 3696 return JNI_EINVAL; >>>>>> 3697 } >>>>>> 3698 #else >>>>>> >>>>>> >>>>>> And one more comment. Unfortunately I oversight this >>>>>> before... You not check return value from >>>>>> 'match_special_option_and_act' new function on lines >>>>>> 3673-3675, but in one case it can return >>>>>> error(JNI_ERR) when "-XX:NativeMemoryTracking" is >>>>>> specified and INCLUDE_NMT is not defined. Thus, I >>>>>> think that check for return value should be >>>>>> added(with freeing memory for env variables in case >>>>>> of error). >>>>>> >>>>>> Thank you, >>>>>> Dmitry >>>>>> >>>>>>> >>>>>>> New Rev: >>>>>>> >>>>>>> http://cr.openjdk.java.net/~jmanson/8079301/webrev.04/ >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> Jeremy >>>>>>> >>>>>>> On Fri, Jul 10, 2015 at 5:52 AM, Dmitry Dmitriev >>>>>>> >>>>>> >>>>>>> >>>>>>> > wrote: >>>>>>> >>>>>>> Jeremy, >>>>>>> >>>>>>> Two additional comments which I didn't catch >>>>>>> earlier... >>>>>>> >>>>>>> 1) Order of processing command line options is >>>>>>> following(Arguments::parse_vm_init_args function): >>>>>>> options from >>>>>>> JAVA_TOOL_OPTIONS environment variable, then options >>>>>>> from command >>>>>>> line and then options from _JAVA_OPTIONS >>>>>>> environment variable. And >>>>>>> last argument wins! >>>>>>> >>>>>>> You not change this order in >>>>>>> Arguments::parse_vm_init_args >>>>>>> function, but it seems that order in several >>>>>>> other places is changed. >>>>>>> >>>>>>> Lines 3665-3667: >>>>>>> >>>>>>> 3665 match_special_option_and_act(args, >>>>>>> &flags_file); >>>>>>> 3666 >>>>>>> match_special_option_and_act(&java_tool_options_args, >>>>>>> &flags_file); >>>>>>> 3667 >>>>>>> match_special_option_and_act(&java_options_args, >>>>>>> &flags_file); >>>>>>> >>>>>>> Here we see that order is following: options >>>>>>> from command line, >>>>>>> then options from JAVA_TOOL_OPTIONS environment >>>>>>> variable and then >>>>>>> options from _JAVA_OPTIONS environment variable. >>>>>>> Thus, in this >>>>>>> case "-XX:+IgnoreUnrecognizedVMOptions" option in >>>>>>> JAVA_TOOL_OPTIONS environment variable will have >>>>>>> bigger priority >>>>>>> than in command line(last argument wins), but >>>>>>> this is differ from >>>>>>> processing options in >>>>>>> Arguments::parse_vm_init_args function. >>>>>>> Thus, I think that you need to swap 3665 and >>>>>>> 3666 lines: >>>>>>> >>>>>>> 3665 >>>>>>> match_special_option_and_act(&java_tool_options_args, >>>>>>> &flags_file); >>>>>>> 3666 match_special_option_and_act(args, >>>>>>> &flags_file); >>>>>>> 3667 >>>>>>> match_special_option_and_act(&java_options_args, >>>>>>> &flags_file); >>>>>>> >>>>>>> Similar situation on lines 3696-3700: >>>>>>> >>>>>>> 3696 if (PrintVMOptions) { >>>>>>> 3697 print_options(args); >>>>>>> 3698 print_options(&java_tool_options_args); >>>>>>> 3699 print_options(&java_options_args); >>>>>>> 3700 } >>>>>>> >>>>>>> Command line options are printed before options >>>>>>> from >>>>>>> JAVA_TOOL_OPTIONS environment variable. Thus, I >>>>>>> think that you >>>>>>> need to swap 3697 and 3698 lines: >>>>>>> >>>>>>> 3696 if (PrintVMOptions) { >>>>>>> 3697 print_options(&java_tool_options_args); >>>>>>> 3698 print_options(args); >>>>>>> 3699 print_options(&java_options_args); >>>>>>> 3700 } >>>>>>> >>>>>>> >>>>>>> 2) One more thing about error processing :) >>>>>>> I think it will be great to free allocated >>>>>>> memory for environment >>>>>>> variables when error occured on lines 3661-3663, >>>>>>> 3679-3681 and >>>>>>> 3685-3687. >>>>>>> My suggestion is to add some static function >>>>>>> which free memory for >>>>>>> env variables, something like that: >>>>>>> static void >>>>>>> free_memory_for_environment_variables( JavaVMInitArgs >>>>>>> *options_args ) { >>>>>>> for (int i = 0; i < options_args->nOptions; >>>>>>> i++) { >>>>>>> os::free(options_args->options[i].optionString); >>>>>>> } >>>>>>> FREE_C_HEAP_ARRAY(JavaVMOption, options_args->options); >>>>>>> } >>>>>>> >>>>>>> And change lines 3661-3663 to following: >>>>>>> >>>>>>> 3661 if (code != JNI_OK) { >>>>>>> 3662 >>>>>>> free_memory_for_environment_variables(&java_tool_options_args); >>>>>>> >>>>>>> 3663 return code; >>>>>>> 3664 } >>>>>>> >>>>>>> Lines 3679-3681 to following: >>>>>>> >>>>>>> 3679 if (!process_settings_file(flags_file, >>>>>>> true, >>>>>>> args->ignoreUnrecognized)) { >>>>>>> 3680 >>>>>>> free_memory_for_environment_variables(&java_tool_options_args); >>>>>>> >>>>>>> 3681 >>>>>>> free_memory_for_environment_variables(&java_options_args); >>>>>>> >>>>>>> 3682 return JNI_EINVAL; >>>>>>> 3683 } >>>>>>> >>>>>>> Lines 3685-3687 to following: >>>>>>> >>>>>>> 3685 if >>>>>>> (!process_settings_file(".hotspotrc", false, >>>>>>> args->ignoreUnrecognized)) { >>>>>>> 3680 >>>>>>> free_memory_for_environment_variables(&java_tool_options_args); >>>>>>> >>>>>>> 3681 >>>>>>> free_memory_for_environment_variables(&java_options_args); >>>>>>> >>>>>>> 3686 return JNI_EINVAL; >>>>>>> 3687 } >>>>>>> >>>>>>> And lines 3706-3715 to following: >>>>>>> >>>>>>> 3706 // Done with the envvars >>>>>>> 3707 >>>>>>> free_memory_for_environment_variables(&java_tool_options_args); >>>>>>> >>>>>>> 3708 >>>>>>> free_memory_for_environment_variables(&java_options_args); >>>>>>> >>>>>>> >>>>>>> >>>>>>> Thank you, >>>>>>> Dmitry >>>>>>> >>>>>>> >>>>>>> On 10.07.2015 14:36, Dmitry Dmitriev wrote: >>>>>>> >>>>>>> Hello Jeremy, >>>>>>> >>>>>>> Thank you for fixing that! But in this case >>>>>>> we still have >>>>>>> minor issue when quotes processing >>>>>>> failed(lines 3438-3444). >>>>>>> Here is my suggestion: leave 'while' >>>>>>> cycle(lines 3423-3462) as >>>>>>> I was in your previous webrev(without >>>>>>> 'start' and etc.) and >>>>>>> call strdup when copy 'options' to >>>>>>> 'options_arr' on lines >>>>>>> 3472-3474, i.e. make lines 3472-3474 like this: >>>>>>> >>>>>>> 3472 for (int i = 0; i < options->length(); >>>>>>> i++) { >>>>>>> 3473 options_arr[i] = options->at(i); >>>>>>> 3474 options_arr[i].optionString = >>>>>>> os::strdup(options_arr[i].optionString); >>>>>>> 3475 } >>>>>>> >>>>>>> What you think about that? >>>>>>> >>>>>>> Regards, >>>>>>> Dmitry >>>>>>> >>>>>>> On 10.07.2015 3:23, Jeremy Manson wrote: >>>>>>> >>>>>>> Hey Dmitry, >>>>>>> >>>>>>> Thanks for looking at it. The leak was deliberate >>>>>>> (under >>>>>>> the theory that the command line flags >>>>>>> were leaked, too), >>>>>>> but it was silly that I didn't fix it. >>>>>>> >>>>>>> Anyway, fixed. See: >>>>>>> >>>>>>> http://cr.openjdk.java.net/~jmanson/8079301/webrev.03 >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> Jeremy >>>>>>> >>>>>>> On Thu, Jul 9, 2015 at 2:52 PM, Dmitry >>>>>>> Dmitriev >>>>>>> >>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>>>> >> wrote: >>>>>>> >>>>>>> Hello Jeremy, >>>>>>> >>>>>>> Correct me if I am wrong, but I see small memory leak >>>>>>> in your >>>>>>> implementation. >>>>>>> In Arguments::parse_options_environment_variable >>>>>>> function memory >>>>>>> for 'buffer' allocated by strdup function on line >>>>>>> 3415, but now it >>>>>>> not freed in this function because data from this >>>>>>> buffer is used >>>>>>> later. On the other hand when we are done with env >>>>>>> variables, we >>>>>>> free only options array(lines 3703-3705) and not free >>>>>>> previously >>>>>>> allocated memory for 'buffer' because we lost track >>>>>>> for it. >>>>>>> >>>>>>> Thanks, >>>>>>> Dmitry >>>>>>> >>>>>>> >>>>>>> On 09.07.2015 21:20, Jeremy Manson wrote: >>>>>>> >>>>>>> Thanks for looking at this, Coleen. >>>>>>> >>>>>>> I merged this with the latest version of hs-rt, >>>>>>> but Ron is or >>>>>>> I am going to >>>>>>> have to do some merging for 8061999. The changes >>>>>>> are relatively >>>>>>> orthogonal, but they touch a couple of the same >>>>>>> places. How >>>>>>> far away is >>>>>>> Ron's checkin? >>>>>>> >>>>>>> Updated webrev: >>>>>>> >>>>>>> http://cr.openjdk.java.net/~jmanson/8079301/webrev.01/ >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> Updated test: >>>>>>> >>>>>>> http://cr.openjdk.java.net/~jmanson/8079301t/webrev.01/ >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> (Mild complaining on my part: the conflicts >>>>>>> wouldn't have been >>>>>>> an issue if >>>>>>> someone had looked at this two months ago, when I >>>>>>> first >>>>>>> asked. I suspect >>>>>>> Ron hadn't even started his change at that point. >>>>>>> And if external >>>>>>> developers were able to submit changes to Hotspot, >>>>>>> we wouldn't >>>>>>> have had to >>>>>>> bother Oracle engineers at all. Neither of these >>>>>>> is your >>>>>>> fault or your >>>>>>> problem, of course - I'm grateful you were able to >>>>>>> take a look.) >>>>>>> >>>>>>> Jeremy >>>>>>> >>>>>>> On Wed, Jul 8, 2015 at 6:19 AM, Coleen Phillimore < >>>>>>> coleen.phillimore at oracle.com >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>>>> >> wrote: >>>>>>> >>>>>>> I'll sponsor it but can you repost the RFR? >>>>>>> >>>>>>> There has been a fair bit of work to command line >>>>>>> processing lately so I'd >>>>>>> like to have the others look at it too. Have >>>>>>> you merged >>>>>>> this up with the >>>>>>> latest version of hs-rt repository and were there >>>>>>> conflicts? Also, have >>>>>>> you looked at the RFR: >>>>>>> >>>>>>> "Open code review for 8061999 Enhance VM >>>>>>> option parsing to >>>>>>> allow options >>>>>>> to be specified" >>>>>>> >>>>>>> and are there conflicts with this? >>>>>>> >>>>>>> The hotspot change looks good to me. >>>>>>> >>>>>>> >>>>>>> http://cr.openjdk.java.net/~jmanson/8079301t/webrev.00/test/com/sun/management/HotSpotDiagnosticMXBean/CheckOrigin.java.udiff.html >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> "UseCerealGC" LOL >>>>>>> Can you use a different option than >>>>>>> PrintOopAddress in >>>>>>> this test? I don't >>>>>>> know why this command line option exists or >>>>>>> would be >>>>>>> useful for, and seems >>>>>>> to be a good candidate for removal. If you >>>>>>> need a valid >>>>>>> argument, that is >>>>>>> unlikely to go away, TraceExceptions would be >>>>>>> good. >>>>>>> >>>>>>> Thanks, >>>>>>> Coleen >>>>>>> >>>>>>> >>>>>>> On 7/7/15 8:00 PM, Jeremy Manson wrote: >>>>>>> >>>>>>> No love? Is there a code owner here I >>>>>>> should pester >>>>>>> more directly? >>>>>>> >>>>>>> Jeremy >>>>>>> >>>>>>> On Fri, Jun 26, 2015 at 3:00 PM, Martin >>>>>>> Buchholz >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>>>> >> >>>>>>> wrote: >>>>>>> >>>>>>> As usual with Google patches, they are >>>>>>> in use >>>>>>> locally. This one has been >>>>>>> >>>>>>> stable for a while without complaints. >>>>>>> Please >>>>>>> sponsor. >>>>>>> >>>>>>> On Fri, Jun 26, 2015 at 1:53 PM, >>>>>>> Jeremy Manson >>>>>>> >>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>>>> >> >>>>>>> wrote: >>>>>>> >>>>>>> All this talk about >>>>>>> IgnoreUnrecognizedVMOptions >>>>>>> reminded me that this >>>>>>> >>>>>>> review is still outstanding. Any >>>>>>> takers? >>>>>>> >>>>>>> Jeremy >>>>>>> >>>>>>> On Tue, May 5, 2015 at 10:01 AM, >>>>>>> Jeremy Manson >>>>>>> >>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>>>> > >>>>>>> wrote: >>>>>>> >>>>>>> Hi David, >>>>>>> >>>>>>> Thanks for taking a look. >>>>>>> >>>>>>> On Mon, May 4, 2015 at 8:32 >>>>>>> PM, David >>>>>>> Holmes >>>>>>> >>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>>>> >> >>>>>>> >>>>>>> wrote: >>>>>>> >>>>>>> Hi Jeremy, >>>>>>> >>>>>>> On 5/05/2015 6:51 AM, >>>>>>> Jeremy Manson wrote: >>>>>>> >>>>>>> Not sure who might be >>>>>>> willing to >>>>>>> sponsor this. David? You >>>>>>> did the >>>>>>> >>>>>>> last >>>>>>> one. :) >>>>>>> >>>>>>> Might be a while >>>>>>> before I can >>>>>>> get to it. I did have >>>>>>> a quick look >>>>>>> >>>>>>> (and >>>>>>> will need a longer one). >>>>>>> >>>>>>> I understand. I'm just happy it's >>>>>>> possible to upstream this stuff at >>>>>>> all[1]. >>>>>>> >>>>>>> [1] With the eternal caveat >>>>>>> that I'd be >>>>>>> happier if we didn't *have* to >>>>>>> go through you folks, but >>>>>>> we've learned to >>>>>>> live with it. >>>>>>> >>>>>>> >>>>>>> >>>>>>> Context: A number of >>>>>>> command line >>>>>>> options are not settable via >>>>>>> >>>>>>> JAVA_TOOL_OPTIONS and _JAVA_OPTIONS: >>>>>>> >>>>>>> - PrintVMOptions >>>>>>> >>>>>>> So you have changed the >>>>>>> semantics of this to >>>>>>> print out the >>>>>>> options >>>>>>> >>>>>>> from >>>>>>> the command-line and each >>>>>>> of the two >>>>>>> env vars. Seems reasonable but >>>>>>> may be >>>>>>> better to know which >>>>>>> option came from >>>>>>> where as we can now see >>>>>>> the same >>>>>>> option (or conflicting >>>>>>> variants >>>>>>> thereof) multiple times. >>>>>>> >>>>>>> I'd be happy to do >>>>>>> this. Any >>>>>>> preferred syntax? Does someone >>>>>>> >>>>>>> actually >>>>>>> own this feature? >>>>>>> >>>>>>> I'm unclear what the current >>>>>>> processing >>>>>>> order is for the different >>>>>>> >>>>>>> sources of options, and >>>>>>> whether the >>>>>>> changes affect that order? >>>>>>> >>>>>>> Nope. I go through sad >>>>>>> contortions >>>>>>> to keep the processing >>>>>>> order the >>>>>>> >>>>>>> same. It's JAVA_TOOL_OPTIONS, >>>>>>> then >>>>>>> command line, then _JAVA_OPTIONS. >>>>>>> See >>>>>>> lines 2549-2567. >>>>>>> >>>>>>> >>>>>>> - >>>>>>> IgnoreUnrecognizedVMOptions >>>>>>> >>>>>>> - PrintFlagsInitial >>>>>>> >>>>>>> Unclear what >>>>>>> "initial" actually >>>>>>> means - is it the default? >>>>>>> >>>>>>> More or less. If you stick, >>>>>>> for example, >>>>>>> IgnoreUnrecognizedVMOptions >>>>>>> in >>>>>>> there first, it will get >>>>>>> printed out as >>>>>>> "true". I haven't really >>>>>>> changed >>>>>>> the semantics here either - >>>>>>> I've just >>>>>>> added processing of the envvars. >>>>>>> >>>>>>> - NativeMemoryTracking >>>>>>> >>>>>>> - PrintFlagsWithComments >>>>>>> >>>>>>> This is because these >>>>>>> flags have >>>>>>> to be processed before >>>>>>> processing >>>>>>> other >>>>>>> flags, and no one ever >>>>>>> bothered to >>>>>>> do that for the flags >>>>>>> coming from >>>>>>> environment >>>>>>> variables. This patch >>>>>>> fixes that problem. >>>>>>> >>>>>>> I have a test, but it is a >>>>>>> modification to a JDK >>>>>>> test instead >>>>>>> of a HS >>>>>>> test, >>>>>>> so it can go in >>>>>>> separately (I guess). >>>>>>> >>>>>>> They can be pushed >>>>>>> together to >>>>>>> different repos in the >>>>>>> same forest. >>>>>>> >>>>>>> Okay. Here's the test >>>>>>> change: >>>>>>> >>>>>>> http://cr.openjdk.java.net/~jmanson/8079301t/webrev.00/ >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> As I said I'll have to get >>>>>>> back to this. >>>>>>> And hopefully someone else in >>>>>>> >>>>>>> runtime will take a good >>>>>>> look as well ;-) >>>>>>> >>>>>>> I'd be happy to toss it >>>>>>> over to >>>>>>> whomever owns this, if anyone. >>>>>>> >>>>>>> Thanks! >>>>>>> >>>>>>> Jeremy >>>>>>> >>>>>>> >>>>>>> >>>>>>> Bug: >>>>>>> >>>>>>> https://bugs.openjdk.java.net/browse/JDK-8079301 >>>>>>> >>>>>>> Webrev: >>>>>>> http://cr.openjdk.java.net/~jmanson/8079301/webrev.00/ >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> Jeremy >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>> >>>> >>> >> >> >> > > From coleen.phillimore at oracle.com Thu Jul 16 18:09:58 2015 From: coleen.phillimore at oracle.com (Coleen Phillimore) Date: Thu, 16 Jul 2015 14:09:58 -0400 Subject: RFR: 8079301: Some command line options not settable via JAVA_TOOL_OPTIONS In-Reply-To: References: <554839B4.3020800@oracle.com> <559D237C.2060702@oracle.com> <559EED17.4060109@oracle.com> <559FAE4B.5060505@oracle.com> <559FBFFB.3060206@oracle.com> <55A01184.7080102@oracle.com> <55A0361B.2060307@oracle.com> <55A2794E.20502@oracle.com> <55A56713.8090308@oracle.com> <55A5705D.9080500@oracle.com> Message-ID: <55A7F376.3010407@oracle.com> On 7/15/15 6:39 PM, Jeremy Manson wrote: > Sorry about the delay. We were finally able to get JDK8 to the point > where we could use it without our services falling apart, so we rolled > it forward at Google. I've spent a lot of the last week putting out > fires. Also, house renovations. :/ > > I think that it is long past time for Hotspot to start using the RAII > classes everyone else in the world adopted years ago, and will be > happy to implement one for this case. It was pretty hard for me to > avoid the temptation when I was writing this code in the first place, > but the general lack of them throughout the codebase made me think > that they were unpopular. lol, nah, just under utilized. Most stuff used to be cleaned up by the GC or by ResourceMark, which the initial implementers of Hotspot thought was (is) better. > > Some crazy day we might even consider rolling forward to the 21st > century and starting to use unique_ptr in the source base. That's going a bit further. We still have some years left before the end of the 21st century though so you never know. Coleen > > I'll ping the thread when there's a new rev. > > Jeremy > > On Tue, Jul 14, 2015 at 1:26 PM, Dmitry Dmitriev > > wrote: > > Hello Coleen, > > Yes, I like your approach. It seems more accurate. Thus, > desctructor can be something like that: > ~EnvInitArgs() { > if( _args.options != NULL ) { > for (int i = 0; i < _args.nOptions; i++) { > os::free(_args.options[i].optionString); > } > FREE_C_HEAP_ARRAY(JavaVMOption, _args.options); > } > } > > Jeremy, what you think about that? > > Thank you, > Dmitry > > > On 14.07.2015 22:46, Coleen Phillimore wrote: >> >> >> On 7/12/15 10:27 AM, Dmitry Dmitriev wrote: >>> Hello Coleen, >>> >>> I think that adding destructor not help with this, since all >>> this code with free_memory_for_vm_init_args is a special >>> workaround for processing options in env variables and not >>> applied to the options from command line which passed in 'args' >>> to the Arguments::parse function. >> >> I see - JavaVMInitArgs is a C struct in jni.h >> >> If you wrap JavaVMInitArgs for the options for environment >> variables in a scoped object that calls the destructor to clean >> up JavaVMInitArgs, this would eliminate all these extra calls >> that you have to make to free_memory_for_vm_init_args: >> >> class EnvInitArgs : public StackObj { >> JavaVMInitArgs _args; >> public: >> ~EnvInitArgs() { >> // Code to conditionally delete option memory that you >> have in free_memory_for_vm_init_args >> } >> JavaVMInitArgs* init_args() const { return &_args; } >> } >> >> You can put this in the constructor: >> >> + vm_args->version = JNI_VERSION_1_2; >> + vm_args->options = NULL; >> + vm_args->nOptions = 0; >> + vm_args->ignoreUnrecognized = false; >> I think this would be neater than having to check for JNI_OK and >> call free everywhere. >> >> Coleen >> >>> >>> About match_special_option_and_act. Probably it can be processed >>> in the following way(raw idea): >>> code = match_special_option_and_act(&java_tool_options_args, >>> &flags_file); >>> if (code == JNI_OK) { >>> // call next >>> code = match_special_option_and_act(args, &flags_file); >>> } >>> >>> if (code == JNI_OK) { >>> // call next >>> code = match_special_option_and_act(&java_options_args, >>> &flags_file); >>> } >>> >>> if (code != JNI_OK) { >>> free_memory_for_vm_init_args(&java_tool_options_args); >>> free_memory_for_vm_init_args(&java_options_args); >>> return code; >>> } >>> >>> Thanks, >>> Dmitry >>> >>> On 11.07.2015 0:16, Coleen Phillimore wrote: >>>> >>>> Hi, I have a couple of suggestions. >>>> >>>> Can you add a destructor to JavaVMInitArgs which will delete >>>> the options things if they exist? Then you won't need these >>>> free_memory_for_vm_init_args functions. I think this would work. >>>> >>>> Secondly, I was also going to comment about >>>> match_special_option_and_act not using it's return value. The >>>> destructor code would make this less cumbersome. I like the >>>> refactoring though. >>>> >>>> Thanks, >>>> Coleen >>>> >>>> On 7/10/15 2:40 PM, Dmitry Dmitriev wrote: >>>>> Jeremy, thank you for fixing that! Please, see my comments >>>>> inline for 2 item and one more comment. >>>>> >>>>> On 10.07.2015 20:15, Jeremy Manson wrote: >>>>>> Thanks for the detailed look, Dmitry. I have taken your >>>>>> advice, with a couple of exceptions: >>>>>> >>>>>> 1) I named the method free_memory_for_vm_init_args instead of >>>>>> free_memory_for_environment_variables. >>>>>> 2) I did not free the memory in 3661-3663 or in 3679-3681, >>>>>> because those are error paths where the memory may not have >>>>>> been allocated in the first place. So freeing it might lead >>>>>> to a crash. >>>>> Yes, you are right. But I think we can guard from this by >>>>> adding check for args->options in new >>>>> free_memory_for_vm_init_args function and free memory in all >>>>> execution paths. If args->options is not NULL, then memory is >>>>> allocated and must be freed: >>>>> >>>>> 3485 static void free_memory_for_vm_init_args(JavaVMInitArgs* >>>>> args) { >>>>> 3486 if( args->options != NULL ) { >>>>> 3487 for (int i = 0; i < args->nOptions; i++) { >>>>> 3488 os::free(args->options[i].optionString); >>>>> 3489 } >>>>> 3490 FREE_C_HEAP_ARRAY(JavaVMOption, args->options); >>>>> 3491 } >>>>> 3492 } >>>>> >>>>> As I see you add free memory for error paths at >>>>> lines(webrev.04) 3668-3671 and 3687-3691. Thus, with that >>>>> guard you can add two calls to free_memory_for_vm_init_args >>>>> function before "return JNI_EINVAL;" on line 3696: >>>>> >>>>> 3693 #ifdef ASSERT >>>>> 3694 // Parse default .hotspotrc settings file >>>>> 3695 if (!process_settings_file(".hotspotrc", false, >>>>> args->ignoreUnrecognized)) { >>>>> 3696 return JNI_EINVAL; >>>>> 3697 } >>>>> 3698 #else >>>>> >>>>> >>>>> And one more comment. Unfortunately I oversight this before... >>>>> You not check return value from 'match_special_option_and_act' >>>>> new function on lines 3673-3675, but in one case it can return >>>>> error(JNI_ERR) when "-XX:NativeMemoryTracking" is specified >>>>> and INCLUDE_NMT is not defined. Thus, I think that check for >>>>> return value should be added(with freeing memory for env >>>>> variables in case of error). >>>>> >>>>> Thank you, >>>>> Dmitry >>>>> >>>>>> >>>>>> New Rev: >>>>>> >>>>>> http://cr.openjdk.java.net/~jmanson/8079301/webrev.04/ >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> Jeremy >>>>>> >>>>>> On Fri, Jul 10, 2015 at 5:52 AM, Dmitry Dmitriev >>>>>> >>>>> >>>>>> >>>>>> > wrote: >>>>>> >>>>>> Jeremy, >>>>>> >>>>>> Two additional comments which I didn't catch earlier... >>>>>> >>>>>> 1) Order of processing command line options is >>>>>> following(Arguments::parse_vm_init_args function): options from >>>>>> JAVA_TOOL_OPTIONS environment variable, then options from >>>>>> command >>>>>> line and then options from _JAVA_OPTIONS environment >>>>>> variable. And >>>>>> last argument wins! >>>>>> >>>>>> You not change this order in Arguments::parse_vm_init_args >>>>>> function, but it seems that order in several other places >>>>>> is changed. >>>>>> >>>>>> Lines 3665-3667: >>>>>> >>>>>> 3665 match_special_option_and_act(args, &flags_file); >>>>>> 3666 match_special_option_and_act(&java_tool_options_args, >>>>>> &flags_file); >>>>>> 3667 match_special_option_and_act(&java_options_args, >>>>>> &flags_file); >>>>>> >>>>>> Here we see that order is following: options from command >>>>>> line, >>>>>> then options from JAVA_TOOL_OPTIONS environment variable >>>>>> and then >>>>>> options from _JAVA_OPTIONS environment variable. Thus, in >>>>>> this >>>>>> case "-XX:+IgnoreUnrecognizedVMOptions" option in >>>>>> JAVA_TOOL_OPTIONS environment variable will have bigger >>>>>> priority >>>>>> than in command line(last argument wins), but this is >>>>>> differ from >>>>>> processing options in Arguments::parse_vm_init_args >>>>>> function. >>>>>> Thus, I think that you need to swap 3665 and 3666 lines: >>>>>> >>>>>> 3665 match_special_option_and_act(&java_tool_options_args, >>>>>> &flags_file); >>>>>> 3666 match_special_option_and_act(args, &flags_file); >>>>>> 3667 match_special_option_and_act(&java_options_args, >>>>>> &flags_file); >>>>>> >>>>>> Similar situation on lines 3696-3700: >>>>>> >>>>>> 3696 if (PrintVMOptions) { >>>>>> 3697 print_options(args); >>>>>> 3698 print_options(&java_tool_options_args); >>>>>> 3699 print_options(&java_options_args); >>>>>> 3700 } >>>>>> >>>>>> Command line options are printed before options from >>>>>> JAVA_TOOL_OPTIONS environment variable. Thus, I think >>>>>> that you >>>>>> need to swap 3697 and 3698 lines: >>>>>> >>>>>> 3696 if (PrintVMOptions) { >>>>>> 3697 print_options(&java_tool_options_args); >>>>>> 3698 print_options(args); >>>>>> 3699 print_options(&java_options_args); >>>>>> 3700 } >>>>>> >>>>>> >>>>>> 2) One more thing about error processing :) >>>>>> I think it will be great to free allocated memory for >>>>>> environment >>>>>> variables when error occured on lines 3661-3663, >>>>>> 3679-3681 and >>>>>> 3685-3687. >>>>>> My suggestion is to add some static function which free >>>>>> memory for >>>>>> env variables, something like that: >>>>>> static void free_memory_for_environment_variables( >>>>>> JavaVMInitArgs >>>>>> *options_args ) { >>>>>> for (int i = 0; i < options_args->nOptions; i++) { >>>>>> os::free(options_args->options[i].optionString); >>>>>> } >>>>>> FREE_C_HEAP_ARRAY(JavaVMOption, options_args->options); >>>>>> } >>>>>> >>>>>> And change lines 3661-3663 to following: >>>>>> >>>>>> 3661 if (code != JNI_OK) { >>>>>> 3662 >>>>>> free_memory_for_environment_variables(&java_tool_options_args); >>>>>> 3663 return code; >>>>>> 3664 } >>>>>> >>>>>> Lines 3679-3681 to following: >>>>>> >>>>>> 3679 if (!process_settings_file(flags_file, true, >>>>>> args->ignoreUnrecognized)) { >>>>>> 3680 >>>>>> free_memory_for_environment_variables(&java_tool_options_args); >>>>>> 3681 >>>>>> free_memory_for_environment_variables(&java_options_args); >>>>>> 3682 return JNI_EINVAL; >>>>>> 3683 } >>>>>> >>>>>> Lines 3685-3687 to following: >>>>>> >>>>>> 3685 if (!process_settings_file(".hotspotrc", false, >>>>>> args->ignoreUnrecognized)) { >>>>>> 3680 >>>>>> free_memory_for_environment_variables(&java_tool_options_args); >>>>>> 3681 >>>>>> free_memory_for_environment_variables(&java_options_args); >>>>>> 3686 return JNI_EINVAL; >>>>>> 3687 } >>>>>> >>>>>> And lines 3706-3715 to following: >>>>>> >>>>>> 3706 // Done with the envvars >>>>>> 3707 >>>>>> free_memory_for_environment_variables(&java_tool_options_args); >>>>>> 3708 >>>>>> free_memory_for_environment_variables(&java_options_args); >>>>>> >>>>>> >>>>>> Thank you, >>>>>> Dmitry >>>>>> >>>>>> >>>>>> On 10.07.2015 14:36, Dmitry Dmitriev wrote: >>>>>> >>>>>> Hello Jeremy, >>>>>> >>>>>> Thank you for fixing that! But in this case we still >>>>>> have >>>>>> minor issue when quotes processing failed(lines >>>>>> 3438-3444). >>>>>> Here is my suggestion: leave 'while' cycle(lines >>>>>> 3423-3462) as >>>>>> I was in your previous webrev(without 'start' and >>>>>> etc.) and >>>>>> call strdup when copy 'options' to 'options_arr' on >>>>>> lines >>>>>> 3472-3474, i.e. make lines 3472-3474 like this: >>>>>> >>>>>> 3472 for (int i = 0; i < options->length(); i++) { >>>>>> 3473 options_arr[i] = options->at(i); >>>>>> 3474 options_arr[i].optionString = >>>>>> os::strdup(options_arr[i].optionString); >>>>>> 3475 } >>>>>> >>>>>> What you think about that? >>>>>> >>>>>> Regards, >>>>>> Dmitry >>>>>> >>>>>> On 10.07.2015 3:23, Jeremy Manson wrote: >>>>>> >>>>>> Hey Dmitry, >>>>>> >>>>>> Thanks for looking at it. The leak was >>>>>> deliberate (under >>>>>> the theory that the command line flags were >>>>>> leaked, too), >>>>>> but it was silly that I didn't fix it. >>>>>> >>>>>> Anyway, fixed. See: >>>>>> >>>>>> http://cr.openjdk.java.net/~jmanson/8079301/webrev.03 >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> Jeremy >>>>>> >>>>>> On Thu, Jul 9, 2015 at 2:52 PM, Dmitry Dmitriev >>>>>> >>>>> >>>>>> >>>>>> >>>>>> >>>>> >>>>>> >> wrote: >>>>>> >>>>>> Hello Jeremy, >>>>>> >>>>>> Correct me if I am wrong, but I see small >>>>>> memory leak >>>>>> in your >>>>>> implementation. >>>>>> In Arguments::parse_options_environment_variable >>>>>> function memory >>>>>> for 'buffer' allocated by strdup function on >>>>>> line >>>>>> 3415, but now it >>>>>> not freed in this function because data from >>>>>> this >>>>>> buffer is used >>>>>> later. On the other hand when we are done >>>>>> with env >>>>>> variables, we >>>>>> free only options array(lines 3703-3705) and >>>>>> not free >>>>>> previously >>>>>> allocated memory for 'buffer' because we lost >>>>>> track >>>>>> for it. >>>>>> >>>>>> Thanks, >>>>>> Dmitry >>>>>> >>>>>> >>>>>> On 09.07.2015 21:20, Jeremy Manson wrote: >>>>>> >>>>>> Thanks for looking at this, Coleen. >>>>>> >>>>>> I merged this with the latest version of >>>>>> hs-rt, >>>>>> but Ron is or >>>>>> I am going to >>>>>> have to do some merging for 8061999. The >>>>>> changes >>>>>> are relatively >>>>>> orthogonal, but they touch a couple of >>>>>> the same >>>>>> places. How >>>>>> far away is >>>>>> Ron's checkin? >>>>>> >>>>>> Updated webrev: >>>>>> >>>>>> http://cr.openjdk.java.net/~jmanson/8079301/webrev.01/ >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> Updated test: >>>>>> >>>>>> http://cr.openjdk.java.net/~jmanson/8079301t/webrev.01/ >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> (Mild complaining on my part: the conflicts >>>>>> wouldn't have been >>>>>> an issue if >>>>>> someone had looked at this two months >>>>>> ago, when I >>>>>> first >>>>>> asked. I suspect >>>>>> Ron hadn't even started his change at >>>>>> that point. And if external >>>>>> developers were able to submit changes to >>>>>> Hotspot, >>>>>> we wouldn't >>>>>> have had to >>>>>> bother Oracle engineers at all. Neither >>>>>> of these >>>>>> is your >>>>>> fault or your >>>>>> problem, of course - I'm grateful you >>>>>> were able to >>>>>> take a look.) >>>>>> >>>>>> Jeremy >>>>>> >>>>>> On Wed, Jul 8, 2015 at 6:19 AM, Coleen >>>>>> Phillimore < >>>>>> coleen.phillimore at oracle.com >>>>>> >>>>>> >>>>>> >>>>>> >>>>> >>>>>> >> wrote: >>>>>> >>>>>> I'll sponsor it but can you repost >>>>>> the RFR? >>>>>> >>>>>> There has been a fair bit of work to >>>>>> command line >>>>>> processing lately so I'd >>>>>> like to have the others look at it >>>>>> too. Have >>>>>> you merged >>>>>> this up with the >>>>>> latest version of hs-rt repository >>>>>> and were there >>>>>> conflicts? Also, have >>>>>> you looked at the RFR: >>>>>> >>>>>> "Open code review for 8061999 Enhance VM >>>>>> option parsing to >>>>>> allow options >>>>>> to be specified" >>>>>> >>>>>> and are there conflicts with this? >>>>>> >>>>>> The hotspot change looks good to me. >>>>>> >>>>>> >>>>>> http://cr.openjdk.java.net/~jmanson/8079301t/webrev.00/test/com/sun/management/HotSpotDiagnosticMXBean/CheckOrigin.java.udiff.html >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> "UseCerealGC" LOL >>>>>> Can you use a different option than >>>>>> PrintOopAddress in >>>>>> this test? I don't >>>>>> know why this command line option >>>>>> exists or >>>>>> would be >>>>>> useful for, and seems >>>>>> to be a good candidate for removal. >>>>>> If you >>>>>> need a valid >>>>>> argument, that is >>>>>> unlikely to go away, TraceExceptions >>>>>> would be >>>>>> good. >>>>>> >>>>>> Thanks, >>>>>> Coleen >>>>>> >>>>>> >>>>>> On 7/7/15 8:00 PM, Jeremy Manson wrote: >>>>>> >>>>>> No love? Is there a code owner >>>>>> here I >>>>>> should pester >>>>>> more directly? >>>>>> >>>>>> Jeremy >>>>>> >>>>>> On Fri, Jun 26, 2015 at 3:00 PM, >>>>>> Martin >>>>>> Buchholz >>>>>> >>>>> >>>>>> >>>>>> >>>>> >> >>>>>> wrote: >>>>>> >>>>>> As usual with Google patches, >>>>>> they are >>>>>> in use >>>>>> locally. This one has been >>>>>> >>>>>> stable for a while without >>>>>> complaints. >>>>>> Please >>>>>> sponsor. >>>>>> >>>>>> On Fri, Jun 26, 2015 at 1:53 PM, >>>>>> Jeremy Manson >>>>>> >>>>> >>>>>> >>>>>> >>>>>> >>>>> >>>>>> >> >>>>>> wrote: >>>>>> >>>>>> All this talk about >>>>>> IgnoreUnrecognizedVMOptions >>>>>> reminded me that this >>>>>> >>>>>> review is still >>>>>> outstanding. Any >>>>>> takers? >>>>>> >>>>>> Jeremy >>>>>> >>>>>> On Tue, May 5, 2015 at >>>>>> 10:01 AM, >>>>>> Jeremy Manson >>>>>> >>>>>> >>>>>> >>>>>> >>>>> >>>>>> > >>>>>> wrote: >>>>>> >>>>>> Hi David, >>>>>> >>>>>> Thanks for taking a look. >>>>>> >>>>>> On Mon, May 4, 2015 >>>>>> at 8:32 >>>>>> PM, David >>>>>> Holmes >>>>>> >>>>> >>>>>> >>>>>> >>>>>> >>>>> >>>>>> >> >>>>>> >>>>>> wrote: >>>>>> >>>>>> Hi Jeremy, >>>>>> >>>>>> On 5/05/2015 6:51 AM, >>>>>> Jeremy Manson wrote: >>>>>> >>>>>> Not sure who might be >>>>>> willing to >>>>>> sponsor this. David? You >>>>>> did the >>>>>> >>>>>> last >>>>>> one. :) >>>>>> >>>>>> Might be a while >>>>>> before I can >>>>>> get to it. I did have >>>>>> a quick look >>>>>> >>>>>> (and >>>>>> will need a longer one). >>>>>> >>>>>> I understand. I'm >>>>>> just happy it's >>>>>> possible to upstream this stuff at >>>>>> all[1]. >>>>>> >>>>>> [1] With the eternal caveat >>>>>> that I'd be >>>>>> happier if we didn't *have* to >>>>>> go through you folks, >>>>>> but >>>>>> we've learned to >>>>>> live with it. >>>>>> >>>>>> >>>>>> >>>>>> Context: A number of >>>>>> command line >>>>>> options are not settable via >>>>>> >>>>>> JAVA_TOOL_OPTIONS and _JAVA_OPTIONS: >>>>>> >>>>>> - PrintVMOptions >>>>>> >>>>>> So you have changed the >>>>>> semantics of this to >>>>>> print out the >>>>>> options >>>>>> >>>>>> from >>>>>> the command-line and each >>>>>> of the two >>>>>> env vars. Seems reasonable but >>>>>> may be >>>>>> better to know which >>>>>> option came from >>>>>> where as we can now see >>>>>> the same >>>>>> option (or conflicting >>>>>> variants >>>>>> thereof) multiple times. >>>>>> >>>>>> I'd be happy to do >>>>>> this. Any >>>>>> preferred syntax? Does someone >>>>>> >>>>>> actually >>>>>> own this feature? >>>>>> >>>>>> I'm unclear what the current >>>>>> processing >>>>>> order is for the different >>>>>> >>>>>> sources of options, and >>>>>> whether the >>>>>> changes affect that order? >>>>>> >>>>>> Nope. I go through sad >>>>>> contortions >>>>>> to keep the processing >>>>>> order the >>>>>> >>>>>> same. It's JAVA_TOOL_OPTIONS, >>>>>> then >>>>>> command line, then _JAVA_OPTIONS. >>>>>> See >>>>>> lines 2549-2567. >>>>>> >>>>>> >>>>>> - >>>>>> IgnoreUnrecognizedVMOptions >>>>>> >>>>>> - PrintFlagsInitial >>>>>> >>>>>> Unclear what >>>>>> "initial" actually >>>>>> means - is it the default? >>>>>> >>>>>> More or less. If you stick, >>>>>> for example, >>>>>> IgnoreUnrecognizedVMOptions >>>>>> in >>>>>> there first, it will get >>>>>> printed out as >>>>>> "true". I haven't really >>>>>> changed >>>>>> the semantics here either - >>>>>> I've just >>>>>> added processing of the envvars. >>>>>> >>>>>> - NativeMemoryTracking >>>>>> >>>>>> - PrintFlagsWithComments >>>>>> >>>>>> This is because these >>>>>> flags have >>>>>> to be processed before >>>>>> processing >>>>>> other >>>>>> flags, and no one ever >>>>>> bothered to >>>>>> do that for the flags >>>>>> coming from >>>>>> environment >>>>>> variables. This patch >>>>>> fixes that problem. >>>>>> >>>>>> I have a test, but it is a >>>>>> modification to a JDK >>>>>> test instead >>>>>> of a HS >>>>>> test, >>>>>> so it can go in >>>>>> separately (I guess). >>>>>> >>>>>> They can be pushed >>>>>> together to >>>>>> different repos in the >>>>>> same forest. >>>>>> >>>>>> Okay. Here's the test >>>>>> change: >>>>>> >>>>>> http://cr.openjdk.java.net/~jmanson/8079301t/webrev.00/ >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> As I said I'll have to get >>>>>> back to this. >>>>>> And hopefully someone else in >>>>>> >>>>>> runtime will take a good >>>>>> look as well ;-) >>>>>> >>>>>> I'd be happy to toss it >>>>>> over to >>>>>> whomever owns this, if anyone. >>>>>> >>>>>> Thanks! >>>>>> >>>>>> Jeremy >>>>>> >>>>>> >>>>>> >>>>>> Bug: >>>>>> >>>>>> https://bugs.openjdk.java.net/browse/JDK-8079301 >>>>>> >>>>>> Webrev: >>>>>> http://cr.openjdk.java.net/~jmanson/8079301/webrev.00/ >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> Jeremy >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>> >>>> >>> >> > > From karen.kinnear at oracle.com Thu Jul 16 19:29:47 2015 From: karen.kinnear at oracle.com (Karen Kinnear) Date: Thu, 16 Jul 2015 15:29:47 -0400 Subject: RFR: 8087342: crash in klassItable_initialize_itable_for_interface In-Reply-To: <55A6F5E0.7020403@oracle.com> References: <55A6F5E0.7020403@oracle.com> Message-ID: <5CD38B13-5AE1-4A87-A748-CF30E1551ECF@oracle.com> David, Thank you for the review. And yes, your summary is cleaner and less wordy than mine :-) thanks, Karen On Jul 15, 2015, at 8:08 PM, David Holmes wrote: > Hi Karen, > > On 16/07/2015 2:40 AM, Karen Kinnear wrote: >> >> Please review for JDK9: >> >> bug: https://bugs.openjdk.java.net/browse/JDK-8087342 >> webrev: http://cr.openjdk.java.net/~acorn/8087342.2/webrev/ >> >> Crash occurs in product when we should through IncompatibleClassChangeError. > > Based on the description in the bug report and copious amount of rewritten comments, these changes seem quite reasonable - though I can't claim to be an expert in the details here. Bottom line is we need to skip private interface methods when checking other aspects. > > Thanks, > David > >> testing: >> internal tests: Defmeth (updated), SelectionResolution - product and fastdebug >> jprt >> jck >> jtreg/hotspot_all >> jtreg/jdk_streams >> test,noncolo.testlist, -atk quick >> >> (jck and macosx testing in progress) >> >> thanks, >> Karen >> From gerard.ziemski at oracle.com Thu Jul 16 19:48:08 2015 From: gerard.ziemski at oracle.com (gerard ziemski) Date: Thu, 16 Jul 2015 14:48:08 -0500 Subject: Open code review for 8061999 Enhance VM option parsing to allow options to be specified In-Reply-To: <6b67beb6-3936-4c3c-bd33-cd314be5e8e5@default> References: <6b67beb6-3936-4c3c-bd33-cd314be5e8e5@default> Message-ID: <55A80A78.4080605@oracle.com> hi Ron, I have no more comments, just one question: you say "A future enhancement will be to refactor the options file processing to grow memory like the environment variables do now." - is that enhancement filed yet? Please consider this reviewed with small "r". cheers On 07/14/2015 05:21 PM, Ron Durbin wrote: > Gerard, > > Thanks for your time in reviewing the code and providing comments. > My responses to your comments inline below: > > >> -----Original Message----- >> From: Gerard Ziemski >> Sent: Tuesday, June 23, 2015 1:53 PM >> To: hotspot-runtime-dev at openjdk.java.net >> Cc: Ron Durbin >> Subject: Re: Open code review for 8061999 Enhance VM option parsing to allow options to be specified >> >> hi Ron, >> >> I'm sending you partial feedback, since I am starting to get a bit tired. I will spend more time reviewing your >> webrev tomorrow, but here is what I have so far: >> >> --- >> src/share/vm/utilities/globalDefinitions.hp >> >> 1. Should we name the method "is_white()", not "iswhite()" since it's part of our code base? But then since it's >> a macro, shouldn't it actually be "IS_WHITE()" ? >> --- >> src/share/vm/runtime/arguments.hpp >> [ > > [Ron] While researching my answer to this comment, I realized > that I should have used the already existing isspace() function > instead of creating the iswhite() macro. Will fix. > >> 1. >> >> All the arguments in alloc_JVM_options_list(), copy_JVM_options_from_buf() and parse_JVM_options_file() use >> underscores in the arguments names except for merge_JVM_options_file(). I think the merge_JVM_options_file() >> should be: >> >> + static jint merge_JVM_options_file(const struct JavaVMInitArgs *args_in, >> + struct JavaVMInitArgs **args_out); >> > > [Ron] This one is a reasonable clean up > >> --- >> src/share/vm/runtime/arguments.cpp >> >> 1. Why do FreeVMOptions, DumpVMOptions, DumpVMOption and DumpOption start with capital letters? Shouldn't their >> names start with a lower case letter? >> > [Ron] This one is a reasonable clean up > >> 2. Line 4306. The pattern in Arguments::parse() seems to be to print out error message and return the error >> value if something goes wrong, but we do vm_exit(1) instead? >> > > [Ron ] The cases that will trigger this exit on fail are extreme: > - missing or otherwise in accessible options files > - Un-parsable options file, too big, too many options, nonwhite space terminated options > - Unable to allocate memory for options files processing > >> 3. Line 4309. I was told that when it comes to NULL pointer check we should do (NULL == args), not the other way >> around. >> > [Ron] This one is a reasonable clean up > >> 4. Line 4375. Don't we need FreeVMOptions() here? Line 4382 as well? > > > [Ron] Gerard this one is a reasonable clean up > >> 5. Question. Why do we need N_MAX_OPTIONS? > > [Ron] Until recently N_MAX_OPTIONS applied to environment variables too > N_MAX_OTIIONS is used to limit the number of options and thus the memory allocated. > A future enhancement will be to refactor the options file processing to grow memory like the > environment variables do now. > >> 6. Question. Why do we need OPTION_BUFFER_SIZE? Can't we use "int bytes_needed = fseek(stream, 0, SEEK_END); >> rewind(stream)" and have the code dynamically allocate memory without hard coded limits? >> > [Ron>] Until recently OPTION_BUFFER_SIZE applied to environment variables too. \ > OPTION_BUFFER_SIZE is used to limit the memory allocated for reading the options. > A future enhancement will be to refactor the options file processing to grow memory like the > environment variables do now. > > >> 7. Line 3965. Can that comparison ever succeed? "read()" will not read more bytes (only less) than as specified >> by "bytes_alloc" and if it did, we would overwrite memory since our buf is only "bytes_alloc" big. >> > [Ron>] Yes that comparison can succeed. We only support an > options file that is <= OPTION_BUFFER_SIZE bytes in > size. > > We allocate a read buffer that is OPTION_BUFFER_SIZE + 1 > bytes in size for two reasons: > > 1) to have space for a NULL terminator when the > options file is the maximum number of bytes > in length > 2) easy detection of an options file that is too large; > we try to read OPTION_BUFFER_SIZE + 1 bytes. If we > succeed, then the file is too big. > > >> >> cheers >> >> >> On 6/22/2015 7:52 AM, Ron Durbin wrote: >> Webrev URL: >> http://cr.openjdk.java.net/~rdurbin/8061999_OCR0_JDK9_webrev >> >> >> RFE request: >> https://bugs.openjdk.java.net/browse/JDK-8061999 >> >> This RFE allows a file to be specified that holds VM Options that >> would otherwise be specified on the command line or in an environment variable. >> Only one options file may be specified on the command line and no options file >> may be specified in either of the following environment variables >> "JAVA_TOOL_OPTIONS" or "_JAVA_OPTIONS". >> >> The options file feature supports all VM options currently supported on >> the command line, except the options file option. The option to specify an >> options file is "-XX:VMOptionsFile=". >> The options file feature supports an options file up to 1024 bytes in size >> and up to 64 options. >> >> This feature has been tested on: >> OS: >> Solaris, MAC, Windows, Linux >> Tests: >> Manual unit tests >> JPRT with -testset hotspot (including the SQE proposed test coverage for this feature.) >> >> >> > From ron.durbin at oracle.com Thu Jul 16 20:00:00 2015 From: ron.durbin at oracle.com (Ron Durbin) Date: Thu, 16 Jul 2015 13:00:00 -0700 (PDT) Subject: Open code review for 8061999 Enhance VM option parsing to allow options to be specified In-Reply-To: <55A80A78.4080605@oracle.com> References: <6b67beb6-3936-4c3c-bd33-cd314be5e8e5@default> <55A80A78.4080605@oracle.com> Message-ID: <539fb166-506a-47bd-b710-d218e6ebaed1@default> I will file it and thanks for the "r" review. >-----Original Message----- >From: gerard ziemski >Sent: Thursday, July 16, 2015 1:48 PM >To: Ron Durbin; hotspot-runtime-dev at openjdk.java.net >Subject: Re: Open code review for 8061999 Enhance VM option parsing to allow options to be specified > >hi Ron, > >I have no more comments, just one question: you say "A future >enhancement will be to refactor the options file processing to grow >memory like the environment variables do now." - is that enhancement >filed yet? > >Please consider this reviewed with small "r". > > >cheers > > >On 07/14/2015 05:21 PM, Ron Durbin wrote: >> Gerard, >> >> Thanks for your time in reviewing the code and providing comments. >> My responses to your comments inline below: >> >> >>> -----Original Message----- >>> From: Gerard Ziemski >>> Sent: Tuesday, June 23, 2015 1:53 PM >>> To: hotspot-runtime-dev at openjdk.java.net >>> Cc: Ron Durbin >>> Subject: Re: Open code review for 8061999 Enhance VM option parsing to allow options to be specified >>> >>> hi Ron, >>> >>> I'm sending you partial feedback, since I am starting to get a bit tired. I will spend more time reviewing >your >>> webrev tomorrow, but here is what I have so far: >>> >>> --- >>> src/share/vm/utilities/globalDefinitions.hp >>> >>> 1. Should we name the method "is_white()", not "iswhite()" since it's part of our code base? But then since >it's >>> a macro, shouldn't it actually be "IS_WHITE()" ? >>> --- >>> src/share/vm/runtime/arguments.hpp >>> [ >> >> [Ron] While researching my answer to this comment, I realized >> that I should have used the already existing isspace() function >> instead of creating the iswhite() macro. Will fix. >> >>> 1. >>> >>> All the arguments in alloc_JVM_options_list(), copy_JVM_options_from_buf() and parse_JVM_options_file() use >>> underscores in the arguments names except for merge_JVM_options_file(). I think the merge_JVM_options_file() >>> should be: >>> >>> + static jint merge_JVM_options_file(const struct JavaVMInitArgs *args_in, >>> + struct JavaVMInitArgs **args_out); >>> >> >> [Ron] This one is a reasonable clean up >> >>> --- >>> src/share/vm/runtime/arguments.cpp >>> >>> 1. Why do FreeVMOptions, DumpVMOptions, DumpVMOption and DumpOption start with capital letters? Shouldn't >their >>> names start with a lower case letter? >>> >> [Ron] This one is a reasonable clean up >> >>> 2. Line 4306. The pattern in Arguments::parse() seems to be to print out error message and return the error >>> value if something goes wrong, but we do vm_exit(1) instead? >>> >> >> [Ron ] The cases that will trigger this exit on fail are extreme: >> - missing or otherwise in accessible options files >> - Un-parsable options file, too big, too many options, nonwhite space terminated options >> - Unable to allocate memory for options files processing >> >>> 3. Line 4309. I was told that when it comes to NULL pointer check we should do (NULL == args), not the other >way >>> around. >>> >> [Ron] This one is a reasonable clean up >> >>> 4. Line 4375. Don't we need FreeVMOptions() here? Line 4382 as well? >> >> >> [Ron] Gerard this one is a reasonable clean up >> >>> 5. Question. Why do we need N_MAX_OPTIONS? >> >> [Ron] Until recently N_MAX_OPTIONS applied to environment variables too >> N_MAX_OTIIONS is used to limit the number of options and thus the memory allocated. >> A future enhancement will be to refactor the options file processing to grow memory like the >> environment variables do now. >> >>> 6. Question. Why do we need OPTION_BUFFER_SIZE? Can't we use "int bytes_needed = fseek(stream, 0, SEEK_END); >>> rewind(stream)" and have the code dynamically allocate memory without hard coded limits? >>> >> [Ron>] Until recently OPTION_BUFFER_SIZE applied to environment variables too. \ >> OPTION_BUFFER_SIZE is used to limit the memory allocated for reading the options. >> A future enhancement will be to refactor the options file processing to grow memory like the >> environment variables do now. >> >> >>> 7. Line 3965. Can that comparison ever succeed? "read()" will not read more bytes (only less) than as >specified >>> by "bytes_alloc" and if it did, we would overwrite memory since our buf is only "bytes_alloc" big. >>> >> [Ron>] Yes that comparison can succeed. We only support an >> options file that is <= OPTION_BUFFER_SIZE bytes in >> size. >> >> We allocate a read buffer that is OPTION_BUFFER_SIZE + 1 >> bytes in size for two reasons: >> >> 1) to have space for a NULL terminator when the >> options file is the maximum number of bytes >> in length >> 2) easy detection of an options file that is too large; >> we try to read OPTION_BUFFER_SIZE + 1 bytes. If we >> succeed, then the file is too big. >> >> >>> >>> cheers >>> >>> >>> On 6/22/2015 7:52 AM, Ron Durbin wrote: >>> Webrev URL: >>> http://cr.openjdk.java.net/~rdurbin/8061999_OCR0_JDK9_webrev >>> >>> >>> RFE request: >>> https://bugs.openjdk.java.net/browse/JDK-8061999 >>> >>> This RFE allows a file to be specified that holds VM Options that >>> would otherwise be specified on the command line or in an environment variable. >>> Only one options file may be specified on the command line and no options file >>> may be specified in either of the following environment variables >>> "JAVA_TOOL_OPTIONS" or "_JAVA_OPTIONS". >>> >>> The options file feature supports all VM options currently supported on >>> the command line, except the options file option. The option to specify an >>> options file is "-XX:VMOptionsFile=". >>> The options file feature supports an options file up to 1024 bytes in size >>> and up to 64 options. >>> >>> This feature has been tested on: >>> OS: >>> Solaris, MAC, Windows, Linux >>> Tests: >>> Manual unit tests >>> JPRT with -testset hotspot (including the SQE proposed test coverage for this feature.) >>> >>> >>> >> > From karen.kinnear at oracle.com Thu Jul 16 22:03:52 2015 From: karen.kinnear at oracle.com (Karen Kinnear) Date: Thu, 16 Jul 2015 18:03:52 -0400 Subject: RFR: 8087342: crash in klassItable_initialize_itable_for_interface In-Reply-To: <55A6F6F7.6040508@oracle.com> References: <55A6F6F7.6040508@oracle.com> Message-ID: Lois, Thank you for the detailed review. I really appreciate it. On Jul 15, 2015, at 8:12 PM, Lois Foltan wrote: > > On 7/15/2015 12:40 PM, Karen Kinnear wrote: >> Please review for JDK9: >> >> bug: https://bugs.openjdk.java.net/browse/JDK-8087342 >> webrev: http://cr.openjdk.java.net/~acorn/8087342.2/webrev/ >> >> Crash occurs in product when we should through IncompatibleClassChangeError. > > Hi Karen, > I think this looks good and I really like how straight forward klassVtable::is_miranda now is. Some minor clarification comments: > > - src/share/vm/instanceKlass.cpp > comments for the find_local_method* were changed to state: > +// note that the local methods array can have up to one overpass, one static > +// and one instance (private or not) with the same name/signature > I think there are two combinations that the code depends on not occurring, they are: > 1. all 3 are in existence in the local methods array (one overpass, one static and one instance) > 2. the combination of one static and one instance (private or not) > In other words there has to be an overpass to cause more than one method with the same name/signature within the local methods array. And it is either an overpass and a static or an overpass and an instance, but not all 3. Correct me if I am wrong. I need to write an additional test to check that. I agree that both the spec and the ClassFileParser if _need_verify is set will prevent instance and static overlap. I need to see what happens if you skip verification. I will get back to you with that and update the comments to clarify if needed. > > - src/share/vm/oops/klassVtable.cpp Let me see if I can make this clearer - let me know if I can make the comments clearer. I truly appreciate your trying to see if this all makes sense and is consistent. It is still too complex. > Thank you for adding the improved comments ahead of is_miranda. My read is that overpass methods are not considered miranda methods and I agree with that statement. Yes, they are not considered miranda methods because you don't need to add them to the vtable as abstract methods because they already are in the vtable from being in the class' LOCAL methods array. So pass 1: overpasses do not exist pass 2: overpasses are already in the vtable when we calculate mirandas pass 3: overpasses in a class have the class as their method_holder, not an interface, so we aren't looking them up here So - pass 2 is the one that cares about the find_local_method(Klass:find_overpass vs. Klass::skip_overpass). > Yet, Klass::find_overpass is specified in the code. I think the code is correct, but based on the comment I would have thought Klass::skip_overpass should have been specified? I also think the code is correct. So what pass 2 is doing is walking through the superinterfaces to see if any of the superinterface methods (which all used to be abstract) need to be added to the vtable. So the question is - what superinterface methods belong in the vtable? So the searches in is_miranda are designed to find out if there is a method in the vtable already such that we don't need to add the superinterface method - e.g. this was abstract and we have an implementation for it. With the addition of default methods, we have three new challenges - overpasses, static interface methods and private interface methods. Static and private interface methods do not get added to the vtable and are not seen by the method resolution process. So we skip those. Overpass methods are already in the vtable, so vtable lookup will find them there and we don't need to add a miranda method to the end of the vtable. So we look for those explicitly. Note that we inherit our superclasses vtable, so the superclass' search also needs to use find_overpass. Does this make sense? Is there a way I could make this clearer via comments? > Much like skip_static and skip_private. So based on your later statement that "Abstract methods may already have been handled via overpasses" it implies that overpass methods, although not miranda methods, can satisfy or stand in for an miranda during pass 2. So they must be found, did I understand that correctly? > > Again, looks good. I don't need to see another review. My comments were merely clarification based. many thanks, Karen > > Thanks, > Lois > > > > > > > > >> >> testing: >> internal tests: Defmeth (updated), SelectionResolution - product and fastdebug >> jprt >> jck >> jtreg/hotspot_all >> jtreg/jdk_streams >> test,noncolo.testlist, -atk quick >> >> (jck and macosx testing in progress) >> >> thanks, >> Karen >> > From derek.white at oracle.com Thu Jul 16 23:07:24 2015 From: derek.white at oracle.com (Derek White) Date: Thu, 16 Jul 2015 19:07:24 -0400 Subject: Runtime command-line deprecation (Was Re: RFR: 8066821(S) Enhance command line processing to manage deprecating and obsoleting -XX command line arguments In-Reply-To: <559AEC80.3010907@oracle.com> References: <54B44661.8070007@oracle.com> <54B84E91.1050708@oracle.com> <54D15A0B.6030501@oracle.com> <87B07B03-3423-4738-9617-0C7B72A74A6E@oracle.com> <559AEC80.3010907@oracle.com> Message-ID: <55A8392C.3020404@oracle.com> Hi Karen, Coleen, I'll respond to one issue which you both brought up here, and respond to the rest inline. I think you both were skeptical of the need to "deprecate & handle" an argument (where the argument isn't an alias for another argument), although Karen suggested that might be good for external option removal, which has a really long lead time. From the options I've looked at, the decision to ignore vs. handle a deprecated option depends on what the option does and what users expect. For simple tuning or diagnostic options, there is little harm if we don't handle "-XX:+ UseOldInlining". The user would be hard-pressed to tell the difference. But if we wanted to deprecate "-XX:+UseG1GC" (for an unlikely example), this would make a big difference if we simply ignored the option. In this case we should still handle the option after emitting a deprecation warning (for at least one release). Should we ever go from "deprecate & handle" in one release to full removal in the next? Or should we always have a release that "deprecates & ignores" an option before removing it? Ignoring an old option is often a convenience for customers, but on the other hand it's kind of lying to the customers. Maybe they're asking for "XX:-MSG" and we say "sure boss" and pour on the monosodium glutamate :-) On the other hand, really handling a deprecated option has a cost too, so code complexity (and reliability), or time and space overheads might call for simply ignoring a deprecated option instead of always handling it in one release and ignoring it in the next. Coming up with some guidelines for this is a good idea, but I don't think hard rules will work. Specific responses below. FYI - New webrev is going through last round of merge testing. - Derek On 7/6/15 5:00 PM, Coleen Phillimore wrote: > > Hi, > > I'm happy for more clarity in the process of removing command line > arguments. I have some questions and comments below. > > On 6/26/15 4:09 PM, Karen Kinnear wrote: >> Derek, >> >> I am really glad you are looking into this. I expanded this to the runtime folks in case many of them have not yet seen this. >> Mary just forwarded this and I believe you haven't checked it in yet, so perhaps still time to discuss and make sure >> we all are together on the deprecation policy. >> >> The runtime team was discussing at staff this week how we handle deprecating jvm command-line options as >> we are looking to do more clean up in the future. >> >> So our internal change control process classifies our exported interfaces into three categories: >> External: command-line flags e.g. -verbose:gc, -Xmx, ... >> This includes any commercial flags >> Private: -XX flags documented (e.g. performance tuning or troubleshooting) >> I would assume this would include -XX product, experimental flags and manageable flags >> Internal: undocumented -XX flags >> I would assume this would include -XX develop and diagnostic flags >> >> (please correct me if my assumptions are wrong folks) > > This is a good categorization. Although I think there's some grey > area between External and Private, where some XX options are so > commonly used they should be considered External. Some of the GC > options may fall into this category like UseParNewGC. Yes, I agree that there is unexpected flag promotion. It would be great to get a common understanding of where the lines are between External, Private, and Internal. The flag types like commercial, product, experimental, develop, diagnostic are important, although I'd argue that experimental flags are more likely "internal" not private. I think we also need a liberal definition of "Documented" to include not just official documentation but blog postings and even serious mentions in places like StackOverflow. If the only reference that Google can find to an -XX flag is in the openJDK source code, then chances are it is "Internal". >> The way I understand that we handle private -XX options today is a 2-step removal: (obsolete_jvm_flags - where the >> release number is in a table and could be undefined) >> >> Using your helpful taxonomy fromhttps://bugs.openjdk.java.net/browse/JDK-806682: >> >> Today: private -XX options use 2-step removal (obsolete_jvm_flags) >> release 1: Deprecate & Obsolete - warn about the option but do nothing with it (we can remove all code that supports it) >> release 2: Dead - unrecognized >> - the point of the 2-step is to give customers time to modify any scripts they use >> >> I believe we have very rarely removed External flags - since customers, licensees, etc. may expect them. >> >> Mini-proposal: >> 1) I would recommend that we add a future set of changes to add consistent handling for the External flags - >> so that they would follow a three-step removal: >> release 1: Deprecate & Handle - warn and keep supporting >> release 2: Deprecate & Obsolete - warn and do nothing >> release 3: Dead - unrecognized >> >> 2) For the Internal flags - I think it would be kindest to customers and not a huge amount of additional work if >> we were to follow the Private model of using a 2 step. >> >> 3) leave the Private flags with the current 2-step removal > > Yes, this reflects our current model. >> 4) add support for aliasing - for any of them >> So that if you are doing aliasing, you would follow the model you are adding >> release 1: Deprecated & Handled - i.e. warn and still support (and set the information for the new alias) >> release 2: Dead - unrecognized >> >> 5) Could we possibly take the two flags that followed a different model already, i.e. moving to >> Deprecated & Handled and handle those as mistakes rather than part of a new general model? > > So this is my question which is around the code review in question. > Note, Derek, can you resend the RFR to hotspot-dev at openjdk.java.net so > it gets to all of us (even the compiler team may want to share in the > mechanism). > > Why are UseParNewGC and MaxGCMinorPauseMillis deprecated and handled > and not deprecated and obsolete? I don't actually see why have the > distinction here? > > Did these flags follow the deprecation procedure below? Why not just > make them obsolete, why have this other mechanism? I may be asking > the same question as Karen. > > I think the aliased flags could have a deprecate and handle model > (where handle == alias) in which case you only need one table for the > aliased flags, and you need to keep them in globals.hpp so they're > parsed properly. The real reason I wrote the code that way is because I was supporting the current policy (classic "mechanism not policy" checkin). I didn't (and don't) have the history on how we got there. But after thinking about it (see top post), I think there will be some cases where we'll have handle options instead of ignoring them and vice verse. And the final decision may come down to engineering, or customer, or partner concerns, or management whimsy, or whatever the current fad is. We're talking about code changes over multiple years here :-) >> Or do you think we will see more cases other than aliasing in which we would want to >> release 1: Deprecate & Handle and then release 2: Dead >> rather than release 1: Deprecate & Obsolete and then 2: Dead >> or rather than a 3 step like the External option proposal above? > > I think for the aliased flags you want the first option here > (deprecate&handle), right? But that's only because you need to keep > the option in globals.hpp so it parses correctly, otherwise the second > option (deprecate&obsolete) would be the preference? > > The options in the GC that are being deprecated and handled have had > warnings about them for a while, so making them obsolete doesn't feel > too soon. Yes, but just went through the approval process. > > Also, I agree with Kim's comment below that your comment lines are too > long. My fonts are too big to have windows this wide. > > thanks, > Coleen >> thanks, >> Karen >> >> p.s. Note that all of the deprecation needs to >> 1) work with licensee engineering to ensure we give licensee's a head's up and get feedback >> 2) file a change control request >> >> - we try to do these both as bulk requests to reduce the processing overhead. >> >> p.p.s. Details >> >> 1. Do the warnings print today or are they silent? Just want to make sure we are conscious of how >> those are handled if any of this moves to the new unified logging mechanism for which the new default >> for "warning" level is to print. The deprecation messages go through warning(), which is controlled by PrintWarnings (defaults to true). This is how the obsolete flag warnings are printed. The new deprecation mechanism replaces a mishmash of calls to jio_fprintf() and warning(), with a variety of different ways of saying the same thing. >> 2. "will likely be removed in a future release"? If we have already set the release it will be removed - is this a bit >> vague or did I not read closely enough? That text came from some of the deprecated GC options. If removal has been scheduled, we could say something more definite, or even the exact release. We don't print the exact "death" release for obsolete options currently though. >> >> On Feb 3, 2015, at 6:30 PM, Derek White wrote: >> >>> Request for review (again): >>> >>> - Updated with Kim's suggestion. >>> - Stopped double-printing warnings in some cases. >>> - Initial caps on warning() messages. >>> >>> Webrev:http://cr.openjdk.java.net/~drwhite/8066821/webrev.04/ >>> CR:https://bugs.openjdk.java.net/browse/JDK-8066821 >>> Tests: jtreg, jprt >>> >>> Thanks for looking! >>> >>> - Derek >>> >>> On 1/28/15 3:47 PM, Kim Barrett wrote: >>> ... From david.holmes at oracle.com Thu Jul 16 23:52:05 2015 From: david.holmes at oracle.com (David Holmes) Date: Fri, 17 Jul 2015 09:52:05 +1000 Subject: Runtime command-line deprecation (Was Re: RFR: 8066821(S) Enhance command line processing to manage deprecating and obsoleting -XX command line arguments In-Reply-To: <55A8392C.3020404@oracle.com> References: <54B44661.8070007@oracle.com> <54B84E91.1050708@oracle.com> <54D15A0B.6030501@oracle.com> <87B07B03-3423-4738-9617-0C7B72A74A6E@oracle.com> <559AEC80.3010907@oracle.com> <55A8392C.3020404@oracle.com> Message-ID: <55A843A5.1080108@oracle.com> Hi Derek, One general comment inline below that I meant to make to Karen's email earlier ... On 17/07/2015 9:07 AM, Derek White wrote: > Hi Karen, Coleen, > > I'll respond to one issue which you both brought up here, and respond to > the rest inline. > > I think you both were skeptical of the need to "deprecate & handle" an > argument (where the argument isn't an alias for another argument), > although Karen suggested that might be good for external option removal, > which has a really long lead time. > > From the options I've looked at, the decision to ignore vs. handle a > deprecated option depends on what the option does and what users expect. > For simple tuning or diagnostic options, there is little harm if we > don't handle "-XX:+ UseOldInlining". The user would be hard-pressed to > tell the difference. But if we wanted to deprecate "-XX:+UseG1GC" (for > an unlikely example), this would make a big difference if we simply > ignored the option. In this case we should still handle the option after > emitting a deprecation warning (for at least one release). > > Should we ever go from "deprecate & handle" in one release to full > removal in the next? Or should we always have a release that "deprecates > & ignores" an option before removing it? Ignoring an old option is often > a convenience for customers, but on the other hand it's kind of lying to > the customers. Maybe they're asking for "XX:-MSG" and we say "sure boss" > and pour on the monosodium glutamate :-) > > On the other hand, really handling a deprecated option has a cost too, > so code complexity (and reliability), or time and space overheads might > call for simply ignoring a deprecated option instead of always handling > it in one release and ignoring it in the next. > > Coming up with some guidelines for this is a good idea, but I don't > think hard rules will work. > > Specific responses below. > > FYI - New webrev is going through last round of merge testing. > > - Derek > > On 7/6/15 5:00 PM, Coleen Phillimore wrote: >> >> Hi, >> >> I'm happy for more clarity in the process of removing command line >> arguments. I have some questions and comments below. >> >> On 6/26/15 4:09 PM, Karen Kinnear wrote: >>> Derek, >>> >>> I am really glad you are looking into this. I expanded this to the >>> runtime folks in case many of them have not yet seen this. >>> Mary just forwarded this and I believe you haven't checked it in yet, >>> so perhaps still time to discuss and make sure >>> we all are together on the deprecation policy. >>> >>> The runtime team was discussing at staff this week how we handle >>> deprecating jvm command-line options as >>> we are looking to do more clean up in the future. >>> >>> So our internal change control process classifies our exported >>> interfaces into three categories: >>> External: command-line flags e.g. -verbose:gc, -Xmx, ... >>> This includes any commercial flags >>> Private: -XX flags documented (e.g. performance tuning or >>> troubleshooting) >>> I would assume this would include -XX product, experimental >>> flags and manageable flags >>> Internal: undocumented -XX flags >>> I would assume this would include -XX develop and diagnostic flags >>> >>> (please correct me if my assumptions are wrong folks) >> >> This is a good categorization. Although I think there's some grey >> area between External and Private, where some XX options are so >> commonly used they should be considered External. Some of the GC >> options may fall into this category like UseParNewGC. > Yes, I agree that there is unexpected flag promotion. It would be great > to get a common understanding of where the lines are between External, > Private, and Internal. The flag types like commercial, product, > experimental, develop, diagnostic are important, although I'd argue that > experimental flags are more likely "internal" not private. I think we > also need a liberal definition of "Documented" to include not just > official documentation but blog postings and even serious mentions in > places like StackOverflow. If the only reference that Google can find to > an -XX flag is in the openJDK source code, then chances are it is > "Internal". The classifications that Karen listed come from a document that pre-dates open-sourcing of Java by many years. In an OpenSource world all flags are "documented" - and there are a few webpages that serve as tables of VM options for everyone to see. Not to mention all the publicly visible bug reports. So a new definition of "documented" is certainly needed. I also think we need definitions based more on the type of flag: product, develop, diagnostic, experimental, commercial - as a first level classification. With the concerns of external/internal/private applying as a secondary classification when needed. Obviously not all combinations make sense. I agree that in the worst-case there could well be a three phase process: - deprecate and handle - deprecate and ignore - remove (give error on use) but that should only be needed for external, product flags - those with the broadest use-base and exposure. Most will need the second two stages only. And for some we should be able to just rip them out whenever eg experimental-internal/private. Aside: in the JDK deprecation has mostly been phase one only, unfortunately, with a handful of phase two. Alas no stage three. Cheers, David ------ >>> The way I understand that we handle private -XX options today is a >>> 2-step removal: (obsolete_jvm_flags - where the >>> release number is in a table and could be undefined) >>> >>> Using your helpful taxonomy >>> fromhttps://bugs.openjdk.java.net/browse/JDK-806682: >>> >>> Today: private -XX options use 2-step removal (obsolete_jvm_flags) >>> release 1: Deprecate & Obsolete - warn about the option but do >>> nothing with it (we can remove all code that supports it) >>> release 2: Dead - unrecognized >>> - the point of the 2-step is to give customers time to modify any >>> scripts they use >>> >>> I believe we have very rarely removed External flags - since >>> customers, licensees, etc. may expect them. >>> >>> Mini-proposal: >>> 1) I would recommend that we add a future set of changes to add >>> consistent handling for the External flags - >>> so that they would follow a three-step removal: >>> release 1: Deprecate & Handle - warn and keep supporting >>> release 2: Deprecate & Obsolete - warn and do nothing >>> release 3: Dead - unrecognized >>> >>> 2) For the Internal flags - I think it would be kindest to customers >>> and not a huge amount of additional work if >>> we were to follow the Private model of using a 2 step. >>> >>> 3) leave the Private flags with the current 2-step removal >> >> Yes, this reflects our current model. >>> 4) add support for aliasing - for any of them >>> So that if you are doing aliasing, you would follow the model >>> you are adding >>> release 1: Deprecated & Handled - i.e. warn and still support >>> (and set the information for the new alias) >>> release 2: Dead - unrecognized >>> >>> 5) Could we possibly take the two flags that followed a different >>> model already, i.e. moving to >>> Deprecated & Handled and handle those as mistakes rather than part of >>> a new general model? >> >> So this is my question which is around the code review in question. >> Note, Derek, can you resend the RFR to hotspot-dev at openjdk.java.net so >> it gets to all of us (even the compiler team may want to share in the >> mechanism). >> >> Why are UseParNewGC and MaxGCMinorPauseMillis deprecated and handled >> and not deprecated and obsolete? I don't actually see why have the >> distinction here? >> >> Did these flags follow the deprecation procedure below? Why not just >> make them obsolete, why have this other mechanism? I may be asking >> the same question as Karen. >> >> I think the aliased flags could have a deprecate and handle model >> (where handle == alias) in which case you only need one table for the >> aliased flags, and you need to keep them in globals.hpp so they're >> parsed properly. > > The real reason I wrote the code that way is because I was supporting > the current policy (classic "mechanism not policy" checkin). I didn't > (and don't) have the history on how we got there. But after thinking > about it (see top post), I think there will be some cases where we'll > have handle options instead of ignoring them and vice verse. And the > final decision may come down to engineering, or customer, or partner > concerns, or management whimsy, or whatever the current fad is. We're > talking about code changes over multiple years here :-) >>> Or do you think we will see more cases other than aliasing in which >>> we would want to >>> release 1: Deprecate & Handle and then release 2: Dead >>> rather than release 1: Deprecate & Obsolete and then 2: Dead >>> or rather than a 3 step like the External option proposal above? >> >> I think for the aliased flags you want the first option here >> (deprecate&handle), right? But that's only because you need to keep >> the option in globals.hpp so it parses correctly, otherwise the second >> option (deprecate&obsolete) would be the preference? >> >> The options in the GC that are being deprecated and handled have had >> warnings about them for a while, so making them obsolete doesn't feel >> too soon. > > Yes, but just went through the approval process. >> >> Also, I agree with Kim's comment below that your comment lines are too >> long. My fonts are too big to have windows this wide. >> >> thanks, >> Coleen >>> thanks, >>> Karen >>> >>> p.s. Note that all of the deprecation needs to >>> 1) work with licensee engineering to ensure we give licensee's a >>> head's up and get feedback >>> 2) file a change control request >>> >>> - we try to do these both as bulk requests to reduce the processing >>> overhead. >>> >>> p.p.s. Details >>> >>> 1. Do the warnings print today or are they silent? Just want to make >>> sure we are conscious of how >>> those are handled if any of this moves to the new unified logging >>> mechanism for which the new default >>> for "warning" level is to print. > The deprecation messages go through warning(), which is controlled by > PrintWarnings (defaults to true). This is how the obsolete flag warnings > are printed. The new deprecation mechanism replaces a mishmash of calls > to jio_fprintf() and warning(), with a variety of different ways of > saying the same thing. >>> 2. "will likely be removed in a future release"? If we have already >>> set the release it will be removed - is this a bit >>> vague or did I not read closely enough? > That text came from some of the deprecated GC options. If removal has > been scheduled, we could say something more definite, or even the exact > release. We don't print the exact "death" release for obsolete options > currently though. >>> >>> On Feb 3, 2015, at 6:30 PM, Derek White wrote: >>> >>>> Request for review (again): >>>> >>>> - Updated with Kim's suggestion. >>>> - Stopped double-printing warnings in some cases. >>>> - Initial caps on warning() messages. >>>> >>>> Webrev:http://cr.openjdk.java.net/~drwhite/8066821/webrev.04/ >>>> CR:https://bugs.openjdk.java.net/browse/JDK-8066821 >>>> Tests: jtreg, jprt >>>> >>>> Thanks for looking! >>>> >>>> - Derek >>>> >>>> On 1/28/15 3:47 PM, Kim Barrett wrote: >>>> > ... From david.holmes at oracle.com Fri Jul 17 02:56:09 2015 From: david.holmes at oracle.com (David Holmes) Date: Fri, 17 Jul 2015 12:56:09 +1000 Subject: RFR(XS): 8079825: Uninitialised variable in hotspot/src/share/vm & cpu/x86/vm (runtime) In-Reply-To: <55A7E55F.7060206@oracle.com> References: <55A7E55F.7060206@oracle.com> Message-ID: <55A86EC9.5010008@oracle.com> Looks good Calvin! Thanks, David On 17/07/2015 3:09 AM, Calvin Cheung wrote: > This is for fixing some warnings about uninitialized variables reported > by our internal code analysis tool. > > JBS: https://bugs.openjdk.java.net/browse/JDK-8079825 > (this is a confidential bug) > > webrev: http://cr.openjdk.java.net/~ccheung/8079825/webrev.00/ > > [1] Uninitialised pointer localvariable_type_table_start may be used as > argument > 8 when calling ClassFileParser::copy_localvariable_table at line 2465 of > hotspot/src/share/vm/classfile/classFileParser.cpp in function > ClassFileParser::parse_method > > Similar warning message for the other 3 local variables. > > The fix in classFileParser.cpp is for initializing the following > variables to NULL: > localvariable_table_length, > localvariable_table_start, > localvariable_type_table_length, > localvariable_type_table_start > > They may not be defined if the execution path goes through the if block > at line 2137: > if (LoadLineNumberTables && > _cp->symbol_at(code_attribute_name_index) == > vmSymbols::tag_line_number_table()) { > // Parse and compress line number table > parse_linenumber_table(code_attribute_length, code_length, > &linenumber_table, CHECK_(nullHandle)); > > [2] Uninitialised pointer rf may be used as argument 1 when calling > RFrame::set_distance at line 96 of > hotspot/src/share/vm/runtime/rframe.cpp in > function RFrame::new_RFrame > > The fix in rframe.cpp is for initializing the rf to NULL. > > It isn't being initialized if the execution path goes to the else block: > } else { > assert(false, "Unhandled frame type"); > } > > the assert is only for debug build. > > Testing: > JPRT > Aurora adhoc run including vm.quick on linux, windows (32- and > 64-bit), and solaris sparc and x64 > > Thanks in advance for your review. > > Calvin > From calvin.cheung at oracle.com Fri Jul 17 05:00:46 2015 From: calvin.cheung at oracle.com (Calvin Cheung) Date: Thu, 16 Jul 2015 22:00:46 -0700 Subject: RFR(XS): 8079825: Uninitialised variable in hotspot/src/share/vm & cpu/x86/vm (runtime) In-Reply-To: <55A86EC9.5010008@oracle.com> References: <55A7E55F.7060206@oracle.com> <55A86EC9.5010008@oracle.com> Message-ID: <55A88BFE.7000201@oracle.com> Thanks for your review, David. Calvin On 7/16/15 7:56 PM, David Holmes wrote: > Looks good Calvin! > > Thanks, > David > > On 17/07/2015 3:09 AM, Calvin Cheung wrote: >> This is for fixing some warnings about uninitialized variables reported >> by our internal code analysis tool. >> >> JBS: https://bugs.openjdk.java.net/browse/JDK-8079825 >> (this is a confidential bug) >> >> webrev: http://cr.openjdk.java.net/~ccheung/8079825/webrev.00/ >> >> [1] Uninitialised pointer localvariable_type_table_start may be used as >> argument >> 8 when calling ClassFileParser::copy_localvariable_table at line 2465 of >> hotspot/src/share/vm/classfile/classFileParser.cpp in function >> ClassFileParser::parse_method >> >> Similar warning message for the other 3 local variables. >> >> The fix in classFileParser.cpp is for initializing the following >> variables to NULL: >> localvariable_table_length, >> localvariable_table_start, >> localvariable_type_table_length, >> localvariable_type_table_start >> >> They may not be defined if the execution path goes through the if block >> at line 2137: >> if (LoadLineNumberTables && >> _cp->symbol_at(code_attribute_name_index) == >> vmSymbols::tag_line_number_table()) { >> // Parse and compress line number table >> parse_linenumber_table(code_attribute_length, code_length, >> &linenumber_table, CHECK_(nullHandle)); >> >> [2] Uninitialised pointer rf may be used as argument 1 when calling >> RFrame::set_distance at line 96 of >> hotspot/src/share/vm/runtime/rframe.cpp in >> function RFrame::new_RFrame >> >> The fix in rframe.cpp is for initializing the rf to NULL. >> >> It isn't being initialized if the execution path goes to the else block: >> } else { >> assert(false, "Unhandled frame type"); >> } >> >> the assert is only for debug build. >> >> Testing: >> JPRT >> Aurora adhoc run including vm.quick on linux, windows (32- and >> 64-bit), and solaris sparc and x64 >> >> Thanks in advance for your review. >> >> Calvin >> From daniel.daugherty at oracle.com Fri Jul 17 13:29:27 2015 From: daniel.daugherty at oracle.com (Daniel D. Daugherty) Date: Fri, 17 Jul 2015 07:29:27 -0600 Subject: Runtime command-line deprecation (Was Re: RFR: 8066821(S) Enhance command line processing to manage deprecating and obsoleting -XX command line arguments In-Reply-To: <55A843A5.1080108@oracle.com> References: <54B44661.8070007@oracle.com> <54B84E91.1050708@oracle.com> <54D15A0B.6030501@oracle.com> <87B07B03-3423-4738-9617-0C7B72A74A6E@oracle.com> <559AEC80.3010907@oracle.com> <55A8392C.3020404@oracle.com> <55A843A5.1080108@oracle.com> Message-ID: <55A90337.7030909@oracle.com> One tiny correction below... On 7/16/15 5:52 PM, David Holmes wrote: > Hi Derek, > > One general comment inline below that I meant to make to Karen's email > earlier ... > > On 17/07/2015 9:07 AM, Derek White wrote: >> Hi Karen, Coleen, >> >> I'll respond to one issue which you both brought up here, and respond to >> the rest inline. >> >> I think you both were skeptical of the need to "deprecate & handle" an >> argument (where the argument isn't an alias for another argument), >> although Karen suggested that might be good for external option removal, >> which has a really long lead time. >> >> From the options I've looked at, the decision to ignore vs. handle a >> deprecated option depends on what the option does and what users expect. >> For simple tuning or diagnostic options, there is little harm if we >> don't handle "-XX:+ UseOldInlining". The user would be hard-pressed to >> tell the difference. But if we wanted to deprecate "-XX:+UseG1GC" (for >> an unlikely example), this would make a big difference if we simply >> ignored the option. In this case we should still handle the option after >> emitting a deprecation warning (for at least one release). >> >> Should we ever go from "deprecate & handle" in one release to full >> removal in the next? Or should we always have a release that "deprecates >> & ignores" an option before removing it? Ignoring an old option is often >> a convenience for customers, but on the other hand it's kind of lying to >> the customers. Maybe they're asking for "XX:-MSG" and we say "sure boss" >> and pour on the monosodium glutamate :-) >> >> On the other hand, really handling a deprecated option has a cost too, >> so code complexity (and reliability), or time and space overheads might >> call for simply ignoring a deprecated option instead of always handling >> it in one release and ignoring it in the next. >> >> Coming up with some guidelines for this is a good idea, but I don't >> think hard rules will work. >> >> Specific responses below. >> >> FYI - New webrev is going through last round of merge testing. >> >> - Derek >> >> On 7/6/15 5:00 PM, Coleen Phillimore wrote: >>> >>> Hi, >>> >>> I'm happy for more clarity in the process of removing command line >>> arguments. I have some questions and comments below. >>> >>> On 6/26/15 4:09 PM, Karen Kinnear wrote: >>>> Derek, >>>> >>>> I am really glad you are looking into this. I expanded this to the >>>> runtime folks in case many of them have not yet seen this. >>>> Mary just forwarded this and I believe you haven't checked it in yet, >>>> so perhaps still time to discuss and make sure >>>> we all are together on the deprecation policy. >>>> >>>> The runtime team was discussing at staff this week how we handle >>>> deprecating jvm command-line options as >>>> we are looking to do more clean up in the future. >>>> >>>> So our internal change control process classifies our exported >>>> interfaces into three categories: >>>> External: command-line flags e.g. -verbose:gc, -Xmx, ... >>>> This includes any commercial flags >>>> Private: -XX flags documented (e.g. performance tuning or >>>> troubleshooting) >>>> I would assume this would include -XX product, experimental >>>> flags and manageable flags >>>> Internal: undocumented -XX flags >>>> I would assume this would include -XX develop and diagnostic >>>> flags >>>> >>>> (please correct me if my assumptions are wrong folks) >>> >>> This is a good categorization. Although I think there's some grey >>> area between External and Private, where some XX options are so >>> commonly used they should be considered External. Some of the GC >>> options may fall into this category like UseParNewGC. >> Yes, I agree that there is unexpected flag promotion. It would be great >> to get a common understanding of where the lines are between External, >> Private, and Internal. The flag types like commercial, product, >> experimental, develop, diagnostic are important, although I'd argue that >> experimental flags are more likely "internal" not private. I think we >> also need a liberal definition of "Documented" to include not just >> official documentation but blog postings and even serious mentions in >> places like StackOverflow. If the only reference that Google can find to >> an -XX flag is in the openJDK source code, then chances are it is >> "Internal". > > The classifications that Karen listed come from a document that > pre-dates open-sourcing of Java by many years. In an OpenSource world > all flags are "documented" - and there are a few webpages that serve > as tables of VM options for everyone to see. Not to mention all the > publicly visible bug reports. So a new definition of "documented" is > certainly needed. > > I also think we need definitions based more on the type of flag: > product, develop, diagnostic, experimental, commercial - as a first > level classification. With the concerns of external/internal/private > applying as a secondary classification when needed. Obviously not all > combinations make sense. > > I agree that in the worst-case there could well be a three phase process: > - deprecate and handle > - deprecate and ignore > - remove (give error on use) > > but that should only be needed for external, product flags - those > with the broadest use-base and exposure. Most will need the second two > stages only. And for some we should be able to just rip them out > whenever eg experimental-internal/private. > > Aside: in the JDK deprecation has mostly been phase one only, > unfortunately, with a handful of phase two. Alas no stage three. There's at least one stage 3 in the JDK: java.lang.Thread.suspend() throws UnsupportedOperationException since JDK8-B96. https://bugs.openjdk.java.net/browse/JDK-7059085 http://hg.openjdk.java.net/jdk9/dev/jdk/annotate/669be1677ab7/src/share/classes/java/lang/Thread.java#l848 Dan > > Cheers, > David > ------ > >>>> The way I understand that we handle private -XX options today is a >>>> 2-step removal: (obsolete_jvm_flags - where the >>>> release number is in a table and could be undefined) >>>> >>>> Using your helpful taxonomy >>>> fromhttps://bugs.openjdk.java.net/browse/JDK-806682: >>>> >>>> Today: private -XX options use 2-step removal (obsolete_jvm_flags) >>>> release 1: Deprecate & Obsolete - warn about the option but do >>>> nothing with it (we can remove all code that supports it) >>>> release 2: Dead - unrecognized >>>> - the point of the 2-step is to give customers time to modify any >>>> scripts they use >>>> >>>> I believe we have very rarely removed External flags - since >>>> customers, licensees, etc. may expect them. >>>> >>>> Mini-proposal: >>>> 1) I would recommend that we add a future set of changes to add >>>> consistent handling for the External flags - >>>> so that they would follow a three-step removal: >>>> release 1: Deprecate & Handle - warn and keep supporting >>>> release 2: Deprecate & Obsolete - warn and do nothing >>>> release 3: Dead - unrecognized >>>> >>>> 2) For the Internal flags - I think it would be kindest to customers >>>> and not a huge amount of additional work if >>>> we were to follow the Private model of using a 2 step. >>>> >>>> 3) leave the Private flags with the current 2-step removal >>> >>> Yes, this reflects our current model. >>>> 4) add support for aliasing - for any of them >>>> So that if you are doing aliasing, you would follow the model >>>> you are adding >>>> release 1: Deprecated & Handled - i.e. warn and still support >>>> (and set the information for the new alias) >>>> release 2: Dead - unrecognized >>>> >>>> 5) Could we possibly take the two flags that followed a different >>>> model already, i.e. moving to >>>> Deprecated & Handled and handle those as mistakes rather than part of >>>> a new general model? >>> >>> So this is my question which is around the code review in question. >>> Note, Derek, can you resend the RFR to hotspot-dev at openjdk.java.net so >>> it gets to all of us (even the compiler team may want to share in the >>> mechanism). >>> >>> Why are UseParNewGC and MaxGCMinorPauseMillis deprecated and handled >>> and not deprecated and obsolete? I don't actually see why have the >>> distinction here? >>> >>> Did these flags follow the deprecation procedure below? Why not just >>> make them obsolete, why have this other mechanism? I may be asking >>> the same question as Karen. >>> >>> I think the aliased flags could have a deprecate and handle model >>> (where handle == alias) in which case you only need one table for the >>> aliased flags, and you need to keep them in globals.hpp so they're >>> parsed properly. >> >> The real reason I wrote the code that way is because I was supporting >> the current policy (classic "mechanism not policy" checkin). I didn't >> (and don't) have the history on how we got there. But after thinking >> about it (see top post), I think there will be some cases where we'll >> have handle options instead of ignoring them and vice verse. And the >> final decision may come down to engineering, or customer, or partner >> concerns, or management whimsy, or whatever the current fad is. We're >> talking about code changes over multiple years here :-) >>>> Or do you think we will see more cases other than aliasing in which >>>> we would want to >>>> release 1: Deprecate & Handle and then release 2: Dead >>>> rather than release 1: Deprecate & Obsolete and then 2: Dead >>>> or rather than a 3 step like the External option proposal above? >>> >>> I think for the aliased flags you want the first option here >>> (deprecate&handle), right? But that's only because you need to keep >>> the option in globals.hpp so it parses correctly, otherwise the second >>> option (deprecate&obsolete) would be the preference? >>> >>> The options in the GC that are being deprecated and handled have had >>> warnings about them for a while, so making them obsolete doesn't feel >>> too soon. >> >> Yes, but just went through the approval process. >>> >>> Also, I agree with Kim's comment below that your comment lines are too >>> long. My fonts are too big to have windows this wide. >>> >>> thanks, >>> Coleen >>>> thanks, >>>> Karen >>>> >>>> p.s. Note that all of the deprecation needs to >>>> 1) work with licensee engineering to ensure we give licensee's a >>>> head's up and get feedback >>>> 2) file a change control request >>>> >>>> - we try to do these both as bulk requests to reduce the processing >>>> overhead. >>>> >>>> p.p.s. Details >>>> >>>> 1. Do the warnings print today or are they silent? Just want to make >>>> sure we are conscious of how >>>> those are handled if any of this moves to the new unified logging >>>> mechanism for which the new default >>>> for "warning" level is to print. >> The deprecation messages go through warning(), which is controlled by >> PrintWarnings (defaults to true). This is how the obsolete flag warnings >> are printed. The new deprecation mechanism replaces a mishmash of calls >> to jio_fprintf() and warning(), with a variety of different ways of >> saying the same thing. >>>> 2. "will likely be removed in a future release"? If we have already >>>> set the release it will be removed - is this a bit >>>> vague or did I not read closely enough? >> That text came from some of the deprecated GC options. If removal has >> been scheduled, we could say something more definite, or even the exact >> release. We don't print the exact "death" release for obsolete options >> currently though. >>>> >>>> On Feb 3, 2015, at 6:30 PM, Derek White wrote: >>>> >>>>> Request for review (again): >>>>> >>>>> - Updated with Kim's suggestion. >>>>> - Stopped double-printing warnings in some cases. >>>>> - Initial caps on warning() messages. >>>>> >>>>> Webrev:http://cr.openjdk.java.net/~drwhite/8066821/webrev.04/ >>>>> CR:https://bugs.openjdk.java.net/browse/JDK-8066821 >>>>> Tests: jtreg, jprt >>>>> >>>>> Thanks for looking! >>>>> >>>>> - Derek >>>>> >>>>> On 1/28/15 3:47 PM, Kim Barrett wrote: >>>>> >> ... From harold.seigel at oracle.com Fri Jul 17 14:48:34 2015 From: harold.seigel at oracle.com (harold seigel) Date: Fri, 17 Jul 2015 10:48:34 -0400 Subject: RFR(XS) 8081695: Old verifier fails to reject bad access to protected method Message-ID: <55A915C2.1040204@oracle.com> Hi, Please review this small change to fix bug JDK-8081695. The (old) type inferencing verifier excluded a particular protected access check for invokespecial calls of protected methods. That exclusion was done because of bytecodes generated by very old broken compilers. It is being removed because it violates the JVM-8 Spec and should no longer be needed. Open Webrev: http://cr.openjdk.java.net/~hseigel/bug_8081695/ JBS Bug: https://bugs.openjdk.java.net/browse/JDK-8081695 The fix was tested with JCK Lang and VM tests, WLS sanity testing, the UTE quick tests, and the hotspot, and JDK vm, java/io, java/lang, and java/util JTreg tests. Thanks, Harold From george.triantafillou at oracle.com Fri Jul 17 15:57:19 2015 From: george.triantafillou at oracle.com (George Triantafillou) Date: Fri, 17 Jul 2015 11:57:19 -0400 Subject: RFR(XS) 8081695: Old verifier fails to reject bad access to protected method In-Reply-To: <55A915C2.1040204@oracle.com> References: <55A915C2.1040204@oracle.com> Message-ID: <55A925DF.40507@oracle.com> Hi Harold, Looks good. -George On 7/17/2015 10:48 AM, harold seigel wrote: > Hi, > > Please review this small change to fix bug JDK-8081695. The (old) > type inferencing verifier excluded a particular protected access check > for invokespecial calls of protected methods. That exclusion was done > because of bytecodes generated by very old broken compilers. It is > being removed because it violates the JVM-8 Spec and should no longer > be needed. > > Open Webrev: http://cr.openjdk.java.net/~hseigel/bug_8081695/ > > JBS Bug: https://bugs.openjdk.java.net/browse/JDK-8081695 > > The fix was tested with JCK Lang and VM tests, WLS sanity testing, the > UTE quick tests, and the hotspot, and JDK vm, java/io, java/lang, and > java/util JTreg tests. > > Thanks, Harold From harold.seigel at oracle.com Fri Jul 17 18:07:54 2015 From: harold.seigel at oracle.com (harold seigel) Date: Fri, 17 Jul 2015 14:07:54 -0400 Subject: RFR(XS) 8081695: Old verifier fails to reject bad access to protected method In-Reply-To: <55A925DF.40507@oracle.com> References: <55A915C2.1040204@oracle.com> <55A925DF.40507@oracle.com> Message-ID: <55A9447A.3010907@oracle.com> Hi George, Thanks for the review! Harold On 7/17/2015 11:57 AM, George Triantafillou wrote: > Hi Harold, > > Looks good. > > -George > > On 7/17/2015 10:48 AM, harold seigel wrote: >> Hi, >> >> Please review this small change to fix bug JDK-8081695. The (old) >> type inferencing verifier excluded a particular protected access >> check for invokespecial calls of protected methods. That exclusion >> was done because of bytecodes generated by very old broken >> compilers. It is being removed because it violates the JVM-8 Spec >> and should no longer be needed. >> >> Open Webrev: http://cr.openjdk.java.net/~hseigel/bug_8081695/ >> >> JBS Bug: https://bugs.openjdk.java.net/browse/JDK-8081695 >> >> The fix was tested with JCK Lang and VM tests, WLS sanity testing, >> the UTE quick tests, and the hotspot, and JDK vm, java/io, java/lang, >> and java/util JTreg tests. >> >> Thanks, Harold > From yumin.qi at oracle.com Fri Jul 17 18:14:03 2015 From: yumin.qi at oracle.com (Yumin Qi) Date: Fri, 17 Jul 2015 11:14:03 -0700 Subject: RFR(XS): 8079825: Uninitialised variable in hotspot/src/share/vm & cpu/x86/vm (runtime) In-Reply-To: <55A7E55F.7060206@oracle.com> References: <55A7E55F.7060206@oracle.com> Message-ID: <55A945EB.3040904@oracle.com> Calvin, Looks good. Thanks Yumin On 7/16/2015 10:09 AM, Calvin Cheung wrote: > This is for fixing some warnings about uninitialized variables > reported by our internal code analysis tool. > > JBS: https://bugs.openjdk.java.net/browse/JDK-8079825 > (this is a confidential bug) > > webrev: http://cr.openjdk.java.net/~ccheung/8079825/webrev.00/ > > [1] Uninitialised pointer localvariable_type_table_start may be used > as argument > 8 when calling ClassFileParser::copy_localvariable_table at line 2465 of > hotspot/src/share/vm/classfile/classFileParser.cpp in function > ClassFileParser::parse_method > > Similar warning message for the other 3 local variables. > > The fix in classFileParser.cpp is for initializing the following > variables to NULL: > localvariable_table_length, > localvariable_table_start, > localvariable_type_table_length, > localvariable_type_table_start > > They may not be defined if the execution path goes through the if > block at line 2137: > if (LoadLineNumberTables && > _cp->symbol_at(code_attribute_name_index) == > vmSymbols::tag_line_number_table()) { > // Parse and compress line number table > parse_linenumber_table(code_attribute_length, code_length, > &linenumber_table, CHECK_(nullHandle)); > > [2] Uninitialised pointer rf may be used as argument 1 when calling > RFrame::set_distance at line 96 of > hotspot/src/share/vm/runtime/rframe.cpp in > function RFrame::new_RFrame > > The fix in rframe.cpp is for initializing the rf to NULL. > > It isn't being initialized if the execution path goes to the else block: > } else { > assert(false, "Unhandled frame type"); > } > > the assert is only for debug build. > > Testing: > JPRT > Aurora adhoc run including vm.quick on linux, windows (32- and > 64-bit), and solaris sparc and x64 > > Thanks in advance for your review. > > Calvin > From lois.foltan at oracle.com Fri Jul 17 18:13:27 2015 From: lois.foltan at oracle.com (Lois Foltan) Date: Fri, 17 Jul 2015 14:13:27 -0400 Subject: RFR(XS) 8081695: Old verifier fails to reject bad access to protected method In-Reply-To: <55A915C2.1040204@oracle.com> References: <55A915C2.1040204@oracle.com> Message-ID: <55A945C7.5080409@oracle.com> On 7/17/2015 10:48 AM, harold seigel wrote: > Hi, > > Please review this small change to fix bug JDK-8081695. The (old) > type inferencing verifier excluded a particular protected access check > for invokespecial calls of protected methods. That exclusion was done > because of bytecodes generated by very old broken compilers. It is > being removed because it violates the JVM-8 Spec and should no longer > be needed. > > Open Webrev: http://cr.openjdk.java.net/~hseigel/bug_8081695/ > > JBS Bug: https://bugs.openjdk.java.net/browse/JDK-8081695 Looks good. But can I suggest a reword on line #29 of test/vm/verifier/VerifyProtectedConstructor.java. Instead of: @summary Verify that protected constructor calls are not allowed for classfile version >= 50 (and that they are also not allowed for lesser versions). Can you just simply state: @summary Verify that protected constructor calls are not allowed for classfile version >= 49 Thanks, Lois > > The fix was tested with JCK Lang and VM tests, WLS sanity testing, the > UTE quick tests, and the hotspot, and JDK vm, java/io, java/lang, and > java/util JTreg tests. > > Thanks, Harold From calvin.cheung at oracle.com Fri Jul 17 18:18:51 2015 From: calvin.cheung at oracle.com (Calvin Cheung) Date: Fri, 17 Jul 2015 11:18:51 -0700 Subject: RFR(XS): 8079825: Uninitialised variable in hotspot/src/share/vm & cpu/x86/vm (runtime) In-Reply-To: <55A945EB.3040904@oracle.com> References: <55A7E55F.7060206@oracle.com> <55A945EB.3040904@oracle.com> Message-ID: <55A9470B.9070701@oracle.com> Thanks Yumin. Calvin On 7/17/15 11:14 AM, Yumin Qi wrote: > Calvin, > > Looks good. > > Thanks > Yumin > > On 7/16/2015 10:09 AM, Calvin Cheung wrote: >> This is for fixing some warnings about uninitialized variables >> reported by our internal code analysis tool. >> >> JBS: https://bugs.openjdk.java.net/browse/JDK-8079825 >> (this is a confidential bug) >> >> webrev: http://cr.openjdk.java.net/~ccheung/8079825/webrev.00/ >> >> [1] Uninitialised pointer localvariable_type_table_start may be used >> as argument >> 8 when calling ClassFileParser::copy_localvariable_table at line 2465 of >> hotspot/src/share/vm/classfile/classFileParser.cpp in function >> ClassFileParser::parse_method >> >> Similar warning message for the other 3 local variables. >> >> The fix in classFileParser.cpp is for initializing the following >> variables to NULL: >> localvariable_table_length, >> localvariable_table_start, >> localvariable_type_table_length, >> localvariable_type_table_start >> >> They may not be defined if the execution path goes through the if >> block at line 2137: >> if (LoadLineNumberTables && >> _cp->symbol_at(code_attribute_name_index) == >> vmSymbols::tag_line_number_table()) { >> // Parse and compress line number table >> parse_linenumber_table(code_attribute_length, code_length, >> &linenumber_table, CHECK_(nullHandle)); >> >> [2] Uninitialised pointer rf may be used as argument 1 when calling >> RFrame::set_distance at line 96 of >> hotspot/src/share/vm/runtime/rframe.cpp in >> function RFrame::new_RFrame >> >> The fix in rframe.cpp is for initializing the rf to NULL. >> >> It isn't being initialized if the execution path goes to the else block: >> } else { >> assert(false, "Unhandled frame type"); >> } >> >> the assert is only for debug build. >> >> Testing: >> JPRT >> Aurora adhoc run including vm.quick on linux, windows (32- and >> 64-bit), and solaris sparc and x64 >> >> Thanks in advance for your review. >> >> Calvin >> > From harold.seigel at oracle.com Fri Jul 17 18:20:59 2015 From: harold.seigel at oracle.com (harold seigel) Date: Fri, 17 Jul 2015 14:20:59 -0400 Subject: RFR(XS) 8081695: Old verifier fails to reject bad access to protected method In-Reply-To: <55A945C7.5080409@oracle.com> References: <55A915C2.1040204@oracle.com> <55A945C7.5080409@oracle.com> Message-ID: <55A9478B.8010006@oracle.com> Hi Lois, Thanks for the review. I'll re-phrase the Summary to say: Verify that protected constructor calls are not allowed for any classfile versions in either verifier. Harold On 7/17/2015 2:13 PM, Lois Foltan wrote: > > On 7/17/2015 10:48 AM, harold seigel wrote: >> Hi, >> >> Please review this small change to fix bug JDK-8081695. The (old) >> type inferencing verifier excluded a particular protected access >> check for invokespecial calls of protected methods. That exclusion >> was done because of bytecodes generated by very old broken >> compilers. It is being removed because it violates the JVM-8 Spec >> and should no longer be needed. >> >> Open Webrev: http://cr.openjdk.java.net/~hseigel/bug_8081695/ >> >> JBS Bug: https://bugs.openjdk.java.net/browse/JDK-8081695 > > Looks good. But can I suggest a reword on line #29 of > test/vm/verifier/VerifyProtectedConstructor.java. Instead of: > @summary Verify that protected constructor calls are not allowed for classfile version >= 50 (and that they are also not allowed for lesser versions). > Can you just simply state: > @summary Verify that protected constructor calls are not allowed for classfile version >= 49 > > Thanks, > Lois > > > >> >> The fix was tested with JCK Lang and VM tests, WLS sanity testing, >> the UTE quick tests, and the hotspot, and JDK vm, java/io, java/lang, >> and java/util JTreg tests. >> >> Thanks, Harold > From lois.foltan at oracle.com Fri Jul 17 18:21:42 2015 From: lois.foltan at oracle.com (Lois Foltan) Date: Fri, 17 Jul 2015 14:21:42 -0400 Subject: RFR(XS) 8081695: Old verifier fails to reject bad access to protected method In-Reply-To: <55A9478B.8010006@oracle.com> References: <55A915C2.1040204@oracle.com> <55A945C7.5080409@oracle.com> <55A9478B.8010006@oracle.com> Message-ID: <55A947B6.8030107@oracle.com> Thanks, that sounds good. Lois On 7/17/2015 2:20 PM, harold seigel wrote: > Hi Lois, > > Thanks for the review. > > I'll re-phrase the Summary to say: Verify that protected constructor > calls are not allowed for any classfile versions in either verifier. > > Harold > > On 7/17/2015 2:13 PM, Lois Foltan wrote: >> >> On 7/17/2015 10:48 AM, harold seigel wrote: >>> Hi, >>> >>> Please review this small change to fix bug JDK-8081695. The (old) >>> type inferencing verifier excluded a particular protected access >>> check for invokespecial calls of protected methods. That exclusion >>> was done because of bytecodes generated by very old broken >>> compilers. It is being removed because it violates the JVM-8 Spec >>> and should no longer be needed. >>> >>> Open Webrev: http://cr.openjdk.java.net/~hseigel/bug_8081695/ >>> >>> JBS Bug: https://bugs.openjdk.java.net/browse/JDK-8081695 >> >> Looks good. But can I suggest a reword on line #29 of >> test/vm/verifier/VerifyProtectedConstructor.java. Instead of: >> @summary Verify that protected constructor calls are not allowed for classfile version >= 50 (and that they are also not allowed for lesser versions). >> Can you just simply state: >> @summary Verify that protected constructor calls are not allowed for classfile version >= 49 >> >> Thanks, >> Lois >> >> >> >>> >>> The fix was tested with JCK Lang and VM tests, WLS sanity testing, >>> the UTE quick tests, and the hotspot, and JDK vm, java/io, >>> java/lang, and java/util JTreg tests. >>> >>> Thanks, Harold >> > From coleen.phillimore at oracle.com Fri Jul 17 18:47:52 2015 From: coleen.phillimore at oracle.com (Coleen Phillimore) Date: Fri, 17 Jul 2015 14:47:52 -0400 Subject: Open code review for 8061999 Enhance VM option parsing to allow options to be specified In-Reply-To: <539fb166-506a-47bd-b710-d218e6ebaed1@default> References: <6b67beb6-3936-4c3c-bd33-cd314be5e8e5@default> <55A80A78.4080605@oracle.com> <539fb166-506a-47bd-b710-d218e6ebaed1@default> Message-ID: <55A94DD8.8000400@oracle.com> Ron, The code that we've just reviewed and I'm sponsoring from Jeremy Manson directly conflicts with this code. Jeremy has added a RESII class for JavaVMInitArgs that you should use. I have other initial comments but I haven't gotten to reading all of this thread yet. Please wait for my code review. Thanks, Coleen On 7/16/15 4:00 PM, Ron Durbin wrote: > I will file it and thanks for the "r" review. > >> -----Original Message----- >> From: gerard ziemski >> Sent: Thursday, July 16, 2015 1:48 PM >> To: Ron Durbin; hotspot-runtime-dev at openjdk.java.net >> Subject: Re: Open code review for 8061999 Enhance VM option parsing to allow options to be specified >> >> hi Ron, >> >> I have no more comments, just one question: you say "A future >> enhancement will be to refactor the options file processing to grow >> memory like the environment variables do now." - is that enhancement >> filed yet? >> >> Please consider this reviewed with small "r". >> >> >> cheers >> >> >> On 07/14/2015 05:21 PM, Ron Durbin wrote: >>> Gerard, >>> >>> Thanks for your time in reviewing the code and providing comments. >>> My responses to your comments inline below: >>> >>> >>>> -----Original Message----- >>>> From: Gerard Ziemski >>>> Sent: Tuesday, June 23, 2015 1:53 PM >>>> To: hotspot-runtime-dev at openjdk.java.net >>>> Cc: Ron Durbin >>>> Subject: Re: Open code review for 8061999 Enhance VM option parsing to allow options to be specified >>>> >>>> hi Ron, >>>> >>>> I'm sending you partial feedback, since I am starting to get a bit tired. I will spend more time reviewing >> your >>>> webrev tomorrow, but here is what I have so far: >>>> >>>> --- >>>> src/share/vm/utilities/globalDefinitions.hp >>>> >>>> 1. Should we name the method "is_white()", not "iswhite()" since it's part of our code base? But then since >> it's >>>> a macro, shouldn't it actually be "IS_WHITE()" ? >>>> --- >>>> src/share/vm/runtime/arguments.hpp >>>> [ >>> [Ron] While researching my answer to this comment, I realized >>> that I should have used the already existing isspace() function >>> instead of creating the iswhite() macro. Will fix. >>> >>>> 1. >>>> >>>> All the arguments in alloc_JVM_options_list(), copy_JVM_options_from_buf() and parse_JVM_options_file() use >>>> underscores in the arguments names except for merge_JVM_options_file(). I think the merge_JVM_options_file() >>>> should be: >>>> >>>> + static jint merge_JVM_options_file(const struct JavaVMInitArgs *args_in, >>>> + struct JavaVMInitArgs **args_out); >>>> >>> [Ron] This one is a reasonable clean up >>> >>>> --- >>>> src/share/vm/runtime/arguments.cpp >>>> >>>> 1. Why do FreeVMOptions, DumpVMOptions, DumpVMOption and DumpOption start with capital letters? Shouldn't >> their >>>> names start with a lower case letter? >>>> >>> [Ron] This one is a reasonable clean up >>> >>>> 2. Line 4306. The pattern in Arguments::parse() seems to be to print out error message and return the error >>>> value if something goes wrong, but we do vm_exit(1) instead? >>>> >>> [Ron ] The cases that will trigger this exit on fail are extreme: >>> - missing or otherwise in accessible options files >>> - Un-parsable options file, too big, too many options, nonwhite space terminated options >>> - Unable to allocate memory for options files processing >>> >>>> 3. Line 4309. I was told that when it comes to NULL pointer check we should do (NULL == args), not the other >> way >>>> around. >>>> >>> [Ron] This one is a reasonable clean up >>> >>>> 4. Line 4375. Don't we need FreeVMOptions() here? Line 4382 as well? >>> >>> [Ron] Gerard this one is a reasonable clean up >>> >>>> 5. Question. Why do we need N_MAX_OPTIONS? >>> [Ron] Until recently N_MAX_OPTIONS applied to environment variables too >>> N_MAX_OTIIONS is used to limit the number of options and thus the memory allocated. >>> A future enhancement will be to refactor the options file processing to grow memory like the >>> environment variables do now. >>> >>>> 6. Question. Why do we need OPTION_BUFFER_SIZE? Can't we use "int bytes_needed = fseek(stream, 0, SEEK_END); >>>> rewind(stream)" and have the code dynamically allocate memory without hard coded limits? >>>> >>> [Ron>] Until recently OPTION_BUFFER_SIZE applied to environment variables too. \ >>> OPTION_BUFFER_SIZE is used to limit the memory allocated for reading the options. >>> A future enhancement will be to refactor the options file processing to grow memory like the >>> environment variables do now. >>> >>> >>>> 7. Line 3965. Can that comparison ever succeed? "read()" will not read more bytes (only less) than as >> specified >>>> by "bytes_alloc" and if it did, we would overwrite memory since our buf is only "bytes_alloc" big. >>>> >>> [Ron>] Yes that comparison can succeed. We only support an >>> options file that is <= OPTION_BUFFER_SIZE bytes in >>> size. >>> >>> We allocate a read buffer that is OPTION_BUFFER_SIZE + 1 >>> bytes in size for two reasons: >>> >>> 1) to have space for a NULL terminator when the >>> options file is the maximum number of bytes >>> in length >>> 2) easy detection of an options file that is too large; >>> we try to read OPTION_BUFFER_SIZE + 1 bytes. If we >>> succeed, then the file is too big. >>> >>> >>>> cheers >>>> >>>> >>>> On 6/22/2015 7:52 AM, Ron Durbin wrote: >>>> Webrev URL: >>>> http://cr.openjdk.java.net/~rdurbin/8061999_OCR0_JDK9_webrev >>>> >>>> >>>> RFE request: >>>> https://bugs.openjdk.java.net/browse/JDK-8061999 >>>> >>>> This RFE allows a file to be specified that holds VM Options that >>>> would otherwise be specified on the command line or in an environment variable. >>>> Only one options file may be specified on the command line and no options file >>>> may be specified in either of the following environment variables >>>> "JAVA_TOOL_OPTIONS" or "_JAVA_OPTIONS". >>>> >>>> The options file feature supports all VM options currently supported on >>>> the command line, except the options file option. The option to specify an >>>> options file is "-XX:VMOptionsFile=". >>>> The options file feature supports an options file up to 1024 bytes in size >>>> and up to 64 options. >>>> >>>> This feature has been tested on: >>>> OS: >>>> Solaris, MAC, Windows, Linux >>>> Tests: >>>> Manual unit tests >>>> JPRT with -testset hotspot (including the SQE proposed test coverage for this feature.) >>>> >>>> >>>> From coleen.phillimore at oracle.com Fri Jul 17 18:49:57 2015 From: coleen.phillimore at oracle.com (Coleen Phillimore) Date: Fri, 17 Jul 2015 14:49:57 -0400 Subject: Open code review for 8061999 Enhance VM option parsing to allow options to be specified In-Reply-To: <55A94DD8.8000400@oracle.com> References: <6b67beb6-3936-4c3c-bd33-cd314be5e8e5@default> <55A80A78.4080605@oracle.com> <539fb166-506a-47bd-b710-d218e6ebaed1@default> <55A94DD8.8000400@oracle.com> Message-ID: <55A94E55.2050603@oracle.com> Sorry, it's a RAII class. I got the acronym confused with Robert Strout :) Coleen On 7/17/15 2:47 PM, Coleen Phillimore wrote: > > Ron, > > The code that we've just reviewed and I'm sponsoring from Jeremy > Manson directly conflicts with this code. Jeremy has added a RESII > class for JavaVMInitArgs that you should use. I have other initial > comments but I haven't gotten to reading all of this thread yet. > Please wait for my code review. > > Thanks, > Coleen > > On 7/16/15 4:00 PM, Ron Durbin wrote: >> I will file it and thanks for the "r" review. >> >>> -----Original Message----- >>> From: gerard ziemski >>> Sent: Thursday, July 16, 2015 1:48 PM >>> To: Ron Durbin; hotspot-runtime-dev at openjdk.java.net >>> Subject: Re: Open code review for 8061999 Enhance VM option parsing >>> to allow options to be specified >>> >>> hi Ron, >>> >>> I have no more comments, just one question: you say "A future >>> enhancement will be to refactor the options file processing to grow >>> memory like the environment variables do now." - is that enhancement >>> filed yet? >>> >>> Please consider this reviewed with small "r". >>> >>> >>> cheers >>> >>> >>> On 07/14/2015 05:21 PM, Ron Durbin wrote: >>>> Gerard, >>>> >>>> Thanks for your time in reviewing the code and providing comments. >>>> My responses to your comments inline below: >>>> >>>> >>>>> -----Original Message----- >>>>> From: Gerard Ziemski >>>>> Sent: Tuesday, June 23, 2015 1:53 PM >>>>> To: hotspot-runtime-dev at openjdk.java.net >>>>> Cc: Ron Durbin >>>>> Subject: Re: Open code review for 8061999 Enhance VM option >>>>> parsing to allow options to be specified >>>>> >>>>> hi Ron, >>>>> >>>>> I'm sending you partial feedback, since I am starting to get a bit >>>>> tired. I will spend more time reviewing >>> your >>>>> webrev tomorrow, but here is what I have so far: >>>>> >>>>> --- >>>>> src/share/vm/utilities/globalDefinitions.hp >>>>> >>>>> 1. Should we name the method "is_white()", not "iswhite()" since >>>>> it's part of our code base? But then since >>> it's >>>>> a macro, shouldn't it actually be "IS_WHITE()" ? >>>>> --- >>>>> src/share/vm/runtime/arguments.hpp >>>>> [ >>>> [Ron] While researching my answer to this comment, I realized >>>> that I should have used the already existing isspace() >>>> function >>>> instead of creating the iswhite() macro. Will fix. >>>> >>>>> 1. >>>>> >>>>> All the arguments in alloc_JVM_options_list(), >>>>> copy_JVM_options_from_buf() and parse_JVM_options_file() use >>>>> underscores in the arguments names except for >>>>> merge_JVM_options_file(). I think the merge_JVM_options_file() >>>>> should be: >>>>> >>>>> + static jint merge_JVM_options_file(const struct JavaVMInitArgs >>>>> *args_in, >>>>> + struct JavaVMInitArgs >>>>> **args_out); >>>>> >>>> [Ron] This one is a reasonable clean up >>>> >>>>> --- >>>>> src/share/vm/runtime/arguments.cpp >>>>> >>>>> 1. Why do FreeVMOptions, DumpVMOptions, DumpVMOption and >>>>> DumpOption start with capital letters? Shouldn't >>> their >>>>> names start with a lower case letter? >>>>> >>>> [Ron] This one is a reasonable clean up >>>> >>>>> 2. Line 4306. The pattern in Arguments::parse() seems to be to >>>>> print out error message and return the error >>>>> value if something goes wrong, but we do vm_exit(1) instead? >>>>> >>>> [Ron ] The cases that will trigger this exit on fail are extreme: >>>> - missing or otherwise in accessible options files >>>> - Un-parsable options file, too big, too many options, >>>> nonwhite space terminated options >>>> - Unable to allocate memory for options files processing >>>> >>>>> 3. Line 4309. I was told that when it comes to NULL pointer check >>>>> we should do (NULL == args), not the other >>> way >>>>> around. >>>>> >>>> [Ron] This one is a reasonable clean up >>>> >>>>> 4. Line 4375. Don't we need FreeVMOptions() here? Line 4382 as well? >>>> >>>> [Ron] Gerard this one is a reasonable clean up >>>> >>>>> 5. Question. Why do we need N_MAX_OPTIONS? >>>> [Ron] Until recently N_MAX_OPTIONS applied to environment variables >>>> too >>>> N_MAX_OTIIONS is used to limit the number of options and >>>> thus the memory allocated. >>>> A future enhancement will be to refactor the options file >>>> processing to grow memory like the >>>> environment variables do now. >>>> >>>>> 6. Question. Why do we need OPTION_BUFFER_SIZE? Can't we use "int >>>>> bytes_needed = fseek(stream, 0, SEEK_END); >>>>> rewind(stream)" and have the code dynamically allocate memory >>>>> without hard coded limits? >>>>> >>>> [Ron>] Until recently OPTION_BUFFER_SIZE applied to environment >>>> variables too. \ >>>> OPTION_BUFFER_SIZE is used to limit the memory allocated >>>> for reading the options. >>>> A future enhancement will be to refactor the options file >>>> processing to grow memory like the >>>> environment variables do now. >>>> >>>> >>>>> 7. Line 3965. Can that comparison ever succeed? "read()" will not >>>>> read more bytes (only less) than as >>> specified >>>>> by "bytes_alloc" and if it did, we would overwrite memory since >>>>> our buf is only "bytes_alloc" big. >>>>> >>>> [Ron>] Yes that comparison can succeed. We only support an >>>> options file that is <= OPTION_BUFFER_SIZE bytes in >>>> size. >>>> >>>> We allocate a read buffer that is OPTION_BUFFER_SIZE + 1 >>>> bytes in size for two reasons: >>>> >>>> 1) to have space for a NULL terminator when the >>>> options file is the maximum number of bytes >>>> in length >>>> 2) easy detection of an options file that is too large; >>>> we try to read OPTION_BUFFER_SIZE + 1 bytes. If we >>>> succeed, then the file is too big. >>>> >>>> >>>>> cheers >>>>> >>>>> >>>>> On 6/22/2015 7:52 AM, Ron Durbin wrote: >>>>> Webrev URL: >>>>> http://cr.openjdk.java.net/~rdurbin/8061999_OCR0_JDK9_webrev >>>>> >>>>> >>>>> RFE request: >>>>> https://bugs.openjdk.java.net/browse/JDK-8061999 >>>>> >>>>> This RFE allows a file to be specified that holds VM Options that >>>>> would otherwise be specified on the command line or in an >>>>> environment variable. >>>>> Only one options file may be specified on the command line and no >>>>> options file >>>>> may be specified in either of the following environment variables >>>>> "JAVA_TOOL_OPTIONS" or "_JAVA_OPTIONS". >>>>> >>>>> The options file feature supports all VM options currently >>>>> supported on >>>>> the command line, except the options file option. The option to >>>>> specify an >>>>> options file is "-XX:VMOptionsFile=". >>>>> The options file feature supports an options file up to 1024 bytes >>>>> in size >>>>> and up to 64 options. >>>>> >>>>> This feature has been tested on: >>>>> OS: >>>>> Solaris, MAC, Windows, Linux >>>>> Tests: >>>>> Manual unit tests >>>>> JPRT with -testset hotspot (including the SQE proposed test >>>>> coverage for this feature.) >>>>> >>>>> >>>>> > From ron.durbin at oracle.com Fri Jul 17 23:02:03 2015 From: ron.durbin at oracle.com (Ron Durbin) Date: Fri, 17 Jul 2015 16:02:03 -0700 (PDT) Subject: Open code review for 8061999 Enhance VM option parsing to allow options to be specified Message-ID: <65a589f0-99cd-43e5-8dfd-71143bc6cc08@default> Here is the round 1 webrev for 8061999. It incorporates changes made due to comments from the round 0 reviewers. The easiest way to review this round is to download the two patch files: http://cr.openjdk.java.net/~rdurbin/8061999_OCR0_JDK9_webrev/hotspot.patch http://cr.openjdk.java.net/~rdurbin/8061999_OCR1_JDK9_webrev/hotspot.patch and look at them in your favorite file merge tool. RFE request: https://bugs.openjdk.java.net/browse/JDK-8061999 This RFE allows a file to be specified that holds VM Options that would otherwise be specified on the command line or in an environment variable. Only one options file may be specified on the command line and no options file may be specified in either of the following environment variables "JAVA_TOOL_OPTIONS" or "_JAVA_OPTIONS". The options file feature supports all VM options currently supported on the command line, except the options file option. The option to specify an options file is "-XX:VMOptionsFile=". The options file feature supports an options file up to 1024 bytes in size and up to 64 options. This feature has been tested on: OS: Solaris, MAC, Windows, Linux Tests: Manual unit tests JPRT with -testset hotspot (including the SQE proposed test coverage for this feature.) From daniel.daugherty at oracle.com Sat Jul 18 02:17:11 2015 From: daniel.daugherty at oracle.com (Daniel D. Daugherty) Date: Fri, 17 Jul 2015 20:17:11 -0600 Subject: Open code review for 8061999 Enhance VM option parsing to allow options to be specified In-Reply-To: <65a589f0-99cd-43e5-8dfd-71143bc6cc08@default> References: <65a589f0-99cd-43e5-8dfd-71143bc6cc08@default> Message-ID: <55A9B727.2080508@oracle.com> On 7/17/15 5:02 PM, Ron Durbin wrote: > Here is the round 1 webrev for 8061999. It incorporates changes made > due to comments from the round 0 reviewers. The easiest way to review > this round is to download the two patch files: > > http://cr.openjdk.java.net/~rdurbin/8061999_OCR0_JDK9_webrev/hotspot.patch > http://cr.openjdk.java.net/~rdurbin/8061999_OCR1_JDK9_webrev/hotspot.patch > http://cr.openjdk.java.net/~rdurbin/8061999_OCR1_JDK9_webrev/ src/share/vm/runtime/arguments.cpp No comments. src/share/vm/runtime/arguments.hpp No comments. Thumbs up. Dan > > and look at them in your favorite file merge tool. > > RFE request: > https://bugs.openjdk.java.net/browse/JDK-8061999 > > This RFE allows a file to be specified that holds VM Options that > would otherwise be specified on the command line or in an environment variable. > Only one options file may be specified on the command line and no options file > may be specified in either of the following environment variables > "JAVA_TOOL_OPTIONS" or "_JAVA_OPTIONS". > > The options file feature supports all VM options currently supported on > the command line, except the options file option. The option to specify an > options file is "-XX:VMOptionsFile=". > The options file feature supports an options file up to 1024 bytes in size > and up to 64 options. > > This feature has been tested on: > OS: > Solaris, MAC, Windows, Linux > Tests: > Manual unit tests > JPRT with -testset hotspot (including the SQE proposed test coverage for this feature.) From david.holmes at oracle.com Mon Jul 20 01:56:58 2015 From: david.holmes at oracle.com (David Holmes) Date: Mon, 20 Jul 2015 11:56:58 +1000 Subject: Open code review for 8061999 Enhance VM option parsing to allow options to be specified In-Reply-To: <65a589f0-99cd-43e5-8dfd-71143bc6cc08@default> References: <65a589f0-99cd-43e5-8dfd-71143bc6cc08@default> Message-ID: <55AC556A.1060100@oracle.com> As per Coleen's earlier email this needs re-sync'ing with: http://hg.openjdk.java.net/jdk9/hs-rt/hotspot/rev/a02747e8bc4c David On 18/07/2015 9:02 AM, Ron Durbin wrote: > Here is the round 1 webrev for 8061999. It incorporates changes made > due to comments from the round 0 reviewers. The easiest way to review > this round is to download the two patch files: > > http://cr.openjdk.java.net/~rdurbin/8061999_OCR0_JDK9_webrev/hotspot.patch > http://cr.openjdk.java.net/~rdurbin/8061999_OCR1_JDK9_webrev/hotspot.patch > > and look at them in your favorite file merge tool. > > RFE request: > https://bugs.openjdk.java.net/browse/JDK-8061999 > > This RFE allows a file to be specified that holds VM Options that > would otherwise be specified on the command line or in an environment variable. > Only one options file may be specified on the command line and no options file > may be specified in either of the following environment variables > "JAVA_TOOL_OPTIONS" or "_JAVA_OPTIONS". > > The options file feature supports all VM options currently supported on > the command line, except the options file option. The option to specify an > options file is "-XX:VMOptionsFile=". > The options file feature supports an options file up to 1024 bytes in size > and up to 64 options. > > This feature has been tested on: > OS: > Solaris, MAC, Windows, Linux > Tests: > Manual unit tests > JPRT with -testset hotspot (including the SQE proposed test coverage for this feature.) > From david.holmes at oracle.com Mon Jul 20 02:09:21 2015 From: david.holmes at oracle.com (David Holmes) Date: Mon, 20 Jul 2015 12:09:21 +1000 Subject: Runtime command-line deprecation (Was Re: RFR: 8066821(S) Enhance command line processing to manage deprecating and obsoleting -XX command line arguments In-Reply-To: <55A90337.7030909@oracle.com> References: <54B44661.8070007@oracle.com> <54B84E91.1050708@oracle.com> <54D15A0B.6030501@oracle.com> <87B07B03-3423-4738-9617-0C7B72A74A6E@oracle.com> <559AEC80.3010907@oracle.com> <55A8392C.3020404@oracle.com> <55A843A5.1080108@oracle.com> <55A90337.7030909@oracle.com> Message-ID: <55AC5851.1040001@oracle.com> On 17/07/2015 11:29 PM, Daniel D. Daugherty wrote: > One tiny correction below... A correction to your correction ... > On 7/16/15 5:52 PM, David Holmes wrote: >> Aside: in the JDK deprecation has mostly been phase one only, >> unfortunately, with a handful of phase two. Alas no stage three. > > There's at least one stage 3 in the JDK: > > java.lang.Thread.suspend() throws UnsupportedOperationException > since JDK8-B96. I don't consider that a stage 3 - stage 3 would mean Thread.suspend doesn't even exist in the API. Cheers, David > https://bugs.openjdk.java.net/browse/JDK-7059085 > > http://hg.openjdk.java.net/jdk9/dev/jdk/annotate/669be1677ab7/src/share/classes/java/lang/Thread.java#l848 > > > Dan > > >> >> Cheers, >> David >> ------ >> >>>>> The way I understand that we handle private -XX options today is a >>>>> 2-step removal: (obsolete_jvm_flags - where the >>>>> release number is in a table and could be undefined) >>>>> >>>>> Using your helpful taxonomy >>>>> fromhttps://bugs.openjdk.java.net/browse/JDK-806682: >>>>> >>>>> Today: private -XX options use 2-step removal (obsolete_jvm_flags) >>>>> release 1: Deprecate & Obsolete - warn about the option but do >>>>> nothing with it (we can remove all code that supports it) >>>>> release 2: Dead - unrecognized >>>>> - the point of the 2-step is to give customers time to modify any >>>>> scripts they use >>>>> >>>>> I believe we have very rarely removed External flags - since >>>>> customers, licensees, etc. may expect them. >>>>> >>>>> Mini-proposal: >>>>> 1) I would recommend that we add a future set of changes to add >>>>> consistent handling for the External flags - >>>>> so that they would follow a three-step removal: >>>>> release 1: Deprecate & Handle - warn and keep supporting >>>>> release 2: Deprecate & Obsolete - warn and do nothing >>>>> release 3: Dead - unrecognized >>>>> >>>>> 2) For the Internal flags - I think it would be kindest to customers >>>>> and not a huge amount of additional work if >>>>> we were to follow the Private model of using a 2 step. >>>>> >>>>> 3) leave the Private flags with the current 2-step removal >>>> >>>> Yes, this reflects our current model. >>>>> 4) add support for aliasing - for any of them >>>>> So that if you are doing aliasing, you would follow the model >>>>> you are adding >>>>> release 1: Deprecated & Handled - i.e. warn and still support >>>>> (and set the information for the new alias) >>>>> release 2: Dead - unrecognized >>>>> >>>>> 5) Could we possibly take the two flags that followed a different >>>>> model already, i.e. moving to >>>>> Deprecated & Handled and handle those as mistakes rather than part of >>>>> a new general model? >>>> >>>> So this is my question which is around the code review in question. >>>> Note, Derek, can you resend the RFR to hotspot-dev at openjdk.java.net so >>>> it gets to all of us (even the compiler team may want to share in the >>>> mechanism). >>>> >>>> Why are UseParNewGC and MaxGCMinorPauseMillis deprecated and handled >>>> and not deprecated and obsolete? I don't actually see why have the >>>> distinction here? >>>> >>>> Did these flags follow the deprecation procedure below? Why not just >>>> make them obsolete, why have this other mechanism? I may be asking >>>> the same question as Karen. >>>> >>>> I think the aliased flags could have a deprecate and handle model >>>> (where handle == alias) in which case you only need one table for the >>>> aliased flags, and you need to keep them in globals.hpp so they're >>>> parsed properly. >>> >>> The real reason I wrote the code that way is because I was supporting >>> the current policy (classic "mechanism not policy" checkin). I didn't >>> (and don't) have the history on how we got there. But after thinking >>> about it (see top post), I think there will be some cases where we'll >>> have handle options instead of ignoring them and vice verse. And the >>> final decision may come down to engineering, or customer, or partner >>> concerns, or management whimsy, or whatever the current fad is. We're >>> talking about code changes over multiple years here :-) >>>>> Or do you think we will see more cases other than aliasing in which >>>>> we would want to >>>>> release 1: Deprecate & Handle and then release 2: Dead >>>>> rather than release 1: Deprecate & Obsolete and then 2: Dead >>>>> or rather than a 3 step like the External option proposal above? >>>> >>>> I think for the aliased flags you want the first option here >>>> (deprecate&handle), right? But that's only because you need to keep >>>> the option in globals.hpp so it parses correctly, otherwise the second >>>> option (deprecate&obsolete) would be the preference? >>>> >>>> The options in the GC that are being deprecated and handled have had >>>> warnings about them for a while, so making them obsolete doesn't feel >>>> too soon. >>> >>> Yes, but just went through the approval process. >>>> >>>> Also, I agree with Kim's comment below that your comment lines are too >>>> long. My fonts are too big to have windows this wide. >>>> >>>> thanks, >>>> Coleen >>>>> thanks, >>>>> Karen >>>>> >>>>> p.s. Note that all of the deprecation needs to >>>>> 1) work with licensee engineering to ensure we give licensee's a >>>>> head's up and get feedback >>>>> 2) file a change control request >>>>> >>>>> - we try to do these both as bulk requests to reduce the processing >>>>> overhead. >>>>> >>>>> p.p.s. Details >>>>> >>>>> 1. Do the warnings print today or are they silent? Just want to make >>>>> sure we are conscious of how >>>>> those are handled if any of this moves to the new unified logging >>>>> mechanism for which the new default >>>>> for "warning" level is to print. >>> The deprecation messages go through warning(), which is controlled by >>> PrintWarnings (defaults to true). This is how the obsolete flag warnings >>> are printed. The new deprecation mechanism replaces a mishmash of calls >>> to jio_fprintf() and warning(), with a variety of different ways of >>> saying the same thing. >>>>> 2. "will likely be removed in a future release"? If we have already >>>>> set the release it will be removed - is this a bit >>>>> vague or did I not read closely enough? >>> That text came from some of the deprecated GC options. If removal has >>> been scheduled, we could say something more definite, or even the exact >>> release. We don't print the exact "death" release for obsolete options >>> currently though. >>>>> >>>>> On Feb 3, 2015, at 6:30 PM, Derek White wrote: >>>>> >>>>>> Request for review (again): >>>>>> >>>>>> - Updated with Kim's suggestion. >>>>>> - Stopped double-printing warnings in some cases. >>>>>> - Initial caps on warning() messages. >>>>>> >>>>>> Webrev:http://cr.openjdk.java.net/~drwhite/8066821/webrev.04/ >>>>>> CR:https://bugs.openjdk.java.net/browse/JDK-8066821 >>>>>> Tests: jtreg, jprt >>>>>> >>>>>> Thanks for looking! >>>>>> >>>>>> - Derek >>>>>> >>>>>> On 1/28/15 3:47 PM, Kim Barrett wrote: >>>>>> >>> ... > From daniel.daugherty at oracle.com Mon Jul 20 13:54:20 2015 From: daniel.daugherty at oracle.com (Daniel D. Daugherty) Date: Mon, 20 Jul 2015 07:54:20 -0600 Subject: Runtime command-line deprecation (Was Re: RFR: 8066821(S) Enhance command line processing to manage deprecating and obsoleting -XX command line arguments In-Reply-To: <55AC5851.1040001@oracle.com> References: <54B44661.8070007@oracle.com> <54B84E91.1050708@oracle.com> <54D15A0B.6030501@oracle.com> <87B07B03-3423-4738-9617-0C7B72A74A6E@oracle.com> <559AEC80.3010907@oracle.com> <55A8392C.3020404@oracle.com> <55A843A5.1080108@oracle.com> <55A90337.7030909@oracle.com> <55AC5851.1040001@oracle.com> Message-ID: <55ACFD8C.6060907@oracle.com> On 7/19/15 8:09 PM, David Holmes wrote: > On 17/07/2015 11:29 PM, Daniel D. Daugherty wrote: >> One tiny correction below... > > A correction to your correction ... > >> On 7/16/15 5:52 PM, David Holmes wrote: >>> Aside: in the JDK deprecation has mostly been phase one only, >>> unfortunately, with a handful of phase two. Alas no stage three. >> >> There's at least one stage 3 in the JDK: >> >> java.lang.Thread.suspend() throws UnsupportedOperationException >> since JDK8-B96. > > I don't consider that a stage 3 - stage 3 would mean Thread.suspend > doesn't even exist in the API. Your three stages from your original reply which you trimmed from this reply: > I agree that in the worst-case there could well be a three phase process: > - deprecate and handle > - deprecate and ignore > - remove (give error on use) I was responding to the "give error on use" part and not so much on the "remove" part. Dan > > Cheers, > David > >> https://bugs.openjdk.java.net/browse/JDK-7059085 >> >> http://hg.openjdk.java.net/jdk9/dev/jdk/annotate/669be1677ab7/src/share/classes/java/lang/Thread.java#l848 >> >> >> >> Dan >> >> >>> >>> Cheers, >>> David >>> ------ >>> >>>>>> The way I understand that we handle private -XX options today is a >>>>>> 2-step removal: (obsolete_jvm_flags - where the >>>>>> release number is in a table and could be undefined) >>>>>> >>>>>> Using your helpful taxonomy >>>>>> fromhttps://bugs.openjdk.java.net/browse/JDK-806682: >>>>>> >>>>>> Today: private -XX options use 2-step removal (obsolete_jvm_flags) >>>>>> release 1: Deprecate & Obsolete - warn about the option but do >>>>>> nothing with it (we can remove all code that supports it) >>>>>> release 2: Dead - unrecognized >>>>>> - the point of the 2-step is to give customers time to modify any >>>>>> scripts they use >>>>>> >>>>>> I believe we have very rarely removed External flags - since >>>>>> customers, licensees, etc. may expect them. >>>>>> >>>>>> Mini-proposal: >>>>>> 1) I would recommend that we add a future set of changes to add >>>>>> consistent handling for the External flags - >>>>>> so that they would follow a three-step removal: >>>>>> release 1: Deprecate & Handle - warn and keep supporting >>>>>> release 2: Deprecate & Obsolete - warn and do nothing >>>>>> release 3: Dead - unrecognized >>>>>> >>>>>> 2) For the Internal flags - I think it would be kindest to customers >>>>>> and not a huge amount of additional work if >>>>>> we were to follow the Private model of using a 2 step. >>>>>> >>>>>> 3) leave the Private flags with the current 2-step removal >>>>> >>>>> Yes, this reflects our current model. >>>>>> 4) add support for aliasing - for any of them >>>>>> So that if you are doing aliasing, you would follow the model >>>>>> you are adding >>>>>> release 1: Deprecated & Handled - i.e. warn and still support >>>>>> (and set the information for the new alias) >>>>>> release 2: Dead - unrecognized >>>>>> >>>>>> 5) Could we possibly take the two flags that followed a different >>>>>> model already, i.e. moving to >>>>>> Deprecated & Handled and handle those as mistakes rather than >>>>>> part of >>>>>> a new general model? >>>>> >>>>> So this is my question which is around the code review in question. >>>>> Note, Derek, can you resend the RFR to >>>>> hotspot-dev at openjdk.java.net so >>>>> it gets to all of us (even the compiler team may want to share in the >>>>> mechanism). >>>>> >>>>> Why are UseParNewGC and MaxGCMinorPauseMillis deprecated and handled >>>>> and not deprecated and obsolete? I don't actually see why have the >>>>> distinction here? >>>>> >>>>> Did these flags follow the deprecation procedure below? Why not just >>>>> make them obsolete, why have this other mechanism? I may be asking >>>>> the same question as Karen. >>>>> >>>>> I think the aliased flags could have a deprecate and handle model >>>>> (where handle == alias) in which case you only need one table for the >>>>> aliased flags, and you need to keep them in globals.hpp so they're >>>>> parsed properly. >>>> >>>> The real reason I wrote the code that way is because I was supporting >>>> the current policy (classic "mechanism not policy" checkin). I didn't >>>> (and don't) have the history on how we got there. But after thinking >>>> about it (see top post), I think there will be some cases where we'll >>>> have handle options instead of ignoring them and vice verse. And the >>>> final decision may come down to engineering, or customer, or partner >>>> concerns, or management whimsy, or whatever the current fad is. We're >>>> talking about code changes over multiple years here :-) >>>>>> Or do you think we will see more cases other than aliasing in which >>>>>> we would want to >>>>>> release 1: Deprecate & Handle and then release 2: Dead >>>>>> rather than release 1: Deprecate & Obsolete and then 2: Dead >>>>>> or rather than a 3 step like the External option proposal >>>>>> above? >>>>> >>>>> I think for the aliased flags you want the first option here >>>>> (deprecate&handle), right? But that's only because you need to keep >>>>> the option in globals.hpp so it parses correctly, otherwise the >>>>> second >>>>> option (deprecate&obsolete) would be the preference? >>>>> >>>>> The options in the GC that are being deprecated and handled have had >>>>> warnings about them for a while, so making them obsolete doesn't feel >>>>> too soon. >>>> >>>> Yes, but just went through the approval process. >>>>> >>>>> Also, I agree with Kim's comment below that your comment lines are >>>>> too >>>>> long. My fonts are too big to have windows this wide. >>>>> >>>>> thanks, >>>>> Coleen >>>>>> thanks, >>>>>> Karen >>>>>> >>>>>> p.s. Note that all of the deprecation needs to >>>>>> 1) work with licensee engineering to ensure we give licensee's a >>>>>> head's up and get feedback >>>>>> 2) file a change control request >>>>>> >>>>>> - we try to do these both as bulk requests to reduce the processing >>>>>> overhead. >>>>>> >>>>>> p.p.s. Details >>>>>> >>>>>> 1. Do the warnings print today or are they silent? Just want to >>>>>> make >>>>>> sure we are conscious of how >>>>>> those are handled if any of this moves to the new unified logging >>>>>> mechanism for which the new default >>>>>> for "warning" level is to print. >>>> The deprecation messages go through warning(), which is controlled by >>>> PrintWarnings (defaults to true). This is how the obsolete flag >>>> warnings >>>> are printed. The new deprecation mechanism replaces a mishmash of >>>> calls >>>> to jio_fprintf() and warning(), with a variety of different ways of >>>> saying the same thing. >>>>>> 2. "will likely be removed in a future release"? If we have already >>>>>> set the release it will be removed - is this a bit >>>>>> vague or did I not read closely enough? >>>> That text came from some of the deprecated GC options. If removal has >>>> been scheduled, we could say something more definite, or even the >>>> exact >>>> release. We don't print the exact "death" release for obsolete options >>>> currently though. >>>>>> >>>>>> On Feb 3, 2015, at 6:30 PM, Derek White wrote: >>>>>> >>>>>>> Request for review (again): >>>>>>> >>>>>>> - Updated with Kim's suggestion. >>>>>>> - Stopped double-printing warnings in some cases. >>>>>>> - Initial caps on warning() messages. >>>>>>> >>>>>>> Webrev:http://cr.openjdk.java.net/~drwhite/8066821/webrev.04/ >>>>>>> CR:https://bugs.openjdk.java.net/browse/JDK-8066821 >>>>>>> Tests: jtreg, jprt >>>>>>> >>>>>>> Thanks for looking! >>>>>>> >>>>>>> - Derek >>>>>>> >>>>>>> On 1/28/15 3:47 PM, Kim Barrett wrote: >>>>>>> >>>> ... >> > > From vladimir.kempik at oracle.com Mon Jul 20 14:20:45 2015 From: vladimir.kempik at oracle.com (Vladimir Kempik) Date: Mon, 20 Jul 2015 17:20:45 +0300 Subject: RFR: 8048353: jstack -l crashes VM when a Java mirror for a primitive type is locked In-Reply-To: <55A66EC0.2020202@oracle.com> References: <55A53006.1030307@oracle.com> <55A53122.8000409@oracle.com> <55A53702.6000309@oracle.com> <55A66EC0.2020202@oracle.com> Message-ID: <55AD03BD.9050306@oracle.com> hello Can I have one more review for this please? jstack/tmtools tested passed fine. Thanks, Vladimir. On 15.07.2015 17:31, Vladimir Kempik wrote: > Hello > > Thanks for looking into this. > > Where can I find jstack/tmtools tests to run them ? > > Thanks, Vladimir. > > On 14.07.2015 19:21, Daniel D. Daugherty wrote: >> > Webrev: http://cr.openjdk.java.net/~vkempik/8048353/webrev.00/ >> >> src/share/vm/classfile/javaClasses.cpp >> No comments. (Thanks for including the "" case.) >> >> src/share/vm/classfile/javaClasses.hpp >> No comments. >> >> src/share/vm/runtime/vframe.cpp >> No comments. >> >> Thumbs up (modulo running the proper tests). >> >> Dan >> >> >> On 7/14/15 9:56 AM, Daniel D. Daugherty wrote: >>> Adding serviceability-dev at ... since jstack belongs to the >>> Serviceability team... >>> >>> The jstack and/or tmtools tests should also be run... >>> >>> Dan >>> >>> >>> On 7/14/15 9:51 AM, Vladimir Kempik wrote: >>>> Hello, >>>> >>>> Please review the patch to fix 8048353. >>>> Customer has an issue with this bug when running jstack on jdk7. >>>> He tested FVB and cofirmed it has fixed the issue. >>>> Before pushing jdk7 backport I need to get the fix to 9 and 8. >>>> >>>> Webrev: http://cr.openjdk.java.net/~vkempik/8048353/webrev.00/ >>>> JBS bug: https://bugs.openjdk.java.net/browse/JDK-8048353 >>>> >>>> testing: JPRT. >>>> >>>> Thanks, Vladimir. >>> >> > From daniel.daugherty at oracle.com Mon Jul 20 14:39:46 2015 From: daniel.daugherty at oracle.com (Daniel D. Daugherty) Date: Mon, 20 Jul 2015 08:39:46 -0600 Subject: RFR: 8048353: jstack -l crashes VM when a Java mirror for a primitive type is locked In-Reply-To: <55AD03BD.9050306@oracle.com> References: <55A53006.1030307@oracle.com> <55A53122.8000409@oracle.com> <55A53702.6000309@oracle.com> <55A66EC0.2020202@oracle.com> <55AD03BD.9050306@oracle.com> Message-ID: <55AD0832.90309@oracle.com> Vladimir, I see reviews from me, Coleen, and David H. That's three (R)eviewers. Are you waiting for a review from someone in Serviceability? Dan On 7/20/15 8:20 AM, Vladimir Kempik wrote: > hello > > Can I have one more review for this please? > > jstack/tmtools tested passed fine. > > Thanks, Vladimir. > > On 15.07.2015 17:31, Vladimir Kempik wrote: >> Hello >> >> Thanks for looking into this. >> >> Where can I find jstack/tmtools tests to run them ? >> >> Thanks, Vladimir. >> >> On 14.07.2015 19:21, Daniel D. Daugherty wrote: >>> > Webrev: http://cr.openjdk.java.net/~vkempik/8048353/webrev.00/ >>> >>> src/share/vm/classfile/javaClasses.cpp >>> No comments. (Thanks for including the "" case.) >>> >>> src/share/vm/classfile/javaClasses.hpp >>> No comments. >>> >>> src/share/vm/runtime/vframe.cpp >>> No comments. >>> >>> Thumbs up (modulo running the proper tests). >>> >>> Dan >>> >>> >>> On 7/14/15 9:56 AM, Daniel D. Daugherty wrote: >>>> Adding serviceability-dev at ... since jstack belongs to the >>>> Serviceability team... >>>> >>>> The jstack and/or tmtools tests should also be run... >>>> >>>> Dan >>>> >>>> >>>> On 7/14/15 9:51 AM, Vladimir Kempik wrote: >>>>> Hello, >>>>> >>>>> Please review the patch to fix 8048353. >>>>> Customer has an issue with this bug when running jstack on jdk7. >>>>> He tested FVB and cofirmed it has fixed the issue. >>>>> Before pushing jdk7 backport I need to get the fix to 9 and 8. >>>>> >>>>> Webrev: http://cr.openjdk.java.net/~vkempik/8048353/webrev.00/ >>>>> JBS bug: https://bugs.openjdk.java.net/browse/JDK-8048353 >>>>> >>>>> testing: JPRT. >>>>> >>>>> Thanks, Vladimir. >>>> >>> >> > > > From daniel.daugherty at oracle.com Mon Jul 20 14:49:12 2015 From: daniel.daugherty at oracle.com (Daniel D. Daugherty) Date: Mon, 20 Jul 2015 08:49:12 -0600 Subject: Open code review for 8061999 Enhance VM option parsing to allow options to be specified In-Reply-To: <55A94E55.2050603@oracle.com> References: <6b67beb6-3936-4c3c-bd33-cd314be5e8e5@default> <55A80A78.4080605@oracle.com> <539fb166-506a-47bd-b710-d218e6ebaed1@default> <55A94DD8.8000400@oracle.com> <55A94E55.2050603@oracle.com> Message-ID: <55AD0A68.7020100@oracle.com> Coleen, Ron's out of the office today (Monday) so I'll chime in. We asked Ron to finish addressing the round 0 code review comments before rebasing his project to the current RT_Baseline in order to preserve the proper context for those replies and adjustments. Ron's project was last rebased just before Gerard's awesome cmd line option validation work. We also knew that Jeremy's env var changes were coming and that we likely had conflicts there. Lots of dust is flying in the cmd line options arena lately! Dan On 7/17/15 12:49 PM, Coleen Phillimore wrote: > > Sorry, it's a RAII class. I got the acronym confused with Robert > Strout :) > > Coleen > > On 7/17/15 2:47 PM, Coleen Phillimore wrote: >> >> Ron, >> >> The code that we've just reviewed and I'm sponsoring from Jeremy >> Manson directly conflicts with this code. Jeremy has added a RESII >> class for JavaVMInitArgs that you should use. I have other initial >> comments but I haven't gotten to reading all of this thread yet. >> Please wait for my code review. >> >> Thanks, >> Coleen >> >> On 7/16/15 4:00 PM, Ron Durbin wrote: >>> I will file it and thanks for the "r" review. >>> >>>> -----Original Message----- >>>> From: gerard ziemski >>>> Sent: Thursday, July 16, 2015 1:48 PM >>>> To: Ron Durbin; hotspot-runtime-dev at openjdk.java.net >>>> Subject: Re: Open code review for 8061999 Enhance VM option parsing >>>> to allow options to be specified >>>> >>>> hi Ron, >>>> >>>> I have no more comments, just one question: you say "A future >>>> enhancement will be to refactor the options file processing to grow >>>> memory like the environment variables do now." - is that enhancement >>>> filed yet? >>>> >>>> Please consider this reviewed with small "r". >>>> >>>> >>>> cheers >>>> >>>> >>>> On 07/14/2015 05:21 PM, Ron Durbin wrote: >>>>> Gerard, >>>>> >>>>> Thanks for your time in reviewing the code and providing comments. >>>>> My responses to your comments inline below: >>>>> >>>>> >>>>>> -----Original Message----- >>>>>> From: Gerard Ziemski >>>>>> Sent: Tuesday, June 23, 2015 1:53 PM >>>>>> To: hotspot-runtime-dev at openjdk.java.net >>>>>> Cc: Ron Durbin >>>>>> Subject: Re: Open code review for 8061999 Enhance VM option >>>>>> parsing to allow options to be specified >>>>>> >>>>>> hi Ron, >>>>>> >>>>>> I'm sending you partial feedback, since I am starting to get a >>>>>> bit tired. I will spend more time reviewing >>>> your >>>>>> webrev tomorrow, but here is what I have so far: >>>>>> >>>>>> --- >>>>>> src/share/vm/utilities/globalDefinitions.hp >>>>>> >>>>>> 1. Should we name the method "is_white()", not "iswhite()" since >>>>>> it's part of our code base? But then since >>>> it's >>>>>> a macro, shouldn't it actually be "IS_WHITE()" ? >>>>>> --- >>>>>> src/share/vm/runtime/arguments.hpp >>>>>> [ >>>>> [Ron] While researching my answer to this comment, I realized >>>>> that I should have used the already existing isspace() >>>>> function >>>>> instead of creating the iswhite() macro. Will fix. >>>>> >>>>>> 1. >>>>>> >>>>>> All the arguments in alloc_JVM_options_list(), >>>>>> copy_JVM_options_from_buf() and parse_JVM_options_file() use >>>>>> underscores in the arguments names except for >>>>>> merge_JVM_options_file(). I think the merge_JVM_options_file() >>>>>> should be: >>>>>> >>>>>> + static jint merge_JVM_options_file(const struct JavaVMInitArgs >>>>>> *args_in, >>>>>> + struct JavaVMInitArgs >>>>>> **args_out); >>>>>> >>>>> [Ron] This one is a reasonable clean up >>>>> >>>>>> --- >>>>>> src/share/vm/runtime/arguments.cpp >>>>>> >>>>>> 1. Why do FreeVMOptions, DumpVMOptions, DumpVMOption and >>>>>> DumpOption start with capital letters? Shouldn't >>>> their >>>>>> names start with a lower case letter? >>>>>> >>>>> [Ron] This one is a reasonable clean up >>>>> >>>>>> 2. Line 4306. The pattern in Arguments::parse() seems to be to >>>>>> print out error message and return the error >>>>>> value if something goes wrong, but we do vm_exit(1) instead? >>>>>> >>>>> [Ron ] The cases that will trigger this exit on fail are extreme: >>>>> - missing or otherwise in accessible options files >>>>> - Un-parsable options file, too big, too many options, >>>>> nonwhite space terminated options >>>>> - Unable to allocate memory for options files processing >>>>> >>>>>> 3. Line 4309. I was told that when it comes to NULL pointer check >>>>>> we should do (NULL == args), not the other >>>> way >>>>>> around. >>>>>> >>>>> [Ron] This one is a reasonable clean up >>>>> >>>>>> 4. Line 4375. Don't we need FreeVMOptions() here? Line 4382 as well? >>>>> >>>>> [Ron] Gerard this one is a reasonable clean up >>>>> >>>>>> 5. Question. Why do we need N_MAX_OPTIONS? >>>>> [Ron] Until recently N_MAX_OPTIONS applied to environment >>>>> variables too >>>>> N_MAX_OTIIONS is used to limit the number of options and >>>>> thus the memory allocated. >>>>> A future enhancement will be to refactor the options file >>>>> processing to grow memory like the >>>>> environment variables do now. >>>>> >>>>>> 6. Question. Why do we need OPTION_BUFFER_SIZE? Can't we use "int >>>>>> bytes_needed = fseek(stream, 0, SEEK_END); >>>>>> rewind(stream)" and have the code dynamically allocate memory >>>>>> without hard coded limits? >>>>>> >>>>> [Ron>] Until recently OPTION_BUFFER_SIZE applied to environment >>>>> variables too. \ >>>>> OPTION_BUFFER_SIZE is used to limit the memory allocated >>>>> for reading the options. >>>>> A future enhancement will be to refactor the options file >>>>> processing to grow memory like the >>>>> environment variables do now. >>>>> >>>>> >>>>>> 7. Line 3965. Can that comparison ever succeed? "read()" will not >>>>>> read more bytes (only less) than as >>>> specified >>>>>> by "bytes_alloc" and if it did, we would overwrite memory since >>>>>> our buf is only "bytes_alloc" big. >>>>>> >>>>> [Ron>] Yes that comparison can succeed. We only support an >>>>> options file that is <= OPTION_BUFFER_SIZE bytes in >>>>> size. >>>>> >>>>> We allocate a read buffer that is OPTION_BUFFER_SIZE + 1 >>>>> bytes in size for two reasons: >>>>> >>>>> 1) to have space for a NULL terminator when the >>>>> options file is the maximum number of bytes >>>>> in length >>>>> 2) easy detection of an options file that is too large; >>>>> we try to read OPTION_BUFFER_SIZE + 1 bytes. If we >>>>> succeed, then the file is too big. >>>>> >>>>> >>>>>> cheers >>>>>> >>>>>> >>>>>> On 6/22/2015 7:52 AM, Ron Durbin wrote: >>>>>> Webrev URL: >>>>>> http://cr.openjdk.java.net/~rdurbin/8061999_OCR0_JDK9_webrev >>>>>> >>>>>> >>>>>> RFE request: >>>>>> https://bugs.openjdk.java.net/browse/JDK-8061999 >>>>>> >>>>>> This RFE allows a file to be specified that holds VM Options that >>>>>> would otherwise be specified on the command line or in an >>>>>> environment variable. >>>>>> Only one options file may be specified on the command line and no >>>>>> options file >>>>>> may be specified in either of the following environment variables >>>>>> "JAVA_TOOL_OPTIONS" or "_JAVA_OPTIONS". >>>>>> >>>>>> The options file feature supports all VM options currently >>>>>> supported on >>>>>> the command line, except the options file option. The option to >>>>>> specify an >>>>>> options file is "-XX:VMOptionsFile=". >>>>>> The options file feature supports an options file up to 1024 >>>>>> bytes in size >>>>>> and up to 64 options. >>>>>> >>>>>> This feature has been tested on: >>>>>> OS: >>>>>> Solaris, MAC, Windows, Linux >>>>>> Tests: >>>>>> Manual unit tests >>>>>> JPRT with -testset hotspot (including the SQE proposed test >>>>>> coverage for this feature.) >>>>>> >>>>>> >>>>>> >> > > > > From daniel.daugherty at oracle.com Mon Jul 20 14:49:15 2015 From: daniel.daugherty at oracle.com (Daniel D. Daugherty) Date: Mon, 20 Jul 2015 08:49:15 -0600 Subject: Open code review for 8061999 Enhance VM option parsing to allow options to be specified In-Reply-To: <55AC556A.1060100@oracle.com> References: <65a589f0-99cd-43e5-8dfd-71143bc6cc08@default> <55AC556A.1060100@oracle.com> Message-ID: <55AD0A6B.9040407@oracle.com> David, Ron's out of the office today (Monday) so I'll chime in. We asked Ron to finish addressing the round 0 code review comments before rebasing his project to the current RT_Baseline in order to preserve the proper context for those replies and adjustments. Ron's project was last rebased just before Gerard's awesome cmd line option validation work. We also knew that Jeremy's env var changes were coming and that we likely had conflicts there. Lots of dust is flying in the cmd line options arena lately! Dan On 7/19/15 7:56 PM, David Holmes wrote: > As per Coleen's earlier email this needs re-sync'ing with: > > http://hg.openjdk.java.net/jdk9/hs-rt/hotspot/rev/a02747e8bc4c > > David > > On 18/07/2015 9:02 AM, Ron Durbin wrote: >> Here is the round 1 webrev for 8061999. It incorporates changes made >> due to comments from the round 0 reviewers. The easiest way to review >> this round is to download the two patch files: >> >> http://cr.openjdk.java.net/~rdurbin/8061999_OCR0_JDK9_webrev/hotspot.patch >> >> http://cr.openjdk.java.net/~rdurbin/8061999_OCR1_JDK9_webrev/hotspot.patch >> >> >> and look at them in your favorite file merge tool. >> >> RFE request: >> https://bugs.openjdk.java.net/browse/JDK-8061999 >> >> This RFE allows a file to be specified that holds VM Options that >> would otherwise be specified on the command line or in an environment >> variable. >> Only one options file may be specified on the command line and no >> options file >> may be specified in either of the following environment variables >> "JAVA_TOOL_OPTIONS" or "_JAVA_OPTIONS". >> >> The options file feature supports all VM options currently supported on >> the command line, except the options file option. The option to >> specify an >> options file is "-XX:VMOptionsFile=". >> The options file feature supports an options file up to 1024 bytes in >> size >> and up to 64 options. >> >> This feature has been tested on: >> OS: >> Solaris, MAC, Windows, Linux >> Tests: >> Manual unit tests >> JPRT with -testset hotspot (including the SQE proposed test >> coverage for this feature.) >> > > From coleen.phillimore at oracle.com Mon Jul 20 15:21:35 2015 From: coleen.phillimore at oracle.com (Coleen Phillimore) Date: Mon, 20 Jul 2015 11:21:35 -0400 Subject: Open code review for 8061999 Enhance VM option parsing to allow options to be specified In-Reply-To: <55AD0A68.7020100@oracle.com> References: <6b67beb6-3936-4c3c-bd33-cd314be5e8e5@default> <55A80A78.4080605@oracle.com> <539fb166-506a-47bd-b710-d218e6ebaed1@default> <55A94DD8.8000400@oracle.com> <55A94E55.2050603@oracle.com> <55AD0A68.7020100@oracle.com> Message-ID: <55AD11FF.1070609@oracle.com> Hi Dan, I have comments about the round 1 of this change. In light of Jeremy Manson's refactoring, I don't think much of the code that was added for this RFE needs to be added. There are functions it can call instead and ScopeVMInitArgs destructor can replace the free calls that were added. This code also had duplicates parsing that is done for environment variable. Further I think the logging added in this change is sandbox debugging and not worthy of adding a Logging flag, and should be removed. I can send more specific comments but the summary is that I would like to see this change integrated better with existing code, rather than checked in. Thanks, Coleen On 7/20/15 10:49 AM, Daniel D. Daugherty wrote: > Coleen, > > Ron's out of the office today (Monday) so I'll chime in. > > We asked Ron to finish addressing the round 0 code review comments > before rebasing his project to the current RT_Baseline in order to > preserve the proper context for those replies and adjustments. > > Ron's project was last rebased just before Gerard's awesome cmd > line option validation work. We also knew that Jeremy's env var > changes were coming and that we likely had conflicts there. Lots > of dust is flying in the cmd line options arena lately! > > Dan > > > On 7/17/15 12:49 PM, Coleen Phillimore wrote: >> >> Sorry, it's a RAII class. I got the acronym confused with Robert >> Strout :) >> >> Coleen >> >> On 7/17/15 2:47 PM, Coleen Phillimore wrote: >>> >>> Ron, >>> >>> The code that we've just reviewed and I'm sponsoring from Jeremy >>> Manson directly conflicts with this code. Jeremy has added a RESII >>> class for JavaVMInitArgs that you should use. I have other initial >>> comments but I haven't gotten to reading all of this thread yet. >>> Please wait for my code review. >>> >>> Thanks, >>> Coleen >>> >>> On 7/16/15 4:00 PM, Ron Durbin wrote: >>>> I will file it and thanks for the "r" review. >>>> >>>>> -----Original Message----- >>>>> From: gerard ziemski >>>>> Sent: Thursday, July 16, 2015 1:48 PM >>>>> To: Ron Durbin; hotspot-runtime-dev at openjdk.java.net >>>>> Subject: Re: Open code review for 8061999 Enhance VM option >>>>> parsing to allow options to be specified >>>>> >>>>> hi Ron, >>>>> >>>>> I have no more comments, just one question: you say "A future >>>>> enhancement will be to refactor the options file processing to grow >>>>> memory like the environment variables do now." - is that enhancement >>>>> filed yet? >>>>> >>>>> Please consider this reviewed with small "r". >>>>> >>>>> >>>>> cheers >>>>> >>>>> >>>>> On 07/14/2015 05:21 PM, Ron Durbin wrote: >>>>>> Gerard, >>>>>> >>>>>> Thanks for your time in reviewing the code and providing comments. >>>>>> My responses to your comments inline below: >>>>>> >>>>>> >>>>>>> -----Original Message----- >>>>>>> From: Gerard Ziemski >>>>>>> Sent: Tuesday, June 23, 2015 1:53 PM >>>>>>> To: hotspot-runtime-dev at openjdk.java.net >>>>>>> Cc: Ron Durbin >>>>>>> Subject: Re: Open code review for 8061999 Enhance VM option >>>>>>> parsing to allow options to be specified >>>>>>> >>>>>>> hi Ron, >>>>>>> >>>>>>> I'm sending you partial feedback, since I am starting to get a >>>>>>> bit tired. I will spend more time reviewing >>>>> your >>>>>>> webrev tomorrow, but here is what I have so far: >>>>>>> >>>>>>> --- >>>>>>> src/share/vm/utilities/globalDefinitions.hp >>>>>>> >>>>>>> 1. Should we name the method "is_white()", not "iswhite()" since >>>>>>> it's part of our code base? But then since >>>>> it's >>>>>>> a macro, shouldn't it actually be "IS_WHITE()" ? >>>>>>> --- >>>>>>> src/share/vm/runtime/arguments.hpp >>>>>>> [ >>>>>> [Ron] While researching my answer to this comment, I realized >>>>>> that I should have used the already existing isspace() >>>>>> function >>>>>> instead of creating the iswhite() macro. Will fix. >>>>>> >>>>>>> 1. >>>>>>> >>>>>>> All the arguments in alloc_JVM_options_list(), >>>>>>> copy_JVM_options_from_buf() and parse_JVM_options_file() use >>>>>>> underscores in the arguments names except for >>>>>>> merge_JVM_options_file(). I think the merge_JVM_options_file() >>>>>>> should be: >>>>>>> >>>>>>> + static jint merge_JVM_options_file(const struct >>>>>>> JavaVMInitArgs *args_in, >>>>>>> + struct JavaVMInitArgs >>>>>>> **args_out); >>>>>>> >>>>>> [Ron] This one is a reasonable clean up >>>>>> >>>>>>> --- >>>>>>> src/share/vm/runtime/arguments.cpp >>>>>>> >>>>>>> 1. Why do FreeVMOptions, DumpVMOptions, DumpVMOption and >>>>>>> DumpOption start with capital letters? Shouldn't >>>>> their >>>>>>> names start with a lower case letter? >>>>>>> >>>>>> [Ron] This one is a reasonable clean up >>>>>> >>>>>>> 2. Line 4306. The pattern in Arguments::parse() seems to be to >>>>>>> print out error message and return the error >>>>>>> value if something goes wrong, but we do vm_exit(1) instead? >>>>>>> >>>>>> [Ron ] The cases that will trigger this exit on fail are extreme: >>>>>> - missing or otherwise in accessible options files >>>>>> - Un-parsable options file, too big, too many options, >>>>>> nonwhite space terminated options >>>>>> - Unable to allocate memory for options files processing >>>>>> >>>>>>> 3. Line 4309. I was told that when it comes to NULL pointer >>>>>>> check we should do (NULL == args), not the other >>>>> way >>>>>>> around. >>>>>>> >>>>>> [Ron] This one is a reasonable clean up >>>>>> >>>>>>> 4. Line 4375. Don't we need FreeVMOptions() here? Line 4382 as >>>>>>> well? >>>>>> >>>>>> [Ron] Gerard this one is a reasonable clean up >>>>>> >>>>>>> 5. Question. Why do we need N_MAX_OPTIONS? >>>>>> [Ron] Until recently N_MAX_OPTIONS applied to environment >>>>>> variables too >>>>>> N_MAX_OTIIONS is used to limit the number of options >>>>>> and thus the memory allocated. >>>>>> A future enhancement will be to refactor the options >>>>>> file processing to grow memory like the >>>>>> environment variables do now. >>>>>> >>>>>>> 6. Question. Why do we need OPTION_BUFFER_SIZE? Can't we use >>>>>>> "int bytes_needed = fseek(stream, 0, SEEK_END); >>>>>>> rewind(stream)" and have the code dynamically allocate memory >>>>>>> without hard coded limits? >>>>>>> >>>>>> [Ron>] Until recently OPTION_BUFFER_SIZE applied to environment >>>>>> variables too. \ >>>>>> OPTION_BUFFER_SIZE is used to limit the memory allocated >>>>>> for reading the options. >>>>>> A future enhancement will be to refactor the options >>>>>> file processing to grow memory like the >>>>>> environment variables do now. >>>>>> >>>>>> >>>>>>> 7. Line 3965. Can that comparison ever succeed? "read()" will >>>>>>> not read more bytes (only less) than as >>>>> specified >>>>>>> by "bytes_alloc" and if it did, we would overwrite memory since >>>>>>> our buf is only "bytes_alloc" big. >>>>>>> >>>>>> [Ron>] Yes that comparison can succeed. We only support an >>>>>> options file that is <= OPTION_BUFFER_SIZE bytes in >>>>>> size. >>>>>> >>>>>> We allocate a read buffer that is OPTION_BUFFER_SIZE + 1 >>>>>> bytes in size for two reasons: >>>>>> >>>>>> 1) to have space for a NULL terminator when the >>>>>> options file is the maximum number of bytes >>>>>> in length >>>>>> 2) easy detection of an options file that is too large; >>>>>> we try to read OPTION_BUFFER_SIZE + 1 bytes. If we >>>>>> succeed, then the file is too big. >>>>>> >>>>>> >>>>>>> cheers >>>>>>> >>>>>>> >>>>>>> On 6/22/2015 7:52 AM, Ron Durbin wrote: >>>>>>> Webrev URL: >>>>>>> http://cr.openjdk.java.net/~rdurbin/8061999_OCR0_JDK9_webrev >>>>>>> >>>>>>> >>>>>>> RFE request: >>>>>>> https://bugs.openjdk.java.net/browse/JDK-8061999 >>>>>>> >>>>>>> This RFE allows a file to be specified that holds VM Options that >>>>>>> would otherwise be specified on the command line or in an >>>>>>> environment variable. >>>>>>> Only one options file may be specified on the command line and >>>>>>> no options file >>>>>>> may be specified in either of the following environment variables >>>>>>> "JAVA_TOOL_OPTIONS" or "_JAVA_OPTIONS". >>>>>>> >>>>>>> The options file feature supports all VM options currently >>>>>>> supported on >>>>>>> the command line, except the options file option. The option to >>>>>>> specify an >>>>>>> options file is "-XX:VMOptionsFile=". >>>>>>> The options file feature supports an options file up to 1024 >>>>>>> bytes in size >>>>>>> and up to 64 options. >>>>>>> >>>>>>> This feature has been tested on: >>>>>>> OS: >>>>>>> Solaris, MAC, Windows, Linux >>>>>>> Tests: >>>>>>> Manual unit tests >>>>>>> JPRT with -testset hotspot (including the SQE proposed test >>>>>>> coverage for this feature.) >>>>>>> >>>>>>> >>>>>>> >>> >> >> >> >> > From daniel.daugherty at oracle.com Mon Jul 20 15:42:31 2015 From: daniel.daugherty at oracle.com (Daniel D. Daugherty) Date: Mon, 20 Jul 2015 09:42:31 -0600 Subject: Open code review for 8061999 Enhance VM option parsing to allow options to be specified In-Reply-To: <55AD11FF.1070609@oracle.com> References: <6b67beb6-3936-4c3c-bd33-cd314be5e8e5@default> <55A80A78.4080605@oracle.com> <539fb166-506a-47bd-b710-d218e6ebaed1@default> <55A94DD8.8000400@oracle.com> <55A94E55.2050603@oracle.com> <55AD0A68.7020100@oracle.com> <55AD11FF.1070609@oracle.com> Message-ID: <55AD16E7.6070601@oracle.com> Coleen, Thanks for taking the time to look at how Ron's work conflicts with Jeremy's work. We knew there would be some collision and having another pair of eyes check this out is a Good Thing (TM). Rather than clog the alias with a lot of back-and-forth about how to merge Ron's work with Jeremy's work, let's take it off alias until we get closure on another webrev. Ron is out of the office today. I believe Dmitry is on vacation all week so we won't have his lightning fast test updates until he gets back. I still need to spin up on Jeremy's changes. Does this sound like an OK plan? Dan On 7/20/15 9:21 AM, Coleen Phillimore wrote: > > Hi Dan, > > I have comments about the round 1 of this change. In light of Jeremy > Manson's refactoring, I don't think much of the code that was added > for this RFE needs to be added. There are functions it can call > instead and ScopeVMInitArgs destructor can replace the free calls that > were added. This code also had duplicates parsing that is done for > environment variable. Further I think the logging added in this > change is sandbox debugging and not worthy of adding a Logging flag, > and should be removed. I can send more specific comments but the > summary is that I would like to see this change integrated better with > existing code, rather than checked in. > > Thanks, > Coleen > > > On 7/20/15 10:49 AM, Daniel D. Daugherty wrote: >> Coleen, >> >> Ron's out of the office today (Monday) so I'll chime in. >> >> We asked Ron to finish addressing the round 0 code review comments >> before rebasing his project to the current RT_Baseline in order to >> preserve the proper context for those replies and adjustments. >> >> Ron's project was last rebased just before Gerard's awesome cmd >> line option validation work. We also knew that Jeremy's env var >> changes were coming and that we likely had conflicts there. Lots >> of dust is flying in the cmd line options arena lately! >> >> Dan >> >> >> On 7/17/15 12:49 PM, Coleen Phillimore wrote: >>> >>> Sorry, it's a RAII class. I got the acronym confused with Robert >>> Strout :) >>> >>> Coleen >>> >>> On 7/17/15 2:47 PM, Coleen Phillimore wrote: >>>> >>>> Ron, >>>> >>>> The code that we've just reviewed and I'm sponsoring from Jeremy >>>> Manson directly conflicts with this code. Jeremy has added a >>>> RESII class for JavaVMInitArgs that you should use. I have other >>>> initial comments but I haven't gotten to reading all of this thread >>>> yet. Please wait for my code review. >>>> >>>> Thanks, >>>> Coleen >>>> >>>> On 7/16/15 4:00 PM, Ron Durbin wrote: >>>>> I will file it and thanks for the "r" review. >>>>> >>>>>> -----Original Message----- >>>>>> From: gerard ziemski >>>>>> Sent: Thursday, July 16, 2015 1:48 PM >>>>>> To: Ron Durbin; hotspot-runtime-dev at openjdk.java.net >>>>>> Subject: Re: Open code review for 8061999 Enhance VM option >>>>>> parsing to allow options to be specified >>>>>> >>>>>> hi Ron, >>>>>> >>>>>> I have no more comments, just one question: you say "A future >>>>>> enhancement will be to refactor the options file processing to grow >>>>>> memory like the environment variables do now." - is that enhancement >>>>>> filed yet? >>>>>> >>>>>> Please consider this reviewed with small "r". >>>>>> >>>>>> >>>>>> cheers >>>>>> >>>>>> >>>>>> On 07/14/2015 05:21 PM, Ron Durbin wrote: >>>>>>> Gerard, >>>>>>> >>>>>>> Thanks for your time in reviewing the code and providing comments. >>>>>>> My responses to your comments inline below: >>>>>>> >>>>>>> >>>>>>>> -----Original Message----- >>>>>>>> From: Gerard Ziemski >>>>>>>> Sent: Tuesday, June 23, 2015 1:53 PM >>>>>>>> To: hotspot-runtime-dev at openjdk.java.net >>>>>>>> Cc: Ron Durbin >>>>>>>> Subject: Re: Open code review for 8061999 Enhance VM option >>>>>>>> parsing to allow options to be specified >>>>>>>> >>>>>>>> hi Ron, >>>>>>>> >>>>>>>> I'm sending you partial feedback, since I am starting to get a >>>>>>>> bit tired. I will spend more time reviewing >>>>>> your >>>>>>>> webrev tomorrow, but here is what I have so far: >>>>>>>> >>>>>>>> --- >>>>>>>> src/share/vm/utilities/globalDefinitions.hp >>>>>>>> >>>>>>>> 1. Should we name the method "is_white()", not "iswhite()" >>>>>>>> since it's part of our code base? But then since >>>>>> it's >>>>>>>> a macro, shouldn't it actually be "IS_WHITE()" ? >>>>>>>> --- >>>>>>>> src/share/vm/runtime/arguments.hpp >>>>>>>> [ >>>>>>> [Ron] While researching my answer to this comment, I realized >>>>>>> that I should have used the already existing isspace() >>>>>>> function >>>>>>> instead of creating the iswhite() macro. Will fix. >>>>>>> >>>>>>>> 1. >>>>>>>> >>>>>>>> All the arguments in alloc_JVM_options_list(), >>>>>>>> copy_JVM_options_from_buf() and parse_JVM_options_file() use >>>>>>>> underscores in the arguments names except for >>>>>>>> merge_JVM_options_file(). I think the merge_JVM_options_file() >>>>>>>> should be: >>>>>>>> >>>>>>>> + static jint merge_JVM_options_file(const struct >>>>>>>> JavaVMInitArgs *args_in, >>>>>>>> + struct JavaVMInitArgs >>>>>>>> **args_out); >>>>>>>> >>>>>>> [Ron] This one is a reasonable clean up >>>>>>> >>>>>>>> --- >>>>>>>> src/share/vm/runtime/arguments.cpp >>>>>>>> >>>>>>>> 1. Why do FreeVMOptions, DumpVMOptions, DumpVMOption and >>>>>>>> DumpOption start with capital letters? Shouldn't >>>>>> their >>>>>>>> names start with a lower case letter? >>>>>>>> >>>>>>> [Ron] This one is a reasonable clean up >>>>>>> >>>>>>>> 2. Line 4306. The pattern in Arguments::parse() seems to be to >>>>>>>> print out error message and return the error >>>>>>>> value if something goes wrong, but we do vm_exit(1) instead? >>>>>>>> >>>>>>> [Ron ] The cases that will trigger this exit on fail are extreme: >>>>>>> - missing or otherwise in accessible options files >>>>>>> - Un-parsable options file, too big, too many options, >>>>>>> nonwhite space terminated options >>>>>>> - Unable to allocate memory for options files processing >>>>>>> >>>>>>>> 3. Line 4309. I was told that when it comes to NULL pointer >>>>>>>> check we should do (NULL == args), not the other >>>>>> way >>>>>>>> around. >>>>>>>> >>>>>>> [Ron] This one is a reasonable clean up >>>>>>> >>>>>>>> 4. Line 4375. Don't we need FreeVMOptions() here? Line 4382 as >>>>>>>> well? >>>>>>> >>>>>>> [Ron] Gerard this one is a reasonable clean up >>>>>>> >>>>>>>> 5. Question. Why do we need N_MAX_OPTIONS? >>>>>>> [Ron] Until recently N_MAX_OPTIONS applied to environment >>>>>>> variables too >>>>>>> N_MAX_OTIIONS is used to limit the number of options >>>>>>> and thus the memory allocated. >>>>>>> A future enhancement will be to refactor the options >>>>>>> file processing to grow memory like the >>>>>>> environment variables do now. >>>>>>> >>>>>>>> 6. Question. Why do we need OPTION_BUFFER_SIZE? Can't we use >>>>>>>> "int bytes_needed = fseek(stream, 0, SEEK_END); >>>>>>>> rewind(stream)" and have the code dynamically allocate memory >>>>>>>> without hard coded limits? >>>>>>>> >>>>>>> [Ron>] Until recently OPTION_BUFFER_SIZE applied to environment >>>>>>> variables too. \ >>>>>>> OPTION_BUFFER_SIZE is used to limit the memory >>>>>>> allocated for reading the options. >>>>>>> A future enhancement will be to refactor the options >>>>>>> file processing to grow memory like the >>>>>>> environment variables do now. >>>>>>> >>>>>>> >>>>>>>> 7. Line 3965. Can that comparison ever succeed? "read()" will >>>>>>>> not read more bytes (only less) than as >>>>>> specified >>>>>>>> by "bytes_alloc" and if it did, we would overwrite memory since >>>>>>>> our buf is only "bytes_alloc" big. >>>>>>>> >>>>>>> [Ron>] Yes that comparison can succeed. We only support an >>>>>>> options file that is <= OPTION_BUFFER_SIZE bytes in >>>>>>> size. >>>>>>> >>>>>>> We allocate a read buffer that is OPTION_BUFFER_SIZE + 1 >>>>>>> bytes in size for two reasons: >>>>>>> >>>>>>> 1) to have space for a NULL terminator when the >>>>>>> options file is the maximum number of bytes >>>>>>> in length >>>>>>> 2) easy detection of an options file that is too large; >>>>>>> we try to read OPTION_BUFFER_SIZE + 1 bytes. If we >>>>>>> succeed, then the file is too big. >>>>>>> >>>>>>> >>>>>>>> cheers >>>>>>>> >>>>>>>> >>>>>>>> On 6/22/2015 7:52 AM, Ron Durbin wrote: >>>>>>>> Webrev URL: >>>>>>>> http://cr.openjdk.java.net/~rdurbin/8061999_OCR0_JDK9_webrev >>>>>>>> >>>>>>>> >>>>>>>> RFE request: >>>>>>>> https://bugs.openjdk.java.net/browse/JDK-8061999 >>>>>>>> >>>>>>>> This RFE allows a file to be specified that holds VM Options that >>>>>>>> would otherwise be specified on the command line or in an >>>>>>>> environment variable. >>>>>>>> Only one options file may be specified on the command line and >>>>>>>> no options file >>>>>>>> may be specified in either of the following environment variables >>>>>>>> "JAVA_TOOL_OPTIONS" or "_JAVA_OPTIONS". >>>>>>>> >>>>>>>> The options file feature supports all VM options currently >>>>>>>> supported on >>>>>>>> the command line, except the options file option. The option to >>>>>>>> specify an >>>>>>>> options file is "-XX:VMOptionsFile=". >>>>>>>> The options file feature supports an options file up to 1024 >>>>>>>> bytes in size >>>>>>>> and up to 64 options. >>>>>>>> >>>>>>>> This feature has been tested on: >>>>>>>> OS: >>>>>>>> Solaris, MAC, Windows, Linux >>>>>>>> Tests: >>>>>>>> Manual unit tests >>>>>>>> JPRT with -testset hotspot (including the SQE proposed >>>>>>>> test coverage for this feature.) >>>>>>>> >>>>>>>> >>>>>>>> >>>> >>> >>> >>> >>> >> > From coleen.phillimore at oracle.com Mon Jul 20 15:43:13 2015 From: coleen.phillimore at oracle.com (Coleen Phillimore) Date: Mon, 20 Jul 2015 11:43:13 -0400 Subject: Open code review for 8061999 Enhance VM option parsing to allow options to be specified In-Reply-To: <55AD16E7.6070601@oracle.com> References: <6b67beb6-3936-4c3c-bd33-cd314be5e8e5@default> <55A80A78.4080605@oracle.com> <539fb166-506a-47bd-b710-d218e6ebaed1@default> <55A94DD8.8000400@oracle.com> <55A94E55.2050603@oracle.com> <55AD0A68.7020100@oracle.com> <55AD11FF.1070609@oracle.com> <55AD16E7.6070601@oracle.com> Message-ID: <55AD1711.8040306@oracle.com> Yes, this sounds like a good plan. Thanks for your help in addressing my concerns. Coleen On 7/20/15 11:42 AM, Daniel D. Daugherty wrote: > Coleen, > > Thanks for taking the time to look at how Ron's work conflicts > with Jeremy's work. We knew there would be some collision and > having another pair of eyes check this out is a Good Thing (TM). > > Rather than clog the alias with a lot of back-and-forth about > how to merge Ron's work with Jeremy's work, let's take it off > alias until we get closure on another webrev. > > Ron is out of the office today. I believe Dmitry is on vacation > all week so we won't have his lightning fast test updates until > he gets back. I still need to spin up on Jeremy's changes. > > Does this sound like an OK plan? > > Dan > > > On 7/20/15 9:21 AM, Coleen Phillimore wrote: >> >> Hi Dan, >> >> I have comments about the round 1 of this change. In light of >> Jeremy Manson's refactoring, I don't think much of the code that was >> added for this RFE needs to be added. There are functions it can >> call instead and ScopeVMInitArgs destructor can replace the free >> calls that were added. This code also had duplicates parsing that is >> done for environment variable. Further I think the logging added in >> this change is sandbox debugging and not worthy of adding a Logging >> flag, and should be removed. I can send more specific comments but >> the summary is that I would like to see this change integrated better >> with existing code, rather than checked in. >> >> Thanks, >> Coleen >> >> >> On 7/20/15 10:49 AM, Daniel D. Daugherty wrote: >>> Coleen, >>> >>> Ron's out of the office today (Monday) so I'll chime in. >>> >>> We asked Ron to finish addressing the round 0 code review comments >>> before rebasing his project to the current RT_Baseline in order to >>> preserve the proper context for those replies and adjustments. >>> >>> Ron's project was last rebased just before Gerard's awesome cmd >>> line option validation work. We also knew that Jeremy's env var >>> changes were coming and that we likely had conflicts there. Lots >>> of dust is flying in the cmd line options arena lately! >>> >>> Dan >>> >>> >>> On 7/17/15 12:49 PM, Coleen Phillimore wrote: >>>> >>>> Sorry, it's a RAII class. I got the acronym confused with Robert >>>> Strout :) >>>> >>>> Coleen >>>> >>>> On 7/17/15 2:47 PM, Coleen Phillimore wrote: >>>>> >>>>> Ron, >>>>> >>>>> The code that we've just reviewed and I'm sponsoring from Jeremy >>>>> Manson directly conflicts with this code. Jeremy has added a >>>>> RESII class for JavaVMInitArgs that you should use. I have other >>>>> initial comments but I haven't gotten to reading all of this >>>>> thread yet. Please wait for my code review. >>>>> >>>>> Thanks, >>>>> Coleen >>>>> >>>>> On 7/16/15 4:00 PM, Ron Durbin wrote: >>>>>> I will file it and thanks for the "r" review. >>>>>> >>>>>>> -----Original Message----- >>>>>>> From: gerard ziemski >>>>>>> Sent: Thursday, July 16, 2015 1:48 PM >>>>>>> To: Ron Durbin; hotspot-runtime-dev at openjdk.java.net >>>>>>> Subject: Re: Open code review for 8061999 Enhance VM option >>>>>>> parsing to allow options to be specified >>>>>>> >>>>>>> hi Ron, >>>>>>> >>>>>>> I have no more comments, just one question: you say "A future >>>>>>> enhancement will be to refactor the options file processing to grow >>>>>>> memory like the environment variables do now." - is that >>>>>>> enhancement >>>>>>> filed yet? >>>>>>> >>>>>>> Please consider this reviewed with small "r". >>>>>>> >>>>>>> >>>>>>> cheers >>>>>>> >>>>>>> >>>>>>> On 07/14/2015 05:21 PM, Ron Durbin wrote: >>>>>>>> Gerard, >>>>>>>> >>>>>>>> Thanks for your time in reviewing the code and providing comments. >>>>>>>> My responses to your comments inline below: >>>>>>>> >>>>>>>> >>>>>>>>> -----Original Message----- >>>>>>>>> From: Gerard Ziemski >>>>>>>>> Sent: Tuesday, June 23, 2015 1:53 PM >>>>>>>>> To: hotspot-runtime-dev at openjdk.java.net >>>>>>>>> Cc: Ron Durbin >>>>>>>>> Subject: Re: Open code review for 8061999 Enhance VM option >>>>>>>>> parsing to allow options to be specified >>>>>>>>> >>>>>>>>> hi Ron, >>>>>>>>> >>>>>>>>> I'm sending you partial feedback, since I am starting to get a >>>>>>>>> bit tired. I will spend more time reviewing >>>>>>> your >>>>>>>>> webrev tomorrow, but here is what I have so far: >>>>>>>>> >>>>>>>>> --- >>>>>>>>> src/share/vm/utilities/globalDefinitions.hp >>>>>>>>> >>>>>>>>> 1. Should we name the method "is_white()", not "iswhite()" >>>>>>>>> since it's part of our code base? But then since >>>>>>> it's >>>>>>>>> a macro, shouldn't it actually be "IS_WHITE()" ? >>>>>>>>> --- >>>>>>>>> src/share/vm/runtime/arguments.hpp >>>>>>>>> [ >>>>>>>> [Ron] While researching my answer to this comment, I realized >>>>>>>> that I should have used the already existing isspace() >>>>>>>> function >>>>>>>> instead of creating the iswhite() macro. Will fix. >>>>>>>> >>>>>>>>> 1. >>>>>>>>> >>>>>>>>> All the arguments in alloc_JVM_options_list(), >>>>>>>>> copy_JVM_options_from_buf() and parse_JVM_options_file() use >>>>>>>>> underscores in the arguments names except for >>>>>>>>> merge_JVM_options_file(). I think the merge_JVM_options_file() >>>>>>>>> should be: >>>>>>>>> >>>>>>>>> + static jint merge_JVM_options_file(const struct >>>>>>>>> JavaVMInitArgs *args_in, >>>>>>>>> + struct JavaVMInitArgs >>>>>>>>> **args_out); >>>>>>>>> >>>>>>>> [Ron] This one is a reasonable clean up >>>>>>>> >>>>>>>>> --- >>>>>>>>> src/share/vm/runtime/arguments.cpp >>>>>>>>> >>>>>>>>> 1. Why do FreeVMOptions, DumpVMOptions, DumpVMOption and >>>>>>>>> DumpOption start with capital letters? Shouldn't >>>>>>> their >>>>>>>>> names start with a lower case letter? >>>>>>>>> >>>>>>>> [Ron] This one is a reasonable clean up >>>>>>>> >>>>>>>>> 2. Line 4306. The pattern in Arguments::parse() seems to be to >>>>>>>>> print out error message and return the error >>>>>>>>> value if something goes wrong, but we do vm_exit(1) instead? >>>>>>>>> >>>>>>>> [Ron ] The cases that will trigger this exit on fail are extreme: >>>>>>>> - missing or otherwise in accessible options files >>>>>>>> - Un-parsable options file, too big, too many options, >>>>>>>> nonwhite space terminated options >>>>>>>> - Unable to allocate memory for options files processing >>>>>>>> >>>>>>>>> 3. Line 4309. I was told that when it comes to NULL pointer >>>>>>>>> check we should do (NULL == args), not the other >>>>>>> way >>>>>>>>> around. >>>>>>>>> >>>>>>>> [Ron] This one is a reasonable clean up >>>>>>>> >>>>>>>>> 4. Line 4375. Don't we need FreeVMOptions() here? Line 4382 as >>>>>>>>> well? >>>>>>>> >>>>>>>> [Ron] Gerard this one is a reasonable clean up >>>>>>>> >>>>>>>>> 5. Question. Why do we need N_MAX_OPTIONS? >>>>>>>> [Ron] Until recently N_MAX_OPTIONS applied to environment >>>>>>>> variables too >>>>>>>> N_MAX_OTIIONS is used to limit the number of options >>>>>>>> and thus the memory allocated. >>>>>>>> A future enhancement will be to refactor the options >>>>>>>> file processing to grow memory like the >>>>>>>> environment variables do now. >>>>>>>> >>>>>>>>> 6. Question. Why do we need OPTION_BUFFER_SIZE? Can't we use >>>>>>>>> "int bytes_needed = fseek(stream, 0, SEEK_END); >>>>>>>>> rewind(stream)" and have the code dynamically allocate memory >>>>>>>>> without hard coded limits? >>>>>>>>> >>>>>>>> [Ron>] Until recently OPTION_BUFFER_SIZE applied to environment >>>>>>>> variables too. \ >>>>>>>> OPTION_BUFFER_SIZE is used to limit the memory >>>>>>>> allocated for reading the options. >>>>>>>> A future enhancement will be to refactor the options >>>>>>>> file processing to grow memory like the >>>>>>>> environment variables do now. >>>>>>>> >>>>>>>> >>>>>>>>> 7. Line 3965. Can that comparison ever succeed? "read()" will >>>>>>>>> not read more bytes (only less) than as >>>>>>> specified >>>>>>>>> by "bytes_alloc" and if it did, we would overwrite memory >>>>>>>>> since our buf is only "bytes_alloc" big. >>>>>>>>> >>>>>>>> [Ron>] Yes that comparison can succeed. We only support an >>>>>>>> options file that is <= OPTION_BUFFER_SIZE bytes in >>>>>>>> size. >>>>>>>> >>>>>>>> We allocate a read buffer that is OPTION_BUFFER_SIZE + 1 >>>>>>>> bytes in size for two reasons: >>>>>>>> >>>>>>>> 1) to have space for a NULL terminator when the >>>>>>>> options file is the maximum number of bytes >>>>>>>> in length >>>>>>>> 2) easy detection of an options file that is too large; >>>>>>>> we try to read OPTION_BUFFER_SIZE + 1 bytes. If we >>>>>>>> succeed, then the file is too big. >>>>>>>> >>>>>>>> >>>>>>>>> cheers >>>>>>>>> >>>>>>>>> >>>>>>>>> On 6/22/2015 7:52 AM, Ron Durbin wrote: >>>>>>>>> Webrev URL: >>>>>>>>> http://cr.openjdk.java.net/~rdurbin/8061999_OCR0_JDK9_webrev >>>>>>>>> >>>>>>>>> >>>>>>>>> RFE request: >>>>>>>>> https://bugs.openjdk.java.net/browse/JDK-8061999 >>>>>>>>> >>>>>>>>> This RFE allows a file to be specified that holds VM Options that >>>>>>>>> would otherwise be specified on the command line or in an >>>>>>>>> environment variable. >>>>>>>>> Only one options file may be specified on the command line and >>>>>>>>> no options file >>>>>>>>> may be specified in either of the following environment variables >>>>>>>>> "JAVA_TOOL_OPTIONS" or "_JAVA_OPTIONS". >>>>>>>>> >>>>>>>>> The options file feature supports all VM options currently >>>>>>>>> supported on >>>>>>>>> the command line, except the options file option. The option >>>>>>>>> to specify an >>>>>>>>> options file is "-XX:VMOptionsFile=". >>>>>>>>> The options file feature supports an options file up to 1024 >>>>>>>>> bytes in size >>>>>>>>> and up to 64 options. >>>>>>>>> >>>>>>>>> This feature has been tested on: >>>>>>>>> OS: >>>>>>>>> Solaris, MAC, Windows, Linux >>>>>>>>> Tests: >>>>>>>>> Manual unit tests >>>>>>>>> JPRT with -testset hotspot (including the SQE proposed >>>>>>>>> test coverage for this feature.) >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>> >>>> >>>> >>>> >>>> >>> >> > From harold.seigel at oracle.com Mon Jul 20 18:29:24 2015 From: harold.seigel at oracle.com (harold seigel) Date: Mon, 20 Jul 2015 14:29:24 -0400 Subject: RFR(XS) 8129895: New verifier fails to reject erroneous cast from int[] to other arrays of small integer types Message-ID: <55AD3E04.6080900@oracle.com> Hi, Please review this small change to fix bug 8129895. The split verifier erroneously allows arrays of primitive ints to be assignable to arrays of Booleans, bytes, chars, and shorts. This fix adds a new function (is_component_assignable_from()) for explicitly checking assign-ability of array components. The new function requires that primitive array components be identical for assign-ability. Open webrev: http://cr.openjdk.java.net/~hseigel/bug_8129895/ JBS Bug: https://bugs.openjdk.java.net/browse/JDK-8129895 The fix was tested with JCK Lang and VM tests, the UTE quick and split verifier tests, and the hotspot, and JDK vm, java/io, java/lang, and java/util JTreg tests. Thanks, Harold From george.triantafillou at oracle.com Mon Jul 20 18:56:43 2015 From: george.triantafillou at oracle.com (George Triantafillou) Date: Mon, 20 Jul 2015 14:56:43 -0400 Subject: RFR(XS) 8129895: New verifier fails to reject erroneous cast from int[] to other arrays of small integer types In-Reply-To: <55AD3E04.6080900@oracle.com> References: <55AD3E04.6080900@oracle.com> Message-ID: <55AD446B.6070703@oracle.com> Hi Harold, This looks good. -George On 7/20/2015 2:29 PM, harold seigel wrote: > Hi, > > Please review this small change to fix bug 8129895. The split > verifier erroneously allows arrays of primitive ints to be assignable > to arrays of Booleans, bytes, chars, and shorts. This fix adds a new > function (is_component_assignable_from()) for explicitly checking > assign-ability of array components. The new function requires that > primitive array components be identical for assign-ability. > > Open webrev: http://cr.openjdk.java.net/~hseigel/bug_8129895/ > > JBS Bug: https://bugs.openjdk.java.net/browse/JDK-8129895 > > The fix was tested with JCK Lang and VM tests, the UTE quick and split > verifier tests, and the hotspot, and JDK vm, java/io, java/lang, and > java/util JTreg tests. > > Thanks, Harold From harold.seigel at oracle.com Mon Jul 20 19:11:31 2015 From: harold.seigel at oracle.com (harold seigel) Date: Mon, 20 Jul 2015 15:11:31 -0400 Subject: RFR(XS) 8129895: New verifier fails to reject erroneous cast from int[] to other arrays of small integer types In-Reply-To: <55AD446B.6070703@oracle.com> References: <55AD3E04.6080900@oracle.com> <55AD446B.6070703@oracle.com> Message-ID: <55AD47E3.3090802@oracle.com> Hi George, Thanks for the review! Harold On 7/20/2015 2:56 PM, George Triantafillou wrote: > Hi Harold, > > This looks good. > > -George > > On 7/20/2015 2:29 PM, harold seigel wrote: >> Hi, >> >> Please review this small change to fix bug 8129895. The split >> verifier erroneously allows arrays of primitive ints to be assignable >> to arrays of Booleans, bytes, chars, and shorts. This fix adds a new >> function (is_component_assignable_from()) for explicitly checking >> assign-ability of array components. The new function requires that >> primitive array components be identical for assign-ability. >> >> Open webrev: http://cr.openjdk.java.net/~hseigel/bug_8129895/ >> >> JBS Bug: https://bugs.openjdk.java.net/browse/JDK-8129895 >> >> The fix was tested with JCK Lang and VM tests, the UTE quick and >> split verifier tests, and the hotspot, and JDK vm, java/io, >> java/lang, and java/util JTreg tests. >> >> Thanks, Harold > From daniel.daugherty at oracle.com Mon Jul 20 21:06:55 2015 From: daniel.daugherty at oracle.com (Daniel D. Daugherty) Date: Mon, 20 Jul 2015 15:06:55 -0600 Subject: RFR(S) Contended Locking fast notify bucket (8075171) In-Reply-To: <559724B0.6000507@oracle.com> References: <555A4678.7020308@oracle.com> <559724B0.6000507@oracle.com> Message-ID: <55AD62EF.3080104@oracle.com> Greetings, In rebasing this bucket, I've run into the need for @HotSpotIntrinsicCandidate (8076112). That results in the following trivial change in the JDK repo: $ hg diff diff -r c2e706c73dd5 src/java.base/share/classes/java/lang/Object.java --- a/src/java.base/share/classes/java/lang/Object.java Fri Jul 17 08:46:54 2015 -0700 +++ b/src/java.base/share/classes/java/lang/Object.java Mon Jul 20 13:59:10 2015 -0700 @@ -278,6 +278,7 @@ public class Object { * @see java.lang.Object#notifyAll() * @see java.lang.Object#wait() */ + @HotSpotIntrinsicCandidate public final native void notify(); /** @@ -302,6 +303,7 @@ public class Object { * @see java.lang.Object#notify() * @see java.lang.Object#wait() */ + @HotSpotIntrinsicCandidate public final native void notifyAll(); /** and the following trivial test change in the HotSpot repo: diff -r 67c4a62090e5 test/compiler/dependencies/MonomorphicObjectCall/java/lang/Object.java --- a/test/compiler/dependencies/MonomorphicObjectCall/java/lang/Object.java +++ b/test/compiler/dependencies/MonomorphicObjectCall/java/lang/Object.java @@ -58,8 +58,10 @@ public class Object { return getClass().getName() + "@" + Integer.toHexString(hashCode()); } + @HotSpotIntrinsicCandidate public final native void notify(); + @HotSpotIntrinsicCandidate public final native void notifyAll(); public final native void wait(long timeout) throws InterruptedException; Dan On 7/3/15 6:11 PM, Daniel D. Daugherty wrote: > Greetings, > > I've updated the patch for Contended Locking fast notify bucket > based on David H's and Karen's comments. > > This work is being tracked by the following bug ID: > > JDK-8075171 Contended Locking fast notify bucket > https://bugs.openjdk.java.net/browse/JDK-8075171 > > Here is the webrev URL: > > http://cr.openjdk.java.net/~dcubed/8075171-webrev/1-jdk9-hs-rt/ > > Here is the JEP link: > > https://bugs.openjdk.java.net/browse/JDK-8046133 > > Testing: > > - RBT vm.quick batches (in process) > - JPRT test jobs > - MonitorWaitNotifyStresser micro-benchmark (in process) > - CallTimerGrid stress testing (in process) > > > The changes in this round are in only four of the files: > > src/share/vm/opto/runtime.cpp > > - deleted comment about hashCode() that belongs in a different bucket > > src/share/vm/runtime/objectMonitor.cpp > > - add MAX_RECHECK_INTERVAL define for use in ObjectMonitor::EnterI() > - cleanup recheck interval code > - ObjectMonitor::INotify() return type is now "void" > - delete duplicate comments, clarify/rewrite some comments > > src/share/vm/runtime/objectMonitor.hpp > > - ObjectMonitor::INotify() return type is now "void" > > src/share/vm/runtime/synchronizer.cpp > > - clarify/rewrite comments, add additional comments > - cleanup variables in ObjectSynchronizer::quick_notify > - refactor loop to be more clear > - delete unused enum MaximumRecheckInterval > > The easiest way to review the delta is to download the two patch > files and compare them in something like jfilemerge: > > http://cr.openjdk.java.net/~dcubed/8075171-webrev/0-jdk9-hs-rt/hotspot.patch > > http://cr.openjdk.java.net/~dcubed/8075171-webrev/1-jdk9-hs-rt/hotspot.patch > > > Dan > > > On 5/18/15 2:07 PM, Daniel D. Daugherty wrote: >> Greetings, >> >> I have the Contended Locking fast notify bucket ready for review. >> >> The code changes in this bucket are the final piece in the triad >> of {fast-enter, fast-exit, fast-notify} changes. There are no >> macro assembler changes in this bucket (yeah!), but there are >> code review cleanups motivated by comments on other buckets, e.g., >> changing variables like 'Tally' -> 'tally'. >> >> This work is being tracked by the following bug ID: >> >> JDK-8075171 Contended Locking fast notify bucket >> https://bugs.openjdk.java.net/browse/JDK-8075171 >> >> Here is the webrev URL: >> >> http://cr.openjdk.java.net/~dcubed/8075171-webrev/0-jdk9-hs-rt/ >> >> Here is the JEP link: >> >> https://bugs.openjdk.java.net/browse/JDK-8046133 >> >> Testing: >> >> - Aurora Adhoc RT/SVC baseline batch >> - JPRT test jobs >> - MonitorWaitNotifyStresser micro-benchmark (in process) >> - CallTimerGrid stress testing (in process) >> - Aurora performance testing: >> - out of the box for the "promotion" and 32-bit server configs >> - heavy weight monitors for the "promotion" and 32-bit server configs >> (-XX:-UseBiasedLocking -XX:+UseHeavyMonitors) >> (in process) >> >> The hang somehow introduced by the "fast enter" bucket is still >> unresolved, but progress is being made. That work is being tracked >> by the following bug: >> >> JDK-8077392 Stream fork/join tasks occasionally fail to complete >> https://bugs.openjdk.java.net/browse/JDK-8077392 >> >> You'll see a change that re-enables the "fast enter" bucket in this >> webrev, but that change will not be pushed when we're done with the >> review of this bucket unless JDK-8077392 is resolved. >> >> Thanks, in advance, for any comments, questions or suggestions. >> >> Gory details about the changes are below... >> >> Dan >> >> >> 8075171 summary of changes: >> >> src/share/vm/classfile/vmSymbols.hpp >> - Add do_intrinsic() entries for _notify and _notifyAll >> >> src/share/vm/opto/library_call.cpp >> - Add optional inline_notify() that is controlled by new >> '-XX:[+-]InlineNotify' option >> >> src/share/vm/opto/runtime.cpp >> src/share/vm/opto/runtime.hpp >> - Add OptoRuntime::monitor_notify_C() and >> OptoRuntime::monitor_notifyAll_C() functions to support >> the new "fast notify" code paths >> - Add new OptoRuntime::monitor_notify_Type() to support >> the above two new functions >> >> src/share/vm/runtime/globals.hpp >> - Add '-XX:[+-]InlineNotify' option; default option value is >> enabled (true) >> >> src/share/vm/runtime/objectMonitor.cpp >> src/share/vm/runtime/objectMonitor.hpp >> - Refactor ObjectMonitor::notify() and ObjectMonitor::notifyAll() >> into wrappers that call the new ObjectMonitor::INotify() >> - Add new ObjectMonitor::INotify() to reduce code duplication >> between "notify" and "notifyAll" code paths >> >> src/share/vm/runtime/sharedRuntime.cpp >> - Temporarily re-enable the "fast enter" optimization in order >> to do performance testing. JDK-8077392 is still unresolved, >> but progress is being made. >> >> src/share/vm/runtime/synchronizer.cpp >> src/share/vm/runtime/synchronizer.hpp >> - Add ObjectSynchronizer::quick_notify() that implements the >> new "fast notify" code paths >> - The new code handles a couple of special cases where the >> "notify" can be done without the heavy weight slow-path >> (thread state transitions and other baggage) >> >> > > > From david.holmes at oracle.com Tue Jul 21 01:39:15 2015 From: david.holmes at oracle.com (David Holmes) Date: Tue, 21 Jul 2015 11:39:15 +1000 Subject: RFR(S) Contended Locking fast notify bucket (8075171) In-Reply-To: <55AD62EF.3080104@oracle.com> References: <555A4678.7020308@oracle.com> <559724B0.6000507@oracle.com> <55AD62EF.3080104@oracle.com> Message-ID: <55ADA2C3.4070103@oracle.com> Hi Dan, On 21/07/2015 7:06 AM, Daniel D. Daugherty wrote: > Greetings, > > In rebasing this bucket, I've run into the need for > @HotSpotIntrinsicCandidate (8076112). That results > in the following trivial change in the JDK repo: > > $ hg diff > diff -r c2e706c73dd5 src/java.base/share/classes/java/lang/Object.java > --- a/src/java.base/share/classes/java/lang/Object.java Fri Jul 17 > 08:46:54 2015 -0700 > +++ b/src/java.base/share/classes/java/lang/Object.java Mon Jul 20 > 13:59:10 2015 -0700 > @@ -278,6 +278,7 @@ public class Object { > * @see java.lang.Object#notifyAll() > * @see java.lang.Object#wait() > */ > + @HotSpotIntrinsicCandidate > public final native void notify(); > > /** > @@ -302,6 +303,7 @@ public class Object { > * @see java.lang.Object#notify() > * @see java.lang.Object#wait() > */ > + @HotSpotIntrinsicCandidate > public final native void notifyAll(); > > /** I'm regretting not having paid more attention to this annotation. I'm really not seeing it's value. And the word "Hotspot" should NOT be appearing as part of the Java platform API docs. :( > > and the following trivial test change in the HotSpot repo: > > diff -r 67c4a62090e5 > test/compiler/dependencies/MonomorphicObjectCall/java/lang/Object.java > --- > a/test/compiler/dependencies/MonomorphicObjectCall/java/lang/Object.java > +++ > b/test/compiler/dependencies/MonomorphicObjectCall/java/lang/Object.java > @@ -58,8 +58,10 @@ public class Object { > return getClass().getName() + "@" + > Integer.toHexString(hashCode()); > } > > + @HotSpotIntrinsicCandidate > public final native void notify(); > > + @HotSpotIntrinsicCandidate > public final native void notifyAll(); > > public final native void wait(long timeout) throws > InterruptedException; Sorry to do this to you but as we already hit this with some other tests it may be better to disable CheckIntrinsics for the test. Otherwise the test can now only be compiled by a sufficiently recent JDK 9. Thanks, David > Dan > > > On 7/3/15 6:11 PM, Daniel D. Daugherty wrote: >> Greetings, >> >> I've updated the patch for Contended Locking fast notify bucket >> based on David H's and Karen's comments. >> >> This work is being tracked by the following bug ID: >> >> JDK-8075171 Contended Locking fast notify bucket >> https://bugs.openjdk.java.net/browse/JDK-8075171 >> >> Here is the webrev URL: >> >> http://cr.openjdk.java.net/~dcubed/8075171-webrev/1-jdk9-hs-rt/ >> >> Here is the JEP link: >> >> https://bugs.openjdk.java.net/browse/JDK-8046133 >> >> Testing: >> >> - RBT vm.quick batches (in process) >> - JPRT test jobs >> - MonitorWaitNotifyStresser micro-benchmark (in process) >> - CallTimerGrid stress testing (in process) >> >> >> The changes in this round are in only four of the files: >> >> src/share/vm/opto/runtime.cpp >> >> - deleted comment about hashCode() that belongs in a different bucket >> >> src/share/vm/runtime/objectMonitor.cpp >> >> - add MAX_RECHECK_INTERVAL define for use in ObjectMonitor::EnterI() >> - cleanup recheck interval code >> - ObjectMonitor::INotify() return type is now "void" >> - delete duplicate comments, clarify/rewrite some comments >> >> src/share/vm/runtime/objectMonitor.hpp >> >> - ObjectMonitor::INotify() return type is now "void" >> >> src/share/vm/runtime/synchronizer.cpp >> >> - clarify/rewrite comments, add additional comments >> - cleanup variables in ObjectSynchronizer::quick_notify >> - refactor loop to be more clear >> - delete unused enum MaximumRecheckInterval >> >> The easiest way to review the delta is to download the two patch >> files and compare them in something like jfilemerge: >> >> http://cr.openjdk.java.net/~dcubed/8075171-webrev/0-jdk9-hs-rt/hotspot.patch >> >> http://cr.openjdk.java.net/~dcubed/8075171-webrev/1-jdk9-hs-rt/hotspot.patch >> >> >> Dan >> >> >> On 5/18/15 2:07 PM, Daniel D. Daugherty wrote: >>> Greetings, >>> >>> I have the Contended Locking fast notify bucket ready for review. >>> >>> The code changes in this bucket are the final piece in the triad >>> of {fast-enter, fast-exit, fast-notify} changes. There are no >>> macro assembler changes in this bucket (yeah!), but there are >>> code review cleanups motivated by comments on other buckets, e.g., >>> changing variables like 'Tally' -> 'tally'. >>> >>> This work is being tracked by the following bug ID: >>> >>> JDK-8075171 Contended Locking fast notify bucket >>> https://bugs.openjdk.java.net/browse/JDK-8075171 >>> >>> Here is the webrev URL: >>> >>> http://cr.openjdk.java.net/~dcubed/8075171-webrev/0-jdk9-hs-rt/ >>> >>> Here is the JEP link: >>> >>> https://bugs.openjdk.java.net/browse/JDK-8046133 >>> >>> Testing: >>> >>> - Aurora Adhoc RT/SVC baseline batch >>> - JPRT test jobs >>> - MonitorWaitNotifyStresser micro-benchmark (in process) >>> - CallTimerGrid stress testing (in process) >>> - Aurora performance testing: >>> - out of the box for the "promotion" and 32-bit server configs >>> - heavy weight monitors for the "promotion" and 32-bit server configs >>> (-XX:-UseBiasedLocking -XX:+UseHeavyMonitors) >>> (in process) >>> >>> The hang somehow introduced by the "fast enter" bucket is still >>> unresolved, but progress is being made. That work is being tracked >>> by the following bug: >>> >>> JDK-8077392 Stream fork/join tasks occasionally fail to complete >>> https://bugs.openjdk.java.net/browse/JDK-8077392 >>> >>> You'll see a change that re-enables the "fast enter" bucket in this >>> webrev, but that change will not be pushed when we're done with the >>> review of this bucket unless JDK-8077392 is resolved. >>> >>> Thanks, in advance, for any comments, questions or suggestions. >>> >>> Gory details about the changes are below... >>> >>> Dan >>> >>> >>> 8075171 summary of changes: >>> >>> src/share/vm/classfile/vmSymbols.hpp >>> - Add do_intrinsic() entries for _notify and _notifyAll >>> >>> src/share/vm/opto/library_call.cpp >>> - Add optional inline_notify() that is controlled by new >>> '-XX:[+-]InlineNotify' option >>> >>> src/share/vm/opto/runtime.cpp >>> src/share/vm/opto/runtime.hpp >>> - Add OptoRuntime::monitor_notify_C() and >>> OptoRuntime::monitor_notifyAll_C() functions to support >>> the new "fast notify" code paths >>> - Add new OptoRuntime::monitor_notify_Type() to support >>> the above two new functions >>> >>> src/share/vm/runtime/globals.hpp >>> - Add '-XX:[+-]InlineNotify' option; default option value is >>> enabled (true) >>> >>> src/share/vm/runtime/objectMonitor.cpp >>> src/share/vm/runtime/objectMonitor.hpp >>> - Refactor ObjectMonitor::notify() and ObjectMonitor::notifyAll() >>> into wrappers that call the new ObjectMonitor::INotify() >>> - Add new ObjectMonitor::INotify() to reduce code duplication >>> between "notify" and "notifyAll" code paths >>> >>> src/share/vm/runtime/sharedRuntime.cpp >>> - Temporarily re-enable the "fast enter" optimization in order >>> to do performance testing. JDK-8077392 is still unresolved, >>> but progress is being made. >>> >>> src/share/vm/runtime/synchronizer.cpp >>> src/share/vm/runtime/synchronizer.hpp >>> - Add ObjectSynchronizer::quick_notify() that implements the >>> new "fast notify" code paths >>> - The new code handles a couple of special cases where the >>> "notify" can be done without the heavy weight slow-path >>> (thread state transitions and other baggage) >>> >>> >> >> >> > From david.holmes at oracle.com Tue Jul 21 01:49:01 2015 From: david.holmes at oracle.com (David Holmes) Date: Tue, 21 Jul 2015 11:49:01 +1000 Subject: RFR(XS) 8129895: New verifier fails to reject erroneous cast from int[] to other arrays of small integer types In-Reply-To: <55AD3E04.6080900@oracle.com> References: <55AD3E04.6080900@oracle.com> Message-ID: <55ADA50D.9090208@oracle.com> Hi Harold, On 21/07/2015 4:29 AM, harold seigel wrote: > Hi, > > Please review this small change to fix bug 8129895. The split verifier > erroneously allows arrays of primitive ints to be assignable to arrays > of Booleans, bytes, chars, and shorts. This fix adds a new function > (is_component_assignable_from()) for explicitly checking assign-ability > of array components. The new function requires that primitive array > components be identical for assign-ability. > > Open webrev: http://cr.openjdk.java.net/~hseigel/bug_8129895/ My only nit here is that "is_assignable" doesn't reflect the actual check - it's is-equal for the primitives not is-assignable. I'm also wondering what the situation is with long[], float[] and double[]? Thanks, David > JBS Bug: https://bugs.openjdk.java.net/browse/JDK-8129895 > > The fix was tested with JCK Lang and VM tests, the UTE quick and split > verifier tests, and the hotspot, and JDK vm, java/io, java/lang, and > java/util JTreg tests. > > Thanks, Harold From daniel.daugherty at oracle.com Tue Jul 21 04:24:35 2015 From: daniel.daugherty at oracle.com (Daniel D. Daugherty) Date: Mon, 20 Jul 2015 22:24:35 -0600 Subject: RFR(S) Contended Locking fast notify bucket (8075171) In-Reply-To: <55ADA2C3.4070103@oracle.com> References: <555A4678.7020308@oracle.com> <559724B0.6000507@oracle.com> <55AD62EF.3080104@oracle.com> <55ADA2C3.4070103@oracle.com> Message-ID: <55ADC983.1030107@oracle.com> On 7/20/15 7:39 PM, David Holmes wrote: > Hi Dan, > > On 21/07/2015 7:06 AM, Daniel D. Daugherty wrote: >> Greetings, >> >> In rebasing this bucket, I've run into the need for >> @HotSpotIntrinsicCandidate (8076112). That results >> in the following trivial change in the JDK repo: >> >> $ hg diff >> diff -r c2e706c73dd5 src/java.base/share/classes/java/lang/Object.java >> --- a/src/java.base/share/classes/java/lang/Object.java Fri Jul 17 >> 08:46:54 2015 -0700 >> +++ b/src/java.base/share/classes/java/lang/Object.java Mon Jul 20 >> 13:59:10 2015 -0700 >> @@ -278,6 +278,7 @@ public class Object { >> * @see java.lang.Object#notifyAll() >> * @see java.lang.Object#wait() >> */ >> + @HotSpotIntrinsicCandidate >> public final native void notify(); >> >> /** >> @@ -302,6 +303,7 @@ public class Object { >> * @see java.lang.Object#notify() >> * @see java.lang.Object#wait() >> */ >> + @HotSpotIntrinsicCandidate >> public final native void notifyAll(); >> >> /** > > I'm regretting not having paid more attention to this annotation. I'm > really not seeing it's value. And the word "Hotspot" should NOT be > appearing as part of the Java platform API docs. :( Yup. It does feel strange, but I had to add it... > >> >> and the following trivial test change in the HotSpot repo: >> >> diff -r 67c4a62090e5 >> test/compiler/dependencies/MonomorphicObjectCall/java/lang/Object.java >> --- >> a/test/compiler/dependencies/MonomorphicObjectCall/java/lang/Object.java >> +++ >> b/test/compiler/dependencies/MonomorphicObjectCall/java/lang/Object.java >> @@ -58,8 +58,10 @@ public class Object { >> return getClass().getName() + "@" + >> Integer.toHexString(hashCode()); >> } >> >> + @HotSpotIntrinsicCandidate >> public final native void notify(); >> >> + @HotSpotIntrinsicCandidate >> public final native void notifyAll(); >> >> public final native void wait(long timeout) throws >> InterruptedException; > > Sorry to do this to you but as we already hit this with some other > tests it may be better to disable CheckIntrinsics for the test. > Otherwise the test can now only be compiled by a sufficiently recent > JDK 9. Since I know nothing about this test other than 8076112 modified it for other intrinsics, I'd rather not muddy the waters of this changeset dealing with whether this test should use -XX:-CheckIntrinsics or not... I will file a follow up bug and try to chase down resolution for that test using a different bug. Dan > > Thanks, > David > >> Dan >> >> >> On 7/3/15 6:11 PM, Daniel D. Daugherty wrote: >>> Greetings, >>> >>> I've updated the patch for Contended Locking fast notify bucket >>> based on David H's and Karen's comments. >>> >>> This work is being tracked by the following bug ID: >>> >>> JDK-8075171 Contended Locking fast notify bucket >>> https://bugs.openjdk.java.net/browse/JDK-8075171 >>> >>> Here is the webrev URL: >>> >>> http://cr.openjdk.java.net/~dcubed/8075171-webrev/1-jdk9-hs-rt/ >>> >>> Here is the JEP link: >>> >>> https://bugs.openjdk.java.net/browse/JDK-8046133 >>> >>> Testing: >>> >>> - RBT vm.quick batches (in process) >>> - JPRT test jobs >>> - MonitorWaitNotifyStresser micro-benchmark (in process) >>> - CallTimerGrid stress testing (in process) >>> >>> >>> The changes in this round are in only four of the files: >>> >>> src/share/vm/opto/runtime.cpp >>> >>> - deleted comment about hashCode() that belongs in a different bucket >>> >>> src/share/vm/runtime/objectMonitor.cpp >>> >>> - add MAX_RECHECK_INTERVAL define for use in ObjectMonitor::EnterI() >>> - cleanup recheck interval code >>> - ObjectMonitor::INotify() return type is now "void" >>> - delete duplicate comments, clarify/rewrite some comments >>> >>> src/share/vm/runtime/objectMonitor.hpp >>> >>> - ObjectMonitor::INotify() return type is now "void" >>> >>> src/share/vm/runtime/synchronizer.cpp >>> >>> - clarify/rewrite comments, add additional comments >>> - cleanup variables in ObjectSynchronizer::quick_notify >>> - refactor loop to be more clear >>> - delete unused enum MaximumRecheckInterval >>> >>> The easiest way to review the delta is to download the two patch >>> files and compare them in something like jfilemerge: >>> >>> http://cr.openjdk.java.net/~dcubed/8075171-webrev/0-jdk9-hs-rt/hotspot.patch >>> >>> >>> http://cr.openjdk.java.net/~dcubed/8075171-webrev/1-jdk9-hs-rt/hotspot.patch >>> >>> >>> >>> Dan >>> >>> >>> On 5/18/15 2:07 PM, Daniel D. Daugherty wrote: >>>> Greetings, >>>> >>>> I have the Contended Locking fast notify bucket ready for review. >>>> >>>> The code changes in this bucket are the final piece in the triad >>>> of {fast-enter, fast-exit, fast-notify} changes. There are no >>>> macro assembler changes in this bucket (yeah!), but there are >>>> code review cleanups motivated by comments on other buckets, e.g., >>>> changing variables like 'Tally' -> 'tally'. >>>> >>>> This work is being tracked by the following bug ID: >>>> >>>> JDK-8075171 Contended Locking fast notify bucket >>>> https://bugs.openjdk.java.net/browse/JDK-8075171 >>>> >>>> Here is the webrev URL: >>>> >>>> http://cr.openjdk.java.net/~dcubed/8075171-webrev/0-jdk9-hs-rt/ >>>> >>>> Here is the JEP link: >>>> >>>> https://bugs.openjdk.java.net/browse/JDK-8046133 >>>> >>>> Testing: >>>> >>>> - Aurora Adhoc RT/SVC baseline batch >>>> - JPRT test jobs >>>> - MonitorWaitNotifyStresser micro-benchmark (in process) >>>> - CallTimerGrid stress testing (in process) >>>> - Aurora performance testing: >>>> - out of the box for the "promotion" and 32-bit server configs >>>> - heavy weight monitors for the "promotion" and 32-bit server >>>> configs >>>> (-XX:-UseBiasedLocking -XX:+UseHeavyMonitors) >>>> (in process) >>>> >>>> The hang somehow introduced by the "fast enter" bucket is still >>>> unresolved, but progress is being made. That work is being tracked >>>> by the following bug: >>>> >>>> JDK-8077392 Stream fork/join tasks occasionally fail to complete >>>> https://bugs.openjdk.java.net/browse/JDK-8077392 >>>> >>>> You'll see a change that re-enables the "fast enter" bucket in this >>>> webrev, but that change will not be pushed when we're done with the >>>> review of this bucket unless JDK-8077392 is resolved. >>>> >>>> Thanks, in advance, for any comments, questions or suggestions. >>>> >>>> Gory details about the changes are below... >>>> >>>> Dan >>>> >>>> >>>> 8075171 summary of changes: >>>> >>>> src/share/vm/classfile/vmSymbols.hpp >>>> - Add do_intrinsic() entries for _notify and _notifyAll >>>> >>>> src/share/vm/opto/library_call.cpp >>>> - Add optional inline_notify() that is controlled by new >>>> '-XX:[+-]InlineNotify' option >>>> >>>> src/share/vm/opto/runtime.cpp >>>> src/share/vm/opto/runtime.hpp >>>> - Add OptoRuntime::monitor_notify_C() and >>>> OptoRuntime::monitor_notifyAll_C() functions to support >>>> the new "fast notify" code paths >>>> - Add new OptoRuntime::monitor_notify_Type() to support >>>> the above two new functions >>>> >>>> src/share/vm/runtime/globals.hpp >>>> - Add '-XX:[+-]InlineNotify' option; default option value is >>>> enabled (true) >>>> >>>> src/share/vm/runtime/objectMonitor.cpp >>>> src/share/vm/runtime/objectMonitor.hpp >>>> - Refactor ObjectMonitor::notify() and ObjectMonitor::notifyAll() >>>> into wrappers that call the new ObjectMonitor::INotify() >>>> - Add new ObjectMonitor::INotify() to reduce code duplication >>>> between "notify" and "notifyAll" code paths >>>> >>>> src/share/vm/runtime/sharedRuntime.cpp >>>> - Temporarily re-enable the "fast enter" optimization in order >>>> to do performance testing. JDK-8077392 is still unresolved, >>>> but progress is being made. >>>> >>>> src/share/vm/runtime/synchronizer.cpp >>>> src/share/vm/runtime/synchronizer.hpp >>>> - Add ObjectSynchronizer::quick_notify() that implements the >>>> new "fast notify" code paths >>>> - The new code handles a couple of special cases where the >>>> "notify" can be done without the heavy weight slow-path >>>> (thread state transitions and other baggage) >>>> >>>> >>> >>> >>> >> From david.holmes at oracle.com Tue Jul 21 04:33:50 2015 From: david.holmes at oracle.com (David Holmes) Date: Tue, 21 Jul 2015 14:33:50 +1000 Subject: RFR(S) Contended Locking fast notify bucket (8075171) In-Reply-To: <55ADC983.1030107@oracle.com> References: <555A4678.7020308@oracle.com> <559724B0.6000507@oracle.com> <55AD62EF.3080104@oracle.com> <55ADA2C3.4070103@oracle.com> <55ADC983.1030107@oracle.com> Message-ID: <55ADCBAE.8080902@oracle.com> On 21/07/2015 2:24 PM, Daniel D. Daugherty wrote: > > On 7/20/15 7:39 PM, David Holmes wrote: >> Hi Dan, >> >> On 21/07/2015 7:06 AM, Daniel D. Daugherty wrote: >>> Greetings, >>> >>> In rebasing this bucket, I've run into the need for >>> @HotSpotIntrinsicCandidate (8076112). That results >>> in the following trivial change in the JDK repo: >>> >>> $ hg diff >>> diff -r c2e706c73dd5 src/java.base/share/classes/java/lang/Object.java >>> --- a/src/java.base/share/classes/java/lang/Object.java Fri Jul 17 >>> 08:46:54 2015 -0700 >>> +++ b/src/java.base/share/classes/java/lang/Object.java Mon Jul 20 >>> 13:59:10 2015 -0700 >>> @@ -278,6 +278,7 @@ public class Object { >>> * @see java.lang.Object#notifyAll() >>> * @see java.lang.Object#wait() >>> */ >>> + @HotSpotIntrinsicCandidate >>> public final native void notify(); >>> >>> /** >>> @@ -302,6 +303,7 @@ public class Object { >>> * @see java.lang.Object#notify() >>> * @see java.lang.Object#wait() >>> */ >>> + @HotSpotIntrinsicCandidate >>> public final native void notifyAll(); >>> >>> /** >> >> I'm regretting not having paid more attention to this annotation. I'm >> really not seeing it's value. And the word "Hotspot" should NOT be >> appearing as part of the Java platform API docs. :( > > Yup. It does feel strange, but I had to add it... > > >> >>> >>> and the following trivial test change in the HotSpot repo: >>> >>> diff -r 67c4a62090e5 >>> test/compiler/dependencies/MonomorphicObjectCall/java/lang/Object.java >>> --- >>> a/test/compiler/dependencies/MonomorphicObjectCall/java/lang/Object.java >>> +++ >>> b/test/compiler/dependencies/MonomorphicObjectCall/java/lang/Object.java >>> @@ -58,8 +58,10 @@ public class Object { >>> return getClass().getName() + "@" + >>> Integer.toHexString(hashCode()); >>> } >>> >>> + @HotSpotIntrinsicCandidate >>> public final native void notify(); >>> >>> + @HotSpotIntrinsicCandidate >>> public final native void notifyAll(); >>> >>> public final native void wait(long timeout) throws >>> InterruptedException; >> >> Sorry to do this to you but as we already hit this with some other >> tests it may be better to disable CheckIntrinsics for the test. >> Otherwise the test can now only be compiled by a sufficiently recent >> JDK 9. > > Since I know nothing about this test other than 8076112 modified > it for other intrinsics, I'd rather not muddy the waters of this > changeset dealing with whether this test should use > -XX:-CheckIntrinsics or not... Hadn't realized that this test was already using the annotation - in that case no problem and no need for follow up. Thanks, David > I will file a follow up bug and try to chase down resolution > for that test using a different bug. > > Dan > >> >> Thanks, >> David >> >>> Dan >>> >>> >>> On 7/3/15 6:11 PM, Daniel D. Daugherty wrote: >>>> Greetings, >>>> >>>> I've updated the patch for Contended Locking fast notify bucket >>>> based on David H's and Karen's comments. >>>> >>>> This work is being tracked by the following bug ID: >>>> >>>> JDK-8075171 Contended Locking fast notify bucket >>>> https://bugs.openjdk.java.net/browse/JDK-8075171 >>>> >>>> Here is the webrev URL: >>>> >>>> http://cr.openjdk.java.net/~dcubed/8075171-webrev/1-jdk9-hs-rt/ >>>> >>>> Here is the JEP link: >>>> >>>> https://bugs.openjdk.java.net/browse/JDK-8046133 >>>> >>>> Testing: >>>> >>>> - RBT vm.quick batches (in process) >>>> - JPRT test jobs >>>> - MonitorWaitNotifyStresser micro-benchmark (in process) >>>> - CallTimerGrid stress testing (in process) >>>> >>>> >>>> The changes in this round are in only four of the files: >>>> >>>> src/share/vm/opto/runtime.cpp >>>> >>>> - deleted comment about hashCode() that belongs in a different bucket >>>> >>>> src/share/vm/runtime/objectMonitor.cpp >>>> >>>> - add MAX_RECHECK_INTERVAL define for use in ObjectMonitor::EnterI() >>>> - cleanup recheck interval code >>>> - ObjectMonitor::INotify() return type is now "void" >>>> - delete duplicate comments, clarify/rewrite some comments >>>> >>>> src/share/vm/runtime/objectMonitor.hpp >>>> >>>> - ObjectMonitor::INotify() return type is now "void" >>>> >>>> src/share/vm/runtime/synchronizer.cpp >>>> >>>> - clarify/rewrite comments, add additional comments >>>> - cleanup variables in ObjectSynchronizer::quick_notify >>>> - refactor loop to be more clear >>>> - delete unused enum MaximumRecheckInterval >>>> >>>> The easiest way to review the delta is to download the two patch >>>> files and compare them in something like jfilemerge: >>>> >>>> http://cr.openjdk.java.net/~dcubed/8075171-webrev/0-jdk9-hs-rt/hotspot.patch >>>> >>>> >>>> http://cr.openjdk.java.net/~dcubed/8075171-webrev/1-jdk9-hs-rt/hotspot.patch >>>> >>>> >>>> >>>> Dan >>>> >>>> >>>> On 5/18/15 2:07 PM, Daniel D. Daugherty wrote: >>>>> Greetings, >>>>> >>>>> I have the Contended Locking fast notify bucket ready for review. >>>>> >>>>> The code changes in this bucket are the final piece in the triad >>>>> of {fast-enter, fast-exit, fast-notify} changes. There are no >>>>> macro assembler changes in this bucket (yeah!), but there are >>>>> code review cleanups motivated by comments on other buckets, e.g., >>>>> changing variables like 'Tally' -> 'tally'. >>>>> >>>>> This work is being tracked by the following bug ID: >>>>> >>>>> JDK-8075171 Contended Locking fast notify bucket >>>>> https://bugs.openjdk.java.net/browse/JDK-8075171 >>>>> >>>>> Here is the webrev URL: >>>>> >>>>> http://cr.openjdk.java.net/~dcubed/8075171-webrev/0-jdk9-hs-rt/ >>>>> >>>>> Here is the JEP link: >>>>> >>>>> https://bugs.openjdk.java.net/browse/JDK-8046133 >>>>> >>>>> Testing: >>>>> >>>>> - Aurora Adhoc RT/SVC baseline batch >>>>> - JPRT test jobs >>>>> - MonitorWaitNotifyStresser micro-benchmark (in process) >>>>> - CallTimerGrid stress testing (in process) >>>>> - Aurora performance testing: >>>>> - out of the box for the "promotion" and 32-bit server configs >>>>> - heavy weight monitors for the "promotion" and 32-bit server >>>>> configs >>>>> (-XX:-UseBiasedLocking -XX:+UseHeavyMonitors) >>>>> (in process) >>>>> >>>>> The hang somehow introduced by the "fast enter" bucket is still >>>>> unresolved, but progress is being made. That work is being tracked >>>>> by the following bug: >>>>> >>>>> JDK-8077392 Stream fork/join tasks occasionally fail to complete >>>>> https://bugs.openjdk.java.net/browse/JDK-8077392 >>>>> >>>>> You'll see a change that re-enables the "fast enter" bucket in this >>>>> webrev, but that change will not be pushed when we're done with the >>>>> review of this bucket unless JDK-8077392 is resolved. >>>>> >>>>> Thanks, in advance, for any comments, questions or suggestions. >>>>> >>>>> Gory details about the changes are below... >>>>> >>>>> Dan >>>>> >>>>> >>>>> 8075171 summary of changes: >>>>> >>>>> src/share/vm/classfile/vmSymbols.hpp >>>>> - Add do_intrinsic() entries for _notify and _notifyAll >>>>> >>>>> src/share/vm/opto/library_call.cpp >>>>> - Add optional inline_notify() that is controlled by new >>>>> '-XX:[+-]InlineNotify' option >>>>> >>>>> src/share/vm/opto/runtime.cpp >>>>> src/share/vm/opto/runtime.hpp >>>>> - Add OptoRuntime::monitor_notify_C() and >>>>> OptoRuntime::monitor_notifyAll_C() functions to support >>>>> the new "fast notify" code paths >>>>> - Add new OptoRuntime::monitor_notify_Type() to support >>>>> the above two new functions >>>>> >>>>> src/share/vm/runtime/globals.hpp >>>>> - Add '-XX:[+-]InlineNotify' option; default option value is >>>>> enabled (true) >>>>> >>>>> src/share/vm/runtime/objectMonitor.cpp >>>>> src/share/vm/runtime/objectMonitor.hpp >>>>> - Refactor ObjectMonitor::notify() and ObjectMonitor::notifyAll() >>>>> into wrappers that call the new ObjectMonitor::INotify() >>>>> - Add new ObjectMonitor::INotify() to reduce code duplication >>>>> between "notify" and "notifyAll" code paths >>>>> >>>>> src/share/vm/runtime/sharedRuntime.cpp >>>>> - Temporarily re-enable the "fast enter" optimization in order >>>>> to do performance testing. JDK-8077392 is still unresolved, >>>>> but progress is being made. >>>>> >>>>> src/share/vm/runtime/synchronizer.cpp >>>>> src/share/vm/runtime/synchronizer.hpp >>>>> - Add ObjectSynchronizer::quick_notify() that implements the >>>>> new "fast notify" code paths >>>>> - The new code handles a couple of special cases where the >>>>> "notify" can be done without the heavy weight slow-path >>>>> (thread state transitions and other baggage) >>>>> >>>>> >>>> >>>> >>>> >>> > From daniel.daugherty at oracle.com Tue Jul 21 11:53:24 2015 From: daniel.daugherty at oracle.com (Daniel D. Daugherty) Date: Tue, 21 Jul 2015 05:53:24 -0600 Subject: RFR(S) Contended Locking fast notify bucket (8075171) In-Reply-To: <55ADCBAE.8080902@oracle.com> References: <555A4678.7020308@oracle.com> <559724B0.6000507@oracle.com> <55AD62EF.3080104@oracle.com> <55ADA2C3.4070103@oracle.com> <55ADC983.1030107@oracle.com> <55ADCBAE.8080902@oracle.com> Message-ID: <55AE32B4.9020205@oracle.com> On 7/20/15 10:33 PM, David Holmes wrote: > On 21/07/2015 2:24 PM, Daniel D. Daugherty wrote: >> >> On 7/20/15 7:39 PM, David Holmes wrote: >>> Hi Dan, >>> >>> On 21/07/2015 7:06 AM, Daniel D. Daugherty wrote: >>>> Greetings, >>>> >>>> In rebasing this bucket, I've run into the need for >>>> @HotSpotIntrinsicCandidate (8076112). That results >>>> in the following trivial change in the JDK repo: >>>> >>>> $ hg diff >>>> diff -r c2e706c73dd5 src/java.base/share/classes/java/lang/Object.java >>>> --- a/src/java.base/share/classes/java/lang/Object.java Fri Jul 17 >>>> 08:46:54 2015 -0700 >>>> +++ b/src/java.base/share/classes/java/lang/Object.java Mon Jul 20 >>>> 13:59:10 2015 -0700 >>>> @@ -278,6 +278,7 @@ public class Object { >>>> * @see java.lang.Object#notifyAll() >>>> * @see java.lang.Object#wait() >>>> */ >>>> + @HotSpotIntrinsicCandidate >>>> public final native void notify(); >>>> >>>> /** >>>> @@ -302,6 +303,7 @@ public class Object { >>>> * @see java.lang.Object#notify() >>>> * @see java.lang.Object#wait() >>>> */ >>>> + @HotSpotIntrinsicCandidate >>>> public final native void notifyAll(); >>>> >>>> /** >>> >>> I'm regretting not having paid more attention to this annotation. I'm >>> really not seeing it's value. And the word "Hotspot" should NOT be >>> appearing as part of the Java platform API docs. :( >> >> Yup. It does feel strange, but I had to add it... >> >> >>> >>>> >>>> and the following trivial test change in the HotSpot repo: >>>> >>>> diff -r 67c4a62090e5 >>>> test/compiler/dependencies/MonomorphicObjectCall/java/lang/Object.java >>>> --- >>>> a/test/compiler/dependencies/MonomorphicObjectCall/java/lang/Object.java >>>> >>>> +++ >>>> b/test/compiler/dependencies/MonomorphicObjectCall/java/lang/Object.java >>>> >>>> @@ -58,8 +58,10 @@ public class Object { >>>> return getClass().getName() + "@" + >>>> Integer.toHexString(hashCode()); >>>> } >>>> >>>> + @HotSpotIntrinsicCandidate >>>> public final native void notify(); >>>> >>>> + @HotSpotIntrinsicCandidate >>>> public final native void notifyAll(); >>>> >>>> public final native void wait(long timeout) throws >>>> InterruptedException; >>> >>> Sorry to do this to you but as we already hit this with some other >>> tests it may be better to disable CheckIntrinsics for the test. >>> Otherwise the test can now only be compiled by a sufficiently recent >>> JDK 9. >> >> Since I know nothing about this test other than 8076112 modified >> it for other intrinsics, I'd rather not muddy the waters of this >> changeset dealing with whether this test should use >> -XX:-CheckIntrinsics or not... > > Hadn't realized that this test was already using the annotation - in > that case no problem and no need for follow up. Thanks! Dan > > Thanks, > David > >> I will file a follow up bug and try to chase down resolution >> for that test using a different bug. >> >> Dan >> >>> >>> Thanks, >>> David >>> >>>> Dan >>>> >>>> >>>> On 7/3/15 6:11 PM, Daniel D. Daugherty wrote: >>>>> Greetings, >>>>> >>>>> I've updated the patch for Contended Locking fast notify bucket >>>>> based on David H's and Karen's comments. >>>>> >>>>> This work is being tracked by the following bug ID: >>>>> >>>>> JDK-8075171 Contended Locking fast notify bucket >>>>> https://bugs.openjdk.java.net/browse/JDK-8075171 >>>>> >>>>> Here is the webrev URL: >>>>> >>>>> http://cr.openjdk.java.net/~dcubed/8075171-webrev/1-jdk9-hs-rt/ >>>>> >>>>> Here is the JEP link: >>>>> >>>>> https://bugs.openjdk.java.net/browse/JDK-8046133 >>>>> >>>>> Testing: >>>>> >>>>> - RBT vm.quick batches (in process) >>>>> - JPRT test jobs >>>>> - MonitorWaitNotifyStresser micro-benchmark (in process) >>>>> - CallTimerGrid stress testing (in process) >>>>> >>>>> >>>>> The changes in this round are in only four of the files: >>>>> >>>>> src/share/vm/opto/runtime.cpp >>>>> >>>>> - deleted comment about hashCode() that belongs in a different >>>>> bucket >>>>> >>>>> src/share/vm/runtime/objectMonitor.cpp >>>>> >>>>> - add MAX_RECHECK_INTERVAL define for use in >>>>> ObjectMonitor::EnterI() >>>>> - cleanup recheck interval code >>>>> - ObjectMonitor::INotify() return type is now "void" >>>>> - delete duplicate comments, clarify/rewrite some comments >>>>> >>>>> src/share/vm/runtime/objectMonitor.hpp >>>>> >>>>> - ObjectMonitor::INotify() return type is now "void" >>>>> >>>>> src/share/vm/runtime/synchronizer.cpp >>>>> >>>>> - clarify/rewrite comments, add additional comments >>>>> - cleanup variables in ObjectSynchronizer::quick_notify >>>>> - refactor loop to be more clear >>>>> - delete unused enum MaximumRecheckInterval >>>>> >>>>> The easiest way to review the delta is to download the two patch >>>>> files and compare them in something like jfilemerge: >>>>> >>>>> http://cr.openjdk.java.net/~dcubed/8075171-webrev/0-jdk9-hs-rt/hotspot.patch >>>>> >>>>> >>>>> >>>>> http://cr.openjdk.java.net/~dcubed/8075171-webrev/1-jdk9-hs-rt/hotspot.patch >>>>> >>>>> >>>>> >>>>> >>>>> Dan >>>>> >>>>> >>>>> On 5/18/15 2:07 PM, Daniel D. Daugherty wrote: >>>>>> Greetings, >>>>>> >>>>>> I have the Contended Locking fast notify bucket ready for review. >>>>>> >>>>>> The code changes in this bucket are the final piece in the triad >>>>>> of {fast-enter, fast-exit, fast-notify} changes. There are no >>>>>> macro assembler changes in this bucket (yeah!), but there are >>>>>> code review cleanups motivated by comments on other buckets, e.g., >>>>>> changing variables like 'Tally' -> 'tally'. >>>>>> >>>>>> This work is being tracked by the following bug ID: >>>>>> >>>>>> JDK-8075171 Contended Locking fast notify bucket >>>>>> https://bugs.openjdk.java.net/browse/JDK-8075171 >>>>>> >>>>>> Here is the webrev URL: >>>>>> >>>>>> http://cr.openjdk.java.net/~dcubed/8075171-webrev/0-jdk9-hs-rt/ >>>>>> >>>>>> Here is the JEP link: >>>>>> >>>>>> https://bugs.openjdk.java.net/browse/JDK-8046133 >>>>>> >>>>>> Testing: >>>>>> >>>>>> - Aurora Adhoc RT/SVC baseline batch >>>>>> - JPRT test jobs >>>>>> - MonitorWaitNotifyStresser micro-benchmark (in process) >>>>>> - CallTimerGrid stress testing (in process) >>>>>> - Aurora performance testing: >>>>>> - out of the box for the "promotion" and 32-bit server configs >>>>>> - heavy weight monitors for the "promotion" and 32-bit server >>>>>> configs >>>>>> (-XX:-UseBiasedLocking -XX:+UseHeavyMonitors) >>>>>> (in process) >>>>>> >>>>>> The hang somehow introduced by the "fast enter" bucket is still >>>>>> unresolved, but progress is being made. That work is being tracked >>>>>> by the following bug: >>>>>> >>>>>> JDK-8077392 Stream fork/join tasks occasionally fail to complete >>>>>> https://bugs.openjdk.java.net/browse/JDK-8077392 >>>>>> >>>>>> You'll see a change that re-enables the "fast enter" bucket in this >>>>>> webrev, but that change will not be pushed when we're done with the >>>>>> review of this bucket unless JDK-8077392 is resolved. >>>>>> >>>>>> Thanks, in advance, for any comments, questions or suggestions. >>>>>> >>>>>> Gory details about the changes are below... >>>>>> >>>>>> Dan >>>>>> >>>>>> >>>>>> 8075171 summary of changes: >>>>>> >>>>>> src/share/vm/classfile/vmSymbols.hpp >>>>>> - Add do_intrinsic() entries for _notify and _notifyAll >>>>>> >>>>>> src/share/vm/opto/library_call.cpp >>>>>> - Add optional inline_notify() that is controlled by new >>>>>> '-XX:[+-]InlineNotify' option >>>>>> >>>>>> src/share/vm/opto/runtime.cpp >>>>>> src/share/vm/opto/runtime.hpp >>>>>> - Add OptoRuntime::monitor_notify_C() and >>>>>> OptoRuntime::monitor_notifyAll_C() functions to support >>>>>> the new "fast notify" code paths >>>>>> - Add new OptoRuntime::monitor_notify_Type() to support >>>>>> the above two new functions >>>>>> >>>>>> src/share/vm/runtime/globals.hpp >>>>>> - Add '-XX:[+-]InlineNotify' option; default option value is >>>>>> enabled (true) >>>>>> >>>>>> src/share/vm/runtime/objectMonitor.cpp >>>>>> src/share/vm/runtime/objectMonitor.hpp >>>>>> - Refactor ObjectMonitor::notify() and ObjectMonitor::notifyAll() >>>>>> into wrappers that call the new ObjectMonitor::INotify() >>>>>> - Add new ObjectMonitor::INotify() to reduce code duplication >>>>>> between "notify" and "notifyAll" code paths >>>>>> >>>>>> src/share/vm/runtime/sharedRuntime.cpp >>>>>> - Temporarily re-enable the "fast enter" optimization in order >>>>>> to do performance testing. JDK-8077392 is still unresolved, >>>>>> but progress is being made. >>>>>> >>>>>> src/share/vm/runtime/synchronizer.cpp >>>>>> src/share/vm/runtime/synchronizer.hpp >>>>>> - Add ObjectSynchronizer::quick_notify() that implements the >>>>>> new "fast notify" code paths >>>>>> - The new code handles a couple of special cases where the >>>>>> "notify" can be done without the heavy weight slow-path >>>>>> (thread state transitions and other baggage) >>>>>> >>>>>> >>>>> >>>>> >>>>> >>>> >> From harold.seigel at oracle.com Tue Jul 21 13:49:04 2015 From: harold.seigel at oracle.com (harold seigel) Date: Tue, 21 Jul 2015 09:49:04 -0400 Subject: RFR(XS) 8129895: New verifier fails to reject erroneous cast from int[] to other arrays of small integer types In-Reply-To: <55ADA50D.9090208@oracle.com> References: <55AD3E04.6080900@oracle.com> <55ADA50D.9090208@oracle.com> Message-ID: <55AE4DD0.8040901@oracle.com> Hi David, Thanks for the review. The new function is named is_component_assignable_from() because it is similar to existing function is_assignable_from(). Also, the purpose of the function is to check assignability of array components. It just so happens that assignability for the integer primitives is determined by identity, but that is not so for other array components that it checks. >> I'm also wondering what the situation is with long[], float[] and double[]? The verifier correctly throws VerifyError when checking assignability between arrays of different primitive types in cases of longs, floats, and doubles. Thanks, Harold The new function checks for assignability of array components. For int On 7/20/2015 9:49 PM, David Holmes wrote: > Hi Harold, > > On 21/07/2015 4:29 AM, harold seigel wrote: >> Hi, >> >> Please review this small change to fix bug 8129895. The split verifier >> erroneously allows arrays of primitive ints to be assignable to arrays >> of Booleans, bytes, chars, and shorts. This fix adds a new function >> (is_component_assignable_from()) for explicitly checking assign-ability >> of array components. The new function requires that primitive array >> components be identical for assign-ability. >> >> Open webrev: http://cr.openjdk.java.net/~hseigel/bug_8129895/ > > My only nit here is that "is_assignable" doesn't reflect the actual > check - it's is-equal for the primitives not is-assignable. > > I'm also wondering what the situation is with long[], float[] and > double[]? > > Thanks, > David > >> JBS Bug: https://bugs.openjdk.java.net/browse/JDK-8129895 >> >> The fix was tested with JCK Lang and VM tests, the UTE quick and split >> verifier tests, and the hotspot, and JDK vm, java/io, java/lang, and >> java/util JTreg tests. >> >> Thanks, Harold From harold.seigel at oracle.com Tue Jul 21 20:21:33 2015 From: harold.seigel at oracle.com (harold seigel) Date: Tue, 21 Jul 2015 16:21:33 -0400 Subject: RFR(XS) 8129897: Old verifier fails to reject erroneous cast from boolean[] to byte[] Message-ID: <55AEA9CD.1000102@oracle.com> Hi, Please review this small change to fix bug 8129897. The old verifier treats arrays of Booleans as arrays of bytes, allowing assignability between them. This fix distinguishes between arrays of Booleans and arrays of bytes and so disallows assignability between them. Additional changes were needed to make sure operands to baload and similar opcodes could still be either Boolean or byte arrays. Open webrev: http://cr.openjdk.java.net/~hseigel/bug_8129897/ JBS Bug: https://bugs.openjdk.java.net/browse/JDK-8129897 The fix was tested with JCK Lang and VM tests, the UTE quick and split verifier tests, and the hotspot, and JDK vm, java/io, java/lang, and java/util JTreg tests. This scenario will be tested by JCK-9. So no regression test was included in this webrev. Thanks, Harold From david.holmes at oracle.com Tue Jul 21 23:44:19 2015 From: david.holmes at oracle.com (David Holmes) Date: Wed, 22 Jul 2015 09:44:19 +1000 Subject: RFR(XS) 8129897: Old verifier fails to reject erroneous cast from boolean[] to byte[] In-Reply-To: <55AEA9CD.1000102@oracle.com> References: <55AEA9CD.1000102@oracle.com> Message-ID: <55AED953.9060904@oracle.com> Hi Harold, On 22/07/2015 6:21 AM, harold seigel wrote: > Hi, > > Please review this small change to fix bug 8129897. The old verifier > treats arrays of Booleans as arrays of bytes, allowing assignability > between them. This fix distinguishes between arrays of Booleans and > arrays of bytes and so disallows assignability between them. Additional > changes were needed to make sure operands to baload and similar opcodes > could still be either Boolean or byte arrays. > > Open webrev: http://cr.openjdk.java.net/~hseigel/bug_8129897/ Seems reasonable. Only query I have was why you didn't split this: 2256 case 'B': case 'Z': /* array of bytes or booleans */ 2257 if (top_type != MAKE_FULLINFO(ITEM_Byte, 1, 0) && 2258 top_type != MAKE_FULLINFO(ITEM_Boolean, 1, 0)) 2259 CCerror(context, 2260 "Expecting to find array of bytes or Booleans on stack"); 2261 break; into two distinct cases? Thanks, David > JBS Bug: https://bugs.openjdk.java.net/browse/JDK-8129897 > > The fix was tested with JCK Lang and VM tests, the UTE quick and split > verifier tests, and the hotspot, and JDK vm, java/io, java/lang, and > java/util JTreg tests. > > This scenario will be tested by JCK-9. So no regression test was > included in this webrev. > > Thanks, Harold From lois.foltan at oracle.com Wed Jul 22 01:00:13 2015 From: lois.foltan at oracle.com (Lois Foltan) Date: Tue, 21 Jul 2015 21:00:13 -0400 Subject: RFR(XS) 8129897: Old verifier fails to reject erroneous cast from boolean[] to byte[] In-Reply-To: <55AEA9CD.1000102@oracle.com> References: <55AEA9CD.1000102@oracle.com> Message-ID: <55AEEB1D.4020906@oracle.com> Looks good. I am curious about David's question concerning the "case 'B': case 'Z':" statement, though. Lois On 7/21/2015 4:21 PM, harold seigel wrote: > Hi, > > Please review this small change to fix bug 8129897. The old verifier > treats arrays of Booleans as arrays of bytes, allowing assignability > between them. This fix distinguishes between arrays of Booleans and > arrays of bytes and so disallows assignability between them. > Additional changes were needed to make sure operands to baload and > similar opcodes could still be either Boolean or byte arrays. > > Open webrev: http://cr.openjdk.java.net/~hseigel/bug_8129897/ > > JBS Bug: https://bugs.openjdk.java.net/browse/JDK-8129897 > > The fix was tested with JCK Lang and VM tests, the UTE quick and split > verifier tests, and the hotspot, and JDK vm, java/io, java/lang, and > java/util JTreg tests. > > This scenario will be tested by JCK-9. So no regression test was > included in this webrev. > > Thanks, Harold From david.holmes at oracle.com Wed Jul 22 01:31:02 2015 From: david.holmes at oracle.com (David Holmes) Date: Wed, 22 Jul 2015 11:31:02 +1000 Subject: RFR(XS) 8129895: New verifier fails to reject erroneous cast from int[] to other arrays of small integer types In-Reply-To: <55AE4DD0.8040901@oracle.com> References: <55AD3E04.6080900@oracle.com> <55ADA50D.9090208@oracle.com> <55AE4DD0.8040901@oracle.com> Message-ID: <55AEF256.1010102@oracle.com> Hi Harold, Thanks for clarifying. Good to go. David On 21/07/2015 11:49 PM, harold seigel wrote: > Hi David, > > Thanks for the review. > > The new function is named is_component_assignable_from() because it is > similar to existing function is_assignable_from(). Also, the purpose of > the function is to check assignability of array components. It just so > happens that assignability for the integer primitives is determined by > identity, but that is not so for other array components that it checks. > > >> I'm also wondering what the situation is with long[], float[] and > double[]? > The verifier correctly throws VerifyError when checking assignability > between arrays of different primitive types in cases of longs, floats, > and doubles. > > Thanks, Harold > > The new function checks for assignability of array components. For int > On 7/20/2015 9:49 PM, David Holmes wrote: >> Hi Harold, >> >> On 21/07/2015 4:29 AM, harold seigel wrote: >>> Hi, >>> >>> Please review this small change to fix bug 8129895. The split verifier >>> erroneously allows arrays of primitive ints to be assignable to arrays >>> of Booleans, bytes, chars, and shorts. This fix adds a new function >>> (is_component_assignable_from()) for explicitly checking assign-ability >>> of array components. The new function requires that primitive array >>> components be identical for assign-ability. >>> >>> Open webrev: http://cr.openjdk.java.net/~hseigel/bug_8129895/ >> >> My only nit here is that "is_assignable" doesn't reflect the actual >> check - it's is-equal for the primitives not is-assignable. >> >> I'm also wondering what the situation is with long[], float[] and >> double[]? >> >> Thanks, >> David >> >>> JBS Bug: https://bugs.openjdk.java.net/browse/JDK-8129895 >>> >>> The fix was tested with JCK Lang and VM tests, the UTE quick and split >>> verifier tests, and the hotspot, and JDK vm, java/io, java/lang, and >>> java/util JTreg tests. >>> >>> Thanks, Harold > From harold.seigel at oracle.com Wed Jul 22 12:01:54 2015 From: harold.seigel at oracle.com (harold seigel) Date: Wed, 22 Jul 2015 08:01:54 -0400 Subject: RFR(XS) 8129895: New verifier fails to reject erroneous cast from int[] to other arrays of small integer types In-Reply-To: <55AEF256.1010102@oracle.com> References: <55AD3E04.6080900@oracle.com> <55ADA50D.9090208@oracle.com> <55AE4DD0.8040901@oracle.com> <55AEF256.1010102@oracle.com> Message-ID: <55AF8632.5050006@oracle.com> Thanks David! Harold On 7/21/2015 9:31 PM, David Holmes wrote: > Hi Harold, > > Thanks for clarifying. Good to go. > > David > > On 21/07/2015 11:49 PM, harold seigel wrote: >> Hi David, >> >> Thanks for the review. >> >> The new function is named is_component_assignable_from() because it is >> similar to existing function is_assignable_from(). Also, the purpose of >> the function is to check assignability of array components. It just so >> happens that assignability for the integer primitives is determined by >> identity, but that is not so for other array components that it checks. >> >> >> I'm also wondering what the situation is with long[], float[] and >> double[]? >> The verifier correctly throws VerifyError when checking assignability >> between arrays of different primitive types in cases of longs, floats, >> and doubles. >> >> Thanks, Harold >> >> The new function checks for assignability of array components. For int >> On 7/20/2015 9:49 PM, David Holmes wrote: >>> Hi Harold, >>> >>> On 21/07/2015 4:29 AM, harold seigel wrote: >>>> Hi, >>>> >>>> Please review this small change to fix bug 8129895. The split >>>> verifier >>>> erroneously allows arrays of primitive ints to be assignable to arrays >>>> of Booleans, bytes, chars, and shorts. This fix adds a new function >>>> (is_component_assignable_from()) for explicitly checking >>>> assign-ability >>>> of array components. The new function requires that primitive array >>>> components be identical for assign-ability. >>>> >>>> Open webrev: http://cr.openjdk.java.net/~hseigel/bug_8129895/ >>> >>> My only nit here is that "is_assignable" doesn't reflect the actual >>> check - it's is-equal for the primitives not is-assignable. >>> >>> I'm also wondering what the situation is with long[], float[] and >>> double[]? >>> >>> Thanks, >>> David >>> >>>> JBS Bug: https://bugs.openjdk.java.net/browse/JDK-8129895 >>>> >>>> The fix was tested with JCK Lang and VM tests, the UTE quick and split >>>> verifier tests, and the hotspot, and JDK vm, java/io, java/lang, and >>>> java/util JTreg tests. >>>> >>>> Thanks, Harold >> From harold.seigel at oracle.com Wed Jul 22 15:06:11 2015 From: harold.seigel at oracle.com (harold seigel) Date: Wed, 22 Jul 2015 11:06:11 -0400 Subject: RFR(XS) 8129897: Old verifier fails to reject erroneous cast from boolean[] to byte[] In-Reply-To: <55AED953.9060904@oracle.com> References: <55AEA9CD.1000102@oracle.com> <55AED953.9060904@oracle.com> Message-ID: <55AFB163.908@oracle.com> Hi David, Thanks for the review! I updated lines 2256- 2261 in a new webrev: http://cr.openjdk.java.net/~hseigel/bug_8129897.2/ Here are the new lines: 2256 case 'B': /* array of bytes or booleans */ 2257 if (top_type != MAKE_FULLINFO(ITEM_Byte, 1, 0) && 2258 top_type != MAKE_FULLINFO(ITEM_Boolean, 1, 0)) 2259 CCerror(context, 2260 "Expecting to find array of bytes or Booleans on stack"); 2261 break; File jdk/src/java.base/share/native/libverify/opcodes.in_out defines the first operand for opcodes baload and bastore as [B. But, according to the JVM Spec, the first operand for these bytecodes can be either [B or [Z. This code checks that the opcodes, that opcodes.in_out says expect [B, do not throw VerifyError if their actual operand is either [B or [Z. Opcodes baload and bastore are the only opcodes in opcodes.in_out with [B operands, and that's unlikely to change. I removed "case 'Z': because there are no [Z operands for any opcodes in opcodes.in_out. Thanks, Harold On 7/21/2015 7:44 PM, David Holmes wrote: > Hi Harold, > > On 22/07/2015 6:21 AM, harold seigel wrote: >> Hi, >> >> Please review this small change to fix bug 8129897. The old verifier >> treats arrays of Booleans as arrays of bytes, allowing assignability >> between them. This fix distinguishes between arrays of Booleans and >> arrays of bytes and so disallows assignability between them. Additional >> changes were needed to make sure operands to baload and similar opcodes >> could still be either Boolean or byte arrays. >> >> Open webrev: http://cr.openjdk.java.net/~hseigel/bug_8129897/ > > Seems reasonable. Only query I have was why you didn't split this: > > 2256 case 'B': case 'Z': /* array of bytes or > booleans */ > 2257 if (top_type != MAKE_FULLINFO(ITEM_Byte, > 1, 0) && > 2258 top_type != > MAKE_FULLINFO(ITEM_Boolean, 1, 0)) > 2259 CCerror(context, > 2260 "Expecting to find array of > bytes or Booleans on stack"); > 2261 break; > > into two distinct cases? > > Thanks, > David > >> JBS Bug: https://bugs.openjdk.java.net/browse/JDK-8129897 >> >> The fix was tested with JCK Lang and VM tests, the UTE quick and split >> verifier tests, and the hotspot, and JDK vm, java/io, java/lang, and >> java/util JTreg tests. >> >> This scenario will be tested by JCK-9. So no regression test was >> included in this webrev. >> >> Thanks, Harold From harold.seigel at oracle.com Wed Jul 22 15:12:15 2015 From: harold.seigel at oracle.com (harold seigel) Date: Wed, 22 Jul 2015 11:12:15 -0400 Subject: RFR(XS) 8129897: Old verifier fails to reject erroneous cast from boolean[] to byte[] In-Reply-To: <55AEEB1D.4020906@oracle.com> References: <55AEA9CD.1000102@oracle.com> <55AEEB1D.4020906@oracle.com> Message-ID: <55AFB2CF.1060700@oracle.com> Hi Lois, Thanks for the review. Please see my reply to David's comments. Thanks, Harold On 7/21/2015 9:00 PM, Lois Foltan wrote: > Looks good. I am curious about David's question concerning the "case > 'B': case 'Z':" statement, though. > Lois > > On 7/21/2015 4:21 PM, harold seigel wrote: >> Hi, >> >> Please review this small change to fix bug 8129897. The old verifier >> treats arrays of Booleans as arrays of bytes, allowing assignability >> between them. This fix distinguishes between arrays of Booleans and >> arrays of bytes and so disallows assignability between them. >> Additional changes were needed to make sure operands to baload and >> similar opcodes could still be either Boolean or byte arrays. >> >> Open webrev: http://cr.openjdk.java.net/~hseigel/bug_8129897/ >> >> JBS Bug: https://bugs.openjdk.java.net/browse/JDK-8129897 >> >> The fix was tested with JCK Lang and VM tests, the UTE quick and >> split verifier tests, and the hotspot, and JDK vm, java/io, >> java/lang, and java/util JTreg tests. >> >> This scenario will be tested by JCK-9. So no regression test was >> included in this webrev. >> >> Thanks, Harold > From coleen.phillimore at oracle.com Wed Jul 22 17:22:12 2015 From: coleen.phillimore at oracle.com (Coleen Phillimore) Date: Wed, 22 Jul 2015 13:22:12 -0400 Subject: RFR 8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine Message-ID: <55AFD144.9010102@oracle.com> Summary: Need to get source_file_name from the_class's constant pool not previous version constant pool open webrev at http://cr.openjdk.java.net/~coleenp/8087315.01/ bug link https://bugs.openjdk.java.net/browse/JDK-8087315 Tested with added test (yay!), RBT (remote build and test), vm.redefine.testlist, jdk/test/java/lang/instrument and failing testcase 1000 times (reproduced <400). Thanks, Coleen From jeremymanson at google.com Wed Jul 22 18:22:14 2015 From: jeremymanson at google.com (Jeremy Manson) Date: Wed, 22 Jul 2015 11:22:14 -0700 Subject: os::current_thread_id on Linux Message-ID: Hey folks, os::current_thread_id on Linux now maps to pthread_self. The problem with pthread_self is that it only makes sense in the context of the running process. When it is written out to the log (as it is in several places), there really isn't a way (AFAICT) for the user to map it back to anything useful. As it happens, that value is mostly used to write to the log. The places where it doesn't do so don't seem to need to use pthread_self for any particular reason. Meanwhile, the SIGQUIT stack dump uses java_thread->osthread()->thread_id() as the nid. On Linux, that maps back to os::Linux::gettid(), whish is also what gets exposed in /proc. That makes it much easier to see what threads might be doing the log write. Would it be okay to change os::current_thread_id to point to os::Linux::gettid()? That way, it can be mapped back to the output of a SIGQUIT dump. The downside of gettid() is that it is only available on Linux>2.4.11, but that dates from 2001. If we really still want to support it, we could check for that. Thoughts? Jeremy From dmitry.samersoff at oracle.com Wed Jul 22 18:52:38 2015 From: dmitry.samersoff at oracle.com (Dmitry Samersoff) Date: Wed, 22 Jul 2015 21:52:38 +0300 Subject: os::current_thread_id on Linux In-Reply-To: References: Message-ID: <55AFE676.3080806@oracle.com> Jeremy, Please take in account that gettid() returns a value that unique for the *running threads* across a system. I.e. for long running java process gettid() can return a value that was previously assigned to one of dead threads. -Dmitry On 2015-07-22 21:22, Jeremy Manson wrote: > Hey folks, > > os::current_thread_id on Linux now maps to pthread_self. The problem with > pthread_self is that it only makes sense in the context of the running > process. When it is written out to the log (as it is in several places), > there really isn't a way (AFAICT) for the user to map it back to anything > useful. > > As it happens, that value is mostly used to write to the log. The places > where it doesn't do so don't seem to need to use pthread_self for any > particular reason. > > Meanwhile, the SIGQUIT stack dump uses java_thread->osthread()->thread_id() > as the nid. On Linux, that maps back to os::Linux::gettid(), whish is also > what gets exposed in /proc. That makes it much easier to see what threads > might be doing the log write. > > Would it be okay to change os::current_thread_id to point > to os::Linux::gettid()? That way, it can be mapped back to the output of a > SIGQUIT dump. > > The downside of gettid() is that it is only available on Linux>2.4.11, but > that dates from 2001. If we really still want to support it, we could > check for that. > > Thoughts? > > Jeremy > -- Dmitry Samersoff Oracle Java development team, Saint Petersburg, Russia * I would love to change the world, but they won't give me the sources. From jeremymanson at google.com Wed Jul 22 18:52:49 2015 From: jeremymanson at google.com (Jeremy Manson) Date: Wed, 22 Jul 2015 11:52:49 -0700 Subject: os::current_thread_id on Linux In-Reply-To: References: Message-ID: Example of where this would help: Current output of SIGQUIT: "C1 CompilerThread3" #8 daemon prio=9 os_prio=0 tid=0x00007f0890247800 nid=0x2e3d waiting on condition [0x0000000000000000] java.lang.Thread.State: RUNNABLE "C2 CompilerThread2" #7 daemon prio=9 os_prio=0 tid=0x00007f0890245000 nid=0x2e3c waiting on condition [0x0000000000000000] java.lang.Thread.State: RUNNABLE "C2 CompilerThread1" #6 daemon prio=9 os_prio=0 tid=0x00007f0890243800 nid=0x2e3b waiting on condition [0x0000000000000000] java.lang.Thread.State: RUNNABLE "C2 CompilerThread0" #5 daemon prio=9 os_prio=0 tid=0x00007f0890240800 nid=0x2e3a waiting on condition [0x0000000000000000] java.lang.Thread.State: RUNNABLE Current directory listing from /tmp with -XX:+UnlockDiagnosticVMOptions -XX:+LogCompilation: $ ls -d /tmp/hs* hs_c139673756251904_pid11818.log hs_c139673759409920_pid11818.log hs_c139673757304576_pid11818.log hsperfdata_jeremymanson/ hs_c139673758357248_pid11818.log hsperfdata_root/ Output with this change would look like: $ ls -d /tmp/hs* hs_c11837_pid11818.log hs_c11834_pid11818.log hs_c11836_pid11818.log hsperfdata_jeremymanson/ hs_c11835_pid11818.log hsperfdata_root/ Where 1183x maps neatly back to 0x2e3x in the SIGQUIT dump. Jeremy On Wed, Jul 22, 2015 at 11:22 AM, Jeremy Manson wrote: > Hey folks, > > os::current_thread_id on Linux now maps to pthread_self. The problem with > pthread_self is that it only makes sense in the context of the running > process. When it is written out to the log (as it is in several places), > there really isn't a way (AFAICT) for the user to map it back to anything > useful. > > As it happens, that value is mostly used to write to the log. The places > where it doesn't do so don't seem to need to use pthread_self for any > particular reason. > > Meanwhile, the SIGQUIT stack dump > uses java_thread->osthread()->thread_id() as the nid. On Linux, that maps > back to os::Linux::gettid(), whish is also what gets exposed in /proc. > That makes it much easier to see what threads might be doing the log write. > > Would it be okay to change os::current_thread_id to point > to os::Linux::gettid()? That way, it can be mapped back to the output of a > SIGQUIT dump. > > The downside of gettid() is that it is only available on Linux>2.4.11, but > that dates from 2001. If we really still want to support it, we could > check for that. > > Thoughts? > > Jeremy > From jeremymanson at google.com Wed Jul 22 18:53:55 2015 From: jeremymanson at google.com (Jeremy Manson) Date: Wed, 22 Jul 2015 11:53:55 -0700 Subject: os::current_thread_id on Linux In-Reply-To: <55AFE676.3080806@oracle.com> References: <55AFE676.3080806@oracle.com> Message-ID: That's also true of pthread_self. From the man page: Thread IDs are guaranteed to be unique only within a process. A thread ID may be reused after a terminated thread has been joined, or a detached thread has terminated. Jeremy On Wed, Jul 22, 2015 at 11:52 AM, Dmitry Samersoff < dmitry.samersoff at oracle.com> wrote: > Jeremy, > > Please take in account that gettid() returns a value that unique for > the *running threads* across a system. > > I.e. for long running java process gettid() can return a value that was > previously assigned to one of dead threads. > > -Dmitry > > > On 2015-07-22 21:22, Jeremy Manson wrote: > > Hey folks, > > > > os::current_thread_id on Linux now maps to pthread_self. The problem > with > > pthread_self is that it only makes sense in the context of the running > > process. When it is written out to the log (as it is in several places), > > there really isn't a way (AFAICT) for the user to map it back to anything > > useful. > > > > As it happens, that value is mostly used to write to the log. The places > > where it doesn't do so don't seem to need to use pthread_self for any > > particular reason. > > > > Meanwhile, the SIGQUIT stack dump uses > java_thread->osthread()->thread_id() > > as the nid. On Linux, that maps back to os::Linux::gettid(), whish is > also > > what gets exposed in /proc. That makes it much easier to see what > threads > > might be doing the log write. > > > > Would it be okay to change os::current_thread_id to point > > to os::Linux::gettid()? That way, it can be mapped back to the output > of a > > SIGQUIT dump. > > > > The downside of gettid() is that it is only available on Linux>2.4.11, > but > > that dates from 2001. If we really still want to support it, we could > > check for that. > > > > Thoughts? > > > > Jeremy > > > > > -- > Dmitry Samersoff > Oracle Java development team, Saint Petersburg, Russia > * I would love to change the world, but they won't give me the sources. > From coleen.phillimore at oracle.com Wed Jul 22 19:15:53 2015 From: coleen.phillimore at oracle.com (Coleen Phillimore) Date: Wed, 22 Jul 2015 15:15:53 -0400 Subject: os::current_thread_id on Linux In-Reply-To: References: Message-ID: <55AFEBE9.2090707@oracle.com> With this change would it change this output to os::Linux::gettid() in decimal, ie the smaller number? I take it this is long hex number is pthread_self? To debug, run 'gdb /proc/12549/exe 12549'; then switch to thread 140452715837184 (0x00007fbdb23c3700) the hs_err_log file has: *Current thread (0x00007fbda8011000): JavaThread "main" [_thread_in_vm, id=12550, stack(0x00007fbdb22 c3000,0x00007fbdb23c4000)] *I'd rather see 12550 which is so much easier to find in gdb (gdb still has this number I believe I just verified this). There is anywhere else in the JVM where pthread_self is more correct than the tid? If not, which I think you've stated, this sounds really good to me. Coleen On 7/22/15 2:52 PM, Jeremy Manson wrote: > Example of where this would help: > > Current output of SIGQUIT: > > "C1 CompilerThread3" #8 daemon prio=9 os_prio=0 tid=0x00007f0890247800 > nid=0x2e3d waiting on condition [0x0000000000000000] > java.lang.Thread.State: RUNNABLE > > "C2 CompilerThread2" #7 daemon prio=9 os_prio=0 tid=0x00007f0890245000 > nid=0x2e3c waiting on condition [0x0000000000000000] > java.lang.Thread.State: RUNNABLE > > "C2 CompilerThread1" #6 daemon prio=9 os_prio=0 tid=0x00007f0890243800 > nid=0x2e3b waiting on condition [0x0000000000000000] > java.lang.Thread.State: RUNNABLE > > "C2 CompilerThread0" #5 daemon prio=9 os_prio=0 tid=0x00007f0890240800 > nid=0x2e3a waiting on condition [0x0000000000000000] > java.lang.Thread.State: RUNNABLE > > Current directory listing from /tmp with -XX:+UnlockDiagnosticVMOptions > -XX:+LogCompilation: > > $ ls -d /tmp/hs* > hs_c139673756251904_pid11818.log hs_c139673759409920_pid11818.log > hs_c139673757304576_pid11818.log hsperfdata_jeremymanson/ > hs_c139673758357248_pid11818.log hsperfdata_root/ > > > Output with this change would look like: > > $ ls -d /tmp/hs* > hs_c11837_pid11818.log hs_c11834_pid11818.log > hs_c11836_pid11818.log hsperfdata_jeremymanson/ > hs_c11835_pid11818.log hsperfdata_root/ > > Where 1183x maps neatly back to 0x2e3x in the SIGQUIT dump. > > Jeremy > > On Wed, Jul 22, 2015 at 11:22 AM, Jeremy Manson > wrote: > >> Hey folks, >> >> os::current_thread_id on Linux now maps to pthread_self. The problem with >> pthread_self is that it only makes sense in the context of the running >> process. When it is written out to the log (as it is in several places), >> there really isn't a way (AFAICT) for the user to map it back to anything >> useful. >> >> As it happens, that value is mostly used to write to the log. The places >> where it doesn't do so don't seem to need to use pthread_self for any >> particular reason. >> >> Meanwhile, the SIGQUIT stack dump >> uses java_thread->osthread()->thread_id() as the nid. On Linux, that maps >> back to os::Linux::gettid(), whish is also what gets exposed in /proc. >> That makes it much easier to see what threads might be doing the log write. >> >> Would it be okay to change os::current_thread_id to point >> to os::Linux::gettid()? That way, it can be mapped back to the output of a >> SIGQUIT dump. >> >> The downside of gettid() is that it is only available on Linux>2.4.11, but >> that dates from 2001. If we really still want to support it, we could >> check for that. >> >> Thoughts? >> >> Jeremy >> From jeremymanson at google.com Wed Jul 22 19:46:38 2015 From: jeremymanson at google.com (Jeremy Manson) Date: Wed, 22 Jul 2015 12:46:38 -0700 Subject: os::current_thread_id on Linux In-Reply-To: <55AFEBE9.2090707@oracle.com> References: <55AFEBE9.2090707@oracle.com> Message-ID: On Wed, Jul 22, 2015 at 12:15 PM, Coleen Phillimore < coleen.phillimore at oracle.com> wrote: > > With this change would it change this output to os::Linux::gettid() in > decimal, ie the smaller number? I take it this is long hex number is > pthread_self? > The long hex number in the SIGQUIT output is the address of the thread object. It doesn't map to pthread_self. So there is no current way to map the compiler thread id back to the sigquit output. > To debug, run 'gdb /proc/12549/exe 12549'; then switch to thread > 140452715837184 (0x00007fbdb23c3700) > > the hs_err_log file has: > > *Current thread (0x00007fbda8011000): JavaThread "main" [_thread_in_vm, > id=12550, stack(0x00007fbdb22 > c3000,0x00007fbdb23c4000)] > > *I'd rather see 12550 which is so much easier to find in gdb (gdb still > has this number I believe I just verified this). There is anywhere else in > the JVM where pthread_self is more correct than the tid? If not, which I > think you've stated, this sounds really good to me. It's used to indicate thread ownership of resources in a couple of places, but there was nothing about pthread_self that seemed more correct to me in those places. If you are willing to sponsor, I can file a bug and send a change for review. Thanks! Jeremy > > > Coleen > > > On 7/22/15 2:52 PM, Jeremy Manson wrote: > >> Example of where this would help: >> >> Current output of SIGQUIT: >> >> "C1 CompilerThread3" #8 daemon prio=9 os_prio=0 tid=0x00007f0890247800 >> nid=0x2e3d waiting on condition [0x0000000000000000] >> java.lang.Thread.State: RUNNABLE >> >> "C2 CompilerThread2" #7 daemon prio=9 os_prio=0 tid=0x00007f0890245000 >> nid=0x2e3c waiting on condition [0x0000000000000000] >> java.lang.Thread.State: RUNNABLE >> >> "C2 CompilerThread1" #6 daemon prio=9 os_prio=0 tid=0x00007f0890243800 >> nid=0x2e3b waiting on condition [0x0000000000000000] >> java.lang.Thread.State: RUNNABLE >> >> "C2 CompilerThread0" #5 daemon prio=9 os_prio=0 tid=0x00007f0890240800 >> nid=0x2e3a waiting on condition [0x0000000000000000] >> java.lang.Thread.State: RUNNABLE >> >> Current directory listing from /tmp with -XX:+UnlockDiagnosticVMOptions >> -XX:+LogCompilation: >> >> $ ls -d /tmp/hs* >> hs_c139673756251904_pid11818.log hs_c139673759409920_pid11818.log >> hs_c139673757304576_pid11818.log hsperfdata_jeremymanson/ >> hs_c139673758357248_pid11818.log hsperfdata_root/ >> >> >> Output with this change would look like: >> >> $ ls -d /tmp/hs* >> hs_c11837_pid11818.log hs_c11834_pid11818.log >> hs_c11836_pid11818.log hsperfdata_jeremymanson/ >> hs_c11835_pid11818.log hsperfdata_root/ >> >> Where 1183x maps neatly back to 0x2e3x in the SIGQUIT dump. >> >> Jeremy >> >> On Wed, Jul 22, 2015 at 11:22 AM, Jeremy Manson >> wrote: >> >> Hey folks, >>> >>> os::current_thread_id on Linux now maps to pthread_self. The problem >>> with >>> pthread_self is that it only makes sense in the context of the running >>> process. When it is written out to the log (as it is in several places), >>> there really isn't a way (AFAICT) for the user to map it back to anything >>> useful. >>> >>> As it happens, that value is mostly used to write to the log. The places >>> where it doesn't do so don't seem to need to use pthread_self for any >>> particular reason. >>> >>> Meanwhile, the SIGQUIT stack dump >>> uses java_thread->osthread()->thread_id() as the nid. On Linux, that >>> maps >>> back to os::Linux::gettid(), whish is also what gets exposed in /proc. >>> That makes it much easier to see what threads might be doing the log >>> write. >>> >>> Would it be okay to change os::current_thread_id to point >>> to os::Linux::gettid()? That way, it can be mapped back to the output >>> of a >>> SIGQUIT dump. >>> >>> The downside of gettid() is that it is only available on Linux>2.4.11, >>> but >>> that dates from 2001. If we really still want to support it, we could >>> check for that. >>> >>> Thoughts? >>> >>> Jeremy >>> >>> > From jeremymanson at google.com Wed Jul 22 21:14:31 2015 From: jeremymanson at google.com (Jeremy Manson) Date: Wed, 22 Jul 2015 14:14:31 -0700 Subject: os::current_thread_id on Linux In-Reply-To: <55B006C4.8010202@kippdata.de> References: <55B006C4.8010202@kippdata.de> Message-ID: Right. Those values were taken off of actual output from a JVM. I think that, generally, they will be relatively close to each other in memory, but not actually the same. That jibes with one being pthread_self and the other being the address of the JVM's thread object - they would be created at roughly the same time. Since no one has noticed this for the O(years) that it has been in place, I argue that no one is relying on this behavior. :) Jeremy On Wed, Jul 22, 2015 at 2:10 PM, Rainer Jung wrote: > Am 22.07.2015 um 20:52 schrieb Jeremy Manson: > >> Example of where this would help: >> >> Current output of SIGQUIT: >> >> "C1 CompilerThread3" #8 daemon prio=9 os_prio=0 tid=0x00007f0890247800 >> nid=0x2e3d waiting on condition [0x0000000000000000] >> java.lang.Thread.State: RUNNABLE >> >> "C2 CompilerThread2" #7 daemon prio=9 os_prio=0 tid=0x00007f0890245000 >> nid=0x2e3c waiting on condition [0x0000000000000000] >> java.lang.Thread.State: RUNNABLE >> >> "C2 CompilerThread1" #6 daemon prio=9 os_prio=0 tid=0x00007f0890243800 >> nid=0x2e3b waiting on condition [0x0000000000000000] >> java.lang.Thread.State: RUNNABLE >> >> "C2 CompilerThread0" #5 daemon prio=9 os_prio=0 tid=0x00007f0890240800 >> nid=0x2e3a waiting on condition [0x0000000000000000] >> java.lang.Thread.State: RUNNABLE >> >> Current directory listing from /tmp with -XX:+UnlockDiagnosticVMOptions >> -XX:+LogCompilation: >> >> $ ls -d /tmp/hs* >> hs_c139673756251904_pid11818.log hs_c139673759409920_pid11818.log >> hs_c139673757304576_pid11818.log hsperfdata_jeremymanson/ >> hs_c139673758357248_pid11818.log hsperfdata_root/ >> >> >> Output with this change would look like: >> >> $ ls -d /tmp/hs* >> hs_c11837_pid11818.log hs_c11834_pid11818.log >> hs_c11836_pid11818.log hsperfdata_jeremymanson/ >> hs_c11835_pid11818.log hsperfdata_root/ >> >> Where 1183x maps neatly back to 0x2e3x in the SIGQUIT dump. >> > > I always though the other thread id is the tid printed above. At least I > vaguely remember to have successfully used that id to match against thread > IDs as ouput by the gstack command. In your concrete example above, tid and > long thread ID do not exactly match though, e.g. > > 139673756251904 = 0x00007f0854a03700 > > Regards, > > Rainer > From martinrb at google.com Wed Jul 22 21:51:37 2015 From: martinrb at google.com (Martin Buchholz) Date: Wed, 22 Jul 2015 14:51:37 -0700 Subject: os::current_thread_id on Linux In-Reply-To: References: <55B006C4.8010202@kippdata.de> Message-ID: It would be nice if even internal hotspot APIs had clear specs. All we have now is: // thread id on Linux/64bit is 64bit, on Windows and Solaris, it's 32bit static intx current_thread_id(); pthread_self() is documented as being an opaque value that cannot necessarily be stored in a native integral type, so casting to intx is a bit bogus. (but yeah, this is hotspot, we can get away with non-portable code) For debugging purposes, it would be nice to have convenient access to all of the various "current thread" values: pthread_self(), gettid(), hotspot C++ thread object, java thread object, java thread id. But that doesn't fit with a function returning intx, and whose uniqueness is also used for locking. From jeremymanson at google.com Wed Jul 22 22:01:20 2015 From: jeremymanson at google.com (Jeremy Manson) Date: Wed, 22 Jul 2015 15:01:20 -0700 Subject: os::current_thread_id on Linux In-Reply-To: References: Message-ID: Based on the feedback, this seems to be a good idea, approximately. Coleen would have sponsored, but she's going on vacation. Anyone else feel like sponsoring? Jeremy On Wed, Jul 22, 2015 at 11:22 AM, Jeremy Manson wrote: > Hey folks, > > os::current_thread_id on Linux now maps to pthread_self. The problem with > pthread_self is that it only makes sense in the context of the running > process. When it is written out to the log (as it is in several places), > there really isn't a way (AFAICT) for the user to map it back to anything > useful. > > As it happens, that value is mostly used to write to the log. The places > where it doesn't do so don't seem to need to use pthread_self for any > particular reason. > > Meanwhile, the SIGQUIT stack dump > uses java_thread->osthread()->thread_id() as the nid. On Linux, that maps > back to os::Linux::gettid(), whish is also what gets exposed in /proc. > That makes it much easier to see what threads might be doing the log write. > > Would it be okay to change os::current_thread_id to point > to os::Linux::gettid()? That way, it can be mapped back to the output of a > SIGQUIT dump. > > The downside of gettid() is that it is only available on Linux>2.4.11, but > that dates from 2001. If we really still want to support it, we could > check for that. > > Thoughts? > > Jeremy > From coleen.phillimore at oracle.com Wed Jul 22 22:25:25 2015 From: coleen.phillimore at oracle.com (Coleen Phillimore) Date: Wed, 22 Jul 2015 18:25:25 -0400 Subject: RFR 8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine In-Reply-To: <55AFD144.9010102@oracle.com> References: <55AFD144.9010102@oracle.com> Message-ID: <55B01855.6090400@oracle.com> This version contains test improvements suggested offline by Christian. open webrev at http://cr.openjdk.java.net/~coleenp/8082782.02/ Coleen On 7/22/15 1:22 PM, Coleen Phillimore wrote: > Summary: Need to get source_file_name from the_class's constant pool > not previous version constant pool > > open webrev at http://cr.openjdk.java.net/~coleenp/8087315.01/ > bug link https://bugs.openjdk.java.net/browse/JDK-8087315 > > Tested with added test (yay!), RBT (remote build and test), > vm.redefine.testlist, jdk/test/java/lang/instrument and failing > testcase 1000 times (reproduced <400). > > Thanks, > Coleen From daniel.daugherty at oracle.com Thu Jul 23 00:57:58 2015 From: daniel.daugherty at oracle.com (Daniel D. Daugherty) Date: Wed, 22 Jul 2015 18:57:58 -0600 Subject: RFR 8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine In-Reply-To: <55AFD144.9010102@oracle.com> References: <55AFD144.9010102@oracle.com> Message-ID: <55B03C16.50007@oracle.com> On 7/22/15 11:22 AM, Coleen Phillimore wrote: > Summary: Need to get source_file_name from the_class's constant pool > not previous version constant pool > > open webrev at http://cr.openjdk.java.net/~coleenp/8087315.01/ src/share/vm/classfile/javaClasses.cpp So in the new code, you avoid the use of holder->source_file_name() (where holder has been reset to a previous version ik) to fetch the Symbol because you can't trust that the source file name CP index saved in the previous version ik will work with that ik's constant pool. Interesting problem with previous versions... So you added a helper that grabs the source file name CP index out of the previous version ik and sanity checks it before using it with the merged CP. And you had to do this in two places so yet another reason for the helper... Sorry for verbiage... I had to remind myself how this stuff works... test/runtime/RedefineTests/RedefineRunningMethodsWithBacktrace.java Nice test. So what does the output look like when the test is run without your fix? Something like what is in the bug report? Thumbs up. Dan > bug link https://bugs.openjdk.java.net/browse/JDK-8087315 > > Tested with added test (yay!), RBT (remote build and test), > vm.redefine.testlist, jdk/test/java/lang/instrument and failing > testcase 1000 times (reproduced <400). > > Thanks, > Coleen From coleen.phillimore at oracle.com Thu Jul 23 01:31:33 2015 From: coleen.phillimore at oracle.com (Coleen Phillimore) Date: Wed, 22 Jul 2015 21:31:33 -0400 Subject: RFR 8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine In-Reply-To: <55B03C16.50007@oracle.com> References: <55AFD144.9010102@oracle.com> <55B03C16.50007@oracle.com> Message-ID: <55B043F5.1030300@oracle.com> Dan, Thank you again for the quick code review. On 7/22/15 8:57 PM, Daniel D. Daugherty wrote: > On 7/22/15 11:22 AM, Coleen Phillimore wrote: >> Summary: Need to get source_file_name from the_class's constant pool >> not previous version constant pool >> >> open webrev at http://cr.openjdk.java.net/~coleenp/8087315.01/ > > src/share/vm/classfile/javaClasses.cpp > So in the new code, you avoid the use of holder->source_file_name() > (where holder has been reset to a previous version ik) to fetch the > Symbol because you can't trust that the source file name CP index > saved in the previous version ik will work with that ik's constant > pool. Interesting problem with previous versions... > > So you added a helper that grabs the source file name CP index out > of the previous version ik and sanity checks it before using it > with the merged CP. > > And you had to do this in two places so yet another reason for > the helper... > > Sorry for verbiage... I had to remind myself how this stuff works... Yes, you are exactly right. I'm so glad you remember this. I don't know how, but I'm glad you do. :) > > test/runtime/RedefineTests/RedefineRunningMethodsWithBacktrace.java > Nice test. > > So what does the output look like when the test is > run without your fix? Something like what is in the > bug report? Yes, it crashes like the bug report. I was really happy to get a small test to reproduce this. Thanks! Coleen > > Thumbs up. > > Dan > > > > >> bug link https://bugs.openjdk.java.net/browse/JDK-8087315 >> >> Tested with added test (yay!), RBT (remote build and test), >> vm.redefine.testlist, jdk/test/java/lang/instrument and failing >> testcase 1000 times (reproduced <400). >> >> Thanks, >> Coleen > From david.holmes at oracle.com Thu Jul 23 01:32:15 2015 From: david.holmes at oracle.com (David Holmes) Date: Thu, 23 Jul 2015 11:32:15 +1000 Subject: RFR(XS) 8129897: Old verifier fails to reject erroneous cast from boolean[] to byte[] In-Reply-To: <55AFB163.908@oracle.com> References: <55AEA9CD.1000102@oracle.com> <55AED953.9060904@oracle.com> <55AFB163.908@oracle.com> Message-ID: <55B0441F.3090108@oracle.com> On 23/07/2015 1:06 AM, harold seigel wrote: > Hi David, > > Thanks for the review! > > I updated lines 2256- 2261 in a new webrev: > http://cr.openjdk.java.net/~hseigel/bug_8129897.2/ > > Here are the new lines: > > 2256 case 'B': /* array of bytes or booleans */ > 2257 if (top_type != MAKE_FULLINFO(ITEM_Byte, 1, > 0) && > 2258 top_type != MAKE_FULLINFO(ITEM_Boolean, > 1, 0)) > 2259 CCerror(context, > 2260 "Expecting to find array of bytes > or Booleans on stack"); > 2261 break; > > > File jdk/src/java.base/share/native/libverify/opcodes.in_out defines the > first operand for opcodes baload and bastore as [B. But, according to > the JVM Spec, the first operand for these bytecodes can be either [B or > [Z. This code checks that the opcodes, that opcodes.in_out says expect > [B, do not throw VerifyError if their actual operand is either [B or > [Z. Opcodes baload and bastore are the only opcodes in opcodes.in_out > with [B operands, and that's unlikely to change. > > I removed "case 'Z': because there are no [Z operands for any opcodes in > opcodes.in_out. Yeah they were too miserly to give booleans their own bytecodes :) Thanks for clarifying and changing. David > Thanks, Harold > > On 7/21/2015 7:44 PM, David Holmes wrote: >> Hi Harold, >> >> On 22/07/2015 6:21 AM, harold seigel wrote: >>> Hi, >>> >>> Please review this small change to fix bug 8129897. The old verifier >>> treats arrays of Booleans as arrays of bytes, allowing assignability >>> between them. This fix distinguishes between arrays of Booleans and >>> arrays of bytes and so disallows assignability between them. Additional >>> changes were needed to make sure operands to baload and similar opcodes >>> could still be either Boolean or byte arrays. >>> >>> Open webrev: http://cr.openjdk.java.net/~hseigel/bug_8129897/ >> >> Seems reasonable. Only query I have was why you didn't split this: >> >> 2256 case 'B': case 'Z': /* array of bytes or >> booleans */ >> 2257 if (top_type != MAKE_FULLINFO(ITEM_Byte, >> 1, 0) && >> 2258 top_type != >> MAKE_FULLINFO(ITEM_Boolean, 1, 0)) >> 2259 CCerror(context, >> 2260 "Expecting to find array of >> bytes or Booleans on stack"); >> 2261 break; >> >> into two distinct cases? >> >> Thanks, >> David >> >>> JBS Bug: https://bugs.openjdk.java.net/browse/JDK-8129897 >>> >>> The fix was tested with JCK Lang and VM tests, the UTE quick and split >>> verifier tests, and the hotspot, and JDK vm, java/io, java/lang, and >>> java/util JTreg tests. >>> >>> This scenario will be tested by JCK-9. So no regression test was >>> included in this webrev. >>> >>> Thanks, Harold > From david.holmes at oracle.com Thu Jul 23 02:08:08 2015 From: david.holmes at oracle.com (David Holmes) Date: Thu, 23 Jul 2015 12:08:08 +1000 Subject: os::current_thread_id on Linux In-Reply-To: References: Message-ID: <55B04C88.5080302@oracle.com> On 23/07/2015 8:01 AM, Jeremy Manson wrote: > Based on the feedback, this seems to be a good idea, approximately. > Coleen would have sponsored, but she's going on vacation. Anyone else > feel like sponsoring? Hold up a minute! :) There are different notions of "native thread id" that exist. First we have the "user level thread id" - this is what is reported by pthread_self in POSIX and thr_self in UI. Then we also have the OS specific "thread" id, also referred to as a LWP or "kernel scheduling entity" or "kernel thread" - the id for this is what gettid() maps back to on Linux. This distinction may not exist on all platforms. Unfortunately os::current_thread_id does not define which of these it represents: // thread id on Linux/64bit is 64bit, on Windows and Solaris, it's 32bit static intx current_thread_id(); and so on some platforms it returns the "user thread id" (eg pthread_self()), and on some it returns the same as gettid (ie OSX - but I don't know if the mach thread id is truly a "LWP" id ?). Also note that on some platforms the osThread stores the id of the "user-level thread" and on some the "kernel thread". Hence another source of confusion. :( So if you want to enforce that os::current_thread_id() represents the "kernel thread" then that should be applied consistently across all platforms**, and for platforms for which there is a change to make you have to ensure the usage of os::current_thread_id() is not semantically altered by the change. ** Of course a platform may only have a single notion of "thread" I'm happy to sponsor such a proposal. And don't worry about maintaining compatibility with archaic Linux versions for JDK9 (less cleanup to do later). Thanks, David > Jeremy > > On Wed, Jul 22, 2015 at 11:22 AM, Jeremy Manson > wrote: > > Hey folks, > > os::current_thread_id on Linux now maps to pthread_self. The > problem with pthread_self is that it only makes sense in the context > of the running process. When it is written out to the log (as it is > in several places), there really isn't a way (AFAICT) for the user > to map it back to anything useful. > > As it happens, that value is mostly used to write to the log. The > places where it doesn't do so don't seem to need to use pthread_self > for any particular reason. > > Meanwhile, the SIGQUIT stack dump > uses java_thread->osthread()->thread_id() as the nid. On Linux, > that maps back to os::Linux::gettid(), whish is also what gets > exposed in /proc. That makes it much easier to see what threads > might be doing the log write. > > Would it be okay to change os::current_thread_id to point > to os::Linux::gettid()? That way, it can be mapped back to the > output of a SIGQUIT dump. > > The downside of gettid() is that it is only available on > Linux>2.4.11, but that dates from 2001. If we really still want to > support it, we could check for that. > > Thoughts? > > Jeremy > > From coleen.phillimore at oracle.com Thu Jul 23 02:28:01 2015 From: coleen.phillimore at oracle.com (Coleen Phillimore) Date: Wed, 22 Jul 2015 22:28:01 -0400 Subject: RFR: 8130115: REDO - Reduce Symbol::_identity_hash to 2 bytes In-Reply-To: <55A69A5F.3070504@oracle.com> References: <55A69A5F.3070504@oracle.com> Message-ID: <55B05131.2080507@oracle.com> This looks fine. I'm not expert at knowing how the bitwise operators and shifts produce a random number so I'd like someone to verify that. Does anyone know why the serviceability agent has to duplicate the Symbol identity hash and if this is used by anything? This code change is fine for the duplicated SA code, but it would be nice to file an RFE to delete it. Your testing looks good. Thanks, Coleen On 7/15/15 1:37 PM, Yumin Qi wrote: > Hi, > > This is redo for bug 8087143, in that push, it caused failure on > Serviceability Agent failed to get type for "_identity_hash": > mistakenly used JShortField for it, but in fact it still is > CIntegerField. In this change, besides of the original change in > hotspot/src, I add code to calculate identity_hash in hotspot/agent > based on the changed in hotspot. > > Old webrev for 8087143: > bug: https://bugs.openjdk.java.net/browse/JDK-8087143 > webrev: http://cr.openjdk.java.net/~minqi/8087143/webrev03/ > > Summary: _identity_hash is an integer in Symbol (SymbolBase), it is > used to compute hash bucket index by modulus division of table size. > Currently in hotspot, no table size is more than 65535 so we can use > short instead. For case with table size over 65535 we can use the > first two bytes of symbol data to be as the upper 16 bits for the > calculation but rare cases. > > New webrev for 8130115: > bug: https://bugs.openjdk.java.net/browse/JDK-8130115 > webrev: http://cr.openjdk.java.net/~minqi/8130115/webrev01/ > > > Tests: JPRT, SA manual tests, -atk quick, jtreg hotspot/runtime > Also internal large application used for hashtable data analysis --- > the No. of loaded classes is big(over 19K), and tested with different > bucket sizes including over 65535 to see the new algorithm for > identity_hash calculation, result shows the consistency before and > after the fix. > > Thanks > Yumin From yumin.qi at oracle.com Thu Jul 23 03:08:47 2015 From: yumin.qi at oracle.com (Yumin Qi) Date: Wed, 22 Jul 2015 20:08:47 -0700 Subject: RFR: 8130115: REDO - Reduce Symbol::_identity_hash to 2 bytes In-Reply-To: <55B05131.2080507@oracle.com> References: <55A69A5F.3070504@oracle.com> <55B05131.2080507@oracle.com> Message-ID: <55B05ABF.5070503@oracle.com> Thanks for your review! I am not sure SA code so did not change that: hashcode() --- return an 'int' which is not usable in this case, we need a full 64bit address. This seems never used. getValue() --- return the address value, but is internally used, not in Address interface, don't know why it is platform dependent. I will file a bug for it. Thanks Yumin On 7/22/2015 7:28 PM, Coleen Phillimore wrote: > > This looks fine. I'm not expert at knowing how the bitwise operators > and shifts produce a random number so I'd like someone to verify that. > > Does anyone know why the serviceability agent has to duplicate the > Symbol identity hash and if this is used by anything? This code > change is fine for the duplicated SA code, but it would be nice to > file an RFE to delete it. > > Your testing looks good. > > Thanks, > Coleen > > On 7/15/15 1:37 PM, Yumin Qi wrote: >> Hi, >> >> This is redo for bug 8087143, in that push, it caused failure on >> Serviceability Agent failed to get type for "_identity_hash": >> mistakenly used JShortField for it, but in fact it still is >> CIntegerField. In this change, besides of the original change in >> hotspot/src, I add code to calculate identity_hash in hotspot/agent >> based on the changed in hotspot. >> >> Old webrev for 8087143: >> bug: https://bugs.openjdk.java.net/browse/JDK-8087143 >> webrev: http://cr.openjdk.java.net/~minqi/8087143/webrev03/ >> >> Summary: _identity_hash is an integer in Symbol (SymbolBase), it is >> used to compute hash bucket index by modulus division of table size. >> Currently in hotspot, no table size is more than 65535 so we can use >> short instead. For case with table size over 65535 we can use the >> first two bytes of symbol data to be as the upper 16 bits for the >> calculation but rare cases. >> >> New webrev for 8130115: >> bug: https://bugs.openjdk.java.net/browse/JDK-8130115 >> webrev: http://cr.openjdk.java.net/~minqi/8130115/webrev01/ >> >> >> Tests: JPRT, SA manual tests, -atk quick, jtreg hotspot/runtime >> Also internal large application used for hashtable data analysis --- >> the No. of loaded classes is big(over 19K), and tested with different >> bucket sizes including over 65535 to see the new algorithm for >> identity_hash calculation, result shows the consistency before and >> after the fix. >> >> Thanks >> Yumin > From jeremymanson at google.com Thu Jul 23 05:15:46 2015 From: jeremymanson at google.com (Jeremy Manson) Date: Wed, 22 Jul 2015 22:15:46 -0700 Subject: os::current_thread_id on Linux In-Reply-To: <55B04C88.5080302@oracle.com> References: <55B04C88.5080302@oracle.com> Message-ID: Hey David, Thanks for the offer of sponsorship. My goal here is really to make the log output on Linux usable. I want to be able to map the log output back to an actual thread. I don't think it really matters to users if the API consistently means "kernel thread ID" or "threading API thread ID", as long as they can figure out what the output means. Since what I am doing (in effect) to accomplish my goal is to ensure that the API returns the same value as osthread()->thread_id() does for the current thread, I could just... do precisely that. os::current_thread_id could just return osthread()->thread_id() for the current thread. I don't have easy access to anything for testing other than Linux, though, so whether it worked (or even compiled) on the other platforms would be a bit of a guess (per the last time we did this dance). Seem reasonable? Jeremy On Wed, Jul 22, 2015 at 7:08 PM, David Holmes wrote: > On 23/07/2015 8:01 AM, Jeremy Manson wrote: > >> Based on the feedback, this seems to be a good idea, approximately. >> Coleen would have sponsored, but she's going on vacation. Anyone else >> feel like sponsoring? >> > > Hold up a minute! :) There are different notions of "native thread id" > that exist. First we have the "user level thread id" - this is what is > reported by pthread_self in POSIX and thr_self in UI. Then we also have the > OS specific "thread" id, also referred to as a LWP or "kernel scheduling > entity" or "kernel thread" - the id for this is what gettid() maps back to > on Linux. This distinction may not exist on all platforms. > > Unfortunately os::current_thread_id does not define which of these it > represents: > > // thread id on Linux/64bit is 64bit, on Windows and Solaris, it's 32bit > static intx current_thread_id(); > > and so on some platforms it returns the "user thread id" (eg > pthread_self()), and on some it returns the same as gettid (ie OSX - but I > don't know if the mach thread id is truly a "LWP" id ?). > > Also note that on some platforms the osThread stores the id of the > "user-level thread" and on some the "kernel thread". Hence another source > of confusion. :( > > So if you want to enforce that os::current_thread_id() represents the > "kernel thread" then that should be applied consistently across all > platforms**, and for platforms for which there is a change to make you have > to ensure the usage of os::current_thread_id() is not semantically altered > by the change. > > ** Of course a platform may only have a single notion of "thread" > > I'm happy to sponsor such a proposal. And don't worry about maintaining > compatibility with archaic Linux versions for JDK9 (less cleanup to do > later). > > Thanks, > David > > Jeremy >> >> On Wed, Jul 22, 2015 at 11:22 AM, Jeremy Manson > > wrote: >> >> Hey folks, >> >> os::current_thread_id on Linux now maps to pthread_self. The >> problem with pthread_self is that it only makes sense in the context >> of the running process. When it is written out to the log (as it is >> in several places), there really isn't a way (AFAICT) for the user >> to map it back to anything useful. >> >> As it happens, that value is mostly used to write to the log. The >> places where it doesn't do so don't seem to need to use pthread_self >> for any particular reason. >> >> Meanwhile, the SIGQUIT stack dump >> uses java_thread->osthread()->thread_id() as the nid. On Linux, >> that maps back to os::Linux::gettid(), whish is also what gets >> exposed in /proc. That makes it much easier to see what threads >> might be doing the log write. >> >> Would it be okay to change os::current_thread_id to point >> to os::Linux::gettid()? That way, it can be mapped back to the >> output of a SIGQUIT dump. >> >> The downside of gettid() is that it is only available on >> Linux>2.4.11, but that dates from 2001. If we really still want to >> support it, we could check for that. >> >> Thoughts? >> >> Jeremy >> >> >> From david.holmes at oracle.com Thu Jul 23 05:57:37 2015 From: david.holmes at oracle.com (David Holmes) Date: Thu, 23 Jul 2015 15:57:37 +1000 Subject: os::current_thread_id on Linux In-Reply-To: References: <55B04C88.5080302@oracle.com> Message-ID: <55B08251.6030909@oracle.com> On 23/07/2015 3:15 PM, Jeremy Manson wrote: > Hey David, > > Thanks for the offer of sponsorship. My goal here is really to make the > log output on Linux usable. I want to be able to map the log output > back to an actual thread. I don't think it really matters to users if > the API consistently means "kernel thread ID" or "threading API thread > ID", as long as they can figure out what the output means. I think consistency is important else developers don't know what they should be using where - which is the current situation. > Since what I am doing (in effect) to accomplish my goal is to ensure > that the API returns the same value as osthread()->thread_id() does for > the current thread, I could just... do precisely that. > os::current_thread_id could just return osthread()->thread_id() for the > current thread. I don't have easy access to anything for testing other > than Linux, though, so whether it worked (or even compiled) on the other > platforms would be a bit of a guess (per the last time we did this dance). Defining os::current_thread_id() to be Thread::current()->osThread()->thread_id() assumes you can make those calls in the context in which os::current_thread_id() is used - if we crash during thread startup then some of those may be null and the id not even set. The current implementation is independent of the state of thread within the VM. So its okay to return the same thing as Thread::current()->osThread()->thread_id() but it needs to be done directly. Again any platform for which this would cause a change in behaviour needs to be examined. It may be other platforms have the same problem you are trying to fix for linux. If I get time later I'll try to check what each platform does. Thanks, David > Seem reasonable? > > Jeremy > > On Wed, Jul 22, 2015 at 7:08 PM, David Holmes > wrote: > > On 23/07/2015 8:01 AM, Jeremy Manson wrote: > > Based on the feedback, this seems to be a good idea, approximately. > Coleen would have sponsored, but she's going on vacation. > Anyone else > feel like sponsoring? > > > Hold up a minute! :) There are different notions of "native thread > id" that exist. First we have the "user level thread id" - this is > what is reported by pthread_self in POSIX and thr_self in UI. Then > we also have the OS specific "thread" id, also referred to as a LWP > or "kernel scheduling entity" or "kernel thread" - the id for this > is what gettid() maps back to on Linux. This distinction may not > exist on all platforms. > > Unfortunately os::current_thread_id does not define which of these > it represents: > > // thread id on Linux/64bit is 64bit, on Windows and Solaris, it's > 32bit > static intx current_thread_id(); > > and so on some platforms it returns the "user thread id" (eg > pthread_self()), and on some it returns the same as gettid (ie OSX - > but I don't know if the mach thread id is truly a "LWP" id ?). > > Also note that on some platforms the osThread stores the id of the > "user-level thread" and on some the "kernel thread". Hence another > source of confusion. :( > > So if you want to enforce that os::current_thread_id() represents > the "kernel thread" then that should be applied consistently across > all platforms**, and for platforms for which there is a change to > make you have to ensure the usage of os::current_thread_id() is not > semantically altered by the change. > > ** Of course a platform may only have a single notion of "thread" > > I'm happy to sponsor such a proposal. And don't worry about > maintaining compatibility with archaic Linux versions for JDK9 (less > cleanup to do later). > > Thanks, > David > > Jeremy > > On Wed, Jul 22, 2015 at 11:22 AM, Jeremy Manson > > >> wrote: > > Hey folks, > > os::current_thread_id on Linux now maps to pthread_self. The > problem with pthread_self is that it only makes sense in > the context > of the running process. When it is written out to the log > (as it is > in several places), there really isn't a way (AFAICT) for > the user > to map it back to anything useful. > > As it happens, that value is mostly used to write to the > log. The > places where it doesn't do so don't seem to need to use > pthread_self > for any particular reason. > > Meanwhile, the SIGQUIT stack dump > uses java_thread->osthread()->thread_id() as the nid. On > Linux, > that maps back to os::Linux::gettid(), whish is also what gets > exposed in /proc. That makes it much easier to see what > threads > might be doing the log write. > > Would it be okay to change os::current_thread_id to point > to os::Linux::gettid()? That way, it can be mapped back to the > output of a SIGQUIT dump. > > The downside of gettid() is that it is only available on > Linux>2.4.11, but that dates from 2001. If we really still > want to > support it, we could check for that. > > Thoughts? > > Jeremy > > > From jeremymanson at google.com Thu Jul 23 06:11:43 2015 From: jeremymanson at google.com (Jeremy Manson) Date: Wed, 22 Jul 2015 23:11:43 -0700 Subject: os::current_thread_id on Linux In-Reply-To: <55B08251.6030909@oracle.com> References: <55B04C88.5080302@oracle.com> <55B08251.6030909@oracle.com> Message-ID: Okay. TBH, thinking about it more, it's a little weird for something named os::current_thread_id() to be different from Thread::current()->osThread->thread_id(), or for either of them to be different from "what the OS thinks the thread id is", so it seems like the Right Thing to Do (in the absence of any platform-specific issues). Jeremy On Wed, Jul 22, 2015 at 10:57 PM, David Holmes wrote: > On 23/07/2015 3:15 PM, Jeremy Manson wrote: > >> Hey David, >> >> Thanks for the offer of sponsorship. My goal here is really to make the >> log output on Linux usable. I want to be able to map the log output >> back to an actual thread. I don't think it really matters to users if >> the API consistently means "kernel thread ID" or "threading API thread >> ID", as long as they can figure out what the output means. >> > > I think consistency is important else developers don't know what they > should be using where - which is the current situation. > > Since what I am doing (in effect) to accomplish my goal is to ensure >> that the API returns the same value as osthread()->thread_id() does for >> the current thread, I could just... do precisely that. >> os::current_thread_id could just return osthread()->thread_id() for the >> current thread. I don't have easy access to anything for testing other >> than Linux, though, so whether it worked (or even compiled) on the other >> platforms would be a bit of a guess (per the last time we did this dance). >> > > Defining os::current_thread_id() to be > Thread::current()->osThread()->thread_id() assumes you can make those calls > in the context in which os::current_thread_id() is used - if we crash > during thread startup then some of those may be null and the id not even > set. The current implementation is independent of the state of thread > within the VM. > > So its okay to return the same thing as > Thread::current()->osThread()->thread_id() but it needs to be done directly. > > Again any platform for which this would cause a change in behaviour needs > to be examined. It may be other platforms have the same problem you are > trying to fix for linux. > > If I get time later I'll try to check what each platform does. > > Thanks, > David > > Seem reasonable? >> >> Jeremy >> >> On Wed, Jul 22, 2015 at 7:08 PM, David Holmes > > wrote: >> >> On 23/07/2015 8:01 AM, Jeremy Manson wrote: >> >> Based on the feedback, this seems to be a good idea, >> approximately. >> Coleen would have sponsored, but she's going on vacation. >> Anyone else >> feel like sponsoring? >> >> >> Hold up a minute! :) There are different notions of "native thread >> id" that exist. First we have the "user level thread id" - this is >> what is reported by pthread_self in POSIX and thr_self in UI. Then >> we also have the OS specific "thread" id, also referred to as a LWP >> or "kernel scheduling entity" or "kernel thread" - the id for this >> is what gettid() maps back to on Linux. This distinction may not >> exist on all platforms. >> >> Unfortunately os::current_thread_id does not define which of these >> it represents: >> >> // thread id on Linux/64bit is 64bit, on Windows and Solaris, it's >> 32bit >> static intx current_thread_id(); >> >> and so on some platforms it returns the "user thread id" (eg >> pthread_self()), and on some it returns the same as gettid (ie OSX - >> but I don't know if the mach thread id is truly a "LWP" id ?). >> >> Also note that on some platforms the osThread stores the id of the >> "user-level thread" and on some the "kernel thread". Hence another >> source of confusion. :( >> >> So if you want to enforce that os::current_thread_id() represents >> the "kernel thread" then that should be applied consistently across >> all platforms**, and for platforms for which there is a change to >> make you have to ensure the usage of os::current_thread_id() is not >> semantically altered by the change. >> >> ** Of course a platform may only have a single notion of "thread" >> >> I'm happy to sponsor such a proposal. And don't worry about >> maintaining compatibility with archaic Linux versions for JDK9 (less >> cleanup to do later). >> >> Thanks, >> David >> >> Jeremy >> >> On Wed, Jul 22, 2015 at 11:22 AM, Jeremy Manson >> >> > >> >> wrote: >> >> Hey folks, >> >> os::current_thread_id on Linux now maps to pthread_self. The >> problem with pthread_self is that it only makes sense in >> the context >> of the running process. When it is written out to the log >> (as it is >> in several places), there really isn't a way (AFAICT) for >> the user >> to map it back to anything useful. >> >> As it happens, that value is mostly used to write to the >> log. The >> places where it doesn't do so don't seem to need to use >> pthread_self >> for any particular reason. >> >> Meanwhile, the SIGQUIT stack dump >> uses java_thread->osthread()->thread_id() as the nid. On >> Linux, >> that maps back to os::Linux::gettid(), whish is also what >> gets >> exposed in /proc. That makes it much easier to see what >> threads >> might be doing the log write. >> >> Would it be okay to change os::current_thread_id to point >> to os::Linux::gettid()? That way, it can be mapped back to >> the >> output of a SIGQUIT dump. >> >> The downside of gettid() is that it is only available on >> Linux>2.4.11, but that dates from 2001. If we really still >> want to >> support it, we could check for that. >> >> Thoughts? >> >> Jeremy >> >> >> >> From serguei.spitsyn at oracle.com Thu Jul 23 06:35:32 2015 From: serguei.spitsyn at oracle.com (serguei.spitsyn at oracle.com) Date: Wed, 22 Jul 2015 23:35:32 -0700 Subject: RFR 8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine In-Reply-To: <55AFD144.9010102@oracle.com> References: <55AFD144.9010102@oracle.com> Message-ID: <55B08B34.7080707@oracle.com> Coleen, The fix looks good in general. There is one more place where the same may need to be fixed. It is in the function java_lang_StackTraceElement::create (): 1911 // Fill in source file name and line number. 1912 // Use specific ik version as a holder since the mirror might 1913 // refer to version that is now obsolete and no longer accessible 1914 // via the previous versions list. 1915 holder = holder->get_klass_version(version); 1916 assert(holder != NULL, "sanity check"); 1917 Symbol* source = holder->source_file_name(); I'm still reviewing the test. Thanks, Serguei On 7/22/15 10:22 AM, Coleen Phillimore wrote: > Summary: Need to get source_file_name from the_class's constant pool > not previous version constant pool > > open webrev at http://cr.openjdk.java.net/~coleenp/8087315.01/ > bug link https://bugs.openjdk.java.net/browse/JDK-8087315 > > Tested with added test (yay!), RBT (remote build and test), > vm.redefine.testlist, jdk/test/java/lang/instrument and failing > testcase 1000 times (reproduced <400). > > Thanks, > Coleen From david.holmes at oracle.com Thu Jul 23 07:16:07 2015 From: david.holmes at oracle.com (David Holmes) Date: Thu, 23 Jul 2015 17:16:07 +1000 Subject: os::current_thread_id on Linux In-Reply-To: References: <55B04C88.5080302@oracle.com> <55B08251.6030909@oracle.com> Message-ID: <55B094B7.6060309@oracle.com> On 23/07/2015 4:11 PM, Jeremy Manson wrote: > Okay. TBH, thinking about it more, it's a little weird for something > named os::current_thread_id() to be different from > Thread::current()->osThread->thread_id(), or for either of them to be > different from "what the OS thinks the thread id is", so it seems like > the Right Thing to Do (in the absence of any platform-specific issues). When there are two different levels of thread ID it isn't that simple - especially as, like you say, one can be used to look in /proc while the other can't. So perhaps better naming is in order. Cheers, David > Jeremy > > On Wed, Jul 22, 2015 at 10:57 PM, David Holmes > wrote: > > On 23/07/2015 3:15 PM, Jeremy Manson wrote: > > Hey David, > > Thanks for the offer of sponsorship. My goal here is really to > make the > log output on Linux usable. I want to be able to map the log output > back to an actual thread. I don't think it really matters to > users if > the API consistently means "kernel thread ID" or "threading API > thread > ID", as long as they can figure out what the output means. > > > I think consistency is important else developers don't know what > they should be using where - which is the current situation. > > Since what I am doing (in effect) to accomplish my goal is to ensure > that the API returns the same value as osthread()->thread_id() > does for > the current thread, I could just... do precisely that. > os::current_thread_id could just return osthread()->thread_id() > for the > current thread. I don't have easy access to anything for testing > other > than Linux, though, so whether it worked (or even compiled) on > the other > platforms would be a bit of a guess (per the last time we did > this dance). > > > Defining os::current_thread_id() to be > Thread::current()->osThread()->thread_id() assumes you can make > those calls in the context in which os::current_thread_id() is used > - if we crash during thread startup then some of those may be null > and the id not even set. The current implementation is independent > of the state of thread within the VM. > > So its okay to return the same thing as > Thread::current()->osThread()->thread_id() but it needs to be done > directly. > > Again any platform for which this would cause a change in behaviour > needs to be examined. It may be other platforms have the same > problem you are trying to fix for linux. > > If I get time later I'll try to check what each platform does. > > Thanks, > David > > Seem reasonable? > > Jeremy > > On Wed, Jul 22, 2015 at 7:08 PM, David Holmes > > >> wrote: > > On 23/07/2015 8:01 AM, Jeremy Manson wrote: > > Based on the feedback, this seems to be a good idea, > approximately. > Coleen would have sponsored, but she's going on vacation. > Anyone else > feel like sponsoring? > > > Hold up a minute! :) There are different notions of "native > thread > id" that exist. First we have the "user level thread id" - > this is > what is reported by pthread_self in POSIX and thr_self in > UI. Then > we also have the OS specific "thread" id, also referred to > as a LWP > or "kernel scheduling entity" or "kernel thread" - the id > for this > is what gettid() maps back to on Linux. This distinction > may not > exist on all platforms. > > Unfortunately os::current_thread_id does not define which > of these > it represents: > > // thread id on Linux/64bit is 64bit, on Windows and > Solaris, it's > 32bit > static intx current_thread_id(); > > and so on some platforms it returns the "user thread id" (eg > pthread_self()), and on some it returns the same as gettid > (ie OSX - > but I don't know if the mach thread id is truly a "LWP" id ?). > > Also note that on some platforms the osThread stores the id > of the > "user-level thread" and on some the "kernel thread". Hence > another > source of confusion. :( > > So if you want to enforce that os::current_thread_id() > represents > the "kernel thread" then that should be applied > consistently across > all platforms**, and for platforms for which there is a > change to > make you have to ensure the usage of > os::current_thread_id() is not > semantically altered by the change. > > ** Of course a platform may only have a single notion of > "thread" > > I'm happy to sponsor such a proposal. And don't worry about > maintaining compatibility with archaic Linux versions for > JDK9 (less > cleanup to do later). > > Thanks, > David > > Jeremy > > On Wed, Jul 22, 2015 at 11:22 AM, Jeremy Manson > > > > > >>> wrote: > > Hey folks, > > os::current_thread_id on Linux now maps to > pthread_self. The > problem with pthread_self is that it only makes > sense in > the context > of the running process. When it is written out to > the log > (as it is > in several places), there really isn't a way > (AFAICT) for > the user > to map it back to anything useful. > > As it happens, that value is mostly used to write > to the > log. The > places where it doesn't do so don't seem to need > to use > pthread_self > for any particular reason. > > Meanwhile, the SIGQUIT stack dump > uses java_thread->osthread()->thread_id() as the > nid. On > Linux, > that maps back to os::Linux::gettid(), whish is > also what gets > exposed in /proc. That makes it much easier to > see what > threads > might be doing the log write. > > Would it be okay to change os::current_thread_id > to point > to os::Linux::gettid()? That way, it can be > mapped back to the > output of a SIGQUIT dump. > > The downside of gettid() is that it is only > available on > Linux>2.4.11, but that dates from 2001. If we > really still > want to > support it, we could check for that. > > Thoughts? > > Jeremy > > > > From coleen.phillimore at oracle.com Thu Jul 23 11:49:26 2015 From: coleen.phillimore at oracle.com (Coleen Phillimore) Date: Thu, 23 Jul 2015 07:49:26 -0400 Subject: RFR 8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine In-Reply-To: <55B08B34.7080707@oracle.com> References: <55AFD144.9010102@oracle.com> <55B08B34.7080707@oracle.com> Message-ID: <55B0D4C6.8060303@oracle.com> Hi Serguei, On 7/23/15 2:35 AM, serguei.spitsyn at oracle.com wrote: > Coleen, > > The fix looks good in general. > There is one more place where the same may need to be fixed. > It is in the function java_lang_StackTraceElement::create (): > 1911 // Fill in source file name and line number. > 1912 // Use specific ik version as a holder since the mirror might > 1913 // refer to version that is now obsolete and no longer accessible > 1914 // via the previous versions list. > 1915 holder = holder->get_klass_version(version); > 1916 assert(holder != NULL, "sanity check"); > 1917 Symbol* source = holder->source_file_name(); > I did change both places, I think you're looking at the old version. java_lang_StackTraceElement::create() was where the crash was. thanks for getting to this so quickly. Coleen > I'm still reviewing the test. > > Thanks, > Serguei > > > On 7/22/15 10:22 AM, Coleen Phillimore wrote: >> Summary: Need to get source_file_name from the_class's constant pool >> not previous version constant pool >> >> open webrev at http://cr.openjdk.java.net/~coleenp/8087315.01/ >> bug link https://bugs.openjdk.java.net/browse/JDK-8087315 >> >> Tested with added test (yay!), RBT (remote build and test), >> vm.redefine.testlist, jdk/test/java/lang/instrument and failing >> testcase 1000 times (reproduced <400). >> >> Thanks, >> Coleen > From serguei.spitsyn at oracle.com Thu Jul 23 11:57:53 2015 From: serguei.spitsyn at oracle.com (serguei.spitsyn at oracle.com) Date: Thu, 23 Jul 2015 04:57:53 -0700 Subject: RFR 8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine In-Reply-To: <55B0D4C6.8060303@oracle.com> References: <55AFD144.9010102@oracle.com> <55B08B34.7080707@oracle.com> <55B0D4C6.8060303@oracle.com> Message-ID: <55B0D6C1.8000503@oracle.com> Hi Coleen, On 7/23/15 4:49 AM, Coleen Phillimore wrote: > > Hi Serguei, > > On 7/23/15 2:35 AM, serguei.spitsyn at oracle.com wrote: >> Coleen, >> >> The fix looks good in general. >> There is one more place where the same may need to be fixed. >> It is in the function java_lang_StackTraceElement::create (): >> 1911 // Fill in source file name and line number. >> 1912 // Use specific ik version as a holder since the mirror might >> 1913 // refer to version that is now obsolete and no longer accessible >> 1914 // via the previous versions list. >> 1915 holder = holder->get_klass_version(version); >> 1916 assert(holder != NULL, "sanity check"); >> 1917 Symbol* source = holder->source_file_name(); >> > > I did change both places, I think you're looking at the old version. > java_lang_StackTraceElement::create() was where the crash was. > thanks for getting to this so quickly. You are right, sorry. I've overlooked the second place. It is because both fragments look similar. It is nice that you have fixed them both! Still reviewing the test. Thanks, Serguei > Coleen > > >> I'm still reviewing the test. >> >> Thanks, >> Serguei >> >> >> On 7/22/15 10:22 AM, Coleen Phillimore wrote: >>> Summary: Need to get source_file_name from the_class's constant pool >>> not previous version constant pool >>> >>> open webrev at http://cr.openjdk.java.net/~coleenp/8087315.01/ >>> bug link https://bugs.openjdk.java.net/browse/JDK-8087315 >>> >>> Tested with added test (yay!), RBT (remote build and test), >>> vm.redefine.testlist, jdk/test/java/lang/instrument and failing >>> testcase 1000 times (reproduced <400). >>> >>> Thanks, >>> Coleen >> > From serguei.spitsyn at oracle.com Thu Jul 23 12:30:36 2015 From: serguei.spitsyn at oracle.com (serguei.spitsyn at oracle.com) Date: Thu, 23 Jul 2015 05:30:36 -0700 Subject: RFR 8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine In-Reply-To: <55B0D6C1.8000503@oracle.com> References: <55AFD144.9010102@oracle.com> <55B08B34.7080707@oracle.com> <55B0D4C6.8060303@oracle.com> <55B0D6C1.8000503@oracle.com> Message-ID: <55B0DE6C.9030601@oracle.com> The fix is good. Nice test! A couple of places with indent 2: 78 static void localSleep() { 79 try{ 80 Thread.currentThread().sleep(10);//sleep for 10 ms 81 } catch(InterruptedException ie) { 82 } 83 } 119 for (int i = 0; i < stackTrace.length; i++) { 120 StackTraceElement frame = stackTrace[i]; 121 if (frame.getClassName() == null) { 122 System.out.println("\nTest failed: trace[" + i + "].getClassName() returned null"); 123 } 124 if (frame.getMethodName() == null) { 125 System.out.println("\nTest failed: trace[" + i + "].getMethodName() returned null"); 126 } 127 } Thank you a lot for fixing this issue! Thanks, Serguei On 7/23/15 4:57 AM, serguei.spitsyn at oracle.com wrote: > Hi Coleen, > > > On 7/23/15 4:49 AM, Coleen Phillimore wrote: >> >> Hi Serguei, >> >> On 7/23/15 2:35 AM, serguei.spitsyn at oracle.com wrote: >>> Coleen, >>> >>> The fix looks good in general. >>> There is one more place where the same may need to be fixed. >>> It is in the function java_lang_StackTraceElement::create (): >>> 1911 // Fill in source file name and line number. >>> 1912 // Use specific ik version as a holder since the mirror might >>> 1913 // refer to version that is now obsolete and no longer accessible >>> 1914 // via the previous versions list. >>> 1915 holder = holder->get_klass_version(version); >>> 1916 assert(holder != NULL, "sanity check"); >>> 1917 Symbol* source = holder->source_file_name(); >>> >> >> I did change both places, I think you're looking at the old >> version. java_lang_StackTraceElement::create() was where the crash was. >> thanks for getting to this so quickly. > > You are right, sorry. > I've overlooked the second place. > It is because both fragments look similar. > It is nice that you have fixed them both! > Still reviewing the test. > > Thanks, > Serguei > >> Coleen >> >> >>> I'm still reviewing the test. >>> >>> Thanks, >>> Serguei >>> >>> >>> On 7/22/15 10:22 AM, Coleen Phillimore wrote: >>>> Summary: Need to get source_file_name from the_class's constant >>>> pool not previous version constant pool >>>> >>>> open webrev at http://cr.openjdk.java.net/~coleenp/8087315.01/ >>>> bug link https://bugs.openjdk.java.net/browse/JDK-8087315 >>>> >>>> Tested with added test (yay!), RBT (remote build and test), >>>> vm.redefine.testlist, jdk/test/java/lang/instrument and failing >>>> testcase 1000 times (reproduced <400). >>>> >>>> Thanks, >>>> Coleen >>> >> > From harold.seigel at oracle.com Thu Jul 23 12:45:28 2015 From: harold.seigel at oracle.com (harold seigel) Date: Thu, 23 Jul 2015 08:45:28 -0400 Subject: RFR(XS) 8129897: Old verifier fails to reject erroneous cast from boolean[] to byte[] In-Reply-To: <55B0441F.3090108@oracle.com> References: <55AEA9CD.1000102@oracle.com> <55AED953.9060904@oracle.com> <55AFB163.908@oracle.com> <55B0441F.3090108@oracle.com> Message-ID: <55B0E1E8.2010309@oracle.com> Thanks David! Harold On 7/22/2015 9:32 PM, David Holmes wrote: > On 23/07/2015 1:06 AM, harold seigel wrote: >> Hi David, >> >> Thanks for the review! >> >> I updated lines 2256- 2261 in a new webrev: >> http://cr.openjdk.java.net/~hseigel/bug_8129897.2/ >> >> Here are the new lines: >> >> 2256 case 'B': /* array of bytes or booleans */ >> 2257 if (top_type != MAKE_FULLINFO(ITEM_Byte, 1, >> 0) && >> 2258 top_type != MAKE_FULLINFO(ITEM_Boolean, >> 1, 0)) >> 2259 CCerror(context, >> 2260 "Expecting to find array of bytes >> or Booleans on stack"); >> 2261 break; >> >> >> File jdk/src/java.base/share/native/libverify/opcodes.in_out defines the >> first operand for opcodes baload and bastore as [B. But, according to >> the JVM Spec, the first operand for these bytecodes can be either [B or >> [Z. This code checks that the opcodes, that opcodes.in_out says expect >> [B, do not throw VerifyError if their actual operand is either [B or >> [Z. Opcodes baload and bastore are the only opcodes in opcodes.in_out >> with [B operands, and that's unlikely to change. >> >> I removed "case 'Z': because there are no [Z operands for any opcodes in >> opcodes.in_out. > > Yeah they were too miserly to give booleans their own bytecodes :) > > Thanks for clarifying and changing. > > David > > >> Thanks, Harold >> >> On 7/21/2015 7:44 PM, David Holmes wrote: >>> Hi Harold, >>> >>> On 22/07/2015 6:21 AM, harold seigel wrote: >>>> Hi, >>>> >>>> Please review this small change to fix bug 8129897. The old verifier >>>> treats arrays of Booleans as arrays of bytes, allowing assignability >>>> between them. This fix distinguishes between arrays of Booleans and >>>> arrays of bytes and so disallows assignability between them. >>>> Additional >>>> changes were needed to make sure operands to baload and similar >>>> opcodes >>>> could still be either Boolean or byte arrays. >>>> >>>> Open webrev: http://cr.openjdk.java.net/~hseigel/bug_8129897/ >>> >>> Seems reasonable. Only query I have was why you didn't split this: >>> >>> 2256 case 'B': case 'Z': /* array of bytes or >>> booleans */ >>> 2257 if (top_type != MAKE_FULLINFO(ITEM_Byte, >>> 1, 0) && >>> 2258 top_type != >>> MAKE_FULLINFO(ITEM_Boolean, 1, 0)) >>> 2259 CCerror(context, >>> 2260 "Expecting to find array of >>> bytes or Booleans on stack"); >>> 2261 break; >>> >>> into two distinct cases? >>> >>> Thanks, >>> David >>> >>>> JBS Bug: https://bugs.openjdk.java.net/browse/JDK-8129897 >>>> >>>> The fix was tested with JCK Lang and VM tests, the UTE quick and split >>>> verifier tests, and the hotspot, and JDK vm, java/io, java/lang, and >>>> java/util JTreg tests. >>>> >>>> This scenario will be tested by JCK-9. So no regression test was >>>> included in this webrev. >>>> >>>> Thanks, Harold >> From goetz.lindenmaier at sap.com Thu Jul 23 13:30:33 2015 From: goetz.lindenmaier at sap.com (Lindenmaier, Goetz) Date: Thu, 23 Jul 2015 13:30:33 +0000 Subject: RFR(S): LogTouchedMethods (8025692) asserts if TieredCompilation is off. Message-ID: <4295855A5C1DE049A61835A1887419CC2D00907C@DEWDFEMB12A.global.corp.sap> Hi, LogTouchedMethods causes the template interpreter to generate profiling code even if no compiler is used. If TieredCompilation is off, code containing an assertion that checks that UseCompiler is set, is reached. This assertion exists on the sparc and ppc platforms. Fix: Check for LogTouchedMethods in the assertion. Also added testcase with -XX:-TieredCompilation. The problem can be reproduced with the new test case on solaris sparc. Please review this change. I please need a sponsor. http://cr.openjdk.java.net/~goetz/webrevs/8132242-jtregPTM/webrev.01/ Best regards, Goetz Lindenmaier From daniel.daugherty at oracle.com Thu Jul 23 13:49:11 2015 From: daniel.daugherty at oracle.com (Daniel D. Daugherty) Date: Thu, 23 Jul 2015 07:49:11 -0600 Subject: RFR(S): LogTouchedMethods (8025692) asserts if TieredCompilation is off. In-Reply-To: <4295855A5C1DE049A61835A1887419CC2D00907C@DEWDFEMB12A.global.corp.sap> References: <4295855A5C1DE049A61835A1887419CC2D00907C@DEWDFEMB12A.global.corp.sap> Message-ID: <55B0F0D7.3040708@oracle.com> Yumin, Since you did the work on: JDK-8025692 Log what methods are touched at run-time https://bugs.openjdk.java.net/browse/JDK-8025692 can you help Goetz with this tweak? Dan On 7/23/15 7:30 AM, Lindenmaier, Goetz wrote: > Hi, > > LogTouchedMethods causes the template interpreter to generate profiling code even > if no compiler is used. If TieredCompilation is off, code containing an assertion > that checks that UseCompiler is set, is reached. > This assertion exists on the sparc and ppc platforms. > Fix: > Check for LogTouchedMethods in the assertion. > Also added testcase with -XX:-TieredCompilation. > > The problem can be reproduced with the new test case on solaris sparc. > > Please review this change. I please need a sponsor. > http://cr.openjdk.java.net/~goetz/webrevs/8132242-jtregPTM/webrev.01/ > > Best regards, > Goetz Lindenmaier From vladimir.kempik at oracle.com Thu Jul 23 14:56:34 2015 From: vladimir.kempik at oracle.com (Vladimir Kempik) Date: Thu, 23 Jul 2015 17:56:34 +0300 Subject: [8u] request for approval: backport of JDK-8048353 Message-ID: <55B100A2.7090202@oracle.com> Hi All, I would like to backport fix for JDK-8048353 to 8u Bug id: https://bugs.openjdk.java.net/browse/JDK-8048353 Changeset: http://hg.openjdk.java.net/jdk9/hs-rt/hotspot/rev/5133956b4a98 Fix applies cleanly to jdk8 Review thread for original fix: http://mail.openjdk.java.net/pipermail/hotspot-runtime-dev/2015-July/015408.html testing: jprt Thanks, Vladimir From daniel.daugherty at oracle.com Thu Jul 23 15:33:17 2015 From: daniel.daugherty at oracle.com (Daniel D. Daugherty) Date: Thu, 23 Jul 2015 09:33:17 -0600 Subject: [8u] request for approval: backport of JDK-8048353 In-Reply-To: <55B100A2.7090202@oracle.com> References: <55B100A2.7090202@oracle.com> Message-ID: <55B1093D.1030302@oracle.com> Thumbs up modulo running the jstack and tmtools on the JDK8u version. Dan On 7/23/15 8:56 AM, Vladimir Kempik wrote: > Hi All, > > I would like to backport fix for JDK-8048353 to 8u > > Bug id: https://bugs.openjdk.java.net/browse/JDK-8048353 > > Changeset: http://hg.openjdk.java.net/jdk9/hs-rt/hotspot/rev/5133956b4a98 > > Fix applies cleanly to jdk8 > > Review thread for original fix: > http://mail.openjdk.java.net/pipermail/hotspot-runtime-dev/2015-July/015408.html > > testing: jprt > > Thanks, > Vladimir From coleen.phillimore at oracle.com Thu Jul 23 15:34:03 2015 From: coleen.phillimore at oracle.com (Coleen Phillimore) Date: Thu, 23 Jul 2015 11:34:03 -0400 Subject: RFR 8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine In-Reply-To: <55B0DE6C.9030601@oracle.com> References: <55AFD144.9010102@oracle.com> <55B08B34.7080707@oracle.com> <55B0D4C6.8060303@oracle.com> <55B0D6C1.8000503@oracle.com> <55B0DE6C.9030601@oracle.com> Message-ID: <55B1096B.8000705@oracle.com> Thank you Serguei. I'll fix the indentation to 4 since that's the coding style for Java (I like 2 better!) Coleen On 7/23/15 8:30 AM, serguei.spitsyn at oracle.com wrote: > The fix is good. > Nice test! > > A couple of places with indent 2: > 78 static void localSleep() { > 79 try{ > 80 Thread.currentThread().sleep(10);//sleep for 10 ms > 81 } catch(InterruptedException ie) { > 82 } > 83 } > > 119 for (int i = 0; i < stackTrace.length; i++) { > 120 StackTraceElement frame = stackTrace[i]; > 121 if (frame.getClassName() == null) { > 122 System.out.println("\nTest failed: trace[" + i + "].getClassName() returned null"); > 123 } > 124 if (frame.getMethodName() == null) { > 125 System.out.println("\nTest failed: trace[" + i + "].getMethodName() returned null"); > 126 } > 127 } > > Thank you a lot for fixing this issue! > > Thanks, > Serguei > > > > On 7/23/15 4:57 AM, serguei.spitsyn at oracle.com wrote: >> Hi Coleen, >> >> >> On 7/23/15 4:49 AM, Coleen Phillimore wrote: >>> >>> Hi Serguei, >>> >>> On 7/23/15 2:35 AM, serguei.spitsyn at oracle.com wrote: >>>> Coleen, >>>> >>>> The fix looks good in general. >>>> There is one more place where the same may need to be fixed. >>>> It is in the function java_lang_StackTraceElement::create (): >>>> 1911 // Fill in source file name and line number. >>>> 1912 // Use specific ik version as a holder since the mirror might >>>> 1913 // refer to version that is now obsolete and no longer accessible >>>> 1914 // via the previous versions list. >>>> 1915 holder = holder->get_klass_version(version); >>>> 1916 assert(holder != NULL, "sanity check"); >>>> 1917 Symbol* source = holder->source_file_name(); >>>> >>> >>> I did change both places, I think you're looking at the old >>> version. java_lang_StackTraceElement::create() was where the crash >>> was. >>> thanks for getting to this so quickly. >> >> You are right, sorry. >> I've overlooked the second place. >> It is because both fragments look similar. >> It is nice that you have fixed them both! >> Still reviewing the test. >> >> Thanks, >> Serguei >> >>> Coleen >>> >>> >>>> I'm still reviewing the test. >>>> >>>> Thanks, >>>> Serguei >>>> >>>> >>>> On 7/22/15 10:22 AM, Coleen Phillimore wrote: >>>>> Summary: Need to get source_file_name from the_class's constant >>>>> pool not previous version constant pool >>>>> >>>>> open webrev at http://cr.openjdk.java.net/~coleenp/8087315.01/ >>>>> bug link https://bugs.openjdk.java.net/browse/JDK-8087315 >>>>> >>>>> Tested with added test (yay!), RBT (remote build and test), >>>>> vm.redefine.testlist, jdk/test/java/lang/instrument and failing >>>>> testcase 1000 times (reproduced <400). >>>>> >>>>> Thanks, >>>>> Coleen >>>> >>> >> > From ioi.lam at oracle.com Thu Jul 23 16:42:59 2015 From: ioi.lam at oracle.com (Ioi Lam) Date: Thu, 23 Jul 2015 09:42:59 -0700 Subject: RFR(S): LogTouchedMethods (8025692) asserts if TieredCompilation is off. In-Reply-To: <4295855A5C1DE049A61835A1887419CC2D00907C@DEWDFEMB12A.global.corp.sap> References: <4295855A5C1DE049A61835A1887419CC2D00907C@DEWDFEMB12A.global.corp.sap> Message-ID: <55B11993.603@oracle.com> This looks good to me. Thanks - Ioi On 7/23/15 6:30 AM, Lindenmaier, Goetz wrote: > Hi, > > LogTouchedMethods causes the template interpreter to generate profiling code even > if no compiler is used. If TieredCompilation is off, code containing an assertion > that checks that UseCompiler is set, is reached. > This assertion exists on the sparc and ppc platforms. > Fix: > Check for LogTouchedMethods in the assertion. > Also added testcase with -XX:-TieredCompilation. > > The problem can be reproduced with the new test case on solaris sparc. > > Please review this change. I please need a sponsor. > http://cr.openjdk.java.net/~goetz/webrevs/8132242-jtregPTM/webrev.01/ > > Best regards, > Goetz Lindenmaier From jeremymanson at google.com Thu Jul 23 18:03:48 2015 From: jeremymanson at google.com (Jeremy Manson) Date: Thu, 23 Jul 2015 11:03:48 -0700 Subject: os::current_thread_id on Linux In-Reply-To: <55B094B7.6060309@oracle.com> References: <55B04C88.5080302@oracle.com> <55B08251.6030909@oracle.com> <55B094B7.6060309@oracle.com> Message-ID: Quick rundown: On Solaris, osthread and current_thread_id are the same (thr_self()). On Windows, they are the same (GetCurrentThreadId()). On OS X, they are the same (pthread_mach_thread_np(::pthread_self())) On AIX, current_thread_id is pthread_self, and osthread is thread_self() On non-OS X BSD, current_thread_id is pthread_self, and osthread is the syscall. I don't see any code that depends on the particular value of current_thread_id (for example, assuming that it is the same as thread_self in a meaningful way on AIX, or that it is pthread_self on AIX). My guess is that the AIX and non-OS X code are just following the Linux convention. I'm happy to make current_thread_id consistent with osthread on all of the platforms, or just on Linux (with the understanding that I can't really test AIX and OS X easily). Jeremy On Thu, Jul 23, 2015 at 12:16 AM, David Holmes wrote: > On 23/07/2015 4:11 PM, Jeremy Manson wrote: > >> Okay. TBH, thinking about it more, it's a little weird for something >> named os::current_thread_id() to be different from >> Thread::current()->osThread->thread_id(), or for either of them to be >> different from "what the OS thinks the thread id is", so it seems like >> the Right Thing to Do (in the absence of any platform-specific issues). >> > > When there are two different levels of thread ID it isn't that simple - > especially as, like you say, one can be used to look in /proc while the > other can't. So perhaps better naming is in order. > > Cheers, > David > > Jeremy >> >> On Wed, Jul 22, 2015 at 10:57 PM, David Holmes > > wrote: >> >> On 23/07/2015 3:15 PM, Jeremy Manson wrote: >> >> Hey David, >> >> Thanks for the offer of sponsorship. My goal here is really to >> make the >> log output on Linux usable. I want to be able to map the log >> output >> back to an actual thread. I don't think it really matters to >> users if >> the API consistently means "kernel thread ID" or "threading API >> thread >> ID", as long as they can figure out what the output means. >> >> >> I think consistency is important else developers don't know what >> they should be using where - which is the current situation. >> >> Since what I am doing (in effect) to accomplish my goal is to >> ensure >> that the API returns the same value as osthread()->thread_id() >> does for >> the current thread, I could just... do precisely that. >> os::current_thread_id could just return osthread()->thread_id() >> for the >> current thread. I don't have easy access to anything for testing >> other >> than Linux, though, so whether it worked (or even compiled) on >> the other >> platforms would be a bit of a guess (per the last time we did >> this dance). >> >> >> Defining os::current_thread_id() to be >> Thread::current()->osThread()->thread_id() assumes you can make >> those calls in the context in which os::current_thread_id() is used >> - if we crash during thread startup then some of those may be null >> and the id not even set. The current implementation is independent >> of the state of thread within the VM. >> >> So its okay to return the same thing as >> Thread::current()->osThread()->thread_id() but it needs to be done >> directly. >> >> Again any platform for which this would cause a change in behaviour >> needs to be examined. It may be other platforms have the same >> problem you are trying to fix for linux. >> >> If I get time later I'll try to check what each platform does. >> >> Thanks, >> David >> >> Seem reasonable? >> >> Jeremy >> >> On Wed, Jul 22, 2015 at 7:08 PM, David Holmes >> >> > >> >> wrote: >> >> On 23/07/2015 8:01 AM, Jeremy Manson wrote: >> >> Based on the feedback, this seems to be a good idea, >> approximately. >> Coleen would have sponsored, but she's going on vacation. >> Anyone else >> feel like sponsoring? >> >> >> Hold up a minute! :) There are different notions of "native >> thread >> id" that exist. First we have the "user level thread id" - >> this is >> what is reported by pthread_self in POSIX and thr_self in >> UI. Then >> we also have the OS specific "thread" id, also referred to >> as a LWP >> or "kernel scheduling entity" or "kernel thread" - the id >> for this >> is what gettid() maps back to on Linux. This distinction >> may not >> exist on all platforms. >> >> Unfortunately os::current_thread_id does not define which >> of these >> it represents: >> >> // thread id on Linux/64bit is 64bit, on Windows and >> Solaris, it's >> 32bit >> static intx current_thread_id(); >> >> and so on some platforms it returns the "user thread id" (eg >> pthread_self()), and on some it returns the same as gettid >> (ie OSX - >> but I don't know if the mach thread id is truly a "LWP" id >> ?). >> >> Also note that on some platforms the osThread stores the id >> of the >> "user-level thread" and on some the "kernel thread". Hence >> another >> source of confusion. :( >> >> So if you want to enforce that os::current_thread_id() >> represents >> the "kernel thread" then that should be applied >> consistently across >> all platforms**, and for platforms for which there is a >> change to >> make you have to ensure the usage of >> os::current_thread_id() is not >> semantically altered by the change. >> >> ** Of course a platform may only have a single notion of >> "thread" >> >> I'm happy to sponsor such a proposal. And don't worry about >> maintaining compatibility with archaic Linux versions for >> JDK9 (less >> cleanup to do later). >> >> Thanks, >> David >> >> Jeremy >> >> On Wed, Jul 22, 2015 at 11:22 AM, Jeremy Manson >> > > > >> > >> >> > >>> wrote: >> >> Hey folks, >> >> os::current_thread_id on Linux now maps to >> pthread_self. The >> problem with pthread_self is that it only makes >> sense in >> the context >> of the running process. When it is written out to >> the log >> (as it is >> in several places), there really isn't a way >> (AFAICT) for >> the user >> to map it back to anything useful. >> >> As it happens, that value is mostly used to write >> to the >> log. The >> places where it doesn't do so don't seem to need >> to use >> pthread_self >> for any particular reason. >> >> Meanwhile, the SIGQUIT stack dump >> uses java_thread->osthread()->thread_id() as the >> nid. On >> Linux, >> that maps back to os::Linux::gettid(), whish is >> also what gets >> exposed in /proc. That makes it much easier to >> see what >> threads >> might be doing the log write. >> >> Would it be okay to change os::current_thread_id >> to point >> to os::Linux::gettid()? That way, it can be >> mapped back to the >> output of a SIGQUIT dump. >> >> The downside of gettid() is that it is only >> available on >> Linux>2.4.11, but that dates from 2001. If we >> really still >> want to >> support it, we could check for that. >> >> Thoughts? >> >> Jeremy >> >> >> >> >> From daniel.daugherty at oracle.com Thu Jul 23 21:44:18 2015 From: daniel.daugherty at oracle.com (Daniel D. Daugherty) Date: Thu, 23 Jul 2015 15:44:18 -0600 Subject: RFR(S) Contended Locking fast notify bucket (8075171) In-Reply-To: <559724B0.6000507@oracle.com> References: <555A4678.7020308@oracle.com> <559724B0.6000507@oracle.com> Message-ID: <55B16032.3010904@oracle.com> David H and I were IM'ing about adding options and it occurred to us that the new "InlineNotify" option is added as a "product" option and it should have been added as a "diagnostic" option. Diagnostic options are easier to remove in the future. JDK-8132286 change 'InlineNotify' flag option from "product" to "diagnostic" https://bugs.openjdk.java.net/browse/JDK-8132286 And here's the diff: $ hg diff diff -r 5ec83d7b8a2d src/share/vm/runtime/globals.hpp --- a/src/share/vm/runtime/globals.hpp Thu Jul 23 16:36:36 2015 +0000 +++ b/src/share/vm/runtime/globals.hpp Thu Jul 23 14:36:23 2015 -0700 @@ -1286,7 +1286,7 @@ public: \ experimental(intx, SyncVerbose, 0, "(Unstable)") \ \ - product(bool, InlineNotify, true, "intrinsify subset of notify" ) \ + diagnostic(bool, InlineNotify, true, "intrinsify subset of notify") \ \ experimental(intx, ClearFPUAtPark, 0, "(Unsafe, Unstable)") \ \ Under the new "trivial" change rules, may I have a single (R)eviewer for this change? Thanks, in advance, for any comments, questions or suggestions. Dan P.S. For completeness, I also filed: JDK-8132287 deprecate the "InlineNotify" flag option in JDK10 https://bugs.openjdk.java.net/browse/JDK-8132287 and set the "Fix Version/s" to '10' On 7/3/15 6:11 PM, Daniel D. Daugherty wrote: > Greetings, > > I've updated the patch for Contended Locking fast notify bucket > based on David H's and Karen's comments. > > This work is being tracked by the following bug ID: > > JDK-8075171 Contended Locking fast notify bucket > https://bugs.openjdk.java.net/browse/JDK-8075171 > > Here is the webrev URL: > > http://cr.openjdk.java.net/~dcubed/8075171-webrev/1-jdk9-hs-rt/ > > Here is the JEP link: > > https://bugs.openjdk.java.net/browse/JDK-8046133 > > Testing: > > - RBT vm.quick batches (in process) > - JPRT test jobs > - MonitorWaitNotifyStresser micro-benchmark (in process) > - CallTimerGrid stress testing (in process) > > > The changes in this round are in only four of the files: > > src/share/vm/opto/runtime.cpp > > - deleted comment about hashCode() that belongs in a different bucket > > src/share/vm/runtime/objectMonitor.cpp > > - add MAX_RECHECK_INTERVAL define for use in ObjectMonitor::EnterI() > - cleanup recheck interval code > - ObjectMonitor::INotify() return type is now "void" > - delete duplicate comments, clarify/rewrite some comments > > src/share/vm/runtime/objectMonitor.hpp > > - ObjectMonitor::INotify() return type is now "void" > > src/share/vm/runtime/synchronizer.cpp > > - clarify/rewrite comments, add additional comments > - cleanup variables in ObjectSynchronizer::quick_notify > - refactor loop to be more clear > - delete unused enum MaximumRecheckInterval > > The easiest way to review the delta is to download the two patch > files and compare them in something like jfilemerge: > > http://cr.openjdk.java.net/~dcubed/8075171-webrev/0-jdk9-hs-rt/hotspot.patch > > http://cr.openjdk.java.net/~dcubed/8075171-webrev/1-jdk9-hs-rt/hotspot.patch > > > Dan > > > On 5/18/15 2:07 PM, Daniel D. Daugherty wrote: >> Greetings, >> >> I have the Contended Locking fast notify bucket ready for review. >> >> The code changes in this bucket are the final piece in the triad >> of {fast-enter, fast-exit, fast-notify} changes. There are no >> macro assembler changes in this bucket (yeah!), but there are >> code review cleanups motivated by comments on other buckets, e.g., >> changing variables like 'Tally' -> 'tally'. >> >> This work is being tracked by the following bug ID: >> >> JDK-8075171 Contended Locking fast notify bucket >> https://bugs.openjdk.java.net/browse/JDK-8075171 >> >> Here is the webrev URL: >> >> http://cr.openjdk.java.net/~dcubed/8075171-webrev/0-jdk9-hs-rt/ >> >> Here is the JEP link: >> >> https://bugs.openjdk.java.net/browse/JDK-8046133 >> >> Testing: >> >> - Aurora Adhoc RT/SVC baseline batch >> - JPRT test jobs >> - MonitorWaitNotifyStresser micro-benchmark (in process) >> - CallTimerGrid stress testing (in process) >> - Aurora performance testing: >> - out of the box for the "promotion" and 32-bit server configs >> - heavy weight monitors for the "promotion" and 32-bit server configs >> (-XX:-UseBiasedLocking -XX:+UseHeavyMonitors) >> (in process) >> >> The hang somehow introduced by the "fast enter" bucket is still >> unresolved, but progress is being made. That work is being tracked >> by the following bug: >> >> JDK-8077392 Stream fork/join tasks occasionally fail to complete >> https://bugs.openjdk.java.net/browse/JDK-8077392 >> >> You'll see a change that re-enables the "fast enter" bucket in this >> webrev, but that change will not be pushed when we're done with the >> review of this bucket unless JDK-8077392 is resolved. >> >> Thanks, in advance, for any comments, questions or suggestions. >> >> Gory details about the changes are below... >> >> Dan >> >> >> 8075171 summary of changes: >> >> src/share/vm/classfile/vmSymbols.hpp >> - Add do_intrinsic() entries for _notify and _notifyAll >> >> src/share/vm/opto/library_call.cpp >> - Add optional inline_notify() that is controlled by new >> '-XX:[+-]InlineNotify' option >> >> src/share/vm/opto/runtime.cpp >> src/share/vm/opto/runtime.hpp >> - Add OptoRuntime::monitor_notify_C() and >> OptoRuntime::monitor_notifyAll_C() functions to support >> the new "fast notify" code paths >> - Add new OptoRuntime::monitor_notify_Type() to support >> the above two new functions >> >> src/share/vm/runtime/globals.hpp >> - Add '-XX:[+-]InlineNotify' option; default option value is >> enabled (true) >> >> src/share/vm/runtime/objectMonitor.cpp >> src/share/vm/runtime/objectMonitor.hpp >> - Refactor ObjectMonitor::notify() and ObjectMonitor::notifyAll() >> into wrappers that call the new ObjectMonitor::INotify() >> - Add new ObjectMonitor::INotify() to reduce code duplication >> between "notify" and "notifyAll" code paths >> >> src/share/vm/runtime/sharedRuntime.cpp >> - Temporarily re-enable the "fast enter" optimization in order >> to do performance testing. JDK-8077392 is still unresolved, >> but progress is being made. >> >> src/share/vm/runtime/synchronizer.cpp >> src/share/vm/runtime/synchronizer.hpp >> - Add ObjectSynchronizer::quick_notify() that implements the >> new "fast notify" code paths >> - The new code handles a couple of special cases where the >> "notify" can be done without the heavy weight slow-path >> (thread state transitions and other baggage) >> >> > > > From coleen.phillimore at oracle.com Thu Jul 23 21:45:59 2015 From: coleen.phillimore at oracle.com (Coleen Phillimore) Date: Thu, 23 Jul 2015 17:45:59 -0400 Subject: RFR(S) Contended Locking fast notify bucket (8075171) In-Reply-To: <55B16032.3010904@oracle.com> References: <555A4678.7020308@oracle.com> <559724B0.6000507@oracle.com> <55B16032.3010904@oracle.com> Message-ID: <55B16097.9090900@oracle.com> I approve. This is better. Coleen On 7/23/15 5:44 PM, Daniel D. Daugherty wrote: > David H and I were IM'ing about adding options and it occurred to us > that the new "InlineNotify" option is added as a "product" option and > it should have been added as a "diagnostic" option. Diagnostic options > are easier to remove in the future. > > JDK-8132286 change 'InlineNotify' flag option from "product" to > "diagnostic" > https://bugs.openjdk.java.net/browse/JDK-8132286 > > And here's the diff: > > $ hg diff > diff -r 5ec83d7b8a2d src/share/vm/runtime/globals.hpp > --- a/src/share/vm/runtime/globals.hpp Thu Jul 23 16:36:36 2015 +0000 > +++ b/src/share/vm/runtime/globals.hpp Thu Jul 23 14:36:23 2015 -0700 > @@ -1286,7 +1286,7 @@ public: > \ > experimental(intx, SyncVerbose, 0, > "(Unstable)") \ > \ > - product(bool, InlineNotify, true, "intrinsify subset of notify" > ) \ > + diagnostic(bool, InlineNotify, true, "intrinsify subset of > notify") \ > \ > experimental(intx, ClearFPUAtPark, 0, "(Unsafe, > Unstable)") \ > \ > > Under the new "trivial" change rules, may I have a single (R)eviewer > for this change? > > Thanks, in advance, for any comments, questions or suggestions. > > Dan > > P.S. > For completeness, I also filed: > > JDK-8132287 deprecate the "InlineNotify" flag option in JDK10 > https://bugs.openjdk.java.net/browse/JDK-8132287 > > and set the "Fix Version/s" to '10' > > > On 7/3/15 6:11 PM, Daniel D. Daugherty wrote: >> Greetings, >> >> I've updated the patch for Contended Locking fast notify bucket >> based on David H's and Karen's comments. >> >> This work is being tracked by the following bug ID: >> >> JDK-8075171 Contended Locking fast notify bucket >> https://bugs.openjdk.java.net/browse/JDK-8075171 >> >> Here is the webrev URL: >> >> http://cr.openjdk.java.net/~dcubed/8075171-webrev/1-jdk9-hs-rt/ >> >> Here is the JEP link: >> >> https://bugs.openjdk.java.net/browse/JDK-8046133 >> >> Testing: >> >> - RBT vm.quick batches (in process) >> - JPRT test jobs >> - MonitorWaitNotifyStresser micro-benchmark (in process) >> - CallTimerGrid stress testing (in process) >> >> >> The changes in this round are in only four of the files: >> >> src/share/vm/opto/runtime.cpp >> >> - deleted comment about hashCode() that belongs in a different bucket >> >> src/share/vm/runtime/objectMonitor.cpp >> >> - add MAX_RECHECK_INTERVAL define for use in ObjectMonitor::EnterI() >> - cleanup recheck interval code >> - ObjectMonitor::INotify() return type is now "void" >> - delete duplicate comments, clarify/rewrite some comments >> >> src/share/vm/runtime/objectMonitor.hpp >> >> - ObjectMonitor::INotify() return type is now "void" >> >> src/share/vm/runtime/synchronizer.cpp >> >> - clarify/rewrite comments, add additional comments >> - cleanup variables in ObjectSynchronizer::quick_notify >> - refactor loop to be more clear >> - delete unused enum MaximumRecheckInterval >> >> The easiest way to review the delta is to download the two patch >> files and compare them in something like jfilemerge: >> >> http://cr.openjdk.java.net/~dcubed/8075171-webrev/0-jdk9-hs-rt/hotspot.patch >> >> http://cr.openjdk.java.net/~dcubed/8075171-webrev/1-jdk9-hs-rt/hotspot.patch >> >> >> Dan >> >> >> On 5/18/15 2:07 PM, Daniel D. Daugherty wrote: >>> Greetings, >>> >>> I have the Contended Locking fast notify bucket ready for review. >>> >>> The code changes in this bucket are the final piece in the triad >>> of {fast-enter, fast-exit, fast-notify} changes. There are no >>> macro assembler changes in this bucket (yeah!), but there are >>> code review cleanups motivated by comments on other buckets, e.g., >>> changing variables like 'Tally' -> 'tally'. >>> >>> This work is being tracked by the following bug ID: >>> >>> JDK-8075171 Contended Locking fast notify bucket >>> https://bugs.openjdk.java.net/browse/JDK-8075171 >>> >>> Here is the webrev URL: >>> >>> http://cr.openjdk.java.net/~dcubed/8075171-webrev/0-jdk9-hs-rt/ >>> >>> Here is the JEP link: >>> >>> https://bugs.openjdk.java.net/browse/JDK-8046133 >>> >>> Testing: >>> >>> - Aurora Adhoc RT/SVC baseline batch >>> - JPRT test jobs >>> - MonitorWaitNotifyStresser micro-benchmark (in process) >>> - CallTimerGrid stress testing (in process) >>> - Aurora performance testing: >>> - out of the box for the "promotion" and 32-bit server configs >>> - heavy weight monitors for the "promotion" and 32-bit server configs >>> (-XX:-UseBiasedLocking -XX:+UseHeavyMonitors) >>> (in process) >>> >>> The hang somehow introduced by the "fast enter" bucket is still >>> unresolved, but progress is being made. That work is being tracked >>> by the following bug: >>> >>> JDK-8077392 Stream fork/join tasks occasionally fail to complete >>> https://bugs.openjdk.java.net/browse/JDK-8077392 >>> >>> You'll see a change that re-enables the "fast enter" bucket in this >>> webrev, but that change will not be pushed when we're done with the >>> review of this bucket unless JDK-8077392 is resolved. >>> >>> Thanks, in advance, for any comments, questions or suggestions. >>> >>> Gory details about the changes are below... >>> >>> Dan >>> >>> >>> 8075171 summary of changes: >>> >>> src/share/vm/classfile/vmSymbols.hpp >>> - Add do_intrinsic() entries for _notify and _notifyAll >>> >>> src/share/vm/opto/library_call.cpp >>> - Add optional inline_notify() that is controlled by new >>> '-XX:[+-]InlineNotify' option >>> >>> src/share/vm/opto/runtime.cpp >>> src/share/vm/opto/runtime.hpp >>> - Add OptoRuntime::monitor_notify_C() and >>> OptoRuntime::monitor_notifyAll_C() functions to support >>> the new "fast notify" code paths >>> - Add new OptoRuntime::monitor_notify_Type() to support >>> the above two new functions >>> >>> src/share/vm/runtime/globals.hpp >>> - Add '-XX:[+-]InlineNotify' option; default option value is >>> enabled (true) >>> >>> src/share/vm/runtime/objectMonitor.cpp >>> src/share/vm/runtime/objectMonitor.hpp >>> - Refactor ObjectMonitor::notify() and ObjectMonitor::notifyAll() >>> into wrappers that call the new ObjectMonitor::INotify() >>> - Add new ObjectMonitor::INotify() to reduce code duplication >>> between "notify" and "notifyAll" code paths >>> >>> src/share/vm/runtime/sharedRuntime.cpp >>> - Temporarily re-enable the "fast enter" optimization in order >>> to do performance testing. JDK-8077392 is still unresolved, >>> but progress is being made. >>> >>> src/share/vm/runtime/synchronizer.cpp >>> src/share/vm/runtime/synchronizer.hpp >>> - Add ObjectSynchronizer::quick_notify() that implements the >>> new "fast notify" code paths >>> - The new code handles a couple of special cases where the >>> "notify" can be done without the heavy weight slow-path >>> (thread state transitions and other baggage) >>> >>> >> >> >> > From daniel.daugherty at oracle.com Thu Jul 23 21:46:59 2015 From: daniel.daugherty at oracle.com (Daniel D. Daugherty) Date: Thu, 23 Jul 2015 15:46:59 -0600 Subject: RFR(S) Contended Locking fast notify bucket (8075171) In-Reply-To: <55B16097.9090900@oracle.com> References: <555A4678.7020308@oracle.com> <559724B0.6000507@oracle.com> <55B16032.3010904@oracle.com> <55B16097.9090900@oracle.com> Message-ID: <55B160D3.7030304@oracle.com> Thanks! Dan On 7/23/15 3:45 PM, Coleen Phillimore wrote: > > I approve. This is better. > Coleen > > On 7/23/15 5:44 PM, Daniel D. Daugherty wrote: >> David H and I were IM'ing about adding options and it occurred to us >> that the new "InlineNotify" option is added as a "product" option and >> it should have been added as a "diagnostic" option. Diagnostic options >> are easier to remove in the future. >> >> JDK-8132286 change 'InlineNotify' flag option from "product" to >> "diagnostic" >> https://bugs.openjdk.java.net/browse/JDK-8132286 >> >> And here's the diff: >> >> $ hg diff >> diff -r 5ec83d7b8a2d src/share/vm/runtime/globals.hpp >> --- a/src/share/vm/runtime/globals.hpp Thu Jul 23 16:36:36 2015 +0000 >> +++ b/src/share/vm/runtime/globals.hpp Thu Jul 23 14:36:23 2015 -0700 >> @@ -1286,7 +1286,7 @@ public: >> \ >> experimental(intx, SyncVerbose, 0, >> "(Unstable)") \ >> \ >> - product(bool, InlineNotify, true, "intrinsify subset of notify" >> ) \ >> + diagnostic(bool, InlineNotify, true, "intrinsify subset of >> notify") \ >> \ >> experimental(intx, ClearFPUAtPark, 0, "(Unsafe, >> Unstable)") \ >> \ >> >> Under the new "trivial" change rules, may I have a single (R)eviewer >> for this change? >> >> Thanks, in advance, for any comments, questions or suggestions. >> >> Dan >> >> P.S. >> For completeness, I also filed: >> >> JDK-8132287 deprecate the "InlineNotify" flag option in JDK10 >> https://bugs.openjdk.java.net/browse/JDK-8132287 >> >> and set the "Fix Version/s" to '10' >> >> >> On 7/3/15 6:11 PM, Daniel D. Daugherty wrote: >>> Greetings, >>> >>> I've updated the patch for Contended Locking fast notify bucket >>> based on David H's and Karen's comments. >>> >>> This work is being tracked by the following bug ID: >>> >>> JDK-8075171 Contended Locking fast notify bucket >>> https://bugs.openjdk.java.net/browse/JDK-8075171 >>> >>> Here is the webrev URL: >>> >>> http://cr.openjdk.java.net/~dcubed/8075171-webrev/1-jdk9-hs-rt/ >>> >>> Here is the JEP link: >>> >>> https://bugs.openjdk.java.net/browse/JDK-8046133 >>> >>> Testing: >>> >>> - RBT vm.quick batches (in process) >>> - JPRT test jobs >>> - MonitorWaitNotifyStresser micro-benchmark (in process) >>> - CallTimerGrid stress testing (in process) >>> >>> >>> The changes in this round are in only four of the files: >>> >>> src/share/vm/opto/runtime.cpp >>> >>> - deleted comment about hashCode() that belongs in a different bucket >>> >>> src/share/vm/runtime/objectMonitor.cpp >>> >>> - add MAX_RECHECK_INTERVAL define for use in ObjectMonitor::EnterI() >>> - cleanup recheck interval code >>> - ObjectMonitor::INotify() return type is now "void" >>> - delete duplicate comments, clarify/rewrite some comments >>> >>> src/share/vm/runtime/objectMonitor.hpp >>> >>> - ObjectMonitor::INotify() return type is now "void" >>> >>> src/share/vm/runtime/synchronizer.cpp >>> >>> - clarify/rewrite comments, add additional comments >>> - cleanup variables in ObjectSynchronizer::quick_notify >>> - refactor loop to be more clear >>> - delete unused enum MaximumRecheckInterval >>> >>> The easiest way to review the delta is to download the two patch >>> files and compare them in something like jfilemerge: >>> >>> http://cr.openjdk.java.net/~dcubed/8075171-webrev/0-jdk9-hs-rt/hotspot.patch >>> >>> http://cr.openjdk.java.net/~dcubed/8075171-webrev/1-jdk9-hs-rt/hotspot.patch >>> >>> >>> Dan >>> >>> >>> On 5/18/15 2:07 PM, Daniel D. Daugherty wrote: >>>> Greetings, >>>> >>>> I have the Contended Locking fast notify bucket ready for review. >>>> >>>> The code changes in this bucket are the final piece in the triad >>>> of {fast-enter, fast-exit, fast-notify} changes. There are no >>>> macro assembler changes in this bucket (yeah!), but there are >>>> code review cleanups motivated by comments on other buckets, e.g., >>>> changing variables like 'Tally' -> 'tally'. >>>> >>>> This work is being tracked by the following bug ID: >>>> >>>> JDK-8075171 Contended Locking fast notify bucket >>>> https://bugs.openjdk.java.net/browse/JDK-8075171 >>>> >>>> Here is the webrev URL: >>>> >>>> http://cr.openjdk.java.net/~dcubed/8075171-webrev/0-jdk9-hs-rt/ >>>> >>>> Here is the JEP link: >>>> >>>> https://bugs.openjdk.java.net/browse/JDK-8046133 >>>> >>>> Testing: >>>> >>>> - Aurora Adhoc RT/SVC baseline batch >>>> - JPRT test jobs >>>> - MonitorWaitNotifyStresser micro-benchmark (in process) >>>> - CallTimerGrid stress testing (in process) >>>> - Aurora performance testing: >>>> - out of the box for the "promotion" and 32-bit server configs >>>> - heavy weight monitors for the "promotion" and 32-bit server >>>> configs >>>> (-XX:-UseBiasedLocking -XX:+UseHeavyMonitors) >>>> (in process) >>>> >>>> The hang somehow introduced by the "fast enter" bucket is still >>>> unresolved, but progress is being made. That work is being tracked >>>> by the following bug: >>>> >>>> JDK-8077392 Stream fork/join tasks occasionally fail to complete >>>> https://bugs.openjdk.java.net/browse/JDK-8077392 >>>> >>>> You'll see a change that re-enables the "fast enter" bucket in this >>>> webrev, but that change will not be pushed when we're done with the >>>> review of this bucket unless JDK-8077392 is resolved. >>>> >>>> Thanks, in advance, for any comments, questions or suggestions. >>>> >>>> Gory details about the changes are below... >>>> >>>> Dan >>>> >>>> >>>> 8075171 summary of changes: >>>> >>>> src/share/vm/classfile/vmSymbols.hpp >>>> - Add do_intrinsic() entries for _notify and _notifyAll >>>> >>>> src/share/vm/opto/library_call.cpp >>>> - Add optional inline_notify() that is controlled by new >>>> '-XX:[+-]InlineNotify' option >>>> >>>> src/share/vm/opto/runtime.cpp >>>> src/share/vm/opto/runtime.hpp >>>> - Add OptoRuntime::monitor_notify_C() and >>>> OptoRuntime::monitor_notifyAll_C() functions to support >>>> the new "fast notify" code paths >>>> - Add new OptoRuntime::monitor_notify_Type() to support >>>> the above two new functions >>>> >>>> src/share/vm/runtime/globals.hpp >>>> - Add '-XX:[+-]InlineNotify' option; default option value is >>>> enabled (true) >>>> >>>> src/share/vm/runtime/objectMonitor.cpp >>>> src/share/vm/runtime/objectMonitor.hpp >>>> - Refactor ObjectMonitor::notify() and ObjectMonitor::notifyAll() >>>> into wrappers that call the new ObjectMonitor::INotify() >>>> - Add new ObjectMonitor::INotify() to reduce code duplication >>>> between "notify" and "notifyAll" code paths >>>> >>>> src/share/vm/runtime/sharedRuntime.cpp >>>> - Temporarily re-enable the "fast enter" optimization in order >>>> to do performance testing. JDK-8077392 is still unresolved, >>>> but progress is being made. >>>> >>>> src/share/vm/runtime/synchronizer.cpp >>>> src/share/vm/runtime/synchronizer.hpp >>>> - Add ObjectSynchronizer::quick_notify() that implements the >>>> new "fast notify" code paths >>>> - The new code handles a couple of special cases where the >>>> "notify" can be done without the heavy weight slow-path >>>> (thread state transitions and other baggage) >>>> >>>> >>> >>> >>> >> > From david.holmes at oracle.com Fri Jul 24 00:28:49 2015 From: david.holmes at oracle.com (David Holmes) Date: Fri, 24 Jul 2015 10:28:49 +1000 Subject: os::current_thread_id on Linux In-Reply-To: References: <55B04C88.5080302@oracle.com> <55B08251.6030909@oracle.com> <55B094B7.6060309@oracle.com> Message-ID: <55B186C1.1080706@oracle.com> On 24/07/2015 4:03 AM, Jeremy Manson wrote: > Quick rundown: Thanks - sorry I couldn't get to this last night. > On Solaris, osthread and current_thread_id are the same (thr_self()). So both user-thread > On Windows, they are the same (GetCurrentThreadId()). Windows is single-level. > On OS X, they are the same (pthread_mach_thread_np(::pthread_self())) Both "kernel" thread > On AIX, current_thread_id is pthread_self, and osthread is thread_self() > On non-OS X BSD, current_thread_id is pthread_self, and osthread is the > syscall. One user and one kernel. > I don't see any code that depends on the particular value of > current_thread_id (for example, assuming that it is the same as > thread_self in a meaningful way on AIX, or that it is pthread_self on > AIX). My guess is that the AIX and non-OS X code are just following the > Linux convention. Yes - port by copy. :( > I'm happy to make current_thread_id consistent with > osthread on all of the platforms, or just on Linux (with the > understanding that I can't really test AIX and OS X easily). Just make the change on Linux, there's really no consistency here to aim for. :( Thanks, David > Jeremy > > On Thu, Jul 23, 2015 at 12:16 AM, David Holmes > wrote: > > On 23/07/2015 4:11 PM, Jeremy Manson wrote: > > Okay. TBH, thinking about it more, it's a little weird for > something > named os::current_thread_id() to be different from > Thread::current()->osThread->thread_id(), or for either of them > to be > different from "what the OS thinks the thread id is", so it > seems like > the Right Thing to Do (in the absence of any platform-specific > issues). > > > When there are two different levels of thread ID it isn't that > simple - especially as, like you say, one can be used to look in > /proc while the other can't. So perhaps better naming is in order. > > Cheers, > David > > Jeremy > > On Wed, Jul 22, 2015 at 10:57 PM, David Holmes > > >> wrote: > > On 23/07/2015 3:15 PM, Jeremy Manson wrote: > > Hey David, > > Thanks for the offer of sponsorship. My goal here is > really to > make the > log output on Linux usable. I want to be able to map > the log output > back to an actual thread. I don't think it really > matters to > users if > the API consistently means "kernel thread ID" or > "threading API > thread > ID", as long as they can figure out what the output means. > > > I think consistency is important else developers don't know > what > they should be using where - which is the current situation. > > Since what I am doing (in effect) to accomplish my goal > is to ensure > that the API returns the same value as > osthread()->thread_id() > does for > the current thread, I could just... do precisely that. > os::current_thread_id could just return > osthread()->thread_id() > for the > current thread. I don't have easy access to anything > for testing > other > than Linux, though, so whether it worked (or even > compiled) on > the other > platforms would be a bit of a guess (per the last time > we did > this dance). > > > Defining os::current_thread_id() to be > Thread::current()->osThread()->thread_id() assumes you can make > those calls in the context in which os::current_thread_id() > is used > - if we crash during thread startup then some of those may > be null > and the id not even set. The current implementation is > independent > of the state of thread within the VM. > > So its okay to return the same thing as > Thread::current()->osThread()->thread_id() but it needs to > be done > directly. > > Again any platform for which this would cause a change in > behaviour > needs to be examined. It may be other platforms have the same > problem you are trying to fix for linux. > > If I get time later I'll try to check what each platform does. > > Thanks, > David > > Seem reasonable? > > Jeremy > > On Wed, Jul 22, 2015 at 7:08 PM, David Holmes > > > > > >>> wrote: > > On 23/07/2015 8:01 AM, Jeremy Manson wrote: > > Based on the feedback, this seems to be a good > idea, > approximately. > Coleen would have sponsored, but she's going > on vacation. > Anyone else > feel like sponsoring? > > > Hold up a minute! :) There are different notions > of "native > thread > id" that exist. First we have the "user level > thread id" - > this is > what is reported by pthread_self in POSIX and > thr_self in > UI. Then > we also have the OS specific "thread" id, also > referred to > as a LWP > or "kernel scheduling entity" or "kernel thread" - > the id > for this > is what gettid() maps back to on Linux. This > distinction > may not > exist on all platforms. > > Unfortunately os::current_thread_id does not > define which > of these > it represents: > > // thread id on Linux/64bit is 64bit, on Windows and > Solaris, it's > 32bit > static intx current_thread_id(); > > and so on some platforms it returns the "user > thread id" (eg > pthread_self()), and on some it returns the same > as gettid > (ie OSX - > but I don't know if the mach thread id is truly a > "LWP" id ?). > > Also note that on some platforms the osThread > stores the id > of the > "user-level thread" and on some the "kernel > thread". Hence > another > source of confusion. :( > > So if you want to enforce that os::current_thread_id() > represents > the "kernel thread" then that should be applied > consistently across > all platforms**, and for platforms for which there > is a > change to > make you have to ensure the usage of > os::current_thread_id() is not > semantically altered by the change. > > ** Of course a platform may only have a single > notion of > "thread" > > I'm happy to sponsor such a proposal. And don't > worry about > maintaining compatibility with archaic Linux > versions for > JDK9 (less > cleanup to do later). > > Thanks, > David > > Jeremy > > On Wed, Jul 22, 2015 at 11:22 AM, Jeremy Manson > > > > > >> > > > > > > >>>> wrote: > > Hey folks, > > os::current_thread_id on Linux now maps to > pthread_self. The > problem with pthread_self is that it only > makes > sense in > the context > of the running process. When it is > written out to > the log > (as it is > in several places), there really isn't a way > (AFAICT) for > the user > to map it back to anything useful. > > As it happens, that value is mostly used > to write > to the > log. The > places where it doesn't do so don't seem > to need > to use > pthread_self > for any particular reason. > > Meanwhile, the SIGQUIT stack dump > uses java_thread->osthread()->thread_id() > as the > nid. On > Linux, > that maps back to os::Linux::gettid(), > whish is > also what gets > exposed in /proc. That makes it much > easier to > see what > threads > might be doing the log write. > > Would it be okay to change > os::current_thread_id > to point > to os::Linux::gettid()? That way, it can be > mapped back to the > output of a SIGQUIT dump. > > The downside of gettid() is that it is only > available on > Linux>2.4.11, but that dates from 2001. > If we > really still > want to > support it, we could check for that. > > Thoughts? > > Jeremy > > > > > From goetz.lindenmaier at sap.com Fri Jul 24 05:45:20 2015 From: goetz.lindenmaier at sap.com (Lindenmaier, Goetz) Date: Fri, 24 Jul 2015 05:45:20 +0000 Subject: RFR(S): LogTouchedMethods (8025692) asserts if TieredCompilation is off. In-Reply-To: <55B11993.603@oracle.com> References: <4295855A5C1DE049A61835A1887419CC2D00907C@DEWDFEMB12A.global.corp.sap> <55B11993.603@oracle.com> Message-ID: <4295855A5C1DE049A61835A1887419CC2D00A311@DEWDFEMB12A.global.corp.sap> Hi Ioi, Thanks for the review! Best regards, Goetz. -----Original Message----- From: Ioi Lam [mailto:ioi.lam at oracle.com] Sent: Thursday, July 23, 2015 6:43 PM To: Lindenmaier, Goetz; hotspot-runtime-dev at openjdk.java.net Subject: Re: RFR(S): LogTouchedMethods (8025692) asserts if TieredCompilation is off. This looks good to me. Thanks - Ioi On 7/23/15 6:30 AM, Lindenmaier, Goetz wrote: > Hi, > > LogTouchedMethods causes the template interpreter to generate profiling code even > if no compiler is used. If TieredCompilation is off, code containing an assertion > that checks that UseCompiler is set, is reached. > This assertion exists on the sparc and ppc platforms. > Fix: > Check for LogTouchedMethods in the assertion. > Also added testcase with -XX:-TieredCompilation. > > The problem can be reproduced with the new test case on solaris sparc. > > Please review this change. I please need a sponsor. > http://cr.openjdk.java.net/~goetz/webrevs/8132242-jtregPTM/webrev.01/ > > Best regards, > Goetz Lindenmaier From coleen.phillimore at oracle.com Fri Jul 24 13:50:25 2015 From: coleen.phillimore at oracle.com (Coleen Phillimore) Date: Fri, 24 Jul 2015 09:50:25 -0400 Subject: RFR(XS) 8081695: Old verifier fails to reject bad access to protected method In-Reply-To: <55A915C2.1040204@oracle.com> References: <55A915C2.1040204@oracle.com> Message-ID: <55B242A1.3060005@oracle.com> Harold, I don't know if this is still out for review, but it looks fine. We'll soon find out whose old bytecodes motivated this fix in the first place. Good luck, Coleen On 7/17/15 10:48 AM, harold seigel wrote: > Hi, > > Please review this small change to fix bug JDK-8081695. The (old) > type inferencing verifier excluded a particular protected access check > for invokespecial calls of protected methods. That exclusion was done > because of bytecodes generated by very old broken compilers. It is > being removed because it violates the JVM-8 Spec and should no longer > be needed. > > Open Webrev: http://cr.openjdk.java.net/~hseigel/bug_8081695/ > > JBS Bug: https://bugs.openjdk.java.net/browse/JDK-8081695 > > The fix was tested with JCK Lang and VM tests, WLS sanity testing, the > UTE quick tests, and the hotspot, and JDK vm, java/io, java/lang, and > java/util JTreg tests. > > Thanks, Harold From harold.seigel at oracle.com Fri Jul 24 13:52:35 2015 From: harold.seigel at oracle.com (harold seigel) Date: Fri, 24 Jul 2015 09:52:35 -0400 Subject: RFR(XS) 8081695: Old verifier fails to reject bad access to protected method In-Reply-To: <55B242A1.3060005@oracle.com> References: <55A915C2.1040204@oracle.com> <55B242A1.3060005@oracle.com> Message-ID: <55B24323.6010006@oracle.com> Hi Coleen, Thanks for the review. Harold On 7/24/2015 9:50 AM, Coleen Phillimore wrote: > > Harold, > > I don't know if this is still out for review, but it looks fine. > > We'll soon find out whose old bytecodes motivated this fix in the > first place. > > Good luck, > Coleen > > On 7/17/15 10:48 AM, harold seigel wrote: >> Hi, >> >> Please review this small change to fix bug JDK-8081695. The (old) >> type inferencing verifier excluded a particular protected access >> check for invokespecial calls of protected methods. That exclusion >> was done because of bytecodes generated by very old broken >> compilers. It is being removed because it violates the JVM-8 Spec >> and should no longer be needed. >> >> Open Webrev: http://cr.openjdk.java.net/~hseigel/bug_8081695/ >> >> JBS Bug: https://bugs.openjdk.java.net/browse/JDK-8081695 >> >> The fix was tested with JCK Lang and VM tests, WLS sanity testing, >> the UTE quick tests, and the hotspot, and JDK vm, java/io, java/lang, >> and java/util JTreg tests. >> >> Thanks, Harold > From Sergey.Bylokhov at oracle.com Fri Jul 24 17:10:56 2015 From: Sergey.Bylokhov at oracle.com (Sergey Bylokhov) Date: Fri, 24 Jul 2015 20:10:56 +0300 Subject: RFR: JDK-8080511 - Refresh of jimage support In-Reply-To: <487562C8-9F9D-43B3-AF21-D99368852DDB@oracle.com> References: <165AE6EA-8FB7-4715-8D76-477692B63C95@oracle.com> <69B55DAD-6E30-4703-B2B0-4A5EEC598149@oracle.com> <487562C8-9F9D-43B3-AF21-D99368852DDB@oracle.com> Message-ID: <55B271A0.7090705@oracle.com> After the latest merge I got some issue, I assume related to this fix. Can somebody take a look to this code: import java.net.URI; import java.nio.file.*; import java.nio.file.attribute.BasicFileAttributes; public class JRTFileSystemError { public static void main(final String[] args) throws Exception { FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/")); Files.walkFileTree(fs.getPath("/java.desktop"), new SimpleFileVisitor() { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) { return FileVisitResult.CONTINUE; } }); } } It fails with "Exception in thread "main" java.nio.file.NoSuchFileException: /java.desktop". Bur previously it works correctly. Can somebody confirm this is an issue in the test(and how to change it) or in jdk? It seems that IntelliJ also broken in some way so it cannot take classes from the jdk9 after this fix. probably they should update jrt-fs.jar? On 23.06.15 19:08, Jean-Francois Denise wrote: > Hi, > an updated webrev that takes into account reviews. In addition the hotspot tests have been reworked following Christian Tornqvist suggestions. > > top: http://cr.openjdk.java.net/~jfdenise/hs-rt-jimage.3/webrev-top/ > langtools: http://cr.openjdk.java.net/~jfdenise/hs-rt-jimage.3/webrev-langtools/ > hotspot: http://cr.openjdk.java.net/~jfdenise/hs-rt-jimage.3/webrev-hotspot/ > jdk: http://cr.openjdk.java.net/~jfdenise/hs-rt-jimage.3/webrev-jdk/ > > Testing: > JCK(s) tests are passing (ran only on Mac OS) > Hotspot tests are passing (All platforms) > Java PIT tests are passing (All platforms). Ran once on https://bugs.openjdk.java.net/browse/JDK-8129592 > > Thanks. > JF > > On 23 Jun 2015, at 14:10, Jean-Francois Denise wrote: > >> Hi Paul, >> >> On 19 Jun 2015, at 16:39, Paul Sandoz wrote: >> >>> On Jun 18, 2015, at 2:08 AM, Jim Laskey (Oracle) wrote: >>> >>>> https://bugs.openjdk.java.net/browse/JDK-8080511 >>>> >>>> This is an long overdue refresh of the jimage support in the JDK9-dev repo. This includes native support for reading jimage files, improved jrt-fs (java runtime file system) support for retrieving modules and packages from the runtime, and improved performance for langtools in the presence of jrt-fs. >>>> >>>> http://cr.openjdk.java.net/~jlaskey/hs-rt-jimage/webrev-top >>>> http://cr.openjdk.java.net/~jlaskey/hs-rt-jimage/webrev-jdk >>> I eyeballed the JDK changes. Just two thing: >>> >>> make/src/classes/build/tools/module/ModuleArchive.java >>> >>> 90 @Override >>> 91 public Stream entries() { >>> 92 List entries = new ArrayList<>(); >>> 93 try { >>> 94 if (classes != null) >>> 95 Files.walk(classes) >>> 96 .sorted() >>> 97 .filter(p -> !Files.isDirectory(p) >>> 98 && !classes.relativize(p).toString().startsWith("_the.") >>> 99 && !classes.relativize(p).toString().equals("javac_state")) >>> 100 .map(p -> toEntry(p, classes, EntryType.CLASS_OR_RESOURCE)) >>> 101 .forEach(entries::add); >>> 102 if (cmds != null) >>> 103 Files.walk(cmds) >>> 104 .filter(p -> !Files.isDirectory(p)) >>> 105 .map(p -> toEntry(p, cmds, EntryType.NATIVE_CMD)) >>> 106 .forEach(entries::add); >>> 107 if (libs != null) >>> 108 Files.walk(libs) >>> 109 .filter(p -> !Files.isDirectory(p)) >>> 110 .map(p -> toEntry(p, libs, EntryType.NATIVE_LIB)) >>> 111 .forEach(entries::add); >>> 112 if (configs != null) >>> 113 Files.walk(configs) >>> 114 .filter(p -> !Files.isDirectory(p)) >>> 115 .map(p -> toEntry(p, configs, EntryType.CONFIG)) >>> 116 .forEach(entries::add); >>> 117 } catch (IOException ioe) { >>> 118 throw new UncheckedIOException(ioe); >>> 119 } >>> 120 return entries.stream(); >>> 121 } >>> >>> You can use collect(toList()) >> ==> OK collect used. In addition, filter first then sort, tryWithResource for 4 Files stream. >> >>> In general the contract for Archive.entries probably has to say the stream needs to be closed after use since it might cover lazy I/O based resources, so callers will need to use a try-with-resources block. >> ==> Added a note in javadoc, implemented explicit close for non lazy streams, added missing tryWithResource. Added a comment on what should be done in ModuleArchive to keep laziness. >>> Paul. >> Thanks. >> >>>> http://cr.openjdk.java.net/~jlaskey/hs-rt-jimage/webrev-hotspot >>>> http://cr.openjdk.java.net/~jlaskey/hs-rt-jimage/webrev-langtools >>>> >>>> >>>> Details: >>>> >>>> - jrt-fs provides access, via the nio FileSystem API, to the classes in a .jimage file, organized by module or by package. >>>> - Shared code for jimage support converted to native. Currently residing in hotspot, but will migrate to it?s own jdk library https://bugs.openjdk.java.net/browse/JDK-8087181 >>>> - A new archive abstraction for class/resource sources. >>>> - java based implementation layer for jimage reading to allow backport to JDK8 (jrt-fs.jar - IDE support.) >>>> - JNI support for jimage into hotspot. >>>> - White box tests written to exercise native jimage support. -- Best regards, Sergey. From jean-francois.denise at oracle.com Fri Jul 24 17:17:18 2015 From: jean-francois.denise at oracle.com (Jean-Francois Denise) Date: Fri, 24 Jul 2015 19:17:18 +0200 Subject: RFR: JDK-8080511 - Refresh of jimage support In-Reply-To: <55B271A0.7090705@oracle.com> References: <165AE6EA-8FB7-4715-8D76-477692B63C95@oracle.com> <69B55DAD-6E30-4703-B2B0-4A5EEC598149@oracle.com> <487562C8-9F9D-43B3-AF21-D99368852DDB@oracle.com> <55B271A0.7090705@oracle.com> Message-ID: <3C863E9B-2C79-4058-9588-A17C5015EBBA@oracle.com> Hi, you need to prefix your path with /modules, so ?/modules/java.desktop?. JF On 24 Jul 2015, at 19:10, Sergey Bylokhov wrote: > After the latest merge I got some issue, I assume related to this fix. > Can somebody take a look to this code: > > import java.net.URI; > import java.nio.file.*; > import java.nio.file.attribute.BasicFileAttributes; > > public class JRTFileSystemError { > > public static void main(final String[] args) throws Exception { > FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/")); > Files.walkFileTree(fs.getPath("/java.desktop"), new SimpleFileVisitor() { > @Override > public FileVisitResult visitFile(Path file, > BasicFileAttributes attrs) { > return FileVisitResult.CONTINUE; > } > }); > } > } > > It fails with "Exception in thread "main" java.nio.file.NoSuchFileException: /java.desktop". > Bur previously it works correctly. Can somebody confirm this is an issue in the test(and how to change it) or in jdk? > It seems that IntelliJ also broken in some way so it cannot take classes from the jdk9 after this fix. probably they should update jrt-fs.jar? > > > On 23.06.15 19:08, Jean-Francois Denise wrote: >> Hi, >> an updated webrev that takes into account reviews. In addition the hotspot tests have been reworked following Christian Tornqvist suggestions. >> >> top: http://cr.openjdk.java.net/~jfdenise/hs-rt-jimage.3/webrev-top/ >> langtools: http://cr.openjdk.java.net/~jfdenise/hs-rt-jimage.3/webrev-langtools/ >> hotspot: http://cr.openjdk.java.net/~jfdenise/hs-rt-jimage.3/webrev-hotspot/ >> jdk: http://cr.openjdk.java.net/~jfdenise/hs-rt-jimage.3/webrev-jdk/ >> >> Testing: >> JCK(s) tests are passing (ran only on Mac OS) >> Hotspot tests are passing (All platforms) >> Java PIT tests are passing (All platforms). Ran once on https://bugs.openjdk.java.net/browse/JDK-8129592 >> >> Thanks. >> JF >> >> On 23 Jun 2015, at 14:10, Jean-Francois Denise wrote: >> >>> Hi Paul, >>> >>> On 19 Jun 2015, at 16:39, Paul Sandoz wrote: >>> >>>> On Jun 18, 2015, at 2:08 AM, Jim Laskey (Oracle) wrote: >>>> >>>>> https://bugs.openjdk.java.net/browse/JDK-8080511 >>>>> >>>>> This is an long overdue refresh of the jimage support in the JDK9-dev repo. This includes native support for reading jimage files, improved jrt-fs (java runtime file system) support for retrieving modules and packages from the runtime, and improved performance for langtools in the presence of jrt-fs. >>>>> >>>>> http://cr.openjdk.java.net/~jlaskey/hs-rt-jimage/webrev-top >>>>> http://cr.openjdk.java.net/~jlaskey/hs-rt-jimage/webrev-jdk >>>> I eyeballed the JDK changes. Just two thing: >>>> >>>> make/src/classes/build/tools/module/ModuleArchive.java >>>> >>>> 90 @Override >>>> 91 public Stream entries() { >>>> 92 List entries = new ArrayList<>(); >>>> 93 try { >>>> 94 if (classes != null) >>>> 95 Files.walk(classes) >>>> 96 .sorted() >>>> 97 .filter(p -> !Files.isDirectory(p) >>>> 98 && !classes.relativize(p).toString().startsWith("_the.") >>>> 99 && !classes.relativize(p).toString().equals("javac_state")) >>>> 100 .map(p -> toEntry(p, classes, EntryType.CLASS_OR_RESOURCE)) >>>> 101 .forEach(entries::add); >>>> 102 if (cmds != null) >>>> 103 Files.walk(cmds) >>>> 104 .filter(p -> !Files.isDirectory(p)) >>>> 105 .map(p -> toEntry(p, cmds, EntryType.NATIVE_CMD)) >>>> 106 .forEach(entries::add); >>>> 107 if (libs != null) >>>> 108 Files.walk(libs) >>>> 109 .filter(p -> !Files.isDirectory(p)) >>>> 110 .map(p -> toEntry(p, libs, EntryType.NATIVE_LIB)) >>>> 111 .forEach(entries::add); >>>> 112 if (configs != null) >>>> 113 Files.walk(configs) >>>> 114 .filter(p -> !Files.isDirectory(p)) >>>> 115 .map(p -> toEntry(p, configs, EntryType.CONFIG)) >>>> 116 .forEach(entries::add); >>>> 117 } catch (IOException ioe) { >>>> 118 throw new UncheckedIOException(ioe); >>>> 119 } >>>> 120 return entries.stream(); >>>> 121 } >>>> >>>> You can use collect(toList()) >>> ==> OK collect used. In addition, filter first then sort, tryWithResource for 4 Files stream. >>> >>>> In general the contract for Archive.entries probably has to say the stream needs to be closed after use since it might cover lazy I/O based resources, so callers will need to use a try-with-resources block. >>> ==> Added a note in javadoc, implemented explicit close for non lazy streams, added missing tryWithResource. Added a comment on what should be done in ModuleArchive to keep laziness. >>>> Paul. >>> Thanks. >>> >>>>> http://cr.openjdk.java.net/~jlaskey/hs-rt-jimage/webrev-hotspot >>>>> http://cr.openjdk.java.net/~jlaskey/hs-rt-jimage/webrev-langtools >>>>> >>>>> >>>>> Details: >>>>> >>>>> - jrt-fs provides access, via the nio FileSystem API, to the classes in a .jimage file, organized by module or by package. >>>>> - Shared code for jimage support converted to native. Currently residing in hotspot, but will migrate to it?s own jdk library https://bugs.openjdk.java.net/browse/JDK-8087181 >>>>> - A new archive abstraction for class/resource sources. >>>>> - java based implementation layer for jimage reading to allow backport to JDK8 (jrt-fs.jar - IDE support.) >>>>> - JNI support for jimage into hotspot. >>>>> - White box tests written to exercise native jimage support. > > > -- > Best regards, Sergey. > From christian.thalinger at oracle.com Fri Jul 24 17:17:10 2015 From: christian.thalinger at oracle.com (Christian Thalinger) Date: Fri, 24 Jul 2015 10:17:10 -0700 Subject: RFR: JDK-8080511 - Refresh of jimage support In-Reply-To: <55B271A0.7090705@oracle.com> References: <165AE6EA-8FB7-4715-8D76-477692B63C95@oracle.com> <69B55DAD-6E30-4703-B2B0-4A5EEC598149@oracle.com> <487562C8-9F9D-43B3-AF21-D99368852DDB@oracle.com> <55B271A0.7090705@oracle.com> Message-ID: <04A08DDE-B9A8-4DFD-82F9-6C0A668E4BC4@oracle.com> > On Jul 24, 2015, at 10:10 AM, Sergey Bylokhov wrote: > > After the latest merge I got some issue, I assume related to this fix. > Can somebody take a look to this code: > > import java.net.URI; > import java.nio.file.*; > import java.nio.file.attribute.BasicFileAttributes; > > public class JRTFileSystemError { > > public static void main(final String[] args) throws Exception { > FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/")); > Files.walkFileTree(fs.getPath("/java.desktop"), new SimpleFileVisitor() { > @Override > public FileVisitResult visitFile(Path file, > BasicFileAttributes attrs) { > return FileVisitResult.CONTINUE; > } > }); > } > } > > It fails with "Exception in thread "main" java.nio.file.NoSuchFileException: /java.desktop?. After the refresh all modules are under /modules. Try ?/modules/java.desktop?. > Bur previously it works correctly. Can somebody confirm this is an issue in the test(and how to change it) or in jdk? > It seems that IntelliJ also broken in some way so it cannot take classes from the jdk9 after this fix. probably they should update jrt-fs.jar? > > > On 23.06.15 19:08, Jean-Francois Denise wrote: >> Hi, >> an updated webrev that takes into account reviews. In addition the hotspot tests have been reworked following Christian Tornqvist suggestions. >> >> top: http://cr.openjdk.java.net/~jfdenise/hs-rt-jimage.3/webrev-top/ >> langtools: http://cr.openjdk.java.net/~jfdenise/hs-rt-jimage.3/webrev-langtools/ >> hotspot: http://cr.openjdk.java.net/~jfdenise/hs-rt-jimage.3/webrev-hotspot/ >> jdk: http://cr.openjdk.java.net/~jfdenise/hs-rt-jimage.3/webrev-jdk/ >> >> Testing: >> JCK(s) tests are passing (ran only on Mac OS) >> Hotspot tests are passing (All platforms) >> Java PIT tests are passing (All platforms). Ran once on https://bugs.openjdk.java.net/browse/JDK-8129592 >> >> Thanks. >> JF >> >> On 23 Jun 2015, at 14:10, Jean-Francois Denise wrote: >> >>> Hi Paul, >>> >>> On 19 Jun 2015, at 16:39, Paul Sandoz wrote: >>> >>>> On Jun 18, 2015, at 2:08 AM, Jim Laskey (Oracle) wrote: >>>> >>>>> https://bugs.openjdk.java.net/browse/JDK-8080511 >>>>> >>>>> This is an long overdue refresh of the jimage support in the JDK9-dev repo. This includes native support for reading jimage files, improved jrt-fs (java runtime file system) support for retrieving modules and packages from the runtime, and improved performance for langtools in the presence of jrt-fs. >>>>> >>>>> http://cr.openjdk.java.net/~jlaskey/hs-rt-jimage/webrev-top >>>>> http://cr.openjdk.java.net/~jlaskey/hs-rt-jimage/webrev-jdk >>>> I eyeballed the JDK changes. Just two thing: >>>> >>>> make/src/classes/build/tools/module/ModuleArchive.java >>>> >>>> 90 @Override >>>> 91 public Stream entries() { >>>> 92 List entries = new ArrayList<>(); >>>> 93 try { >>>> 94 if (classes != null) >>>> 95 Files.walk(classes) >>>> 96 .sorted() >>>> 97 .filter(p -> !Files.isDirectory(p) >>>> 98 && !classes.relativize(p).toString().startsWith("_the.") >>>> 99 && !classes.relativize(p).toString().equals("javac_state")) >>>> 100 .map(p -> toEntry(p, classes, EntryType.CLASS_OR_RESOURCE)) >>>> 101 .forEach(entries::add); >>>> 102 if (cmds != null) >>>> 103 Files.walk(cmds) >>>> 104 .filter(p -> !Files.isDirectory(p)) >>>> 105 .map(p -> toEntry(p, cmds, EntryType.NATIVE_CMD)) >>>> 106 .forEach(entries::add); >>>> 107 if (libs != null) >>>> 108 Files.walk(libs) >>>> 109 .filter(p -> !Files.isDirectory(p)) >>>> 110 .map(p -> toEntry(p, libs, EntryType.NATIVE_LIB)) >>>> 111 .forEach(entries::add); >>>> 112 if (configs != null) >>>> 113 Files.walk(configs) >>>> 114 .filter(p -> !Files.isDirectory(p)) >>>> 115 .map(p -> toEntry(p, configs, EntryType.CONFIG)) >>>> 116 .forEach(entries::add); >>>> 117 } catch (IOException ioe) { >>>> 118 throw new UncheckedIOException(ioe); >>>> 119 } >>>> 120 return entries.stream(); >>>> 121 } >>>> >>>> You can use collect(toList()) >>> ==> OK collect used. In addition, filter first then sort, tryWithResource for 4 Files stream. >>> >>>> In general the contract for Archive.entries probably has to say the stream needs to be closed after use since it might cover lazy I/O based resources, so callers will need to use a try-with-resources block. >>> ==> Added a note in javadoc, implemented explicit close for non lazy streams, added missing tryWithResource. Added a comment on what should be done in ModuleArchive to keep laziness. >>>> Paul. >>> Thanks. >>> >>>>> http://cr.openjdk.java.net/~jlaskey/hs-rt-jimage/webrev-hotspot >>>>> http://cr.openjdk.java.net/~jlaskey/hs-rt-jimage/webrev-langtools >>>>> >>>>> >>>>> Details: >>>>> >>>>> - jrt-fs provides access, via the nio FileSystem API, to the classes in a .jimage file, organized by module or by package. >>>>> - Shared code for jimage support converted to native. Currently residing in hotspot, but will migrate to it?s own jdk library https://bugs.openjdk.java.net/browse/JDK-8087181 >>>>> - A new archive abstraction for class/resource sources. >>>>> - java based implementation layer for jimage reading to allow backport to JDK8 (jrt-fs.jar - IDE support.) >>>>> - JNI support for jimage into hotspot. >>>>> - White box tests written to exercise native jimage support. > > > -- > Best regards, Sergey. > From Sergey.Bylokhov at oracle.com Fri Jul 24 18:46:39 2015 From: Sergey.Bylokhov at oracle.com (Sergey Bylokhov) Date: Fri, 24 Jul 2015 21:46:39 +0300 Subject: RFR: JDK-8080511 - Refresh of jimage support In-Reply-To: <3C863E9B-2C79-4058-9588-A17C5015EBBA@oracle.com> References: <165AE6EA-8FB7-4715-8D76-477692B63C95@oracle.com> <69B55DAD-6E30-4703-B2B0-4A5EEC598149@oracle.com> <487562C8-9F9D-43B3-AF21-D99368852DDB@oracle.com> <55B271A0.7090705@oracle.com> <3C863E9B-2C79-4058-9588-A17C5015EBBA@oracle.com> Message-ID: <55B2880F.8050102@oracle.com> On 24.07.15 20:17, Jean-Francois Denise wrote: > Hi, > you need to prefix your path with /modules, so ?/modules/java.desktop?. Thanks. It works. > JF > > > On 24 Jul 2015, at 19:10, Sergey Bylokhov wrote: > >> After the latest merge I got some issue, I assume related to this fix. >> Can somebody take a look to this code: >> >> import java.net.URI; >> import java.nio.file.*; >> import java.nio.file.attribute.BasicFileAttributes; >> >> public class JRTFileSystemError { >> >> public static void main(final String[] args) throws Exception { >> FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/")); >> Files.walkFileTree(fs.getPath("/java.desktop"), new SimpleFileVisitor() { >> @Override >> public FileVisitResult visitFile(Path file, >> BasicFileAttributes attrs) { >> return FileVisitResult.CONTINUE; >> } >> }); >> } >> } >> >> It fails with "Exception in thread "main" java.nio.file.NoSuchFileException: /java.desktop". >> Bur previously it works correctly. Can somebody confirm this is an issue in the test(and how to change it) or in jdk? >> It seems that IntelliJ also broken in some way so it cannot take classes from the jdk9 after this fix. probably they should update jrt-fs.jar? >> >> >> On 23.06.15 19:08, Jean-Francois Denise wrote: >>> Hi, >>> an updated webrev that takes into account reviews. In addition the hotspot tests have been reworked following Christian Tornqvist suggestions. >>> >>> top: http://cr.openjdk.java.net/~jfdenise/hs-rt-jimage.3/webrev-top/ >>> langtools: http://cr.openjdk.java.net/~jfdenise/hs-rt-jimage.3/webrev-langtools/ >>> hotspot: http://cr.openjdk.java.net/~jfdenise/hs-rt-jimage.3/webrev-hotspot/ >>> jdk: http://cr.openjdk.java.net/~jfdenise/hs-rt-jimage.3/webrev-jdk/ >>> >>> Testing: >>> JCK(s) tests are passing (ran only on Mac OS) >>> Hotspot tests are passing (All platforms) >>> Java PIT tests are passing (All platforms). Ran once on https://bugs.openjdk.java.net/browse/JDK-8129592 >>> >>> Thanks. >>> JF >>> >>> On 23 Jun 2015, at 14:10, Jean-Francois Denise wrote: >>> >>>> Hi Paul, >>>> >>>> On 19 Jun 2015, at 16:39, Paul Sandoz wrote: >>>> >>>>> On Jun 18, 2015, at 2:08 AM, Jim Laskey (Oracle) wrote: >>>>> >>>>>> https://bugs.openjdk.java.net/browse/JDK-8080511 >>>>>> >>>>>> This is an long overdue refresh of the jimage support in the JDK9-dev repo. This includes native support for reading jimage files, improved jrt-fs (java runtime file system) support for retrieving modules and packages from the runtime, and improved performance for langtools in the presence of jrt-fs. >>>>>> >>>>>> http://cr.openjdk.java.net/~jlaskey/hs-rt-jimage/webrev-top >>>>>> http://cr.openjdk.java.net/~jlaskey/hs-rt-jimage/webrev-jdk >>>>> I eyeballed the JDK changes. Just two thing: >>>>> >>>>> make/src/classes/build/tools/module/ModuleArchive.java >>>>> >>>>> 90 @Override >>>>> 91 public Stream entries() { >>>>> 92 List entries = new ArrayList<>(); >>>>> 93 try { >>>>> 94 if (classes != null) >>>>> 95 Files.walk(classes) >>>>> 96 .sorted() >>>>> 97 .filter(p -> !Files.isDirectory(p) >>>>> 98 && !classes.relativize(p).toString().startsWith("_the.") >>>>> 99 && !classes.relativize(p).toString().equals("javac_state")) >>>>> 100 .map(p -> toEntry(p, classes, EntryType.CLASS_OR_RESOURCE)) >>>>> 101 .forEach(entries::add); >>>>> 102 if (cmds != null) >>>>> 103 Files.walk(cmds) >>>>> 104 .filter(p -> !Files.isDirectory(p)) >>>>> 105 .map(p -> toEntry(p, cmds, EntryType.NATIVE_CMD)) >>>>> 106 .forEach(entries::add); >>>>> 107 if (libs != null) >>>>> 108 Files.walk(libs) >>>>> 109 .filter(p -> !Files.isDirectory(p)) >>>>> 110 .map(p -> toEntry(p, libs, EntryType.NATIVE_LIB)) >>>>> 111 .forEach(entries::add); >>>>> 112 if (configs != null) >>>>> 113 Files.walk(configs) >>>>> 114 .filter(p -> !Files.isDirectory(p)) >>>>> 115 .map(p -> toEntry(p, configs, EntryType.CONFIG)) >>>>> 116 .forEach(entries::add); >>>>> 117 } catch (IOException ioe) { >>>>> 118 throw new UncheckedIOException(ioe); >>>>> 119 } >>>>> 120 return entries.stream(); >>>>> 121 } >>>>> >>>>> You can use collect(toList()) >>>> ==> OK collect used. In addition, filter first then sort, tryWithResource for 4 Files stream. >>>> >>>>> In general the contract for Archive.entries probably has to say the stream needs to be closed after use since it might cover lazy I/O based resources, so callers will need to use a try-with-resources block. >>>> ==> Added a note in javadoc, implemented explicit close for non lazy streams, added missing tryWithResource. Added a comment on what should be done in ModuleArchive to keep laziness. >>>>> Paul. >>>> Thanks. >>>> >>>>>> http://cr.openjdk.java.net/~jlaskey/hs-rt-jimage/webrev-hotspot >>>>>> http://cr.openjdk.java.net/~jlaskey/hs-rt-jimage/webrev-langtools >>>>>> >>>>>> >>>>>> Details: >>>>>> >>>>>> - jrt-fs provides access, via the nio FileSystem API, to the classes in a .jimage file, organized by module or by package. >>>>>> - Shared code for jimage support converted to native. Currently residing in hotspot, but will migrate to it?s own jdk library https://bugs.openjdk.java.net/browse/JDK-8087181 >>>>>> - A new archive abstraction for class/resource sources. >>>>>> - java based implementation layer for jimage reading to allow backport to JDK8 (jrt-fs.jar - IDE support.) >>>>>> - JNI support for jimage into hotspot. >>>>>> - White box tests written to exercise native jimage support. >> >> -- >> Best regards, Sergey. >> -- Best regards, Sergey. From cheleswer.sahu at oracle.com Mon Jul 27 17:07:06 2015 From: cheleswer.sahu at oracle.com (cheleswer sahu) Date: Mon, 27 Jul 2015 22:37:06 +0530 Subject: RFR[ 9u-dev] JDK-8075773 - jps running as root fails after the fix of JDK-8050807 Message-ID: <55B6653A.3070007@oracle.com> Hi, Please review the code changes for "https://bugs.openjdk.java.net/browse/JDK-8075773" . Web review Link: http://cr.openjdk.java.net/~poonam/8075773/webrev.00/ Bug brief: This bug was introduced after the fix of JDK-8050807. JPS reads the process information from "/tmp/hsperfdata_$username_$ProcessID". In order to ensure the file is secure to open and read, it tries to match the UID with the effective user ID of that file. When JPS is run as root user this check gets failed. Fix: If JPS is running as a root user, then the check which matches, UID with effective user id is skipped. I have test this fix, it's working fine and found no security issue. Regards, Cheleswer From dmitry.samersoff at oracle.com Mon Jul 27 17:35:18 2015 From: dmitry.samersoff at oracle.com (Dmitry Samersoff) Date: Mon, 27 Jul 2015 20:35:18 +0300 Subject: RFR[ 9u-dev] JDK-8075773 - jps running as root fails after the fix of JDK-8050807 In-Reply-To: <55B6653A.3070007@oracle.com> References: <55B6653A.3070007@oracle.com> Message-ID: <55B66BD6.6080307@oracle.com> Cheleswer, src/os/linux/vm/perfMemory_linux.cpp 220 space missed after // 222 space missed after != src/os/solaris/vm/perfMemory_solaris.cpp 222 extra space before // (wrong indent) Otherwise looks good. (not a Reviewer) -Dmitry On 2015-07-27 20:07, cheleswer sahu wrote: > Hi, > > Please review the code changes for > "https://bugs.openjdk.java.net/browse/JDK-8075773" . > Web review Link: http://cr.openjdk.java.net/~poonam/8075773/webrev.00/ > > Bug brief: This bug was introduced after the fix of JDK-8050807. JPS > reads the process information from > "/tmp/hsperfdata_$username_$ProcessID". In order to ensure the file is > secure to open and read, it tries to match the UID with the effective > user ID of that file. When JPS is run as root user this check gets failed. > > Fix: If JPS is running as a root user, then the check which matches, UID > with effective user id is skipped. > > I have test this fix, it's working fine and found no security issue. > > > Regards, > Cheleswer -- Dmitry Samersoff Oracle Java development team, Saint Petersburg, Russia * I would love to change the world, but they won't give me the sources. From jeremymanson at google.com Mon Jul 27 18:11:18 2015 From: jeremymanson at google.com (Jeremy Manson) Date: Mon, 27 Jul 2015 11:11:18 -0700 Subject: os::current_thread_id on Linux In-Reply-To: <55B186C1.1080706@oracle.com> References: <55B04C88.5080302@oracle.com> <55B08251.6030909@oracle.com> <55B094B7.6060309@oracle.com> <55B186C1.1080706@oracle.com> Message-ID: Okay, thanks, David. I'll submit a patch to make one API call the other, so that there will be no confusion in the future. Jeremy On Thu, Jul 23, 2015 at 5:28 PM, David Holmes wrote: > On 24/07/2015 4:03 AM, Jeremy Manson wrote: > >> Quick rundown: >> > > Thanks - sorry I couldn't get to this last night. > > On Solaris, osthread and current_thread_id are the same (thr_self()). >> > > So both user-thread > > On Windows, they are the same (GetCurrentThreadId()). >> > > Windows is single-level. > > On OS X, they are the same (pthread_mach_thread_np(::pthread_self())) >> > > Both "kernel" thread > > On AIX, current_thread_id is pthread_self, and osthread is thread_self() >> On non-OS X BSD, current_thread_id is pthread_self, and osthread is the >> syscall. >> > > One user and one kernel. > > I don't see any code that depends on the particular value of >> current_thread_id (for example, assuming that it is the same as >> thread_self in a meaningful way on AIX, or that it is pthread_self on >> AIX). My guess is that the AIX and non-OS X code are just following the >> Linux convention. >> > > Yes - port by copy. :( > > I'm happy to make current_thread_id consistent with >> osthread on all of the platforms, or just on Linux (with the >> understanding that I can't really test AIX and OS X easily). >> > > Just make the change on Linux, there's really no consistency here to aim > for. :( > > Thanks, > David > > Jeremy >> >> On Thu, Jul 23, 2015 at 12:16 AM, David Holmes > > wrote: >> >> On 23/07/2015 4:11 PM, Jeremy Manson wrote: >> >> Okay. TBH, thinking about it more, it's a little weird for >> something >> named os::current_thread_id() to be different from >> Thread::current()->osThread->thread_id(), or for either of them >> to be >> different from "what the OS thinks the thread id is", so it >> seems like >> the Right Thing to Do (in the absence of any platform-specific >> issues). >> >> >> When there are two different levels of thread ID it isn't that >> simple - especially as, like you say, one can be used to look in >> /proc while the other can't. So perhaps better naming is in order. >> >> Cheers, >> David >> >> Jeremy >> >> On Wed, Jul 22, 2015 at 10:57 PM, David Holmes >> >> > >> wrote: >> >> On 23/07/2015 3:15 PM, Jeremy Manson wrote: >> >> Hey David, >> >> Thanks for the offer of sponsorship. My goal here is >> really to >> make the >> log output on Linux usable. I want to be able to map >> the log output >> back to an actual thread. I don't think it really >> matters to >> users if >> the API consistently means "kernel thread ID" or >> "threading API >> thread >> ID", as long as they can figure out what the output >> means. >> >> >> I think consistency is important else developers don't know >> what >> they should be using where - which is the current situation. >> >> Since what I am doing (in effect) to accomplish my goal >> is to ensure >> that the API returns the same value as >> osthread()->thread_id() >> does for >> the current thread, I could just... do precisely that. >> os::current_thread_id could just return >> osthread()->thread_id() >> for the >> current thread. I don't have easy access to anything >> for testing >> other >> than Linux, though, so whether it worked (or even >> compiled) on >> the other >> platforms would be a bit of a guess (per the last time >> we did >> this dance). >> >> >> Defining os::current_thread_id() to be >> Thread::current()->osThread()->thread_id() assumes you can >> make >> those calls in the context in which os::current_thread_id() >> is used >> - if we crash during thread startup then some of those may >> be null >> and the id not even set. The current implementation is >> independent >> of the state of thread within the VM. >> >> So its okay to return the same thing as >> Thread::current()->osThread()->thread_id() but it needs to >> be done >> directly. >> >> Again any platform for which this would cause a change in >> behaviour >> needs to be examined. It may be other platforms have the same >> problem you are trying to fix for linux. >> >> If I get time later I'll try to check what each platform >> does. >> >> Thanks, >> David >> >> Seem reasonable? >> >> Jeremy >> >> On Wed, Jul 22, 2015 at 7:08 PM, David Holmes >> > > > >> > >> >> > >>> wrote: >> >> On 23/07/2015 8:01 AM, Jeremy Manson wrote: >> >> Based on the feedback, this seems to be a good >> idea, >> approximately. >> Coleen would have sponsored, but she's going >> on vacation. >> Anyone else >> feel like sponsoring? >> >> >> Hold up a minute! :) There are different notions >> of "native >> thread >> id" that exist. First we have the "user level >> thread id" - >> this is >> what is reported by pthread_self in POSIX and >> thr_self in >> UI. Then >> we also have the OS specific "thread" id, also >> referred to >> as a LWP >> or "kernel scheduling entity" or "kernel thread" - >> the id >> for this >> is what gettid() maps back to on Linux. This >> distinction >> may not >> exist on all platforms. >> >> Unfortunately os::current_thread_id does not >> define which >> of these >> it represents: >> >> // thread id on Linux/64bit is 64bit, on Windows >> and >> Solaris, it's >> 32bit >> static intx current_thread_id(); >> >> and so on some platforms it returns the "user >> thread id" (eg >> pthread_self()), and on some it returns the same >> as gettid >> (ie OSX - >> but I don't know if the mach thread id is truly a >> "LWP" id ?). >> >> Also note that on some platforms the osThread >> stores the id >> of the >> "user-level thread" and on some the "kernel >> thread". Hence >> another >> source of confusion. :( >> >> So if you want to enforce that >> os::current_thread_id() >> represents >> the "kernel thread" then that should be applied >> consistently across >> all platforms**, and for platforms for which there >> is a >> change to >> make you have to ensure the usage of >> os::current_thread_id() is not >> semantically altered by the change. >> >> ** Of course a platform may only have a single >> notion of >> "thread" >> >> I'm happy to sponsor such a proposal. And don't >> worry about >> maintaining compatibility with archaic Linux >> versions for >> JDK9 (less >> cleanup to do later). >> >> Thanks, >> David >> >> Jeremy >> >> On Wed, Jul 22, 2015 at 11:22 AM, Jeremy Manson >> > >> > > >> >> > >> >> > >> > > >> >> > >> > >>>> wrote: >> >> Hey folks, >> >> os::current_thread_id on Linux now maps to >> pthread_self. The >> problem with pthread_self is that it only >> makes >> sense in >> the context >> of the running process. When it is >> written out to >> the log >> (as it is >> in several places), there really isn't a >> way >> (AFAICT) for >> the user >> to map it back to anything useful. >> >> As it happens, that value is mostly used >> to write >> to the >> log. The >> places where it doesn't do so don't seem >> to need >> to use >> pthread_self >> for any particular reason. >> >> Meanwhile, the SIGQUIT stack dump >> uses java_thread->osthread()->thread_id() >> as the >> nid. On >> Linux, >> that maps back to os::Linux::gettid(), >> whish is >> also what gets >> exposed in /proc. That makes it much >> easier to >> see what >> threads >> might be doing the log write. >> >> Would it be okay to change >> os::current_thread_id >> to point >> to os::Linux::gettid()? That way, it can >> be >> mapped back to the >> output of a SIGQUIT dump. >> >> The downside of gettid() is that it is only >> available on >> Linux>2.4.11, but that dates from 2001. >> If we >> really still >> want to >> support it, we could check for that. >> >> Thoughts? >> >> Jeremy >> >> >> >> >> >> From jeremymanson at google.com Mon Jul 27 18:14:09 2015 From: jeremymanson at google.com (Jeremy Manson) Date: Mon, 27 Jul 2015 11:14:09 -0700 Subject: os::current_thread_id on Linux In-Reply-To: References: <55B04C88.5080302@oracle.com> <55B08251.6030909@oracle.com> <55B094B7.6060309@oracle.com> <55B186C1.1080706@oracle.com> Message-ID: Turns out JDK-6661889 already covered this. Jeremy On Mon, Jul 27, 2015 at 11:11 AM, Jeremy Manson wrote: > Okay, thanks, David. I'll submit a patch to make one API call the other, > so that there will be no confusion in the future. > > Jeremy > > On Thu, Jul 23, 2015 at 5:28 PM, David Holmes > wrote: > >> On 24/07/2015 4:03 AM, Jeremy Manson wrote: >> >>> Quick rundown: >>> >> >> Thanks - sorry I couldn't get to this last night. >> >> On Solaris, osthread and current_thread_id are the same (thr_self()). >>> >> >> So both user-thread >> >> On Windows, they are the same (GetCurrentThreadId()). >>> >> >> Windows is single-level. >> >> On OS X, they are the same (pthread_mach_thread_np(::pthread_self())) >>> >> >> Both "kernel" thread >> >> On AIX, current_thread_id is pthread_self, and osthread is thread_self() >>> On non-OS X BSD, current_thread_id is pthread_self, and osthread is the >>> syscall. >>> >> >> One user and one kernel. >> >> I don't see any code that depends on the particular value of >>> current_thread_id (for example, assuming that it is the same as >>> thread_self in a meaningful way on AIX, or that it is pthread_self on >>> AIX). My guess is that the AIX and non-OS X code are just following the >>> Linux convention. >>> >> >> Yes - port by copy. :( >> >> I'm happy to make current_thread_id consistent with >>> osthread on all of the platforms, or just on Linux (with the >>> understanding that I can't really test AIX and OS X easily). >>> >> >> Just make the change on Linux, there's really no consistency here to aim >> for. :( >> >> Thanks, >> David >> >> Jeremy >>> >>> On Thu, Jul 23, 2015 at 12:16 AM, David Holmes >> > wrote: >>> >>> On 23/07/2015 4:11 PM, Jeremy Manson wrote: >>> >>> Okay. TBH, thinking about it more, it's a little weird for >>> something >>> named os::current_thread_id() to be different from >>> Thread::current()->osThread->thread_id(), or for either of them >>> to be >>> different from "what the OS thinks the thread id is", so it >>> seems like >>> the Right Thing to Do (in the absence of any platform-specific >>> issues). >>> >>> >>> When there are two different levels of thread ID it isn't that >>> simple - especially as, like you say, one can be used to look in >>> /proc while the other can't. So perhaps better naming is in order. >>> >>> Cheers, >>> David >>> >>> Jeremy >>> >>> On Wed, Jul 22, 2015 at 10:57 PM, David Holmes >>> >>> >> >>> >> wrote: >>> >>> On 23/07/2015 3:15 PM, Jeremy Manson wrote: >>> >>> Hey David, >>> >>> Thanks for the offer of sponsorship. My goal here is >>> really to >>> make the >>> log output on Linux usable. I want to be able to map >>> the log output >>> back to an actual thread. I don't think it really >>> matters to >>> users if >>> the API consistently means "kernel thread ID" or >>> "threading API >>> thread >>> ID", as long as they can figure out what the output >>> means. >>> >>> >>> I think consistency is important else developers don't know >>> what >>> they should be using where - which is the current situation. >>> >>> Since what I am doing (in effect) to accomplish my goal >>> is to ensure >>> that the API returns the same value as >>> osthread()->thread_id() >>> does for >>> the current thread, I could just... do precisely that. >>> os::current_thread_id could just return >>> osthread()->thread_id() >>> for the >>> current thread. I don't have easy access to anything >>> for testing >>> other >>> than Linux, though, so whether it worked (or even >>> compiled) on >>> the other >>> platforms would be a bit of a guess (per the last time >>> we did >>> this dance). >>> >>> >>> Defining os::current_thread_id() to be >>> Thread::current()->osThread()->thread_id() assumes you can >>> make >>> those calls in the context in which os::current_thread_id() >>> is used >>> - if we crash during thread startup then some of those may >>> be null >>> and the id not even set. The current implementation is >>> independent >>> of the state of thread within the VM. >>> >>> So its okay to return the same thing as >>> Thread::current()->osThread()->thread_id() but it needs to >>> be done >>> directly. >>> >>> Again any platform for which this would cause a change in >>> behaviour >>> needs to be examined. It may be other platforms have the >>> same >>> problem you are trying to fix for linux. >>> >>> If I get time later I'll try to check what each platform >>> does. >>> >>> Thanks, >>> David >>> >>> Seem reasonable? >>> >>> Jeremy >>> >>> On Wed, Jul 22, 2015 at 7:08 PM, David Holmes >>> >> >> > >>> >> >>> >>> >> >>> wrote: >>> >>> On 23/07/2015 8:01 AM, Jeremy Manson wrote: >>> >>> Based on the feedback, this seems to be a good >>> idea, >>> approximately. >>> Coleen would have sponsored, but she's going >>> on vacation. >>> Anyone else >>> feel like sponsoring? >>> >>> >>> Hold up a minute! :) There are different notions >>> of "native >>> thread >>> id" that exist. First we have the "user level >>> thread id" - >>> this is >>> what is reported by pthread_self in POSIX and >>> thr_self in >>> UI. Then >>> we also have the OS specific "thread" id, also >>> referred to >>> as a LWP >>> or "kernel scheduling entity" or "kernel thread" - >>> the id >>> for this >>> is what gettid() maps back to on Linux. This >>> distinction >>> may not >>> exist on all platforms. >>> >>> Unfortunately os::current_thread_id does not >>> define which >>> of these >>> it represents: >>> >>> // thread id on Linux/64bit is 64bit, on Windows >>> and >>> Solaris, it's >>> 32bit >>> static intx current_thread_id(); >>> >>> and so on some platforms it returns the "user >>> thread id" (eg >>> pthread_self()), and on some it returns the same >>> as gettid >>> (ie OSX - >>> but I don't know if the mach thread id is truly a >>> "LWP" id ?). >>> >>> Also note that on some platforms the osThread >>> stores the id >>> of the >>> "user-level thread" and on some the "kernel >>> thread". Hence >>> another >>> source of confusion. :( >>> >>> So if you want to enforce that >>> os::current_thread_id() >>> represents >>> the "kernel thread" then that should be applied >>> consistently across >>> all platforms**, and for platforms for which there >>> is a >>> change to >>> make you have to ensure the usage of >>> os::current_thread_id() is not >>> semantically altered by the change. >>> >>> ** Of course a platform may only have a single >>> notion of >>> "thread" >>> >>> I'm happy to sponsor such a proposal. And don't >>> worry about >>> maintaining compatibility with archaic Linux >>> versions for >>> JDK9 (less >>> cleanup to do later). >>> >>> Thanks, >>> David >>> >>> Jeremy >>> >>> On Wed, Jul 22, 2015 at 11:22 AM, Jeremy Manson >>> >> >>> >> > >>> >>> >> >> >>> >> >>> >> > >>> >>> >> >>> >> >>>> wrote: >>> >>> Hey folks, >>> >>> os::current_thread_id on Linux now maps to >>> pthread_self. The >>> problem with pthread_self is that it only >>> makes >>> sense in >>> the context >>> of the running process. When it is >>> written out to >>> the log >>> (as it is >>> in several places), there really isn't a >>> way >>> (AFAICT) for >>> the user >>> to map it back to anything useful. >>> >>> As it happens, that value is mostly used >>> to write >>> to the >>> log. The >>> places where it doesn't do so don't seem >>> to need >>> to use >>> pthread_self >>> for any particular reason. >>> >>> Meanwhile, the SIGQUIT stack dump >>> uses java_thread->osthread()->thread_id() >>> as the >>> nid. On >>> Linux, >>> that maps back to os::Linux::gettid(), >>> whish is >>> also what gets >>> exposed in /proc. That makes it much >>> easier to >>> see what >>> threads >>> might be doing the log write. >>> >>> Would it be okay to change >>> os::current_thread_id >>> to point >>> to os::Linux::gettid()? That way, it can >>> be >>> mapped back to the >>> output of a SIGQUIT dump. >>> >>> The downside of gettid() is that it is >>> only >>> available on >>> Linux>2.4.11, but that dates from 2001. >>> If we >>> really still >>> want to >>> support it, we could check for that. >>> >>> Thoughts? >>> >>> Jeremy >>> >>> >>> >>> >>> >>> > From gerald.thornbrugh at oracle.com Mon Jul 27 21:43:32 2015 From: gerald.thornbrugh at oracle.com (Gerald Thornbrugh) Date: Mon, 27 Jul 2015 15:43:32 -0600 Subject: RFR[ 9u-dev] JDK-8075773 - jps running as root fails after the fix of JDK-8050807 In-Reply-To: <55B66BD6.6080307@oracle.com> References: <55B6653A.3070007@oracle.com> <55B66BD6.6080307@oracle.com> Message-ID: <55B6A604.4010206@oracle.com> Hi Cheleswer, Other than the issues Dimitry mentioned below your changes look good. I am also not a "Reviewer". Thanks! Jerry > Cheleswer, > > src/os/linux/vm/perfMemory_linux.cpp > > 220 space missed after // > 222 space missed after != > > src/os/solaris/vm/perfMemory_solaris.cpp > > 222 extra space before // (wrong indent) > > Otherwise looks good. (not a Reviewer) > > -Dmitry > > > On 2015-07-27 20:07, cheleswer sahu wrote: >> Hi, >> >> Please review the code changes for >> "https://bugs.openjdk.java.net/browse/JDK-8075773" . >> Web review Link: http://cr.openjdk.java.net/~poonam/8075773/webrev.00/ >> >> Bug brief: This bug was introduced after the fix of JDK-8050807. JPS >> reads the process information from >> "/tmp/hsperfdata_$username_$ProcessID". In order to ensure the file is >> secure to open and read, it tries to match the UID with the effective >> user ID of that file. When JPS is run as root user this check gets failed. >> >> Fix: If JPS is running as a root user, then the check which matches, UID >> with effective user id is skipped. >> >> I have test this fix, it's working fine and found no security issue. >> >> >> Regards, >> Cheleswer > From ioi.lam at oracle.com Tue Jul 28 04:29:44 2015 From: ioi.lam at oracle.com (Ioi Lam) Date: Mon, 27 Jul 2015 21:29:44 -0700 Subject: RFR: 8130115: REDO - Reduce Symbol::_identity_hash to 2 bytes In-Reply-To: <55A69A5F.3070504@oracle.com> References: <55A69A5F.3070504@oracle.com> Message-ID: <55B70538.1070109@oracle.com> Hi Yumin, The C code changes look good to me. I am a little concerned about the Java code's calculation of identityHash: Java version: 86 public int identityHash() { 87 long addr_value = getAddress().asLongValue(); 88 int addr_bits = (int)(addr_value >> (VM.getVM().getLogMinObjAlignmentInBytes() + 3)); 89 int length = (int)getLength(); 90 int byte0 = getByteAt(0); 91 int byte1 = getByteAt(1); 92 int id_hash = (int)(0xffff & idHash.getValue(this.addr)); 93 return id_hash | 94 ((addr_bits ^ (length << 8) ^ ((byte0 << 8) | byte1)) << 16); 95 } C version: 148 unsigned identity_hash() { 149 unsigned addr_bits = (unsigned)((uintptr_t)this >> (LogMinObjAlignmentInBytes + 3)); 150 return (unsigned)_identity_hash | 151 ((addr_bits ^ (_length << 8) ^ (( _body[0] << 8) | _body[1])) << 16); 152 } The main problem is to correctly emulate the C unsigned operations in the Java code. I've eyeballed the code and it seems correct, but I am wondering if you have actually tested and verified that the Java version indeed returns the same value as the C code? A unit test case would be good: * Add a new test in hotspot/agent/test * Get a few Symbols (e.g., call sun.jvm.hotspot.runtime.VM.getSymbolTable and iterate over the first 1000 Symbols) * For each Symbol, call its Symbol.identityHash() method * Add a new whitebox API to return the C version of the identity_hash() value * Check if the C value is the same as the Java value Please run the test on all platforms (both 32-bit and 64-bit, and all OSes). Thanks - Ioi On 7/15/15 10:37 AM, Yumin Qi wrote: > Hi, > > This is redo for bug 8087143, in that push, it caused failure on > Serviceability Agent failed to get type for "_identity_hash": > mistakenly used JShortField for it, but in fact it still is > CIntegerField. In this change, besides of the original change in > hotspot/src, I add code to calculate identity_hash in hotspot/agent > based on the changed in hotspot. > > Old webrev for 8087143: > bug: https://bugs.openjdk.java.net/browse/JDK-8087143 > webrev: http://cr.openjdk.java.net/~minqi/8087143/webrev03/ > > Summary: _identity_hash is an integer in Symbol (SymbolBase), it is > used to compute hash bucket index by modulus division of table size. > Currently in hotspot, no table size is more than 65535 so we can use > short instead. For case with table size over 65535 we can use the > first two bytes of symbol data to be as the upper 16 bits for the > calculation but rare cases. > > New webrev for 8130115: > bug: https://bugs.openjdk.java.net/browse/JDK-8130115 > webrev: http://cr.openjdk.java.net/~minqi/8130115/webrev01/ > > > Tests: JPRT, SA manual tests, -atk quick, jtreg hotspot/runtime > Also internal large application used for hashtable data analysis --- > the No. of loaded classes is big(over 19K), and tested with different > bucket sizes including over 65535 to see the new algorithm for > identity_hash calculation, result shows the consistency before and > after the fix. > > Thanks > Yumin From yumin.qi at oracle.com Tue Jul 28 04:57:06 2015 From: yumin.qi at oracle.com (Yumin Qi) Date: Mon, 27 Jul 2015 21:57:06 -0700 Subject: RFR: 8130115: REDO - Reduce Symbol::_identity_hash to 2 bytes In-Reply-To: <55B70538.1070109@oracle.com> References: <55A69A5F.3070504@oracle.com> <55B70538.1070109@oracle.com> Message-ID: <55B70BA2.9080907@oracle.com> Thanks for your suggestion, that is good to cover the concern. I will factor a test case for it. Yumin On 7/27/2015 9:29 PM, Ioi Lam wrote: > Hi Yumin, > > The C code changes look good to me. > > I am a little concerned about the Java code's calculation of > identityHash: > > Java version: > 86 public int identityHash() { > 87 long addr_value = getAddress().asLongValue(); > 88 int addr_bits = (int)(addr_value >> > (VM.getVM().getLogMinObjAlignmentInBytes() + 3)); > 89 int length = (int)getLength(); > 90 int byte0 = getByteAt(0); > 91 int byte1 = getByteAt(1); > 92 int id_hash = (int)(0xffff & idHash.getValue(this.addr)); > 93 return id_hash | > 94 ((addr_bits ^ (length << 8) ^ ((byte0 << 8) | byte1)) > << 16); > 95 } > > C version: > 148 unsigned identity_hash() { > 149 unsigned addr_bits = (unsigned)((uintptr_t)this >> > (LogMinObjAlignmentInBytes + 3)); > 150 return (unsigned)_identity_hash | > 151 ((addr_bits ^ (_length << 8) ^ (( _body[0] << 8) | > _body[1])) << 16); > 152 } > > The main problem is to correctly emulate the C unsigned operations in > the Java code. I've eyeballed the code and it seems correct, but I am > wondering if you have actually tested and verified that the Java > version indeed returns the same value as the C code? A unit test case > would be good: > > * Add a new test in hotspot/agent/test > * Get a few Symbols (e.g., call > sun.jvm.hotspot.runtime.VM.getSymbolTable and iterate over the first > 1000 Symbols) > * For each Symbol, call its Symbol.identityHash() method > * Add a new whitebox API to return the C version of the > identity_hash() value > * Check if the C value is the same as the Java value > > Please run the test on all platforms (both 32-bit and 64-bit, and all > OSes). > > Thanks > - Ioi > > > On 7/15/15 10:37 AM, Yumin Qi wrote: >> Hi, >> >> This is redo for bug 8087143, in that push, it caused failure on >> Serviceability Agent failed to get type for "_identity_hash": >> mistakenly used JShortField for it, but in fact it still is >> CIntegerField. In this change, besides of the original change in >> hotspot/src, I add code to calculate identity_hash in hotspot/agent >> based on the changed in hotspot. >> >> Old webrev for 8087143: >> bug: https://bugs.openjdk.java.net/browse/JDK-8087143 >> webrev: http://cr.openjdk.java.net/~minqi/8087143/webrev03/ >> >> Summary: _identity_hash is an integer in Symbol (SymbolBase), it is >> used to compute hash bucket index by modulus division of table size. >> Currently in hotspot, no table size is more than 65535 so we can use >> short instead. For case with table size over 65535 we can use the >> first two bytes of symbol data to be as the upper 16 bits for the >> calculation but rare cases. >> >> New webrev for 8130115: >> bug: https://bugs.openjdk.java.net/browse/JDK-8130115 >> webrev: http://cr.openjdk.java.net/~minqi/8130115/webrev01/ >> >> >> Tests: JPRT, SA manual tests, -atk quick, jtreg hotspot/runtime >> Also internal large application used for hashtable data analysis --- >> the No. of loaded classes is big(over 19K), and tested with different >> bucket sizes including over 65535 to see the new algorithm for >> identity_hash calculation, result shows the consistency before and >> after the fix. >> >> Thanks >> Yumin > From goetz.lindenmaier at sap.com Tue Jul 28 08:58:23 2015 From: goetz.lindenmaier at sap.com (Lindenmaier, Goetz) Date: Tue, 28 Jul 2015 08:58:23 +0000 Subject: RFR(S): 8132242: LogTouchedMethods (8025692) asserts if TieredCompilation is off. Message-ID: <4295855A5C1DE049A61835A1887419CC2D013E70@DEWDFEMB12A.global.corp.sap> Hi, Yumin, could you have a look at this, please? It's trivial. Or could someone else sponsor this? http://cr.openjdk.java.net/~goetz/webrevs/8132242-jtregPTM/webrev.01/ ... I added the bugID I forgot before to the subject. Best regards, Goetz. -----Original Message----- From: Daniel D. Daugherty [mailto:daniel.daugherty at oracle.com] Sent: Donnerstag, 23. Juli 2015 15:49 To: Lindenmaier, Goetz Cc: hotspot-runtime-dev at openjdk.java.net Subject: Re: RFR(S): LogTouchedMethods (8025692) asserts if TieredCompilation is off. Yumin, Since you did the work on: JDK-8025692 Log what methods are touched at run-time https://bugs.openjdk.java.net/browse/JDK-8025692 can you help Goetz with this tweak? Dan On 7/23/15 7:30 AM, Lindenmaier, Goetz wrote: > Hi, > > LogTouchedMethods causes the template interpreter to generate profiling code even > if no compiler is used. If TieredCompilation is off, code containing an assertion > that checks that UseCompiler is set, is reached. > This assertion exists on the sparc and ppc platforms. > Fix: > Check for LogTouchedMethods in the assertion. > Also added testcase with -XX:-TieredCompilation. > > The problem can be reproduced with the new test case on solaris sparc. > > Please review this change. I please need a sponsor. > http://cr.openjdk.java.net/~goetz/webrevs/8132242-jtregPTM/webrev.01/ > > Best regards, > Goetz Lindenmaier From aleksey.shipilev at oracle.com Tue Jul 28 10:07:52 2015 From: aleksey.shipilev at oracle.com (Aleksey Shipilev) Date: Tue, 28 Jul 2015 13:07:52 +0300 Subject: RFR: 8130115: REDO - Reduce Symbol::_identity_hash to 2 bytes In-Reply-To: <55B05131.2080507@oracle.com> References: <55A69A5F.3070504@oracle.com> <55B05131.2080507@oracle.com> Message-ID: <55B75478.6060906@oracle.com> I am still not entirely convinced this does not introduce anomalous behaviors due to the way we try to construct the upper word in random number, but this will do for now. Thanks, -Aleksey On 07/23/2015 05:28 AM, Coleen Phillimore wrote: > > This looks fine. I'm not expert at knowing how the bitwise operators > and shifts produce a random number so I'd like someone to verify that. > > Does anyone know why the serviceability agent has to duplicate the > Symbol identity hash and if this is used by anything? This code change > is fine for the duplicated SA code, but it would be nice to file an RFE > to delete it. > > Your testing looks good. > > Thanks, > Coleen > > On 7/15/15 1:37 PM, Yumin Qi wrote: >> Hi, >> >> This is redo for bug 8087143, in that push, it caused failure on >> Serviceability Agent failed to get type for "_identity_hash": >> mistakenly used JShortField for it, but in fact it still is >> CIntegerField. In this change, besides of the original change in >> hotspot/src, I add code to calculate identity_hash in hotspot/agent >> based on the changed in hotspot. >> >> Old webrev for 8087143: >> bug: https://bugs.openjdk.java.net/browse/JDK-8087143 >> webrev: http://cr.openjdk.java.net/~minqi/8087143/webrev03/ >> >> Summary: _identity_hash is an integer in Symbol (SymbolBase), it is >> used to compute hash bucket index by modulus division of table size. >> Currently in hotspot, no table size is more than 65535 so we can use >> short instead. For case with table size over 65535 we can use the >> first two bytes of symbol data to be as the upper 16 bits for the >> calculation but rare cases. >> >> New webrev for 8130115: >> bug: https://bugs.openjdk.java.net/browse/JDK-8130115 >> webrev: http://cr.openjdk.java.net/~minqi/8130115/webrev01/ >> >> >> Tests: JPRT, SA manual tests, -atk quick, jtreg hotspot/runtime >> Also internal large application used for hashtable data analysis --- >> the No. of loaded classes is big(over 19K), and tested with different >> bucket sizes including over 65535 to see the new algorithm for >> identity_hash calculation, result shows the consistency before and >> after the fix. >> >> Thanks >> Yumin > From yumin.qi at oracle.com Tue Jul 28 15:48:03 2015 From: yumin.qi at oracle.com (Yumin Qi) Date: Tue, 28 Jul 2015 08:48:03 -0700 Subject: RFR(S): 8132242: LogTouchedMethods (8025692) asserts if TieredCompilation is off. In-Reply-To: <4295855A5C1DE049A61835A1887419CC2D013E70@DEWDFEMB12A.global.corp.sap> References: <4295855A5C1DE049A61835A1887419CC2D013E70@DEWDFEMB12A.global.corp.sap> Message-ID: <55B7A433.3080506@oracle.com> Goetz, Thanks for taking care of this issue. It looks good. I am not a "R"eviewer and I think Ioi is not either, we still need a 'R'eviewer to give a pass. I can sponsor for the push. Thanks Yumin On 7/28/2015 1:58 AM, Lindenmaier, Goetz wrote: > Hi, > > Yumin, could you have a look at this, please? It's trivial. > Or could someone else sponsor this? > http://cr.openjdk.java.net/~goetz/webrevs/8132242-jtregPTM/webrev.01/ > > ... I added the bugID I forgot before to the subject. > > Best regards, > Goetz. > > -----Original Message----- > From: Daniel D. Daugherty [mailto:daniel.daugherty at oracle.com] > Sent: Donnerstag, 23. Juli 2015 15:49 > To: Lindenmaier, Goetz > Cc: hotspot-runtime-dev at openjdk.java.net > Subject: Re: RFR(S): LogTouchedMethods (8025692) asserts if TieredCompilation is off. > > Yumin, > > Since you did the work on: > > JDK-8025692 Log what methods are touched at run-time > https://bugs.openjdk.java.net/browse/JDK-8025692 > > can you help Goetz with this tweak? > > Dan > > > On 7/23/15 7:30 AM, Lindenmaier, Goetz wrote: >> Hi, >> >> LogTouchedMethods causes the template interpreter to generate profiling code even >> if no compiler is used. If TieredCompilation is off, code containing an assertion >> that checks that UseCompiler is set, is reached. >> This assertion exists on the sparc and ppc platforms. >> Fix: >> Check for LogTouchedMethods in the assertion. >> Also added testcase with -XX:-TieredCompilation. >> >> The problem can be reproduced with the new test case on solaris sparc. >> >> Please review this change. I please need a sponsor. >> http://cr.openjdk.java.net/~goetz/webrevs/8132242-jtregPTM/webrev.01/ >> >> Best regards, >> Goetz Lindenmaier From mikhailo.seledtsov at oracle.com Tue Jul 28 17:49:18 2015 From: mikhailo.seledtsov at oracle.com (Mikhailo Seledtsov) Date: Tue, 28 Jul 2015 10:49:18 -0700 Subject: RFR(M): JDK-8132214: [TESTBUG] Create basic shared strings test for CDS archive Message-ID: <55B7C09E.9030703@oracle.com> Please review an addition of a new test for Shared Strings in CDS archive. JBS: https://bugs.openjdk.java.net/browse/JDK-8132214 WebRev: http://cr.openjdk.java.net/~mseledtsov/8132214.00/ Testing: Ran CDS tests including this newly written test via automated multi-platform testing on standard platforms Thank you, Misha From yumin.qi at oracle.com Wed Jul 29 03:29:26 2015 From: yumin.qi at oracle.com (Yumin Qi) Date: Tue, 28 Jul 2015 20:29:26 -0700 Subject: RFR: 8130115: REDO - Reduce Symbol::_identity_hash to 2 bytes In-Reply-To: <55B75478.6060906@oracle.com> References: <55A69A5F.3070504@oracle.com> <55B05131.2080507@oracle.com> <55B75478.6060906@oracle.com> Message-ID: <55B84896.70303@oracle.com> Thanks! Yumin On 7/28/2015 3:07 AM, Aleksey Shipilev wrote: > I am still not entirely convinced this does not introduce anomalous > behaviors due to the way we try to construct the upper word in random > number, but this will do for now. > > Thanks, > -Aleksey > > On 07/23/2015 05:28 AM, Coleen Phillimore wrote: >> This looks fine. I'm not expert at knowing how the bitwise operators >> and shifts produce a random number so I'd like someone to verify that. >> >> Does anyone know why the serviceability agent has to duplicate the >> Symbol identity hash and if this is used by anything? This code change >> is fine for the duplicated SA code, but it would be nice to file an RFE >> to delete it. >> >> Your testing looks good. >> >> Thanks, >> Coleen >> >> On 7/15/15 1:37 PM, Yumin Qi wrote: >>> Hi, >>> >>> This is redo for bug 8087143, in that push, it caused failure on >>> Serviceability Agent failed to get type for "_identity_hash": >>> mistakenly used JShortField for it, but in fact it still is >>> CIntegerField. In this change, besides of the original change in >>> hotspot/src, I add code to calculate identity_hash in hotspot/agent >>> based on the changed in hotspot. >>> >>> Old webrev for 8087143: >>> bug: https://bugs.openjdk.java.net/browse/JDK-8087143 >>> webrev: http://cr.openjdk.java.net/~minqi/8087143/webrev03/ >>> >>> Summary: _identity_hash is an integer in Symbol (SymbolBase), it is >>> used to compute hash bucket index by modulus division of table size. >>> Currently in hotspot, no table size is more than 65535 so we can use >>> short instead. For case with table size over 65535 we can use the >>> first two bytes of symbol data to be as the upper 16 bits for the >>> calculation but rare cases. >>> >>> New webrev for 8130115: >>> bug: https://bugs.openjdk.java.net/browse/JDK-8130115 >>> webrev: http://cr.openjdk.java.net/~minqi/8130115/webrev01/ >>> >>> >>> Tests: JPRT, SA manual tests, -atk quick, jtreg hotspot/runtime >>> Also internal large application used for hashtable data analysis --- >>> the No. of loaded classes is big(over 19K), and tested with different >>> bucket sizes including over 65535 to see the new algorithm for >>> identity_hash calculation, result shows the consistency before and >>> after the fix. >>> >>> Thanks >>> Yumin > From david.holmes at oracle.com Wed Jul 29 05:46:11 2015 From: david.holmes at oracle.com (David Holmes) Date: Wed, 29 Jul 2015 15:46:11 +1000 Subject: RFR: 8130212: Thread::current() might access freed memory on Solaris Message-ID: <55B868A3.2080602@oracle.com> Summary: replace complex custom code for maintaining ThreadLocalStorage with compiler supported thread-local variables (Solaris only) This is a non-public bug so let me explain with some background, the bug, and then the fix - which involves lots of complex-code deletion and addition of some very simple code. :) webrev: http://cr.openjdk.java.net/~dholmes/8130212/webrev/ In various parts of the runtime and in compiler generated code we need to get a reference to the (VM-level) Thread* of the currently executing thread. This is what Thread::current() returns. For performance reasons we also have a fast-path on 64-bit where the Thread* is stashed away in a register (g7 on sparc, r15 on x64). So Thread::current() is actually a slow-path mechanism and it delegates to ThreadLocalStorage::thread(). On some systems ThreadLocalStorage::thread utilizes a caching mechanism to try and speed up access to the current thread. Otherwise it calls into yet another "slow" path which uses the available platform thread-specific-storage APIs. Compiled code also has a slow-path get_thread() method which uses assembly code to invoke the same platform thread-specific-storage APIs (in some cases - on sparc it simply calls ThreadLocalStorage::thread()). On Solaris 64-bit (which is all we support today) there is a simple 1-level thread cache which is an array of Thread*. If a thread doesn't find itself in the slot for the hash of its id it inserts itself there. As a thread terminates it clears out its ThreadLocalStorage values including any cached reference. The bug is that we have potential for a read-after-free error due to this code: 46 uintptr_t raw = pd_raw_thread_id(); 47 int ix = pd_cache_index(raw); // hashes id 48 Thread* candidate = ThreadLocalStorage::_get_thread_cache[ix]; 49 if (candidate->self_raw_id() == raw) { 50 // hit 51 return candidate; 52 } else { 53 return ThreadLocalStorage::get_thread_via_cache_slowly(raw, ix); 54 } The problem is that the value read as candidate could be a thread that (after line 48) terminated and was freed. But line #49 then reads the raw id of that thread, which is then a read-after-free - which is a "Bad Thing (TM)". There's no simple fix for the caching code - you would need a completely different approach (or synchronization that would nullify the whole point of the cache). Now all this ThreadLocalStorage code is pretty old and was put in place to deal with inadequacies of the system provided thread-specific-storage API. In fact on Solaris we even by-pass the public API (thr_getspecific/thr_setspecific) when we can and implement our own version using lower-level APIs available in the T1/T2 threading libraries! In mid-2015 things have changed considerably and we have reliable and performant support for thread-local variables at the C+ language-level. So the way to maintain the current thread is simply using: // Declaration of thread-local variable static __thread Thread * _thr_current inline Thread* ThreadLocalStorage::thread() { return _thr_current; } inline void ThreadLocalStorage::set_thread(Thread* thread) { _thr_current = thread; } And all the complex ThreadLocalStorage code with caching etc all vanishes! For my next trick I plan to try and remove the ThreadLocalStorage class completely by using language-based thread-locals on all platforms. But for now this is just Solaris and so we still need the ThreadLocalStorage API. However a lot of that API is not needed any more on Solaris so I have excluded it from there in the shared code (ifndef SOLARIS). But to avoid changing other shared-code callsites of ThreadLocalStorage I've kept part of the API with trivial implementations on Solaris. Testing: JPRT All hotspot regression tests I'm happy to run more tests but the nice thing about such low-level code is that if it is broken, it is always broken :) Every use of Thread::current or MacroAssembler::get_thread now hits this code. Performance: I've run a basic set of benchmarks that is readily available to me on our performance testing system. The best way to describe the result is neutral. There are some slight wins, and some slight losses, with most showing no statistical difference. And even the "wins" and "losses" are within the natural variations of the benchmarks. So a lot of complex code has been replaced by simple code and we haven't lost any observable performance - which seems like a win to me. Also product mode x64 libjvm.so has shrunk by 921KB - which is a little surprising but very nice. Thanks, David From david.holmes at oracle.com Wed Jul 29 05:53:24 2015 From: david.holmes at oracle.com (David Holmes) Date: Wed, 29 Jul 2015 15:53:24 +1000 Subject: RFR: 8130212: Thread::current() might access freed memory on Solaris In-Reply-To: <55B868A3.2080602@oracle.com> References: <55B868A3.2080602@oracle.com> Message-ID: <55B86A54.7000708@oracle.com> I forgot to credit Dave Dice with the suggestion to modernize this code. David On 29/07/2015 3:46 PM, David Holmes wrote: > Summary: replace complex custom code for maintaining ThreadLocalStorage > with compiler supported thread-local variables (Solaris only) > > This is a non-public bug so let me explain with some background, the > bug, and then the fix - which involves lots of complex-code deletion and > addition of some very simple code. :) > > webrev: http://cr.openjdk.java.net/~dholmes/8130212/webrev/ > > In various parts of the runtime and in compiler generated code we need > to get a reference to the (VM-level) Thread* of the currently executing > thread. This is what Thread::current() returns. For performance reasons > we also have a fast-path on 64-bit where the Thread* is stashed away in > a register (g7 on sparc, r15 on x64). > > So Thread::current() is actually a slow-path mechanism and it delegates > to ThreadLocalStorage::thread(). > > On some systems ThreadLocalStorage::thread utilizes a caching mechanism > to try and speed up access to the current thread. Otherwise it calls > into yet another "slow" path which uses the available platform > thread-specific-storage APIs. > > Compiled code also has a slow-path get_thread() method which uses > assembly code to invoke the same platform thread-specific-storage APIs > (in some cases - on sparc it simply calls ThreadLocalStorage::thread()). > > On Solaris 64-bit (which is all we support today) there is a simple > 1-level thread cache which is an array of Thread*. If a thread doesn't > find itself in the slot for the hash of its id it inserts itself there. > As a thread terminates it clears out its ThreadLocalStorage values > including any cached reference. > > The bug is that we have potential for a read-after-free error due to > this code: > > 46 uintptr_t raw = pd_raw_thread_id(); > 47 int ix = pd_cache_index(raw); // hashes id > 48 Thread* candidate = ThreadLocalStorage::_get_thread_cache[ix]; > 49 if (candidate->self_raw_id() == raw) { > 50 // hit > 51 return candidate; > 52 } else { > 53 return ThreadLocalStorage::get_thread_via_cache_slowly(raw, ix); > 54 } > > The problem is that the value read as candidate could be a thread that > (after line 48) terminated and was freed. But line #49 then reads the > raw id of that thread, which is then a read-after-free - which is a "Bad > Thing (TM)". > > There's no simple fix for the caching code - you would need a completely > different approach (or synchronization that would nullify the whole > point of the cache). > > Now all this ThreadLocalStorage code is pretty old and was put in place > to deal with inadequacies of the system provided thread-specific-storage > API. In fact on Solaris we even by-pass the public API > (thr_getspecific/thr_setspecific) when we can and implement our own > version using lower-level APIs available in the T1/T2 threading libraries! > > In mid-2015 things have changed considerably and we have reliable and > performant support for thread-local variables at the C+ language-level. > So the way to maintain the current thread is simply using: > > // Declaration of thread-local variable > static __thread Thread * _thr_current > > inline Thread* ThreadLocalStorage::thread() { > return _thr_current; > } > > inline void ThreadLocalStorage::set_thread(Thread* thread) { > _thr_current = thread; > } > > And all the complex ThreadLocalStorage code with caching etc all vanishes! > > For my next trick I plan to try and remove the ThreadLocalStorage class > completely by using language-based thread-locals on all platforms. But > for now this is just Solaris and so we still need the ThreadLocalStorage > API. However a lot of that API is not needed any more on Solaris so I > have excluded it from there in the shared code (ifndef SOLARIS). But to > avoid changing other shared-code callsites of ThreadLocalStorage I've > kept part of the API with trivial implementations on Solaris. > > Testing: JPRT > All hotspot regression tests > > I'm happy to run more tests but the nice thing about such low-level code > is that if it is broken, it is always broken :) Every use of > Thread::current or MacroAssembler::get_thread now hits this code. > > Performance: I've run a basic set of benchmarks that is readily > available to me on our performance testing system. The best way to > describe the result is neutral. There are some slight wins, and some > slight losses, with most showing no statistical difference. And even the > "wins" and "losses" are within the natural variations of the benchmarks. > So a lot of complex code has been replaced by simple code and we haven't > lost any observable performance - which seems like a win to me. > > Also product mode x64 libjvm.so has shrunk by 921KB - which is a little > surprising but very nice. > > Thanks, > David From david.holmes at oracle.com Wed Jul 29 05:56:08 2015 From: david.holmes at oracle.com (David Holmes) Date: Wed, 29 Jul 2015 15:56:08 +1000 Subject: RFR: 8130212: Thread::current() might access freed memory on Solaris In-Reply-To: <55B86A54.7000708@oracle.com> References: <55B868A3.2080602@oracle.com> <55B86A54.7000708@oracle.com> Message-ID: <55B86AF8.9070104@oracle.com> Moved to hotspot-dev so the compiler folk also see this for the MacroAssembler changes. David On 29/07/2015 3:53 PM, David Holmes wrote: > I forgot to credit Dave Dice with the suggestion to modernize this code. > > David > > On 29/07/2015 3:46 PM, David Holmes wrote: >> Summary: replace complex custom code for maintaining ThreadLocalStorage >> with compiler supported thread-local variables (Solaris only) >> >> This is a non-public bug so let me explain with some background, the >> bug, and then the fix - which involves lots of complex-code deletion and >> addition of some very simple code. :) >> >> webrev: http://cr.openjdk.java.net/~dholmes/8130212/webrev/ >> >> In various parts of the runtime and in compiler generated code we need >> to get a reference to the (VM-level) Thread* of the currently executing >> thread. This is what Thread::current() returns. For performance reasons >> we also have a fast-path on 64-bit where the Thread* is stashed away in >> a register (g7 on sparc, r15 on x64). >> >> So Thread::current() is actually a slow-path mechanism and it delegates >> to ThreadLocalStorage::thread(). >> >> On some systems ThreadLocalStorage::thread utilizes a caching mechanism >> to try and speed up access to the current thread. Otherwise it calls >> into yet another "slow" path which uses the available platform >> thread-specific-storage APIs. >> >> Compiled code also has a slow-path get_thread() method which uses >> assembly code to invoke the same platform thread-specific-storage APIs >> (in some cases - on sparc it simply calls ThreadLocalStorage::thread()). >> >> On Solaris 64-bit (which is all we support today) there is a simple >> 1-level thread cache which is an array of Thread*. If a thread doesn't >> find itself in the slot for the hash of its id it inserts itself there. >> As a thread terminates it clears out its ThreadLocalStorage values >> including any cached reference. >> >> The bug is that we have potential for a read-after-free error due to >> this code: >> >> 46 uintptr_t raw = pd_raw_thread_id(); >> 47 int ix = pd_cache_index(raw); // hashes id >> 48 Thread* candidate = ThreadLocalStorage::_get_thread_cache[ix]; >> 49 if (candidate->self_raw_id() == raw) { >> 50 // hit >> 51 return candidate; >> 52 } else { >> 53 return ThreadLocalStorage::get_thread_via_cache_slowly(raw, >> ix); >> 54 } >> >> The problem is that the value read as candidate could be a thread that >> (after line 48) terminated and was freed. But line #49 then reads the >> raw id of that thread, which is then a read-after-free - which is a "Bad >> Thing (TM)". >> >> There's no simple fix for the caching code - you would need a completely >> different approach (or synchronization that would nullify the whole >> point of the cache). >> >> Now all this ThreadLocalStorage code is pretty old and was put in place >> to deal with inadequacies of the system provided thread-specific-storage >> API. In fact on Solaris we even by-pass the public API >> (thr_getspecific/thr_setspecific) when we can and implement our own >> version using lower-level APIs available in the T1/T2 threading >> libraries! >> >> In mid-2015 things have changed considerably and we have reliable and >> performant support for thread-local variables at the C+ language-level. >> So the way to maintain the current thread is simply using: >> >> // Declaration of thread-local variable >> static __thread Thread * _thr_current >> >> inline Thread* ThreadLocalStorage::thread() { >> return _thr_current; >> } >> >> inline void ThreadLocalStorage::set_thread(Thread* thread) { >> _thr_current = thread; >> } >> >> And all the complex ThreadLocalStorage code with caching etc all >> vanishes! >> >> For my next trick I plan to try and remove the ThreadLocalStorage class >> completely by using language-based thread-locals on all platforms. But >> for now this is just Solaris and so we still need the ThreadLocalStorage >> API. However a lot of that API is not needed any more on Solaris so I >> have excluded it from there in the shared code (ifndef SOLARIS). But to >> avoid changing other shared-code callsites of ThreadLocalStorage I've >> kept part of the API with trivial implementations on Solaris. >> >> Testing: JPRT >> All hotspot regression tests >> >> I'm happy to run more tests but the nice thing about such low-level code >> is that if it is broken, it is always broken :) Every use of >> Thread::current or MacroAssembler::get_thread now hits this code. >> >> Performance: I've run a basic set of benchmarks that is readily >> available to me on our performance testing system. The best way to >> describe the result is neutral. There are some slight wins, and some >> slight losses, with most showing no statistical difference. And even the >> "wins" and "losses" are within the natural variations of the benchmarks. >> So a lot of complex code has been replaced by simple code and we haven't >> lost any observable performance - which seems like a win to me. >> >> Also product mode x64 libjvm.so has shrunk by 921KB - which is a little >> surprising but very nice. >> >> Thanks, >> David From volker.simonis at gmail.com Wed Jul 29 08:21:11 2015 From: volker.simonis at gmail.com (Volker Simonis) Date: Wed, 29 Jul 2015 10:21:11 +0200 Subject: RFR(S): 8132242: LogTouchedMethods (8025692) asserts if TieredCompilation is off. In-Reply-To: <55B7A433.3080506@oracle.com> References: <4295855A5C1DE049A61835A1887419CC2D013E70@DEWDFEMB12A.global.corp.sap> <55B7A433.3080506@oracle.com> Message-ID: Hi Goetz, Yumin, the change looks good! You can go ahead and push it. Thanks, Volker On Tue, Jul 28, 2015 at 5:48 PM, Yumin Qi wrote: > Goetz, > > Thanks for taking care of this issue. It looks good. I am not a "R"eviewer > and I think Ioi is not either, we still need a 'R'eviewer to give a pass. > I can sponsor for the push. > > Thanks > Yumin > > On 7/28/2015 1:58 AM, Lindenmaier, Goetz wrote: >> >> Hi, >> >> Yumin, could you have a look at this, please? It's trivial. >> Or could someone else sponsor this? >> http://cr.openjdk.java.net/~goetz/webrevs/8132242-jtregPTM/webrev.01/ >> >> ... I added the bugID I forgot before to the subject. >> >> Best regards, >> Goetz. >> >> -----Original Message----- >> From: Daniel D. Daugherty [mailto:daniel.daugherty at oracle.com] >> Sent: Donnerstag, 23. Juli 2015 15:49 >> To: Lindenmaier, Goetz >> Cc: hotspot-runtime-dev at openjdk.java.net >> Subject: Re: RFR(S): LogTouchedMethods (8025692) asserts if >> TieredCompilation is off. >> >> Yumin, >> >> Since you did the work on: >> >> JDK-8025692 Log what methods are touched at run-time >> https://bugs.openjdk.java.net/browse/JDK-8025692 >> >> can you help Goetz with this tweak? >> >> Dan >> >> >> On 7/23/15 7:30 AM, Lindenmaier, Goetz wrote: >>> >>> Hi, >>> >>> LogTouchedMethods causes the template interpreter to generate profiling >>> code even >>> if no compiler is used. If TieredCompilation is off, code containing an >>> assertion >>> that checks that UseCompiler is set, is reached. >>> This assertion exists on the sparc and ppc platforms. >>> Fix: >>> Check for LogTouchedMethods in the assertion. >>> Also added testcase with -XX:-TieredCompilation. >>> >>> The problem can be reproduced with the new test case on solaris sparc. >>> >>> Please review this change. I please need a sponsor. >>> http://cr.openjdk.java.net/~goetz/webrevs/8132242-jtregPTM/webrev.01/ >>> >>> Best regards, >>> Goetz Lindenmaier > > From goetz.lindenmaier at sap.com Wed Jul 29 12:09:43 2015 From: goetz.lindenmaier at sap.com (Lindenmaier, Goetz) Date: Wed, 29 Jul 2015 12:09:43 +0000 Subject: RFR(S): 8132242: LogTouchedMethods (8025692) asserts if TieredCompilation is off. In-Reply-To: References: <4295855A5C1DE049A61835A1887419CC2D013E70@DEWDFEMB12A.global.corp.sap> <55B7A433.3080506@oracle.com> Message-ID: <4295855A5C1DE049A61835A1887419CC2D0152C9@DEWDFEMB12A.global.corp.sap> Thanks Volker! Best regards, Goetz. -----Original Message----- From: Volker Simonis [mailto:volker.simonis at gmail.com] Sent: Mittwoch, 29. Juli 2015 10:21 To: Yumin Qi Cc: Lindenmaier, Goetz; hotspot-runtime-dev at openjdk.java.net Subject: Re: RFR(S): 8132242: LogTouchedMethods (8025692) asserts if TieredCompilation is off. Hi Goetz, Yumin, the change looks good! You can go ahead and push it. Thanks, Volker On Tue, Jul 28, 2015 at 5:48 PM, Yumin Qi wrote: > Goetz, > > Thanks for taking care of this issue. It looks good. I am not a "R"eviewer > and I think Ioi is not either, we still need a 'R'eviewer to give a pass. > I can sponsor for the push. > > Thanks > Yumin > > On 7/28/2015 1:58 AM, Lindenmaier, Goetz wrote: >> >> Hi, >> >> Yumin, could you have a look at this, please? It's trivial. >> Or could someone else sponsor this? >> http://cr.openjdk.java.net/~goetz/webrevs/8132242-jtregPTM/webrev.01/ >> >> ... I added the bugID I forgot before to the subject. >> >> Best regards, >> Goetz. >> >> -----Original Message----- >> From: Daniel D. Daugherty [mailto:daniel.daugherty at oracle.com] >> Sent: Donnerstag, 23. Juli 2015 15:49 >> To: Lindenmaier, Goetz >> Cc: hotspot-runtime-dev at openjdk.java.net >> Subject: Re: RFR(S): LogTouchedMethods (8025692) asserts if >> TieredCompilation is off. >> >> Yumin, >> >> Since you did the work on: >> >> JDK-8025692 Log what methods are touched at run-time >> https://bugs.openjdk.java.net/browse/JDK-8025692 >> >> can you help Goetz with this tweak? >> >> Dan >> >> >> On 7/23/15 7:30 AM, Lindenmaier, Goetz wrote: >>> >>> Hi, >>> >>> LogTouchedMethods causes the template interpreter to generate profiling >>> code even >>> if no compiler is used. If TieredCompilation is off, code containing an >>> assertion >>> that checks that UseCompiler is set, is reached. >>> This assertion exists on the sparc and ppc platforms. >>> Fix: >>> Check for LogTouchedMethods in the assertion. >>> Also added testcase with -XX:-TieredCompilation. >>> >>> The problem can be reproduced with the new test case on solaris sparc. >>> >>> Please review this change. I please need a sponsor. >>> http://cr.openjdk.java.net/~goetz/webrevs/8132242-jtregPTM/webrev.01/ >>> >>> Best regards, >>> Goetz Lindenmaier > > From goetz.lindenmaier at sap.com Wed Jul 29 12:10:23 2015 From: goetz.lindenmaier at sap.com (Lindenmaier, Goetz) Date: Wed, 29 Jul 2015 12:10:23 +0000 Subject: RFR(S): 8132242: LogTouchedMethods (8025692) asserts if TieredCompilation is off. In-Reply-To: <55B7A433.3080506@oracle.com> References: <4295855A5C1DE049A61835A1887419CC2D013E70@DEWDFEMB12A.global.corp.sap> <55B7A433.3080506@oracle.com> Message-ID: <4295855A5C1DE049A61835A1887419CC2D0152DC@DEWDFEMB12A.global.corp.sap> Hi Yumin, thanks for taking the time of sponsoring this! Best regards, Goetz. -----Original Message----- From: Yumin Qi [mailto:yumin.qi at oracle.com] Sent: Dienstag, 28. Juli 2015 17:48 To: Lindenmaier, Goetz Cc: daniel.daugherty at oracle.com; hotspot-runtime-dev at openjdk.java.net Subject: Re: RFR(S): 8132242: LogTouchedMethods (8025692) asserts if TieredCompilation is off. Goetz, Thanks for taking care of this issue. It looks good. I am not a "R"eviewer and I think Ioi is not either, we still need a 'R'eviewer to give a pass. I can sponsor for the push. Thanks Yumin On 7/28/2015 1:58 AM, Lindenmaier, Goetz wrote: > Hi, > > Yumin, could you have a look at this, please? It's trivial. > Or could someone else sponsor this? > http://cr.openjdk.java.net/~goetz/webrevs/8132242-jtregPTM/webrev.01/ > > ... I added the bugID I forgot before to the subject. > > Best regards, > Goetz. > > -----Original Message----- > From: Daniel D. Daugherty [mailto:daniel.daugherty at oracle.com] > Sent: Donnerstag, 23. Juli 2015 15:49 > To: Lindenmaier, Goetz > Cc: hotspot-runtime-dev at openjdk.java.net > Subject: Re: RFR(S): LogTouchedMethods (8025692) asserts if TieredCompilation is off. > > Yumin, > > Since you did the work on: > > JDK-8025692 Log what methods are touched at run-time > https://bugs.openjdk.java.net/browse/JDK-8025692 > > can you help Goetz with this tweak? > > Dan > > > On 7/23/15 7:30 AM, Lindenmaier, Goetz wrote: >> Hi, >> >> LogTouchedMethods causes the template interpreter to generate profiling code even >> if no compiler is used. If TieredCompilation is off, code containing an assertion >> that checks that UseCompiler is set, is reached. >> This assertion exists on the sparc and ppc platforms. >> Fix: >> Check for LogTouchedMethods in the assertion. >> Also added testcase with -XX:-TieredCompilation. >> >> The problem can be reproduced with the new test case on solaris sparc. >> >> Please review this change. I please need a sponsor. >> http://cr.openjdk.java.net/~goetz/webrevs/8132242-jtregPTM/webrev.01/ >> >> Best regards, >> Goetz Lindenmaier From christian.thalinger at oracle.com Wed Jul 29 15:28:44 2015 From: christian.thalinger at oracle.com (Christian Thalinger) Date: Wed, 29 Jul 2015 08:28:44 -0700 Subject: RFR: 8130212: Thread::current() might access freed memory on Solaris In-Reply-To: <55B86AF8.9070104@oracle.com> References: <55B868A3.2080602@oracle.com> <55B86A54.7000708@oracle.com> <55B86AF8.9070104@oracle.com> Message-ID: <7F33558F-F6DF-4594-B35E-F72BCEAA1300@oracle.com> Now that threadLS_solaris_sparc.{cpp,hpp} and threadLS_solaris_x86.{cpp,hop} look exactly the same it would be nice to merge them into threadLS_solaris.{cpp,hpp}. > On Jul 28, 2015, at 10:56 PM, David Holmes wrote: > > Moved to hotspot-dev so the compiler folk also see this for the MacroAssembler changes. > > David > > On 29/07/2015 3:53 PM, David Holmes wrote: >> I forgot to credit Dave Dice with the suggestion to modernize this code. >> >> David >> >> On 29/07/2015 3:46 PM, David Holmes wrote: >>> Summary: replace complex custom code for maintaining ThreadLocalStorage >>> with compiler supported thread-local variables (Solaris only) >>> >>> This is a non-public bug so let me explain with some background, the >>> bug, and then the fix - which involves lots of complex-code deletion and >>> addition of some very simple code. :) >>> >>> webrev: http://cr.openjdk.java.net/~dholmes/8130212/webrev/ >>> >>> In various parts of the runtime and in compiler generated code we need >>> to get a reference to the (VM-level) Thread* of the currently executing >>> thread. This is what Thread::current() returns. For performance reasons >>> we also have a fast-path on 64-bit where the Thread* is stashed away in >>> a register (g7 on sparc, r15 on x64). >>> >>> So Thread::current() is actually a slow-path mechanism and it delegates >>> to ThreadLocalStorage::thread(). >>> >>> On some systems ThreadLocalStorage::thread utilizes a caching mechanism >>> to try and speed up access to the current thread. Otherwise it calls >>> into yet another "slow" path which uses the available platform >>> thread-specific-storage APIs. >>> >>> Compiled code also has a slow-path get_thread() method which uses >>> assembly code to invoke the same platform thread-specific-storage APIs >>> (in some cases - on sparc it simply calls ThreadLocalStorage::thread()). >>> >>> On Solaris 64-bit (which is all we support today) there is a simple >>> 1-level thread cache which is an array of Thread*. If a thread doesn't >>> find itself in the slot for the hash of its id it inserts itself there. >>> As a thread terminates it clears out its ThreadLocalStorage values >>> including any cached reference. >>> >>> The bug is that we have potential for a read-after-free error due to >>> this code: >>> >>> 46 uintptr_t raw = pd_raw_thread_id(); >>> 47 int ix = pd_cache_index(raw); // hashes id >>> 48 Thread* candidate = ThreadLocalStorage::_get_thread_cache[ix]; >>> 49 if (candidate->self_raw_id() == raw) { >>> 50 // hit >>> 51 return candidate; >>> 52 } else { >>> 53 return ThreadLocalStorage::get_thread_via_cache_slowly(raw, >>> ix); >>> 54 } >>> >>> The problem is that the value read as candidate could be a thread that >>> (after line 48) terminated and was freed. But line #49 then reads the >>> raw id of that thread, which is then a read-after-free - which is a "Bad >>> Thing (TM)". >>> >>> There's no simple fix for the caching code - you would need a completely >>> different approach (or synchronization that would nullify the whole >>> point of the cache). >>> >>> Now all this ThreadLocalStorage code is pretty old and was put in place >>> to deal with inadequacies of the system provided thread-specific-storage >>> API. In fact on Solaris we even by-pass the public API >>> (thr_getspecific/thr_setspecific) when we can and implement our own >>> version using lower-level APIs available in the T1/T2 threading >>> libraries! >>> >>> In mid-2015 things have changed considerably and we have reliable and >>> performant support for thread-local variables at the C+ language-level. >>> So the way to maintain the current thread is simply using: >>> >>> // Declaration of thread-local variable >>> static __thread Thread * _thr_current >>> >>> inline Thread* ThreadLocalStorage::thread() { >>> return _thr_current; >>> } >>> >>> inline void ThreadLocalStorage::set_thread(Thread* thread) { >>> _thr_current = thread; >>> } >>> >>> And all the complex ThreadLocalStorage code with caching etc all >>> vanishes! >>> >>> For my next trick I plan to try and remove the ThreadLocalStorage class >>> completely by using language-based thread-locals on all platforms. But >>> for now this is just Solaris and so we still need the ThreadLocalStorage >>> API. However a lot of that API is not needed any more on Solaris so I >>> have excluded it from there in the shared code (ifndef SOLARIS). But to >>> avoid changing other shared-code callsites of ThreadLocalStorage I've >>> kept part of the API with trivial implementations on Solaris. >>> >>> Testing: JPRT >>> All hotspot regression tests >>> >>> I'm happy to run more tests but the nice thing about such low-level code >>> is that if it is broken, it is always broken :) Every use of >>> Thread::current or MacroAssembler::get_thread now hits this code. >>> >>> Performance: I've run a basic set of benchmarks that is readily >>> available to me on our performance testing system. The best way to >>> describe the result is neutral. There are some slight wins, and some >>> slight losses, with most showing no statistical difference. And even the >>> "wins" and "losses" are within the natural variations of the benchmarks. >>> So a lot of complex code has been replaced by simple code and we haven't >>> lost any observable performance - which seems like a win to me. >>> >>> Also product mode x64 libjvm.so has shrunk by 921KB - which is a little >>> surprising but very nice. >>> >>> Thanks, >>> David From jeremymanson at google.com Wed Jul 29 20:34:55 2015 From: jeremymanson at google.com (Jeremy Manson) Date: Wed, 29 Jul 2015 13:34:55 -0700 Subject: RFR (XS): 6661889: thread id on Linux is inconsistent in error and log outputs Message-ID: David, can you review/sponsor this, per our conversation of last week? It fixes an issue where, on Linux, some of the Hotspot logging output identifies threads by pthread_id, and some of it identifies threads by kernel-level TID. This happened because Hotspot calls into two different APIs that provide the thread ID, and developers seem to have picked which one they call at random. The CR makes these APIs consistently use the kernel-level TID, and makes one of the APIs a thin shim over the other. Conversation: http://mail.openjdk.java.net/pipermail/hotspot-runtime-dev/2015-July/015507.html Bug: https://bugs.openjdk.java.net/browse/JDK-6661889 Webrev: http://cr.openjdk.java.net/~jmanson/6661889/webrev.01/ Jeremy From david.holmes at oracle.com Wed Jul 29 22:31:57 2015 From: david.holmes at oracle.com (David Holmes) Date: Thu, 30 Jul 2015 08:31:57 +1000 Subject: RFR (XS): 6661889: thread id on Linux is inconsistent in error and log outputs In-Reply-To: References: Message-ID: <55B9545D.8000506@oracle.com> Hi Jeremy, On 30/07/2015 6:34 AM, Jeremy Manson wrote: > David, can you review/sponsor this, per our conversation of last week? Yes I can sponsor and it is also Reviewed. But I'd like a second review from someone else. Thanks, David > It fixes an issue where, on Linux, some of the Hotspot logging output > identifies threads by pthread_id, and some of it identifies threads by > kernel-level TID. This happened because Hotspot calls into two > different APIs that provide the thread ID, and developers seem to have > picked which one they call at random. > > The CR makes these APIs consistently use the kernel-level TID, and makes > one of the APIs a thin shim over the other. > > Conversation: > http://mail.openjdk.java.net/pipermail/hotspot-runtime-dev/2015-July/015507.html > Bug: https://bugs.openjdk.java.net/browse/JDK-6661889 > Webrev: http://cr.openjdk.java.net/~jmanson/6661889/webrev.01/ > > Jeremy From vladimir.kozlov at oracle.com Wed Jul 29 23:07:44 2015 From: vladimir.kozlov at oracle.com (Vladimir Kozlov) Date: Wed, 29 Jul 2015 16:07:44 -0700 Subject: RFR (XS): 6661889: thread id on Linux is inconsistent in error and log outputs In-Reply-To: <55B9545D.8000506@oracle.com> References: <55B9545D.8000506@oracle.com> Message-ID: <55B95CC0.2090303@oracle.com> Finally after 7 years, since I filed this bug, it will be fixed :) Looks good. Thanks, Vladimir On 7/29/15 3:31 PM, David Holmes wrote: > Hi Jeremy, > > On 30/07/2015 6:34 AM, Jeremy Manson wrote: >> David, can you review/sponsor this, per our conversation of last week? > > Yes I can sponsor and it is also Reviewed. > > But I'd like a second review from someone else. > > Thanks, > David > >> It fixes an issue where, on Linux, some of the Hotspot logging output >> identifies threads by pthread_id, and some of it identifies threads by >> kernel-level TID. This happened because Hotspot calls into two >> different APIs that provide the thread ID, and developers seem to have >> picked which one they call at random. >> >> The CR makes these APIs consistently use the kernel-level TID, and makes >> one of the APIs a thin shim over the other. >> >> Conversation: >> http://mail.openjdk.java.net/pipermail/hotspot-runtime-dev/2015-July/015507.html >> >> Bug: https://bugs.openjdk.java.net/browse/JDK-6661889 >> Webrev: http://cr.openjdk.java.net/~jmanson/6661889/webrev.01/ >> >> Jeremy From jiangli.zhou at oracle.com Wed Jul 29 23:50:55 2015 From: jiangli.zhou at oracle.com (Jiangli Zhou) Date: Wed, 29 Jul 2015 16:50:55 -0700 Subject: RFR(M): JDK-8132214: [TESTBUG] Create basic shared strings test for CDS archive In-Reply-To: <55B7C09E.9030703@oracle.com> References: <55B7C09E.9030703@oracle.com> Message-ID: Hi Misha, Looks ok. Thanks for adding the test case. Thanks, Jiangli On Jul 28, 2015, at 10:49 AM, Mikhailo Seledtsov wrote: > Please review an addition of a new test for Shared Strings in CDS archive. > > JBS: https://bugs.openjdk.java.net/browse/JDK-8132214 > WebRev: http://cr.openjdk.java.net/~mseledtsov/8132214.00/ > Testing: Ran CDS tests including this newly written test via > automated multi-platform testing on standard platforms > > Thank you, > Misha From david.holmes at oracle.com Thu Jul 30 03:03:56 2015 From: david.holmes at oracle.com (David Holmes) Date: Thu, 30 Jul 2015 13:03:56 +1000 Subject: RFR (XS): 6661889: thread id on Linux is inconsistent in error and log outputs In-Reply-To: <55B95CC0.2090303@oracle.com> References: <55B9545D.8000506@oracle.com> <55B95CC0.2090303@oracle.com> Message-ID: <55B9941C.8050806@oracle.com> On 30/07/2015 9:07 AM, Vladimir Kozlov wrote: > Finally after 7 years, since I filed this bug, it will be fixed :) I hope it now does what you wanted :) On its way. Thanks, David > Looks good. > > Thanks, > Vladimir > > On 7/29/15 3:31 PM, David Holmes wrote: >> Hi Jeremy, >> >> On 30/07/2015 6:34 AM, Jeremy Manson wrote: >>> David, can you review/sponsor this, per our conversation of last week? >> >> Yes I can sponsor and it is also Reviewed. >> >> But I'd like a second review from someone else. >> >> Thanks, >> David >> >>> It fixes an issue where, on Linux, some of the Hotspot logging output >>> identifies threads by pthread_id, and some of it identifies threads by >>> kernel-level TID. This happened because Hotspot calls into two >>> different APIs that provide the thread ID, and developers seem to have >>> picked which one they call at random. >>> >>> The CR makes these APIs consistently use the kernel-level TID, and makes >>> one of the APIs a thin shim over the other. >>> >>> Conversation: >>> http://mail.openjdk.java.net/pipermail/hotspot-runtime-dev/2015-July/015507.html >>> >>> >>> Bug: https://bugs.openjdk.java.net/browse/JDK-6661889 >>> Webrev: http://cr.openjdk.java.net/~jmanson/6661889/webrev.01/ >>> >>> Jeremy From jeremymanson at google.com Thu Jul 30 05:48:28 2015 From: jeremymanson at google.com (Jeremy Manson) Date: Wed, 29 Jul 2015 22:48:28 -0700 Subject: RFR (XS): 6661889: thread id on Linux is inconsistent in error and log outputs In-Reply-To: <55B9941C.8050806@oracle.com> References: <55B9545D.8000506@oracle.com> <55B95CC0.2090303@oracle.com> <55B9941C.8050806@oracle.com> Message-ID: Thanks, folks! Jeremy On Wed, Jul 29, 2015 at 8:03 PM, David Holmes wrote: > On 30/07/2015 9:07 AM, Vladimir Kozlov wrote: > >> Finally after 7 years, since I filed this bug, it will be fixed :) >> > > I hope it now does what you wanted :) > > On its way. > > Thanks, > David > > > Looks good. >> >> Thanks, >> Vladimir >> >> On 7/29/15 3:31 PM, David Holmes wrote: >> >>> Hi Jeremy, >>> >>> On 30/07/2015 6:34 AM, Jeremy Manson wrote: >>> >>>> David, can you review/sponsor this, per our conversation of last week? >>>> >>> >>> Yes I can sponsor and it is also Reviewed. >>> >>> But I'd like a second review from someone else. >>> >>> Thanks, >>> David >>> >>> It fixes an issue where, on Linux, some of the Hotspot logging output >>>> identifies threads by pthread_id, and some of it identifies threads by >>>> kernel-level TID. This happened because Hotspot calls into two >>>> different APIs that provide the thread ID, and developers seem to have >>>> picked which one they call at random. >>>> >>>> The CR makes these APIs consistently use the kernel-level TID, and makes >>>> one of the APIs a thin shim over the other. >>>> >>>> Conversation: >>>> >>>> http://mail.openjdk.java.net/pipermail/hotspot-runtime-dev/2015-July/015507.html >>>> >>>> >>>> Bug: https://bugs.openjdk.java.net/browse/JDK-6661889 >>>> Webrev: http://cr.openjdk.java.net/~jmanson/6661889/webrev.01/ >>>> >>>> Jeremy >>>> >>> From cheleswer.sahu at oracle.com Fri Jul 31 06:50:41 2015 From: cheleswer.sahu at oracle.com (cheleswer sahu) Date: Fri, 31 Jul 2015 12:20:41 +0530 Subject: RFR[ 9u-dev] JDK-8075773 - jps running as root fails after the fix of JDK-8050807 In-Reply-To: <55B6A604.4010206@oracle.com> References: <55B6653A.3070007@oracle.com> <55B66BD6.6080307@oracle.com> <55B6A604.4010206@oracle.com> Message-ID: <55BB1AC1.4040909@oracle.com> Hi, Thanks Dmitry and Jerry for your review comments. I have fixed the spacing and indentation issue. Update web review link: http://cr.openjdk.java.net/~poonam/8075773/webrev.01/ Regards, Cheleswer On 7/28/2015 3:13 AM, Gerald Thornbrugh wrote: > Hi Cheleswer, > > Other than the issues Dimitry mentioned below your changes look good. > > I am also not a "Reviewer". > > Thanks! > > Jerry >> Cheleswer, >> >> src/os/linux/vm/perfMemory_linux.cpp >> >> 220 space missed after // >> 222 space missed after != >> >> src/os/solaris/vm/perfMemory_solaris.cpp >> >> 222 extra space before // (wrong indent) >> >> Otherwise looks good. (not a Reviewer) >> >> -Dmitry >> >> >> On 2015-07-27 20:07, cheleswer sahu wrote: >>> Hi, >>> >>> Please review the code changes for >>> "https://bugs.openjdk.java.net/browse/JDK-8075773" . >>> Web review Link: http://cr.openjdk.java.net/~poonam/8075773/webrev.00/ >>> >>> Bug brief: This bug was introduced after the fix of JDK-8050807. JPS >>> reads the process information from >>> "/tmp/hsperfdata_$username_$ProcessID". In order to ensure the file is >>> secure to open and read, it tries to match the UID with the effective >>> user ID of that file. When JPS is run as root user this check gets >>> failed. >>> >>> Fix: If JPS is running as a root user, then the check which matches, >>> UID >>> with effective user id is skipped. >>> >>> I have test this fix, it's working fine and found no security issue. >>> >>> >>> Regards, >>> Cheleswer >> > From dmitry.samersoff at oracle.com Fri Jul 31 09:06:09 2015 From: dmitry.samersoff at oracle.com (Dmitry Samersoff) Date: Fri, 31 Jul 2015 12:06:09 +0300 Subject: RFR[ 9u-dev] JDK-8075773 - jps running as root fails after the fix of JDK-8050807 In-Reply-To: <55BB1AC1.4040909@oracle.com> References: <55B6653A.3070007@oracle.com> <55B66BD6.6080307@oracle.com> <55B6A604.4010206@oracle.com> <55BB1AC1.4040909@oracle.com> Message-ID: <55BB3A81.5070903@oracle.com> Cheleswer, Looks good for me! -Dmitry On 2015-07-31 09:50, cheleswer sahu wrote: > Hi, > Thanks Dmitry and Jerry for your review comments. I have fixed the > spacing and indentation issue. > > Update web review link: > http://cr.openjdk.java.net/~poonam/8075773/webrev.01/ > > Regards, > Cheleswer > > On 7/28/2015 3:13 AM, Gerald Thornbrugh wrote: >> Hi Cheleswer, >> >> Other than the issues Dimitry mentioned below your changes look good. >> >> I am also not a "Reviewer". >> >> Thanks! >> >> Jerry >>> Cheleswer, >>> >>> src/os/linux/vm/perfMemory_linux.cpp >>> >>> 220 space missed after // >>> 222 space missed after != >>> >>> src/os/solaris/vm/perfMemory_solaris.cpp >>> >>> 222 extra space before // (wrong indent) >>> >>> Otherwise looks good. (not a Reviewer) >>> >>> -Dmitry >>> >>> >>> On 2015-07-27 20:07, cheleswer sahu wrote: >>>> Hi, >>>> >>>> Please review the code changes for >>>> "https://bugs.openjdk.java.net/browse/JDK-8075773" . >>>> Web review Link: http://cr.openjdk.java.net/~poonam/8075773/webrev.00/ >>>> >>>> Bug brief: This bug was introduced after the fix of JDK-8050807. JPS >>>> reads the process information from >>>> "/tmp/hsperfdata_$username_$ProcessID". In order to ensure the file is >>>> secure to open and read, it tries to match the UID with the effective >>>> user ID of that file. When JPS is run as root user this check gets >>>> failed. >>>> >>>> Fix: If JPS is running as a root user, then the check which matches, >>>> UID >>>> with effective user id is skipped. >>>> >>>> I have test this fix, it's working fine and found no security issue. >>>> >>>> >>>> Regards, >>>> Cheleswer >>> >> > -- Dmitry Samersoff Oracle Java development team, Saint Petersburg, Russia * I would love to change the world, but they won't give me the sources. From mikhailo.seledtsov at oracle.com Fri Jul 31 17:05:20 2015 From: mikhailo.seledtsov at oracle.com (Mikhailo Seledtsov) Date: Fri, 31 Jul 2015 10:05:20 -0700 Subject: RFR(M): JDK-8132214: [TESTBUG] Create basic shared strings test for CDS archive In-Reply-To: References: <55B7C09E.9030703@oracle.com> Message-ID: <55BBAAD0.50309@oracle.com> Jiangli, Thank you for review. Also, I got some feedback from Christian T. offline, and made the changes accordingly. The changes are minor. 1. Christian: test/runtime/SharedArchiveFile/BasicJarBuilder.java L39, 70, 91-98 Is the DEBUG variable still useful to have around? Misha: I have removed the DEBUG statements, think the test has been tested enough and these are not needed here anymore. 2. Christian: SharedStrings.java - can you name the .jsa file to SharedStrings.jsa instead? We had some issues where we suspected the old .jsa file to be around if the tests were in the same directory, this would make the naming of them unique. Misha: Done. 3. Christian: SharedStrings.java - L53, shouldn?t need the extra parenthesis around this? Misha: Done, removed extra parenthesis. The updated webrev is available at: http://cr.openjdk.java.net/~mseledtsov/8132214.01/ Thank you, Misha On 7/29/2015 4:50 PM, Jiangli Zhou wrote: > Hi Misha, > > Looks ok. Thanks for adding the test case. > > Thanks, > Jiangli > > On Jul 28, 2015, at 10:49 AM, Mikhailo Seledtsov wrote: > >> Please review an addition of a new test for Shared Strings in CDS archive. >> >> JBS: https://bugs.openjdk.java.net/browse/JDK-8132214 >> WebRev: http://cr.openjdk.java.net/~mseledtsov/8132214.00/ >> Testing: Ran CDS tests including this newly written test via >> automated multi-platform testing on standard platforms >> >> Thank you, >> Misha From christian.tornqvist at oracle.com Fri Jul 31 17:09:08 2015 From: christian.tornqvist at oracle.com (Christian Tornqvist) Date: Fri, 31 Jul 2015 13:09:08 -0400 Subject: RFR(M): JDK-8132214: [TESTBUG] Create basic shared strings test for CDS archive In-Reply-To: <55BBAAD0.50309@oracle.com> References: <55B7C09E.9030703@oracle.com> <55BBAAD0.50309@oracle.com> Message-ID: <011001d0cbb3$9d2d98a0$d788c9e0$@oracle.com> Hi Misha, This looks good, thanks for adding these test :) Thanks, Christian -----Original Message----- From: Mikhailo Seledtsov [mailto:mikhailo.seledtsov at oracle.com] Sent: Friday, July 31, 2015 1:05 PM To: Jiangli Zhou ; Christian T?rnqvist Cc: hotspot-runtime-dev Subject: Re: RFR(M): JDK-8132214: [TESTBUG] Create basic shared strings test for CDS archive Jiangli, Thank you for review. Also, I got some feedback from Christian T. offline, and made the changes accordingly. The changes are minor. 1. Christian: test/runtime/SharedArchiveFile/BasicJarBuilder.java L39, 70, 91-98 Is the DEBUG variable still useful to have around? Misha: I have removed the DEBUG statements, think the test has been tested enough and these are not needed here anymore. 2. Christian: SharedStrings.java - can you name the .jsa file to SharedStrings.jsa instead? We had some issues where we suspected the old .jsa file to be around if the tests were in the same directory, this would make the naming of them unique. Misha: Done. 3. Christian: SharedStrings.java - L53, shouldn?t need the extra parenthesis around this? Misha: Done, removed extra parenthesis. The updated webrev is available at: http://cr.openjdk.java.net/~mseledtsov/8132214.01/ Thank you, Misha On 7/29/2015 4:50 PM, Jiangli Zhou wrote: > Hi Misha, > > Looks ok. Thanks for adding the test case. > > Thanks, > Jiangli > > On Jul 28, 2015, at 10:49 AM, Mikhailo Seledtsov wrote: > >> Please review an addition of a new test for Shared Strings in CDS archive. >> >> JBS: https://bugs.openjdk.java.net/browse/JDK-8132214 >> WebRev: http://cr.openjdk.java.net/~mseledtsov/8132214.00/ >> Testing: Ran CDS tests including this newly written test via >> automated multi-platform testing on standard >> platforms >> >> Thank you, >> Misha From mikhailo.seledtsov at oracle.com Fri Jul 31 17:14:48 2015 From: mikhailo.seledtsov at oracle.com (Mikhailo Seledtsov) Date: Fri, 31 Jul 2015 10:14:48 -0700 Subject: RFR(M): JDK-8132214: [TESTBUG] Create basic shared strings test for CDS archive In-Reply-To: <011001d0cbb3$9d2d98a0$d788c9e0$@oracle.com> References: <55B7C09E.9030703@oracle.com> <55BBAAD0.50309@oracle.com> <011001d0cbb3$9d2d98a0$d788c9e0$@oracle.com> Message-ID: <55BBAD08.1050608@oracle.com> Thank you for review, Misha On 7/31/2015 10:09 AM, Christian Tornqvist wrote: > Hi Misha, > > This looks good, thanks for adding these test :) > > Thanks, > Christian > > -----Original Message----- > From: Mikhailo Seledtsov [mailto:mikhailo.seledtsov at oracle.com] > Sent: Friday, July 31, 2015 1:05 PM > To: Jiangli Zhou ; Christian T?rnqvist > > Cc: hotspot-runtime-dev > Subject: Re: RFR(M): JDK-8132214: [TESTBUG] Create basic shared strings test > for CDS archive > > Jiangli, > Thank you for review. > > Also, I got some feedback from Christian T. offline, and made the changes > accordingly. > The changes are minor. > > 1. Christian: test/runtime/SharedArchiveFile/BasicJarBuilder.java > L39, 70, 91-98 Is the DEBUG variable still useful to have around? > Misha: I have removed the DEBUG statements, think the test has been > tested enough and > these are not needed here anymore. > > 2. Christian: SharedStrings.java - can you name the .jsa file to > SharedStrings.jsa instead? We had some issues where we suspected the old > .jsa file to be around if the tests were in the same directory, this would > make the naming of them unique. > Misha: Done. > > 3. Christian: SharedStrings.java - L53, shouldn?t need the extra parenthesis > around this? > Misha: Done, removed extra parenthesis. > > The updated webrev is available at: > http://cr.openjdk.java.net/~mseledtsov/8132214.01/ > > > Thank you, > Misha > > On 7/29/2015 4:50 PM, Jiangli Zhou wrote: >> Hi Misha, >> >> Looks ok. Thanks for adding the test case. >> >> Thanks, >> Jiangli >> >> On Jul 28, 2015, at 10:49 AM, Mikhailo Seledtsov > wrote: >>> Please review an addition of a new test for Shared Strings in CDS > archive. >>> JBS: https://bugs.openjdk.java.net/browse/JDK-8132214 >>> WebRev: http://cr.openjdk.java.net/~mseledtsov/8132214.00/ >>> Testing: Ran CDS tests including this newly written test via >>> automated multi-platform testing on standard >>> platforms >>> >>> Thank you, >>> Misha > From karen.kinnear at oracle.com Fri Jul 31 18:01:18 2015 From: karen.kinnear at oracle.com (Karen Kinnear) Date: Fri, 31 Jul 2015 14:01:18 -0400 Subject: RFR: 8087342: crash in klassItable_initialize_itable_for_interface In-Reply-To: References: <55A6F6F7.6040508@oracle.com> Message-ID: Lois, Here is an updated webrev. The hotspot code has not changed (except for the fixed comments). I added a test to investigate if I could have static and instance fields in the same class (obviously with -Xverify:none). I did manage to have 1 public static, 1 private instance and 1 overpass for an AME from an abstract interface. Obviously none of this matches the jls, or jvms or passes the verifier - but I did want to make sure the code did the right thing. The test passes in product and fastdebug. I would appreciate a review for the test itself. Thanks to Harold for jasm example :-) updated webrev: http://cr.openjdk.java.net/~acorn/8087342.3/webrev/ >> bug: https://bugs.openjdk.java.net/browse/JDK-8087342 thanks, Karen On Jul 16, 2015, at 6:03 PM, Karen Kinnear wrote: > Lois, > > Thank you for the detailed review. I really appreciate it. > On Jul 15, 2015, at 8:12 PM, Lois Foltan wrote: > >> >> On 7/15/2015 12:40 PM, Karen Kinnear wrote: >>> Please review for JDK9: >>> >>> bug: https://bugs.openjdk.java.net/browse/JDK-8087342 >>> webrev: http://cr.openjdk.java.net/~acorn/8087342.2/webrev/ >>> >>> Crash occurs in product when we should through IncompatibleClassChangeError. >> >> Hi Karen, >> I think this looks good and I really like how straight forward klassVtable::is_miranda now is. Some minor clarification comments: >> >> - src/share/vm/instanceKlass.cpp >> comments for the find_local_method* were changed to state: >> +// note that the local methods array can have up to one overpass, one static >> +// and one instance (private or not) with the same name/signature >> I think there are two combinations that the code depends on not occurring, they are: >> 1. all 3 are in existence in the local methods array (one overpass, one static and one instance) >> 2. the combination of one static and one instance (private or not) >> In other words there has to be an overpass to cause more than one method with the same name/signature within the local methods array. And it is either an overpass and a static or an overpass and an instance, but not all 3. Correct me if I am wrong. > I need to write an additional test to check that. I agree that both the spec and the ClassFileParser if _need_verify is set will > prevent instance and static overlap. I need to see what happens if you skip verification. I will get back to you with that and update the > comments to clarify if needed. >> >> - src/share/vm/oops/klassVtable.cpp > Let me see if I can make this clearer - let me know if I can make the comments clearer. I truly appreciate your trying to see > if this all makes sense and is consistent. It is still too complex. >> Thank you for adding the improved comments ahead of is_miranda. My read is that overpass methods are not considered miranda methods and I agree with that statement. > Yes, they are not considered miranda methods because you don't need to add them to the vtable as abstract methods because > they already are in the vtable from being in the class' LOCAL methods array. > So pass 1: overpasses do not exist > pass 2: overpasses are already in the vtable when we calculate mirandas > pass 3: overpasses in a class have the class as their method_holder, not an interface, so we aren't looking them up here > > So - pass 2 is the one that cares about the find_local_method(Klass:find_overpass vs. Klass::skip_overpass). > > >> Yet, Klass::find_overpass is specified in the code. I think the code is correct, but based on the comment I would have thought Klass::skip_overpass should have been specified? > I also think the code is correct. > So what pass 2 is doing is walking through the superinterfaces to see if any of the superinterface methods (which all used to be abstract) > need to be added to the vtable. > > So the question is - what superinterface methods belong in the vtable? > So the searches in is_miranda are designed to find out if there is a method in the vtable already such that we don't > need to add the superinterface method - e.g. this was abstract and we have an implementation for it. > > With the addition of default methods, we have three new challenges - overpasses, static interface methods and private > interface methods. > > Static and private interface methods do not get added to the vtable and are not seen by the method resolution process. > So we skip those. > > Overpass methods are already in the vtable, so vtable lookup will find them there and we don't need to add a miranda method > to the end of the vtable. So we look for those explicitly. Note that we inherit our superclasses vtable, so the superclass' search > also needs to use find_overpass. > > Does this make sense? > > Is there a way I could make this clearer via comments? > >> Much like skip_static and skip_private. So based on your later statement that "Abstract methods may already have been handled via overpasses" it implies that overpass methods, although not miranda methods, can satisfy or stand in for an miranda during pass 2. So they must be found, did I understand that correctly? > >> >> Again, looks good. I don't need to see another review. My comments were merely clarification based. > many thanks, > Karen > >> >> Thanks, >> Lois >> >> >> >> >> >> >> >> >>> >>> testing: >>> internal tests: Defmeth (updated), SelectionResolution - product and fastdebug >>> jprt >>> jck >>> jtreg/hotspot_all >>> jtreg/jdk_streams >>> test,noncolo.testlist, -atk quick >>> >>> (jck and macosx testing in progress) >>> >>> thanks, >>> Karen >>> >> > From rainer.jung at kippdata.de Wed Jul 22 21:10:41 2015 From: rainer.jung at kippdata.de (Rainer Jung) Date: Wed, 22 Jul 2015 21:10:41 -0000 Subject: os::current_thread_id on Linux In-Reply-To: References: Message-ID: <55B006C4.8010202@kippdata.de> Am 22.07.2015 um 20:52 schrieb Jeremy Manson: > Example of where this would help: > > Current output of SIGQUIT: > > "C1 CompilerThread3" #8 daemon prio=9 os_prio=0 tid=0x00007f0890247800 > nid=0x2e3d waiting on condition [0x0000000000000000] > java.lang.Thread.State: RUNNABLE > > "C2 CompilerThread2" #7 daemon prio=9 os_prio=0 tid=0x00007f0890245000 > nid=0x2e3c waiting on condition [0x0000000000000000] > java.lang.Thread.State: RUNNABLE > > "C2 CompilerThread1" #6 daemon prio=9 os_prio=0 tid=0x00007f0890243800 > nid=0x2e3b waiting on condition [0x0000000000000000] > java.lang.Thread.State: RUNNABLE > > "C2 CompilerThread0" #5 daemon prio=9 os_prio=0 tid=0x00007f0890240800 > nid=0x2e3a waiting on condition [0x0000000000000000] > java.lang.Thread.State: RUNNABLE > > Current directory listing from /tmp with -XX:+UnlockDiagnosticVMOptions > -XX:+LogCompilation: > > $ ls -d /tmp/hs* > hs_c139673756251904_pid11818.log hs_c139673759409920_pid11818.log > hs_c139673757304576_pid11818.log hsperfdata_jeremymanson/ > hs_c139673758357248_pid11818.log hsperfdata_root/ > > > Output with this change would look like: > > $ ls -d /tmp/hs* > hs_c11837_pid11818.log hs_c11834_pid11818.log > hs_c11836_pid11818.log hsperfdata_jeremymanson/ > hs_c11835_pid11818.log hsperfdata_root/ > > Where 1183x maps neatly back to 0x2e3x in the SIGQUIT dump. I always though the other thread id is the tid printed above. At least I vaguely remember to have successfully used that id to match against thread IDs as ouput by the gstack command. In your concrete example above, tid and long thread ID do not exactly match though, e.g. 139673756251904 = 0x00007f0854a03700 Regards, Rainer