RFR (M) Close alignment gaps in InstanceKlass
Summary: moved fields around and some constant fields into ConstantPool This is a simple change except that I moved some constant fields from InstanceKlass into the constant pool so they can be shared read-only in the CDS archive. There are associated repercussions in SA and JVMCI, so please look at these changes. Also moved similarly sized fields together in the class so there's less likelihood of introducing gaps in future InstanceKlass changes. InstanceKlass is reduced from 544 to 520 bytes in a simple Hello World class. open webrev at http://cr.openjdk.java.net/~coleenp/2020/8238048.01/webrev bug link https://bugs.openjdk.java.net/browse/JDK-8238048 Tested with tier1-6. Thanks, Coleen
Re: RFR (M) Close alignment gaps in InstanceKlass
Hi Coleen, The SA changes look good. BTW, I've already made the TestIntConstant.java change in the Loom project. InstanceKlass::_misc_is_unsafe_anonymous was already changed to "8" in loom. You might want to sync up with Ron to make sure you aren't making conflicting changes in this area. Your code looks like: 249 enum { 250 _misc_rewritten = 1 << 0, // methods rewritten. 251 _misc_has_nonstatic_fields = 1 << 1, // for sizing with UseCompressedOops 252 _misc_should_verify_class = 1 << 2, // allow caching of preverification 253 _misc_is_unsafe_anonymous = 1 << 3, // has embedded _unsafe_anonymous_host field 254 _misc_is_contended = 1 << 4, // marked with contended annotation Loom looks like: static const unsigned _misc_kind_field_size = 0; ... // Start after _misc_kind field. enum { _misc_rewritten = 1 << (_misc_kind_field_size + 0), // methods rewritten. _misc_has_nonstatic_fields = 1 << (_misc_kind_field_size + 1), // for sizing with UseCompressedOops _misc_should_verify_class = 1 << (_misc_kind_field_size + 2), // allow caching of preverification _misc_is_unsafe_anonymous = 1 << (_misc_kind_field_size + 3), // has embedded _unsafe_anonymous_host field _misc_is_contended = 1 << (_misc_kind_field_size + 4), // marked with contended annotation ... At the very least this is a merge conflict that loom will need to deal with and it would help to know about in advance (Alan normally does the merges). thanks, Chris On 4/21/20 1:12 PM, coleen.phillim...@oracle.com wrote: Summary: moved fields around and some constant fields into ConstantPool This is a simple change except that I moved some constant fields from InstanceKlass into the constant pool so they can be shared read-only in the CDS archive. There are associated repercussions in SA and JVMCI, so please look at these changes. Also moved similarly sized fields together in the class so there's less likelihood of introducing gaps in future InstanceKlass changes. InstanceKlass is reduced from 544 to 520 bytes in a simple Hello World class. open webrev at http://cr.openjdk.java.net/~coleenp/2020/8238048.01/webrev bug link https://bugs.openjdk.java.net/browse/JDK-8238048 Tested with tier1-6. Thanks, Coleen
Re: RFR (M) Close alignment gaps in InstanceKlass
On 4/21/20 4:41 PM, Chris Plummer wrote: Hi Coleen, The SA changes look good. BTW, I've already made the TestIntConstant.java change in the Loom project. InstanceKlass::_misc_is_unsafe_anonymous was already changed to "8" in loom. You might want to sync up with Ron to make sure you aren't making conflicting changes in this area. Your code looks like: 249 enum { 250 _misc_rewritten = 1 << 0, // methods rewritten. 251 _misc_has_nonstatic_fields = 1 << 1, // for sizing with UseCompressedOops 252 _misc_should_verify_class = 1 << 2, // allow caching of preverification 253 _misc_is_unsafe_anonymous = 1 << 3, // has embedded _unsafe_anonymous_host field 254 _misc_is_contended = 1 << 4, // marked with contended annotation Loom looks like: static const unsigned _misc_kind_field_size = 0; ... // Start after _misc_kind field. enum { _misc_rewritten = 1 << (_misc_kind_field_size + 0), // methods rewritten. _misc_has_nonstatic_fields = 1 << (_misc_kind_field_size + 1), // for sizing with UseCompressedOops _misc_should_verify_class = 1 << (_misc_kind_field_size + 2), // allow caching of preverification _misc_is_unsafe_anonymous = 1 << (_misc_kind_field_size + 3), // has embedded _unsafe_anonymous_host field _misc_is_contended = 1 << (_misc_kind_field_size + 4), // marked with contended annotation ... At the very least this is a merge conflict that loom will need to deal with and it would help to know about in advance (Alan normally does the merges). It looks like there are other changes in loom that motivated changing it like this. Why is misc_kind_field_size = 0? Did loom add more misc_flags ? It turns out that there are plenty of available flags in the access_flags if more are needed. Thank you for looking at the SA changes. Coelen thanks, Chris On 4/21/20 1:12 PM, coleen.phillim...@oracle.com wrote: Summary: moved fields around and some constant fields into ConstantPool This is a simple change except that I moved some constant fields from InstanceKlass into the constant pool so they can be shared read-only in the CDS archive. There are associated repercussions in SA and JVMCI, so please look at these changes. Also moved similarly sized fields together in the class so there's less likelihood of introducing gaps in future InstanceKlass changes. InstanceKlass is reduced from 544 to 520 bytes in a simple Hello World class. open webrev at http://cr.openjdk.java.net/~coleenp/2020/8238048.01/webrev bug link https://bugs.openjdk.java.net/browse/JDK-8238048 Tested with tier1-6. Thanks, Coleen
Re: RFR (M) Close alignment gaps in InstanceKlass
On 4/21/20 4:41 PM, Chris Plummer wrote: Hi Coleen, The SA changes look good. BTW, I've already made the TestIntConstant.java change in the Loom project. InstanceKlass::_misc_is_unsafe_anonymous was already changed to "8" in loom. You might want to sync up with Ron to make sure you aren't making conflicting changes in this area. Your code looks like: 249 enum { 250 _misc_rewritten = 1 << 0, // methods rewritten. 251 _misc_has_nonstatic_fields = 1 << 1, // for sizing with UseCompressedOops 252 _misc_should_verify_class = 1 << 2, // allow caching of preverification 253 _misc_is_unsafe_anonymous = 1 << 3, // has embedded _unsafe_anonymous_host field 254 _misc_is_contended = 1 << 4, // marked with contended annotation Loom looks like: static const unsigned _misc_kind_field_size = 0; ... // Start after _misc_kind field. enum { _misc_rewritten = 1 << (_misc_kind_field_size + 0), // methods rewritten. _misc_has_nonstatic_fields = 1 << (_misc_kind_field_size + 1), // for sizing with UseCompressedOops _misc_should_verify_class = 1 << (_misc_kind_field_size + 2), // allow caching of preverification _misc_is_unsafe_anonymous = 1 << (_misc_kind_field_size + 3), // has embedded _unsafe_anonymous_host field _misc_is_contended = 1 << (_misc_kind_field_size + 4), // marked with contended annotation ... At the very least this is a merge conflict that loom will need to deal with and it would help to know about in advance (Alan normally does the merges). Actually I just had a look at the loom instanceKlass.hpp and this change helps that. Loom adds a kind of InstanceKlass, so changed the field to a u1 as I have done. This will clean up loom too. Thanks, Coleen thanks, Chris On 4/21/20 1:12 PM, coleen.phillim...@oracle.com wrote: Summary: moved fields around and some constant fields into ConstantPool This is a simple change except that I moved some constant fields from InstanceKlass into the constant pool so they can be shared read-only in the CDS archive. There are associated repercussions in SA and JVMCI, so please look at these changes. Also moved similarly sized fields together in the class so there's less likelihood of introducing gaps in future InstanceKlass changes. InstanceKlass is reduced from 544 to 520 bytes in a simple Hello World class. open webrev at http://cr.openjdk.java.net/~coleenp/2020/8238048.01/webrev bug link https://bugs.openjdk.java.net/browse/JDK-8238048 Tested with tier1-6. Thanks, Coleen
Re: RFR (M) Close alignment gaps in InstanceKlass
Hi Coleen. The JVMCI changes look OK. It looks like there is a Graal unittest that covers getSourceFileName, but those tests don't always get run. If it's not too much trouble, could you look into enabling getSourceFileName() testing in test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java ? It's currently on the "untested" list. thanks, dl On 4/21/20 1:12 PM, coleen.phillim...@oracle.com wrote: Summary: moved fields around and some constant fields into ConstantPool This is a simple change except that I moved some constant fields from InstanceKlass into the constant pool so they can be shared read-only in the CDS archive. There are associated repercussions in SA and JVMCI, so please look at these changes. Also moved similarly sized fields together in the class so there's less likelihood of introducing gaps in future InstanceKlass changes. InstanceKlass is reduced from 544 to 520 bytes in a simple Hello World class. open webrev at http://cr.openjdk.java.net/~coleenp/2020/8238048.01/webrev bug link https://bugs.openjdk.java.net/browse/JDK-8238048 Tested with tier1-6. Thanks, Coleen
Re: RFR (M) Close alignment gaps in InstanceKlass
Hi Dean, Thank you for looking at the JVMCI changes and the suggestion to add the test. I did this and found a bug. The new test is quite limited because there's no good test to see if a source file name can assertNotNull(type.getSourceFileName()), so I couldn't iterate through the list of loaded classes like the other tests in that file. http://cr.openjdk.java.net/~coleenp/2020/8238048.02.incr/webrev/index.html Thanks, Coleen On 4/21/20 9:51 PM, Dean Long wrote: Hi Coleen. The JVMCI changes look OK. It looks like there is a Graal unittest that covers getSourceFileName, but those tests don't always get run. If it's not too much trouble, could you look into enabling getSourceFileName() testing in test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java ? It's currently on the "untested" list. thanks, dl On 4/21/20 1:12 PM, coleen.phillim...@oracle.com wrote: Summary: moved fields around and some constant fields into ConstantPool This is a simple change except that I moved some constant fields from InstanceKlass into the constant pool so they can be shared read-only in the CDS archive. There are associated repercussions in SA and JVMCI, so please look at these changes. Also moved similarly sized fields together in the class so there's less likelihood of introducing gaps in future InstanceKlass changes. InstanceKlass is reduced from 544 to 520 bytes in a simple Hello World class. open webrev at http://cr.openjdk.java.net/~coleenp/2020/8238048.01/webrev bug link https://bugs.openjdk.java.net/browse/JDK-8238048 Tested with tier1-6. Thanks, Coleen
Re: RFR (M) Close alignment gaps in InstanceKlass
Can you compare the result to some string, like "Object.java"? That seems to be what HotSpotResolvedObjectTypeTest.java is doing. Also, did getSourceFileName() return null for arrays before your change? dl On 4/22/20 8:18 AM, coleen.phillim...@oracle.com wrote: Hi Dean, Thank you for looking at the JVMCI changes and the suggestion to add the test. I did this and found a bug. The new test is quite limited because there's no good test to see if a source file name can assertNotNull(type.getSourceFileName()), so I couldn't iterate through the list of loaded classes like the other tests in that file. http://cr.openjdk.java.net/~coleenp/2020/8238048.02.incr/webrev/index.html Thanks, Coleen On 4/21/20 9:51 PM, Dean Long wrote: Hi Coleen. The JVMCI changes look OK. It looks like there is a Graal unittest that covers getSourceFileName, but those tests don't always get run. If it's not too much trouble, could you look into enabling getSourceFileName() testing in test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java ? It's currently on the "untested" list. thanks, dl On 4/21/20 1:12 PM, coleen.phillim...@oracle.com wrote: Summary: moved fields around and some constant fields into ConstantPool This is a simple change except that I moved some constant fields from InstanceKlass into the constant pool so they can be shared read-only in the CDS archive. There are associated repercussions in SA and JVMCI, so please look at these changes. Also moved similarly sized fields together in the class so there's less likelihood of introducing gaps in future InstanceKlass changes. InstanceKlass is reduced from 544 to 520 bytes in a simple Hello World class. open webrev at http://cr.openjdk.java.net/~coleenp/2020/8238048.01/webrev bug link https://bugs.openjdk.java.net/browse/JDK-8238048 Tested with tier1-6. Thanks, Coleen
Re: RFR (M) Close alignment gaps in InstanceKlass
It looks like calling the JVMCI getSourceFileName() on an array would have accessed random memory because it was expecting an InstanceKlass. Instead of returning null we might want to throw an exception like in HotSpotResolvedPrimitiveType. dl On 4/22/20 5:39 PM, Dean Long wrote: Can you compare the result to some string, like "Object.java"? That seems to be what HotSpotResolvedObjectTypeTest.java is doing. Also, did getSourceFileName() return null for arrays before your change? dl On 4/22/20 8:18 AM, coleen.phillim...@oracle.com wrote: Hi Dean, Thank you for looking at the JVMCI changes and the suggestion to add the test. I did this and found a bug. The new test is quite limited because there's no good test to see if a source file name can assertNotNull(type.getSourceFileName()), so I couldn't iterate through the list of loaded classes like the other tests in that file. http://cr.openjdk.java.net/~coleenp/2020/8238048.02.incr/webrev/index.html Thanks, Coleen On 4/21/20 9:51 PM, Dean Long wrote: Hi Coleen. The JVMCI changes look OK. It looks like there is a Graal unittest that covers getSourceFileName, but those tests don't always get run. If it's not too much trouble, could you look into enabling getSourceFileName() testing in test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java ? It's currently on the "untested" list. thanks, dl On 4/21/20 1:12 PM, coleen.phillim...@oracle.com wrote: Summary: moved fields around and some constant fields into ConstantPool This is a simple change except that I moved some constant fields from InstanceKlass into the constant pool so they can be shared read-only in the CDS archive. There are associated repercussions in SA and JVMCI, so please look at these changes. Also moved similarly sized fields together in the class so there's less likelihood of introducing gaps in future InstanceKlass changes. InstanceKlass is reduced from 544 to 520 bytes in a simple Hello World class. open webrev at http://cr.openjdk.java.net/~coleenp/2020/8238048.01/webrev bug link https://bugs.openjdk.java.net/browse/JDK-8238048 Tested with tier1-6. Thanks, Coleen
Re: RFR (M) Close alignment gaps in InstanceKlass
On 4/22/20 9:00 PM, Dean Long wrote: It looks like calling the JVMCI getSourceFileName() on an array would have accessed random memory because it was expecting an InstanceKlass. Instead of returning null we might want to throw an exception like in HotSpotResolvedPrimitiveType. It was never called, except when I tried to call it on an array in the test. It caused an assert in the hotspot code. How about this? Something else in that file throws JVMCIError with a similar message. public String getSourceFileName() { if (isArray()) { throw new JVMCIError("Cannot call getSourceFileName() on an array klass type: %s", this); } return getConstantPool().getSourceFileName(); } dl On 4/22/20 5:39 PM, Dean Long wrote: Can you compare the result to some string, like "Object.java"? That seems to be what HotSpotResolvedObjectTypeTest.java is doing. Also, did getSourceFileName() return null for arrays before your change? Fixed: public void getSourceFileNameTest() { Class c = Object.class; ResolvedJavaType type = metaAccess.lookupJavaType(c); assertEquals(type.getSourceFileName(), "Object.java"); } thanks, Coleen dl On 4/22/20 8:18 AM, coleen.phillim...@oracle.com wrote: Hi Dean, Thank you for looking at the JVMCI changes and the suggestion to add the test. I did this and found a bug. The new test is quite limited because there's no good test to see if a source file name can assertNotNull(type.getSourceFileName()), so I couldn't iterate through the list of loaded classes like the other tests in that file. http://cr.openjdk.java.net/~coleenp/2020/8238048.02.incr/webrev/index.html Thanks, Coleen On 4/21/20 9:51 PM, Dean Long wrote: Hi Coleen. The JVMCI changes look OK. It looks like there is a Graal unittest that covers getSourceFileName, but those tests don't always get run. If it's not too much trouble, could you look into enabling getSourceFileName() testing in test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java ? It's currently on the "untested" list. thanks, dl On 4/21/20 1:12 PM, coleen.phillim...@oracle.com wrote: Summary: moved fields around and some constant fields into ConstantPool This is a simple change except that I moved some constant fields from InstanceKlass into the constant pool so they can be shared read-only in the CDS archive. There are associated repercussions in SA and JVMCI, so please look at these changes. Also moved similarly sized fields together in the class so there's less likelihood of introducing gaps in future InstanceKlass changes. InstanceKlass is reduced from 544 to 520 bytes in a simple Hello World class. open webrev at http://cr.openjdk.java.net/~coleenp/2020/8238048.01/webrev bug link https://bugs.openjdk.java.net/browse/JDK-8238048 Tested with tier1-6. Thanks, Coleen
Re: RFR (M) Close alignment gaps in InstanceKlass
Thanks, Ioi! Coleen On 4/23/20 12:43 PM, Ioi Lam wrote: Hi Coleen, The changes look good to me. Thanks - Ioi On 4/21/20 1:12 PM, coleen.phillim...@oracle.com wrote: Summary: moved fields around and some constant fields into ConstantPool This is a simple change except that I moved some constant fields from InstanceKlass into the constant pool so they can be shared read-only in the CDS archive. There are associated repercussions in SA and JVMCI, so please look at these changes. Also moved similarly sized fields together in the class so there's less likelihood of introducing gaps in future InstanceKlass changes. InstanceKlass is reduced from 544 to 520 bytes in a simple Hello World class. open webrev at http://cr.openjdk.java.net/~coleenp/2020/8238048.01/webrev bug link https://bugs.openjdk.java.net/browse/JDK-8238048 Tested with tier1-6. Thanks, Coleen
Re: RFR (M) Close alignment gaps in InstanceKlass
OK, thanks, looks good! dl On 4/22/20 7:32 PM, coleen.phillim...@oracle.com wrote: On 4/22/20 9:00 PM, Dean Long wrote: It looks like calling the JVMCI getSourceFileName() on an array would have accessed random memory because it was expecting an InstanceKlass. Instead of returning null we might want to throw an exception like in HotSpotResolvedPrimitiveType. It was never called, except when I tried to call it on an array in the test. It caused an assert in the hotspot code. How about this? Something else in that file throws JVMCIError with a similar message. public String getSourceFileName() { if (isArray()) { throw new JVMCIError("Cannot call getSourceFileName() on an array klass type: %s", this); } return getConstantPool().getSourceFileName(); } dl On 4/22/20 5:39 PM, Dean Long wrote: Can you compare the result to some string, like "Object.java"? That seems to be what HotSpotResolvedObjectTypeTest.java is doing. Also, did getSourceFileName() return null for arrays before your change? Fixed: public void getSourceFileNameTest() { Class c = Object.class; ResolvedJavaType type = metaAccess.lookupJavaType(c); assertEquals(type.getSourceFileName(), "Object.java"); } thanks, Coleen dl On 4/22/20 8:18 AM, coleen.phillim...@oracle.com wrote: Hi Dean, Thank you for looking at the JVMCI changes and the suggestion to add the test. I did this and found a bug. The new test is quite limited because there's no good test to see if a source file name can assertNotNull(type.getSourceFileName()), so I couldn't iterate through the list of loaded classes like the other tests in that file. http://cr.openjdk.java.net/~coleenp/2020/8238048.02.incr/webrev/index.html Thanks, Coleen On 4/21/20 9:51 PM, Dean Long wrote: Hi Coleen. The JVMCI changes look OK. It looks like there is a Graal unittest that covers getSourceFileName, but those tests don't always get run. If it's not too much trouble, could you look into enabling getSourceFileName() testing in test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java ? It's currently on the "untested" list. thanks, dl On 4/21/20 1:12 PM, coleen.phillim...@oracle.com wrote: Summary: moved fields around and some constant fields into ConstantPool This is a simple change except that I moved some constant fields from InstanceKlass into the constant pool so they can be shared read-only in the CDS archive. There are associated repercussions in SA and JVMCI, so please look at these changes. Also moved similarly sized fields together in the class so there's less likelihood of introducing gaps in future InstanceKlass changes. InstanceKlass is reduced from 544 to 520 bytes in a simple Hello World class. open webrev at http://cr.openjdk.java.net/~coleenp/2020/8238048.01/webrev bug link https://bugs.openjdk.java.net/browse/JDK-8238048 Tested with tier1-6. Thanks, Coleen
Re: RFR (M) Close alignment gaps in InstanceKlass
Thanks, Dean! Coleen On 4/23/20 4:16 PM, Dean Long wrote: OK, thanks, looks good! dl On 4/22/20 7:32 PM, coleen.phillim...@oracle.com wrote: On 4/22/20 9:00 PM, Dean Long wrote: It looks like calling the JVMCI getSourceFileName() on an array would have accessed random memory because it was expecting an InstanceKlass. Instead of returning null we might want to throw an exception like in HotSpotResolvedPrimitiveType. It was never called, except when I tried to call it on an array in the test. It caused an assert in the hotspot code. How about this? Something else in that file throws JVMCIError with a similar message. public String getSourceFileName() { if (isArray()) { throw new JVMCIError("Cannot call getSourceFileName() on an array klass type: %s", this); } return getConstantPool().getSourceFileName(); } dl On 4/22/20 5:39 PM, Dean Long wrote: Can you compare the result to some string, like "Object.java"? That seems to be what HotSpotResolvedObjectTypeTest.java is doing. Also, did getSourceFileName() return null for arrays before your change? Fixed: public void getSourceFileNameTest() { Class c = Object.class; ResolvedJavaType type = metaAccess.lookupJavaType(c); assertEquals(type.getSourceFileName(), "Object.java"); } thanks, Coleen dl On 4/22/20 8:18 AM, coleen.phillim...@oracle.com wrote: Hi Dean, Thank you for looking at the JVMCI changes and the suggestion to add the test. I did this and found a bug. The new test is quite limited because there's no good test to see if a source file name can assertNotNull(type.getSourceFileName()), so I couldn't iterate through the list of loaded classes like the other tests in that file. http://cr.openjdk.java.net/~coleenp/2020/8238048.02.incr/webrev/index.html Thanks, Coleen On 4/21/20 9:51 PM, Dean Long wrote: Hi Coleen. The JVMCI changes look OK. It looks like there is a Graal unittest that covers getSourceFileName, but those tests don't always get run. If it's not too much trouble, could you look into enabling getSourceFileName() testing in test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java ? It's currently on the "untested" list. thanks, dl On 4/21/20 1:12 PM, coleen.phillim...@oracle.com wrote: Summary: moved fields around and some constant fields into ConstantPool This is a simple change except that I moved some constant fields from InstanceKlass into the constant pool so they can be shared read-only in the CDS archive. There are associated repercussions in SA and JVMCI, so please look at these changes. Also moved similarly sized fields together in the class so there's less likelihood of introducing gaps in future InstanceKlass changes. InstanceKlass is reduced from 544 to 520 bytes in a simple Hello World class. open webrev at http://cr.openjdk.java.net/~coleenp/2020/8238048.01/webrev bug link https://bugs.openjdk.java.net/browse/JDK-8238048 Tested with tier1-6. Thanks, Coleen