From: miha-q <> Date: Sat, 3 Aug 2024 00:59:05 +0000 (-0400) Subject: Fri Aug 2 08:59:05 PM EDT 2024 X-Git-Url: http://www.foleosoft.com/?a=commitdiff_plain;h=b7ffe2a7711ce95bd6ee8375c27d49b63be6418d;p=QAnsel.git Fri Aug 2 08:59:05 PM EDT 2024 --- diff --git a/src/bytecode.c b/src/bytecode.c index 5413a98..4cf466f 100644 --- a/src/bytecode.c +++ b/src/bytecode.c @@ -1155,6 +1155,7 @@ void qansel_reorder(QAnselContext* ctx, unsigned char* program, int programSize) ramInstrLen++; PC += next; } + for (int i = 0; i < ramInstrLen; i++) { if (i == 0) @@ -1216,7 +1217,6 @@ void qansel_reorder(QAnselContext* ctx, unsigned char* program, int programSize) { while (1) { - head[reorid] = 0; //find the next unchecked instruction int found = -1; int idx = head[reorid]; @@ -1275,13 +1275,27 @@ void qansel_reorder(QAnselContext* ctx, unsigned char* program, int programSize) if (idx == -1) { + //idx.next.prev = found + //found.next = head + //found.prev = -1 + //head = found reordered[reorid][head[reorid]].prev = found; reordered[reorid][found].next = head[reorid]; reordered[reorid][found].prev = -1; head[reorid] = found; + //printf("head: %i\n", found); } else { + /* + [idx].next -> .prev <- o + found + + */ + //idx.next.prev = found + //found.next = idx.next + //found.prev = idx + //idx.next = found reordered[reorid][ reordered[reorid][idx].next ].prev = found; reordered[reorid][found].next = reordered[reorid][idx].next; reordered[reorid][found].prev = idx; @@ -1289,7 +1303,16 @@ void qansel_reorder(QAnselContext* ctx, unsigned char* program, int programSize) } if (reorid == 1) { + /* + printf("%i\n", head[reorid]); + for (int i = 0; i < ramInstrLen; i++) + { + printf("%i -> %i\n", i, reordered[reorid][i].next); + } + printf("===========================\n"); + */ int tmpeff = qansel_efficiency(reordered[reorid], ramInstrLen, head[reorid]); + head[reorid] = 0; //correct? if (tmpeff >= efficiency) { efficiency = tmpeff;