Uploaded image for project: 'HPCC'
  1. HPCC
  2. HPCC-16732

Improve code for break from nested iterator

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Timed Out
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Code Generator
    • Labels:
      None
    • Compatibility:
      Point

      Description

      Currently we generate code like the following:

      		RtlLinkedDatasetBuilder crLND(allocMND);
      		unsigned vNND = 0;
      		bool vOND;
      		vOND = false;
      		byte * rowPND;
      		byte * * curQND = rows;
      		unsigned vRND = numRows;
      		for (;vRND--;) {
      			rowPND = *curQND++;
      			byte * rowSND;
      			byte * * curTND = *((byte * * *)(rowPND + 104U));
      			unsigned vUND = *((unsigned *)(rowPND + 100U));
      			for (;vUND--;) {
      				rowSND = *curTND++;
      				vOND = true;
      				vNND++;
      				if (vNND > 25LL) {
      					break;
      				}
      				crLND.append(rowSND);
      				vOND = false;
      			}
      			if (vOND) {
      				break;
      			}
      		}
      

      Better would be

      		RtlLinkedDatasetBuilder crLND(allocMND);
      		unsigned vNND = 0;
      		bool vOND;
      		vOND = false;
      		byte * rowPND;
      		byte * * curQND = rows;
      		unsigned vRND = numRows;
      		for (;vRND--;) {
      			rowPND = *curQND++;
      			byte * rowSND;
      			byte * * curTND = *((byte * * *)(rowPND + 104U));
      			unsigned vUND = *((unsigned *)(rowPND + 100U));
      			for (;vUND--;) {
      				rowSND = *curTND++;
      				vNND++;
      				if (vNND > 25LL) {
      				    vOND = true;
      				    break;
      				}
      				crLND.append(rowSND);
      			}
      			if (vOND) {
      				break;
      			}
      		}
      

      It would require a break variable to be bound to the current context, and the break code to check and assigned true if so.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                anybody Available for anyone
                Reporter:
                ghalliday Gavin Halliday
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: