From lukas.stadler at jku.at Thu Sep 5 09:07:39 2013 From: lukas.stadler at jku.at (lukas.stadler at jku.at) Date: Thu, 05 Sep 2013 16:07:39 +0000 Subject: hg: mlvm/mlvm/hotspot: coro-simple.patch: rebasing fixes Message-ID: <20130905160740.0C62F625A9@hg.openjdk.java.net> Changeset: 920e65ad4626 Author: Lukas Stadler Date: 2013-09-05 18:02 +0200 URL: http://hg.openjdk.java.net/mlvm/mlvm/hotspot/rev/920e65ad4626 coro-simple.patch: rebasing fixes ! coro-simple.patch From david.r.chase at oracle.com Fri Sep 6 16:59:01 2013 From: david.r.chase at oracle.com (David Chase) Date: Fri, 6 Sep 2013 19:59:01 -0400 Subject: RFR(S+M) / 8022701 Accessibility checking: InvocationTargetException is thrown instead of IllegalAccessError In-Reply-To: <64E60D4E-0829-4B23-9EE7-61AD28DB7E2F@oracle.com> References: <143F40F0-557E-48EA-9207-0FF1880663DF@oracle.com> <5229F4B8.9000506@oracle.com> <64E60D4E-0829-4B23-9EE7-61AD28DB7E2F@oracle.com> Message-ID: new, improved webrev: http://cr.openjdk.java.net/~drchase/8022701/webrev.02/ Same small changes to the sources, plus a test. bug: wrong exception was thrown in call of methodhandle to private method fix: detect special case of IllegalAccessException, convert to IllegalAccessError testing: verified that the test would pass with modified library verified that the test would fail with old library verified that the test would fail if the class substitution (for some reason) did not occur jtreg of jdk/test/java/lang/invoke -- note that the new exception thrown is a subtype of the old one, so this is unlikely to create a new surprise -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 163 bytes Desc: Message signed with OpenPGP using GPGMail Url : http://mail.openjdk.java.net/pipermail/mlvm-dev/attachments/20130906/2625ea4d/signature.asc From headius at headius.com Fri Sep 6 23:11:52 2013 From: headius at headius.com (Charles Oliver Nutter) Date: Sat, 7 Sep 2013 01:11:52 -0500 Subject: Reproducible InternalError in lambda stuff Message-ID: I can reproduce this by running a fairly normalish command in JRuby: (Java::JavaLang::InternalError) guard=Lambda(a0:L,a1:L,a2:L,a3:L,a4:L)=>{ t5:I=MethodHandle(ThreadContext,IRubyObject,IRubyObject,IRubyObject)boolean(a1:L,a2:L,a3:L,a4:L); t6:L=MethodHandleImpl.selectAlternative(t5:I,(MethodHandle(ThreadContext,IRubyObject,IRubyObject,IRubyObject)IRubyObject),(MethodHandle(ThreadContext,IRubyObject,IRubyObject,IRubyObject)IRubyObject)); t7:L=MethodHandle.invokeBasic(t6:L,a1:L,a2:L,a3:L,a4:L);t7:L} I think it's happening at an OutOfMemory event (bumping up memory makes it go away), so it may not be a critical issue, but I thought I'd toss it out here. - Charlie From christian.thalinger at oracle.com Mon Sep 9 09:21:49 2013 From: christian.thalinger at oracle.com (Christian Thalinger) Date: Mon, 9 Sep 2013 09:21:49 -0700 Subject: Reproducible InternalError in lambda stuff In-Reply-To: References: Message-ID: <6810AEF1-95BD-4466-91DB-6872D4AFFE14@oracle.com> On Sep 6, 2013, at 11:11 PM, Charles Oliver Nutter wrote: > I can reproduce this by running a fairly normalish command in JRuby: > > (Java::JavaLang::InternalError) > guard=Lambda(a0:L,a1:L,a2:L,a3:L,a4:L)=>{ > t5:I=MethodHandle(ThreadContext,IRubyObject,IRubyObject,IRubyObject)boolean(a1:L,a2:L,a3:L,a4:L); > t6:L=MethodHandleImpl.selectAlternative(t5:I,(MethodHandle(ThreadContext,IRubyObject,IRubyObject,IRubyObject)IRubyObject),(MethodHandle(ThreadContext,IRubyObject,IRubyObject,IRubyObject)IRubyObject)); > t7:L=MethodHandle.invokeBasic(t6:L,a1:L,a2:L,a3:L,a4:L);t7:L} > > I think it's happening at an OutOfMemory event (bumping up memory > makes it go away), so it may not be a critical issue, but I thought > I'd toss it out here. Do know where it's coming from? -- Chris > > - Charlie > _______________________________________________ > mlvm-dev mailing list > mlvm-dev at openjdk.java.net > http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev From christian.thalinger at oracle.com Thu Sep 12 10:24:16 2013 From: christian.thalinger at oracle.com (Christian Thalinger) Date: Thu, 12 Sep 2013 10:24:16 -0700 Subject: RFR(S+M) / 8022701 Accessibility checking: InvocationTargetException is thrown instead of IllegalAccessError In-Reply-To: References: <143F40F0-557E-48EA-9207-0FF1880663DF@oracle.com> <5229F4B8.9000506@oracle.com> <64E60D4E-0829-4B23-9EE7-61AD28DB7E2F@oracle.com> Message-ID: + // err.initCause(ex); Why is this commented? -- Chris On Sep 6, 2013, at 4:59 PM, David Chase wrote: > new, improved webrev: http://cr.openjdk.java.net/~drchase/8022701/webrev.02/ > Same small changes to the sources, plus a test. > > bug: wrong exception was thrown in call of methodhandle to private method > > fix: detect special case of IllegalAccessException, convert to IllegalAccessError > > testing: > verified that the test would pass with modified library > verified that the test would fail with old library > verified that the test would fail if the class substitution (for some reason) did not occur > jtreg of jdk/test/java/lang/invoke -- note that the new exception thrown is a subtype of the old one, so this is unlikely to create a new surprise > > > _______________________________________________ > mlvm-dev mailing list > mlvm-dev at openjdk.java.net > http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev From david.r.chase at oracle.com Thu Sep 12 10:53:11 2013 From: david.r.chase at oracle.com (David Chase) Date: Thu, 12 Sep 2013 13:53:11 -0400 Subject: RFR(S+M) / 8022701 Accessibility checking: InvocationTargetException is thrown instead of IllegalAccessError In-Reply-To: References: <143F40F0-557E-48EA-9207-0FF1880663DF@oracle.com> <5229F4B8.9000506@oracle.com> <64E60D4E-0829-4B23-9EE7-61AD28DB7E2F@oracle.com> Message-ID: <49B1A36F-6C45-4E92-80D2-FA6F80A238CB@oracle.com> I believe it produced extraneous output -- it was not clear to me that it was either necessary or useful to fully describe all the converted exceptions that lead to the defined exception being thrown. The commented line should have just been removed (I think). On 2013-09-12, at 1:24 PM, Christian Thalinger wrote: > + // err.initCause(ex); > > Why is this commented? > > -- Chris > > On Sep 6, 2013, at 4:59 PM, David Chase wrote: > >> new, improved webrev: http://cr.openjdk.java.net/~drchase/8022701/webrev.02/ >> Same small changes to the sources, plus a test. >> >> bug: wrong exception was thrown in call of methodhandle to private method >> >> fix: detect special case of IllegalAccessException, convert to IllegalAccessError >> >> testing: >> verified that the test would pass with modified library >> verified that the test would fail with old library >> verified that the test would fail if the class substitution (for some reason) did not occur >> jtreg of jdk/test/java/lang/invoke -- note that the new exception thrown is a subtype of the old one, so this is unlikely to create a new surprise >> >> >> _______________________________________________ >> mlvm-dev mailing list >> mlvm-dev at openjdk.java.net >> http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev > From david.r.chase at oracle.com Thu Sep 12 11:28:38 2013 From: david.r.chase at oracle.com (David Chase) Date: Thu, 12 Sep 2013 14:28:38 -0400 Subject: RFR(S+M) / 8022701 Accessibility checking: InvocationTargetException is thrown instead of IllegalAccessError In-Reply-To: <49B1A36F-6C45-4E92-80D2-FA6F80A238CB@oracle.com> References: <143F40F0-557E-48EA-9207-0FF1880663DF@oracle.com> <5229F4B8.9000506@oracle.com> <64E60D4E-0829-4B23-9EE7-61AD28DB7E2F@oracle.com> <49B1A36F-6C45-4E92-80D2-FA6F80A238CB@oracle.com> Message-ID: <2F83E9C4-B28A-4385-8FFB-78F1313A931F@oracle.com> New webrev, commented line removed: http://cr.openjdk.java.net/~drchase/8022701/webrev.03/ On 2013-09-12, at 1:53 PM, David Chase wrote: > I believe it produced extraneous output -- it was not clear to me that it was either necessary or useful to fully describe all the converted exceptions that lead to the defined exception being thrown. The commented line should have just been removed (I think). > > On 2013-09-12, at 1:24 PM, Christian Thalinger wrote: > >> + // err.initCause(ex); >> >> Why is this commented? >> >> -- Chris -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 163 bytes Desc: Message signed with OpenPGP using GPGMail Url : http://mail.openjdk.java.net/pipermail/mlvm-dev/attachments/20130912/646df1fd/signature.asc From christian.thalinger at oracle.com Thu Sep 12 11:34:12 2013 From: christian.thalinger at oracle.com (Christian Thalinger) Date: Thu, 12 Sep 2013 11:34:12 -0700 Subject: RFR(S+M) / 8022701 Accessibility checking: InvocationTargetException is thrown instead of IllegalAccessError In-Reply-To: <2F83E9C4-B28A-4385-8FFB-78F1313A931F@oracle.com> References: <143F40F0-557E-48EA-9207-0FF1880663DF@oracle.com> <5229F4B8.9000506@oracle.com> <64E60D4E-0829-4B23-9EE7-61AD28DB7E2F@oracle.com> <49B1A36F-6C45-4E92-80D2-FA6F80A238CB@oracle.com> <2F83E9C4-B28A-4385-8FFB-78F1313A931F@oracle.com> Message-ID: <6F0563F9-7A78-42C7-9296-53991C18D5CA@oracle.com> On Sep 12, 2013, at 11:28 AM, David Chase wrote: > New webrev, commented line removed: > http://cr.openjdk.java.net/~drchase/8022701/webrev.03/ I think the change is good given that the tests work now. Is your test derived from the test in the bug report? And it would be good if John could also have a quick look (just be to be sure). -- Chris > > On 2013-09-12, at 1:53 PM, David Chase wrote: > >> I believe it produced extraneous output -- it was not clear to me that it was either necessary or useful to fully describe all the converted exceptions that lead to the defined exception being thrown. The commented line should have just been removed (I think). >> >> On 2013-09-12, at 1:24 PM, Christian Thalinger wrote: >> >>> + // err.initCause(ex); >>> >>> Why is this commented? >>> >>> -- Chris > From david.r.chase at oracle.com Thu Sep 12 12:17:24 2013 From: david.r.chase at oracle.com (David Chase) Date: Thu, 12 Sep 2013 15:17:24 -0400 Subject: RFR(S+M) / 8022701 Accessibility checking: InvocationTargetException is thrown instead of IllegalAccessError In-Reply-To: <6F0563F9-7A78-42C7-9296-53991C18D5CA@oracle.com> References: <143F40F0-557E-48EA-9207-0FF1880663DF@oracle.com> <5229F4B8.9000506@oracle.com> <64E60D4E-0829-4B23-9EE7-61AD28DB7E2F@oracle.com> <49B1A36F-6C45-4E92-80D2-FA6F80A238CB@oracle.com> <2F83E9C4-B28A-4385-8FFB-78F1313A931F@oracle.com> <6F0563F9-7A78-42C7-9296-53991C18D5CA@oracle.com> Message-ID: The test is adapted from the test in the bug report. The headline on the bug report is wrong -- because it uses reflection in the test to do the invocation, the thrown exception is wrapped with InvocationTargetException, which is completely correct. HOWEVER, the exception inside the wrapper is the wrong one. The new test checks the exception in both the reflective-invocation and plain-invocation cases, and also checks both a method handle call (which threw the wrong exception) and a plain call (which threw, and throws, the right exception). The test also uses a tweaked classloader to substitute the borked bytecodes necessary to get the error, so it is not only shell-free, it can also be run outside jtreg. On 2013-09-12, at 2:34 PM, Christian Thalinger wrote: > > On Sep 12, 2013, at 11:28 AM, David Chase wrote: > >> New webrev, commented line removed: >> http://cr.openjdk.java.net/~drchase/8022701/webrev.03/ > > I think the change is good given that the tests work now. Is your test derived from the test in the bug report? > > And it would be good if John could also have a quick look (just be to be sure). > > -- Chris > >> >> On 2013-09-12, at 1:53 PM, David Chase wrote: >> >>> I believe it produced extraneous output -- it was not clear to me that it was either necessary or useful to fully describe all the converted exceptions that lead to the defined exception being thrown. The commented line should have just been removed (I think). >>> >>> On 2013-09-12, at 1:24 PM, Christian Thalinger wrote: >>> >>>> + // err.initCause(ex); >>>> >>>> Why is this commented? >>>> >>>> -- Chris >> > -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 163 bytes Desc: Message signed with OpenPGP using GPGMail Url : http://mail.openjdk.java.net/pipermail/mlvm-dev/attachments/20130912/2e3fec94/signature.asc From john.r.rose at oracle.com Thu Sep 12 14:35:46 2013 From: john.r.rose at oracle.com (John Rose) Date: Thu, 12 Sep 2013 14:35:46 -0700 Subject: RFR(S+M) / 8022701 Accessibility checking: InvocationTargetException is thrown instead of IllegalAccessError In-Reply-To: References: <143F40F0-557E-48EA-9207-0FF1880663DF@oracle.com> <5229F4B8.9000506@oracle.com> <64E60D4E-0829-4B23-9EE7-61AD28DB7E2F@oracle.com> <49B1A36F-6C45-4E92-80D2-FA6F80A238CB@oracle.com> <2F83E9C4-B28A-4385-8FFB-78F1313A931F@oracle.com> <6F0563F9-7A78-42C7-9296-53991C18D5CA@oracle.com> Message-ID: <31FAE0CA-5EDD-4014-AED9-27533E53307F@oracle.com> It looks good. I have three requests. Regarding this comment: + * See MethodSupplier.java to see how to produce these bytes. + * They encode that class, except that method m is private, not public. The recipe is incomplete, since it does not say which bits to tweak to make m private. Please add that step to the comments more explicitly, or if possible to the code (so bogusMethodSupplier is a clean copy of the od output). I suppose you could ask sed to change the byte for you. That will make this test a better example for future tests, and make it easier to maintain if javac output changes. The high road to use would be asm, although for a single byte tweak od works OK. Also, this bug has two twins. The same thing will happen with NoSuchMethodE* and NoSuchFieldE*. Can you please make fixes for those guys also? FTR, see MemberName.makeAccessException() for logic which maps the other way, from *Error to *Exception. I don't see a direct way to avoid the double mapping (Error=>Exception=>Error) when it occurs. For the initCause bit we should do this: } catch (IllegalAccessException ex) { Error err = new IllegalAccessError(ex.getMessage()); err.initCause(ex.getCause()); // reuse underlying cause of ex throw err; } ... and for NSME and NSFE... That way users can avoid the duplicate exception but can see any underlying causes that the JVM may include. Thanks for untangling this! ? John On Sep 12, 2013, at 12:17 PM, David Chase wrote: > The test is adapted from the test in the bug report. > The headline on the bug report is wrong -- because it uses reflection in the test to do the invocation, > the thrown exception is wrapped with InvocationTargetException, which is completely correct. > HOWEVER, the exception inside the wrapper is the wrong one. > > The new test checks the exception in both the reflective-invocation and plain-invocation cases, > and also checks both a method handle call (which threw the wrong exception) and a plain > call (which threw, and throws, the right exception). > > The test also uses a tweaked classloader to substitute the borked bytecodes necessary to get > the error, so it is not only shell-free, it can also be run outside jtreg. > > On 2013-09-12, at 2:34 PM, Christian Thalinger wrote: > >> >> On Sep 12, 2013, at 11:28 AM, David Chase wrote: >> >>> New webrev, commented line removed: >>> http://cr.openjdk.java.net/~drchase/8022701/webrev.03/ >> >> I think the change is good given that the tests work now. Is your test derived from the test in the bug report? >> >> And it would be good if John could also have a quick look (just be to be sure). >> >> -- Chris >> >>> >>> On 2013-09-12, at 1:53 PM, David Chase wrote: >>> >>>> I believe it produced extraneous output -- it was not clear to me that it was either necessary or useful to fully describe all the converted exceptions that lead to the defined exception being thrown. The commented line should have just been removed (I think). >>>> >>>> On 2013-09-12, at 1:24 PM, Christian Thalinger wrote: >>>> >>>>> + // err.initCause(ex); >>>>> >>>>> Why is this commented? >>>>> >>>>> -- Chris >>> >> > > _______________________________________________ > mlvm-dev mailing list > mlvm-dev at openjdk.java.net > http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev From john.r.rose at oracle.com Thu Sep 12 16:34:40 2013 From: john.r.rose at oracle.com (John Rose) Date: Thu, 12 Sep 2013 16:34:40 -0700 Subject: RFR (S) 8019417: JSR 292 javadoc should clarify method handle arity limits Message-ID: <0CEEB903-FBA5-41FE-B881-E79DD26947D3@oracle.com> Please review this change for a change to the JSR 292 implementation: http://cr.openjdk.java.net/~jrose/8019417/webrev.00 The change is to javadoc and unit tests, documenting and testing some corner cases of JSR 292 APIs. Since the RI is already correct, there are no implementation code changes. Thanks, ? John From christian.thalinger at oracle.com Thu Sep 12 17:17:22 2013 From: christian.thalinger at oracle.com (Christian Thalinger) Date: Thu, 12 Sep 2013 17:17:22 -0700 Subject: RFR (S) 8019417: JSR 292 javadoc should clarify method handle arity limits In-Reply-To: <0CEEB903-FBA5-41FE-B881-E79DD26947D3@oracle.com> References: <0CEEB903-FBA5-41FE-B881-E79DD26947D3@oracle.com> Message-ID: On Sep 12, 2013, at 4:34 PM, John Rose wrote: > Please review this change for a change to the JSR 292 implementation: > > http://cr.openjdk.java.net/~jrose/8019417/webrev.00 > > The change is to javadoc and unit tests, documenting and testing some corner cases of JSR 292 APIs. > > Since the RI is already correct, there are no implementation code changes. This looks good. The only thing that sounds odd is "very large arity": + * very large arity, -- Chris > > Thanks, > ? John > _______________________________________________ > mlvm-dev mailing list > mlvm-dev at openjdk.java.net > http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev From david.r.chase at oracle.com Thu Sep 12 17:44:19 2013 From: david.r.chase at oracle.com (David Chase) Date: Thu, 12 Sep 2013 20:44:19 -0400 Subject: RFR(S+M) / 8022701 Accessibility checking: InvocationTargetException is thrown instead of IllegalAccessError In-Reply-To: <31FAE0CA-5EDD-4014-AED9-27533E53307F@oracle.com> References: <143F40F0-557E-48EA-9207-0FF1880663DF@oracle.com> <5229F4B8.9000506@oracle.com> <64E60D4E-0829-4B23-9EE7-61AD28DB7E2F@oracle.com> <49B1A36F-6C45-4E92-80D2-FA6F80A238CB@oracle.com> <2F83E9C4-B28A-4385-8FFB-78F1313A931F@oracle.com> <6F0563F9-7A78-42C7-9296-53991C18D5CA@oracle.com> <31FAE0CA-5EDD-4014-AED9-27533E53307F@oracle.com> Message-ID: Do these sibling bugs have numbers? And I take it you would like to see 1) a test enhanced with ASM to do all 3 variants of this 2) DO attach the underlying cause David On 2013-09-12, at 5:35 PM, John Rose wrote: > It looks good. I have three requests. > > Regarding this comment: > + * See MethodSupplier.java to see how to produce these bytes. > + * They encode that class, except that method m is private, not public. > > The recipe is incomplete, since it does not say which bits to tweak to make m private. Please add that step to the comments more explicitly, or if possible to the code (so bogusMethodSupplier is a clean copy of the od output). I suppose you could ask sed to change the byte for you. That will make this test a better example for future tests, and make it easier to maintain if javac output changes. The high road to use would be asm, although for a single byte tweak od works OK. > > Also, this bug has two twins. The same thing will happen with NoSuchMethodE* and NoSuchFieldE*. Can you please make fixes for those guys also? > > FTR, see MemberName.makeAccessException() for logic which maps the other way, from *Error to *Exception. I don't see a direct way to avoid the double mapping (Error=>Exception=>Error) when it occurs. > > For the initCause bit we should do this: > > } catch (IllegalAccessException ex) { > Error err = new IllegalAccessError(ex.getMessage()); > err.initCause(ex.getCause()); // reuse underlying cause of ex > throw err; > } ... and for NSME and NSFE... > > That way users can avoid the duplicate exception but can see any underlying causes that the JVM may include. > > Thanks for untangling this! > > ? John > > On Sep 12, 2013, at 12:17 PM, David Chase wrote: > >> The test is adapted from the test in the bug report. >> The headline on the bug report is wrong -- because it uses reflection in the test to do the invocation, >> the thrown exception is wrapped with InvocationTargetException, which is completely correct. >> HOWEVER, the exception inside the wrapper is the wrong one. >> >> The new test checks the exception in both the reflective-invocation and plain-invocation cases, >> and also checks both a method handle call (which threw the wrong exception) and a plain >> call (which threw, and throws, the right exception). >> >> The test also uses a tweaked classloader to substitute the borked bytecodes necessary to get >> the error, so it is not only shell-free, it can also be run outside jtreg. >> >> On 2013-09-12, at 2:34 PM, Christian Thalinger wrote: >> >>> >>> On Sep 12, 2013, at 11:28 AM, David Chase wrote: >>> >>>> New webrev, commented line removed: >>>> http://cr.openjdk.java.net/~drchase/8022701/webrev.03/ >>> >>> I think the change is good given that the tests work now. Is your test derived from the test in the bug report? >>> >>> And it would be good if John could also have a quick look (just be to be sure). >>> >>> -- Chris >>> >>>> >>>> On 2013-09-12, at 1:53 PM, David Chase wrote: >>>> >>>>> I believe it produced extraneous output -- it was not clear to me that it was either necessary or useful to fully describe all the converted exceptions that lead to the defined exception being thrown. The commented line should have just been removed (I think). >>>>> >>>>> On 2013-09-12, at 1:24 PM, Christian Thalinger wrote: >>>>> >>>>>> + // err.initCause(ex); >>>>>> >>>>>> Why is this commented? >>>>>> >>>>>> -- Chris >>>> >>> >> >> _______________________________________________ >> mlvm-dev mailing list >> mlvm-dev at openjdk.java.net >> http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev > From john.r.rose at oracle.com Thu Sep 12 18:02:10 2013 From: john.r.rose at oracle.com (John Rose) Date: Thu, 12 Sep 2013 18:02:10 -0700 Subject: RFR (S) 8001109: arity mismatch on a call to spreader method handle should elicit IllegalArgumentException Message-ID: <74280088-19F3-4B0B-AC62-3332E9AED63A@oracle.com> Please review this change for a change to the JSR 292 implementation: http://cr.openjdk.java.net/~jrose/8001109/webrev.00/ The change is mostly to javadoc and unit tests, documenting and testing some corner cases of JSR 292 APIs. In the RI, the exception-raising code is simplified to throw just IAE. Thanks, ? John From john.r.rose at oracle.com Thu Sep 12 18:36:56 2013 From: john.r.rose at oracle.com (John Rose) Date: Thu, 12 Sep 2013 18:36:56 -0700 Subject: RFR (L) 8024761: JSR 292 improve performance of generic invocation Message-ID: <69A734BA-67A8-4BA2-9A8B-075E455327A3@oracle.com> Please review this change for a change to the JSR 292 implementation: http://cr.openjdk.java.net/~jrose/8024761/webrev.00/ Bug description: The performance of MethodHandle.invoke is very slow when the call site type differs from the method handle type. When the types differ, the invocation is defined to proceed as if two steps were taken: 1. the target method handle is first adjusted to the call site type, by MethodHandles.asType 2. the type-adjusted method handle is invoked directly, by MethodHandles.invokeExact The existing code (from JDK 7) awkwardly performs the type adjustment on every call. But performing the type analysis and adapter creation on every call is inherently slow. A good fix is to cache the result of step 1 (MethodHandles.asType), since step 2 is already reasonably fast. For most applications, a one-element cache on each individual method handle is a reasonable choice. It has the particular advantage of speeding up invocations of non-varargs bootstrap methods. To benefit from this, the bootstrap methods themselves need to be uniquified across multiple class files, so this work will also include a cache to benefit commonly-used bootstrap methods, such as JDK 8's LambdaMetafactory.metafactory. Additional caches could be based on the call site, the call site type, the target type, or the target's MH.form. Thanks, ? John P.S. Since this is an implementation change oriented toward performance, the review request is to mlvm-dev and hotspot-compiler-dev. Changes which are oriented toward functionality will go to mlvm-dev and core-libs-dev. From john.r.rose at oracle.com Thu Sep 12 18:47:18 2013 From: john.r.rose at oracle.com (John Rose) Date: Thu, 12 Sep 2013 18:47:18 -0700 Subject: RFR (S) 8001108: an attempt to use "" as a method name should elicit NoSuchMethodException Message-ID: <6FAC275C-6374-41F5-BAB7-CA1AC729EF9F@oracle.com> Please review this change for a change to the JSR 292 implementation: http://cr.openjdk.java.net/~jrose/8001108/webrev.00 Summary: add an explicit check for leading "<", upgrade the unit tests The change is mostly to javadoc and unit tests, documenting and testing some corner cases of JSR 292 APIs. In the RI, there is an explicit error check. Thanks, ? John P.S. Since this is a change which oriented toward JSR 292 functionality, the review request is to mlvm-dev and core-libs-dev. Changes which are oriented toward performance will go to mlvm-dev and hotspot-compiler-dev. From john.r.rose at oracle.com Thu Sep 12 19:24:04 2013 From: john.r.rose at oracle.com (John Rose) Date: Thu, 12 Sep 2013 19:24:04 -0700 Subject: RFR (S) 8024599: JSR 292 direct method handles need to respect initialization rules for static members Message-ID: <2A858714-7C1D-4A3D-B971-E193E1E256D3@oracle.com> Please review this change for a change to the JSR 292 implementation: http://cr.openjdk.java.net/~jrose/8024599/webrev.00/ Summary: Align MH semantic with bytecode behavior of constructor and static member accesses, regarding invocation. The change is to javadoc and unit tests, documenting and testing some corner cases of JSR 292 APIs. Bug Description: When using lookupStatic to create a direct method handle for a static method, class initialization needs to be specified to align with the underly bytecode behavior of the invokestatic instruction. The JDK8 and 7u40 implementations do this, but the specification claims that the call to lookupStatic itself performs class initialization. Although this may have been the behavior of early versions of JDK 7, it is an error. Detail: The javadoc headers to Lookup and MethodHandle state that method handles emulate bytecode behaviors. The most precise specification of this emulation is in the JVMS, 5.4.3.5: > Calling this method handle on a valid set of arguments has exactly the same effect and returns the same result (if any) as the corresponding bytecode behavior. Also the doc for the "invokevirtual" instruction says: > ...if the method handle to be invoked has bytecode behavior, the Java Virtual Machine invokes the method handle as if by execution of the bytecode behavior associated with the method handle's kind. And the doc for the "invokestatic" instruction describes the placement of the lazy class initialization: > On successful resolution of the method, the class that declared the resolved method is initialized (?5.5) if that class has not already been initialized. This puts the class initialization action near the border between resolution (link time) and execution (run time). The JDK 7 behavior acts as if the initialization action were part of resolution (link time), in that it claims to perform class initialization before the method handle is returned from findStatic (etc.). But on a closer reading of the JVMS, that is wrong. Note that errors (and presumably side effects) from class initialization are classified as runtime effects, not linktime effects: > Run-time Exceptions Otherwise, if execution of this invokestatic instruction causes initialization of the referenced class, invokestatic may throw an Error as detailed in ?5.5. In other words, the original JDK 7 specification of eager initalization poorly aligns with (poorly emulates) the bytecode behavior, contrary to the overall pronouncements of the JSR 292 specification. Compatibility risk for better alignment is small, since most users of JSR 292 create method handles lazily during BSM (i.e., invokedynamic bootstrap method) execution. It will not matter to them (except to reduce surprise due to semantic mislignment) if the initialization action is moved from the BSM to the first execution of the MH produced by the BSM. It appears that the at least one other implementation, the "JSR 292 Backport", performs static member class initialization on first execution of bytecode behavior, because it uses reflection and weaving of "*static" instructions. This is no accident: The coherence and usefulness of JSR 292 relies on close alignment of member access semantics among the various modes, direct bytecode execution and various old and new reflective APIs. Besides spec. coherence, a key problem with the "eager" class initialization (in findStatic) is usability. Eager class initialization is impossible to undo. It is also difficult to predict and avoid. Users who want it and don't have it can call Class.forName with an argument of 'true'. Users who don't want it and get it (in early JDK 7 and perhaps other systems) are out of luck. Thanks, ? John P.S. Since this is a change which oriented toward JSR 292 functionality, the review request is to mlvm-dev and core-libs-dev. Changes which are oriented toward performance will go to mlvm-dev and hotspot-compiler-dev. From john.r.rose at oracle.com Thu Sep 12 19:55:48 2013 From: john.r.rose at oracle.com (John Rose) Date: Thu, 12 Sep 2013 19:55:48 -0700 Subject: RFR (M) 8001110: method handles should have a collectArguments transform, generalizing asCollector Message-ID: <06D6C12B-CE7F-4180-8DD2-222B9CEE8CB8@oracle.com> Please review this change for a change to the JSR 292 implementation: http://cr.openjdk.java.net/~jrose/8001110/webrev.00/ Summary: promote an existing private method; make unit tests on all argument positions to arity 10 with mixed types The change is to javadoc and unit tests, documenting and testing some corner cases of JSR 292 APIs. Bug Description: Currently, a method handle can be transformed so that multiple arguments are collected and passed to the original method handle. However, the two routes to doing this are both limited to special purposes. (They are asCollector, which collects only trailing arguments, and only into an array; and foldArguments, which collects only leading arguments into filter function, and passes both the filtered result *and* the original arguments to the original.) MethodHandles.collectArguments(mh, pos, collector) should produce a method handle which acts like lambda(a*, b*, c*) { x = collector(b*); return mh(a*, x, c*) }, where the span of arguments b* is located by pos and the arity of the collector. There is internal machinery in any JSR 292 implementation to do this. It should be made available to users. This is a missing part of the JSR 292 spec. Thanks, ? John P.S. Since this is a change which oriented toward JSR 292 functionality, the review request is to mlvm-dev and core-libs-dev. Changes which are oriented toward performance will go to mlvm-dev and hotspot-compiler-dev. From john.r.rose at oracle.com Thu Sep 12 21:02:41 2013 From: john.r.rose at oracle.com (John Rose) Date: Thu, 12 Sep 2013 21:02:41 -0700 Subject: RFR(S+M) / 8022701 Accessibility checking: InvocationTargetException is thrown instead of IllegalAccessError In-Reply-To: References: <143F40F0-557E-48EA-9207-0FF1880663DF@oracle.com> <5229F4B8.9000506@oracle.com> <64E60D4E-0829-4B23-9EE7-61AD28DB7E2F@oracle.com> <49B1A36F-6C45-4E92-80D2-FA6F80A238CB@oracle.com> <2F83E9C4-B28A-4385-8FFB-78F1313A931F@oracle.com> <6F0563F9-7A78-42C7-9296-53991C18D5CA@oracle.com> <31FAE0CA-5EDD-4014-AED9-27533E53307F@oracle.com> Message-ID: <9092C3F3-EA5A-4748-BD67-0423F1B8964E@oracle.com> On Sep 12, 2013, at 5:44 PM, David Chase wrote: > Do these sibling bugs have numbers? Yes, 8022701. I just updated the bug to explain their common genesis. > And I take it you would like to see > > 1) a test enhanced with ASM to do all 3 variants of this Yes, please. The case of "no such field" does not have a direct cause from lambda expressions AFAIK, but it can occur with "raw" CONSTANT_MethodHandles. (It would be reasonable for javac to emit CONSTANT_MH's for fields in some very limited circumstances, but I'll bet it doesn't.) > 2) DO attach the underlying cause Yes. Read the javadoc for ExceptionInInitializerError for an example of why users want the underlying cause for linkage errors. (Golly, I wonder what happens if resolution of a CONSTANT_MethodHandle tries to touch a class with a booby-trapped . I hope it's the case that the ExceptionInInitializerError just passes straight up the stack. But if it were to get wrapped in a ROE of some sort, it would probably bubble up as an IAE. Could be a charming exploration. Actually, no, I don't want to go in there. Getting all possible linkage errors correct is fine, but we have more important things to do.) ? John > David > > On 2013-09-12, at 5:35 PM, John Rose wrote: > >> It looks good. I have three requests. >> >> Regarding this comment: >> + * See MethodSupplier.java to see how to produce these bytes. >> + * They encode that class, except that method m is private, not public. >> >> The recipe is incomplete, since it does not say which bits to tweak to make m private. Please add that step to the comments more explicitly, or if possible to the code (so bogusMethodSupplier is a clean copy of the od output). I suppose you could ask sed to change the byte for you. That will make this test a better example for future tests, and make it easier to maintain if javac output changes. The high road to use would be asm, although for a single byte tweak od works OK. >> >> Also, this bug has two twins. The same thing will happen with NoSuchMethodE* and NoSuchFieldE*. Can you please make fixes for those guys also? >> >> FTR, see MemberName.makeAccessException() for logic which maps the other way, from *Error to *Exception. I don't see a direct way to avoid the double mapping (Error=>Exception=>Error) when it occurs. >> >> For the initCause bit we should do this: >> >> } catch (IllegalAccessException ex) { >> Error err = new IllegalAccessError(ex.getMessage()); >> err.initCause(ex.getCause()); // reuse underlying cause of ex >> throw err; >> } ... and for NSME and NSFE... >> >> That way users can avoid the duplicate exception but can see any underlying causes that the JVM may include. >> >> Thanks for untangling this! >> >> ? John >> >> On Sep 12, 2013, at 12:17 PM, David Chase wrote: >> >>> The test is adapted from the test in the bug report. >>> The headline on the bug report is wrong -- because it uses reflection in the test to do the invocation, >>> the thrown exception is wrapped with InvocationTargetException, which is completely correct. >>> HOWEVER, the exception inside the wrapper is the wrong one. >>> >>> The new test checks the exception in both the reflective-invocation and plain-invocation cases, >>> and also checks both a method handle call (which threw the wrong exception) and a plain >>> call (which threw, and throws, the right exception). >>> >>> The test also uses a tweaked classloader to substitute the borked bytecodes necessary to get >>> the error, so it is not only shell-free, it can also be run outside jtreg. >>> >>> On 2013-09-12, at 2:34 PM, Christian Thalinger wrote: >>> >>>> >>>> On Sep 12, 2013, at 11:28 AM, David Chase wrote: >>>> >>>>> New webrev, commented line removed: >>>>> http://cr.openjdk.java.net/~drchase/8022701/webrev.03/ >>>> >>>> I think the change is good given that the tests work now. Is your test derived from the test in the bug report? >>>> >>>> And it would be good if John could also have a quick look (just be to be sure). >>>> >>>> -- Chris >>>> >>>>> >>>>> On 2013-09-12, at 1:53 PM, David Chase wrote: >>>>> >>>>>> I believe it produced extraneous output -- it was not clear to me that it was either necessary or useful to fully describe all the converted exceptions that lead to the defined exception being thrown. The commented line should have just been removed (I think). >>>>>> >>>>>> On 2013-09-12, at 1:24 PM, Christian Thalinger wrote: >>>>>> >>>>>>> + // err.initCause(ex); >>>>>>> >>>>>>> Why is this commented? >>>>>>> >>>>>>> -- Chris >>>>> >>>> >>> >>> _______________________________________________ >>> mlvm-dev mailing list >>> mlvm-dev at openjdk.java.net >>> http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev >> > From john.r.rose at oracle.com Thu Sep 12 22:06:50 2013 From: john.r.rose at oracle.com (John Rose) Date: Thu, 12 Sep 2013 22:06:50 -0700 Subject: additional JSR 292 review resources Message-ID: P.S. To see the proposed JSR 292 spec changes only (no code, rendered javadoc), see: http://cr.openjdk.java.net/~jrose/pres/201309-jsr292/1-specdiff-meth-info-8008688 http://cr.openjdk.java.net/~jrose/pres/201309-jsr292/2-specdiff-meth-arity-8019417 http://cr.openjdk.java.net/~jrose/pres/201309-jsr292/3-specdiff-meth-spr-8001109 http://cr.openjdk.java.net/~jrose/pres/201309-jsr292/4-specdiff-meth-nsme-8001108 http://cr.openjdk.java.net/~jrose/pres/201309-jsr292/5-specdiff-meth-clinit-8024599 http://cr.openjdk.java.net/~jrose/pres/201309-jsr292/6-specdiff-meth-coll-8001110 http://cr.openjdk.java.net/~jrose/pres/201309-jsr292/7-specdiff-meth-mr-8024438 (The code changes for the last one, 8024438, are not yet ready to review.) -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.openjdk.java.net/pipermail/mlvm-dev/attachments/20130912/26458135/attachment.html From headius at headius.com Fri Sep 13 15:57:25 2013 From: headius at headius.com (Charles Oliver Nutter) Date: Sat, 14 Sep 2013 00:57:25 +0200 Subject: Reproducible InternalError in lambda stuff In-Reply-To: <6810AEF1-95BD-4466-91DB-6872D4AFFE14@oracle.com> References: <6810AEF1-95BD-4466-91DB-6872D4AFFE14@oracle.com> Message-ID: I do not...but it appears to be tied to getting an OOM when inside lambda code. We now have a third-party report of the same issue. Because the internal error appears to nuke the original exception, we don't know for sure that this is memory-related, but the user did see *other* threads raise OOM and increasing memory solved it. https://github.com/jruby/jruby/issues/1014 So...there's two things that are bad things here... * More memory required when running with indy versus without, all other things kept constant (reproduced by two people, one of them me) * InternalError bubbling out and swallowing the cause (reproduced by the same two people)...this may count as two issues. My original reproduction did not appear to fire on Java 8, but it also appeared to run forever...so it's possible that we were at a specific memory threshold (permgen? normal heap? meatspace?) or Java 8 may be failing more gracefully. Feel free to discuss or offer suggestions to Alex on the bug report above. I will be monitoring. - Charlie On Mon, Sep 9, 2013 at 6:21 PM, Christian Thalinger wrote: > > On Sep 6, 2013, at 11:11 PM, Charles Oliver Nutter wrote: > >> I can reproduce this by running a fairly normalish command in JRuby: >> >> (Java::JavaLang::InternalError) >> guard=Lambda(a0:L,a1:L,a2:L,a3:L,a4:L)=>{ >> t5:I=MethodHandle(ThreadContext,IRubyObject,IRubyObject,IRubyObject)boolean(a1:L,a2:L,a3:L,a4:L); >> t6:L=MethodHandleImpl.selectAlternative(t5:I,(MethodHandle(ThreadContext,IRubyObject,IRubyObject,IRubyObject)IRubyObject),(MethodHandle(ThreadContext,IRubyObject,IRubyObject,IRubyObject)IRubyObject)); >> t7:L=MethodHandle.invokeBasic(t6:L,a1:L,a2:L,a3:L,a4:L);t7:L} >> >> I think it's happening at an OutOfMemory event (bumping up memory >> makes it go away), so it may not be a critical issue, but I thought >> I'd toss it out here. > > Do know where it's coming from? -- Chris > >> >> - Charlie >> _______________________________________________ >> mlvm-dev mailing list >> mlvm-dev at openjdk.java.net >> http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev > > _______________________________________________ > mlvm-dev mailing list > mlvm-dev at openjdk.java.net > http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev From headius at headius.com Fri Sep 13 15:59:28 2013 From: headius at headius.com (Charles Oliver Nutter) Date: Sat, 14 Sep 2013 00:59:28 +0200 Subject: Reproducible InternalError in lambda stuff In-Reply-To: References: <6810AEF1-95BD-4466-91DB-6872D4AFFE14@oracle.com> Message-ID: On Sat, Sep 14, 2013 at 12:57 AM, Charles Oliver Nutter wrote: > * More memory required when running with indy versus without, all > other things kept constant (reproduced by two people, one of them me) I should say *significantly more* memory here. The app Alex was running had to go from 1GB heap / 256MB permgen to 2G/512M when it was running *fine* before...and this is just for running the *tests*. - Charlie From john.r.rose at oracle.com Fri Sep 13 16:52:38 2013 From: john.r.rose at oracle.com (John Rose) Date: Fri, 13 Sep 2013 16:52:38 -0700 Subject: Reproducible InternalError in lambda stuff In-Reply-To: References: <6810AEF1-95BD-4466-91DB-6872D4AFFE14@oracle.com> Message-ID: <80F60E34-AB0A-4861-9D77-DE143AD1D508@oracle.com> I've been working on footprint all August. Will post a patch to mlvm this weekend to see if it helps. -- John (on my iPhone) On Sep 13, 2013, at 3:59 PM, Charles Oliver Nutter wrote: > On Sat, Sep 14, 2013 at 12:57 AM, Charles Oliver Nutter > wrote: >> * More memory required when running with indy versus without, all >> other things kept constant (reproduced by two people, one of them me) > > I should say *significantly more* memory here. The app Alex was > running had to go from 1GB heap / 256MB permgen to 2G/512M when it was > running *fine* before...and this is just for running the *tests*. > > - Charlie > _______________________________________________ > mlvm-dev mailing list > mlvm-dev at openjdk.java.net > http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev From john.r.rose at oracle.com Fri Sep 13 22:40:57 2013 From: john.r.rose at oracle.com (john.r.rose at oracle.com) Date: Sat, 14 Sep 2013 05:40:57 +0000 Subject: hg: mlvm/mlvm/hotspot: move old files aside Message-ID: <20130914054058.B824862824@hg.openjdk.java.net> Changeset: 09506d69c8cb Author: jrose Date: 2013-08-13 00:50 -0700 URL: http://hg.openjdk.java.net/mlvm/mlvm/hotspot/rev/09506d69c8cb move old files aside - .hgignore - annot.txt - anonk.patch - anonk.txt - asm/asm-jsr292-bsm.patch - asm/asm-jsr292-ldc.patch - dynopt-6912064.patch - indy-bsm-7001379.patch - indy-notrans-6981791.patch - indy.txt - jdk7-b147-to-bsd-port.patch - meth-bsme-7049415.patch - meth-ci-7009600.patch - meth-enable-6817525.patch - meth-err-7012087.patch - meth-impl-6839872.patch - meth-ing-7049410.patch - meth-lazy-7023639.jit.patch - meth-lazy.txt - meth-mhw-7047961.patch - meth-rename-7012648.patch - meth-ver-6987991.patch - meth.txt - nonperm.txt + old/.hgignore + old/annot.txt + old/anonk.patch + old/anonk.txt + old/asm-jsr292-bsm.patch + old/asm-jsr292-ldc.patch - old/cpindex-6939207.patch - old/cpindex-6956164.patch - old/cpindex-6957004.patch - old/cpindex-6957080.patch - old/cpindex-6981788.patch - old/cpindex-oopmap.patch - old/deopt-mh-6921352.patch - old/disassembler-6912062.patch - old/dont-fixup-6921799.patch + old/dynopt-6912064.patch - old/fix-oop-relocs-6940520.patch - old/indy-6655646.patch - old/indy-6858164.patch - old/indy-amd64-6829192.patch - old/indy-args-6984311.patch - old/indy-args-6996563.patch - old/indy-bsm-6964498.patch + old/indy-bsm-7001379.patch - old/indy-c1-sparc-6930772.patch - old/indy-c1-x86-6919934.patch - old/indy-c2-sparc-6934104.patch - old/indy-cleanup-6893081.patch - old/indy-deopt-6969574.patch + old/indy-notrans-6981791.patch - old/indy-sparc-6829193.patch - old/indy.compiler-6829187.patch - old/indy.compiler.inline-6893268.patch - old/indy.compiler.pkgtest.patch + old/indy.txt - old/inlines-6912063.patch + old/jdk7-b147-to-bsd-port.patch - old/meth-6655638.patch - old/meth-6815692.patch - old/meth-api-6981777.patch - old/meth-asm-6812678.patch - old/meth-bcon-nary.patch - old/meth-bcp-6939196.patch + old/meth-bsme-7049415.patch + old/meth-ci-7009600.patch + old/meth-enable-6817525.patch + old/meth-err-7012087.patch - old/meth-ilookup-6812831.patch + old/meth-impl-6839872.patch - old/meth-ing-6939134.patch - old/meth-ing-6939224.patch - old/meth-ing-6994093.patch + old/meth-ing-7049410.patch + old/meth-lazy-7023639.jit.patch + old/meth-lazy.txt - old/meth-ldc-6939203.patch - old/meth-ldc-6960865.patch + old/meth-mhw-7047961.patch - old/meth-minor-6814659.patch + old/meth-rename-7012648.patch - old/meth-subtype-6813212.patch + old/meth-ver-6987991.patch - old/meth.fixes.patch + old/meth.txt - old/meth.walker-6894206.patch - old/meth.walker.fixes-6914206.patch + old/nonperm.txt - old/oops-7028374.patch - old/post-6939930-adjust.patch - old/reset-thread-mh-flag-6941529.patch - old/trustfinal-6912065.patch From john.r.rose at oracle.com Fri Sep 13 22:46:30 2013 From: john.r.rose at oracle.com (john.r.rose at oracle.com) Date: Sat, 14 Sep 2013 05:46:30 +0000 Subject: hg: mlvm/mlvm/hotspot: rebase to current hsx/hotspot-comp Message-ID: <20130914054630.5215362825@hg.openjdk.java.net> Changeset: 3e126536de3f Author: jrose Date: 2013-09-13 22:46 -0700 URL: http://hg.openjdk.java.net/mlvm/mlvm/hotspot/rev/3e126536de3f rebase to current hsx/hotspot-comp ! coro-simple.patch ! series From john.r.rose at oracle.com Fri Sep 13 22:50:32 2013 From: john.r.rose at oracle.com (john.r.rose at oracle.com) Date: Sat, 14 Sep 2013 05:50:32 +0000 Subject: hg: mlvm/mlvm/jdk: update JDK 8 JSR 292 specs Message-ID: <20130914055032.A693762827@hg.openjdk.java.net> Changeset: 383cbcabff6f Author: jrose Date: 2013-09-13 22:50 -0700 URL: http://hg.openjdk.java.net/mlvm/mlvm/jdk/rev/383cbcabff6f update JDK 8 JSR 292 specs + indy-bsm-8024761.patch + meth-clinit-8024599.patch + meth-coll-8001110.patch + meth-mr-8024438.patch + meth-nsme-8001108.patch + meth-spr-8001109.patch From john.r.rose at oracle.com Fri Sep 13 22:49:43 2013 From: john.r.rose at oracle.com (john.r.rose at oracle.com) Date: Sat, 14 Sep 2013 05:49:43 +0000 Subject: hg: mlvm/mlvm/jdk: 2 new changesets Message-ID: <20130914054944.F289862826@hg.openjdk.java.net> Changeset: 1a78d97d1283 Author: jrose Date: 2013-08-13 12:54 -0700 URL: http://hg.openjdk.java.net/mlvm/mlvm/jdk/rev/1a78d97d1283 move old files aside - anonk-6829144.patch - bsd.patch - cval-7019529.patch - indy-6829144.patch - indy-6829144.verify.patch - indy-6839802.patch - indy-6839839.patch - indy-6914665.patch - indy-bsm-6964498.patch - indy-bsm-7001379.patch - indy-bsm-postjdk7.patch - indy-test-7001423.patch - indy.pack.patch - indy.pack.patch.html - indy.patch - meth-6829144.patch - meth-api-6981777.patch - meth-api-7001424.patch - meth-api-7012650.patch - meth-argcount-6983728.patch - meth-bcp-6939196.patch - meth-bsme-7049415.patch - meth-cval-6982752.patch - meth-deprecate.patch - meth-edrfix-6979327.patch - meth-enable-6817525.patch - meth-exc-7044892.txt - meth-hackdirect.patch - meth-heap-7049122.patch - meth-impl-6839872.patch - meth-ing-6939134.patch - meth-ing-6939224.patch - meth-int-7054590.patch - meth-int-7058630.patch - meth-lang-7016520.patch - meth-ldc-6939203.patch - meth-lookup-6980096.patch - meth-proxy-6953246.patch - meth-refex-7013730.patch - meth-rename-7012648.patch - meth-review-7032323.patch - meth-review-7032323.txt - meth-ser-7016261.patch - meth-smgr-7014755.patch - meth-smgr-7050328.patch - meth-spt-7051206.patch - meth-test-7058651.patch - meth-va-7013417.patch - meth.test.patch + old/anonk-6829144.patch + old/bsd.patch + old/cval-7019529.patch + old/indy-6829144.patch + old/indy-6829144.verify.patch + old/indy-6839802.patch + old/indy-6839839.patch + old/indy-6914665.patch + old/indy-bsm-6964498.patch + old/indy-bsm-7001379.patch + old/indy-bsm-postjdk7.patch + old/indy-test-7001423.patch + old/indy.pack.patch + old/indy.pack.patch.html + old/indy.patch + old/meth-6829144.patch + old/meth-api-6981777.patch + old/meth-api-7001424.patch + old/meth-api-7012650.patch + old/meth-argcount-6983728.patch + old/meth-bcp-6939196.patch + old/meth-bsme-7049415.patch + old/meth-cval-6982752.patch + old/meth-deprecate.patch + old/meth-edrfix-6979327.patch + old/meth-enable-6817525.patch + old/meth-exc-7044892.txt + old/meth-hackdirect.patch + old/meth-heap-7049122.patch + old/meth-impl-6839872.patch + old/meth-ing-6939134.patch + old/meth-ing-6939224.patch + old/meth-int-7054590.patch + old/meth-int-7058630.patch + old/meth-lang-7016520.patch + old/meth-ldc-6939203.patch + old/meth-lookup-6980096.patch + old/meth-proxy-6953246.patch + old/meth-refex-7013730.patch + old/meth-rename-7012648.patch + old/meth-review-7032323.patch + old/meth-review-7032323.txt + old/meth-ser-7016261.patch + old/meth-smgr-7014755.patch + old/meth-smgr-7050328.patch + old/meth-spt-7051206.patch + old/meth-test-7058651.patch + old/meth-va-7013417.patch + old/meth.test.patch + old/regtest-6891770.patch - regtest-6891770.patch Changeset: 58550230addb Author: jrose Date: 2013-09-13 22:49 -0700 URL: http://hg.openjdk.java.net/mlvm/mlvm/jdk/rev/58550230addb rebase to current hsx/hotspot-comp; temporarily import tl fixes - meth-7177472.patch ! meth-aclone-8001105.patch ! meth-arity-8019417.patch ! meth-doc-8014634.patch - meth-info-8008688.patch ! meth.patch + old/meth-7177472.patch ! series + tl-fixes.1.patch + tl-fixes.2.patch + tl-fixes.3.patch From david.r.chase at oracle.com Sat Sep 14 06:07:15 2013 From: david.r.chase at oracle.com (David Chase) Date: Sat, 14 Sep 2013 09:07:15 -0400 Subject: Reproducible InternalError in lambda stuff In-Reply-To: References: <6810AEF1-95BD-4466-91DB-6872D4AFFE14@oracle.com> Message-ID: <4F08B910-2A43-4202-9F69-69732995D9CB@oracle.com> I am not sure, but it seemed like "something" bad floated into jdk8 for a little while, and then floated back out again. I haven't kept close enough track of the gc-dev mailing list, but for a few days I was frequently running out of memory when I had not been before (i.e., doing a build, or simply initializing some of the internal tests) -- this on a machine where when I checked, at least 4G was free for the taking. Something happened, and the problems went away. On 2013-09-13, at 6:59 PM, Charles Oliver Nutter wrote: > On Sat, Sep 14, 2013 at 12:57 AM, Charles Oliver Nutter > wrote: >> * More memory required when running with indy versus without, all >> other things kept constant (reproduced by two people, one of them me) > > I should say *significantly more* memory here. The app Alex was > running had to go from 1GB heap / 256MB permgen to 2G/512M when it was > running *fine* before...and this is just for running the *tests*. > > - Charlie > _______________________________________________ > mlvm-dev mailing list > mlvm-dev at openjdk.java.net > http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 163 bytes Desc: Message signed with OpenPGP using GPGMail Url : http://mail.openjdk.java.net/pipermail/mlvm-dev/attachments/20130914/e2868d22/signature-0001.asc From duncan.macgregor at ge.com Sat Sep 14 10:42:57 2013 From: duncan.macgregor at ge.com (MacGregor, Duncan (GE Energy Management)) Date: Sat, 14 Sep 2013 17:42:57 +0000 Subject: Reproducible InternalError in lambda stuff In-Reply-To: Message-ID: I've been trying our app/language runtime on 7u40 and we're seeing a similar increase needed in PermGen, and some increase needed to heap memory. Seem to have taken about a 10% performance hit on large application benchmarks as well, but I'd need to do some more runs to be really sure of that. On 13/09/2013 23:59, "Charles Oliver Nutter" wrote: >On Sat, Sep 14, 2013 at 12:57 AM, Charles Oliver Nutter > wrote: >> * More memory required when running with indy versus without, all >> other things kept constant (reproduced by two people, one of them me) > >I should say *significantly more* memory here. The app Alex was >running had to go from 1GB heap / 256MB permgen to 2G/512M when it was >running *fine* before...and this is just for running the *tests*. > >- Charlie >_______________________________________________ >mlvm-dev mailing list >mlvm-dev at openjdk.java.net >http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev From headius at headius.com Sat Sep 14 12:55:34 2013 From: headius at headius.com (Charles Oliver Nutter) Date: Sat, 14 Sep 2013 14:55:34 -0500 Subject: Reproducible InternalError in lambda stuff In-Reply-To: <4F08B910-2A43-4202-9F69-69732995D9CB@oracle.com> References: <6810AEF1-95BD-4466-91DB-6872D4AFFE14@oracle.com> <4F08B910-2A43-4202-9F69-69732995D9CB@oracle.com> Message-ID: We are getting many reports of memory issues under u40 running appear with indy support. Some seem to go away with bigger heaps, but others are still eventually failing. This is a very high priority for us because we had hoped to release JRuby 1.7.5 with indy enabled (finally) and that may not be possible. On Sep 14, 2013 3:07 PM, "David Chase" wrote: > I am not sure, but it seemed like "something" bad floated into jdk8 for a > little while, and then floated back out again. > I haven't kept close enough track of the gc-dev mailing list, but for a > few days I was frequently running out of memory when I had not been before > (i.e., doing a build, or simply initializing some of the internal tests) -- > this on a machine where when I checked, at least 4G was free for the taking. > > Something happened, and the problems went away. > > On 2013-09-13, at 6:59 PM, Charles Oliver Nutter > wrote: > > > On Sat, Sep 14, 2013 at 12:57 AM, Charles Oliver Nutter > > wrote: > >> * More memory required when running with indy versus without, all > >> other things kept constant (reproduced by two people, one of them me) > > > > I should say *significantly more* memory here. The app Alex was > > running had to go from 1GB heap / 256MB permgen to 2G/512M when it was > > running *fine* before...and this is just for running the *tests*. > > > > - Charlie > > _______________________________________________ > > mlvm-dev mailing list > > mlvm-dev at openjdk.java.net > > http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev > > > _______________________________________________ > mlvm-dev mailing list > mlvm-dev at openjdk.java.net > http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.openjdk.java.net/pipermail/mlvm-dev/attachments/20130914/554cd0d2/attachment.html From john.r.rose at oracle.com Sat Sep 14 16:44:14 2013 From: john.r.rose at oracle.com (John Rose) Date: Sat, 14 Sep 2013 16:44:14 -0700 Subject: RFR: 8022749: Convert junit tests to testng in test/java/lang/invoke In-Reply-To: <5208A80C.6030002@oracle.com> References: <5205887D.9070204@oracle.com> <5208A80C.6030002@oracle.com> Message-ID: <27686295-ED46-4F7E-B62F-E50FF3B6F434@oracle.com> Thanks for the heads up. I noticed this just now; after refreshing my repos half of the tests fail. Where is the doc that says how to run jtreg and ant (Netbeans) now that my tests have been changed for me? ? John On Aug 12, 2013, at 2:17 AM, Alan Bateman wrote: > On 10/08/2013 01:25, Henry Jen wrote: >> Hi, >> >> Please review a webrev contributed by Mani Sarkar that converts junit >> tests in test/java/lang/invoke to testng. >> >> http://cr.openjdk.java.net/~henryjen/tl/8022749/0/webrev/ >> >> Cheers, >> Henry > This looks good to me (but cc'ing mlvm-dev so that John/Christian/others > that might run these tests interactively are aware of this). > > -Alan. > _______________________________________________ > mlvm-dev mailing list > mlvm-dev at openjdk.java.net > http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev From john.r.rose at oracle.com Sat Sep 14 19:59:15 2013 From: john.r.rose at oracle.com (john.r.rose at oracle.com) Date: Sun, 15 Sep 2013 02:59:15 +0000 Subject: hg: mlvm/mlvm/jdk: meth: temporarily remove testng conversion Message-ID: <20130915025916.3E0496283E@hg.openjdk.java.net> Changeset: 27753ae4c64a Author: jrose Date: 2013-09-14 19:59 -0700 URL: http://hg.openjdk.java.net/mlvm/mlvm/jdk/rev/27753ae4c64a meth: temporarily remove testng conversion ! meth-nsme-8001108.patch ! series + testng-anti-diff.patch From john.r.rose at oracle.com Sun Sep 15 17:15:18 2013 From: john.r.rose at oracle.com (john.r.rose at oracle.com) Date: Mon, 16 Sep 2013 00:15:18 +0000 Subject: hg: mlvm/mlvm/jdk: meth-count: debugging counters; meth-lfc: lambda form caching; relabel/reorder series file Message-ID: <20130916001519.4312762859@hg.openjdk.java.net> Changeset: 393962c8f84e Author: jrose Date: 2013-09-15 17:15 -0700 URL: http://hg.openjdk.java.net/mlvm/mlvm/jdk/rev/393962c8f84e meth-count: debugging counters; meth-lfc: lambda form caching; relabel/reorder series file + meth-counts.patch + meth-lfc.patch ! series From john.r.rose at oracle.com Sun Sep 15 17:36:05 2013 From: john.r.rose at oracle.com (John Rose) Date: Sun, 15 Sep 2013 17:36:05 -0700 Subject: Reproducible InternalError in lambda stuff In-Reply-To: References: <6810AEF1-95BD-4466-91DB-6872D4AFFE14@oracle.com> <4F08B910-2A43-4202-9F69-69732995D9CB@oracle.com> Message-ID: <7804D506-A43C-446E-8C60-0FCFE2564815@oracle.com> On Sep 14, 2013, at 12:55 PM, Charles Oliver Nutter wrote: > We are getting many reports of memory issues under u40 running appear with indy support. Some seem to go away with bigger heaps, but others are still eventually failing. This is a very high priority for us because we had hoped to release JRuby 1.7.5 with indy enabled (finally) and that may not be possible. > I have refreshed mlvm-dev and pushed some patches to it which may address this problem. If you have time, please give them a try. Do "hg qgoto meth-lfc.patch". If this stuff helps we would like to work towards a fix in 7u. What is your time frame for JRuby 1.7.5? ? John -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.openjdk.java.net/pipermail/mlvm-dev/attachments/20130915/9f8cf162/attachment.html From headius at headius.com Mon Sep 16 02:59:41 2013 From: headius at headius.com (Charles Oliver Nutter) Date: Mon, 16 Sep 2013 11:59:41 +0200 Subject: Reproducible InternalError in lambda stuff In-Reply-To: <7804D506-A43C-446E-8C60-0FCFE2564815@oracle.com> References: <6810AEF1-95BD-4466-91DB-6872D4AFFE14@oracle.com> <4F08B910-2A43-4202-9F69-69732995D9CB@oracle.com> <7804D506-A43C-446E-8C60-0FCFE2564815@oracle.com> Message-ID: On Mon, Sep 16, 2013 at 2:36 AM, John Rose wrote: > I have refreshed mlvm-dev and pushed some patches to it which may address > this problem. I'll get a build put together and see if I can get users to test it. > If you have time, please give them a try. Do "hg qgoto meth-lfc.patch". > > If this stuff helps we would like to work towards a fix in 7u. > > What is your time frame for JRuby 1.7.5? It is on hold indefinitely while we work out user-reported issues (most are not 7u40-related, but we'd like to have an answer for those before release too). I've attached one user's hs_err dump. This was with a 4GB heap. Code cache full and failing spectacularly? - Charlie -------------- next part -------------- A non-text attachment was scrubbed... Name: hs_err_pid1184.log Type: application/octet-stream Size: 34773 bytes Desc: not available Url : http://mail.openjdk.java.net/pipermail/mlvm-dev/attachments/20130916/f241f0d4/hs_err_pid1184-0001.log From headius at headius.com Wed Sep 18 01:39:38 2013 From: headius at headius.com (Charles Oliver Nutter) Date: Wed, 18 Sep 2013 10:39:38 +0200 Subject: Interpreting Mission Control numbers for indy Message-ID: I've been playing with JMC a bit tonight, running a user's application that's about 2x slower using indy than using trivial monomorphic caches (and no indy call sites). I'm trying to understand how to interpret what I see. In the Code/Overview results, where it lists "hot packages", the #1 and #2 packages are java.lang.invoke.LambdaForm$MH and DMH, accounting for over 37% of samples. That sounds high, but I'm willing to grant they're hit pretty hard for a fully dynamic application. Results in the "Hot Methods" tab show similar things, like LambdaForm...invokeStatic_LL_L as the number one result and LambdaForm entries dominating the top 50 entries in the profile. Again, I know I'm hitting dynamic call sites hard and sampling is not always accurate. If I look at compilation events, I only see a handful of LambdaForm...convert being compiled. I'm not sure if that's good or bad. My assumption is that LFs don't show up here because they're always being inlined into a caller. The performance numbers for the app have me worried too. If I run JRuby with stock settings, we will chain up to 6 call targets at a call site. The lower I drop this number, the better performance gets; when I drop all the way to zero, forcing all invokedynamic call sites to fail over immediately to a monomorphic inline cache, performance *almost* gets back to the non-indy implementation. This leads me to believe that the less I use invokedynamic (or the fewer LFs involved), the better. That doesn't bode well. I believe the user would be happy to allow me to make these JMC recordings available, and I'm happy to re-run with additional events or gather other information. The JRuby community has a number of very large applications that push the limits of indy. We should work together to improve it. - Charlie From headius at headius.com Wed Sep 18 01:46:32 2013 From: headius at headius.com (Charles Oliver Nutter) Date: Wed, 18 Sep 2013 10:46:32 +0200 Subject: Interpreting Mission Control numbers for indy In-Reply-To: References: Message-ID: A bit more on performance numbers for this application. With no indy, monomorphic caches...the full application (a data load) runs in about a minute. I fully recognize that this is a short run, but JMC seems to indicate the bulk of code has compiled well before the halfway point. With 7u40 or 8, no tiered compilation, it takes about two minutes. Tiered reduces non-indy time to 51s and indy time to 1m29s Tiered + indy + only using monomorphic cache (no direct binding) runs in 1m, still 9s slower than non-indy. With normal settings, indy call sites do settle down and are mostly monomorphic For the two phases of the data load, I stop seeing JRuby bind indy call sites a couple seconds in. There does not appear to be any difference in performance on this app between 7u40 and 8b103. Like I say...I think the user would be willing to share the application, and I feel like the numbers warrant investigation. Standing by! :-) - Charlie On Wed, Sep 18, 2013 at 10:39 AM, Charles Oliver Nutter wrote: > I've been playing with JMC a bit tonight, running a user's application > that's about 2x slower using indy than using trivial monomorphic > caches (and no indy call sites). I'm trying to understand how to > interpret what I see. > > In the Code/Overview results, where it lists "hot packages", the #1 > and #2 packages are java.lang.invoke.LambdaForm$MH and DMH, accounting > for over 37% of samples. That sounds high, but I'm willing to grant > they're hit pretty hard for a fully dynamic application. > > Results in the "Hot Methods" tab show similar things, like > LambdaForm...invokeStatic_LL_L as the number one result and LambdaForm > entries dominating the top 50 entries in the profile. Again, I know > I'm hitting dynamic call sites hard and sampling is not always > accurate. > > If I look at compilation events, I only see a handful of > LambdaForm...convert being compiled. I'm not sure if that's good or > bad. My assumption is that LFs don't show up here because they're > always being inlined into a caller. > > The performance numbers for the app have me worried too. If I run > JRuby with stock settings, we will chain up to 6 call targets at a > call site. The lower I drop this number, the better performance gets; > when I drop all the way to zero, forcing all invokedynamic call sites > to fail over immediately to a monomorphic inline cache, performance > *almost* gets back to the non-indy implementation. This leads me to > believe that the less I use invokedynamic (or the fewer LFs involved), > the better. That doesn't bode well. > > I believe the user would be happy to allow me to make these JMC > recordings available, and I'm happy to re-run with additional events > or gather other information. The JRuby community has a number of very > large applications that push the limits of indy. We should work > together to improve it. > > - Charlie From christian.thalinger at oracle.com Wed Sep 18 12:45:57 2013 From: christian.thalinger at oracle.com (Christian Thalinger) Date: Wed, 18 Sep 2013 12:45:57 -0700 Subject: Reproducible InternalError in lambda stuff In-Reply-To: References: <6810AEF1-95BD-4466-91DB-6872D4AFFE14@oracle.com> <4F08B910-2A43-4202-9F69-69732995D9CB@oracle.com> <7804D506-A43C-446E-8C60-0FCFE2564815@oracle.com> Message-ID: <86C3B1BC-E59A-46DD-BE3E-591B319FAA51@oracle.com> On Sep 16, 2013, at 2:59 AM, Charles Oliver Nutter wrote: > On Mon, Sep 16, 2013 at 2:36 AM, John Rose wrote: >> I have refreshed mlvm-dev and pushed some patches to it which may address >> this problem. > > I'll get a build put together and see if I can get users to test it. > >> If you have time, please give them a try. Do "hg qgoto meth-lfc.patch". >> >> If this stuff helps we would like to work towards a fix in 7u. >> >> What is your time frame for JRuby 1.7.5? > > It is on hold indefinitely while we work out user-reported issues > (most are not 7u40-related, but we'd like to have an answer for those > before release too). > > I've attached one user's hs_err dump. This was with a 4GB heap. Code > cache full You mean perm gen, right? > and failing spectacularly? > > - Charlie > _______________________________________________ > mlvm-dev mailing list > mlvm-dev at openjdk.java.net > http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev From christian.thalinger at oracle.com Wed Sep 18 12:52:05 2013 From: christian.thalinger at oracle.com (Christian Thalinger) Date: Wed, 18 Sep 2013 12:52:05 -0700 Subject: RFR (S) 8001109: arity mismatch on a call to spreader method handle should elicit IllegalArgumentException In-Reply-To: <74280088-19F3-4B0B-AC62-3332E9AED63A@oracle.com> References: <74280088-19F3-4B0B-AC62-3332E9AED63A@oracle.com> Message-ID: <25ACD0D6-FB63-41DB-9321-8CB2D982B993@oracle.com> Looks good. On Sep 12, 2013, at 6:02 PM, John Rose wrote: > Please review this change for a change to the JSR 292 implementation: > > http://cr.openjdk.java.net/~jrose/8001109/webrev.00/ > > The change is mostly to javadoc and unit tests, documenting and testing some corner cases of JSR 292 APIs. > > In the RI, the exception-raising code is simplified to throw just IAE. > > Thanks, > ? John > _______________________________________________ > mlvm-dev mailing list > mlvm-dev at openjdk.java.net > http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev From christian.thalinger at oracle.com Wed Sep 18 14:11:23 2013 From: christian.thalinger at oracle.com (Christian Thalinger) Date: Wed, 18 Sep 2013 14:11:23 -0700 Subject: RFR (L) 8024761: JSR 292 improve performance of generic invocation In-Reply-To: <69A734BA-67A8-4BA2-9A8B-075E455327A3@oracle.com> References: <69A734BA-67A8-4BA2-9A8B-075E455327A3@oracle.com> Message-ID: src/share/classes/java/lang/invoke/CallSite.java: + if (3 + argv.length > MethodType.MAX_MH_ARITY) + MethodType invocationType = MethodType.genericMethodType(3 + argv.length); + MethodHandle spreader = invocationType.invokers().spreadInvoker(3); Could we use a defined constant for "3"? src/share/classes/java/lang/invoke/Invokers.java: + if (targetType == targetType.erase() && targetType.parameterCount() < 10) The same here for "10". Actually, exactInvoker and generalInvoker's code could be factored into one method. + /*non-public*/ MethodHandle basicInvoker() { + //invoker.form.compileToBytecode(); Please remove commented lines. + static MemberName exactInvokeLinkerMethod(MethodType mtype, Object[] appendixResult) { + static MemberName genericInvokeLinkerMethod(MethodType mtype, Object[] appendixResult) { These two could also be factored into one method. + // Return an adapter for invokeExact or generic invoke, as a MH or constant pool linker + // mtype : the caller's method type (either basic or full-custom) + // customized : whether to use a trailing appendix argument (to carry the mtype) + // which&0x01 : whether it is a CP adapter ("linker") or MHs.invoker value ("invoker") + // which&0x02 : whether it is for invokeExact or generic invoke + // + // If !customized, caller is responsible for supplying, during adapter execution, + // a copy of the exact mtype. This is because the adapter might be generalized to + // a basic type. + private static LambdaForm invokeHandleForm(MethodType mtype, boolean customized, int which) { Why are you not using Javadoc style for this method comment? It's still helpful in IDEs. src/share/classes/java/lang/invoke/LambdaForm.java: static void traceInterpreter(String event, Object obj, Object... args) { + if (!(TRACE_INTERPRETER && INIT_DONE)) return; Why not use the same pattern: + if (TRACE_INTERPRETER && INIT_DONE) as the other places? + static final boolean INIT_DONE = Boolean.TRUE.booleanValue(); Why are we having this after all? src/share/classes/java/lang/invoke/MemberName.java: + public MemberName asNormalOriginal() { Could you add a comment to this method? It's not clear to me what "normal" and "original" mean here. + public MemberName(byte refKind, Class defClass, String name, Object type) { + @SuppressWarnings("LocalVariableHidesMemberVariable") + int kindFlags; The SuppressWarnings is in the other constructors because of the name "flags". You don't need it here. Maybe rename the others as well and get rid of the annotation. src/share/classes/java/lang/invoke/MethodHandleNatives.java: static String refKindName(byte refKind) { assert(refKindIsValid(refKind)); - return REFERENCE_KIND_NAME[refKind]; + switch (refKind) { After this change REFERENCE_KIND_NAME is not used anymore. src/share/classes/java/lang/invoke/MethodHandles.java: + member.getName().getClass(); member.getType().getClass(); // NPE Please don't! It would be nice to have at least a different line number in the backtrace. src/share/classes/java/lang/invoke/MethodTypeForm.java: + //Lookup.findVirtual(MethodHandle.class, name, type); Either remove it or add a comment why it's there. On Sep 12, 2013, at 6:36 PM, John Rose wrote: > Please review this change for a change to the JSR 292 implementation: > > http://cr.openjdk.java.net/~jrose/8024761/webrev.00/ > > Bug description: The performance of MethodHandle.invoke is very slow when the call site type differs from the method handle type. When the types differ, the invocation is defined to proceed as if two steps were taken: > > 1. the target method handle is first adjusted to the call site type, by MethodHandles.asType > > 2. the type-adjusted method handle is invoked directly, by MethodHandles.invokeExact > > The existing code (from JDK 7) awkwardly performs the type adjustment on every call. But performing the type analysis and adapter creation on every call is inherently slow. A good fix is to cache the result of step 1 (MethodHandles.asType), since step 2 is already reasonably fast. > > For most applications, a one-element cache on each individual method handle is a reasonable choice. It has the particular advantage of speeding up invocations of non-varargs bootstrap methods. To benefit from this, the bootstrap methods themselves need to be uniquified across multiple class files, so this work will also include a cache to benefit commonly-used bootstrap methods, such as JDK 8's LambdaMetafactory.metafactory. > > Additional caches could be based on the call site, the call site type, the target type, or the target's MH.form. > > Thanks, > ? John > > P.S. Since this is an implementation change oriented toward performance, the review request is to mlvm-dev and hotspot-compiler-dev. > Changes which are oriented toward functionality will go to mlvm-dev and core-libs-dev. From christian.thalinger at oracle.com Wed Sep 18 17:05:09 2013 From: christian.thalinger at oracle.com (Christian Thalinger) Date: Wed, 18 Sep 2013 17:05:09 -0700 Subject: RFR (S) 8001108: an attempt to use "" as a method name should elicit NoSuchMethodException In-Reply-To: <6FAC275C-6374-41F5-BAB7-CA1AC729EF9F@oracle.com> References: <6FAC275C-6374-41F5-BAB7-CA1AC729EF9F@oracle.com> Message-ID: <09F68115-21E6-450C-8DC2-6FCDB6C191B4@oracle.com> src/share/classes/java/lang/invoke/MethodHandles.java: + * methods as if they were normal methods, but the JVM verifier rejects them. I think you should say "JVM byte code verifier" here. + * (Note: JVM internal methods named {@code } not visible to this API, + * even though the {@code invokespecial} instruction can refer to them + * in special circumstances. Use {@link #findConstructor findConstructor} Not exactly sure but should this read "are not visible"? MemberName resolveOrFail(byte refKind, Class refc, String name, MethodType type) throws NoSuchMethodException, IllegalAccessException { + type.getClass(); // NPE checkSymbolicClass(refc); // do this before attempting to resolve - name.getClass(); type.getClass(); // NPE + checkMethodName(refKind, name); Could you add a comment here saying that checkMethodName does an implicit null pointer check on name? Maybe a comment for checkMethodName too. What was the problem with the null pointer exceptions? Is it okay that we might throw another exception before null checking name? On Sep 12, 2013, at 6:47 PM, John Rose wrote: > Please review this change for a change to the JSR 292 implementation: > > http://cr.openjdk.java.net/~jrose/8001108/webrev.00 > > Summary: add an explicit check for leading "<", upgrade the unit tests > > The change is mostly to javadoc and unit tests, documenting and testing some corner cases of JSR 292 APIs. > > In the RI, there is an explicit error check. > > Thanks, > ? John > > P.S. Since this is a change which oriented toward JSR 292 functionality, the review request is to mlvm-dev and core-libs-dev. > Changes which are oriented toward performance will go to mlvm-dev and hotspot-compiler-dev. > _______________________________________________ > mlvm-dev mailing list > mlvm-dev at openjdk.java.net > http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev From john.r.rose at oracle.com Wed Sep 18 18:43:37 2013 From: john.r.rose at oracle.com (John Rose) Date: Wed, 18 Sep 2013 18:43:37 -0700 Subject: RFR (L) 8024761: JSR 292 improve performance of generic invocation In-Reply-To: References: <69A734BA-67A8-4BA2-9A8B-075E455327A3@oracle.com> Message-ID: <0F691222-C21B-416E-B029-D8CA7D8ADFE0@oracle.com> On Sep 18, 2013, at 2:11 PM, Christian Thalinger wrote: > src/share/classes/java/lang/invoke/CallSite.java: > > + if (3 + argv.length > MethodType.MAX_MH_ARITY) > + MethodType invocationType = MethodType.genericMethodType(3 + argv.length); > + MethodHandle spreader = invocationType.invokers().spreadInvoker(3); > > Could we use a defined constant for "3"? Yes. > > src/share/classes/java/lang/invoke/Invokers.java: > > + if (targetType == targetType.erase() && targetType.parameterCount() < 10) > > The same here for "10". Fixed; factored to a subroutine. > Actually, exactInvoker and generalInvoker's code could be factored into one method. > > + /*non-public*/ MethodHandle basicInvoker() { > + //invoker.form.compileToBytecode(); Done. > Please remove commented lines. > > + static MemberName exactInvokeLinkerMethod(MethodType mtype, Object[] appendixResult) { > + static MemberName genericInvokeLinkerMethod(MethodType mtype, Object[] appendixResult) { > > These two could also be factored into one method. Done. I removed those two, and called the one new method from MethodHandleNatives. > + // Return an adapter for invokeExact or generic invoke, as a MH or constant pool linker > + // mtype : the caller's method type (either basic or full-custom) > + // customized : whether to use a trailing appendix argument (to carry the mtype) > + // which&0x01 : whether it is a CP adapter ("linker") or MHs.invoker value ("invoker") > + // which&0x02 : whether it is for invokeExact or generic invoke > + // > + // If !customized, caller is responsible for supplying, during adapter execution, > + // a copy of the exact mtype. This is because the adapter might be generalized to > + // a basic type. > + private static LambdaForm invokeHandleForm(MethodType mtype, boolean customized, int which) { > > Why are you not using Javadoc style for this method comment? It's still helpful in IDEs. Fixed. > src/share/classes/java/lang/invoke/LambdaForm.java: > > static void traceInterpreter(String event, Object obj, Object... args) { > + if (!(TRACE_INTERPRETER && INIT_DONE)) return; Done. > > Why not use the same pattern: > > + if (TRACE_INTERPRETER && INIT_DONE) > > as the other places? > > + static final boolean INIT_DONE = Boolean.TRUE.booleanValue(); > > Why are we having this after all? I removed it; see webrev. There's a comment which explains the problem and the nicer replacement. > src/share/classes/java/lang/invoke/MemberName.java: > > + public MemberName asNormalOriginal() { > > Could you add a comment to this method? It's not clear to me what "normal" and "original" mean here. Done. > + public MemberName(byte refKind, Class defClass, String name, Object type) { > + @SuppressWarnings("LocalVariableHidesMemberVariable") > + int kindFlags; > > The SuppressWarnings is in the other constructors because of the name "flags". You don't need it here. Maybe rename the others as well and get rid of the annotation. OK; I removed 2/3 of them. > src/share/classes/java/lang/invoke/MethodHandleNatives.java: > > static String refKindName(byte refKind) { > assert(refKindIsValid(refKind)); > - return REFERENCE_KIND_NAME[refKind]; > + switch (refKind) { > > After this change REFERENCE_KIND_NAME is not used anymore. Good catch. > src/share/classes/java/lang/invoke/MethodHandles.java: > > + member.getName().getClass(); member.getType().getClass(); // NPE > > Please don't! It would be nice to have at least a different line number in the backtrace. OK. I split three such lines. I would like to switch all these to Objects.requireNonNull, but only after a little performance testing to make sure we don't have surprises. > src/share/classes/java/lang/invoke/MethodTypeForm.java: > > + //Lookup.findVirtual(MethodHandle.class, name, type); > > Either remove it or add a comment why it's there. Commented better now. While testing, I found a spot in BoundMethodHandle that needed a tweak to avoid a bootstrap problem. (Too many of those.) I sharpened the type of 'caller' in CallSite.makeSite. The webrev is updated: http://cr.openjdk.java.net/~jrose/8024761/webrev.01/ Thanks! ? John > On Sep 12, 2013, at 6:36 PM, John Rose wrote: > >> Please review this change for a change to the JSR 292 implementation: >> >> http://cr.openjdk.java.net/~jrose/8024761/webrev.00/ >> >> Bug description: The performance of MethodHandle.invoke is very slow when the call site type differs from the method handle type. When the types differ, the invocation is defined to proceed as if two steps were taken: >> >> 1. the target method handle is first adjusted to the call site type, by MethodHandles.asType >> >> 2. the type-adjusted method handle is invoked directly, by MethodHandles.invokeExact >> >> The existing code (from JDK 7) awkwardly performs the type adjustment on every call. But performing the type analysis and adapter creation on every call is inherently slow. A good fix is to cache the result of step 1 (MethodHandles.asType), since step 2 is already reasonably fast. >> >> For most applications, a one-element cache on each individual method handle is a reasonable choice. It has the particular advantage of speeding up invocations of non-varargs bootstrap methods. To benefit from this, the bootstrap methods themselves need to be uniquified across multiple class files, so this work will also include a cache to benefit commonly-used bootstrap methods, such as JDK 8's LambdaMetafactory.metafactory. >> >> Additional caches could be based on the call site, the call site type, the target type, or the target's MH.form. >> >> Thanks, >> ? John >> >> P.S. Since this is an implementation change oriented toward performance, the review request is to mlvm-dev and hotspot-compiler-dev. >> Changes which are oriented toward functionality will go to mlvm-dev and core-libs-dev. > From christian.thalinger at oracle.com Wed Sep 18 19:01:04 2013 From: christian.thalinger at oracle.com (Christian Thalinger) Date: Wed, 18 Sep 2013 19:01:04 -0700 Subject: Interpreting Mission Control numbers for indy In-Reply-To: References: Message-ID: <9C3372EC-940A-4416-A425-4D2552CA3DEE@oracle.com> On Sep 18, 2013, at 1:39 AM, Charles Oliver Nutter wrote: > I've been playing with JMC a bit tonight, running a user's application > that's about 2x slower using indy than using trivial monomorphic > caches (and no indy call sites). I'm trying to understand how to > interpret what I see. > > In the Code/Overview results, where it lists "hot packages", the #1 > and #2 packages are java.lang.invoke.LambdaForm$MH and DMH, accounting > for over 37% of samples. That sounds high, but I'm willing to grant > they're hit pretty hard for a fully dynamic application. > > Results in the "Hot Methods" tab show similar things, like > LambdaForm...invokeStatic_LL_L as the number one result and LambdaForm > entries dominating the top 50 entries in the profile. Again, I know > I'm hitting dynamic call sites hard and sampling is not always > accurate. > > If I look at compilation events, I only see a handful of > LambdaForm...convert being compiled. I'm not sure if that's good or > bad. My assumption is that LFs don't show up here because they're > always being inlined into a caller. > > The performance numbers for the app have me worried too. If I run > JRuby with stock settings, we will chain up to 6 call targets at a > call site. The lower I drop this number, the better performance gets; > when I drop all the way to zero, forcing all invokedynamic call sites > to fail over immediately to a monomorphic inline cache, performance > *almost* gets back to the non-indy implementation. This leads me to > believe that the less I use invokedynamic (or the fewer LFs involved), > the better. That doesn't bode well. > > I believe the user would be happy to allow me to make these JMC > recordings available, and I'm happy to re-run with additional events > or gather other information. The JRuby community has a number of very > large applications that push the limits of indy. We should work > together to improve it. We talked about this in the past. Can we somehow get access to one of these large applications? > > - Charlie > _______________________________________________ > mlvm-dev mailing list > mlvm-dev at openjdk.java.net > http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev From john.r.rose at oracle.com Wed Sep 18 23:27:41 2013 From: john.r.rose at oracle.com (John Rose) Date: Wed, 18 Sep 2013 23:27:41 -0700 Subject: RFR (S) 8001105: findVirtual of Object[].clone produces internal error Message-ID: <06C8689A-C3A1-493F-8944-7369B1F9AA36@oracle.com> http://cr.openjdk.java.net/~jrose/8001105/webrev.00/ Summary: Replicate JVM logic for access control that makes Object.clone appear public when applied to an array type. See: http://mail.openjdk.java.net/pipermail/mlvm-dev/2012-October/005035.html ? John From george.marrows at googlemail.com Thu Sep 19 01:14:45 2013 From: george.marrows at googlemail.com (George Marrows) Date: Thu, 19 Sep 2013 09:14:45 +0100 Subject: Interpreting Mission Control numbers for indy In-Reply-To: <9C3372EC-940A-4416-A425-4D2552CA3DEE@oracle.com> References: <9C3372EC-940A-4416-A425-4D2552CA3DEE@oracle.com> Message-ID: Christian -- Duncan Macgregor and I have a large desktop application that makes very heavy use of indy. As Duncan reported recently, we're also seeing increased memory usage and (probably) decreased performance under u40. Will contact you privately with details of how we can get you access. -- George On Thu, Sep 19, 2013 at 3:01 AM, Christian Thalinger < christian.thalinger at oracle.com> wrote: > > On Sep 18, 2013, at 1:39 AM, Charles Oliver Nutter > wrote: > > > I've been playing with JMC a bit tonight, running a user's application > > that's about 2x slower using indy than using trivial monomorphic > > caches (and no indy call sites). I'm trying to understand how to > > interpret what I see. > > > > In the Code/Overview results, where it lists "hot packages", the #1 > > and #2 packages are java.lang.invoke.LambdaForm$MH and DMH, accounting > > for over 37% of samples. That sounds high, but I'm willing to grant > > they're hit pretty hard for a fully dynamic application. > > > > Results in the "Hot Methods" tab show similar things, like > > LambdaForm...invokeStatic_LL_L as the number one result and LambdaForm > > entries dominating the top 50 entries in the profile. Again, I know > > I'm hitting dynamic call sites hard and sampling is not always > > accurate. > > > > If I look at compilation events, I only see a handful of > > LambdaForm...convert being compiled. I'm not sure if that's good or > > bad. My assumption is that LFs don't show up here because they're > > always being inlined into a caller. > > > > The performance numbers for the app have me worried too. If I run > > JRuby with stock settings, we will chain up to 6 call targets at a > > call site. The lower I drop this number, the better performance gets; > > when I drop all the way to zero, forcing all invokedynamic call sites > > to fail over immediately to a monomorphic inline cache, performance > > *almost* gets back to the non-indy implementation. This leads me to > > believe that the less I use invokedynamic (or the fewer LFs involved), > > the better. That doesn't bode well. > > > > I believe the user would be happy to allow me to make these JMC > > recordings available, and I'm happy to re-run with additional events > > or gather other information. The JRuby community has a number of very > > large applications that push the limits of indy. We should work > > together to improve it. > > We talked about this in the past. Can we somehow get access to one of > these large applications? > > > > > - Charlie > > _______________________________________________ > > mlvm-dev mailing list > > mlvm-dev at openjdk.java.net > > http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev > > _______________________________________________ > mlvm-dev mailing list > mlvm-dev at openjdk.java.net > http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.openjdk.java.net/pipermail/mlvm-dev/attachments/20130919/d53a132a/attachment.html From david.r.chase at oracle.com Thu Sep 19 09:57:22 2013 From: david.r.chase at oracle.com (David Chase) Date: Thu, 19 Sep 2013 12:57:22 -0400 Subject: RFR(S+M) / 8022701 Accessibility checking: InvocationTargetException is thrown instead of IllegalAccessError In-Reply-To: <9092C3F3-EA5A-4748-BD67-0423F1B8964E@oracle.com> References: <143F40F0-557E-48EA-9207-0FF1880663DF@oracle.com> <5229F4B8.9000506@oracle.com> <64E60D4E-0829-4B23-9EE7-61AD28DB7E2F@oracle.com> <49B1A36F-6C45-4E92-80D2-FA6F80A238CB@oracle.com> <2F83E9C4-B28A-4385-8FFB-78F1313A931F@oracle.com> <6F0563F9-7A78-42C7-9296-53991C18D5CA@oracle.com> <31FAE0CA-5EDD-4014-AED9-27533E53307F@oracle.com> <9092C3F3-EA5A-4748-BD67-0423F1B8964E@oracle.com> Message-ID: Recommended changes made: http://cr.openjdk.java.net/~drchase/8022701/webrev.04/ Test with jtreg (for pass and for induced failure) on MacOS, not sure what additional other testing is desired since it is entirely in the libraries. I included code to handle the case of a broken field-referencing methodhandle, but did not test it because there's no syntax for these in Java, nor is their creation well-documented. David On 2013-09-13, at 12:02 AM, John Rose wrote: > On Sep 12, 2013, at 5:44 PM, David Chase wrote: > >> Do these sibling bugs have numbers? > > Yes, 8022701. I just updated the bug to explain their common genesis. > >> And I take it you would like to see >> >> 1) a test enhanced with ASM to do all 3 variants of this > > Yes, please. The case of "no such field" does not have a direct cause from lambda expressions AFAIK, but it can occur with "raw" CONSTANT_MethodHandles. (It would be reasonable for javac to emit CONSTANT_MH's for fields in some very limited circumstances, but I'll bet it doesn't.) > >> 2) DO attach the underlying cause > > Yes. Read the javadoc for ExceptionInInitializerError for an example of why users want the underlying cause for linkage errors. > > (Golly, I wonder what happens if resolution of a CONSTANT_MethodHandle tries to touch a class with a booby-trapped . I hope it's the case that the ExceptionInInitializerError just passes straight up the stack. But if it were to get wrapped in a ROE of some sort, it would probably bubble up as an IAE. Could be a charming exploration. Actually, no, I don't want to go in there. Getting all possible linkage errors correct is fine, but we have more important things to do.) > > ? John > >> David >> >> On 2013-09-12, at 5:35 PM, John Rose wrote: >> >>> It looks good. I have three requests. >>> >>> Regarding this comment: >>> + * See MethodSupplier.java to see how to produce these bytes. >>> + * They encode that class, except that method m is private, not public. >>> >>> The recipe is incomplete, since it does not say which bits to tweak to make m private. Please add that step to the comments more explicitly, or if possible to the code (so bogusMethodSupplier is a clean copy of the od output). I suppose you could ask sed to change the byte for you. That will make this test a better example for future tests, and make it easier to maintain if javac output changes. The high road to use would be asm, although for a single byte tweak od works OK. >>> >>> Also, this bug has two twins. The same thing will happen with NoSuchMethodE* and NoSuchFieldE*. Can you please make fixes for those guys also? >>> >>> FTR, see MemberName.makeAccessException() for logic which maps the other way, from *Error to *Exception. I don't see a direct way to avoid the double mapping (Error=>Exception=>Error) when it occurs. >>> >>> For the initCause bit we should do this: >>> >>> } catch (IllegalAccessException ex) { >>> Error err = new IllegalAccessError(ex.getMessage()); >>> err.initCause(ex.getCause()); // reuse underlying cause of ex >>> throw err; >>> } ... and for NSME and NSFE... >>> >>> That way users can avoid the duplicate exception but can see any underlying causes that the JVM may include. >>> >>> Thanks for untangling this! >>> >>> ? John >>> >>> On Sep 12, 2013, at 12:17 PM, David Chase wrote: >>> >>>> The test is adapted from the test in the bug report. >>>> The headline on the bug report is wrong -- because it uses reflection in the test to do the invocation, >>>> the thrown exception is wrapped with InvocationTargetException, which is completely correct. >>>> HOWEVER, the exception inside the wrapper is the wrong one. >>>> >>>> The new test checks the exception in both the reflective-invocation and plain-invocation cases, >>>> and also checks both a method handle call (which threw the wrong exception) and a plain >>>> call (which threw, and throws, the right exception). >>>> >>>> The test also uses a tweaked classloader to substitute the borked bytecodes necessary to get >>>> the error, so it is not only shell-free, it can also be run outside jtreg. >>>> >>>> On 2013-09-12, at 2:34 PM, Christian Thalinger wrote: >>>> >>>>> >>>>> On Sep 12, 2013, at 11:28 AM, David Chase wrote: >>>>> >>>>>> New webrev, commented line removed: >>>>>> http://cr.openjdk.java.net/~drchase/8022701/webrev.03/ >>>>> >>>>> I think the change is good given that the tests work now. Is your test derived from the test in the bug report? >>>>> >>>>> And it would be good if John could also have a quick look (just be to be sure). >>>>> >>>>> -- Chris >>>>> >>>>>> >>>>>> On 2013-09-12, at 1:53 PM, David Chase wrote: >>>>>> >>>>>>> I believe it produced extraneous output -- it was not clear to me that it was either necessary or useful to fully describe all the converted exceptions that lead to the defined exception being thrown. The commented line should have just been removed (I think). >>>>>>> >>>>>>> On 2013-09-12, at 1:24 PM, Christian Thalinger wrote: >>>>>>> >>>>>>>> + // err.initCause(ex); >>>>>>>> >>>>>>>> Why is this commented? >>>>>>>> >>>>>>>> -- Chris >>>>>> >>>>> >>>> >>>> _______________________________________________ >>>> mlvm-dev mailing list >>>> mlvm-dev at openjdk.java.net >>>> http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev >>> >> > -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 801 bytes Desc: Message signed with OpenPGP using GPGMail Url : http://mail.openjdk.java.net/pipermail/mlvm-dev/attachments/20130919/341f5977/signature.asc From vladimir.x.ivanov at oracle.com Thu Sep 19 10:45:18 2013 From: vladimir.x.ivanov at oracle.com (Vladimir Ivanov) Date: Thu, 19 Sep 2013 21:45:18 +0400 Subject: RFR (S) 8001109: arity mismatch on a call to spreader method handle should elicit IllegalArgumentException In-Reply-To: <74280088-19F3-4B0B-AC62-3332E9AED63A@oracle.com> References: <74280088-19F3-4B0B-AC62-3332E9AED63A@oracle.com> Message-ID: <523B382E.4060304@oracle.com> Looks good. Best regards, Vladimir Ivanov On 9/13/13 5:02 AM, John Rose wrote: > Please review this change for a change to the JSR 292 implementation: > > http://cr.openjdk.java.net/~jrose/8001109/webrev.00/ > > The change is mostly to javadoc and unit tests, documenting and testing some corner cases of JSR 292 APIs. > > In the RI, the exception-raising code is simplified to throw just IAE. > > Thanks, > ? John > From john.r.rose at oracle.com Thu Sep 19 14:31:43 2013 From: john.r.rose at oracle.com (John Rose) Date: Thu, 19 Sep 2013 14:31:43 -0700 Subject: RFR (S) 8001108: an attempt to use "" as a method name should elicit NoSuchMethodException In-Reply-To: <09F68115-21E6-450C-8DC2-6FCDB6C191B4@oracle.com> References: <6FAC275C-6374-41F5-BAB7-CA1AC729EF9F@oracle.com> <09F68115-21E6-450C-8DC2-6FCDB6C191B4@oracle.com> Message-ID: <99860D39-C18B-4638-94BB-12084139AE1E@oracle.com> On Sep 18, 2013, at 5:05 PM, Christian Thalinger wrote: > src/share/classes/java/lang/invoke/MethodHandles.java: > > + * methods as if they were normal methods, but the JVM verifier rejects them. > > I think you should say "JVM byte code verifier" here. Done. s/byte code/bytecode/. > > + * (Note: JVM internal methods named {@code } not visible to this API, > + * even though the {@code invokespecial} instruction can refer to them > + * in special circumstances. Use {@link #findConstructor findConstructor} > > Not exactly sure but should this read "are not visible"? Yes. > > MemberName resolveOrFail(byte refKind, Class refc, String name, MethodType type) throws NoSuchMethodException, IllegalAccessException { > + type.getClass(); // NPE > checkSymbolicClass(refc); // do this before attempting to resolve > - name.getClass(); type.getClass(); // NPE > + checkMethodName(refKind, name); > > Could you add a comment here saying that checkMethodName does an implicit null pointer check on name? Maybe a comment for checkMethodName too. Done. > > What was the problem with the null pointer exceptions? Is it okay that we might throw another exception before null checking name? Foo. The reordering of those null checks seems to be a needless change that crept in. I'm going to keep them the way they are. See updated webrev: http://cr.openjdk.java.net/~jrose/8001108/webrev.01/ ? John > On Sep 12, 2013, at 6:47 PM, John Rose wrote: > >> Please review this change for a change to the JSR 292 implementation: >> >> http://cr.openjdk.java.net/~jrose/8001108/webrev.00 >> >> Summary: add an explicit check for leading "<", upgrade the unit tests >> >> The change is mostly to javadoc and unit tests, documenting and testing some corner cases of JSR 292 APIs. >> >> In the RI, there is an explicit error check. >> >> Thanks, >> ? John >> >> P.S. Since this is a change which oriented toward JSR 292 functionality, the review request is to mlvm-dev and core-libs-dev. >> Changes which are oriented toward performance will go to mlvm-dev and hotspot-compiler-dev. >> _______________________________________________ >> mlvm-dev mailing list >> mlvm-dev at openjdk.java.net >> http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev > > _______________________________________________ > mlvm-dev mailing list > mlvm-dev at openjdk.java.net > http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev From john.r.rose at oracle.com Thu Sep 19 14:38:30 2013 From: john.r.rose at oracle.com (John Rose) Date: Thu, 19 Sep 2013 14:38:30 -0700 Subject: RFR (S) 8024599: JSR 292 direct method handles need to respect initialization rules for static members In-Reply-To: <2A858714-7C1D-4A3D-B971-E193E1E256D3@oracle.com> References: <2A858714-7C1D-4A3D-B971-E193E1E256D3@oracle.com> Message-ID: <239656DF-E18F-4F88-8983-38C3ECE15DD3@oracle.com> On Sep 12, 2013, at 7:24 PM, John Rose wrote: > Please review this change for a change to the JSR 292 implementation: > > http://cr.openjdk.java.net/~jrose/8024599/webrev.00/ > > Summary: Align MH semantic with bytecode behavior of constructor and static member accesses, regarding invocation. > > The change is to javadoc and unit tests, documenting and testing some corner cases of JSR 292 APIs. I have a reviewer (Alex Buckley) for the documentation changes, but I would also like a quick code review for the unit test. Also, there is a code insertion (predicated on a "false" symbolic constant) which serves to document the buggy JDK 7 behavior. I'm not particularly attached to it, so I'm open to either a yea or nay on keeping it. Leaning nay at the moment. ? John -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.openjdk.java.net/pipermail/mlvm-dev/attachments/20130919/68d6c8e9/attachment.html From benjamin.sieffert at metrigo.de Fri Sep 20 00:42:43 2013 From: benjamin.sieffert at metrigo.de (Benjamin Sieffert) Date: Fri, 20 Sep 2013 09:42:43 +0200 Subject: Calls to native methods setCallSiteTargetNormal and defineAnonymousClass taking very long Message-ID: (sending this again because I wasn't subscribed the 1st time and hence it probably got spamfiltered) Hello everyone, I have been sent over her from the nashorn-dev mailing list. We're having trouble with our application getting (rather randomly) very busy with calls to the methods mentioned in the topic. On jdk8, that is. On jdk7, we're exclusively seeing setCallSiteTargetNormal. This probably has to do with LambdaForms not being in use on jdk7. Anyway, we're running roughly the following setup: - application mantle in JRuby - application core in Java - at the VERY core: highly repetitive javascript run via java (switched from rhino to nashorn recently there) It's a kind of webserver handling about 2-3k reqeusts per second. Each request will result in a few dozen calls to our javascript. Since we need our response times to be as low as possible, we'll not do the javascript-calls serially, but commit them all to an executor running on a number of threads equal to the number of available cores (usually 16 or 24 on our machines, 64bit-linux), so that ideally we'll use all cores for every single request. In summary: High level of concurrency, huge number of classes and nmethods generated at runtime (both by jruby and nashorn). (Some numbers from 65+ hrs uptime. jdk8: 140.000 classes live, 1M unloaded. 800mb metaspace exhausted; jdk7: 14.000 live, 2.000 unloaded. 500mb permgen exhausted) As for our actual problem, like I said, it's that sometimes all our worker threads will start to be 100% busy and, when looking at the stack traces, will all be in one of those two: 1. at java.lang.invoke.MethodHandleNatives.setCallSiteTargetNormal(Native Method) at java.lang.invoke.CallSite.setTargetNormal(CallSite.java:245) at java.lang.invoke.MutableCallSite.setTarget(MutableCallSite.java:154) at jdk.internal.dynalink.support.AbstractRelinkableCallSite.initialize(AbstractRelinkableCallSite.java:115) at jdk.internal.dynalink.DynamicLinker.link(DynamicLinker.java:184) at jdk.nashorn.internal.runtime.linker.Bootstrap.bootstrap(Bootstrap.java:126) at java.lang.invoke.LambdaForm$DMH/272755642.invokeStatic_LLLI_L(LambdaForm$DMH) ... (omitting a few invocations of LambdaForm methods) at java.lang.invoke.LambdaForm$MH/839784351.invoke_MT(LambdaForm$MH) at java.lang.invoke.CallSite.makeSite(CallSite.java:283) at java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:294) at jdk.nashorn.internal.scripts.Script$\^eval\_._L196(:231) ... 2. at sun.misc.Unsafe.defineAnonymousClass(Native Method) at java.lang.invoke.InvokerBytecodeGenerator.loadAndInitializeInvokerClass(InvokerBytecodeGenerator.java:262) at java.lang.invoke.InvokerBytecodeGenerator.loadMethod(InvokerBytecodeGenerator.java:250) at java.lang.invoke.InvokerBytecodeGenerator.generateCustomizedCode(InvokerBytecodeGenerator.java:509) at java.lang.invoke.LambdaForm.compileToBytecode(LambdaForm.java:454) at java.lang.invoke.LambdaForm.checkInvocationCounter(LambdaForm.java:634) ... (omitting a few invocations of LambdaForm methods) at java.lang.invoke.LambdaForm$LFI/1682860686.interpret_L(LambdaForm$LFI) at java.lang.invoke.LambdaForm$MH/1997512181.linkToCallSite(LambdaForm$MH) at jdk.nashorn.internal.scripts.Script$\^eval\_._L196(:232) ... Obviously, the application is near unresponsive under these conditions (i.e. doesn't respond to actual requests from the outside, though you can connect with jconsole / visualvm / jprofiler just fine and observe it). CPU will be near 100% bound by these calls, too. Now there are a few interesting things to note that might help with diagnosis. Maybe most importantly, a full gc (we're using CMS, but CMSClassUnloadingEnabled does not need to be set) will stop the misbehaviour and will return the application to its normal state. Obviously, we'd rather not run full gcs all the time, but it's maybe also interesting to note that this can indeed be triggered by setting (on jdk7) MaxPermSize low enough or not at all. Apparently the garbage collector will always find enough space to clean up on PermGen that it doesn't really need to grow above some threshold -- though the graph showing our PermGen consumption will then look like the one showing our Heap consumption (i.e. up and down all the time) and we don't really have good response times, understandably. So this is not an option to fix the problem, but might be a clue to what's going on. A kind of additional problem in this regard is that exhausted PermGen / MetaSpace will nearly stop increasing under the problematic condition. Which, in turn, makes a full gc less likely to take place. Another clue is that we have been able to make the problem happen less often by dialing back on the amount of reference-replacement we do on our nashorn-javascript-engines. I.e. those engines have engine-wide bindings (as according to the javax.script api) you can replace just by calling .put(bindingName, object) on the engine, even while other threads are involved in calls inside it. Now apparently this causes much relinking of callsites to be done and thus fosters our problem. Still, it's hard to tell what's going on for sure, as we have no stack traces for what's happening inside the native code. I hope I could give you some idea. Best regards Benjamin -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.openjdk.java.net/pipermail/mlvm-dev/attachments/20130920/bbc6153e/attachment.html From blackdrag at gmx.org Fri Sep 20 01:12:44 2013 From: blackdrag at gmx.org (Jochen Theodorou) Date: Fri, 20 Sep 2013 10:12:44 +0200 Subject: Calls to native methods setCallSiteTargetNormal and defineAnonymousClass taking very long In-Reply-To: References: Message-ID: <523C037C.1000202@gmx.org> Am 20.09.2013 09:42, schrieb Benjamin Sieffert: [...] > - at the VERY core: highly repetitive javascript run via java (switched > from rhino to nashorn recently there) [...] > In summary: High level of concurrency, huge number of classes and > nmethods generated at runtime (both by jruby and nashorn). > (Some numbers from 65+ hrs uptime. jdk8: 140.000 classes live, 1M > unloaded. 800mb metaspace exhausted; jdk7: 14.000 live, 2.000 unloaded. > 500mb permgen exhausted) [...] > 1. > at java.lang.invoke.MethodHandleNatives.setCallSiteTargetNormal(Native > Method) > at java.lang.invoke.CallSite.setTargetNormal(CallSite.java:245) > at java.lang.invoke.MutableCallSite.setTarget(MutableCallSite.java:154) > at > jdk.internal.dynalink.support.AbstractRelinkableCallSite.initialize(AbstractRelinkableCallSite.java:115) > at jdk.internal.dynalink.DynamicLinker.link(DynamicLinker.java:184) > at > jdk.nashorn.internal.runtime.linker.Bootstrap.bootstrap(Bootstrap.java:126) > at > java.lang.invoke.LambdaForm$DMH/272755642.invokeStatic_LLLI_L(LambdaForm$DMH) > ... (omitting a few invocations of LambdaForm methods) > at java.lang.invoke.LambdaForm$MH/839784351.invoke_MT(LambdaForm$MH) > at java.lang.invoke.CallSite.makeSite(CallSite.java:283) > at > java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:294) > at jdk.nashorn.internal.scripts.Script$\^eval\_._L196(:231) > ... I don't know nashorn so much, but producing a new call site every time, does look problematic to me. > 2. > at sun.misc.Unsafe.defineAnonymousClass(Native Method) > at > java.lang.invoke.InvokerBytecodeGenerator.loadAndInitializeInvokerClass(InvokerBytecodeGenerator.java:262) > at > java.lang.invoke.InvokerBytecodeGenerator.loadMethod(InvokerBytecodeGenerator.java:250) > at > java.lang.invoke.InvokerBytecodeGenerator.generateCustomizedCode(InvokerBytecodeGenerator.java:509) > at java.lang.invoke.LambdaForm.compileToBytecode(LambdaForm.java:454) > at java.lang.invoke.LambdaForm.checkInvocationCounter(LambdaForm.java:634) > ... (omitting a few invocations of LambdaForm methods) > at java.lang.invoke.LambdaForm$LFI/1682860686.interpret_L(LambdaForm$LFI) > at java.lang.invoke.LambdaForm$MH/1997512181.linkToCallSite(LambdaForm$MH) > at jdk.nashorn.internal.scripts.Script$\^eval\_._L196(:232) > ... I think this is related to the first. > Obviously, the application is near unresponsive under these conditions > (i.e. doesn't respond to actual requests from the outside, though you > can connect with jconsole / visualvm / jprofiler just fine and observe > it). CPU will be near 100% bound by these calls, too. continously setting new callsite targets is very bad for performance > Now there are a few interesting things to note that might help with > diagnosis. > Maybe most importantly, a full gc (we're using CMS, but > CMSClassUnloadingEnabled does not need to be set) will stop the > misbehaviour and will return the application to its normal state. > Obviously, we'd rather not run full gcs all the time, but it's maybe > also interesting to note that this can indeed be triggered by setting > (on jdk7) MaxPermSize low enough or not at all. Apparently the garbage > collector will always find enough space to clean up on PermGen that it > doesn't really need to grow above some threshold -- though the graph > showing our PermGen consumption will then look like the one showing our > Heap consumption (i.e. up and down all the time) and we don't really > have good response times, understandably. So this is not an option to > fix the problem, but might be a clue to what's going on. > A kind of additional problem in this regard is that exhausted PermGen / > MetaSpace will nearly stop increasing under the problematic condition. > Which, in turn, makes a full gc less likely to take place. so the conditions happens due to low memory. My guess is something is softreferenced (or maybe weak) and gets released only (for unknown reasons to me) in a full GC run. The characteristics should be, that after a while the application starts misbehaving again. > Another clue is that we have been able to make the problem happen less > often by dialing back on the amount of reference-replacement we do on > our nashorn-javascript-engines. I.e. those engines have engine-wide > bindings (as according to the javax.script api) you can replace just by > calling .put(bindingName, object) on the engine, even while other > threads are involved in calls inside it. Now apparently this causes much > relinking of callsites to be done and thus fosters our problem. > > Still, it's hard to tell what's going on for sure, as we have no stack > traces for what's happening inside the native code. I hope I could give > you some idea. I think it is not the native code, rather than what nashorn does with the call sites. But I am not really familiar with nashorn. bye Jochen -- Jochen "blackdrag" Theodorou - Groovy Project Tech Lead blog: http://blackdragsview.blogspot.com/ german groovy discussion newsgroup: de.comp.lang.misc For Groovy programming sources visit http://groovy-lang.org From benjamin.sieffert at metrigo.de Fri Sep 20 01:25:56 2013 From: benjamin.sieffert at metrigo.de (Benjamin Sieffert) Date: Fri, 20 Sep 2013 10:25:56 +0200 Subject: Calls to native methods setCallSiteTargetNormal and defineAnonymousClass taking very long In-Reply-To: <523C037C.1000202@gmx.org> References: <523C037C.1000202@gmx.org> Message-ID: Hi Jochen, thanks for responding. I'm not really sure whether nashorn sets new callsites every time. In profiling I only see it initally (when script engines have just been initialized) and when the bad condition arises. As for it being due to low memory, I'm not sure. Sometimes heap will have been up to 450mb, been collected, risen from 250 to 350mb and then the bad condition arises. So it's not 100% tied to low memory, but still running a gc will always make the condition disappear. Regards 2013/9/20 Jochen Theodorou > Am 20.09.2013 09:42, schrieb Benjamin Sieffert: > [...] > > - at the VERY core: highly repetitive javascript run via java (switched > > from rhino to nashorn recently there) > [...] > > In summary: High level of concurrency, huge number of classes and > > nmethods generated at runtime (both by jruby and nashorn). > > (Some numbers from 65+ hrs uptime. jdk8: 140.000 classes live, 1M > > unloaded. 800mb metaspace exhausted; jdk7: 14.000 live, 2.000 unloaded. > > 500mb permgen exhausted) > [...] > > 1. > > at java.lang.invoke.MethodHandleNatives.setCallSiteTargetNormal(Native > > Method) > > at java.lang.invoke.CallSite.setTargetNormal(CallSite.java:245) > > at java.lang.invoke.MutableCallSite.setTarget(MutableCallSite.java:154) > > at > > > jdk.internal.dynalink.support.AbstractRelinkableCallSite.initialize(AbstractRelinkableCallSite.java:115) > > at jdk.internal.dynalink.DynamicLinker.link(DynamicLinker.java:184) > > at > > > jdk.nashorn.internal.runtime.linker.Bootstrap.bootstrap(Bootstrap.java:126) > > at > > > java.lang.invoke.LambdaForm$DMH/272755642.invokeStatic_LLLI_L(LambdaForm$DMH) > > ... (omitting a few invocations of LambdaForm methods) > > at java.lang.invoke.LambdaForm$MH/839784351.invoke_MT(LambdaForm$MH) > > at java.lang.invoke.CallSite.makeSite(CallSite.java:283) > > at > > > java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:294) > > at jdk.nashorn.internal.scripts.Script$\^eval\_._L196(:231) > > ... > > I don't know nashorn so much, but producing a new call site every time, > does look problematic to me. > > > 2. > > at sun.misc.Unsafe.defineAnonymousClass(Native Method) > > at > > > java.lang.invoke.InvokerBytecodeGenerator.loadAndInitializeInvokerClass(InvokerBytecodeGenerator.java:262) > > at > > > java.lang.invoke.InvokerBytecodeGenerator.loadMethod(InvokerBytecodeGenerator.java:250) > > at > > > java.lang.invoke.InvokerBytecodeGenerator.generateCustomizedCode(InvokerBytecodeGenerator.java:509) > > at java.lang.invoke.LambdaForm.compileToBytecode(LambdaForm.java:454) > > at > java.lang.invoke.LambdaForm.checkInvocationCounter(LambdaForm.java:634) > > ... (omitting a few invocations of LambdaForm methods) > > at java.lang.invoke.LambdaForm$LFI/1682860686.interpret_L(LambdaForm$LFI) > > at > java.lang.invoke.LambdaForm$MH/1997512181.linkToCallSite(LambdaForm$MH) > > at jdk.nashorn.internal.scripts.Script$\^eval\_._L196(:232) > > ... > > I think this is related to the first. > > > Obviously, the application is near unresponsive under these conditions > > (i.e. doesn't respond to actual requests from the outside, though you > > can connect with jconsole / visualvm / jprofiler just fine and observe > > it). CPU will be near 100% bound by these calls, too. > > continously setting new callsite targets is very bad for performance > > > Now there are a few interesting things to note that might help with > > diagnosis. > > Maybe most importantly, a full gc (we're using CMS, but > > CMSClassUnloadingEnabled does not need to be set) will stop the > > misbehaviour and will return the application to its normal state. > > Obviously, we'd rather not run full gcs all the time, but it's maybe > > also interesting to note that this can indeed be triggered by setting > > (on jdk7) MaxPermSize low enough or not at all. Apparently the garbage > > collector will always find enough space to clean up on PermGen that it > > doesn't really need to grow above some threshold -- though the graph > > showing our PermGen consumption will then look like the one showing our > > Heap consumption (i.e. up and down all the time) and we don't really > > have good response times, understandably. So this is not an option to > > fix the problem, but might be a clue to what's going on. > > A kind of additional problem in this regard is that exhausted PermGen / > > MetaSpace will nearly stop increasing under the problematic condition. > > Which, in turn, makes a full gc less likely to take place. > > so the conditions happens due to low memory. My guess is something is > softreferenced (or maybe weak) and gets released only (for unknown > reasons to me) in a full GC run. The characteristics should be, that > after a while the application starts misbehaving again. > > > Another clue is that we have been able to make the problem happen less > > often by dialing back on the amount of reference-replacement we do on > > our nashorn-javascript-engines. I.e. those engines have engine-wide > > bindings (as according to the javax.script api) you can replace just by > > calling .put(bindingName, object) on the engine, even while other > > threads are involved in calls inside it. Now apparently this causes much > > relinking of callsites to be done and thus fosters our problem. > > > > Still, it's hard to tell what's going on for sure, as we have no stack > > traces for what's happening inside the native code. I hope I could give > > you some idea. > > I think it is not the native code, rather than what nashorn does with > the call sites. But I am not really familiar with nashorn. > > bye Jochen > > -- > Jochen "blackdrag" Theodorou - Groovy Project Tech Lead > blog: http://blackdragsview.blogspot.com/ > german groovy discussion newsgroup: de.comp.lang.misc > For Groovy programming sources visit http://groovy-lang.org > > _______________________________________________ > mlvm-dev mailing list > mlvm-dev at openjdk.java.net > http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev > -- Benjamin Sieffert metrigo GmbH Sternstr. 106 20357 Hamburg Gesch?ftsf?hrer: Christian M?ller, Tobias Schlottke, Philipp Westermeyer Die Gesellschaft ist eingetragen beim Registergericht Hamburg Nr. HRB 120447. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.openjdk.java.net/pipermail/mlvm-dev/attachments/20130920/f5d6352f/attachment.html From blackdrag at gmx.org Fri Sep 20 02:09:25 2013 From: blackdrag at gmx.org (Jochen Theodorou) Date: Fri, 20 Sep 2013 11:09:25 +0200 Subject: Calls to native methods setCallSiteTargetNormal and defineAnonymousClass taking very long In-Reply-To: References: <523C037C.1000202@gmx.org> Message-ID: <523C10C5.9020702@gmx.org> Am 20.09.2013 10:25, schrieb Benjamin Sieffert: > Hi Jochen, > > thanks for responding. I'm not really sure whether nashorn sets new > callsites every time. In profiling I only see it initally (when script > engines have just been initialized) and when the bad condition arises. it is really only an assumption, but this really looks typical to soft referenced classes to me. It is done at the beginning and once memory requirements get strict, the references are released, but since they are needed right away again, they have to be recreated. > As for it being due to low memory, I'm not sure. Sometimes heap will > have been up to 450mb, been collected, risen from 250 to 350mb and then > the bad condition arises. So it's not 100% tied to low memory, but still > running a gc will always make the condition disappear. How about permgen? It is easy to proof the theory.. increase heap and permgen memory and you should observe the problem at a later point. If you have some luck, you may not experience it anymore at all. But if there are continuously new classes created to answer the requests (and I don't mean classes created by the jdk internals), the behaviour should appear again bye Jochen -- Jochen "blackdrag" Theodorou - Groovy Project Tech Lead blog: http://blackdragsview.blogspot.com/ german groovy discussion newsgroup: de.comp.lang.misc For Groovy programming sources visit http://groovy-lang.org From jlaskey at me.com Fri Sep 20 02:13:56 2013 From: jlaskey at me.com (Jim Laskey) Date: Fri, 20 Sep 2013 06:13:56 -0300 Subject: Calls to native methods setCallSiteTargetNormal and defineAnonymousClass taking very long In-Reply-To: <523C037C.1000202@gmx.org> References: <523C037C.1000202@gmx.org> Message-ID: <21247CA8-0438-44D8-A0C7-5F2AA81184F9@me.com> Thanks for that insight Jochen. (I asked Benjamin to repost here to see if anyone else has seen this issue.) Nashorn normally sets the callsite just once, but it's possible that in low memory conditions that it is getting forced to redo. We will investigate. Cheers, -- Jim Sent from Jim's iPhone > On Sep 20, 2013, at 5:12 AM, Jochen Theodorou wrote: > > Am 20.09.2013 09:42, schrieb Benjamin Sieffert: > [...] >> - at the VERY core: highly repetitive javascript run via java (switched >> from rhino to nashorn recently there) > [...] >> In summary: High level of concurrency, huge number of classes and >> nmethods generated at runtime (both by jruby and nashorn). >> (Some numbers from 65+ hrs uptime. jdk8: 140.000 classes live, 1M >> unloaded. 800mb metaspace exhausted; jdk7: 14.000 live, 2.000 unloaded. >> 500mb permgen exhausted) > [...] >> 1. >> at java.lang.invoke.MethodHandleNatives.setCallSiteTargetNormal(Native >> Method) >> at java.lang.invoke.CallSite.setTargetNormal(CallSite.java:245) >> at java.lang.invoke.MutableCallSite.setTarget(MutableCallSite.java:154) >> at >> jdk.internal.dynalink.support.AbstractRelinkableCallSite.initialize(AbstractRelinkableCallSite.java:115) >> at jdk.internal.dynalink.DynamicLinker.link(DynamicLinker.java:184) >> at >> jdk.nashorn.internal.runtime.linker.Bootstrap.bootstrap(Bootstrap.java:126) >> at >> java.lang.invoke.LambdaForm$DMH/272755642.invokeStatic_LLLI_L(LambdaForm$DMH) >> ... (omitting a few invocations of LambdaForm methods) >> at java.lang.invoke.LambdaForm$MH/839784351.invoke_MT(LambdaForm$MH) >> at java.lang.invoke.CallSite.makeSite(CallSite.java:283) >> at >> java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:294) >> at jdk.nashorn.internal.scripts.Script$\^eval\_._L196(:231) >> ... > > I don't know nashorn so much, but producing a new call site every time, > does look problematic to me. > >> 2. >> at sun.misc.Unsafe.defineAnonymousClass(Native Method) >> at >> java.lang.invoke.InvokerBytecodeGenerator.loadAndInitializeInvokerClass(InvokerBytecodeGenerator.java:262) >> at >> java.lang.invoke.InvokerBytecodeGenerator.loadMethod(InvokerBytecodeGenerator.java:250) >> at >> java.lang.invoke.InvokerBytecodeGenerator.generateCustomizedCode(InvokerBytecodeGenerator.java:509) >> at java.lang.invoke.LambdaForm.compileToBytecode(LambdaForm.java:454) >> at java.lang.invoke.LambdaForm.checkInvocationCounter(LambdaForm.java:634) >> ... (omitting a few invocations of LambdaForm methods) >> at java.lang.invoke.LambdaForm$LFI/1682860686.interpret_L(LambdaForm$LFI) >> at java.lang.invoke.LambdaForm$MH/1997512181.linkToCallSite(LambdaForm$MH) >> at jdk.nashorn.internal.scripts.Script$\^eval\_._L196(:232) >> ... > > I think this is related to the first. > >> Obviously, the application is near unresponsive under these conditions >> (i.e. doesn't respond to actual requests from the outside, though you >> can connect with jconsole / visualvm / jprofiler just fine and observe >> it). CPU will be near 100% bound by these calls, too. > > continously setting new callsite targets is very bad for performance > >> Now there are a few interesting things to note that might help with >> diagnosis. >> Maybe most importantly, a full gc (we're using CMS, but >> CMSClassUnloadingEnabled does not need to be set) will stop the >> misbehaviour and will return the application to its normal state. >> Obviously, we'd rather not run full gcs all the time, but it's maybe >> also interesting to note that this can indeed be triggered by setting >> (on jdk7) MaxPermSize low enough or not at all. Apparently the garbage >> collector will always find enough space to clean up on PermGen that it >> doesn't really need to grow above some threshold -- though the graph >> showing our PermGen consumption will then look like the one showing our >> Heap consumption (i.e. up and down all the time) and we don't really >> have good response times, understandably. So this is not an option to >> fix the problem, but might be a clue to what's going on. >> A kind of additional problem in this regard is that exhausted PermGen / >> MetaSpace will nearly stop increasing under the problematic condition. >> Which, in turn, makes a full gc less likely to take place. > > so the conditions happens due to low memory. My guess is something is > softreferenced (or maybe weak) and gets released only (for unknown > reasons to me) in a full GC run. The characteristics should be, that > after a while the application starts misbehaving again. > >> Another clue is that we have been able to make the problem happen less >> often by dialing back on the amount of reference-replacement we do on >> our nashorn-javascript-engines. I.e. those engines have engine-wide >> bindings (as according to the javax.script api) you can replace just by >> calling .put(bindingName, object) on the engine, even while other >> threads are involved in calls inside it. Now apparently this causes much >> relinking of callsites to be done and thus fosters our problem. >> >> Still, it's hard to tell what's going on for sure, as we have no stack >> traces for what's happening inside the native code. I hope I could give >> you some idea. > > I think it is not the native code, rather than what nashorn does with > the call sites. But I am not really familiar with nashorn. > > bye Jochen > > -- > Jochen "blackdrag" Theodorou - Groovy Project Tech Lead > blog: http://blackdragsview.blogspot.com/ > german groovy discussion newsgroup: de.comp.lang.misc > For Groovy programming sources visit http://groovy-lang.org > > _______________________________________________ > mlvm-dev mailing list > mlvm-dev at openjdk.java.net > http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev From forax at univ-mlv.fr Fri Sep 20 02:17:40 2013 From: forax at univ-mlv.fr (Remi Forax) Date: Fri, 20 Sep 2013 11:17:40 +0200 Subject: Calls to native methods setCallSiteTargetNormal and defineAnonymousClass taking very long In-Reply-To: References: Message-ID: <523C12B4.40003@univ-mlv.fr> I think you have your answer in the stack traces. The problem arise when you (or nashorn) call eval(). I see two solutions, either ask Nashorn guys why they create callsites too often when you use eval() in javascript or stop using eval() in your js script ! (if eval() is something you use and not something nashorn uses internally). R?mi On 09/20/2013 09:42 AM, Benjamin Sieffert wrote: > (sending this again because I wasn't subscribed the 1st time and hence > it probably got spamfiltered) > > Hello everyone, > > I have been sent over her from the nashorn-dev mailing list. We're > having trouble with our application getting (rather randomly) very > busy with calls to the methods mentioned in the topic. On jdk8, that > is. On jdk7, we're exclusively seeing setCallSiteTargetNormal. This > probably has to do with LambdaForms not being in use on jdk7. Anyway, > we're running roughly the following setup: > > - application mantle in JRuby > - application core in Java > - at the VERY core: highly repetitive javascript run via java > (switched from rhino to nashorn recently there) > > It's a kind of webserver handling about 2-3k reqeusts per second. Each > request will result in a few dozen calls to our javascript. Since we > need our response times to be as low as possible, we'll not do the > javascript-calls serially, but commit them all to an executor running > on a number of threads equal to the number of available cores (usually > 16 or 24 on our machines, 64bit-linux), so that ideally we'll use all > cores for every single request. > > In summary: High level of concurrency, huge number of classes and > nmethods generated at runtime (both by jruby and nashorn). > (Some numbers from 65+ hrs uptime. jdk8: 140.000 classes live, 1M > unloaded. 800mb metaspace exhausted; jdk7: 14.000 live, 2.000 > unloaded. 500mb permgen exhausted) > > As for our actual problem, like I said, it's that sometimes all our > worker threads will start to be 100% busy and, when looking at the > stack traces, will all be in one of those two: > > 1. > at java.lang.invoke.MethodHandleNatives.setCallSiteTargetNormal(Native > Method) > at java.lang.invoke.CallSite.setTargetNormal(CallSite.java:245) > at java.lang.invoke.MutableCallSite.setTarget(MutableCallSite.java:154) > at > jdk.internal.dynalink.support.AbstractRelinkableCallSite.initialize(AbstractRelinkableCallSite.java:115) > at jdk.internal.dynalink.DynamicLinker.link(DynamicLinker.java:184) > at > jdk.nashorn.internal.runtime.linker.Bootstrap.bootstrap(Bootstrap.java:126) > at > java.lang.invoke.LambdaForm$DMH/272755642.invokeStatic_LLLI_L(LambdaForm$DMH) > ... (omitting a few invocations of LambdaForm methods) > at java.lang.invoke.LambdaForm$MH/839784351.invoke_MT(LambdaForm$MH) > at java.lang.invoke.CallSite.makeSite(CallSite.java:283) > at > java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:294) > at jdk.nashorn.internal.scripts.Script$\^eval\_._L196(:231) > ... > > 2. > at sun.misc.Unsafe.defineAnonymousClass(Native Method) > at > java.lang.invoke.InvokerBytecodeGenerator.loadAndInitializeInvokerClass(InvokerBytecodeGenerator.java:262) > at > java.lang.invoke.InvokerBytecodeGenerator.loadMethod(InvokerBytecodeGenerator.java:250) > at > java.lang.invoke.InvokerBytecodeGenerator.generateCustomizedCode(InvokerBytecodeGenerator.java:509) > at java.lang.invoke.LambdaForm.compileToBytecode(LambdaForm.java:454) > at java.lang.invoke.LambdaForm.checkInvocationCounter(LambdaForm.java:634) > ... (omitting a few invocations of LambdaForm methods) > at java.lang.invoke.LambdaForm$LFI/1682860686.interpret_L(LambdaForm$LFI) > at java.lang.invoke.LambdaForm$MH/1997512181.linkToCallSite(LambdaForm$MH) > at jdk.nashorn.internal.scripts.Script$\^eval\_._L196(:232) > ... > > > Obviously, the application is near unresponsive under these conditions > (i.e. doesn't respond to actual requests from the outside, though you > can connect with jconsole / visualvm / jprofiler just fine and observe > it). CPU will be near 100% bound by these calls, too. > > Now there are a few interesting things to note that might help with > diagnosis. > Maybe most importantly, a full gc (we're using CMS, but > CMSClassUnloadingEnabled does not need to be set) will stop the > misbehaviour and will return the application to its normal state. > Obviously, we'd rather not run full gcs all the time, but it's maybe > also interesting to note that this can indeed be triggered by setting > (on jdk7) MaxPermSize low enough or not at all. Apparently the garbage > collector will always find enough space to clean up on PermGen that it > doesn't really need to grow above some threshold -- though the graph > showing our PermGen consumption will then look like the one showing > our Heap consumption (i.e. up and down all the time) and we don't > really have good response times, understandably. So this is not an > option to fix the problem, but might be a clue to what's going on. > A kind of additional problem in this regard is that exhausted PermGen > / MetaSpace will nearly stop increasing under the problematic > condition. Which, in turn, makes a full gc less likely to take place. > > Another clue is that we have been able to make the problem happen less > often by dialing back on the amount of reference-replacement we do on > our nashorn-javascript-engines. I.e. those engines have engine-wide > bindings (as according to the javax.script api) you can replace just > by calling .put(bindingName, object) on the engine, even while other > threads are involved in calls inside it. Now apparently this causes > much relinking of callsites to be done and thus fosters our problem. > > Still, it's hard to tell what's going on for sure, as we have no stack > traces for what's happening inside the native code. I hope I could > give you some idea. > > Best regards > Benjamin > > > _______________________________________________ > mlvm-dev mailing list > mlvm-dev at openjdk.java.net > http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev From benjamin.sieffert at metrigo.de Fri Sep 20 02:38:22 2013 From: benjamin.sieffert at metrigo.de (Benjamin Sieffert) Date: Fri, 20 Sep 2013 11:38:22 +0200 Subject: Calls to native methods setCallSiteTargetNormal and defineAnonymousClass taking very long In-Reply-To: <523C12B4.40003@univ-mlv.fr> References: <523C12B4.40003@univ-mlv.fr> Message-ID: Well the thing is, our maximum size (2g) for PermGen / Metaspace is never even approached. In fact, if we don't specify an initial size, constant gc will keep them under 200-300m (at the cost of performance). If we set an initial size of, say, 700m, that boundary won't be grown when the app is running, because gc is always able to take a huge chunk. The only thing left that comes to mind is CodeCache, which we indeed had to increase a few days ago. I will now increase it again (this time by a huge amount) and we'll see if that has any impact. Remi: The eval-calls are mainly nashorn-internal, the point where we call into it from our own code is not shown in the stack traces as I don't believe it matters. Also, what are you gonna do on a ScriptEngine if not call eval() on it? ;) Regards 2013/9/20 Remi Forax > I think you have your answer in the stack traces. > The problem arise when you (or nashorn) call eval(). > > I see two solutions, either ask Nashorn guys why they create callsites > too often when you use eval() in javascript > or stop using eval() in your js script ! (if eval() is something you use > and not something nashorn uses internally). > > R?mi > > On 09/20/2013 09:42 AM, Benjamin Sieffert wrote: > > (sending this again because I wasn't subscribed the 1st time and hence > > it probably got spamfiltered) > > > > Hello everyone, > > > > I have been sent over her from the nashorn-dev mailing list. We're > > having trouble with our application getting (rather randomly) very > > busy with calls to the methods mentioned in the topic. On jdk8, that > > is. On jdk7, we're exclusively seeing setCallSiteTargetNormal. This > > probably has to do with LambdaForms not being in use on jdk7. Anyway, > > we're running roughly the following setup: > > > > - application mantle in JRuby > > - application core in Java > > - at the VERY core: highly repetitive javascript run via java > > (switched from rhino to nashorn recently there) > > > > It's a kind of webserver handling about 2-3k reqeusts per second. Each > > request will result in a few dozen calls to our javascript. Since we > > need our response times to be as low as possible, we'll not do the > > javascript-calls serially, but commit them all to an executor running > > on a number of threads equal to the number of available cores (usually > > 16 or 24 on our machines, 64bit-linux), so that ideally we'll use all > > cores for every single request. > > > > In summary: High level of concurrency, huge number of classes and > > nmethods generated at runtime (both by jruby and nashorn). > > (Some numbers from 65+ hrs uptime. jdk8: 140.000 classes live, 1M > > unloaded. 800mb metaspace exhausted; jdk7: 14.000 live, 2.000 > > unloaded. 500mb permgen exhausted) > > > > As for our actual problem, like I said, it's that sometimes all our > > worker threads will start to be 100% busy and, when looking at the > > stack traces, will all be in one of those two: > > > > 1. > > at java.lang.invoke.MethodHandleNatives.setCallSiteTargetNormal(Native > > Method) > > at java.lang.invoke.CallSite.setTargetNormal(CallSite.java:245) > > at java.lang.invoke.MutableCallSite.setTarget(MutableCallSite.java:154) > > at > > > jdk.internal.dynalink.support.AbstractRelinkableCallSite.initialize(AbstractRelinkableCallSite.java:115) > > at jdk.internal.dynalink.DynamicLinker.link(DynamicLinker.java:184) > > at > > > jdk.nashorn.internal.runtime.linker.Bootstrap.bootstrap(Bootstrap.java:126) > > at > > > java.lang.invoke.LambdaForm$DMH/272755642.invokeStatic_LLLI_L(LambdaForm$DMH) > > ... (omitting a few invocations of LambdaForm methods) > > at java.lang.invoke.LambdaForm$MH/839784351.invoke_MT(LambdaForm$MH) > > at java.lang.invoke.CallSite.makeSite(CallSite.java:283) > > at > > > java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:294) > > at jdk.nashorn.internal.scripts.Script$\^eval\_._L196(:231) > > ... > > > > 2. > > at sun.misc.Unsafe.defineAnonymousClass(Native Method) > > at > > > java.lang.invoke.InvokerBytecodeGenerator.loadAndInitializeInvokerClass(InvokerBytecodeGenerator.java:262) > > at > > > java.lang.invoke.InvokerBytecodeGenerator.loadMethod(InvokerBytecodeGenerator.java:250) > > at > > > java.lang.invoke.InvokerBytecodeGenerator.generateCustomizedCode(InvokerBytecodeGenerator.java:509) > > at java.lang.invoke.LambdaForm.compileToBytecode(LambdaForm.java:454) > > at > java.lang.invoke.LambdaForm.checkInvocationCounter(LambdaForm.java:634) > > ... (omitting a few invocations of LambdaForm methods) > > at java.lang.invoke.LambdaForm$LFI/1682860686.interpret_L(LambdaForm$LFI) > > at > java.lang.invoke.LambdaForm$MH/1997512181.linkToCallSite(LambdaForm$MH) > > at jdk.nashorn.internal.scripts.Script$\^eval\_._L196(:232) > > ... > > > > > > Obviously, the application is near unresponsive under these conditions > > (i.e. doesn't respond to actual requests from the outside, though you > > can connect with jconsole / visualvm / jprofiler just fine and observe > > it). CPU will be near 100% bound by these calls, too. > > > > Now there are a few interesting things to note that might help with > > diagnosis. > > Maybe most importantly, a full gc (we're using CMS, but > > CMSClassUnloadingEnabled does not need to be set) will stop the > > misbehaviour and will return the application to its normal state. > > Obviously, we'd rather not run full gcs all the time, but it's maybe > > also interesting to note that this can indeed be triggered by setting > > (on jdk7) MaxPermSize low enough or not at all. Apparently the garbage > > collector will always find enough space to clean up on PermGen that it > > doesn't really need to grow above some threshold -- though the graph > > showing our PermGen consumption will then look like the one showing > > our Heap consumption (i.e. up and down all the time) and we don't > > really have good response times, understandably. So this is not an > > option to fix the problem, but might be a clue to what's going on. > > A kind of additional problem in this regard is that exhausted PermGen > > / MetaSpace will nearly stop increasing under the problematic > > condition. Which, in turn, makes a full gc less likely to take place. > > > > Another clue is that we have been able to make the problem happen less > > often by dialing back on the amount of reference-replacement we do on > > our nashorn-javascript-engines. I.e. those engines have engine-wide > > bindings (as according to the javax.script api) you can replace just > > by calling .put(bindingName, object) on the engine, even while other > > threads are involved in calls inside it. Now apparently this causes > > much relinking of callsites to be done and thus fosters our problem. > > > > Still, it's hard to tell what's going on for sure, as we have no stack > > traces for what's happening inside the native code. I hope I could > > give you some idea. > > > > Best regards > > Benjamin > > > > > > _______________________________________________ > > mlvm-dev mailing list > > mlvm-dev at openjdk.java.net > > http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev > > _______________________________________________ > mlvm-dev mailing list > mlvm-dev at openjdk.java.net > http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev > -- Benjamin Sieffert metrigo GmbH Sternstr. 106 20357 Hamburg Gesch?ftsf?hrer: Christian M?ller, Tobias Schlottke, Philipp Westermeyer Die Gesellschaft ist eingetragen beim Registergericht Hamburg Nr. HRB 120447. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.openjdk.java.net/pipermail/mlvm-dev/attachments/20130920/c27635bd/attachment.html From forax at univ-mlv.fr Fri Sep 20 03:01:39 2013 From: forax at univ-mlv.fr (Remi Forax) Date: Fri, 20 Sep 2013 12:01:39 +0200 Subject: Calls to native methods setCallSiteTargetNormal and defineAnonymousClass taking very long In-Reply-To: References: <523C12B4.40003@univ-mlv.fr> Message-ID: <523C1D03.6090207@univ-mlv.fr> On 09/20/2013 11:38 AM, Benjamin Sieffert wrote: > Well the thing is, our maximum size (2g) for PermGen / Metaspace is > never even approached. In fact, if we don't specify an initial size, > constant gc will keep them under 200-300m (at the cost of > performance). If we set an initial size of, say, 700m, that boundary > won't be grown when the app is running, because gc is always able to > take a huge chunk. The only thing left that comes to mind is > CodeCache, which we indeed had to increase a few days ago. I will now > increase it again (this time by a huge amount) and we'll see if that > has any impact. > > Remi: The eval-calls are mainly nashorn-internal, the point where we > call into it from our own code is not shown in the stack traces as I > don't believe it matters. Also, what are you gonna do on a > ScriptEngine if not call eval() on it? ;) You mean eval on the script or eval on the compiled script ? http://docs.oracle.com/javase/6/docs/api/javax/script/CompiledScript.html I don't know how Nashorn works but when I had to implements the javax.script API for some obscure scripting language :) I've used two entry points in the compiler that work that way: - if you call eval on a script, binding are compiled as constant. - if you call eval on a compiled script, the binding are not constant because you want to reuse the script. The relinking you see may be because nashorn think that your bindings are constant. > > Regards R?mi > > > 2013/9/20 Remi Forax > > > I think you have your answer in the stack traces. > The problem arise when you (or nashorn) call eval(). > > I see two solutions, either ask Nashorn guys why they create callsites > too often when you use eval() in javascript > or stop using eval() in your js script ! (if eval() is something > you use > and not something nashorn uses internally). > > R?mi > > On 09/20/2013 09:42 AM, Benjamin Sieffert wrote: > > (sending this again because I wasn't subscribed the 1st time and > hence > > it probably got spamfiltered) > > > > Hello everyone, > > > > I have been sent over her from the nashorn-dev mailing list. We're > > having trouble with our application getting (rather randomly) very > > busy with calls to the methods mentioned in the topic. On jdk8, that > > is. On jdk7, we're exclusively seeing setCallSiteTargetNormal. This > > probably has to do with LambdaForms not being in use on jdk7. > Anyway, > > we're running roughly the following setup: > > > > - application mantle in JRuby > > - application core in Java > > - at the VERY core: highly repetitive javascript run via java > > (switched from rhino to nashorn recently there) > > > > It's a kind of webserver handling about 2-3k reqeusts per > second. Each > > request will result in a few dozen calls to our javascript. Since we > > need our response times to be as low as possible, we'll not do the > > javascript-calls serially, but commit them all to an executor > running > > on a number of threads equal to the number of available cores > (usually > > 16 or 24 on our machines, 64bit-linux), so that ideally we'll > use all > > cores for every single request. > > > > In summary: High level of concurrency, huge number of classes and > > nmethods generated at runtime (both by jruby and nashorn). > > (Some numbers from 65+ hrs uptime. jdk8: 140.000 classes live, 1M > > unloaded. 800mb metaspace exhausted; jdk7: 14.000 live, 2.000 > > unloaded. 500mb permgen exhausted) > > > > As for our actual problem, like I said, it's that sometimes all our > > worker threads will start to be 100% busy and, when looking at the > > stack traces, will all be in one of those two: > > > > 1. > > at > java.lang.invoke.MethodHandleNatives.setCallSiteTargetNormal(Native > > Method) > > at java.lang.invoke.CallSite.setTargetNormal(CallSite.java:245) > > at > java.lang.invoke.MutableCallSite.setTarget(MutableCallSite.java:154) > > at > > > jdk.internal.dynalink.support.AbstractRelinkableCallSite.initialize(AbstractRelinkableCallSite.java:115) > > at jdk.internal.dynalink.DynamicLinker.link(DynamicLinker.java:184) > > at > > > jdk.nashorn.internal.runtime.linker.Bootstrap.bootstrap(Bootstrap.java:126) > > at > > > java.lang.invoke.LambdaForm$DMH/272755642.invokeStatic_LLLI_L(LambdaForm$DMH) > > ... (omitting a few invocations of LambdaForm methods) > > at java.lang.invoke.LambdaForm$MH/839784351.invoke_MT(LambdaForm$MH) > > at java.lang.invoke.CallSite.makeSite(CallSite.java:283) > > at > > > java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:294) > > at jdk.nashorn.internal.scripts.Script$\^eval\_._L196(:231) > > ... > > > > 2. > > at sun.misc.Unsafe.defineAnonymousClass(Native Method) > > at > > > java.lang.invoke.InvokerBytecodeGenerator.loadAndInitializeInvokerClass(InvokerBytecodeGenerator.java:262) > > at > > > java.lang.invoke.InvokerBytecodeGenerator.loadMethod(InvokerBytecodeGenerator.java:250) > > at > > > java.lang.invoke.InvokerBytecodeGenerator.generateCustomizedCode(InvokerBytecodeGenerator.java:509) > > at > java.lang.invoke.LambdaForm.compileToBytecode(LambdaForm.java:454) > > at > java.lang.invoke.LambdaForm.checkInvocationCounter(LambdaForm.java:634) > > ... (omitting a few invocations of LambdaForm methods) > > at > java.lang.invoke.LambdaForm$LFI/1682860686.interpret_L(LambdaForm$LFI) > > at > java.lang.invoke.LambdaForm$MH/1997512181.linkToCallSite(LambdaForm$MH) > > at jdk.nashorn.internal.scripts.Script$\^eval\_._L196(:232) > > ... > > > > > > Obviously, the application is near unresponsive under these > conditions > > (i.e. doesn't respond to actual requests from the outside, > though you > > can connect with jconsole / visualvm / jprofiler just fine and > observe > > it). CPU will be near 100% bound by these calls, too. > > > > Now there are a few interesting things to note that might help with > > diagnosis. > > Maybe most importantly, a full gc (we're using CMS, but > > CMSClassUnloadingEnabled does not need to be set) will stop the > > misbehaviour and will return the application to its normal state. > > Obviously, we'd rather not run full gcs all the time, but it's maybe > > also interesting to note that this can indeed be triggered by > setting > > (on jdk7) MaxPermSize low enough or not at all. Apparently the > garbage > > collector will always find enough space to clean up on PermGen > that it > > doesn't really need to grow above some threshold -- though the graph > > showing our PermGen consumption will then look like the one showing > > our Heap consumption (i.e. up and down all the time) and we don't > > really have good response times, understandably. So this is not an > > option to fix the problem, but might be a clue to what's going on. > > A kind of additional problem in this regard is that exhausted > PermGen > > / MetaSpace will nearly stop increasing under the problematic > > condition. Which, in turn, makes a full gc less likely to take > place. > > > > Another clue is that we have been able to make the problem > happen less > > often by dialing back on the amount of reference-replacement we > do on > > our nashorn-javascript-engines. I.e. those engines have engine-wide > > bindings (as according to the javax.script api) you can replace just > > by calling .put(bindingName, object) on the engine, even while other > > threads are involved in calls inside it. Now apparently this causes > > much relinking of callsites to be done and thus fosters our problem. > > > > Still, it's hard to tell what's going on for sure, as we have no > stack > > traces for what's happening inside the native code. I hope I could > > give you some idea. > > > > Best regards > > Benjamin > > > > > > _______________________________________________ > > mlvm-dev mailing list > > mlvm-dev at openjdk.java.net > > http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev > > _______________________________________________ > mlvm-dev mailing list > mlvm-dev at openjdk.java.net > http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev > > > > > -- > Benjamin Sieffert > metrigo GmbH > Sternstr. 106 > 20357 Hamburg > > Gesch?ftsf?hrer: Christian M?ller, Tobias Schlottke, Philipp Westermeyer > Die Gesellschaft ist eingetragen beim Registergericht Hamburg > Nr. HRB 120447. > > > _______________________________________________ > mlvm-dev mailing list > mlvm-dev at openjdk.java.net > http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev From benjamin.sieffert at metrigo.de Fri Sep 20 03:56:46 2013 From: benjamin.sieffert at metrigo.de (Benjamin Sieffert) Date: Fri, 20 Sep 2013 12:56:46 +0200 Subject: Calls to native methods setCallSiteTargetNormal and defineAnonymousClass taking very long In-Reply-To: <523C1D03.6090207@univ-mlv.fr> References: <523C12B4.40003@univ-mlv.fr> <523C1D03.6090207@univ-mlv.fr> Message-ID: R?mi, well I got into more detail on how we use nashorn on their mailing list, because I supposed this wouldn't be so much the issue here. Anyway, you're bringing up a point that they did not, so here's specifically what we do: Each of our ~200 javascripts is set up to return a "scriptrunner" object. This object is 100% javascript. For each javascript, we create a (Nashorn)ScriptEngine, because we need a few bindings to be different for each script. Before passing the javascript to the engine, we .put() the relevant bindings into it. Then we retrieve our javascript-side "scriptrunner" object by calling .compile(javascript).eval() on the engine. (So we get a compiled script at this point, but that is not the object we store and use.) Now the "scriptrunner" is set up to fit our needs. We work with it by calling engine.invokeMethod(scriptrunner, "methodname", arguments) (not possible with every ScriptEngine, but NashornScriptEngine supplies this functionality). So we're effectively calling eval not at all, at least not permanently. Looking at the nashorn-stacktraces, though, all their calls are jdk.nashorn.internal.scripts.Script$\^eval\_._L[line number](:[another line number]) I think it's just how they work internally. And to be honest, I'm not really sure if in our case the lone call to compile once is necessary, as a whole lot of optimization seems to only start happening when we start calling the scriptrunner and not when we create it. Regards, Benjamin -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.openjdk.java.net/pipermail/mlvm-dev/attachments/20130920/85d9e76c/attachment.html From blackdrag at gmx.org Fri Sep 20 04:16:12 2013 From: blackdrag at gmx.org (Jochen Theodorou) Date: Fri, 20 Sep 2013 13:16:12 +0200 Subject: Calls to native methods setCallSiteTargetNormal and defineAnonymousClass taking very long In-Reply-To: References: <523C12B4.40003@univ-mlv.fr> <523C1D03.6090207@univ-mlv.fr> Message-ID: <523C2E7C.8010008@gmx.org> Am 20.09.2013 12:56, schrieb Benjamin Sieffert: [...] > Then we retrieve our javascript-side "scriptrunner" object by calling > .compile(javascript).eval() on the engine. (So we get a compiled script > at this point, but that is not the object we store and use.) can't you reuse the compiled scripts? Depending no how that is implemented it could improve the situation > Now the "scriptrunner" is set up to fit our needs. We work with it by > calling engine.invokeMethod(scriptrunner, "methodname", arguments) (not > possible with every ScriptEngine, but NashornScriptEngine supplies this > functionality). > > So we're effectively calling eval not at all, at least not permanently. > Looking at the nashorn-stacktraces, though, all their calls are > jdk.nashorn.internal.scripts.Script$\^eval\_._L[line > number](:[another line number]) > I think it's just how they work internally. And to be honest, I'm not > really sure if in our case the lone call to compile once is necessary, > as a whole lot of optimization seems to only start happening when we > start calling the scriptrunner and not when we create it. if compile produces a new... let's say class, each time, then you get all the callsites and all the helper code new too. There might be internal compilation and optimization ongoing after compile, but it sounds to me as if nothing of that is going to be reused later, since you through the optimized result away. And next time, you start fresh. bye blackdrag -- Jochen "blackdrag" Theodorou - Groovy Project Tech Lead blog: http://blackdragsview.blogspot.com/ german groovy discussion newsgroup: de.comp.lang.misc For Groovy programming sources visit http://groovy-lang.org From benjamin.sieffert at metrigo.de Fri Sep 20 04:30:58 2013 From: benjamin.sieffert at metrigo.de (Benjamin Sieffert) Date: Fri, 20 Sep 2013 13:30:58 +0200 Subject: Calls to native methods setCallSiteTargetNormal and defineAnonymousClass taking very long In-Reply-To: <523C2E7C.8010008@gmx.org> References: <523C12B4.40003@univ-mlv.fr> <523C1D03.6090207@univ-mlv.fr> <523C2E7C.8010008@gmx.org> Message-ID: No, I think you misunderstand me. We are keeping the javascript(!) object we got from the compiled script and with it, I assume, we keep the compiled script / its optimization. We are in no way re-initializing scripts / script engines with every call. The problem is that we don't really have another way of passing our case-by-case variable into the javascript than storing the scriptrunner and going the invokeMethod-route, since nashorn is not threadsafe in a way that allows calling of CompiledScript.eval(Bindings) in parallel: The passed bindings will conflict with each other. The only bindings we can .put() into the engine are the ones supplying "shared" data that does only get read, not modified from inside the script. So for further concurrency we are stuck with building our own inside the javascript, by passing the relevant variables between functions and not exposing them globally. I really hope this explanation is understandable. 99,9% of our calls into js are this line: engine.invokeMethod(runner, "run", api); The "api" object is different every time, the engine and the runner are initialized once and don't get changed. 2013/9/20 Jochen Theodorou > Am 20.09.2013 12:56, schrieb Benjamin Sieffert: > [...] > > Then we retrieve our javascript-side "scriptrunner" object by calling > > .compile(javascript).eval() on the engine. (So we get a compiled script > > at this point, but that is not the object we store and use.) > > can't you reuse the compiled scripts? Depending no how that is > implemented it could improve the situation > > > Now the "scriptrunner" is set up to fit our needs. We work with it by > > calling engine.invokeMethod(scriptrunner, "methodname", arguments) (not > > possible with every ScriptEngine, but NashornScriptEngine supplies this > > functionality). > > > > So we're effectively calling eval not at all, at least not permanently. > > Looking at the nashorn-stacktraces, though, all their calls are > > jdk.nashorn.internal.scripts.Script$\^eval\_._L[line > > number](:[another line number]) > > I think it's just how they work internally. And to be honest, I'm not > > really sure if in our case the lone call to compile once is necessary, > > as a whole lot of optimization seems to only start happening when we > > start calling the scriptrunner and not when we create it. > > if compile produces a new... let's say class, each time, then you get > all the callsites and all the helper code new too. There might be > internal compilation and optimization ongoing after compile, but it > sounds to me as if nothing of that is going to be reused later, since > you through the optimized result away. And next time, you start fresh. > > bye blackdrag > > -- > Jochen "blackdrag" Theodorou - Groovy Project Tech Lead > blog: http://blackdragsview.blogspot.com/ > german groovy discussion newsgroup: de.comp.lang.misc > For Groovy programming sources visit http://groovy-lang.org > > _______________________________________________ > mlvm-dev mailing list > mlvm-dev at openjdk.java.net > http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev > -- Benjamin Sieffert metrigo GmbH Sternstr. 106 20357 Hamburg Gesch?ftsf?hrer: Christian M?ller, Tobias Schlottke, Philipp Westermeyer Die Gesellschaft ist eingetragen beim Registergericht Hamburg Nr. HRB 120447. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.openjdk.java.net/pipermail/mlvm-dev/attachments/20130920/e875d74e/attachment.html From vladimir.x.ivanov at oracle.com Fri Sep 20 08:29:46 2013 From: vladimir.x.ivanov at oracle.com (Vladimir Ivanov) Date: Fri, 20 Sep 2013 19:29:46 +0400 Subject: RFR (S) 8024599: JSR 292 direct method handles need to respect initialization rules for static members In-Reply-To: <239656DF-E18F-4F88-8983-38C3ECE15DD3@oracle.com> References: <2A858714-7C1D-4A3D-B971-E193E1E256D3@oracle.com> <239656DF-E18F-4F88-8983-38C3ECE15DD3@oracle.com> Message-ID: <523C69EA.3030107@oracle.com> John, I don't see much value in documenting buggy behavior of early JDK7 in JDK8 code. So, I would remove it. Regarding the test: 31 * @run main/othervm/timeout=3600 - why do you have timeout set to 1h? I like the idea how you count events. As a suggestion for enhancement - maybe it's more reliable to check the "type" of event as well? To ensure that particular class was initialized. Best regards, Vladimir Ivanov On 9/20/13 1:38 AM, John Rose wrote: > On Sep 12, 2013, at 7:24 PM, John Rose > wrote: > >> Please review this change for a change to the JSR 292 implementation: >> >> http://cr.openjdk.java.net/~jrose/8024599/webrev.00/ >> >> Summary: Align MH semantic with bytecode behavior of constructor and >> static member accesses, regarding invocation. >> >> The change is to javadoc and unit tests, documenting and testing some >> corner cases of JSR 292 APIs. > > I have a reviewer (Alex Buckley) for the documentation changes, but I > would also like a quick code review for the unit test. > > Also, there is a code insertion (predicated on a "false" symbolic > constant) which serves to document the buggy JDK 7 behavior. I'm not > particularly attached to it, so I'm open to either a yea or nay on > keeping it. Leaning nay at the moment. > > ? John > > > _______________________________________________ > mlvm-dev mailing list > mlvm-dev at openjdk.java.net > http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev > From vladimir.x.ivanov at oracle.com Fri Sep 20 15:07:12 2013 From: vladimir.x.ivanov at oracle.com (Vladimir Ivanov) Date: Sat, 21 Sep 2013 02:07:12 +0400 Subject: RFR (M) 8001110: method handles should have a collectArguments transform, generalizing asCollector In-Reply-To: <06D6C12B-CE7F-4180-8DD2-222B9CEE8CB8@oracle.com> References: <06D6C12B-CE7F-4180-8DD2-222B9CEE8CB8@oracle.com> Message-ID: <523CC710.5030806@oracle.com> John, I cleaned javadoc a little [1], so it is more readable in the browser now. The test code looks ok, though the logic is over-complicated. But the whole MethodHandlesTest is written in the same vein. Best regards, Vladimir Ivanov diff --git a/src/share/classes/java/lang/invoke/MethodHandles.java b/src/share/classes/java/lang/invoke/MethodHandles.java --- a/src/share/classes/java/lang/invoke/MethodHandles.java +++ b/src/share/classes/java/lang/invoke/MethodHandles.java @@ -2013,6 +2013,7 @@ *

