refactor: 优化程序终止和函数调用的输出格式

- 在 CallCommand 中添加换行符,改善函数调用的输出可读性
- 修改 HaltCommand 中的终止消息格式,提高信息的清晰度
This commit is contained in:
Luke 2025-07-22 16:35:43 +08:00
parent 6d79e28c51
commit 07b7d5c40e
2 changed files with 2 additions and 2 deletions

View File

@ -80,7 +80,7 @@ public class CallCommand implements Command {
new MethodContext("subroutine@" + targetAddr, null)); new MethodContext("subroutine@" + targetAddr, null));
callStack.pushFrame(newFrame); callStack.pushFrame(newFrame);
System.out.println("Calling function at address: " + targetAddr); System.out.println("\nCalling function at address: " + targetAddr);
return targetAddr; // jump return targetAddr; // jump
} }
} }

View File

@ -59,7 +59,7 @@ public class HaltCommand implements Command {
@Override @Override
public int execute(String[] parts, int currentPC, OperandStack operandStack, LocalVariableStore localVariableStore, CallStack callStack) { public int execute(String[] parts, int currentPC, OperandStack operandStack, LocalVariableStore localVariableStore, CallStack callStack) {
// Output the termination message // Output the termination message
LoggingUtils.logInfo("Process has ended", "\n"); LoggingUtils.logInfo("\nProcess has ended", "");
// Return -1 to indicate the program termination, and the virtual machine will not continue executing subsequent instructions // Return -1 to indicate the program termination, and the virtual machine will not continue executing subsequent instructions
return -1; return -1;