RFR: 8247236: fieldDescriptor::print_on_for prints extra newline after NULL

Stefan Karlsson stefan.karlsson at oracle.com
Tue Jun 9 15:05:01 UTC 2020


Hi all,

Please review this small patch to remove a newline that is incorrectly 
printed after NULL.

https://cr.openjdk.java.net/~stefank/8247236/webrev.01/
https://bugs.openjdk.java.net/browse/JDK-8247236

Ioi reported that this bug could be seen by running:

---
(gdb) call pp(m)
"Executing pp"
java.lang.Class
{0x00000007bf0008b0} - klass: 'java/lang/Class'
  - ---- fields (total size 14 words):
  - private volatile transient 'classRedefinedCount' 'I' @12 0
  - private volatile transient strict 'cachedConstructor' 
'Ljava/lang/reflect/Constructor;' @40 NULL
  (0)
  - private transient 'name' 'Ljava/lang/String;' @44 NULL
  (0)

There are newlines between NULL and (0).
---

This can be seen whenever an InstanceKlass is printed and one of the 
oops are NULL. There's no newline if the object is non-null or if 
printing primitives. Note, that this is only printed in non-product 
builds, making it less likely that someone depends on the output format.

After the patch, the lines look like this:
  - private volatile transient strict 'cachedConstructor' 
'Ljava/lang/reflect/Constructor;' @40 NULL (0)
  - private transient 'name' 'Ljava/lang/String;' @44 NULL (0)

Thanks,
StefanK


More information about the hotspot-dev mailing list