* In all cases, {@code pos} must be greater than or equal to zero, and * {@code pos} must also be less than or equal to the target's arity. + *

* Example: *

  import static java.lang.invoke.MethodHandles.*;
@@ -2020,17 +2021,22 @@
  ...
  MethodHandle deepToString = publicLookup()
    .findStatic(Arrays.class, "deepToString", methodType(String.class, 
Object[].class));
+
  MethodHandle ts1 = deepToString.asCollector(String[].class, 1);
  assertEquals("[strange]", (String) ts1.invokeExact("strange"));
+
  MethodHandle ts2 = deepToString.asCollector(String[].class, 2);
  assertEquals("[up, down]", (String) ts2.invokeExact("up", "down"));
+
  MethodHandle ts3 = deepToString.asCollector(String[].class, 3);
  MethodHandle ts3_ts2 = collectArguments(ts3, 1, ts2);
  assertEquals("[top, [up, down], strange]",
               (String) ts3_ts2.invokeExact("top", "up", "down", 
"strange"));
+
  MethodHandle ts3_ts2_ts1 = collectArguments(ts3_ts2, 3, ts1);
  assertEquals("[top, [up, down], [strange]]",
               (String) ts3_ts2_ts1.invokeExact("top", "up", "down", 
"strange"));
+
  MethodHandle ts3_ts2_ts3 = collectArguments(ts3_ts2, 1, ts3);
  assertEquals("[top, [[up, down, strange], charm], bottom]",
               (String) ts3_ts2_ts3.invokeExact("top", "up", "down", 
"strange", "charm", "bottom"));


On 9/13/13 6:55 AM, John Rose wrote:
> Please review this change for a change to the JSR 292 implementation:
>
> http://cr.openjdk.java.net/~jrose/8001110/webrev.00/
>
> Summary: promote an existing private method; make unit tests on all argument positions to arity 10 with mixed types
>
> The change is to javadoc and unit tests, documenting and testing some corner cases of JSR 292 APIs.
>
> Bug Description:  Currently, a method handle can be transformed so that multiple arguments are collected and passed to the original method handle. However, the two routes to doing this are both limited to special purposes.
>
> (They are asCollector, which collects only trailing arguments, and only into an array; and foldArguments, which collects only leading arguments into filter function, and passes both the filtered result *and* the original arguments to the original.)
>
> MethodHandles.collectArguments(mh, pos, collector) should produce a method handle which acts like lambda(a*, b*, c*) { x = collector(b*); return mh(a*, x, c*) }, where the span of arguments b* is located by pos and the arity of the collector.
>
> There is internal machinery in any JSR 292 implementation to do this. It should be made available to users.
>
> This is a missing part of the JSR 292 spec.
>
> Thanks,
> ? John
>
> P.S. Since this is a change which oriented toward JSR 292 functionality, the review request is to mlvm-dev and core-libs-dev.
> Changes which are oriented toward performance will go to mlvm-dev and hotspot-compiler-dev.
>

