Request for review (S): JDK-8011009: Use do-while(0) instead of while(0) in EC_TRACE and RC_TRACE* macros

Krystal Mo krystal.mo at oracle.com
Thu Mar 28 15:59:34 PDT 2013


No, I mean like the way RC_TRACE is:

-#define EC_TRACE(out) if (JvmtiTrace::trace_event_controller()) { 
SafeResourceMark rm; tty->print_cr out; } while (0)
+#define EC_TRACE(out) do { \
+  if (JvmtiTrace::trace_event_controller()) { \
+    SafeResourceMark rm; \
+    tty->print_cr out; \
+  } \
+} while (0)

- Kris

On 03/28/2013 03:55 PM, Daniel D. Daugherty wrote:
> On 3/28/13 4:54 PM, Krystal Mo wrote:
>> Thank you, Dan!
>> Would you like it better if I reformat EC_TRACE to one statement on a 
>> line?
>
> Please no! I like the new version much, much better...
>
> Dan
>
>
>>
>> - Kris
>>
>> On 03/28/2013 03:51 PM, Daniel D. Daugherty wrote:
>>> I forgot to say: thumbs up!
>>>
>>> Dan
>>>
>>>
>>> On 3/28/13 4:49 PM, Daniel D. Daugherty wrote:
>>>> On 3/28/13 4:11 PM, Krystal Mo wrote:
>>>>> Hi all,
>>>>>
>>>>> Could I have a review for this small patch, please?
>>>>>
>>>>> Webrev: http://cr.openjdk.java.net/~kmo/8011009/webrev.00
>>>>
>>>> src/share/vm/prims/jvmtiEventController.cpp
>>>>     Thanks for reformatting the macro while you were in there.
>>>>
>>>> src/share/vm/prims/jvmtiRedefineClassesTrace.hpp
>>>>     I was wondering why you reordered the macros until I saw the
>>>>     updates to use RC_TRACE_ENABLED. Nicely done.
>>>>
>>>> Dan
>>>>
>>>>
>>>>> CR: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=8011009
>>>>>
>>>>> This patch improves the EC_TRACE and RC_TRACE* family of macros to 
>>>>> be less error prone.
>>>>> They used to end with while(0) to make the macros statement-like, 
>>>>> but a better way to do this is do {...} while(0).
>>>>>
>>>>> Testing with JPRT, will send an update email when it's done.
>>>>>
>>>>> P.S. I'm not sure where I should send this email for review, 
>>>>> should it be hotspot-runtime or serviceability?
>>>>
>>>> Serviceability would have been the default choice since this
>>>> is JVM/TI code, but hotspot-dev is fine. You've already gotten
>>>> a review from Serguei who in on Serviceability and now me
>>>> (former Serviceability, now Runtime). Bases are covered, I think...
>>>>
>>>> Dan
>>>>
>>>>>
>>>>> Thanks,
>>>>> Kris
>>>>
>>>
>>
>



More information about the hotspot-dev mailing list