RFR: 8171855: Move package name transformations during module bootstrap into native code

Mandy Chung mandy.chung at oracle.com
Thu Jan 5 21:24:55 UTC 2017


> On Jan 5, 2017, at 8:47 AM, Claes Redestad <claes.redestad at oracle.com> wrote:
> 
> Hi,
> 
> after a round of review comments I've now reworked this to do the
> transformations in the JNI layer rather than inside the VM, with
> similar - if not better - results.
> 
> Webrevs:
> http://cr.openjdk.java.net/~redestad/8171855/hotspot.03/
> http://cr.openjdk.java.net/~redestad/8171855/jdk.03/
> 

Happy to know the performance gain is comparable when pushing down the conversion to internal form in native instead of doing it in the VM.  This is good work.

src/java.base/share/native/libjava/Module.c
  This can be refactored e.g. adding a new function GetInternalPackageName that takes a jstring and returns const char*.

  GetStringUTFChars will return a copy of the utf-8 chars. That is an alternative to malloc, GetStringUTFLength, GetStringLength, GetStringUTFRegion calls.  Use ReleaseStringUTFChars to free the copy after use.

  Nit: it may be clearer to rename pkgs_len to num_pkgs

src/share/vm/classfile/modules.cpp
  49 static bool verify_module_name(const char *module_name) {

To be consistent with the convention in this file: const char* 

Otherwise, looks fine.

Mandy


More information about the hotspot-runtime-dev mailing list