From rose00 at me.com  Wed Sep 18 19:32:22 2013
From: rose00 at me.com (John Rose)
Date: Wed, 18 Sep 2013 19:32:22 -0700
Subject: RFR (S) 8001105: findVirtual of Object[].clone produces internal error
Message-ID: <19F72018-5EB4-4AAA-AC66-E18F0F9ECB13@me.com>

http://cr.openjdk.java.net/~jrose/8001105/webrev.00/

Summary: Replicate JVM logic for access control that makes Object.clone appear public when applied to an array type.

See: http://mail.openjdk.java.net/pipermail/mlvm-dev/2012-October/005035.html

? John



From benjamin.sieffert at metrigo.de  Thu Sep 19 01:37:21 2013
From: benjamin.sieffert at metrigo.de (Benjamin Sieffert)
Date: Thu, 19 Sep 2013 10:37:21 +0200
Subject: Calls to native methods setCallSiteTargetNormal and
	defineAnonymousClass taking very long
Message-ID: 

Hello everyone,

I have been sent over her from the nashorn-dev mailing list. We're having
trouble with our application getting (rather randomly) very busy with calls
to the methods mentioned in the topic. On jdk8, that is. On jdk7, we're
exclusively seeing setCallSiteTargetNormal. This probably has to do with
LambdaForms not being in use on jdk7. Anyway, we're running roughly the
following setup:

