# HG changeset patch # User Doug Simon # Date 1395268911 -3600 # Node ID 3ab42370f636cbf75b9061221bd8229a60e61372 # Parent f3510d0dcf67d46e86c80b61316ca7d5911a259d removed use of varargs from Debug.log() API diff -r f3510d0dcf67 -r 3ab42370f636 graal/com.oracle.graal.debug/src/com/oracle/graal/debug/Debug.java --- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/Debug.java Wed Mar 19 23:11:39 2014 +0100 +++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/Debug.java Wed Mar 19 23:41:51 2014 +0100 @@ -296,20 +296,79 @@ } /** - * Prints an indented message to the current debug scopes's logging stream if logging is enabled - * in the scope. + * Prints a message to the current debug scope's logging stream if logging is enabled. + * + * @param msg the message to log + */ + public static void log(String msg) { + if (ENABLED) { + DebugScope.getInstance().log(msg); + } + } + + /** + * Prints a message to the current debug scope's logging stream if logging is enabled. * - * @param msg The format string of the log message - * @param args The arguments referenced by the log message string - * @see Indent#log + * @param format a format string + * @param arg the argument referenced by the format specifiers in {@code format} + */ + public static void log(String format, Object arg) { + if (ENABLED) { + DebugScope.getInstance().log(format, arg); + } + } + + /** + * @see #log(String, Object) + */ + public static void log(String format, Object arg1, Object arg2) { + if (ENABLED) { + DebugScope.getInstance().log(format, arg1, arg2); + } + } + + /** + * @see #log(String, Object) */ - public static void log(String msg, Object... args) { + public static void log(String format, Object arg1, Object arg2, Object arg3) { + if (ENABLED) { + DebugScope.getInstance().log(format, arg1, arg2, arg3); + } + } + + /** + * @see #log(String, Object) + */ + public static void log(String format, Object arg1, Object arg2, Object arg3, Object arg4) { if (ENABLED) { - DebugScope.getInstance().log(msg, args); + DebugScope.getInstance().log(format, arg1, arg2, arg3, arg4); + } + } + + /** + * @see #log(String, Object) + */ + public static void log(String format, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5) { + if (ENABLED) { + DebugScope.getInstance().log(format, arg1, arg2, arg3, arg4, arg5); } } /** + * Prints a message to the current debug scope's logging stream. This method must only be called + * if debugging is {@linkplain Debug#isEnabled() enabled}. + * + * @param format a format string + * @param args the arguments referenced by the format specifiers in {@code format} + */ + public static void logv(String format, Object... args) { + if (!ENABLED) { + throw new InternalError("Use of Debug.logv() must be guarded by a test of Debug.isEnabled()"); + } + DebugScope.getInstance().log(format, args); + } + + /** * The same as {@link #log}, but without line termination and without indentation. */ public static void printf(String msg, Object... args) { diff -r f3510d0dcf67 -r 3ab42370f636 graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugConfig.java --- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugConfig.java Wed Mar 19 23:11:39 2014 +0100 +++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugConfig.java Wed Mar 19 23:41:51 2014 +0100 @@ -28,10 +28,7 @@ public interface DebugConfig { /** - * Determines if logging is enabled in the {@linkplain Debug#currentScope() current debug scope} - * . - * - * @see Debug#log(String, Object...) + * Determines if logging is on in the {@linkplain Debug#currentScope() current debug scope} . */ boolean isLogEnabled(); diff -r f3510d0dcf67 -r 3ab42370f636 graal/com.oracle.graal.java/src/com/oracle/graal/java/BciBlockMapping.java --- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/BciBlockMapping.java Wed Mar 19 23:11:39 2014 +0100 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/BciBlockMapping.java Wed Mar 19 23:41:51 2014 +0100 @@ -748,7 +748,7 @@ int blockID = block.blockID; // log statements in IFs because debugLiveX creates a new String if (Debug.isLogEnabled()) { - Debug.log(" start B%d [%d, %d] in: %s out: %s gen: %s kill: %s", block.blockID, block.startBci, block.endBci, debugLiveIn(blockID), debugLiveOut(blockID), + Debug.logv(" start B%d [%d, %d] in: %s out: %s gen: %s kill: %s", block.blockID, block.startBci, block.endBci, debugLiveIn(blockID), debugLiveOut(blockID), debugLiveGen(blockID), debugLiveKill(blockID)); } @@ -767,7 +767,7 @@ if (blockChanged) { updateLiveness(blockID); if (Debug.isLogEnabled()) { - Debug.log(" end B%d [%d, %d] in: %s out: %s gen: %s kill: %s", block.blockID, block.startBci, block.endBci, debugLiveIn(blockID), debugLiveOut(blockID), + Debug.logv(" end B%d [%d, %d] in: %s out: %s gen: %s kill: %s", block.blockID, block.startBci, block.endBci, debugLiveIn(blockID), debugLiveOut(blockID), debugLiveGen(blockID), debugLiveKill(blockID)); } }