You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by rp...@apache.org on 2015/08/21 05:32:54 UTC

logging-log4j2 git commit: clarified comments showing method size and added link to Jira ticket

Repository: logging-log4j2
Updated Branches:
  refs/heads/master 87bde0d5b -> d33958a9d


clarified comments showing method size and added link to Jira ticket

Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/d33958a9
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/d33958a9
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/d33958a9

Branch: refs/heads/master
Commit: d33958a9d820d28d9d7fb2770bff76a6d2b5e54c
Parents: 87bde0d
Author: rpopma <rp...@apache.org>
Authored: Fri Aug 21 12:33:06 2015 +0900
Committer: rpopma <rp...@apache.org>
Committed: Fri Aug 21 12:33:06 2015 +0900

----------------------------------------------------------------------
 .../log4j/message/ParameterizedMessage.java     | 26 ++++++++++----------
 1 file changed, 13 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/d33958a9/log4j-api/src/main/java/org/apache/logging/log4j/message/ParameterizedMessage.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/message/ParameterizedMessage.java b/log4j-api/src/main/java/org/apache/logging/log4j/message/ParameterizedMessage.java
index e5891c4..0920819 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/message/ParameterizedMessage.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/message/ParameterizedMessage.java
@@ -272,7 +272,7 @@ public class ParameterizedMessage implements Message {
      * @param arguments      the arguments to be used to replace placeholders.
      * @return the formatted message.
      */
-    // 33 bytes
+    // 33 bytes (allows immediate JVM inlining: < 35 bytes) LOG4J2-1096
     static String formatStringArgs(final String messagePattern, final String[] arguments) {
         int len = 0;
         if (messagePattern == null || (len = messagePattern.length()) == 0 || arguments == null
@@ -283,7 +283,7 @@ public class ParameterizedMessage implements Message {
         return formatStringArgs0(messagePattern, len, arguments);
     }
 
-    // 157 bytes
+    // 157 bytes (will be inlined when hot enough: < 325 bytes)
     private static String formatStringArgs0(final String messagePattern, final int len, final String[] arguments) {
         final char[] result = new char[len + sumStringLengths(arguments)];
         int pos = 0;
@@ -323,7 +323,7 @@ public class ParameterizedMessage implements Message {
     /**
      * Returns the sum of the lengths of all Strings in the specified array.
      */
-    // 30 bytes
+    // 30 bytes (allows immediate JVM inlining: < 35 bytes) LOG4J2-1096
     private static int sumStringLengths(final String[] arguments) {
         int result = 0;
         for (int i = 0; i < arguments.length; i++) {
@@ -336,7 +336,7 @@ public class ParameterizedMessage implements Message {
      * Returns {@code true} if the specified char and the char at {@code curCharIndex + 1} in the specified message
      * pattern together form a "{}" delimiter pair, returns {@code false} otherwise.
      */
-    // 22 bytes
+    // 22 bytes (allows immediate JVM inlining: < 35 bytes) LOG4J2-1096
     private static boolean isDelimPair(final char curChar, final String messagePattern, final int curCharIndex) {
         return curChar == DELIM_START && messagePattern.charAt(curCharIndex + 1) == DELIM_STOP;
     }
@@ -345,7 +345,7 @@ public class ParameterizedMessage implements Message {
      * Detects whether the message pattern has been fully processed or if an unprocessed character remains and processes
      * it if necessary, returning the resulting position in the result char array.
      */
-    // 28 bytes
+    // 28 bytes (allows immediate JVM inlining: < 35 bytes) LOG4J2-1096
     private static int handleRemainingCharIfAny(final String messagePattern, final int len, final char[] result,
             int pos, int escapeCounter, int i) {
         if (i == len - 1) {
@@ -358,7 +358,7 @@ public class ParameterizedMessage implements Message {
     /**
      * Processes the last unprocessed character and returns the resulting position in the result char array.
      */
-    // 28 bytes
+    // 28 bytes (allows immediate JVM inlining: < 35 bytes) LOG4J2-1096
     private static int handleLastChar(final char[] result, int pos, final int escapeCounter, final char curChar) {
         if (curChar == ESCAPE_CHAR) {
             pos = writeUnescapedEscapeChars(escapeCounter + 1, result, pos);
@@ -372,7 +372,7 @@ public class ParameterizedMessage implements Message {
      * Processes a literal char (neither an '\' escape char nor a "{}" delimiter pair) and returns the resulting
      * position.
      */
-    // 16 bytes
+    // 16 bytes (allows immediate JVM inlining: < 35 bytes) LOG4J2-1096
     private static int handleLiteralChar(final char[] result, int pos, final int escapeCounter, final char curChar) {
         // any other char beside ESCAPE or DELIM_START/STOP-combo
         // write unescaped escape chars
@@ -384,7 +384,7 @@ public class ParameterizedMessage implements Message {
     /**
      * Writes "{}" to the specified result array at the specified position and returns the resulting position.
      */
-    // 18 bytes
+    // 18 bytes (allows immediate JVM inlining: < 35 bytes) LOG4J2-1096
     private static int writeDelimPair(final char[] result, int pos) {
         result[pos++] = DELIM_START;
         result[pos++] = DELIM_STOP;
@@ -394,7 +394,7 @@ public class ParameterizedMessage implements Message {
     /**
      * Returns {@code true} if the specified parameter is odd.
      */
-    // 11 bytes
+    // 11 bytes (allows immediate JVM inlining: < 35 bytes) LOG4J2-1096
     private static boolean isOdd(final int number) {
         return (number & 1) == 1;
     }
@@ -403,7 +403,7 @@ public class ParameterizedMessage implements Message {
      * Writes a '\' char to the specified result array (starting at the specified position) for each <em>pair</em> of
      * '\' escape chars encountered in the message format and returns the resulting position.
      */
-    // 11 bytes
+    // 11 bytes (allows immediate JVM inlining: < 35 bytes) LOG4J2-1096
     private static int writeEscapedEscapeChars(final int escapeCounter, final char[] result, final int pos) {
         final int escapedEscapes = escapeCounter >> 1; // divide by two
         return writeUnescapedEscapeChars(escapedEscapes, result, pos);
@@ -413,7 +413,7 @@ public class ParameterizedMessage implements Message {
      * Writes the specified number of '\' chars to the specified result array (starting at the specified position) and
      * returns the resulting position.
      */
-    // 20 bytes
+    // 20 bytes (allows immediate JVM inlining: < 35 bytes) LOG4J2-1096
     private static int writeUnescapedEscapeChars(int escapeCounter, char[] result, int pos) {
         while (escapeCounter > 0) {
             result[pos++] = ESCAPE_CHAR;
@@ -426,7 +426,7 @@ public class ParameterizedMessage implements Message {
      * Appends the argument at the specified argument index (or, if no such argument exists, the "{}" delimiter pair) to
      * the specified result char array at the specified position and returns the resulting position.
      */
-    // 25 bytes
+    // 25 bytes (allows immediate JVM inlining: < 35 bytes) LOG4J2-1096
     private static int writeArgOrDelimPair(final String[] arguments, final int currentArgument, final char[] result,
             int pos) {
         if (currentArgument < arguments.length) {
@@ -441,7 +441,7 @@ public class ParameterizedMessage implements Message {
      * Appends the argument at the specified argument index to the specified result char array at the specified position
      * and returns the resulting position.
      */
-    // 30 bytes
+    // 30 bytes (allows immediate JVM inlining: < 35 bytes) LOG4J2-1096
     private static int writeArgAt0(final String[] arguments, final int currentArgument, final char[] result,
             final int pos) {
         final String arg = String.valueOf(arguments[currentArgument]);