- application mantle in JRuby
- application core in Java
- at the VERY core: highly repetitive javascript run via java (switched
from rhino to nashorn recently there)

It's a kind of webserver handling about 2-3k reqeusts per second. Each
request will result in a few dozen calls to our javascript. Since we need
our response times to be as low as possible, we'll not do the
javascript-calls serially, but commit them all to an executor running on a
number of threads equal to the number of available cores (usually 16 or 24
on our machines, 64bit-linux), so that ideally we'll use all cores for
every single request.

In summary: High level of concurrency, huge number of classes and nmethods
generated at runtime (both by jruby and nashorn).
(Some numbers after 20+ hours. jdk8: 140.000 classes live, 1M unloaded.
800mb metaspace exhausted; jdk7: 14.000 live, 2.000 unloaded. 500mb permgen
exhausted)

As for our actual problem, like I said, it's that sometimes all our worker
threads will start to be 100% busy and, when looking at the stack traces,
will all be in one of those two:

1.
at java.lang.invoke.MethodHandleNatives.setCallSiteTargetNormal(Native
Method)
at java.lang.invoke.CallSite.setTargetNormal(CallSite.java:245)
at java.lang.invoke.MutableCallSite.setTarget(MutableCallSite.java:154)
at
jdk.internal.dynalink.support.AbstractRelinkableCallSite.initialize(AbstractRelinkableCallSite.java:115)
at jdk.internal.dynalink.DynamicLinker.link(DynamicLinker.java:184)
at
jdk.nashorn.internal.runtime.linker.Bootstrap.bootstrap(Bootstrap.java:126)
at
java.lang.invoke.LambdaForm$DMH/272755642.invokeStatic_LLLI_L(LambdaForm$DMH)
... (omitting a few invocations of LambdaForm methods)
at java.lang.invoke.LambdaForm$MH/839784351.invoke_MT(LambdaForm$MH)
at java.lang.invoke.CallSite.makeSite(CallSite.java:283)
at
java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:294)
at jdk.nashorn.internal.scripts.Script$\^eval\_._L196(:231)
...

