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

Rachel Protacio rachel.protacio at oracle.com
Thu Apr 6 15:41:29 UTC 2017


Thanks, Harold!

Yeah, I can just delete the try-catch altogether if that's cleaner. Will 
send out again after jigsaw integration.

Rachel


On 3/31/2017 4:58 PM, harold seigel wrote:
> Hi Rachel,
>
> The change looks good!
>
> Could you tweak the end of the AccessCheckOpen.java test at line 80 to 
> throw a new RuntimeException instead of calling println(), or just 
> don't catch the IAE ?
>
>       74         // p1.c1's ctor calls a method in p2.c2, and m2 is open.
>       75         // So should not get IllegalAccessError
>       76         Class p1_c1_class = Class.forName("p1.c1");
>       77         try {
>       78             p1_c1_class.newInstance();
>       79         } catch (IllegalAccessError f) {
>       80*System.out.println(f.getMessage());*
>       81         }
>
> Thanks, Harold
>
> On 3/23/2017 2:23 PM, Rachel Protacio 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