RFR(M): 8165896: Use "open" flag from JVM_DefineModule to export all module packages

Karen Kinnear karen.kinnear at oracle.com
Thu Mar 23 20:04:15 UTC 2017


Rachel,

Nice job! Really glad Harold’s locks still work with this.

Could you possibly explain the change to PackageEntryTable::new_entry - to remove setting set_unqual_exported ?

thanks,
Karen


> On Mar 23, 2017, at 2:23 PM, Rachel Protacio <rachel.protacio at oracle.com> wrote:
> 
> Hello!
> 
> Please review this enhancement, which implements the VM side of open modules. Open modules export all their packages unqualifiedly, which was previously done by exporting the packages one by one on the java side. This change saves that step by adding an internal "open" representation for the module structure, which is checked before checking the exportedness of the package itself.
> 
> JDK link: https://bugs.openjdk.java.net/browse/JDK-8165896
> 
> hotspot webrev: http://cr.openjdk.java.net/~rprotacio/8165896.hotspot.00/
> jdk webrev: http://cr.openjdk.java.net/~rprotacio/8165896.jdk.00/
> root repo patch:
> 
> --- old/test/lib/sun/hotspot/WhiteBox.java	2017-03-23 12:50:36.869963040 -0400
> +++ new/test/lib/sun/hotspot/WhiteBox.java	2017-03-23 12:50:36.421963021 -0400
> @@ -1,5 +1,5 @@
> /*
> - * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
> + * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
>  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
>  *
>  * This code is free software; you can redistribute it and/or modify it
> @@ -449,8 +449,8 @@
>   }
>    // Jigsaw
> -  public native void DefineModule(Object module, String version, String location,
> -                                  Object[] packages);
> +  public native void DefineModule(Object module, boolean is_open, String version,
> +                                  String location, Object[] packages);
>   public native void AddModuleExports(Object from_module, String pkg, Object to_module);
>   public native void AddReadsModule(Object from_module, Object source_module);
>   public native void AddModulePackage(Object module, String pkg);
> 
> 
> Testing:
> 
> * includes new regression test
> * JPRT and RBT hotspot tiers 2-5
> 
> Notes:
> 
> * This changeset re-conceptualizes the unnamed module as an open
>   module (as far as the internal representation is concerned). This
>   saves the VM from specifying every package in the unnamed module as
>   unqualifiedly exported.
> * Additionally, automatic modules are defined as open modules in terms
>   of package exports. As such, in the jdk repo's Module.java code,
>   defineModule0() is called with isOpen==true for automatic modules.
> * In my search through module startup code, I found a for-loop in
>   modules.cpp that was looping through java.base packages just for
>   some logging. The entire loop should have been bounded by a
>   log_is_enabled() conditional. Since this patch is generally
>   improving the efficiency of modules startup, I corrected that here.
> * Fixed a few comment typos I found along the way.
> 
> Thank you!
> Rachel



More information about the hotspot-runtime-dev mailing list