RFR (XS): 8167995: -Xlog:defaultmethods=debug: lengthy method	descriptor triggers "StringStream is re-allocated with a different	ResourceMark"
    David Holmes 
    david.holmes at oracle.com
       
    Tue Oct 25 05:41:36 UTC 2016
    
    
  
Hi Rachel,
On 25/10/2016 6:17 AM, Rachel Protacio wrote:
> Hi,
>
> Please review this small fix, which removes two nested ResourceMark's
> that were causing problems with defaultmethods logging.
>
> Bug: https://bugs.openjdk.java.net/browse/JDK-8167995
> Open webrev: http://cr.openjdk.java.net/~rprotacio/8167995.00/
>
> Tested with JPRT.
It is tricky to determine who has responsibility for positioning the 
ResourceMarks. Looking at this call chain it initially appeared to me 
that we now had a missing RM for the code at line #80:
813       slot->print_on(logstream);
=>
590   void print_on(outputStream* str) const {
591     print_slot(str, name(), signature());
592   }
=>
79 static void print_slot(outputStream* str, Symbol* name, Symbol* 
signature) {
80   str->print("%s%s", name->as_C_string(), signature->as_C_string());
81 }
but we actually have a RM higher up at:
787   ResourceMark rm(THREAD);
so that is good, but then we also have a nested ResourceMark further down:
  795   if (log_is_enabled(Debug, defaultmethods)) {
  796     ResourceMark rm;
I must admit I'm unclear if ResourceMarks should never be nested, or 
should be nested "carefully" - and if the latter exactly what that means 
and how to recognize it.
Thanks,
David
-----
> Thanks!
> Rachel
    
    
More information about the hotspot-runtime-dev
mailing list