2.
at sun.misc.Unsafe.defineAnonymousClass(Native Method)
at
java.lang.invoke.InvokerBytecodeGenerator.loadAndInitializeInvokerClass(InvokerBytecodeGenerator.java:262)
at
java.lang.invoke.InvokerBytecodeGenerator.loadMethod(InvokerBytecodeGenerator.java:250)
at
java.lang.invoke.InvokerBytecodeGenerator.generateCustomizedCode(InvokerBytecodeGenerator.java:509)
at java.lang.invoke.LambdaForm.compileToBytecode(LambdaForm.java:454)
at java.lang.invoke.LambdaForm.checkInvocationCounter(LambdaForm.java:634)
... (omitting a few invocations of LambdaForm methods)
at java.lang.invoke.LambdaForm$LFI/1682860686.interpret_L(LambdaForm$LFI)
at java.lang.invoke.LambdaForm$MH/1997512181.linkToCallSite(LambdaForm$MH)
at jdk.nashorn.internal.scripts.Script$\^eval\_._L196(:232)
...


Obviously, the application is near unresponsive under these conditions
(i.e. doesn't respond to actual requests from the outside, though you can
connect with jconsole / visualvm / jprofiler just fine and observe it). CPU
will be near 100% bound by these calls, too.

Now there are a few interesting things to note that might help with
diagnosis.
Maybe most importantly, a full gc (we're using CMS, but
CMSClassUnloadingEnabled does not need to be set) will stop the
misbehaviour and will return the application to its normal state.
Obviously, we'd rather not run full gcs all the time, but it's maybe also
interesting to note that this can indeed be triggered by setting (on jdk7)
MaxPermSize low enough or not at all. Apparently the garbage collector will
always find enough space to clean up on PermGen that it doesn't really need
to grow above some threshold -- though the graph showing our PermGen
consumption will then look like the one showing our Heap consumption (i.e.
up and down all the time) and we don't really have good response times,
understandably. So this is not an option to fix the problem, but might be a
clue to what's going on.
A kind of additional problem in this regard is that exhausted PermGen /
MetaSpace will nearly stop increasing under the problematic condition.
Which, in turn, makes a full gc less likely to take place.

Another clue is that we have been able to make the problem happen less
often by dialing back on the amount of reference-replacement we do on our
nashorn-javascript-engines. I.e. those engines have engine-wide bindings
(as according to the javax.script api) you can replace just by calling
.put(bindingName, object) on the engine, even while other threads are
involved in calls inside it. Now apparently this causes much relinking of
callsites to be done and thus fosters our problem.

Still, it's hard to tell what's going on for sure, as we have no stack
traces for what's happening inside the native code. I hope I could give you
some idea.

Best regards
Benjamin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/mlvm-dev/attachments/20130919/59175acb/attachment.html 

From john.r.rose at oracle.com  Fri Sep 20 17:09:07 2013
From: john.r.rose at oracle.com (John Rose)
Date: Fri, 20 Sep 2013 17:09:07 -0700
Subject: RFR (M) 8001110: method handles should have a collectArguments
	transform, generalizing asCollector
In-Reply-To: <523CC710.5030806@oracle.com>
References: <06D6C12B-CE7F-4180-8DD2-222B9CEE8CB8@oracle.com>
	<523CC710.5030806@oracle.com>
Message-ID: 

On Sep 20, 2013, at 3:07 PM, Vladimir Ivanov  wrote:

> I cleaned javadoc a little [1], so it is more readable in the browser now.

Thanks; I applied those edits.  I fixed the problem of a missing 

