gc
This commit is contained in:
parent
e3b228061f
commit
0f841f9c22
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
24
njvm.c
24
njvm.c
@ -419,29 +419,32 @@ void swap() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void garbageCollector() {
|
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("%d\n", GET_SIZE(b));
|
||||||
|
|
||||||
//printf("%s\n", "op2");
|
//printf("%s\n", "op2");
|
||||||
bip.op2 = relocate(bip.op2);
|
bip.op2 = relocate(bip.op2);
|
||||||
|
|
||||||
b = bip.op2;
|
b = bip.op2;
|
||||||
if (b != NULL)
|
if (b != NULL)
|
||||||
//printf("%d\n", GET_SIZE(b));
|
//printf("%d\n", GET_SIZE(b));
|
||||||
@ -449,12 +452,19 @@ void garbageCollector() {
|
|||||||
//printf("%s\n", "res");
|
//printf("%s\n", "res");
|
||||||
bip.res = relocate(bip.res);
|
bip.res = relocate(bip.res);
|
||||||
b = bip.res;
|
b = bip.res;
|
||||||
if(b!= NULL)
|
|
||||||
|
if (b != NULL) {
|
||||||
//printf("%d\n", GET_SIZE(b));
|
//printf("%d\n", GET_SIZE(b));
|
||||||
|
|
||||||
//printf("%s\n", "rem");
|
printf("%s\n", "rem");
|
||||||
|
bip.op1 = bip.rem;
|
||||||
|
bigPrint(stdout);
|
||||||
bip.rem = relocate(bip.rem);
|
bip.rem = relocate(bip.rem);
|
||||||
|
printf("%s\n", "rem");
|
||||||
|
}
|
||||||
|
|
||||||
b = bip.rem;
|
b = bip.rem;
|
||||||
|
printf("bip finished\n");
|
||||||
if (b != NULL)
|
if (b != NULL)
|
||||||
//printf("%d\n", GET_SIZE(b));
|
//printf("%d\n", GET_SIZE(b));
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user