Discussion:
RFR: 8207263: Store the Configuration for system modules into CDS archive
Claes Redestad
2018-08-04 16:22:14 UTC
Permalink
Hi,

Jiangli and I discussed a subtle issue with the archiving changes here
last week (she's currently on vacation, and I was at JVMLS this week, so
it was never brought to the list, sorry!)

Basically: the empty configuration uses things like
Collections.emptySet(), which means it will end up deserializing an
object from the archive that doesn't (necessarily) have the same
identity as the object retrieved from direct uses of Collection.emptySet().

Same goes for the Set.of()/Map.of()/List.of() singletons which might now
already exist at runtime in two versions since the change to archive
ModuleDescriptors. Oops!

This glitch is probably fine semantically for most intents and purposes,
but could lead to some unnecessary inefficiencies and theoretically real
surprises/bugs, so we probably need to ensure that all singletons we
serialize retain the property that they are identical to the object a
caller of the respective getter would receive.

I think this can be deferred to a must-fix follow-up, mainly since
there's some benefit in first cleaning up a few things here first:

- currently we have uses of both Collections.emptyFoo() and Foo.of() in
the ModuleDescriptor/Configuration code

- to be correct, we thus need to archive the Collections.emptyFoo()
singletons *and* the various java.util.ImmutableCollections ones

- if we first consolidated all uses of Collections.emptyFoo() to
Foo.of() (in java.lang.module), we'd only need to archive the immutable
singletons in java.util.ImmutableCollections

Consolidating to Foo.of() was actually already being considered anyway,
so I'll go ahead with a separate RFE..

Thanks!

/Claes
Many thanks to Alan and Claes for discussions and contributions to
this change!
Webrev: http://cr.openjdk.java.net/~jiangli/8207263/webrev.00/
Jiangli Zhou
2018-08-06 17:10:04 UTC
Permalink
Hi Claes,

