RFR: 8152635: Create a UL class to represent a Log + Level combination

Stefan Karlsson stefan.karlsson at oracle.com
Mon Apr 4 08:47:37 UTC 2016


Hi Robbin,

On 2016-03-29 17:54, Robbin Ehn wrote:
> Hi Stefan, looks good to me.

Thanks.

>
> (we can now also remove the ResourceMark from the other two test, right?)

Maybe. I'll prefer if that could be handled by a separate RFE.

Thanks,
StefanK

>
> /Robbin
>
> On 03/29/2016 03:46 PM, Stefan Karlsson wrote:
>> Hi all,
>>
>> Please review this patch to introduce a Unified Logging class to
>> describe a combination of a tagset and a log level.
>>
>> http://cr.openjdk.java.net/~stefank/8152635/webrev.01
>> https://bugs.openjdk.java.net/browse/JDK-8152635
>>
>> The patch is applied on top of the patch in:
>> http://mail.openjdk.java.net/pipermail/hotspot-dev/2016-March/022302.html 
>>
>>
>> With this class we could write code as:
>> LogTarget(Debug, gc, heap) log;
>> if (log.is_enabled()) {
>>    log.print(...);
>>    log.print(...);
>>    ... = log.stream();
>> }
>>
>> instead of the current model:
>> Log(gc, heap) log;
>> if (log.is_debug()) {
>>    log.debug(...)
>>    log.debug(...)
>>    ... = log.debug_stream():
>> }
>>
>> The LogTarget class/macro ensures that we only mention the log level
>> once, so that we don't accidentally log to the wrong level. The previous
>> version forces the coder to repeat 'debug' four times.
>>
>> One example where the wrong log level has been used:
>> https://bugs.openjdk.java.net/browse/JDK-8152962
>>
>> I've converted one function in compactibleFreeListSpace.cpp to show how
>> to use the new class.
>>
>> Test: new internal vm test, jprt
>>
>> Thanks,
>> StefanK



More information about the hotspot-dev mailing list