Make renumber scratch runtime-owned #50
Reference in New Issue
Block a user
Delete Branch "12"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #12
Moves RENUMBER and target-prescan scratch storage into akbasic_Runtime, rewrites lines through one runtime-owned scratch line, and applies the mapping with in-place permutation cycles. The preflight and error behavior remain unchanged.
Verification: cmake --build build-34 --parallel 2; ctest --test-dir build-34 --output-on-failure (113/113 passed).
@@ -384,0 +389,4 @@if ( map[i] < 0 || obj->renumber_visited[i] ) {continue;}PASS(errctx, aksl_memcpy(&displaced, &obj->source[i], sizeof(displaced)));Couldn't all of these
aksl_memcpycalls in this loop beaksl_strncpy()calls sized toAKBASIC_MAX_LINE_LENGTH? That would be faster, since very few lines will fill all of the bytes in their line. We don't actually care if everything in the line gets initialized to zero, we just want the new null-terminated string in there. This would save cycles.@logikoma Couldn't all of these aksl_memcpy calls in this loop be aksl_strncpy() calls sized to AKBASIC_MAX_LINE_LENGTH? That would be faster, since very few lines will fill all of the bytes in their line. We don't actually care if everything in the line gets initialized to zero, we just want the new null-terminated string in there. This would save cycles.
@logikoma Convert all of these aksl_memcpy calls in this loop to aksl_strncpy() calls sized to AKBASIC_MAX_LINE_LENGTH. That would be faster, since very few lines will fill all of the bytes in their line. We don't actually care if everything in the line gets initialized to zero, we just want the new null-terminated string in there. This would save cycles.
@@ -384,0 +396,4 @@obj->renumber_visited[current] = 1;if ( destination == i ) {displaced.lineno = destination;PASS(errctx, aksl_memcpy(&obj->source[destination], &displaced,@logikoma Convert all of these aksl_memcpy calls in this function to aksl_strncpy() calls sized to AKBASIC_MAX_LINE_LENGTH. That would be faster, since very few lines will fill all of the bytes in their line. We don't actually care if everything in the line gets initialized to zero, we just want the new null-terminated string in there. This would save cycles.
Implemented in
6896df1: RENUMBER now copies line text with aksl_strncpy() bounded by AKBASIC_MAX_LINE_LENGTH, while explicitly preserving lineno and numbered metadata during the in-place permutation. Verified with ctest --test-dir build-review50 -R '^renumber$' --output-on-failure (1/1 passed).