bug fixes and getfield implementation beta
This commit is contained in:
@@ -713,6 +713,9 @@ struct GroundExecutionResult _GroundBytecodeInstructionExecute(GroundBytecodeIns
|
||||
return CONTINUE;
|
||||
}
|
||||
} else {
|
||||
for (GroundSize i = 0; i < function->closure->len; i++) {
|
||||
Ground.Free.BytecodeValue(&function->closure->heap[i]);
|
||||
}
|
||||
free(function->closure->heap);
|
||||
}
|
||||
|
||||
@@ -724,11 +727,6 @@ struct GroundExecutionResult _GroundBytecodeInstructionExecute(GroundBytecodeIns
|
||||
Ground.Log.Error("malloc failed in Ground.Bytecode.Instruction.execute");
|
||||
Ground.Flags.error = true;
|
||||
return CONTINUE;
|
||||
} else {
|
||||
// forget all values in previous closure
|
||||
for (GroundSize i = 0; i < function->closure->len; i++) {
|
||||
Ground.Free.BytecodeValue(&function->closure->heap[i]);
|
||||
}
|
||||
}
|
||||
|
||||
for (GroundSize i = 0; i < heap->len; i++) {
|
||||
@@ -961,6 +959,9 @@ struct GroundExecutionResult _GroundBytecodeInstructionExecute(GroundBytecodeIns
|
||||
return CONTINUE;
|
||||
}
|
||||
} else {
|
||||
for (GroundSize i = 0; i < function->closure->len; i++) {
|
||||
Ground.Free.BytecodeValue(&function->closure->heap[i]);
|
||||
}
|
||||
free(function->closure->heap);
|
||||
}
|
||||
|
||||
@@ -972,11 +973,6 @@ struct GroundExecutionResult _GroundBytecodeInstructionExecute(GroundBytecodeIns
|
||||
Ground.Log.Error("malloc failed in Ground.Bytecode.Instruction.execute");
|
||||
Ground.Flags.error = true;
|
||||
return CONTINUE;
|
||||
} else {
|
||||
// forget all values in previous closure
|
||||
for (GroundSize i = 0; i < function->closure->len; i++) {
|
||||
Ground.Free.BytecodeValue(&function->closure->heap[i]);
|
||||
}
|
||||
}
|
||||
|
||||
for (GroundSize i = 0; i < heap->len; i++) {
|
||||
@@ -1039,6 +1035,17 @@ struct GroundExecutionResult _GroundBytecodeInstructionExecute(GroundBytecodeIns
|
||||
return CONTINUE;
|
||||
}
|
||||
GETFIELD: {
|
||||
// args: [parent_offset, field0_offset, ..., fieldF_offset, output_offset]
|
||||
GroundBytecodeValue* current = HEAP_GET(heap, instruction->args.at[0]);
|
||||
|
||||
for (GroundSize i = 1; i < instruction->args.len - 1; i++) {
|
||||
current = ¤t->as.Object.values[instruction->args.at[i]];
|
||||
}
|
||||
|
||||
GroundBytecodeValue* output = HEAP_GET(heap, instruction->args.at[instruction->args.len - 1]);
|
||||
Ground.Free.BytecodeValue(output);
|
||||
*output = Ground.Copy.BytecodeValue(current);
|
||||
|
||||
return CONTINUE;
|
||||
}
|
||||
SETFIELD: {
|
||||
|
||||
Reference in New Issue
Block a user