< prev index next >

src/java.base/share/classes/java/lang/StringConcatHelper.java

Print this page
rev 54622 : 8222852: Reduce String concat combinator tree shapes by folding constants into prependers
Reviewed-by: shade, plevart
rev 54623 : imported patch hmb_scf

*** 176,185 **** --- 176,235 ---- return index | UTF16; } } /** + * Prepends constant and the stringly representation of value into buffer, + * given the coder and final index. Index is measured in chars, not in bytes! + * + * @param indexCoder final char index in the buffer, along with coder packed + * into higher bits. + * @param buf buffer to append to + * @param prefix a constant to prepend before value + * @param value boolean value to encode + * @return updated index (coder value retained) + */ + static long prepend(long indexCoder, byte[] buf, String prefix, boolean value) { + indexCoder = prepend(indexCoder, buf, value); + return prepend(indexCoder, buf, prefix); + } + + /** + * Prepends constant and the stringly representation of value into buffer, + * given the coder and final index. Index is measured in chars, not in bytes! + * + * @param indexCoder final char index in the buffer, along with coder packed + * into higher bits. + * @param buf buffer to append to + * @param value boolean value to encode + * @param suffix a constant to prepend after value + * @return updated index (coder value retained) + */ + static long prepend(long indexCoder, byte[] buf, boolean value, String suffix) { + indexCoder = prepend(indexCoder, buf, suffix); + return prepend(indexCoder, buf, value); + } + + /** + * Prepends constant and the stringly representation of value into buffer, + * given the coder and final index. Index is measured in chars, not in bytes! + * + * @param indexCoder final char index in the buffer, along with coder packed + * into higher bits. + * @param buf buffer to append to + * @param prefix a constant to prepend before value + * @param value boolean value to encode + * @param suffix a constant to prepend after value + * @return updated index (coder value retained) + */ + static long prepend(long indexCoder, byte[] buf, String prefix, boolean value, String suffix) { + indexCoder = prepend(indexCoder, buf, suffix); + indexCoder = prepend(indexCoder, buf, value); + return prepend(indexCoder, buf, prefix); + } + + /** * Prepends the stringly representation of byte value into buffer, * given the coder and final index. Index is measured in chars, not in bytes! * * @param indexCoder final char index in the buffer, along with coder packed * into higher bits.
*** 190,199 **** --- 240,299 ---- static long prepend(long indexCoder, byte[] buf, byte value) { return prepend(indexCoder, buf, (int)value); } /** + * Prepends constant and the stringly representation of value into buffer, + * given the coder and final index. Index is measured in chars, not in bytes! + * + * @param indexCoder final char index in the buffer, along with coder packed + * into higher bits. + * @param buf buffer to append to + * @param prefix a constant to prepend before value + * @param value boolean value to encode + * @return updated index (coder value retained) + */ + static long prepend(long indexCoder, byte[] buf, String prefix, byte value) { + indexCoder = prepend(indexCoder, buf, value); + return prepend(indexCoder, buf, prefix); + } + + /** + * Prepends constant and the stringly representation of value into buffer, + * given the coder and final index. Index is measured in chars, not in bytes! + * + * @param indexCoder final char index in the buffer, along with coder packed + * into higher bits. + * @param buf buffer to append to + * @param value boolean value to encode + * @param suffix a constant to prepend after value + * @return updated index (coder value retained) + */ + static long prepend(long indexCoder, byte[] buf, byte value, String suffix) { + indexCoder = prepend(indexCoder, buf, suffix); + return prepend(indexCoder, buf, value); + } + + /** + * Prepends constant and the stringly representation of value into buffer, + * given the coder and final index. Index is measured in chars, not in bytes! + * + * @param indexCoder final char index in the buffer, along with coder packed + * into higher bits. + * @param buf buffer to append to + * @param prefix a constant to prepend before value + * @param value boolean value to encode + * @param suffix a constant to prepend after value + * @return updated index (coder value retained) + */ + static long prepend(long indexCoder, byte[] buf, String prefix, byte value, String suffix) { + indexCoder = prepend(indexCoder, buf, suffix); + indexCoder = prepend(indexCoder, buf, value); + return prepend(indexCoder, buf, prefix); + } + + /** * Prepends the stringly representation of char value into buffer, * given the coder and final index. Index is measured in chars, not in bytes! * * @param indexCoder final char index in the buffer, along with coder packed * into higher bits.
*** 209,218 **** --- 309,368 ---- } return indexCoder; } /** + * Prepends constant and the stringly representation of value into buffer, + * given the coder and final index. Index is measured in chars, not in bytes! + * + * @param indexCoder final char index in the buffer, along with coder packed + * into higher bits. + * @param buf buffer to append to + * @param prefix a constant to prepend before value + * @param value boolean value to encode + * @return updated index (coder value retained) + */ + static long prepend(long indexCoder, byte[] buf, String prefix, char value) { + indexCoder = prepend(indexCoder, buf, value); + return prepend(indexCoder, buf, prefix); + } + + /** + * Prepends constant and the stringly representation of value into buffer, + * given the coder and final index. Index is measured in chars, not in bytes! + * + * @param indexCoder final char index in the buffer, along with coder packed + * into higher bits. + * @param buf buffer to append to + * @param value boolean value to encode + * @param suffix a constant to prepend after value + * @return updated index (coder value retained) + */ + static long prepend(long indexCoder, byte[] buf, char value, String suffix) { + indexCoder = prepend(indexCoder, buf, suffix); + return prepend(indexCoder, buf, value); + } + + /** + * Prepends constant and the stringly representation of value into buffer, + * given the coder and final index. Index is measured in chars, not in bytes! + * + * @param indexCoder final char index in the buffer, along with coder packed + * into higher bits. + * @param buf buffer to append to + * @param prefix a constant to prepend before value + * @param value boolean value to encode + * @param suffix a constant to prepend after value + * @return updated index (coder value retained) + */ + static long prepend(long indexCoder, byte[] buf, String prefix, char value, String suffix) { + indexCoder = prepend(indexCoder, buf, suffix); + indexCoder = prepend(indexCoder, buf, value); + return prepend(indexCoder, buf, prefix); + } + + /** * Prepends the stringly representation of short value into buffer, * given the coder and final index. Index is measured in chars, not in bytes! * * @param indexCoder final char index in the buffer, along with coder packed * into higher bits.
*** 223,232 **** --- 373,432 ---- static long prepend(long indexCoder, byte[] buf, short value) { return prepend(indexCoder, buf, (int)value); } /** + * Prepends constant and the stringly representation of value into buffer, + * given the coder and final index. Index is measured in chars, not in bytes! + * + * @param indexCoder final char index in the buffer, along with coder packed + * into higher bits. + * @param buf buffer to append to + * @param prefix a constant to prepend before value + * @param value boolean value to encode + * @return updated index (coder value retained) + */ + static long prepend(long indexCoder, byte[] buf, String prefix, short value) { + indexCoder = prepend(indexCoder, buf, value); + return prepend(indexCoder, buf, prefix); + } + + /** + * Prepends constant and the stringly representation of value into buffer, + * given the coder and final index. Index is measured in chars, not in bytes! + * + * @param indexCoder final char index in the buffer, along with coder packed + * into higher bits. + * @param buf buffer to append to + * @param value boolean value to encode + * @param suffix a constant to prepend after value + * @return updated index (coder value retained) + */ + static long prepend(long indexCoder, byte[] buf, short value, String suffix) { + indexCoder = prepend(indexCoder, buf, suffix); + return prepend(indexCoder, buf, value); + } + + /** + * Prepends constant and the stringly representation of value into buffer, + * given the coder and final index. Index is measured in chars, not in bytes! + * + * @param indexCoder final char index in the buffer, along with coder packed + * into higher bits. + * @param buf buffer to append to + * @param prefix a constant to prepend before value + * @param value boolean value to encode + * @param suffix a constant to prepend after value + * @return updated index (coder value retained) + */ + static long prepend(long indexCoder, byte[] buf, String prefix, short value, String suffix) { + indexCoder = prepend(indexCoder, buf, suffix); + indexCoder = prepend(indexCoder, buf, value); + return prepend(indexCoder, buf, prefix); + } + + /** * Prepends the stringly representation of integer value into buffer, * given the coder and final index. Index is measured in chars, not in bytes! * * @param indexCoder final char index in the buffer, along with coder packed * into higher bits.
*** 241,250 **** --- 441,500 ---- return StringUTF16.getChars(value, (int)indexCoder, buf) | UTF16; } } /** + * Prepends constant and the stringly representation of value into buffer, + * given the coder and final index. Index is measured in chars, not in bytes! + * + * @param indexCoder final char index in the buffer, along with coder packed + * into higher bits. + * @param buf buffer to append to + * @param prefix a constant to prepend before value + * @param value boolean value to encode + * @return updated index (coder value retained) + */ + static long prepend(long indexCoder, byte[] buf, String prefix, int value) { + indexCoder = prepend(indexCoder, buf, value); + return prepend(indexCoder, buf, prefix); + } + + /** + * Prepends constant and the stringly representation of value into buffer, + * given the coder and final index. Index is measured in chars, not in bytes! + * + * @param indexCoder final char index in the buffer, along with coder packed + * into higher bits. + * @param buf buffer to append to + * @param value boolean value to encode + * @param suffix a constant to prepend after value + * @return updated index (coder value retained) + */ + static long prepend(long indexCoder, byte[] buf, int value, String suffix) { + indexCoder = prepend(indexCoder, buf, suffix); + return prepend(indexCoder, buf, value); + } + + /** + * Prepends constant and the stringly representation of value into buffer, + * given the coder and final index. Index is measured in chars, not in bytes! + * + * @param indexCoder final char index in the buffer, along with coder packed + * into higher bits. + * @param buf buffer to append to + * @param prefix a constant to prepend before value + * @param value boolean value to encode + * @param suffix a constant to prepend after value + * @return updated index (coder value retained) + */ + static long prepend(long indexCoder, byte[] buf, String prefix, int value, String suffix) { + indexCoder = prepend(indexCoder, buf, suffix); + indexCoder = prepend(indexCoder, buf, value); + return prepend(indexCoder, buf, prefix); + } + + /** * Prepends the stringly representation of long value into buffer, * given the coder and final index. Index is measured in chars, not in bytes! * * @param indexCoder final char index in the buffer, along with coder packed * into higher bits.
*** 259,268 **** --- 509,568 ---- return StringUTF16.getChars(value, (int)indexCoder, buf) | UTF16; } } /** + * Prepends constant and the stringly representation of value into buffer, + * given the coder and final index. Index is measured in chars, not in bytes! + * + * @param indexCoder final char index in the buffer, along with coder packed + * into higher bits. + * @param buf buffer to append to + * @param prefix a constant to prepend before value + * @param value boolean value to encode + * @return updated index (coder value retained) + */ + static long prepend(long indexCoder, byte[] buf, String prefix, long value) { + indexCoder = prepend(indexCoder, buf, value); + return prepend(indexCoder, buf, prefix); + } + + /** + * Prepends constant and the stringly representation of value into buffer, + * given the coder and final index. Index is measured in chars, not in bytes! + * + * @param indexCoder final char index in the buffer, along with coder packed + * into higher bits. + * @param buf buffer to append to + * @param value boolean value to encode + * @param suffix a constant to prepend after value + * @return updated index (coder value retained) + */ + static long prepend(long indexCoder, byte[] buf, long value, String suffix) { + indexCoder = prepend(indexCoder, buf, suffix); + return prepend(indexCoder, buf, value); + } + + /** + * Prepends constant and the stringly representation of value into buffer, + * given the coder and final index. Index is measured in chars, not in bytes! + * + * @param indexCoder final char index in the buffer, along with coder packed + * into higher bits. + * @param buf buffer to append to + * @param prefix a constant to prepend before value + * @param value boolean value to encode + * @param suffix a constant to prepend after value + * @return updated index (coder value retained) + */ + static long prepend(long indexCoder, byte[] buf, String prefix, long value, String suffix) { + indexCoder = prepend(indexCoder, buf, suffix); + indexCoder = prepend(indexCoder, buf, value); + return prepend(indexCoder, buf, prefix); + } + + /** * Prepends the stringly representation of String value into buffer, * given the coder and final index. Index is measured in chars, not in bytes! * * @param indexCoder final char index in the buffer, along with coder packed * into higher bits.
*** 279,288 **** --- 579,624 ---- } return indexCoder; } /** + * Prepends constant and the stringly representation of value into buffer, + * given the coder and final index. Index is measured in chars, not in bytes! + * + * @param indexCoder final char index in the buffer, along with coder packed + * into higher bits. + * @param buf buffer to append to + * @param prefix a constant to prepend before value + * @param value boolean value to encode + * @return updated index (coder value retained) + * @implNote this prepend is semantically identical to the omitted + * value + suffix prepender + */ + static long prepend(long indexCoder, byte[] buf, String prefix, String value) { + indexCoder = prepend(indexCoder, buf, value); + return prepend(indexCoder, buf, prefix); + } + + /** + * Prepends constant and the stringly representation of value into buffer, + * given the coder and final index. Index is measured in chars, not in bytes! + * + * @param indexCoder final char index in the buffer, along with coder packed + * into higher bits. + * @param buf buffer to append to + * @param prefix a constant to prepend before value + * @param value boolean value to encode + * @param suffix a constant to prepend after value + * @return updated index (coder value retained) + */ + static long prepend(long indexCoder, byte[] buf, String prefix, String value, String suffix) { + indexCoder = prepend(indexCoder, buf, suffix); + indexCoder = prepend(indexCoder, buf, value); + return prepend(indexCoder, buf, prefix); + } + + /** * Instantiates the String with given buffer and coder * @param buf buffer to use * @param indexCoder remaining index (should be zero) and coder * @return String resulting string */
< prev index next >