| 903 | } |
| 904 | |
| 905 | void fxPrintHeap(txMachine* the, FILE* file, txInteger count) |
| 906 | { |
| 907 | txLinker* linker = (txLinker*)(the->context); |
| 908 | txLinkerProjection* projection = linker->firstProjection; |
| 909 | txSlot *slot, *limit, *item; |
| 910 | txInteger index = 0; |
| 911 | fprintf(file, "/* %.4d */", index); |
| 912 | fprintf(file, "\t{ NULL, {.ID = XS_NO_ID, .flag = XS_NO_FLAG, .kind = XS_REFERENCE_KIND}, "); |
| 913 | fprintf(file, ".value = { .reference = (txSlot*)&gxHeap[%d] } },\n", (int)count); |
| 914 | index++; |
| 915 | while (index < linker->projectionIndex) { |
| 916 | fprintf(file, "/* %.4d */", index); |
| 917 | slot = linker->layout[index]; |
| 918 | if (slot) |
| 919 | fxPrintSlot(the, file, slot, XS_MARK_FLAG); |
| 920 | else |
| 921 | fprintf(file, "\t{ NULL, {.ID = XS_NO_ID, .flag = XS_NO_FLAG, .kind = XS_UNINITIALIZED_KIND }, .value = { .number = 0 } },\n"); |
| 922 | index++; |
| 923 | } |
| 924 | while (projection) { |
| 925 | slot = projection->heap + 1; |
| 926 | limit = projection->limit; |
| 927 | while (slot < limit) { |
| 928 | if (!(slot->flag & XS_MARK_FLAG)) { |
| 929 | if ((slot->kind == XS_ARRAY_KIND) && ((item = slot->value.array.address))) { |
| 930 | fprintf(file, "/* %.4d */", index); |
| 931 | index++; |
| 932 | txInteger size = (txInteger)fxGetIndexSize(the, slot); |
| 933 | fprintf(file, "\t{ "); |
| 934 | fxPrintAddress(the, file, slot->next); |
| 935 | fprintf(file, ", {.ID = %d", slot->ID); |
| 936 | fprintf(file, ", .flag = 0x%x", slot->flag | XS_MARK_FLAG); |
| 937 | fprintf(file, ", .kind = XS_ARRAY_KIND}, .value = { .array = { (txSlot*)&gxHeap[%d], %d } }},\n", (int)index + 1, (int)slot->value.array.length); |
| 938 | fprintf(file, "/* %.4d */", index); |
| 939 | index++; |
| 940 | fprintf(file, "\t{ NULL, {.ID = XS_NO_ID, .flag = 0x80, .kind = XS_INTEGER_KIND}, .value = { .integer = %d * sizeof(txSlot) } },\n", (int)size); // fake chunk |
| 941 | while (size) { |
| 942 | fprintf(file, "/* %.4d */", index); |
| 943 | index++; |
| 944 | fxPrintSlot(the, file, item, XS_MARK_FLAG | XS_DEBUG_FLAG); |
| 945 | item++; |
| 946 | size--; |
| 947 | } |
| 948 | } |
| 949 | else if (projection->indexes[slot - projection->heap] >= linker->projectionIndex) { |
| 950 | fprintf(file, "/* %.4d */", index); |
| 951 | index++; |
| 952 | fxPrintSlot(the, file, slot, XS_MARK_FLAG); |
| 953 | } |
| 954 | } |
| 955 | slot++; |
| 956 | } |
| 957 | projection = projection->nextProjection; |
| 958 | } |
| 959 | fprintf(file, "/* %.4d */", index); |
| 960 | fprintf(file, "\t{ NULL, {.ID = XS_NO_ID, .flag = XS_NO_FLAG, .kind = XS_REFERENCE_KIND}, "); |
| 961 | fprintf(file, ".value = { .reference = NULL } }"); |
| 962 | } |
no test coverage detected