8265029: Preserve SIZED characteristics on slice operations (skip, limit)

Reviewed-by: psandoz
This commit is contained in:
Tagir F. Valeev 2021-05-28 01:56:38 +00:00
parent 95b1fa7a88
commit 0c9daa7ed5
12 changed files with 704 additions and 89 deletions

View file

@ -325,12 +325,24 @@ enum StreamOpFlag {
*/
// 12, 0x01000000
SHORT_CIRCUIT(12,
set(Type.OP).set(Type.TERMINAL_OP));
set(Type.OP).set(Type.TERMINAL_OP)),
/**
* Characteristic value signifying that an operation may adjust the
* total size of the stream.
* <p>
* The flag, if present, is only valid when SIZED is present;
* and is only valid for sequential streams.
* <p>
* An intermediate operation can preserve or inject this value.
*/
// 13, 0x04000000
SIZE_ADJUSTING(13,
set(Type.OP));
// The following 2 flags are currently undefined and a free for any further
// stream flags if/when required
//
// 13, 0x04000000
// 14, 0x10000000
// 15, 0x40000000
@ -629,6 +641,11 @@ enum StreamOpFlag {
*/
static final int IS_SHORT_CIRCUIT = SHORT_CIRCUIT.set;
/**
* The bit value to inject {@link #SIZE_ADJUSTING}.
*/
static final int IS_SIZE_ADJUSTING = SIZE_ADJUSTING.set;
private static int getMask(int flags) {
return (flags == 0)
? FLAG_MASK