This commit is contained in:
nilspolek 2024-01-28 18:42:40 +01:00
parent 0f841f9c22
commit c43f02da8e
6 changed files with 36 additions and 36 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

72
njvm.c
View File

@ -422,54 +422,54 @@ void garbageCollector() {
char *memToPurgePtr = halfHeapPtr - ((heapSizeKiB * 1024) / 2); char *memToPurgePtr = halfHeapPtr - ((heapSizeKiB * 1024) / 2);
swap(); swap();
printf("%s\n", "stack"); // printf("%s\n", "stack");
for (int i = 0; i < *stack.current; i++) { for (int i = 0; i < *stack.current; i++) {
if (stack.stack[i].isObjRef) { if (stack.stack[i].isObjRef) {
stack.stack[i].u.objRef = relocate(stack.stack[i].u.objRef); stack.stack[i].u.objRef = relocate(stack.stack[i].u.objRef);
} }
} }
printf("%s\n", "globals"); // printf("%s\n", "globals");
for (int i = 0; i < *sda.size; i++) { for (int i = 0; i < *sda.size; i++) {
sda.sda[i] = relocate(sda.sda[i]); sda.sda[i] = relocate(sda.sda[i]);
} }
// printf("%s\n", "retVal"); // printf("%s\n", "retVal");
//returnValue = relocate(returnValue); //returnValue = relocate(returnValue);
printf("%s\n", "op1"); // printf("%s\n", "op1");
bip.op1 = relocate(bip.op1); // bip.op1 = relocate(bip.op1);
ObjRef b = bip.op1; // ObjRef b = bip.op1;
//
if (b != NULL) // if (b != NULL)
// //printf("%d\n", GET_SIZE(b));
//
// //printf("%s\n", "op2");
// bip.op2 = relocate(bip.op2);
//
// b = bip.op2;
// if (b != NULL)
// //printf("%d\n", GET_SIZE(b));
//
// //printf("%s\n", "res");
// bip.res = relocate(bip.res);
// b = bip.res;
//
// if (b != NULL) {
// //printf("%d\n", GET_SIZE(b));
//
// printf("%s\n", "rem");
// bip.op1 = bip.rem;
// bigPrint(stdout);
// bip.rem = relocate(bip.rem);
// printf("%s\n", "rem");
// }
//
// b = bip.rem;
// printf("bip finished\n");
// if (b != NULL)
//printf("%d\n", GET_SIZE(b)); //printf("%d\n", GET_SIZE(b));
//
//printf("%s\n", "op2"); //
bip.op2 = relocate(bip.op2); // scan();
b = bip.op2;
if (b != NULL)
//printf("%d\n", GET_SIZE(b));
//printf("%s\n", "res");
bip.res = relocate(bip.res);
b = bip.res;
if (b != NULL) {
//printf("%d\n", GET_SIZE(b));
printf("%s\n", "rem");
bip.op1 = bip.rem;
bigPrint(stdout);
bip.rem = relocate(bip.rem);
printf("%s\n", "rem");
}
b = bip.rem;
printf("bip finished\n");
if (b != NULL)
//printf("%d\n", GET_SIZE(b));
scan();
if (purgeFlag) { if (purgeFlag) {
memset(memToPurgePtr, 0, heapSizeKiB * 1024 / 2); memset(memToPurgePtr, 0, heapSizeKiB * 1024 / 2);
} }

BIN
njvm.o

Binary file not shown.