From 30b89c0f3d031934018218bc132ba9f4bdbc7469 Mon Sep 17 00:00:00 2001 From: Luke Date: Mon, 30 Jun 2025 23:42:52 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=BB=9F=E4=B8=80=E5=93=A8=E5=85=B5?= =?UTF-8?q?=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/jcnc/snow/vm/commands/function/RetCommand.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/jcnc/snow/vm/commands/function/RetCommand.java b/src/main/java/org/jcnc/snow/vm/commands/function/RetCommand.java index af37032..1299bf5 100644 --- a/src/main/java/org/jcnc/snow/vm/commands/function/RetCommand.java +++ b/src/main/java/org/jcnc/snow/vm/commands/function/RetCommand.java @@ -14,7 +14,9 @@ import org.jcnc.snow.vm.module.*; */ public class RetCommand implements Command { - /** Sentinel value that tells the VM loop to terminate gracefully. */ + /** + * Sentinel value that tells the VM loop to terminate gracefully. + */ private static final int PROGRAM_END = Integer.MAX_VALUE; @Override @@ -32,8 +34,8 @@ public class RetCommand implements Command { StackFrame topFrame = callStack.peekFrame(); /* ----- Root frame: do NOT pop, just end program ----- */ - if (topFrame.getReturnAddress() == 0) { - System.out.println("Return 0"); + if (topFrame.getReturnAddress() == PROGRAM_END) { + System.out.println("Return "); return PROGRAM_END; // VM main loop should break }