gc
This commit is contained in:
parent
c43f02da8e
commit
968965d430
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
3
njvm.c
3
njvm.c
@ -51,7 +51,7 @@ void execute(struct program program) {
|
||||
ObjRef tempObj2;
|
||||
int tempInt;
|
||||
for (i = 0; i < *program.size; ++i) {
|
||||
if (debug == 1 || bp == i) debugMenu(fp, stack, &debug, i, &bp);
|
||||
// if (debug == 1 || bp == i) debugMenu(fp, stack, &debug, i, &bp);
|
||||
if (debug == 1) printf("(%i)", i);
|
||||
switch (program.program[i] >> 24) {
|
||||
case HALT:
|
||||
@ -360,7 +360,6 @@ ObjRef relocate(ObjRef orig) {
|
||||
printf("%s%d\n","Size in relocate ", GET_SIZE(orig));
|
||||
}
|
||||
*/
|
||||
|
||||
ObjRef copy;
|
||||
if (orig == NULL) {
|
||||
/* relocate(nil) = nil */
|
||||
|
||||
2
record.c
2
record.c
@ -23,6 +23,7 @@ ObjRef newRecord(int size){
|
||||
}
|
||||
int getSize(ObjRef arr){
|
||||
if(arr == NULL) return 0;
|
||||
if(IS_PRIMITIVE(arr)) perror("Record is a primitive");
|
||||
return GET_ELEMENT_COUNT(arr);
|
||||
}
|
||||
ObjRef getField(ObjRef arr, int point){
|
||||
@ -30,6 +31,7 @@ ObjRef getField(ObjRef arr, int point){
|
||||
if(0 > point || point > getSize(arr)){
|
||||
printf("Index %i out of bounds for length %i\n",point, getSize(arr));
|
||||
}
|
||||
|
||||
return *(ObjRef *)GET_REFS_PTR(arr)[point]->data;
|
||||
}
|
||||
void setField(ObjRef arr, int point, ObjRef value){
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user