DfaInstructionState (DfaInstructionState instructionState, Collection<? extends DfaMemoryState> processed) { DfaMemoryStateImpl curState = (DfaMemoryStateImpl)instructionState.getMemoryState(); int curStateStackSize = curState.getStackSize(); if (processed.size() > 10 && curStateStackSize > 10) { for (DfaMemoryState state : processed) { int diff = curStateStackSize - state.getStackSize(); if (diff > 10) { throw new IllegalStateException("Stack for instruction %d increased by %d; it's likely that IR was built incorrectly" .formatted(instructionState.getInstruction().getIndex(), diff)); } } } Object key = curState.getMergeabilityKey(); DfaMemoryStateImpl mergedState = StreamEx.of(processed).filterBy(DfaMemoryState::getMergeabilityKey, key) .foldLeft(curState, (s1, s2) -> { s1.merge(s2); return s1; }); mergedState.widen(); instructionState = new DfaInstructionState(instructionState.getInstruction(), mergedState); myWasForciblyMerged = true; return instructionState; }