in a few other places too. > The test code looks ok, though the logic is over-complicated. > But the whole MethodHandlesTest is written in the same vein. Thanks. (Looks like it wasn't written by a real test engineer.) ? John -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.openjdk.java.net/pipermail/mlvm-dev/attachments/20130920/6827b3b3/attachment.html From john.r.rose at oracle.com Fri Sep 20 18:18:05 2013 From: john.r.rose at oracle.com (John Rose) Date: Fri, 20 Sep 2013 18:18:05 -0700 Subject: RFR (S) 8024599: JSR 292 direct method handles need to respect initialization rules for static members In-Reply-To: <523C69EA.3030107@oracle.com> References: <2A858714-7C1D-4A3D-B971-E193E1E256D3@oracle.com> <239656DF-E18F-4F88-8983-38C3ECE15DD3@oracle.com> <523C69EA.3030107@oracle.com> Message-ID: <11945016-EBBA-48B6-8881-5648BD285BE7@oracle.com> On Sep 20, 2013, at 8:29 AM, Vladimir Ivanov wrote: > John, > > I don't see much value in documenting buggy behavior of early JDK7 in JDK8 code. So, I would remove it. OK. I think I had it in mainly to make sure the unit tests did something interesting. > Regarding the test: > 31 * @run main/othervm/timeout=3600 > - why do you have timeout set to 1h? Copy-and-paste from some other test. Removed. > I like the idea how you count events. > > As a suggestion for enhancement - maybe it's more reliable to check the "type" of event as well? To ensure that particular class was initialized. Good idea. But since each unique init event is stored in a separate variable, it's easy to check this without explicit event types. I did the following, for each of the six test cases: @@ -150,9 +150,11 @@ } private static int runFoo() throws Throwable { + assertEquals(Init1Tick, 0); // Init1 not initialized yet int t1 = tick("runFoo"); int t2 = (int) INDY_foo().invokeExact(); int t3 = tick("runFoo done"); + assertEquals(Init1Tick, t2); // when Init1 was initialized assertEquals(t1+2, t3); // exactly two ticks in between assertEquals(t1+1, t2); // init happened inside return t2; ? John > Best regards, > Vladimir Ivanov > > On 9/20/13 1:38 AM, John Rose wrote: >> On Sep 12, 2013, at 7:24 PM, John Rose > > wrote: >> >>> Please review this change for a change to the JSR 292 implementation: >>> >>> http://cr.openjdk.java.net/~jrose/8024599/webrev.00/ >>> >>> Summary: Align MH semantic with bytecode behavior of constructor and >>> static member accesses, regarding invocation. >>> >>> The change is to javadoc and unit tests, documenting and testing some >>> corner cases of JSR 292 APIs. >> >> I have a reviewer (Alex Buckley) for the documentation changes, but I >> would also like a quick code review for the unit test. >> >> Also, there is a code insertion (predicated on a "false" symbolic >> constant) which serves to document the buggy JDK 7 behavior. I'm not >> particularly attached to it, so I'm open to either a yea or nay on >> keeping it. Leaning nay at the moment. >> >> ? John >> >> >> _______________________________________________ >> mlvm-dev mailing list >> mlvm-dev at openjdk.java.net >> http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev >> From morris.meyer at oracle.com Sat Sep 21 02:34:17 2013 From: morris.meyer at oracle.com (Morris Meyer) Date: Sat, 21 Sep 2013 05:34:17 -0400 Subject: RFR (S) 8001105: findVirtual of Object[].clone produces internal error In-Reply-To: <19F72018-5EB4-4AAA-AC66-E18F0F9ECB13@me.com> References: <19F72018-5EB4-4AAA-AC66-E18F0F9ECB13@me.com> Message-ID: <4AFDBF02-CFAE-40ED-9BCB-BC53B769AEC2@oracle.com> This looks good. Might want to point out where in HotSpot this change originates from in your comment. --mm > On Sep 18, 2013, at 10:32 PM, John Rose wrote: > > http://cr.openjdk.java.net/~jrose/8001105/webrev.00/ > > Summary: Replicate JVM logic for access control that makes Object.clone appear public when applied to an array type. > > See: http://mail.openjdk.java.net/pipermail/mlvm-dev/2012-October/005035.html > > ? John > > > _______________________________________________ > mlvm-dev mailing list > mlvm-dev at openjdk.java.net > http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev From francis.andre.kampbell at orange.fr Wed Sep 25 10:52:19 2013 From: francis.andre.kampbell at orange.fr (Francis ANDRE) Date: Wed, 25 Sep 2013 19:52:19 +0200 Subject: JDK7u, hotspot, CC_INTERP, and COBOL Message-ID: <524322D3.4050000@orange.fr> Hi On WXP with VS2010 and the http://hg.openjdk.java.net/jdk7u/jdk7u/hotspot/ repository, I successfully build and ran the debug version of hotspot in compiler1 directory. fine Next, I tried to get working the bytecode cppInterpreter instead of the template based interpreter adding the CC_INTERP=true preprocessor define, but I got several compile errors -- see below -- By looking at the Wiki and the OpenJDK website, I discovered that the cppInterpreter was no more maintained. So I am wondering why the cppInterpreter is not anymore maintained and would like to understand if this decision is definitive or not, because it seems to me that there are very few errors. (see above) and that, IMHO, a somewhat small effort should be made to fix the cppInterpreter (but it could be totally wrong). I need the cppInterpreter to make a proposal to the MLVM project to slightly change the JVM spec for all xALOAD and xASTORE bytecodes for a specific class version number for an efficient support of a _COBOL __runtime_. Regards Francis cppInterpreter_x86.cpp 1> frame_x86.cpp 1> interpreter_x86_32.cpp 1> interp_masm_x86_32.cpp 1>..\..\src\cpu\x86\vm\frame_x86.cpp(691): error C2039: 'interpreter_frame_sender_sp_offset' : n'est pas membre de 'frame' 1> Z:\DEV\OpenJDK7u\hotspot\src\share\vm\runtime/frame.hpp(73) : voir la d?claration de 'frame' 1>..\..\src\cpu\x86\vm\frame_x86.cpp(691): error C2065: 'interpreter_frame_sender_sp_offset' : identificateur non d?clar? 1>..\..\src\cpu\x86\vm\frame_x86.cpp(692): error C2039: 'interpreter_frame_last_sp_offset' : n'est pas membre de 'frame' 1> Z:\DEV\OpenJDK7u\hotspot\src\share\vm\runtime/frame.hpp(73) : voir la d?claration de 'frame' 1>..\..\src\cpu\x86\vm\frame_x86.cpp(692): error C2065: 'interpreter_frame_last_sp_offset' : identificateur non d?clar? 1>..\..\src\cpu\x86\vm\frame_x86.cpp(693): error C2039: 'interpreter_frame_method_offset' : n'est pas membre de 'frame' 1> Z:\DEV\OpenJDK7u\hotspot\src\share\vm\runtime/frame.hpp(73) : voir la d?claration de 'frame' 1>..\..\src\cpu\x86\vm\frame_x86.cpp(693): error C2065: 'interpreter_frame_method_offset' : identificateur non d?clar? 1>..\..\src\cpu\x86\vm\frame_x86.cpp(694): error C2039: 'interpreter_frame_mdx_offset' : n'est pas membre de 'frame' 1> Z:\DEV\OpenJDK7u\hotspot\src\share\vm\runtime/frame.hpp(73) : voir la d?claration de 'frame' 1>..\..\src\cpu\x86\vm\frame_x86.cpp(694): error C2065: 'interpreter_frame_mdx_offset' : identificateur non d?clar? 1>..\..\src\cpu\x86\vm\frame_x86.cpp(695): error C2039: 'interpreter_frame_cache_offset' : n'est pas membre de 'frame' 1> Z:\DEV\OpenJDK7u\hotspot\src\share\vm\runtime/frame.hpp(73) : voir la d?claration de 'frame' 1>..\..\src\cpu\x86\vm\frame_x86.cpp(695): error C2065: 'interpreter_frame_cache_offset' : identificateur non d?clar? 1>..\..\src\cpu\x86\vm\frame_x86.cpp(696): error C2039: 'interpreter_frame_locals_offset' : n'est pas membre de 'frame' 1> Z:\DEV\OpenJDK7u\hotspot\src\share\vm\runtime/frame.hpp(73) : voir la d?claration de 'frame' 1>..\..\src\cpu\x86\vm\frame_x86.cpp(696): error C2065: 'interpreter_frame_locals_offset' : identificateur non d?clar? 1>..\..\src\cpu\x86\vm\frame_x86.cpp(697): error C2039: 'interpreter_frame_bcx_offset' : n'est pas membre de 'frame' 1> Z:\DEV\OpenJDK7u\hotspot\src\share\vm\runtime/frame.hpp(73) : voir la d?claration de 'frame' 1>..\..\src\cpu\x86\vm\frame_x86.cpp(697): error C2065: 'interpreter_frame_bcx_offset' : identificateur non d?clar? 1>..\..\src\cpu\x86\vm\frame_x86.cpp(698): error C2039: 'interpreter_frame_initial_sp_offset' : n'est pas membre de 'frame' 1> Z:\DEV\OpenJDK7u\hotspot\src\share\vm\runtime/frame.hpp(73) : voir la d?claration de 'frame' 1>..\..\src\cpu\x86\vm\frame_x86.cpp(698): error C2065: 'interpreter_frame_initial_sp_offset' : identificateur non d?clar? 1> sharedRuntime_x86_32.cpp 1>..\..\src\cpu\x86\vm\interp_masm_x86_32.cpp(56): error C2220: avertissement consid?r? comme une erreur - aucun fichier 'object' g?n?r? 1>..\..\src\cpu\x86\vm\interp_masm_x86_32.cpp(56): warning C4146: op?rateur moins unaire appliqu? ? un type non sign?, le r?sultat sera non sign? 1>..\..\src\cpu\x86\vm\interp_masm_x86_32.cpp(1414): error C2039: 'increment_mask_and_jump' : n'est pas membre de 'InterpreterMacroAssembler' 1> z:\dev\openjdk7u\hotspot\src\cpu\x86\vm\interp_masm_x86_32.hpp(34) : voir la d?claration de 'InterpreterMacroAssembler' 1>..\..\src\cpu\x86\vm\interp_masm_x86_32.cpp(1417): error C2061: erreur de syntaxe : identificateur 'Condition' 1>..\..\src\cpu\x86\vm\interp_masm_x86_32.cpp(1419): error C3861: 'movl' : identificateur introuvable 1>..\..\src\cpu\x86\vm\interp_masm_x86_32.cpp(1421): error C3861: 'incrementl' : identificateur introuvable 1>..\..\src\cpu\x86\vm\interp_masm_x86_32.cpp(1422): error C3861: 'movl' : identificateur introuvable 1>..\..\src\cpu\x86\vm\interp_masm_x86_32.cpp(1423): error C3861: 'andl' : identificateur introuvable 1>..\..\src\cpu\x86\vm\interp_masm_x86_32.cpp(1424): error C2065: 'cond' : identificateur non d?clar? 1>..\..\src\cpu\x86\vm\interp_masm_x86_32.cpp(1424): error C2065: 'where' : identificateur non d?clar? 1>..\..\src\cpu\x86\vm\interp_masm_x86_32.cpp(1424): error C3861: 'jcc' : identificateur introuvable 1>..\..\src\cpu\x86\vm\interpreter_x86_32.cpp(233): error C2039: 'empty_expression_stack' : n'est pas membre de 'InterpreterMacroAssembler' 1> Z:\DEV\OpenJDK7u\hotspot\src\cpu\x86\vm\interp_masm_x86_32.hpp(34) : voir la d?claration de 'InterpreterMacroAssembler' 1>..\..\src\cpu\x86\vm\interpreter_x86_32.cpp(235): error C2039: 'restore_locals' : n'est pas membre de 'InterpreterMacroAssembler' 1> Z:\DEV\OpenJDK7u\hotspot\src\cpu\x86\vm\interp_masm_x86_32.hpp(34) : voir la d?claration de 'InterpreterMacroAssembler' 1>..\..\src\cpu\x86\vm\cppInterpreter_x86.cpp(2211): error C2039: 'method_handle' : n'est pas membre de 'Interpreter' 1> Z:\DEV\OpenJDK7u\hotspot\src\share\vm\interpreter/interpreter.hpp(143) : voir la d?claration de 'Interpreter' 1>..\..\src\cpu\x86\vm\cppInterpreter_x86.cpp(2211): error C2065: 'method_handle' : identificateur non d?clar? 1>..\..\src\cpu\x86\vm\cppInterpreter_x86.cpp(2211): error C2051: l'expression associ?e ? case n'est pas une constante 1>..\..\src\cpu\x86\vm\cppInterpreter_x86.cpp(2211): error C2039: 'generate_method_handle_entry' : n'est pas membre de 'InterpreterGenerator' 1> Z:\DEV\OpenJDK7u\hotspot\src\share\vm\interpreter/interpreterGenerator.hpp(37) : voir la d?claration de 'InterpreterGenerator' 1>..\..\src\cpu\x86\vm\cppInterpreter_x86.cpp(2255): error C2064: le terme ne correspond pas ? une fonction qui prend 0 arguments 1>..\..\src\cpu\x86\vm\sharedRuntime_x86_32.cpp(3062): error C2220: avertissement consid?r? comme une erreur - aucun fichier 'object' g?n?r? 1>..\..\src\cpu\x86\vm\sharedRuntime_x86_32.cpp(3062): warning C4146: op?rateur moins unaire appliqu? ? un type non sign?, le r?sultat sera non sign? ========== G?n?ration : 0 a r?ussi, 1 a ?chou?, 0 mis ? jour, 0 a ?t? ignor? ========== -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.openjdk.java.net/pipermail/mlvm-dev/attachments/20130925/4d587168/attachment.html From blackdrag at gmx.org Thu Sep 26 07:20:23 2013 From: blackdrag at gmx.org (Jochen Theodorou) Date: Thu, 26 Sep 2013 16:20:23 +0200 Subject: jdk8 metaspace problem with indy Message-ID: <524442A7.704@gmx.org> Hi all, probably not such a good time to ask, since many of those, that could answer this might be on JavaOne... but still On the user list we got an interesting program that makes quite some problems to the jvm as it seems. The groovy program looks like this: > println "Started" > for(int i = 0; i < 100; i++) { > print "." > for (int j=0;j<100000;j++) { > Container c = new Container() > c.run() > } > } > println "\ndone" > > public class Container implements Runnable { > public Container() {} > public void run() { > GroovyShell gs = new GroovyShell() > Script script = gs.parse("") > script.run() > } > } What happens is that gs.parse will create a new script and a new class every time. Now using our custom call site code this works fine. Using the indy port, it fails with a permgen error on any jdk7 before u40. On u40 this works fine again. In jdk8 this fails sometimes with a metaspace error, while in u40 it seems to work quite reliable. The problem must be more than just creating many classes, because our custom callsite caching creates just as many classes for the scripts as the indy version does. What does not happen so much there though is code generated by reflection and of course non from indy. So I especially suspect the code cache here to be responsible for the problem, but I have no real basis for this. I lack the means to diagnose the problem further Is there a way to make this work on older jdk7 vms? And is there a way for me to make this work on jdk8? Do others here have similar experiences? bye Jochen -- Jochen "blackdrag" Theodorou - Groovy Project Tech Lead blog: http://blackdragsview.blogspot.com/ german groovy discussion newsgroup: de.comp.lang.misc For Groovy programming sources visit http://groovy-lang.org From christian.thalinger at oracle.com Thu Sep 26 18:46:23 2013 From: christian.thalinger at oracle.com (Christian Thalinger) Date: Thu, 26 Sep 2013 18:46:23 -0700 Subject: RFR (L) 8024761: JSR 292 improve performance of generic invocation In-Reply-To: <0F691222-C21B-416E-B029-D8CA7D8ADFE0@oracle.com> References: <69A734BA-67A8-4BA2-9A8B-075E455327A3@oracle.com> <0F691222-C21B-416E-B029-D8CA7D8ADFE0@oracle.com> Message-ID: <321B997C-A151-4162-BF5E-6E37F413AC4B@oracle.com> On Sep 18, 2013, at 6:43 PM, John Rose wrote: > On Sep 18, 2013, at 2:11 PM, Christian Thalinger wrote: > >> src/share/classes/java/lang/invoke/CallSite.java: >> >> + if (3 + argv.length > MethodType.MAX_MH_ARITY) >> + MethodType invocationType = MethodType.genericMethodType(3 + argv.length); >> + MethodHandle spreader = invocationType.invokers().spreadInvoker(3); >> >> Could we use a defined constant for "3"? > > Yes. >> >> src/share/classes/java/lang/invoke/Invokers.java: >> >> + if (targetType == targetType.erase() && targetType.parameterCount() < 10) >> >> The same here for "10". > > Fixed; factored to a subroutine. > >> Actually, exactInvoker and generalInvoker's code could be factored into one method. >> >> + /*non-public*/ MethodHandle basicInvoker() { >> + //invoker.form.compileToBytecode(); > > Done. > >> Please remove commented lines. >> >> + static MemberName exactInvokeLinkerMethod(MethodType mtype, Object[] appendixResult) { >> + static MemberName genericInvokeLinkerMethod(MethodType mtype, Object[] appendixResult) { >> >> These two could also be factored into one method. > > Done. I removed those two, and called the one new method from MethodHandleNatives. > >> + // Return an adapter for invokeExact or generic invoke, as a MH or constant pool linker >> + // mtype : the caller's method type (either basic or full-custom) >> + // customized : whether to use a trailing appendix argument (to carry the mtype) >> + // which&0x01 : whether it is a CP adapter ("linker") or MHs.invoker value ("invoker") >> + // which&0x02 : whether it is for invokeExact or generic invoke >> + // >> + // If !customized, caller is responsible for supplying, during adapter execution, >> + // a copy of the exact mtype. This is because the adapter might be generalized to >> + // a basic type. >> + private static LambdaForm invokeHandleForm(MethodType mtype, boolean customized, int which) { >> >> Why are you not using Javadoc style for this method comment? It's still helpful in IDEs. > > Fixed. > >> src/share/classes/java/lang/invoke/LambdaForm.java: >> >> static void traceInterpreter(String event, Object obj, Object... args) { >> + if (!(TRACE_INTERPRETER && INIT_DONE)) return; > > Done. >> >> Why not use the same pattern: >> >> + if (TRACE_INTERPRETER && INIT_DONE) >> >> as the other places? >> >> + static final boolean INIT_DONE = Boolean.TRUE.booleanValue(); >> >> Why are we having this after all? > > I removed it; see webrev. There's a comment which explains the problem and the nicer replacement. Good comment. Thank you. > >> src/share/classes/java/lang/invoke/MemberName.java: >> >> + public MemberName asNormalOriginal() { >> >> Could you add a comment to this method? It's not clear to me what "normal" and "original" mean here. > > Done. > >> + public MemberName(byte refKind, Class defClass, String name, Object type) { >> + @SuppressWarnings("LocalVariableHidesMemberVariable") >> + int kindFlags; >> >> The SuppressWarnings is in the other constructors because of the name "flags". You don't need it here. Maybe rename the others as well and get rid of the annotation. > > OK; I removed 2/3 of them. > >> src/share/classes/java/lang/invoke/MethodHandleNatives.java: >> >> static String refKindName(byte refKind) { >> assert(refKindIsValid(refKind)); >> - return REFERENCE_KIND_NAME[refKind]; >> + switch (refKind) { >> >> After this change REFERENCE_KIND_NAME is not used anymore. > > Good catch. > >> src/share/classes/java/lang/invoke/MethodHandles.java: >> >> + member.getName().getClass(); member.getType().getClass(); // NPE >> >> Please don't! It would be nice to have at least a different line number in the backtrace. > > OK. I split three such lines. > > I would like to switch all these to Objects.requireNonNull, but only after a little performance testing to make sure we don't have surprises. > >> src/share/classes/java/lang/invoke/MethodTypeForm.java: >> >> + //Lookup.findVirtual(MethodHandle.class, name, type); >> >> Either remove it or add a comment why it's there. > > Commented better now. > > While testing, I found a spot in BoundMethodHandle that needed a tweak to avoid a bootstrap problem. (Too many of those.) > > I sharpened the type of 'caller' in CallSite.makeSite. > > The webrev is updated: > http://cr.openjdk.java.net/~jrose/8024761/webrev.01/ This looks good. > > Thanks! > > ? John > >> On Sep 12, 2013, at 6:36 PM, John Rose wrote: >> >>> Please review this change for a change to the JSR 292 implementation: >>> >>> http://cr.openjdk.java.net/~jrose/8024761/webrev.00/ >>> >>> Bug description: The performance of MethodHandle.invoke is very slow when the call site type differs from the method handle type. When the types differ, the invocation is defined to proceed as if two steps were taken: >>> >>> 1. the target method handle is first adjusted to the call site type, by MethodHandles.asType >>> >>> 2. the type-adjusted method handle is invoked directly, by MethodHandles.invokeExact >>> >>> The existing code (from JDK 7) awkwardly performs the type adjustment on every call. But performing the type analysis and adapter creation on every call is inherently slow. A good fix is to cache the result of step 1 (MethodHandles.asType), since step 2 is already reasonably fast. >>> >>> For most applications, a one-element cache on each individual method handle is a reasonable choice. It has the particular advantage of speeding up invocations of non-varargs bootstrap methods. To benefit from this, the bootstrap methods themselves need to be uniquified across multiple class files, so this work will also include a cache to benefit commonly-used bootstrap methods, such as JDK 8's LambdaMetafactory.metafactory. >>> >>> Additional caches could be based on the call site, the call site type, the target type, or the target's MH.form. >>> >>> Thanks, >>> ? John >>> >>> P.S. Since this is an implementation change oriented toward performance, the review request is to mlvm-dev and hotspot-compiler-dev. >>> Changes which are oriented toward functionality will go to mlvm-dev and core-libs-dev. >> > > _______________________________________________ > mlvm-dev mailing list > mlvm-dev at openjdk.java.net > http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev From christian.thalinger at oracle.com Thu Sep 26 18:52:01 2013 From: christian.thalinger at oracle.com (Christian Thalinger) Date: Thu, 26 Sep 2013 18:52:01 -0700 Subject: RFR(S+M) / 8022701 Accessibility checking: InvocationTargetException is thrown instead of IllegalAccessError In-Reply-To: References: <143F40F0-557E-48EA-9207-0FF1880663DF@oracle.com> <5229F4B8.9000506@oracle.com> <64E60D4E-0829-4B23-9EE7-61AD28DB7E2F@oracle.com> <49B1A36F-6C45-4E92-80D2-FA6F80A238CB@oracle.com> <2F83E9C4-B28A-4385-8FFB-78F1313A931F@oracle.com> <6F0563F9-7A78-42C7-9296-53991C18D5CA@oracle.com> <31FAE0CA-5EDD-4014-AED9-27533E53307F@oracle.com> <9092C3F3-EA5A-4748-BD67-0423F1B8964E@oracle.com> Message-ID: <70118D67-B367-461B-A4F2-04B2FB18047D@oracle.com> On Sep 19, 2013, at 9:57 AM, David Chase wrote: > Recommended changes made: > > http://cr.openjdk.java.net/~drchase/8022701/webrev.04/ Looks good. Thanks for using ASM. > > Test with jtreg (for pass and for induced failure) on MacOS, > not sure what additional other testing is desired since it is entirely in the libraries. > > I included code to handle the case of a broken field-referencing methodhandle, > but did not test it because there's no syntax for these in Java, nor is their creation > well-documented. > > David > > > On 2013-09-13, at 12:02 AM, John Rose wrote: > >> On Sep 12, 2013, at 5:44 PM, David Chase wrote: >> >>> Do these sibling bugs have numbers? >> >> Yes, 8022701. I just updated the bug to explain their common genesis. >> >>> And I take it you would like to see >>> >>> 1) a test enhanced with ASM to do all 3 variants of this >> >> Yes, please. The case of "no such field" does not have a direct cause from lambda expressions AFAIK, but it can occur with "raw" CONSTANT_MethodHandles. (It would be reasonable for javac to emit CONSTANT_MH's for fields in some very limited circumstances, but I'll bet it doesn't.) >> >>> 2) DO attach the underlying cause >> >> Yes. Read the javadoc for ExceptionInInitializerError for an example of why users want the underlying cause for linkage errors. >> >> (Golly, I wonder what happens if resolution of a CONSTANT_MethodHandle tries to touch a class with a booby-trapped . I hope it's the case that the ExceptionInInitializerError just passes straight up the stack. But if it were to get wrapped in a ROE of some sort, it would probably bubble up as an IAE. Could be a charming exploration. Actually, no, I don't want to go in there. Getting all possible linkage errors correct is fine, but we have more important things to do.) >> >> ? John >> >>> David >>> >>> On 2013-09-12, at 5:35 PM, John Rose wrote: >>> >>>> It looks good. I have three requests. >>>> >>>> Regarding this comment: >>>> + * See MethodSupplier.java to see how to produce these bytes. >>>> + * They encode that class, except that method m is private, not public. >>>> >>>> The recipe is incomplete, since it does not say which bits to tweak to make m private. Please add that step to the comments more explicitly, or if possible to the code (so bogusMethodSupplier is a clean copy of the od output). I suppose you could ask sed to change the byte for you. That will make this test a better example for future tests, and make it easier to maintain if javac output changes. The high road to use would be asm, although for a single byte tweak od works OK. >>>> >>>> Also, this bug has two twins. The same thing will happen with NoSuchMethodE* and NoSuchFieldE*. Can you please make fixes for those guys also? >>>> >>>> FTR, see MemberName.makeAccessException() for logic which maps the other way, from *Error to *Exception. I don't see a direct way to avoid the double mapping (Error=>Exception=>Error) when it occurs. >>>> >>>> For the initCause bit we should do this: >>>> >>>> } catch (IllegalAccessException ex) { >>>> Error err = new IllegalAccessError(ex.getMessage()); >>>> err.initCause(ex.getCause()); // reuse underlying cause of ex >>>> throw err; >>>> } ... and for NSME and NSFE... >>>> >>>> That way users can avoid the duplicate exception but can see any underlying causes that the JVM may include. >>>> >>>> Thanks for untangling this! >>>> >>>> ? John >>>> >>>> On Sep 12, 2013, at 12:17 PM, David Chase wrote: >>>> >>>>> The test is adapted from the test in the bug report. >>>>> The headline on the bug report is wrong -- because it uses reflection in the test to do the invocation, >>>>> the thrown exception is wrapped with InvocationTargetException, which is completely correct. >>>>> HOWEVER, the exception inside the wrapper is the wrong one. >>>>> >>>>> The new test checks the exception in both the reflective-invocation and plain-invocation cases, >>>>> and also checks both a method handle call (which threw the wrong exception) and a plain >>>>> call (which threw, and throws, the right exception). >>>>> >>>>> The test also uses a tweaked classloader to substitute the borked bytecodes necessary to get >>>>> the error, so it is not only shell-free, it can also be run outside jtreg. >>>>> >>>>> On 2013-09-12, at 2:34 PM, Christian Thalinger wrote: >>>>> >>>>>> >>>>>> On Sep 12, 2013, at 11:28 AM, David Chase wrote: >>>>>> >>>>>>> New webrev, commented line removed: >>>>>>> http://cr.openjdk.java.net/~drchase/8022701/webrev.03/ >>>>>> >>>>>> I think the change is good given that the tests work now. Is your test derived from the test in the bug report? >>>>>> >>>>>> And it would be good if John could also have a quick look (just be to be sure). >>>>>> >>>>>> -- Chris >>>>>> >>>>>>> >>>>>>> On 2013-09-12, at 1:53 PM, David Chase wrote: >>>>>>> >>>>>>>> I believe it produced extraneous output -- it was not clear to me that it was either necessary or useful to fully describe all the converted exceptions that lead to the defined exception being thrown. The commented line should have just been removed (I think). >>>>>>>> >>>>>>>> On 2013-09-12, at 1:24 PM, Christian Thalinger wrote: >>>>>>>> >>>>>>>>> + // err.initCause(ex); >>>>>>>>> >>>>>>>>> Why is this commented? >>>>>>>>> >>>>>>>>> -- Chris >>>>>>> >>>>>> >>>>> >>>>> _______________________________________________ >>>>> mlvm-dev mailing list >>>>> mlvm-dev at openjdk.java.net >>>>> http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev >>>> >>> >> > > _______________________________________________ > mlvm-dev mailing list > mlvm-dev at openjdk.java.net > http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev From christian.thalinger at oracle.com Thu Sep 26 18:55:00 2013 From: christian.thalinger at oracle.com (Christian Thalinger) Date: Thu, 26 Sep 2013 18:55:00 -0700 Subject: RFR (S) 8001108: an attempt to use "" as a method name should elicit NoSuchMethodException In-Reply-To: <99860D39-C18B-4638-94BB-12084139AE1E@oracle.com> References: <6FAC275C-6374-41F5-BAB7-CA1AC729EF9F@oracle.com> <09F68115-21E6-450C-8DC2-6FCDB6C191B4@oracle.com> <99860D39-C18B-4638-94BB-12084139AE1E@oracle.com> Message-ID: <35BFE992-4E0C-4816-851B-EE871FA375F2@oracle.com> On Sep 19, 2013, at 2:31 PM, John Rose wrote: > > On Sep 18, 2013, at 5:05 PM, Christian Thalinger wrote: > >> src/share/classes/java/lang/invoke/MethodHandles.java: >> >> + * methods as if they were normal methods, but the JVM verifier rejects them. >> >> I think you should say "JVM byte code verifier" here. > > Done. s/byte code/bytecode/. > >> >> + * (Note: JVM internal methods named {@code } not visible to this API, >> + * even though the {@code invokespecial} instruction can refer to them >> + * in special circumstances. Use {@link #findConstructor findConstructor} >> >> Not exactly sure but should this read "are not visible"? > > Yes. > >> >> MemberName resolveOrFail(byte refKind, Class refc, String name, MethodType type) throws NoSuchMethodException, IllegalAccessException { >> + type.getClass(); // NPE >> checkSymbolicClass(refc); // do this before attempting to resolve >> - name.getClass(); type.getClass(); // NPE >> + checkMethodName(refKind, name); >> >> Could you add a comment here saying that checkMethodName does an implicit null pointer check on name? Maybe a comment for checkMethodName too. > > Done. > >> >> What was the problem with the null pointer exceptions? Is it okay that we might throw another exception before null checking name? > > Foo. The reordering of those null checks seems to be a needless change that crept in. I'm going to keep them the way they are. > > See updated webrev: > http://cr.openjdk.java.net/~jrose/8001108/webrev.01/ Looks good. > > ? John > >> On Sep 12, 2013, at 6:47 PM, John Rose wrote: >> >>> Please review this change for a change to the JSR 292 implementation: >>> >>> http://cr.openjdk.java.net/~jrose/8001108/webrev.00 >>> >>> Summary: add an explicit check for leading "<", upgrade the unit tests >>> >>> The change is mostly to javadoc and unit tests, documenting and testing some corner cases of JSR 292 APIs. >>> >>> In the RI, there is an explicit error check. >>> >>> Thanks, >>> ? John >>> >>> P.S. Since this is a change which oriented toward JSR 292 functionality, the review request is to mlvm-dev and core-libs-dev. >>> Changes which are oriented toward performance will go to mlvm-dev and hotspot-compiler-dev. >>> _______________________________________________ >>> mlvm-dev mailing list >>> mlvm-dev at openjdk.java.net >>> http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev >> >> _______________________________________________ >> mlvm-dev mailing list >> mlvm-dev at openjdk.java.net >> http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev > > _______________________________________________ > mlvm-dev mailing list > mlvm-dev at openjdk.java.net > http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev From christian.thalinger at oracle.com Thu Sep 26 19:16:38 2013 From: christian.thalinger at oracle.com (Christian Thalinger) Date: Thu, 26 Sep 2013 19:16:38 -0700 Subject: jdk8 metaspace problem with indy In-Reply-To: <524442A7.704@gmx.org> References: <524442A7.704@gmx.org> Message-ID: <2AE76E37-87D6-4518-9643-6398448749C5@oracle.com> On Sep 26, 2013, at 7:20 AM, Jochen Theodorou wrote: > Hi all, > > probably not such a good time to ask, since many of those, that could > answer this might be on JavaOne... but still > > On the user list we got an interesting program that makes quite some > problems to the jvm as it seems. The groovy program looks like this: > >> println "Started" >> for(int i = 0; i < 100; i++) { >> print "." >> for (int j=0;j<100000;j++) { >> Container c = new Container() >> c.run() >> } >> } >> println "\ndone" >> >> public class Container implements Runnable { >> public Container() {} >> public void run() { >> GroovyShell gs = new GroovyShell() >> Script script = gs.parse("") >> script.run() >> } >> } > > What happens is that gs.parse will create a new script and a new class > every time. Now using our custom call site code this works fine. Using > the indy port, it fails with a permgen error on any jdk7 before u40. On > u40 this works fine again. In jdk8 this fails sometimes with a metaspace > error, while in u40 it seems to work quite reliable. > > The problem must be more than just creating many classes, because our > custom callsite caching creates just as many classes for the scripts as > the indy version does. What does not happen so much there though is code > generated by reflection and of course non from indy. So I especially > suspect the code cache here to be responsible for the problem, but I > have no real basis for this. I lack the means to diagnose the problem > further > > Is there a way to make this work on older jdk7 vms? And is there a way > for me to make this work on jdk8? Do others here have similar experiences? Is this 64-bit with compressed oops? Is tiered compilation on? > > bye Jochen > -- > Jochen "blackdrag" Theodorou - Groovy Project Tech Lead > blog: http://blackdragsview.blogspot.com/ > german groovy discussion newsgroup: de.comp.lang.misc > For Groovy programming sources visit http://groovy-lang.org > > _______________________________________________ > mlvm-dev mailing list > mlvm-dev at openjdk.java.net > http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev From christian.thalinger at oracle.com Thu Sep 26 19:19:10 2013 From: christian.thalinger at oracle.com (Christian Thalinger) Date: Thu, 26 Sep 2013 19:19:10 -0700 Subject: JDK7u, hotspot, CC_INTERP, and COBOL In-Reply-To: <524322D3.4050000@orange.fr> References: <524322D3.4050000@orange.fr> Message-ID: On Sep 25, 2013, at 10:52 AM, Francis ANDRE wrote: > Hi > > On WXP with VS2010 and the http://hg.openjdk.java.net/jdk7u/jdk7u/hotspot/ repository, I successfully build and ran the debug version of hotspot in compiler1 directory. fine > > Next, I tried to get working the bytecode cppInterpreter instead of the template based interpreter adding the CC_INTERP=true preprocessor define, but I got several compile errors -- see below -- > > By looking at the Wiki and the OpenJDK website, I discovered that the cppInterpreter was no more maintained. I have no idea if it works on Windows but on Linux you can build Zero: http://openjdk.java.net/projects/zero/ Zero uses the C++ interpreter. > > So I am wondering why the cppInterpreter is not anymore maintained and would like to understand if this decision is definitive or not, because it seems to me that there are very few errors. (see above) and that, IMHO, a somewhat small effort should be made to fix the cppInterpreter (but it could be totally wrong). > > I need the cppInterpreter to make a proposal to the MLVM project to slightly change the JVM spec for all xALOAD and xASTORE bytecodes for a specific class version number for an efficient support of a _COBOL __runtime_. > > Regards > > Francis > > > cppInterpreter_x86.cpp > 1> frame_x86.cpp > 1> interpreter_x86_32.cpp > 1> interp_masm_x86_32.cpp > 1>..\..\src\cpu\x86\vm\frame_x86.cpp(691): error C2039: 'interpreter_frame_sender_sp_offset' : n'est pas membre de 'frame' > 1> Z:\DEV\OpenJDK7u\hotspot\src\share\vm\runtime/frame.hpp(73) : voir la d?claration de 'frame' > 1>..\..\src\cpu\x86\vm\frame_x86.cpp(691): error C2065: 'interpreter_frame_sender_sp_offset' : identificateur non d?clar? > 1>..\..\src\cpu\x86\vm\frame_x86.cpp(692): error C2039: 'interpreter_frame_last_sp_offset' : n'est pas membre de 'frame' > 1> Z:\DEV\OpenJDK7u\hotspot\src\share\vm\runtime/frame.hpp(73) : voir la d?claration de 'frame' > 1>..\..\src\cpu\x86\vm\frame_x86.cpp(692): error C2065: 'interpreter_frame_last_sp_offset' : identificateur non d?clar? > 1>..\..\src\cpu\x86\vm\frame_x86.cpp(693): error C2039: 'interpreter_frame_method_offset' : n'est pas membre de 'frame' > 1> Z:\DEV\OpenJDK7u\hotspot\src\share\vm\runtime/frame.hpp(73) : voir la d?claration de 'frame' > 1>..\..\src\cpu\x86\vm\frame_x86.cpp(693): error C2065: 'interpreter_frame_method_offset' : identificateur non d?clar? > 1>..\..\src\cpu\x86\vm\frame_x86.cpp(694): error C2039: 'interpreter_frame_mdx_offset' : n'est pas membre de 'frame' > 1> Z:\DEV\OpenJDK7u\hotspot\src\share\vm\runtime/frame.hpp(73) : voir la d?claration de 'frame' > 1>..\..\src\cpu\x86\vm\frame_x86.cpp(694): error C2065: 'interpreter_frame_mdx_offset' : identificateur non d?clar? > 1>..\..\src\cpu\x86\vm\frame_x86.cpp(695): error C2039: 'interpreter_frame_cache_offset' : n'est pas membre de 'frame' > 1> Z:\DEV\OpenJDK7u\hotspot\src\share\vm\runtime/frame.hpp(73) : voir la d?claration de 'frame' > 1>..\..\src\cpu\x86\vm\frame_x86.cpp(695): error C2065: 'interpreter_frame_cache_offset' : identificateur non d?clar? > 1>..\..\src\cpu\x86\vm\frame_x86.cpp(696): error C2039: 'interpreter_frame_locals_offset' : n'est pas membre de 'frame' > 1> Z:\DEV\OpenJDK7u\hotspot\src\share\vm\runtime/frame.hpp(73) : voir la d?claration de 'frame' > 1>..\..\src\cpu\x86\vm\frame_x86.cpp(696): error C2065: 'interpreter_frame_locals_offset' : identificateur non d?clar? > 1>..\..\src\cpu\x86\vm\frame_x86.cpp(697): error C2039: 'interpreter_frame_bcx_offset' : n'est pas membre de 'frame' > 1> Z:\DEV\OpenJDK7u\hotspot\src\share\vm\runtime/frame.hpp(73) : voir la d?claration de 'frame' > 1>..\..\src\cpu\x86\vm\frame_x86.cpp(697): error C2065: 'interpreter_frame_bcx_offset' : identificateur non d?clar? > 1>..\..\src\cpu\x86\vm\frame_x86.cpp(698): error C2039: 'interpreter_frame_initial_sp_offset' : n'est pas membre de 'frame' > 1> Z:\DEV\OpenJDK7u\hotspot\src\share\vm\runtime/frame.hpp(73) : voir la d?claration de 'frame' > 1>..\..\src\cpu\x86\vm\frame_x86.cpp(698): error C2065: 'interpreter_frame_initial_sp_offset' : identificateur non d?clar? > 1> sharedRuntime_x86_32.cpp > 1>..\..\src\cpu\x86\vm\interp_masm_x86_32.cpp(56): error C2220: avertissement consid?r? comme une erreur - aucun fichier 'object' g?n?r? > 1>..\..\src\cpu\x86\vm\interp_masm_x86_32.cpp(56): warning C4146: op?rateur moins unaire appliqu? ? un type non sign?, le r?sultat sera non sign? > 1>..\..\src\cpu\x86\vm\interp_masm_x86_32.cpp(1414): error C2039: 'increment_mask_and_jump' : n'est pas membre de 'InterpreterMacroAssembler' > 1> z:\dev\openjdk7u\hotspot\src\cpu\x86\vm\interp_masm_x86_32.hpp(34) : voir la d?claration de 'InterpreterMacroAssembler' > 1>..\..\src\cpu\x86\vm\interp_masm_x86_32.cpp(1417): error C2061: erreur de syntaxe : identificateur 'Condition' > 1>..\..\src\cpu\x86\vm\interp_masm_x86_32.cpp(1419): error C3861: 'movl' : identificateur introuvable > 1>..\..\src\cpu\x86\vm\interp_masm_x86_32.cpp(1421): error C3861: 'incrementl' : identificateur introuvable > 1>..\..\src\cpu\x86\vm\interp_masm_x86_32.cpp(1422): error C3861: 'movl' : identificateur introuvable > 1>..\..\src\cpu\x86\vm\interp_masm_x86_32.cpp(1423): error C3861: 'andl' : identificateur introuvable > 1>..\..\src\cpu\x86\vm\interp_masm_x86_32.cpp(1424): error C2065: 'cond' : identificateur non d?clar? > 1>..\..\src\cpu\x86\vm\interp_masm_x86_32.cpp(1424): error C2065: 'where' : identificateur non d?clar? > 1>..\..\src\cpu\x86\vm\interp_masm_x86_32.cpp(1424): error C3861: 'jcc' : identificateur introuvable > 1>..\..\src\cpu\x86\vm\interpreter_x86_32.cpp(233): error C2039: 'empty_expression_stack' : n'est pas membre de 'InterpreterMacroAssembler' > 1> Z:\DEV\OpenJDK7u\hotspot\src\cpu\x86\vm\interp_masm_x86_32.hpp(34) : voir la d?claration de 'InterpreterMacroAssembler' > 1>..\..\src\cpu\x86\vm\interpreter_x86_32.cpp(235): error C2039: 'restore_locals' : n'est pas membre de 'InterpreterMacroAssembler' > 1> Z:\DEV\OpenJDK7u\hotspot\src\cpu\x86\vm\interp_masm_x86_32.hpp(34) : voir la d?claration de 'InterpreterMacroAssembler' > 1>..\..\src\cpu\x86\vm\cppInterpreter_x86.cpp(2211): error C2039: 'method_handle' : n'est pas membre de 'Interpreter' > 1> Z:\DEV\OpenJDK7u\hotspot\src\share\vm\interpreter/interpreter.hpp(143) : voir la d?claration de 'Interpreter' > 1>..\..\src\cpu\x86\vm\cppInterpreter_x86.cpp(2211): error C2065: 'method_handle' : identificateur non d?clar? > 1>..\..\src\cpu\x86\vm\cppInterpreter_x86.cpp(2211): error C2051: l'expression associ?e ? case n'est pas une constante > 1>..\..\src\cpu\x86\vm\cppInterpreter_x86.cpp(2211): error C2039: 'generate_method_handle_entry' : n'est pas membre de 'InterpreterGenerator' > 1> Z:\DEV\OpenJDK7u\hotspot\src\share\vm\interpreter/interpreterGenerator.hpp(37) : voir la d?claration de 'InterpreterGenerator' > 1>..\..\src\cpu\x86\vm\cppInterpreter_x86.cpp(2255): error C2064: le terme ne correspond pas ? une fonction qui prend 0 arguments > 1>..\..\src\cpu\x86\vm\sharedRuntime_x86_32.cpp(3062): error C2220: avertissement consid?r? comme une erreur - aucun fichier 'object' g?n?r? > 1>..\..\src\cpu\x86\vm\sharedRuntime_x86_32.cpp(3062): warning C4146: op?rateur moins unaire appliqu? ? un type non sign?, le r?sultat sera non sign? > ========== G?n?ration : 0 a r?ussi, 1 a ?chou?, 0 mis ? jour, 0 a ?t? ignor? ========== > > > > > From francis.andre.kampbell at orange.fr Thu Sep 26 19:40:33 2013 From: francis.andre.kampbell at orange.fr (Francis ANDRE) Date: Fri, 27 Sep 2013 04:40:33 +0200 Subject: JDK7u, hotspot, CC_INTERP, and COBOL In-Reply-To: References: <524322D3.4050000@orange.fr> Message-ID: <5244F021.8060803@orange.fr> Hi Christian Ok, I will have a look at Zero and try to make it on windows. Thanks for the pointer. Le 27/09/2013 04:19, Christian Thalinger a ?crit : > On Sep 25, 2013, at 10:52 AM, Francis ANDRE wrote: > >> Hi >> >> On WXP with VS2010 and the http://hg.openjdk.java.net/jdk7u/jdk7u/hotspot/ repository, I successfully build and ran the debug version of hotspot in compiler1 directory. fine >> >> Next, I tried to get working the bytecode cppInterpreter instead of the template based interpreter adding the CC_INTERP=true preprocessor define, but I got several compile errors -- see below -- >> >> By looking at the Wiki and the OpenJDK website, I discovered that the cppInterpreter was no more maintained. > I have no idea if it works on Windows but on Linux you can build Zero: > > http://openjdk.java.net/projects/zero/ > > Zero uses the C++ interpreter. > >> So I am wondering why the cppInterpreter is not anymore maintained and would like to understand if this decision is definitive or not, because it seems to me that there are very few errors. (see above) and that, IMHO, a somewhat small effort should be made to fix the cppInterpreter (but it could be totally wrong). >> >> I need the cppInterpreter to make a proposal to the MLVM project to slightly change the JVM spec for all xALOAD and xASTORE bytecodes for a specific class version number for an efficient support of a _COBOL __runtime_. >> >> Regards >> >> Francis >> >> >> cppInterpreter_x86.cpp >> 1> frame_x86.cpp >> 1> interpreter_x86_32.cpp >> 1> interp_masm_x86_32.cpp >> 1>..\..\src\cpu\x86\vm\frame_x86.cpp(691): error C2039: 'interpreter_frame_sender_sp_offset' : n'est pas membre de 'frame' >> 1> Z:\DEV\OpenJDK7u\hotspot\src\share\vm\runtime/frame.hpp(73) : voir la d?claration de 'frame' >> 1>..\..\src\cpu\x86\vm\frame_x86.cpp(691): error C2065: 'interpreter_frame_sender_sp_offset' : identificateur non d?clar? >> 1>..\..\src\cpu\x86\vm\frame_x86.cpp(692): error C2039: 'interpreter_frame_last_sp_offset' : n'est pas membre de 'frame' >> 1> Z:\DEV\OpenJDK7u\hotspot\src\share\vm\runtime/frame.hpp(73) : voir la d?claration de 'frame' >> 1>..\..\src\cpu\x86\vm\frame_x86.cpp(692): error C2065: 'interpreter_frame_last_sp_offset' : identificateur non d?clar? >> 1>..\..\src\cpu\x86\vm\frame_x86.cpp(693): error C2039: 'interpreter_frame_method_offset' : n'est pas membre de 'frame' >> 1> Z:\DEV\OpenJDK7u\hotspot\src\share\vm\runtime/frame.hpp(73) : voir la d?claration de 'frame' >> 1>..\..\src\cpu\x86\vm\frame_x86.cpp(693): error C2065: 'interpreter_frame_method_offset' : identificateur non d?clar? >> 1>..\..\src\cpu\x86\vm\frame_x86.cpp(694): error C2039: 'interpreter_frame_mdx_offset' : n'est pas membre de 'frame' >> 1> Z:\DEV\OpenJDK7u\hotspot\src\share\vm\runtime/frame.hpp(73) : voir la d?claration de 'frame' >> 1>..\..\src\cpu\x86\vm\frame_x86.cpp(694): error C2065: 'interpreter_frame_mdx_offset' : identificateur non d?clar? >> 1>..\..\src\cpu\x86\vm\frame_x86.cpp(695): error C2039: 'interpreter_frame_cache_offset' : n'est pas membre de 'frame' >> 1> Z:\DEV\OpenJDK7u\hotspot\src\share\vm\runtime/frame.hpp(73) : voir la d?claration de 'frame' >> 1>..\..\src\cpu\x86\vm\frame_x86.cpp(695): error C2065: 'interpreter_frame_cache_offset' : identificateur non d?clar? >> 1>..\..\src\cpu\x86\vm\frame_x86.cpp(696): error C2039: 'interpreter_frame_locals_offset' : n'est pas membre de 'frame' >> 1> Z:\DEV\OpenJDK7u\hotspot\src\share\vm\runtime/frame.hpp(73) : voir la d?claration de 'frame' >> 1>..\..\src\cpu\x86\vm\frame_x86.cpp(696): error C2065: 'interpreter_frame_locals_offset' : identificateur non d?clar? >> 1>..\..\src\cpu\x86\vm\frame_x86.cpp(697): error C2039: 'interpreter_frame_bcx_offset' : n'est pas membre de 'frame' >> 1> Z:\DEV\OpenJDK7u\hotspot\src\share\vm\runtime/frame.hpp(73) : voir la d?claration de 'frame' >> 1>..\..\src\cpu\x86\vm\frame_x86.cpp(697): error C2065: 'interpreter_frame_bcx_offset' : identificateur non d?clar? >> 1>..\..\src\cpu\x86\vm\frame_x86.cpp(698): error C2039: 'interpreter_frame_initial_sp_offset' : n'est pas membre de 'frame' >> 1> Z:\DEV\OpenJDK7u\hotspot\src\share\vm\runtime/frame.hpp(73) : voir la d?claration de 'frame' >> 1>..\..\src\cpu\x86\vm\frame_x86.cpp(698): error C2065: 'interpreter_frame_initial_sp_offset' : identificateur non d?clar? >> 1> sharedRuntime_x86_32.cpp >> 1>..\..\src\cpu\x86\vm\interp_masm_x86_32.cpp(56): error C2220: avertissement consid?r? comme une erreur - aucun fichier 'object' g?n?r? >> 1>..\..\src\cpu\x86\vm\interp_masm_x86_32.cpp(56): warning C4146: op?rateur moins unaire appliqu? ? un type non sign?, le r?sultat sera non sign? >> 1>..\..\src\cpu\x86\vm\interp_masm_x86_32.cpp(1414): error C2039: 'increment_mask_and_jump' : n'est pas membre de 'InterpreterMacroAssembler' >> 1> z:\dev\openjdk7u\hotspot\src\cpu\x86\vm\interp_masm_x86_32.hpp(34) : voir la d?claration de 'InterpreterMacroAssembler' >> 1>..\..\src\cpu\x86\vm\interp_masm_x86_32.cpp(1417): error C2061: erreur de syntaxe : identificateur 'Condition' >> 1>..\..\src\cpu\x86\vm\interp_masm_x86_32.cpp(1419): error C3861: 'movl' : identificateur introuvable >> 1>..\..\src\cpu\x86\vm\interp_masm_x86_32.cpp(1421): error C3861: 'incrementl' : identificateur introuvable >> 1>..\..\src\cpu\x86\vm\interp_masm_x86_32.cpp(1422): error C3861: 'movl' : identificateur introuvable >> 1>..\..\src\cpu\x86\vm\interp_masm_x86_32.cpp(1423): error C3861: 'andl' : identificateur introuvable >> 1>..\..\src\cpu\x86\vm\interp_masm_x86_32.cpp(1424): error C2065: 'cond' : identificateur non d?clar? >> 1>..\..\src\cpu\x86\vm\interp_masm_x86_32.cpp(1424): error C2065: 'where' : identificateur non d?clar? >> 1>..\..\src\cpu\x86\vm\interp_masm_x86_32.cpp(1424): error C3861: 'jcc' : identificateur introuvable >> 1>..\..\src\cpu\x86\vm\interpreter_x86_32.cpp(233): error C2039: 'empty_expression_stack' : n'est pas membre de 'InterpreterMacroAssembler' >> 1> Z:\DEV\OpenJDK7u\hotspot\src\cpu\x86\vm\interp_masm_x86_32.hpp(34) : voir la d?claration de 'InterpreterMacroAssembler' >> 1>..\..\src\cpu\x86\vm\interpreter_x86_32.cpp(235): error C2039: 'restore_locals' : n'est pas membre de 'InterpreterMacroAssembler' >> 1> Z:\DEV\OpenJDK7u\hotspot\src\cpu\x86\vm\interp_masm_x86_32.hpp(34) : voir la d?claration de 'InterpreterMacroAssembler' >> 1>..\..\src\cpu\x86\vm\cppInterpreter_x86.cpp(2211): error C2039: 'method_handle' : n'est pas membre de 'Interpreter' >> 1> Z:\DEV\OpenJDK7u\hotspot\src\share\vm\interpreter/interpreter.hpp(143) : voir la d?claration de 'Interpreter' >> 1>..\..\src\cpu\x86\vm\cppInterpreter_x86.cpp(2211): error C2065: 'method_handle' : identificateur non d?clar? >> 1>..\..\src\cpu\x86\vm\cppInterpreter_x86.cpp(2211): error C2051: l'expression associ?e ? case n'est pas une constante >> 1>..\..\src\cpu\x86\vm\cppInterpreter_x86.cpp(2211): error C2039: 'generate_method_handle_entry' : n'est pas membre de 'InterpreterGenerator' >> 1> Z:\DEV\OpenJDK7u\hotspot\src\share\vm\interpreter/interpreterGenerator.hpp(37) : voir la d?claration de 'InterpreterGenerator' >> 1>..\..\src\cpu\x86\vm\cppInterpreter_x86.cpp(2255): error C2064: le terme ne correspond pas ? une fonction qui prend 0 arguments >> 1>..\..\src\cpu\x86\vm\sharedRuntime_x86_32.cpp(3062): error C2220: avertissement consid?r? comme une erreur - aucun fichier 'object' g?n?r? >> 1>..\..\src\cpu\x86\vm\sharedRuntime_x86_32.cpp(3062): warning C4146: op?rateur moins unaire appliqu? ? un type non sign?, le r?sultat sera non sign? >> ========== G?n?ration : 0 a r?ussi, 1 a ?chou?, 0 mis ? jour, 0 a ?t? ignor? ========== >> >> >> >> >> > From john.r.rose at oracle.com Thu Sep 26 21:33:26 2013 From: john.r.rose at oracle.com (John Rose) Date: Thu, 26 Sep 2013 21:33:26 -0700 Subject: RFR(S+M) / 8022701 Accessibility checking: InvocationTargetException is thrown instead of IllegalAccessError In-Reply-To: References: <143F40F0-557E-48EA-9207-0FF1880663DF@oracle.com> <5229F4B8.9000506@oracle.com> <64E60D4E-0829-4B23-9EE7-61AD28DB7E2F@oracle.com> <49B1A36F-6C45-4E92-80D2-FA6F80A238CB@oracle.com> <2F83E9C4-B28A-4385-8FFB-78F1313A931F@oracle.com> <6F0563F9-7A78-42C7-9296-53991C18D5CA@oracle.com> <31FAE0CA-5EDD-4014-AED9-27533E53307F@oracle.com> <9092C3F3-EA5A-4748-BD67-0423F1B8964E@oracle.com> Message-ID: On Sep 19, 2013, at 9:57 AM, David Chase wrote: > Recommended changes made: > > http://cr.openjdk.java.net/~drchase/8022701/webrev.04/ Good; reviewed. Consider adding this tweak, which would close the loop on alternation between the fooError and fooException versions: + static private void initCauseFrom(Error err, Exception ex) { + Throwable th = ex.getCause(); ++ if (err.getClass().isInstance(th)) throw (Error) th; + err.initCause(th == null ? ex : th); + } E.g., if the reason for linkage failure was originally NoSuchMethodError, but was mapped to NoSuchMethodException (which can happen in MemberName.makeAccessException) then the original NoSuchMethodError is extracted and thrown, rather than a new NoSuchMethodError which wraps the original NoSuchMethodError. > Test with jtreg (for pass and for induced failure) on MacOS, > not sure what additional other testing is desired since it is entirely in the libraries. Your test case is enough. > I included code to handle the case of a broken field-referencing methodhandle, > but did not test it because there's no syntax for these in Java, nor is their creation > well-documented. That's fine. Ship it, preferably with the tweak above. ? John From forax at univ-mlv.fr Thu Sep 26 23:13:19 2013 From: forax at univ-mlv.fr (Remi Forax) Date: Fri, 27 Sep 2013 08:13:19 +0200 Subject: RFR(S+M) / 8022701 Accessibility checking: InvocationTargetException is thrown instead of IllegalAccessError In-Reply-To: References: <143F40F0-557E-48EA-9207-0FF1880663DF@oracle.com> <5229F4B8.9000506@oracle.com> <64E60D4E-0829-4B23-9EE7-61AD28DB7E2F@oracle.com> <49B1A36F-6C45-4E92-80D2-FA6F80A238CB@oracle.com> <2F83E9C4-B28A-4385-8FFB-78F1313A931F@oracle.com> <6F0563F9-7A78-42C7-9296-53991C18D5CA@oracle.com> <31FAE0CA-5EDD-4014-AED9-27533E53307F@oracle.com> <9092C3F3-EA5A-4748-BD67-0423F1B8964E@oracle.com> Message-ID: <524521FF.5090706@univ-mlv.fr> On 09/27/2013 06:33 AM, John Rose wrote: > On Sep 19, 2013, at 9:57 AM, David Chase wrote: > >> Recommended changes made: >> >> http://cr.openjdk.java.net/~drchase/8022701/webrev.04/ > Good; reviewed. > > Consider adding this tweak, which would close the loop on alternation between the fooError and fooException versions: > > + static private void initCauseFrom(Error err, Exception ex) { > + Throwable th = ex.getCause(); > ++ if (err.getClass().isInstance(th)) throw (Error) th; > + err.initCause(th == null ? ex : th); > + } > > E.g., if the reason for linkage failure was originally NoSuchMethodError, but was mapped to NoSuchMethodException (which can happen in MemberName.makeAccessException) then the original NoSuchMethodError is extracted and thrown, rather than a new NoSuchMethodError which wraps the original NoSuchMethodError. I'm late in this game but having a method initCauseFrom() that throws an exception (an error exactly) seems plainly wrong to me. > >> Test with jtreg (for pass and for induced failure) on MacOS, >> not sure what additional other testing is desired since it is entirely in the libraries. > Your test case is enough. > >> I included code to handle the case of a broken field-referencing methodhandle, >> but did not test it because there's no syntax for these in Java, nor is their creation >> well-documented. > That's fine. Ship it, preferably with the tweak above. > > ? John R?mi From blackdrag at gmx.org Fri Sep 27 00:55:24 2013 From: blackdrag at gmx.org (Jochen Theodorou) Date: Fri, 27 Sep 2013 09:55:24 +0200 Subject: jdk8 metaspace problem with indy In-Reply-To: <2AE76E37-87D6-4518-9643-6398448749C5@oracle.com> References: <524442A7.704@gmx.org> <2AE76E37-87D6-4518-9643-6398448749C5@oracle.com> Message-ID: <524539EC.4010806@gmx.org> Am 27.09.2013 04:16, schrieb Christian Thalinger: [...] >> Is there a way to make this work on older jdk7 vms? And is there a way >> for me to make this work on jdk8? Do others here have similar experiences? > > Is this 64-bit with compressed oops? Is tiered compilation on? It has been run with a 64bit Linux JVM on default settings. So I think the answer to both is yes. bye Jochen -- Jochen "blackdrag" Theodorou - Groovy Project Tech Lead blog: http://blackdragsview.blogspot.com/ german groovy discussion newsgroup: de.comp.lang.misc For Groovy programming sources visit http://groovy-lang.org From blackdrag at gmx.org Fri Sep 27 01:07:48 2013 From: blackdrag at gmx.org (Jochen Theodorou) Date: Fri, 27 Sep 2013 10:07:48 +0200 Subject: jdk8 metaspace problem with indy In-Reply-To: <2AE76E37-87D6-4518-9643-6398448749C5@oracle.com> References: <524442A7.704@gmx.org> <2AE76E37-87D6-4518-9643-6398448749C5@oracle.com> Message-ID: <52453CD4.3060907@gmx.org> Am 27.09.2013 04:16, schrieb Christian Thalinger: > > On Sep 26, 2013, at 7:20 AM, Jochen Theodorou wrote: [...] >> Is there a way to make this work on older jdk7 vms? And is there a way >> for me to make this work on jdk8? Do others here have similar experiences? > > Is this 64-bit with compressed oops? Is tiered compilation on? It has been run with a 64bit Linux JVM on default settings. I just tried on jdk7u25 -XX:-UseCompressedOops and -XX:-TieredCompilation and I tried with only one of them active, there is no change in how it behaves bye Jochen -- Jochen "blackdrag" Theodorou - Groovy Project Tech Lead blog: http://blackdragsview.blogspot.com/ german groovy discussion newsgroup: de.comp.lang.misc For Groovy programming sources visit http://groovy-lang.org From david.r.chase at oracle.com Fri Sep 27 05:08:15 2013 From: david.r.chase at oracle.com (David Chase) Date: Fri, 27 Sep 2013 08:08:15 -0400 Subject: RFR(S+M) / 8022701 Accessibility checking: InvocationTargetException is thrown instead of IllegalAccessError In-Reply-To: <524521FF.5090706@univ-mlv.fr> References: <143F40F0-557E-48EA-9207-0FF1880663DF@oracle.com> <5229F4B8.9000506@oracle.com> <64E60D4E-0829-4B23-9EE7-61AD28DB7E2F@oracle.com> <49B1A36F-6C45-4E92-80D2-FA6F80A238CB@oracle.com> <2F83E9C4-B28A-4385-8FFB-78F1313A931F@oracle.com> <6F0563F9-7A78-42C7-9296-53991C18D5CA@oracle.com> <31FAE0CA-5EDD-4014-AED9-27533E53307F@oracle.com> <9092C3F3-EA5A-4748-BD67-0423F1B8964E@oracle.com> <524521FF.5090706@univ-mlv.fr> Message-ID: http://cr.openjdk.java.net/~drchase/8022701/webrev.06/ Changes made, incorporating Rose and Forax comments. Anyone care to push this for me? /** + * Use best possible cause for err.initCause(), substituting the + * cause for err itself if the cause has the same (or better) type. + */ + static private Error initCauseFrom(Error err, Exception ex) { + Throwable th = ex.getCause(); + if (err.getClass().isInstance(th)) + return (Error) th; + err.initCause(th == null ? ex : th); + return err; + } + + /** Or should I convert the calls to one-liners? + } catch (IllegalAccessException ex) { + Error err = new IllegalAccessError(ex.getMessage()); + throw initCauseFrom(err, ex); + } catch (NoSuchMethodException ex) { + Error err = new NoSuchMethodError(ex.getMessage()); + throw initCauseFrom(err, ex); + } catch (NoSuchFieldException ex) { + Error err = new NoSuchFieldError(ex.getMessage()); + throw initCauseFrom(err, ex); David -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 801 bytes Desc: Message signed with OpenPGP using GPGMail Url : http://mail.openjdk.java.net/pipermail/mlvm-dev/attachments/20130927/1d9cdf0e/signature.asc From blackdrag at gmx.org Fri Sep 27 07:31:04 2013 From: blackdrag at gmx.org (Jochen Theodorou) Date: Fri, 27 Sep 2013 16:31:04 +0200 Subject: MethodHandles#catchException bug in jdk7u40 and jdk8ea ? Message-ID: <524596A8.5050502@gmx.org> Hi again, I have a Groovy-indy program looking like this https://gist.github.com/abargnesi/6628656 This did work in 7u25 and does not work in 7u40 or the developer preview of jdk8. What I found out is, if you remove an argument the IllegalArgumentException is not thrown What I have (using 7u40 debug information) is a SimpleMethodHandle type: (Class,int,Class,Class,Class,Class,Class,Class,Class)Object lambda: convert=Lambda(a0:L,a1:L,a2:I,a3:L,a4:L,a5:L,a6:L,a7:L,a8:L,a9:L)=>{ t10:L=MethodHandle(int)Object(a2:I); arity: 10 On this I call MethodHandles.catchException(handle, GroovyRuntimeException.class, UNWRAP_EXCEPTION); UNWRAP_EXCEPTION is the the result of a findStatic and looks basically like this: > public static Object unwrap(GroovyRuntimeException gre) throws Throwable { > throw ScriptBytecodeAdapter.unwrap(gre); > } (I add it more for the signature, than for the content.) After the the call to catchException the type of the handle is changed to one containing for everything Object, instead of the original type: SimpleMethodHandle type: (Object,Object,Object,Object,Object,Object,Object,Object,Object)Object lambda: collect=Lambda(a0:L,a1:L,a2:L,a3:L,a4:L,a5:L,a6:L,a7:L,a8:L,a9:L)=>{ t10:L=ValueConversions.array(a1:L,a2:L,a3:L,a4:L,a5:L,a6:L,a7:L,a8:L,a9:L); t11:L=MethodHandle(Object[])Object(t10:L);t11:L} arity: 10 Later on I add a switchpoint guard, which expects the original type and thus I get a runtime error about mismatched types. With a lower arity the type change does not happen. Now.. looking at the documentation of the method I then this here: > * T target(A..., B...); > * T handler(ExType, A...); > * T adapter(A... a, B... b) { > * try { > * return target(a..., b...); > * } catch (ExType ex) { > * return handler(ex, a...); > * } > * } implies to me, that the type of the returned handle (adapter) should be equal to the type of the handle target. And that would mean this is a bug. Am I right about this? If this is no bug, then the documentation absolutely needs an update, plus I doubt such behaviour is good for performance. bye blackdrag -- Jochen "blackdrag" Theodorou - Groovy Project Tech Lead blog: http://blackdragsview.blogspot.com/ german groovy discussion newsgroup: de.comp.lang.misc For Groovy programming sources visit http://groovy-lang.org From coleen.phillimore at oracle.com Mon Sep 30 07:48:02 2013 From: coleen.phillimore at oracle.com (Coleen Phillimore) Date: Mon, 30 Sep 2013 10:48:02 -0400 Subject: jdk8 metaspace problem with indy In-Reply-To: <524442A7.704@gmx.org> References: <524442A7.704@gmx.org> Message-ID: <52498F22.6020706@oracle.com> Hi, Stefan has found the cause of the problem you have described this thread, but we're discussing internally how to fix it. I'll let him explain. Thanks, Coleen On 09/26/2013 10:20 AM, Jochen Theodorou wrote: > Hi all, > > probably not such a good time to ask, since many of those, that could > answer this might be on JavaOne... but still > > On the user list we got an interesting program that makes quite some > problems to the jvm as it seems. The groovy program looks like this: > >> println "Started" >> for(int i = 0; i < 100; i++) { >> print "." >> for (int j=0;j<100000;j++) { >> Container c = new Container() >> c.run() >> } >> } >> println "\ndone" >> >> public class Container implements Runnable { >> public Container() {} >> public void run() { >> GroovyShell gs = new GroovyShell() >> Script script = gs.parse("") >> script.run() >> } >> } > What happens is that gs.parse will create a new script and a new class > every time. Now using our custom call site code this works fine. Using > the indy port, it fails with a permgen error on any jdk7 before u40. On > u40 this works fine again. In jdk8 this fails sometimes with a metaspace > error, while in u40 it seems to work quite reliable. > > The problem must be more than just creating many classes, because our > custom callsite caching creates just as many classes for the scripts as > the indy version does. What does not happen so much there though is code > generated by reflection and of course non from indy. So I especially > suspect the code cache here to be responsible for the problem, but I > have no real basis for this. I lack the means to diagnose the problem > further > > Is there a way to make this work on older jdk7 vms? And is there a way > for me to make this work on jdk8? Do others here have similar experiences? > > bye Jochen From blackdrag at gmx.org Mon Sep 30 08:03:07 2013 From: blackdrag at gmx.org (Jochen Theodorou) Date: Mon, 30 Sep 2013 17:03:07 +0200 Subject: jdk8 metaspace problem with indy In-Reply-To: <52498F22.6020706@oracle.com> References: <524442A7.704@gmx.org> <52498F22.6020706@oracle.com> Message-ID: <524992AB.80309@gmx.org> Hi, good to hear, that the problem is understood and worked on ;) Since you guys know what the problem is, is there a way to prevent this to happen on jdk7 before u40? bye Jochen Am 30.09.2013 16:48, schrieb Coleen Phillimore: > > Hi, Stefan has found the cause of the problem you have described this > thread, but we're discussing internally how to fix it. I'll let him > explain. > > Thanks, > Coleen > > On 09/26/2013 10:20 AM, Jochen Theodorou wrote: >> Hi all, >> >> probably not such a good time to ask, since many of those, that could >> answer this might be on JavaOne... but still >> >> On the user list we got an interesting program that makes quite some >> problems to the jvm as it seems. The groovy program looks like this: >> >>> println "Started" >>> for(int i = 0; i < 100; i++) { >>> print "." >>> for (int j=0;j<100000;j++) { >>> Container c = new Container() >>> c.run() >>> } >>> } >>> println "\ndone" >>> >>> public class Container implements Runnable { >>> public Container() {} >>> public void run() { >>> GroovyShell gs = new GroovyShell() >>> Script script = gs.parse("") >>> script.run() >>> } >>> } >> What happens is that gs.parse will create a new script and a new class >> every time. Now using our custom call site code this works fine. Using >> the indy port, it fails with a permgen error on any jdk7 before u40. On >> u40 this works fine again. In jdk8 this fails sometimes with a metaspace >> error, while in u40 it seems to work quite reliable. >> >> The problem must be more than just creating many classes, because our >> custom callsite caching creates just as many classes for the scripts as >> the indy version does. What does not happen so much there though is code >> generated by reflection and of course non from indy. So I especially >> suspect the code cache here to be responsible for the problem, but I >> have no real basis for this. I lack the means to diagnose the problem >> further >> >> Is there a way to make this work on older jdk7 vms? And is there a way >> for me to make this work on jdk8? Do others here have similar experiences? >> >> bye Jochen > > _______________________________________________ > mlvm-dev mailing list > mlvm-dev at openjdk.java.net > http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev > -- Jochen "blackdrag" Theodorou - Groovy Project Tech Lead blog: http://blackdragsview.blogspot.com/ german groovy discussion newsgroup: de.comp.lang.misc For Groovy programming sources visit http://groovy-lang.org From volker.simonis at gmail.com Mon Sep 30 08:37:45 2013 From: volker.simonis at gmail.com (Volker Simonis) Date: Mon, 30 Sep 2013 17:37:45 +0200 Subject: JDK7u, hotspot, CC_INTERP, and COBOL In-Reply-To: <524322D3.4050000@orange.fr> References: <524322D3.4050000@orange.fr> Message-ID: Just for reference: we have a running CPP-Interpreter on Linux/PPC64 with some enhancements like profiling, compressed oops, OSR, JSR292 and Biased Locking. So in the case you want to fix it on x86, you may take the PPC64 implementation as a boiler plate: http://hg.openjdk.java.net/ppc-aix-port/jdk7u http://hg.openjdk.java.net/ppc-aix-port/jdk8 Regards, Volker On Wed, Sep 25, 2013 at 7:52 PM, Francis ANDRE wrote: > Hi > > On WXP with VS2010 and the http://hg.openjdk.java.net/jdk7u/jdk7u/hotspot/ > repository, I successfully build and ran the debug version of hotspot in > compiler1 directory. fine > > Next, I tried to get working the bytecode cppInterpreter instead of the > template based interpreter adding the CC_INTERP=true preprocessor define, > but I got several compile errors -- see below -- > > By looking at the Wiki and the OpenJDK website, I discovered that the > cppInterpreter was no more maintained. > > So I am wondering why the cppInterpreter is not anymore maintained and would > like to understand if this decision is definitive or not, because it seems > to me that there are very few errors. (see above) and that, IMHO, a somewhat > small effort should be made to fix the cppInterpreter (but it could be > totally wrong). > > I need the cppInterpreter to make a proposal to the MLVM project to slightly > change the JVM spec for all xALOAD and xASTORE bytecodes for a specific > class version number for an efficient support of a _COBOL __runtime_. > > Regards > > Francis > > > cppInterpreter_x86.cpp > 1> frame_x86.cpp > 1> interpreter_x86_32.cpp > 1> interp_masm_x86_32.cpp > 1>..\..\src\cpu\x86\vm\frame_x86.cpp(691): error C2039: > 'interpreter_frame_sender_sp_offset' : n'est pas membre de 'frame' > 1> Z:\DEV\OpenJDK7u\hotspot\src\share\vm\runtime/frame.hpp(73) : voir la > d?claration de 'frame' > 1>..\..\src\cpu\x86\vm\frame_x86.cpp(691): error C2065: > 'interpreter_frame_sender_sp_offset' : identificateur non d?clar? > 1>..\..\src\cpu\x86\vm\frame_x86.cpp(692): error C2039: > 'interpreter_frame_last_sp_offset' : n'est pas membre de 'frame' > 1> Z:\DEV\OpenJDK7u\hotspot\src\share\vm\runtime/frame.hpp(73) : voir la > d?claration de 'frame' > 1>..\..\src\cpu\x86\vm\frame_x86.cpp(692): error C2065: > 'interpreter_frame_last_sp_offset' : identificateur non d?clar? > 1>..\..\src\cpu\x86\vm\frame_x86.cpp(693): error C2039: > 'interpreter_frame_method_offset' : n'est pas membre de 'frame' > 1> Z:\DEV\OpenJDK7u\hotspot\src\share\vm\runtime/frame.hpp(73) : voir la > d?claration de 'frame' > 1>..\..\src\cpu\x86\vm\frame_x86.cpp(693): error C2065: > 'interpreter_frame_method_offset' : identificateur non d?clar? > 1>..\..\src\cpu\x86\vm\frame_x86.cpp(694): error C2039: > 'interpreter_frame_mdx_offset' : n'est pas membre de 'frame' > 1> Z:\DEV\OpenJDK7u\hotspot\src\share\vm\runtime/frame.hpp(73) : voir la > d?claration de 'frame' > 1>..\..\src\cpu\x86\vm\frame_x86.cpp(694): error C2065: > 'interpreter_frame_mdx_offset' : identificateur non d?clar? > 1>..\..\src\cpu\x86\vm\frame_x86.cpp(695): error C2039: > 'interpreter_frame_cache_offset' : n'est pas membre de 'frame' > 1> Z:\DEV\OpenJDK7u\hotspot\src\share\vm\runtime/frame.hpp(73) : voir la > d?claration de 'frame' > 1>..\..\src\cpu\x86\vm\frame_x86.cpp(695): error C2065: > 'interpreter_frame_cache_offset' : identificateur non d?clar? > 1>..\..\src\cpu\x86\vm\frame_x86.cpp(696): error C2039: > 'interpreter_frame_locals_offset' : n'est pas membre de 'frame' > 1> Z:\DEV\OpenJDK7u\hotspot\src\share\vm\runtime/frame.hpp(73) : voir la > d?claration de 'frame' > 1>..\..\src\cpu\x86\vm\frame_x86.cpp(696): error C2065: > 'interpreter_frame_locals_offset' : identificateur non d?clar? > 1>..\..\src\cpu\x86\vm\frame_x86.cpp(697): error C2039: > 'interpreter_frame_bcx_offset' : n'est pas membre de 'frame' > 1> Z:\DEV\OpenJDK7u\hotspot\src\share\vm\runtime/frame.hpp(73) : voir la > d?claration de 'frame' > 1>..\..\src\cpu\x86\vm\frame_x86.cpp(697): error C2065: > 'interpreter_frame_bcx_offset' : identificateur non d?clar? > 1>..\..\src\cpu\x86\vm\frame_x86.cpp(698): error C2039: > 'interpreter_frame_initial_sp_offset' : n'est pas membre de 'frame' > 1> Z:\DEV\OpenJDK7u\hotspot\src\share\vm\runtime/frame.hpp(73) : voir la > d?claration de 'frame' > 1>..\..\src\cpu\x86\vm\frame_x86.cpp(698): error C2065: > 'interpreter_frame_initial_sp_offset' : identificateur non d?clar? > 1> sharedRuntime_x86_32.cpp > 1>..\..\src\cpu\x86\vm\interp_masm_x86_32.cpp(56): error C2220: > avertissement consid?r? comme une erreur - aucun fichier 'object' g?n?r? > 1>..\..\src\cpu\x86\vm\interp_masm_x86_32.cpp(56): warning C4146: op?rateur > moins unaire appliqu? ? un type non sign?, le r?sultat sera non sign? > 1>..\..\src\cpu\x86\vm\interp_masm_x86_32.cpp(1414): error C2039: > 'increment_mask_and_jump' : n'est pas membre de 'InterpreterMacroAssembler' > 1> z:\dev\openjdk7u\hotspot\src\cpu\x86\vm\interp_masm_x86_32.hpp(34) : voir > la d?claration de 'InterpreterMacroAssembler' > 1>..\..\src\cpu\x86\vm\interp_masm_x86_32.cpp(1417): error C2061: erreur de > syntaxe : identificateur 'Condition' > 1>..\..\src\cpu\x86\vm\interp_masm_x86_32.cpp(1419): error C3861: 'movl' : > identificateur introuvable > 1>..\..\src\cpu\x86\vm\interp_masm_x86_32.cpp(1421): error C3861: > 'incrementl' : identificateur introuvable > 1>..\..\src\cpu\x86\vm\interp_masm_x86_32.cpp(1422): error C3861: 'movl' : > identificateur introuvable > 1>..\..\src\cpu\x86\vm\interp_masm_x86_32.cpp(1423): error C3861: 'andl' : > identificateur introuvable > 1>..\..\src\cpu\x86\vm\interp_masm_x86_32.cpp(1424): error C2065: 'cond' : > identificateur non d?clar? > 1>..\..\src\cpu\x86\vm\interp_masm_x86_32.cpp(1424): error C2065: 'where' : > identificateur non d?clar? > 1>..\..\src\cpu\x86\vm\interp_masm_x86_32.cpp(1424): error C3861: 'jcc' : > identificateur introuvable > 1>..\..\src\cpu\x86\vm\interpreter_x86_32.cpp(233): error C2039: > 'empty_expression_stack' : n'est pas membre de 'InterpreterMacroAssembler' > 1> Z:\DEV\OpenJDK7u\hotspot\src\cpu\x86\vm\interp_masm_x86_32.hpp(34) : voir > la d?claration de 'InterpreterMacroAssembler' > 1>..\..\src\cpu\x86\vm\interpreter_x86_32.cpp(235): error C2039: > 'restore_locals' : n'est pas membre de 'InterpreterMacroAssembler' > 1> Z:\DEV\OpenJDK7u\hotspot\src\cpu\x86\vm\interp_masm_x86_32.hpp(34) : voir > la d?claration de 'InterpreterMacroAssembler' > 1>..\..\src\cpu\x86\vm\cppInterpreter_x86.cpp(2211): error C2039: > 'method_handle' : n'est pas membre de 'Interpreter' > 1> Z:\DEV\OpenJDK7u\hotspot\src\share\vm\interpreter/interpreter.hpp(143) : > voir la d?claration de 'Interpreter' > 1>..\..\src\cpu\x86\vm\cppInterpreter_x86.cpp(2211): error C2065: > 'method_handle' : identificateur non d?clar? > 1>..\..\src\cpu\x86\vm\cppInterpreter_x86.cpp(2211): error C2051: > l'expression associ?e ? case n'est pas une constante > 1>..\..\src\cpu\x86\vm\cppInterpreter_x86.cpp(2211): error C2039: > 'generate_method_handle_entry' : n'est pas membre de 'InterpreterGenerator' > 1> > Z:\DEV\OpenJDK7u\hotspot\src\share\vm\interpreter/interpreterGenerator.hpp(37) > : voir la d?claration de 'InterpreterGenerator' > 1>..\..\src\cpu\x86\vm\cppInterpreter_x86.cpp(2255): error C2064: le terme > ne correspond pas ? une fonction qui prend 0 arguments > 1>..\..\src\cpu\x86\vm\sharedRuntime_x86_32.cpp(3062): error C2220: > avertissement consid?r? comme une erreur - aucun fichier 'object' g?n?r? > 1>..\..\src\cpu\x86\vm\sharedRuntime_x86_32.cpp(3062): warning C4146: > op?rateur moins unaire appliqu? ? un type non sign?, le r?sultat sera non > sign? > ========== G?n?ration : 0 a r?ussi, 1 a ?chou?, 0 mis ? jour, 0 a ?t? ignor? > ========== > > > > > From stefan.karlsson at oracle.com Mon Sep 30 08:10:04 2013 From: stefan.karlsson at oracle.com (Stefan Karlsson) Date: Mon, 30 Sep 2013 17:10:04 +0200 Subject: jdk8 metaspace problem with indy In-Reply-To: <52498F22.6020706@oracle.com> References: <524442A7.704@gmx.org> <52498F22.6020706@oracle.com> Message-ID: <5249944C.6040409@oracle.com> On 2013-09-30 16:48, Coleen Phillimore wrote: > > Hi, Stefan has found the cause of the problem you have described this > thread, but we're discussing internally how to fix it. I'll let him > explain. First, my experiments were done without --indy so I might be seeing a different issue than you are. On the other hand, the experiments shows a real problem with our Metaspace and GC interaction, so I think that's worth investigating. The root cause of the problem I'm seeing is that SoftReferences are not cleared when the GC is triggered because of high metaspace memory pressure. I've created the bug: https://bugs.openjdk.java.net/browse/JDK-8025635 - SoftReferences are not cleared before metaspace OOME are thrown StefanK > > Thanks, > Coleen > > On 09/26/2013 10:20 AM, Jochen Theodorou wrote: >> Hi all, >> >> probably not such a good time to ask, since many of those, that could >> answer this might be on JavaOne... but still >> >> On the user list we got an interesting program that makes quite some >> problems to the jvm as it seems. The groovy program looks like this: >> >>> println "Started" >>> for(int i = 0; i < 100; i++) { >>> print "." >>> for (int j=0;j<100000;j++) { >>> Container c = new Container() >>> c.run() >>> } >>> } >>> println "\ndone" >>> >>> public class Container implements Runnable { >>> public Container() {} >>> public void run() { >>> GroovyShell gs = new GroovyShell() >>> Script script = gs.parse("") >>> script.run() >>> } >>> } >> What happens is that gs.parse will create a new script and a new class >> every time. Now using our custom call site code this works fine. Using >> the indy port, it fails with a permgen error on any jdk7 before u40. On >> u40 this works fine again. In jdk8 this fails sometimes with a metaspace >> error, while in u40 it seems to work quite reliable. >> >> The problem must be more than just creating many classes, because our >> custom callsite caching creates just as many classes for the scripts as >> the indy version does. What does not happen so much there though is code >> generated by reflection and of course non from indy. So I especially >> suspect the code cache here to be responsible for the problem, but I >> have no real basis for this. I lack the means to diagnose the problem >> further >> >> Is there a way to make this work on older jdk7 vms? And is there a way >> for me to make this work on jdk8? Do others here have similar >> experiences? >> >> bye Jochen > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.openjdk.java.net/pipermail/mlvm-dev/attachments/20130930/0f67df70/attachment.html From blackdrag at gmx.org Mon Sep 30 11:49:16 2013 From: blackdrag at gmx.org (Jochen Theodorou) Date: Mon, 30 Sep 2013 20:49:16 +0200 Subject: jdk8 metaspace problem with indy In-Reply-To: <5249944C.6040409@oracle.com> References: <524442A7.704@gmx.org> <52498F22.6020706@oracle.com> <5249944C.6040409@oracle.com> Message-ID: <5249C7AC.4040900@gmx.org> Am 30.09.2013 17:10, schrieb Stefan Karlsson: [...] > First, my experiments were done without --indy so I might be seeing a > different issue than you are. On the other hand, the experiments shows a > real problem with our Metaspace and GC interaction, so I think that's > worth investigating. > > The root cause of the problem I'm seeing is that SoftReferences are not > cleared when the GC is triggered because of high metaspace memory > pressure. I've created the bug: > https://bugs.openjdk.java.net/browse/JDK-8025635 - SoftReferences are > not cleared before metaspace OOME are thrown SoftReferences not cleared.. especially SoftReferences to Class and in worst case a soft reference to an object that has a hard reference to a class was always a critical point. We have some history with that. And this I see as critical bug for us. So I am very happy if it gets fixed before the final jdk8 ;) I did read your description and I think you should try with indy (also see http://groovy.codehaus.org/InvokeDynamic+support). What I have seen is not that metaspace increases indefinitely. Instead there is an OOME, before free memory is exhausted. Granted, jdk8 did, as far as I remember, allow about 4 times more classes to be created than jdk4u25, but it failed to clear the number of loaded classes at one point... afaik that was somewhere at 40k classes being loaded (and 38k of them dead). But of course it is possible I missed that there can be no free memory claimed and maybe the fix for JDK-8025635 is a fix for what I did see as well bye Jochen -- Jochen "blackdrag" Theodorou - Groovy Project Tech Lead blog: http://blackdragsview.blogspot.com/ german groovy discussion newsgroup: de.comp.lang.misc For Groovy programming sources visit http://groovy-lang.org