diff --git a/Makefile b/Makefile index da38b3c..8c7a527 100644 --- a/Makefile +++ b/Makefile @@ -9,4 +9,4 @@ run: build ./njvm prog.bin debug: build - ./njvm --debug prog.bin + ./njvm --debug --heap 100000 --stack 1000 prog.bin diff --git a/bigint/build/bin/testbip b/bigint/build/bin/testbip index 5ed9446..4bc656a 100755 Binary files a/bigint/build/bin/testbip and b/bigint/build/bin/testbip differ diff --git a/bigint/build/lib/libbigint.a b/bigint/build/lib/libbigint.a index 29fe716..2529ae1 100644 Binary files a/bigint/build/lib/libbigint.a and b/bigint/build/lib/libbigint.a differ diff --git a/bigint/src/bigint.o b/bigint/src/bigint.o index 162ad9f..4e68f95 100644 Binary files a/bigint/src/bigint.o and b/bigint/src/bigint.o differ diff --git a/bigint/src/libbigint.a b/bigint/src/libbigint.a index 29fe716..2529ae1 100644 Binary files a/bigint/src/libbigint.a and b/bigint/src/libbigint.a differ diff --git a/bigint/tst/support.o b/bigint/tst/support.o index 0147bff..2ad0cc0 100644 Binary files a/bigint/tst/support.o and b/bigint/tst/support.o differ diff --git a/bigint/tst/testbip b/bigint/tst/testbip index 5ed9446..4bc656a 100755 Binary files a/bigint/tst/testbip and b/bigint/tst/testbip differ diff --git a/bigint/tst/testbip.o b/bigint/tst/testbip.o index d8aaf39..8acdffd 100644 Binary files a/bigint/tst/testbip.o and b/bigint/tst/testbip.o differ diff --git a/njvm.c b/njvm.c index 4bcd8da..4fa6868 100644 --- a/njvm.c +++ b/njvm.c @@ -541,12 +541,12 @@ int main(int argc, char *argv[]) { return 0; } else if (strcmp(argv[i], "--stack") == 0) { i++; - // TODO: implement stack size + size = atoi(argv[i]); } else if (strcmp(argv[i], "--heap") == 0) { i++; argVheapSizeKiB = atoi(argv[i]); } else if (strcmp(argv[i], "--gcpurge") == 0) { - // TODO: implement gcpurge + purgeFlag = true; } else { sizeSDA = fromFile(argv[i], program); run = 1; diff --git a/njvm.o b/njvm.o index 8a41421..8e030ae 100644 Binary files a/njvm.o and b/njvm.o differ diff --git a/record.c b/record.c index 8df9f48..76422a7 100644 --- a/record.c +++ b/record.c @@ -8,11 +8,12 @@ #include "njvm.h" ObjRef newRecord(int size){ + printf("Size: %i\n", size); ObjRef record; unsigned int objSize; objSize = sizeof(*record) + (size * sizeof(void *)); if((record = alloc(objSize)) == NULL){ - perror("malloc"); + perror("alloc"); } record->size = MSB; record->size = record->size + size; @@ -49,7 +50,7 @@ void setField(ObjRef arr, int point, ObjRef value){ else size = sizeof(*value) + (GET_ELEMENT_COUNT(value) * sizeof(void *)); } - if((GET_REFS_PTR(arr)[point] = malloc(size)) == NULL) perror("malloc"); + if((GET_REFS_PTR(arr)[point] = alloc(size)) == NULL) perror("alloc"); GET_REFS_PTR(arr)[point] ->size = size; * (ObjRef *)GET_REFS_PTR(arr)[point]->data = value; } diff --git a/stackslot.c b/stackslot.c index 8e59ee6..47df161 100644 --- a/stackslot.c +++ b/stackslot.c @@ -4,6 +4,7 @@ #include #include #include "objref.c" +#include "njvm.h" typedef int Object; @@ -19,8 +20,8 @@ typedef struct { ObjRef getIntObj(int val) { ObjRef intObject; unsigned int objSize = sizeof(ObjRef) + sizeof(int); - if ((intObject = malloc(objSize)) == NULL) { - perror("malloc"); + if ((intObject = alloc(objSize)) == NULL) { + perror("alloc"); } *(int *) intObject->data = val; intObject->size = objSize;