Thanks for filing JDK-8209003
(https://bugs.openjdk.java.net/browse/JDK-8209003)! I'll look into
archiving the immutable singletons in ImmutableCollections.

Thanks again!!

Jiangli
Post by Claes Redestad
Hi,
Jiangli and I discussed a subtle issue with the archiving changes here
last week (she's currently on vacation, and I was at JVMLS this week,
so it was never brought to the list, sorry!)
Basically: the empty configuration uses things like
Collections.emptySet(), which means it will end up deserializing an
object from the archive that doesn't (necessarily) have the same
identity as the object retrieved from direct uses of
Collection.emptySet().
Same goes for the Set.of()/Map.of()/List.of() singletons which might
now already exist at runtime in two versions since the change to
archive ModuleDescriptors. Oops!
This glitch is probably fine semantically for most intents and
purposes, but could lead to some unnecessary inefficiencies and
theoretically real surprises/bugs, so we probably need to ensure that
all singletons we serialize retain the property that they are
identical to the object a caller of the respective getter would receive.
I think this can be deferred to a must-fix follow-up, mainly since
- currently we have uses of both Collections.emptyFoo() and Foo.of()
in the ModuleDescriptor/Configuration code
- to be correct, we thus need to archive the Collections.emptyFoo()
singletons *and* the various java.util.ImmutableCollections ones
- if we first consolidated all uses of Collections.emptyFoo() to
Foo.of() (in java.lang.module), we'd only need to archive the
immutable singletons in java.util.ImmutableCollections
Consolidating to Foo.of() was actually already being considered
anyway, so I'll go ahead with a separate RFE..
Thanks!
/Claes
Many thanks to Alan and Claes for discussions and contributions to
this change!
Webrev: http://cr.openjdk.java.net/~jiangli/8207263/webrev.00/
Alan Bateman
2018-08-06 18:42:58 UTC
Permalink
Post by Claes Redestad
Hi,
Jiangli and I discussed a subtle issue with the archiving changes here
last week (she's currently on vacation, and I was at JVMLS this week,
so it was never brought to the list, sorry!)
Basically: the empty configuration uses things like
Collections.emptySet(), which means it will end up deserializing an
object from the archive that doesn't (necessarily) have the same
identity as the object retrieved from direct uses of
Collection.emptySet().
Same goes for the Set.of()/Map.of()/List.of() singletons which might
now already exist at runtime in two versions since the change to
archive ModuleDescriptors. Oops!
This glitch is probably fine semantically for most intents and
purposes, but could lead to some unnecessary inefficiencies and
theoretically real surprises/bugs, so we probably need to ensure that
all singletons we serialize retain the property that they are
identical to the object a caller of the respective getter would receive.
I think this can be deferred to a must-fix follow-up, mainly since
- currently we have uses of both Collections.emptyFoo() and Foo.of()
in the ModuleDescriptor/Configuration code
- to be correct, we thus need to archive the Collections.emptyFoo()
singletons *and* the various java.util.ImmutableCollections ones
- if we first consolidated all uses of Collections.emptyFoo() to
Foo.of() (in java.lang.module), we'd only need to archive the
immutable singletons in java.util.ImmutableCollections
It's good to bring this up. I don't think there is a real issue right
now but it is a lurking hazard. As I recall, we started out in
java.lang.module long before the immutable collections were added so
this is why it has been using Collections.emptyXXX(). There shouldn't be
any issues changing all these usages to XXX.of().

A discussion for core-libs-dev but I wonder if we could get to the point
where emptyXXX() and XXX.of() returns the same empty collection so that
we don't have any issues elsewhere.

-Alan
Jiangli Zhou
2018-08-08 23:43:26 UTC
Permalink
Thanks Claes for resolving JDK-8209003 quickly. Here is my updated
weberv that includes following changes:

- Added archiving for singletons in ImmutableCollections
(ListN.EMPTY_LIST, SetN.EMPTY_SET and MapN.EMPTY_MAP). Please see
changes in ImmutableCollections.java.
- Incorporated Calvin and Ioi feedbacks on vmSymbols.hpp.
- Added a new test case to check the parents and modules of archived
EMPTY_CONFIGURATION.
- Added argument length check in CheckArchivedModuleApp.java test as
Calvin suggested.

http://cr.openjdk.java.net/~jiangli/8207263/webrev.01/

Thanks,
Jiangli
Hi Calvin and Ioi,
Thanks for reviewing the change! I'll incorporate your suggestions.
As Claes pointed out in his email, there was a subtle issue with the
empty configuration, which was undetected by the testing for archiving
changes but could introduce a bug in certain cases. Claes has already
filed JDK-8209003 for consolidating empty collections usage in module
code. I'll look into archiving the immutable singletons in
java.util.ImmutableCollections.
Thanks!
Jiangli
Hi Jiangli,
The changes look good to me.
1) vmSymbols.hpp
 653   template(url_void_signature, "(Ljava/net/URL;)V") \
 654   template(toFileURL_name, "toFileURL") \
 655   template(toFileURL_signature,
"(Ljava/lang/String;)Ljava/net/URL;")
Since you've moved the above lines to after
“template(systemModules_signature, …”, I’d suggest rearrange the
entire block (lines 652 - 659) in alphabetical order.
Hi Jiangli,
I've reviewed the code. It looks like a clean change and it's great
to make further progress in start-up improvement!
Just a small note on vmSymbols.hpp:  this line can be deleted because
the symbol is no longer used.
  template(jdk_vm_cds_SharedClassInfo, "jdk/vm/cds/SharedClassInfo")
Thanks
- Ioi
2) CheckArchivedModuleApp.java
Since it now expects two input args, I’d suggest checking the number
of input args and throw an exception if it is not equal to two.
thanks,
Calvin
Please review the following webrev that archives the system module
boot layer Configuration (including all java objects reachable from
the Configuration) in CDS archive. This is built on top of the
earlier change for JDK-8202035
(https://bugs.openjdk.java.net/browse/JDK-8202035), which provides
a framework for object sub-graph archiving.
The boot layer Configuration is created in ModuleBootstrap.boot()
(similar to the archived system ModuleDescriptor objects, etc) and
is unchanged after construction. With archived boot layer
Configuration, it allows runtime to bypass the work for creating
the configuration. Currently, this is only supported when the
initial module is unnamed module. Measurements indicate archiving
the boot layer Configuration improves the startup time by 1% ~ 1.5%
(on linux-x64) when running HelloWorld from -cp at runtime.
Many thanks to Alan and Claes for discussions and contributions to
this change!
Webrev: http://cr.openjdk.java.net/~jiangli/8207263/webrev.00/
RFE: https://bugs.openjdk.java.net/browse/JDK-8207263
Tested with tier1 - tier5 tests via mach5.
Thanks,
Jiangli
Claes Redestad
2018-08-09 09:55:05 UTC
Permalink
Library and test changes look good to me. Nits:

ImmutableCollections:

- // Initialize EMPTY_FOO from the archive comments feel redundant

CheckArchivedModule:

- perhaps call out that checking identity is necessary and intentional

/Claes
Post by Jiangli Zhou
Thanks Claes for resolving JDK-8209003 quickly. Here is my updated
- Added archiving for singletons in ImmutableCollections
(ListN.EMPTY_LIST, SetN.EMPTY_SET and MapN.EMPTY_MAP). Please see
changes in ImmutableCollections.java.
- Incorporated Calvin and Ioi feedbacks on vmSymbols.hpp.
- Added a new test case to check the parents and modules of archived
EMPTY_CONFIGURATION.
- Added argument length check in CheckArchivedModuleApp.java test as
Calvin suggested.
http://cr.openjdk.java.net/~jiangli/8207263/webrev.01/
Thanks,
Jiangli
Hi Calvin and Ioi,
Thanks for reviewing the change! I'll incorporate your suggestions.
As Claes pointed out in his email, there was a subtle issue with the
empty configuration, which was undetected by the testing for
archiving changes but could introduce a bug in certain cases. Claes
has already filed JDK-8209003 for consolidating empty collections
usage in module code. I'll look into archiving the immutable
singletons in java.util.ImmutableCollections.
Thanks!
Jiangli
Hi Jiangli,
The changes look good to me.
1) vmSymbols.hpp
 653   template(url_void_signature, "(Ljava/net/URL;)V") \
 654   template(toFileURL_name, "toFileURL") \
 655   template(toFileURL_signature,
"(Ljava/lang/String;)Ljava/net/URL;")
Since you've moved the above lines to after
“template(systemModules_signature, …”, I’d suggest rearrange the
entire block (lines 652 - 659) in alphabetical order.
Hi Jiangli,
I've reviewed the code. It looks like a clean change and it's great
to make further progress in start-up improvement!
Just a small note on vmSymbols.hpp:  this line can be deleted
because the symbol is no longer used.
  template(jdk_vm_cds_SharedClassInfo, "jdk/vm/cds/SharedClassInfo")
Thanks
- Ioi
2) CheckArchivedModuleApp.java
Since it now expects two input args, I’d suggest checking the
number of input args and throw an exception if it is not equal to two.
thanks,
Calvin
Please review the following webrev that archives the system module
boot layer Configuration (including all java objects reachable
from the Configuration) in CDS archive. This is built on top of
the earlier change for JDK-8202035
(https://bugs.openjdk.java.net/browse/JDK-8202035), which provides
a framework for object sub-graph archiving.
The boot layer Configuration is created in ModuleBootstrap.boot()
(similar to the archived system ModuleDescriptor objects, etc) and
is unchanged after construction. With archived boot layer
Configuration, it allows runtime to bypass the work for creating
the configuration. Currently, this is only supported when the
initial module is unnamed module. Measurements indicate archiving
the boot layer Configuration improves the startup time by 1% ~
1.5% (on linux-x64) when running HelloWorld from -cp at runtime.
Many thanks to Alan and Claes for discussions and contributions to
this change!
Webrev: http://cr.openjdk.java.net/~jiangli/8207263/webrev.00/
RFE: https://bugs.openjdk.java.net/browse/JDK-8207263
Tested with tier1 - tier5 tests via mach5.
Thanks,
Jiangli
Jiangli Zhou
2018-08-09 15:50:16 UTC
Permalink
Hi Claes,

Thanks for reviewing the library and test changes! I'll remove the
comments that you pointed below from ImmutableCollections and update the
CheckArchivedModule test.

Thanks!

Jiangli
Post by Claes Redestad
- // Initialize EMPTY_FOO from the archive comments feel redundant
- perhaps call out that checking identity is necessary and intentional
/Claes
Post by Jiangli Zhou
Thanks Claes for resolving JDK-8209003 quickly. Here is my updated
- Added archiving for singletons in ImmutableCollections
(ListN.EMPTY_LIST, SetN.EMPTY_SET and MapN.EMPTY_MAP). Please see
changes in ImmutableCollections.java.
- Incorporated Calvin and Ioi feedbacks on vmSymbols.hpp.
- Added a new test case to check the parents and modules of archived
EMPTY_CONFIGURATION.
- Added argument length check in CheckArchivedModuleApp.java test as
Calvin suggested.
http://cr.openjdk.java.net/~jiangli/8207263/webrev.01/
Thanks,
Jiangli
Hi Calvin and Ioi,
Thanks for reviewing the change! I'll incorporate your suggestions.
As Claes pointed out in his email, there was a subtle issue with the
empty configuration, which was undetected by the testing for
archiving changes but could introduce a bug in certain cases. Claes
has already filed JDK-8209003 for consolidating empty collections
usage in module code. I'll look into archiving the immutable
singletons in java.util.ImmutableCollections.
Thanks!
Jiangli
Hi Jiangli,
The changes look good to me.
1) vmSymbols.hpp
 653   template(url_void_signature, "(Ljava/net/URL;)V") \
 654   template(toFileURL_name, "toFileURL") \
 655   template(toFileURL_signature,
"(Ljava/lang/String;)Ljava/net/URL;")
Since you've moved the above lines to after
“template(systemModules_signature, …”, I’d suggest rearrange the
entire block (lines 652 - 659) in alphabetical order.
Hi Jiangli,
I've reviewed the code. It looks like a clean change and it's great
to make further progress in start-up improvement!
Just a small note on vmSymbols.hpp:  this line can be deleted
because the symbol is no longer used.
  template(jdk_vm_cds_SharedClassInfo, "jdk/vm/cds/SharedClassInfo")
Thanks
- Ioi
2) CheckArchivedModuleApp.java
Since it now expects two input args, I’d suggest checking the
number of input args and throw an exception if it is not equal to two.
thanks,
Calvin
Please review the following webrev that archives the system
module boot layer Configuration (including all java objects
reachable from the Configuration) in CDS archive. This is built
on top of the earlier change for JDK-8202035
(https://bugs.openjdk.java.net/browse/JDK-8202035), which
provides a framework for object sub-graph archiving.
The boot layer Configuration is created in ModuleBootstrap.boot()
(similar to the archived system ModuleDescriptor objects, etc)
and is unchanged after construction. With archived boot layer
Configuration, it allows runtime to bypass the work for creating
the configuration. Currently, this is only supported when the
initial module is unnamed module. Measurements indicate archiving
the boot layer Configuration improves the startup time by 1% ~
1.5% (on linux-x64) when running HelloWorld from -cp at runtime.
Many thanks to Alan and Claes for discussions and contributions
to this change!
Webrev: http://cr.openjdk.java.net/~jiangli/8207263/webrev.00/
RFE: https://bugs.openjdk.java.net/browse/JDK-8207263
Tested with tier1 - tier5 tests via mach5.
Thanks,
Jiangli
Jiangli Zhou
2018-08-09 18:42:06 UTC
Permalink
Here is the updated webrev with comment changes suggested by Claes:

http://cr.openjdk.java.net/~jiangli/8207263/webrev.02/

Updated files:
http://cr.openjdk.java.net/~jiangli/8207263/webrev.02/src/java.base/share/classes/java/util/ImmutableCollections.java.frames.html
http://cr.openjdk.java.net/~jiangli/8207263/webrev.02/src/java.base/share/classes/jdk/internal/module/ArchivedModuleGraph.java.frames.html

Thanks,
Jiangli
Post by Jiangli Zhou
Hi Claes,
Thanks for reviewing the library and test changes! I'll remove the
comments that you pointed below from ImmutableCollections and update
the CheckArchivedModule test.
Thanks!
Jiangli
Post by Claes Redestad
- // Initialize EMPTY_FOO from the archive comments feel redundant
- perhaps call out that checking identity is necessary and intentional
/Claes
Post by Jiangli Zhou
Thanks Claes for resolving JDK-8209003 quickly. Here is my updated
- Added archiving for singletons in ImmutableCollections
(ListN.EMPTY_LIST, SetN.EMPTY_SET and MapN.EMPTY_MAP). Please see
changes in ImmutableCollections.java.
- Incorporated Calvin and Ioi feedbacks on vmSymbols.hpp.
- Added a new test case to check the parents and modules of archived
EMPTY_CONFIGURATION.
- Added argument length check in CheckArchivedModuleApp.java test as
Calvin suggested.
http://cr.openjdk.java.net/~jiangli/8207263/webrev.01/
Thanks,
Jiangli
Hi Calvin and Ioi,
Thanks for reviewing the change! I'll incorporate your suggestions.
As Claes pointed out in his email, there was a subtle issue with
the empty configuration, which was undetected by the testing for
archiving changes but could introduce a bug in certain cases. Claes
has already filed JDK-8209003 for consolidating empty collections
usage in module code. I'll look into archiving the immutable
singletons in java.util.ImmutableCollections.
Thanks!
Jiangli
Hi Jiangli,
The changes look good to me.
1) vmSymbols.hpp
 653   template(url_void_signature, "(Ljava/net/URL;)V") \
 654   template(toFileURL_name, "toFileURL") \
 655   template(toFileURL_signature,
"(Ljava/lang/String;)Ljava/net/URL;")
Since you've moved the above lines to after
“template(systemModules_signature, …”, I’d suggest rearrange the
entire block (lines 652 - 659) in alphabetical order.
Hi Jiangli,
I've reviewed the code. It looks like a clean change and it's
great to make further progress in start-up improvement!
Just a small note on vmSymbols.hpp:  this line can be deleted
because the symbol is no longer used.
  template(jdk_vm_cds_SharedClassInfo, "jdk/vm/cds/SharedClassInfo")
Thanks
- Ioi
2) CheckArchivedModuleApp.java
Since it now expects two input args, I’d suggest checking the
number of input args and throw an exception if it is not equal to two.
thanks,
Calvin
Please review the following webrev that archives the system
module boot layer Configuration (including all java objects
reachable from the Configuration) in CDS archive. This is built
on top of the earlier change for JDK-8202035
(https://bugs.openjdk.java.net/browse/JDK-8202035), which
provides a framework for object sub-graph archiving.
The boot layer Configuration is created in
ModuleBootstrap.boot() (similar to the archived system
ModuleDescriptor objects, etc) and is unchanged after
construction. With archived boot layer Configuration, it allows
runtime to bypass the work for creating the configuration.
Currently, this is only supported when the initial module is
unnamed module. Measurements indicate archiving the boot layer
Configuration improves the startup time by 1% ~ 1.5% (on
linux-x64) when running HelloWorld from -cp at runtime.
Many thanks to Alan and Claes for discussions and contributions
to this change!
Webrev: http://cr.openjdk.java.net/~jiangli/8207263/webrev.00/
RFE: https://bugs.openjdk.java.net/browse/JDK-8207263
Tested with tier1 - tier5 tests via mach5.
Thanks,
Jiangli
Claes Redestad
2018-08-09 19:13:37 UTC
Permalink
Updates looks good, thanks!

/Claes
Post by Jiangli Zhou
http://cr.openjdk.java.net/~jiangli/8207263/webrev.02/
http://cr.openjdk.java.net/~jiangli/8207263/webrev.02/src/java.base/share/classes/java/util/ImmutableCollections.java.frames.html
http://cr.openjdk.java.net/~jiangli/8207263/webrev.02/src/java.base/share/classes/jdk/internal/module/ArchivedModuleGraph.java.frames.html
Thanks,
Jiangli
Post by Jiangli Zhou
Hi Claes,
Thanks for reviewing the library and test changes! I'll remove the
comments that you pointed below from ImmutableCollections and update
the CheckArchivedModule test.
Thanks!
Jiangli
Post by Claes Redestad
- // Initialize EMPTY_FOO from the archive comments feel redundant
- perhaps call out that checking identity is necessary and intentional
/Claes
Post by Jiangli Zhou
Thanks Claes for resolving JDK-8209003 quickly. Here is my updated
- Added archiving for singletons in ImmutableCollections
(ListN.EMPTY_LIST, SetN.EMPTY_SET and MapN.EMPTY_MAP). Please see
changes in ImmutableCollections.java.
- Incorporated Calvin and Ioi feedbacks on vmSymbols.hpp.
- Added a new test case to check the parents and modules of
archived EMPTY_CONFIGURATION.
- Added argument length check in CheckArchivedModuleApp.java test
as Calvin suggested.
http://cr.openjdk.java.net/~jiangli/8207263/webrev.01/
Thanks,
Jiangli
Hi Calvin and Ioi,
Thanks for reviewing the change! I'll incorporate your suggestions.
As Claes pointed out in his email, there was a subtle issue with
the empty configuration, which was undetected by the testing for
archiving changes but could introduce a bug in certain cases.
Claes has already filed JDK-8209003 for consolidating empty
collections usage in module code. I'll look into archiving the
immutable singletons in java.util.ImmutableCollections.
Thanks!
Jiangli
Hi Jiangli,
The changes look good to me.
1) vmSymbols.hpp
 653   template(url_void_signature, "(Ljava/net/URL;)V") \
 654   template(toFileURL_name, "toFileURL") \
 655   template(toFileURL_signature,
"(Ljava/lang/String;)Ljava/net/URL;")
Since you've moved the above lines to after
“template(systemModules_signature, …”, I’d suggest rearrange the
entire block (lines 652 - 659) in alphabetical order.
Hi Jiangli,
I've reviewed the code. It looks like a clean change and it's
great to make further progress in start-up improvement!
Just a small note on vmSymbols.hpp:  this line can be deleted
because the symbol is no longer used.
  template(jdk_vm_cds_SharedClassInfo, "jdk/vm/cds/SharedClassInfo")
Thanks
- Ioi
2) CheckArchivedModuleApp.java
Since it now expects two input args, I’d suggest checking the
number of input args and throw an exception if it is not equal to two.
thanks,
Calvin
Please review the following webrev that archives the system
module boot layer Configuration (including all java objects
reachable from the Configuration) in CDS archive. This is built
on top of the earlier change for JDK-8202035
(https://bugs.openjdk.java.net/browse/JDK-8202035), which
provides a framework for object sub-graph archiving.
The boot layer Configuration is created in
ModuleBootstrap.boot() (similar to the archived system
ModuleDescriptor objects, etc) and is unchanged after
construction. With archived boot layer Configuration, it allows
runtime to bypass the work for creating the configuration.
Currently, this is only supported when the initial module is
unnamed module. Measurements indicate archiving the boot layer
Configuration improves the startup time by 1% ~ 1.5% (on
linux-x64) when running HelloWorld from -cp at runtime.
Many thanks to Alan and Claes for discussions and contributions
to this change!
Webrev: http://cr.openjdk.java.net/~jiangli/8207263/webrev.00/
RFE: https://bugs.openjdk.java.net/browse/JDK-8207263
Tested with tier1 - tier5 tests via mach5.
Thanks,
Jiangli
Jiangli Zhou
2018-08-09 19:10:20 UTC
Permalink
Thanks, Claes!

Jiangli
Post by Claes Redestad
Updates looks good, thanks!
/Claes
Post by Jiangli Zhou
http://cr.openjdk.java.net/~jiangli/8207263/webrev.02/
http://cr.openjdk.java.net/~jiangli/8207263/webrev.02/src/java.base/share/classes/java/util/ImmutableCollections.java.frames.html
http://cr.openjdk.java.net/~jiangli/8207263/webrev.02/src/java.base/share/classes/jdk/internal/module/ArchivedModuleGraph.java.frames.html
Thanks,
Jiangli
Post by Jiangli Zhou
Hi Claes,
Thanks for reviewing the library and test changes! I'll remove the
comments that you pointed below from ImmutableCollections and update
the CheckArchivedModule test.
Thanks!
Jiangli
Post by Claes Redestad
- // Initialize EMPTY_FOO from the archive comments feel redundant
- perhaps call out that checking identity is necessary and intentional
/Claes
Post by Jiangli Zhou
Thanks Claes for resolving JDK-8209003 quickly. Here is my updated
- Added archiving for singletons in ImmutableCollections
(ListN.EMPTY_LIST, SetN.EMPTY_SET and MapN.EMPTY_MAP). Please see
changes in ImmutableCollections.java.
- Incorporated Calvin and Ioi feedbacks on vmSymbols.hpp.
- Added a new test case to check the parents and modules of
archived EMPTY_CONFIGURATION.
- Added argument length check in CheckArchivedModuleApp.java test
as Calvin suggested.
http://cr.openjdk.java.net/~jiangli/8207263/webrev.01/
Thanks,
Jiangli
Hi Calvin and Ioi,
Thanks for reviewing the change! I'll incorporate your suggestions.
As Claes pointed out in his email, there was a subtle issue with
the empty configuration, which was undetected by the testing for
archiving changes but could introduce a bug in certain cases.
Claes has already filed JDK-8209003 for consolidating empty
collections usage in module code. I'll look into archiving the
immutable singletons in java.util.ImmutableCollections.
Thanks!
Jiangli
Hi Jiangli,
The changes look good to me.
1) vmSymbols.hpp
 653   template(url_void_signature, "(Ljava/net/URL;)V") \
 654   template(toFileURL_name, "toFileURL") \
 655   template(toFileURL_signature,
"(Ljava/lang/String;)Ljava/net/URL;")
Since you've moved the above lines to after
“template(systemModules_signature, …”, I’d suggest rearrange
the entire block (lines 652 - 659) in alphabetical order.
Hi Jiangli,
I've reviewed the code. It looks like a clean change and it's
great to make further progress in start-up improvement!
Just a small note on vmSymbols.hpp:  this line can be deleted
because the symbol is no longer used.
  template(jdk_vm_cds_SharedClassInfo,
"jdk/vm/cds/SharedClassInfo")
Thanks
- Ioi
2) CheckArchivedModuleApp.java
Since it now expects two input args, I’d suggest checking the
number of input args and throw an exception if it is not equal to two.
thanks,
Calvin
Please review the following webrev that archives the system
module boot layer Configuration (including all java objects
reachable from the Configuration) in CDS archive. This is
built on top of the earlier change for JDK-8202035
(https://bugs.openjdk.java.net/browse/JDK-8202035), which
provides a framework for object sub-graph archiving.
The boot layer Configuration is created in
ModuleBootstrap.boot() (similar to the archived system
ModuleDescriptor objects, etc) and is unchanged after
construction. With archived boot layer Configuration, it
allows runtime to bypass the work for creating the
configuration. Currently, this is only supported when the
initial module is unnamed module. Measurements indicate
archiving the boot layer Configuration improves the startup
time by 1% ~ 1.5% (on linux-x64) when running HelloWorld from
-cp at runtime.
Many thanks to Alan and Claes for discussions and
contributions to this change!
Webrev: http://cr.openjdk.java.net/~jiangli/8207263/webrev.00/
RFE: https://bugs.openjdk.java.net/browse/JDK-8207263
Tested with tier1 - tier5 tests via mach5.
Thanks,
Jiangli
Ioi Lam
2018-08-09 23:06:34 UTC
Permalink
Looks good to me, too. Thanks!

- Ioi
Post by Claes Redestad
Updates looks good, thanks!
/Claes
Post by Jiangli Zhou
http://cr.openjdk.java.net/~jiangli/8207263/webrev.02/
http://cr.openjdk.java.net/~jiangli/8207263/webrev.02/src/java.base/share/classes/java/util/ImmutableCollections.java.frames.html
http://cr.openjdk.java.net/~jiangli/8207263/webrev.02/src/java.base/share/classes/jdk/internal/module/ArchivedModuleGraph.java.frames.html
Thanks,
Jiangli
Post by Jiangli Zhou
Hi Claes,
Thanks for reviewing the library and test changes! I'll remove the
comments that you pointed below from ImmutableCollections and update
the CheckArchivedModule test.
Thanks!
Jiangli
Post by Claes Redestad
- // Initialize EMPTY_FOO from the archive comments feel redundant
- perhaps call out that checking identity is necessary and intentional
/Claes
Post by Jiangli Zhou
Thanks Claes for resolving JDK-8209003 quickly. Here is my updated
- Added archiving for singletons in ImmutableCollections
(ListN.EMPTY_LIST, SetN.EMPTY_SET and MapN.EMPTY_MAP). Please see
changes in ImmutableCollections.java.
- Incorporated Calvin and Ioi feedbacks on vmSymbols.hpp.
- Added a new test case to check the parents and modules of
archived EMPTY_CONFIGURATION.
- Added argument length check in CheckArchivedModuleApp.java test
as Calvin suggested.
http://cr.openjdk.java.net/~jiangli/8207263/webrev.01/
Thanks,
Jiangli
Hi Calvin and Ioi,
Thanks for reviewing the change! I'll incorporate your suggestions.
As Claes pointed out in his email, there was a subtle issue with
the empty configuration, which was undetected by the testing for
archiving changes but could introduce a bug in certain cases.
Claes has already filed JDK-8209003 for consolidating empty
collections usage in module code. I'll look into archiving the
immutable singletons in java.util.ImmutableCollections.
Thanks!
Jiangli
Hi Jiangli,
The changes look good to me.
1) vmSymbols.hpp
 653   template(url_void_signature, "(Ljava/net/URL;)V") \
 654   template(toFileURL_name, "toFileURL") \
 655   template(toFileURL_signature,
"(Ljava/lang/String;)Ljava/net/URL;")
Since you've moved the above lines to after
“template(systemModules_signature, …”, I’d suggest rearrange
the entire block (lines 652 - 659) in alphabetical order.
Hi Jiangli,
I've reviewed the code. It looks like a clean change and it's
great to make further progress in start-up improvement!
Just a small note on vmSymbols.hpp:  this line can be deleted
because the symbol is no longer used.
  template(jdk_vm_cds_SharedClassInfo,
"jdk/vm/cds/SharedClassInfo")
Thanks
- Ioi
2) CheckArchivedModuleApp.java
Since it now expects two input args, I’d suggest checking the
number of input args and throw an exception if it is not equal to two.
thanks,
Calvin
Please review the following webrev that archives the system
module boot layer Configuration (including all java objects
reachable from the Configuration) in CDS archive. This is
built on top of the earlier change for JDK-8202035
(https://bugs.openjdk.java.net/browse/JDK-8202035), which
provides a framework for object sub-graph archiving.
The boot layer Configuration is created in
ModuleBootstrap.boot() (similar to the archived system
ModuleDescriptor objects, etc) and is unchanged after
construction. With archived boot layer Configuration, it
allows runtime to bypass the work for creating the
configuration. Currently, this is only supported when the
initial module is unnamed module. Measurements indicate
archiving the boot layer Configuration improves the startup
time by 1% ~ 1.5% (on linux-x64) when running HelloWorld from
-cp at runtime.
Many thanks to Alan and Claes for discussions and
contributions to this change!
Webrev: http://cr.openjdk.java.net/~jiangli/8207263/webrev.00/
RFE: https://bugs.openjdk.java.net/browse/JDK-8207263
Tested with tier1 - tier5 tests via mach5.
Thanks,
Jiangli
Jiangli Zhou
2018-08-09 23:20:53 UTC
Permalink
Thanks, Ioi!

Jiangli
Post by Ioi Lam
Looks good to me, too. Thanks!
- Ioi
Post by Claes Redestad
Updates looks good, thanks!
/Claes
Post by Jiangli Zhou
http://cr.openjdk.java.net/~jiangli/8207263/webrev.02/
http://cr.openjdk.java.net/~jiangli/8207263/webrev.02/src/java.base/share/classes/java/util/ImmutableCollections.java.frames.html
http://cr.openjdk.java.net/~jiangli/8207263/webrev.02/src/java.base/share/classes/jdk/internal/module/ArchivedModuleGraph.java.frames.html
Thanks,
Jiangli
Post by Jiangli Zhou
Hi Claes,
Thanks for reviewing the library and test changes! I'll remove the
comments that you pointed below from ImmutableCollections and
update the CheckArchivedModule test.
Thanks!
Jiangli
Post by Claes Redestad
- // Initialize EMPTY_FOO from the archive comments feel redundant
- perhaps call out that checking identity is necessary and
intentional
/Claes
Post by Jiangli Zhou
Thanks Claes for resolving JDK-8209003 quickly. Here is my
- Added archiving for singletons in ImmutableCollections
(ListN.EMPTY_LIST, SetN.EMPTY_SET and MapN.EMPTY_MAP). Please see
changes in ImmutableCollections.java.
- Incorporated Calvin and Ioi feedbacks on vmSymbols.hpp.
- Added a new test case to check the parents and modules of
archived EMPTY_CONFIGURATION.
- Added argument length check in CheckArchivedModuleApp.java test
as Calvin suggested.
http://cr.openjdk.java.net/~jiangli/8207263/webrev.01/
Thanks,
Jiangli
Hi Calvin and Ioi,
Thanks for reviewing the change! I'll incorporate your suggestions.
As Claes pointed out in his email, there was a subtle issue with
the empty configuration, which was undetected by the testing for
archiving changes but could introduce a bug in certain cases.
Claes has already filed JDK-8209003 for consolidating empty
collections usage in module code. I'll look into archiving the
immutable singletons in java.util.ImmutableCollections.
Thanks!
Jiangli
Hi Jiangli,
The changes look good to me.
1) vmSymbols.hpp
 653   template(url_void_signature, "(Ljava/net/URL;)V") \
 654   template(toFileURL_name, "toFileURL") \
 655   template(toFileURL_signature,
"(Ljava/lang/String;)Ljava/net/URL;")
Since you've moved the above lines to after
“template(systemModules_signature, …”, I’d suggest rearrange
the entire block (lines 652 - 659) in alphabetical order.
Hi Jiangli,
I've reviewed the code. It looks like a clean change and it's
great to make further progress in start-up improvement!
Just a small note on vmSymbols.hpp:  this line can be deleted
because the symbol is no longer used.
  template(jdk_vm_cds_SharedClassInfo,
"jdk/vm/cds/SharedClassInfo")
Thanks
- Ioi
2) CheckArchivedModuleApp.java
Since it now expects two input args, I’d suggest checking the
number of input args and throw an exception if it is not equal to two.
thanks,
Calvin
Please review the following webrev that archives the system
module boot layer Configuration (including all java objects
reachable from the Configuration) in CDS archive. This is
built on top of the earlier change for JDK-8202035
(https://bugs.openjdk.java.net/browse/JDK-8202035), which
provides a framework for object sub-graph archiving.
The boot layer Configuration is created in
ModuleBootstrap.boot() (similar to the archived system
ModuleDescriptor objects, etc) and is unchanged after
construction. With archived boot layer Configuration, it
allows runtime to bypass the work for creating the
configuration. Currently, this is only supported when the
initial module is unnamed module. Measurements indicate
archiving the boot layer Configuration improves the startup
time by 1% ~ 1.5% (on linux-x64) when running HelloWorld from
-cp at runtime.
Many thanks to Alan and Claes for discussions and
contributions to this change!
Webrev: http://cr.openjdk.java.net/~jiangli/8207263/webrev.00/
RFE: https://bugs.openjdk.java.net/browse/JDK-8207263
Tested with tier1 - tier5 tests via mach5.
Thanks,
Jiangli
Calvin Cheung
2018-08-09 23:26:53 UTC
Permalink
Looks good.

thanks,
Calvin
Post by Jiangli Zhou
http://cr.openjdk.java.net/~jiangli/8207263/webrev.02/
http://cr.openjdk.java.net/~jiangli/8207263/webrev.02/src/java.base/share/classes/java/util/ImmutableCollections.java.frames.html
http://cr.openjdk.java.net/~jiangli/8207263/webrev.02/src/java.base/share/classes/jdk/internal/module/ArchivedModuleGraph.java.frames.html
Thanks,
Jiangli
Post by Jiangli Zhou
Hi Claes,
Thanks for reviewing the library and test changes! I'll remove the
comments that you pointed below from ImmutableCollections and update
the CheckArchivedModule test.
Thanks!
Jiangli
Post by Claes Redestad
- // Initialize EMPTY_FOO from the archive comments feel redundant
- perhaps call out that checking identity is necessary and intentional
/Claes
Post by Jiangli Zhou
Thanks Claes for resolving JDK-8209003 quickly. Here is my updated
- Added archiving for singletons in ImmutableCollections
(ListN.EMPTY_LIST, SetN.EMPTY_SET and MapN.EMPTY_MAP). Please see
changes in ImmutableCollections.java.
- Incorporated Calvin and Ioi feedbacks on vmSymbols.hpp.
- Added a new test case to check the parents and modules of
archived EMPTY_CONFIGURATION.
- Added argument length check in CheckArchivedModuleApp.java test
as Calvin suggested.
http://cr.openjdk.java.net/~jiangli/8207263/webrev.01/
Thanks,
Jiangli
Hi Calvin and Ioi,
Thanks for reviewing the change! I'll incorporate your suggestions.
As Claes pointed out in his email, there was a subtle issue with
the empty configuration, which was undetected by the testing for
archiving changes but could introduce a bug in certain cases.
Claes has already filed JDK-8209003 for consolidating empty
collections usage in module code. I'll look into archiving the
immutable singletons in java.util.ImmutableCollections.
Thanks!
Jiangli
Hi Jiangli,
The changes look good to me.
1) vmSymbols.hpp
653 template(url_void_signature, "(Ljava/net/URL;)V") \
654 template(toFileURL_name, "toFileURL") \
655 template(toFileURL_signature,
"(Ljava/lang/String;)Ljava/net/URL;")
Since you've moved the above lines to after
“template(systemModules_signature, …”, I’d suggest rearrange the
entire block (lines 652 - 659) in alphabetical order.
Hi Jiangli,
I've reviewed the code. It looks like a clean change and it's
great to make further progress in start-up improvement!
Just a small note on vmSymbols.hpp: this line can be deleted
because the symbol is no longer used.
template(jdk_vm_cds_SharedClassInfo, "jdk/vm/cds/SharedClassInfo")
Thanks
- Ioi
2) CheckArchivedModuleApp.java
Since it now expects two input args, I’d suggest checking the
number of input args and throw an exception if it is not equal to two.
thanks,
Calvin
Please review the following webrev that archives the system
module boot layer Configuration (including all java objects
reachable from the Configuration) in CDS archive. This is built
on top of the earlier change for JDK-8202035
(https://bugs.openjdk.java.net/browse/JDK-8202035), which
provides a framework for object sub-graph archiving.
The boot layer Configuration is created in
ModuleBootstrap.boot() (similar to the archived system
ModuleDescriptor objects, etc) and is unchanged after
construction. With archived boot layer Configuration, it allows
runtime to bypass the work for creating the configuration.
Currently, this is only supported when the initial module is
unnamed module. Measurements indicate archiving the boot layer
Configuration improves the startup time by 1% ~ 1.5% (on
linux-x64) when running HelloWorld from -cp at runtime.
Many thanks to Alan and Claes for discussions and contributions
to this change!
Webrev: http://cr.openjdk.java.net/~jiangli/8207263/webrev.00/
RFE: https://bugs.openjdk.java.net/browse/JDK-8207263
Tested with tier1 - tier5 tests via mach5.
Thanks,
Jiangli
Jiangli Zhou
2018-08-10 01:39:48 UTC
Permalink
Thanks, Calvin!

Jiangli
Post by Calvin Cheung
Looks good.
thanks,
Calvin
Post by Jiangli Zhou
http://cr.openjdk.java.net/~jiangli/8207263/webrev.02/
http://cr.openjdk.java.net/~jiangli/8207263/webrev.02/src/java.base/share/classes/java/util/ImmutableCollections.java.frames.html
http://cr.openjdk.java.net/~jiangli/8207263/webrev.02/src/java.base/share/classes/jdk/internal/module/ArchivedModuleGraph.java.frames.html
Thanks,
Jiangli
Post by Jiangli Zhou
Hi Claes,
Thanks for reviewing the library and test changes! I'll remove the
comments that you pointed below from ImmutableCollections and update
the CheckArchivedModule test.
Thanks!
Jiangli
Post by Claes Redestad
- // Initialize EMPTY_FOO from the archive comments feel redundant
- perhaps call out that checking identity is necessary and intentional
/Claes
Post by Jiangli Zhou
Thanks Claes for resolving JDK-8209003 quickly. Here is my updated
- Added archiving for singletons in ImmutableCollections
(ListN.EMPTY_LIST, SetN.EMPTY_SET and MapN.EMPTY_MAP). Please see
changes in ImmutableCollections.java.
- Incorporated Calvin and Ioi feedbacks on vmSymbols.hpp.
- Added a new test case to check the parents and modules of
archived EMPTY_CONFIGURATION.
- Added argument length check in CheckArchivedModuleApp.java test
as Calvin suggested.
http://cr.openjdk.java.net/~jiangli/8207263/webrev.01/
Thanks,
Jiangli
Hi Calvin and Ioi,
Thanks for reviewing the change! I'll incorporate your suggestions.
As Claes pointed out in his email, there was a subtle issue with
the empty configuration, which was undetected by the testing for
archiving changes but could introduce a bug in certain cases.
Claes has already filed JDK-8209003 for consolidating empty
collections usage in module code. I'll look into archiving the
immutable singletons in java.util.ImmutableCollections.
Thanks!
Jiangli
Hi Jiangli,
The changes look good to me.
1) vmSymbols.hpp
 653   template(url_void_signature, "(Ljava/net/URL;)V") \
 654   template(toFileURL_name, "toFileURL") \
 655   template(toFileURL_signature,
"(Ljava/lang/String;)Ljava/net/URL;")
Since you've moved the above lines to after
“template(systemModules_signature, …”, I’d suggest rearrange
the entire block (lines 652 - 659) in alphabetical order.
Hi Jiangli,
I've reviewed the code. It looks like a clean change and it's
great to make further progress in start-up improvement!
Just a small note on vmSymbols.hpp:  this line can be deleted
because the symbol is no longer used.
  template(jdk_vm_cds_SharedClassInfo,
"jdk/vm/cds/SharedClassInfo")
Thanks
- Ioi
2) CheckArchivedModuleApp.java
Since it now expects two input args, I’d suggest checking the
number of input args and throw an exception if it is not equal to two.
thanks,
Calvin
Please review the following webrev that archives the system
module boot layer Configuration (including all java objects
reachable from the Configuration) in CDS archive. This is
built on top of the earlier change for JDK-8202035
(https://bugs.openjdk.java.net/browse/JDK-8202035), which
provides a framework for object sub-graph archiving.
The boot layer Configuration is created in
ModuleBootstrap.boot() (similar to the archived system
ModuleDescriptor objects, etc) and is unchanged after
construction. With archived boot layer Configuration, it
allows runtime to bypass the work for creating the
configuration. Currently, this is only supported when the
initial module is unnamed module. Measurements indicate
archiving the boot layer Configuration improves the startup
time by 1% ~ 1.5% (on linux-x64) when running HelloWorld from
-cp at runtime.
Many thanks to Alan and Claes for discussions and
contributions to this change!
Webrev: http://cr.openjdk.java.net/~jiangli/8207263/webrev.00/
RFE: https://bugs.openjdk.java.net/browse/JDK-8207263
Tested with tier1 - tier5 tests via mach5.
Thanks,
Jiangli
Loading...