From 8340e2bacce510c15f51516ec1e5cce86e8b65e6 Mon Sep 17 00:00:00 2001 From: zhangxun <1958638841@qq.com> Date: Sat, 28 Jun 2025 20:28:12 +0800 Subject: [PATCH 01/37] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81=20byte8=20?= =?UTF-8?q?=E8=BD=AC=20short16=E3=80=81long64=E3=80=81float32=E3=80=81doub?= =?UTF-8?q?le64?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commands/type/conversion/B2DCommand.java | 47 +++++++++++++++++++ .../commands/type/conversion/B2FCommand.java | 47 +++++++++++++++++++ .../commands/type/conversion/B2LCommand.java | 47 +++++++++++++++++++ .../commands/type/conversion/B2SCommand.java | 47 +++++++++++++++++++ 4 files changed, 188 insertions(+) create mode 100644 src/main/java/org/jcnc/snow/vm/commands/type/conversion/B2DCommand.java create mode 100644 src/main/java/org/jcnc/snow/vm/commands/type/conversion/B2FCommand.java create mode 100644 src/main/java/org/jcnc/snow/vm/commands/type/conversion/B2LCommand.java create mode 100644 src/main/java/org/jcnc/snow/vm/commands/type/conversion/B2SCommand.java diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/B2DCommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/B2DCommand.java new file mode 100644 index 0000000..1ca0655 --- /dev/null +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/B2DCommand.java @@ -0,0 +1,47 @@ +package org.jcnc.snow.vm.commands.type.conversion; + +import org.jcnc.snow.vm.interfaces.Command; +import org.jcnc.snow.vm.module.CallStack; +import org.jcnc.snow.vm.module.LocalVariableStore; +import org.jcnc.snow.vm.module.OperandStack; + +/** + * B2DCommand Opcode: Represents the type conversion operation from byte8 to double64 in the virtual machine. + *
This opcode is implemented by the {@link B2DCommand} class, which defines its specific execution logic.
+ * + *Execution Steps:
+ *This opcode is used to widen a byte8 value to a double64 type to ensure compatibility with integer-based operations.
+ */ +public class B2DCommand implements Command { + + /** + * Default constructor for creating an instance of B2DCommand. + */ + public B2DCommand() { + // Empty constructor + } + + /** + * Executes the byte8 to double64 conversion operation. + * + * @param parts The array of instruction parameters, which is not used in this operation. + * @param currentPC The current program counter, representing the instruction address. + * @param operandStack The operand stack of the virtual machine. + * @param localVariableStore The local variable store for managing method-local variables. + * @param callStack The call stack of the virtual machine. + * @return The updated program counter after execution. + */ + @Override + public int execute(String[] parts, int currentPC, OperandStack operandStack, + LocalVariableStore localVariableStore, CallStack callStack) { + double convertedValue = (byte) operandStack.pop(); + operandStack.push(convertedValue); + return currentPC + 1; + } +} diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/B2FCommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/B2FCommand.java new file mode 100644 index 0000000..c61891b --- /dev/null +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/B2FCommand.java @@ -0,0 +1,47 @@ +package org.jcnc.snow.vm.commands.type.conversion; + +import org.jcnc.snow.vm.interfaces.Command; +import org.jcnc.snow.vm.module.CallStack; +import org.jcnc.snow.vm.module.LocalVariableStore; +import org.jcnc.snow.vm.module.OperandStack; + +/** + * B2FCommand Opcode: Represents the type conversion operation from byte8 to float32 in the virtual machine. + *This opcode is implemented by the {@link B2FCommand} class, which defines its specific execution logic.
+ * + *Execution Steps:
+ *This opcode is used to widen a byte8 value to a float32 type to ensure compatibility with integer-based operations.
+ */ +public class B2FCommand implements Command { + + /** + * Default constructor for creating an instance of B2FCommand. + */ + public B2FCommand() { + // Empty constructor + } + + /** + * Executes the byte8 to float32 conversion operation. + * + * @param parts The array of instruction parameters, which is not used in this operation. + * @param currentPC The current program counter, representing the instruction address. + * @param operandStack The operand stack of the virtual machine. + * @param localVariableStore The local variable store for managing method-local variables. + * @param callStack The call stack of the virtual machine. + * @return The updated program counter after execution. + */ + @Override + public int execute(String[] parts, int currentPC, OperandStack operandStack, + LocalVariableStore localVariableStore, CallStack callStack) { + float convertedValue = (byte) operandStack.pop(); + operandStack.push(convertedValue); + return currentPC + 1; + } +} diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/B2LCommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/B2LCommand.java new file mode 100644 index 0000000..344b49d --- /dev/null +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/B2LCommand.java @@ -0,0 +1,47 @@ +package org.jcnc.snow.vm.commands.type.conversion; + +import org.jcnc.snow.vm.interfaces.Command; +import org.jcnc.snow.vm.module.CallStack; +import org.jcnc.snow.vm.module.LocalVariableStore; +import org.jcnc.snow.vm.module.OperandStack; + +/** + * B2LCommand Opcode: Represents the type conversion operation from byte8 to long64 in the virtual machine. + *This opcode is implemented by the {@link B2LCommand} class, which defines its specific execution logic.
+ * + *Execution Steps:
+ *This opcode is used to widen a byte8 value to a long64 type to ensure compatibility with integer-based operations.
+ */ +public class B2LCommand implements Command { + + /** + * Default constructor for creating an instance of B2LCommand. + */ + public B2LCommand() { + // Empty constructor + } + + /** + * Executes the byte8 to long64 conversion operation. + * + * @param parts The array of instruction parameters, which is not used in this operation. + * @param currentPC The current program counter, representing the instruction address. + * @param operandStack The operand stack of the virtual machine. + * @param localVariableStore The local variable store for managing method-local variables. + * @param callStack The call stack of the virtual machine. + * @return The updated program counter after execution. + */ + @Override + public int execute(String[] parts, int currentPC, OperandStack operandStack, + LocalVariableStore localVariableStore, CallStack callStack) { + long convertedValue = (byte) operandStack.pop(); + operandStack.push(convertedValue); + return currentPC + 1; + } +} diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/B2SCommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/B2SCommand.java new file mode 100644 index 0000000..1f09ff9 --- /dev/null +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/B2SCommand.java @@ -0,0 +1,47 @@ +package org.jcnc.snow.vm.commands.type.conversion; + +import org.jcnc.snow.vm.interfaces.Command; +import org.jcnc.snow.vm.module.CallStack; +import org.jcnc.snow.vm.module.LocalVariableStore; +import org.jcnc.snow.vm.module.OperandStack; + +/** + * B2SCommand Opcode: Represents the type conversion operation from byte8 to short16 in the virtual machine. + *This opcode is implemented by the {@link B2SCommand} class, which defines its specific execution logic.
+ * + *Execution Steps:
+ *This opcode is used to widen a byte8 value to a short16 type to ensure compatibility with integer-based operations.
+ */ +public class B2SCommand implements Command { + + /** + * Default constructor for creating an instance of B2SCommand. + */ + public B2SCommand() { + // Empty constructor + } + + /** + * Executes the byte8 to short16 conversion operation. + * + * @param parts The array of instruction parameters, which is not used in this operation. + * @param currentPC The current program counter, representing the instruction address. + * @param operandStack The operand stack of the virtual machine. + * @param localVariableStore The local variable store for managing method-local variables. + * @param callStack The call stack of the virtual machine. + * @return The updated program counter after execution. + */ + @Override + public int execute(String[] parts, int currentPC, OperandStack operandStack, + LocalVariableStore localVariableStore, CallStack callStack) { + short convertedValue = (byte) operandStack.pop(); + operandStack.push(convertedValue); + return currentPC + 1; + } +} From 9d7d03e91cf7dee327948268e8c2139196dd64ea Mon Sep 17 00:00:00 2001 From: zhangxun <1958638841@qq.com> Date: Sat, 28 Jun 2025 20:31:16 +0800 Subject: [PATCH 02/37] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81=20short16=20?= =?UTF-8?q?=E8=BD=AC=20byte8=E3=80=81long64=E3=80=81float32=E3=80=81double?= =?UTF-8?q?64?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commands/type/conversion/S2BCommand.java | 47 +++++++++++++++++++ .../commands/type/conversion/S2DCommand.java | 47 +++++++++++++++++++ .../commands/type/conversion/S2FCommand.java | 47 +++++++++++++++++++ .../commands/type/conversion/S2LCommand.java | 47 +++++++++++++++++++ 4 files changed, 188 insertions(+) create mode 100644 src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2BCommand.java create mode 100644 src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2DCommand.java create mode 100644 src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2FCommand.java create mode 100644 src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2LCommand.java diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2BCommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2BCommand.java new file mode 100644 index 0000000..fa86e5f --- /dev/null +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2BCommand.java @@ -0,0 +1,47 @@ +package org.jcnc.snow.vm.commands.type.conversion; + +import org.jcnc.snow.vm.interfaces.Command; +import org.jcnc.snow.vm.module.CallStack; +import org.jcnc.snow.vm.module.LocalVariableStore; +import org.jcnc.snow.vm.module.OperandStack; + +/** + * S2BCommand Opcode: Represents the type conversion operation from short16 to byte8 in the virtual machine. + *This opcode is implemented by the {@link S2BCommand} class, which defines its specific execution logic.
+ * + *Execution Steps:
+ *This opcode is used to widen a short16 value to a byte8 type, facilitating subsequent integer arithmetic or comparison operations.
+ */ +public class S2BCommand implements Command { + + /** + * Default constructor for creating an instance of S2BCommand. + */ + public S2BCommand() { + // Empty constructor + } + + /** + * Executes the short16 to byte8 conversion operation. + * + * @param parts The array of instruction parameters, which is not used in this operation. + * @param currentPC The current program counter, representing the instruction address. + * @param operandStack The operand stack of the virtual machine. + * @param localVariableStore The local variable store for managing method-local variables. + * @param callStack The call stack of the virtual machine. + * @return The updated program counter after execution. + */ + @Override + public int execute(String[] parts, int currentPC, OperandStack operandStack, + LocalVariableStore localVariableStore, CallStack callStack) { + byte convertedValue = (byte) ((short) operandStack.pop()); + operandStack.push(convertedValue); + return currentPC + 1; + } +} diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2DCommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2DCommand.java new file mode 100644 index 0000000..2f3381f --- /dev/null +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2DCommand.java @@ -0,0 +1,47 @@ +package org.jcnc.snow.vm.commands.type.conversion; + +import org.jcnc.snow.vm.interfaces.Command; +import org.jcnc.snow.vm.module.CallStack; +import org.jcnc.snow.vm.module.LocalVariableStore; +import org.jcnc.snow.vm.module.OperandStack; + +/** + * S2DCommand Opcode: Represents the type conversion operation from short16 to double64 in the virtual machine. + *This opcode is implemented by the {@link S2DCommand} class, which defines its specific execution logic.
+ * + *Execution Steps:
+ *This opcode is used to widen a short16 value to an double64 type, facilitating subsequent integer arithmetic or comparison operations.
+ */ +public class S2DCommand implements Command { + + /** + * Default constructor for creating an instance of S2DCommand. + */ + public S2DCommand() { + // Empty constructor + } + + /** + * Executes the short16 to double64 conversion operation. + * + * @param parts The array of instruction parameters, which is not used in this operation. + * @param currentPC The current program counter, representing the instruction address. + * @param operandStack The operand stack of the virtual machine. + * @param localVariableStore The local variable store for managing method-local variables. + * @param callStack The call stack of the virtual machine. + * @return The updated program counter after execution. + */ + @Override + public int execute(String[] parts, int currentPC, OperandStack operandStack, + LocalVariableStore localVariableStore, CallStack callStack) { + double convertedValue = (short) operandStack.pop(); + operandStack.push(convertedValue); + return currentPC + 1; + } +} diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2FCommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2FCommand.java new file mode 100644 index 0000000..78fbb4a --- /dev/null +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2FCommand.java @@ -0,0 +1,47 @@ +package org.jcnc.snow.vm.commands.type.conversion; + +import org.jcnc.snow.vm.interfaces.Command; +import org.jcnc.snow.vm.module.CallStack; +import org.jcnc.snow.vm.module.LocalVariableStore; +import org.jcnc.snow.vm.module.OperandStack; + +/** + * S2FCommand Opcode: Represents the type conversion operation from short16 to float32 in the virtual machine. + *This opcode is implemented by the {@link S2FCommand} class, which defines its specific execution logic.
+ * + *Execution Steps:
+ *This opcode is used to widen a short16 value to an float32 type, facilitating subsequent integer arithmetic or comparison operations.
+ */ +public class S2FCommand implements Command { + + /** + * Default constructor for creating an instance of S2FCommand. + */ + public S2FCommand() { + // Empty constructor + } + + /** + * Executes the short16 to float32 conversion operation. + * + * @param parts The array of instruction parameters, which is not used in this operation. + * @param currentPC The current program counter, representing the instruction address. + * @param operandStack The operand stack of the virtual machine. + * @param localVariableStore The local variable store for managing method-local variables. + * @param callStack The call stack of the virtual machine. + * @return The updated program counter after execution. + */ + @Override + public int execute(String[] parts, int currentPC, OperandStack operandStack, + LocalVariableStore localVariableStore, CallStack callStack) { + float convertedValue = (short) operandStack.pop(); + operandStack.push(convertedValue); + return currentPC + 1; + } +} diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2LCommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2LCommand.java new file mode 100644 index 0000000..cec58e6 --- /dev/null +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2LCommand.java @@ -0,0 +1,47 @@ +package org.jcnc.snow.vm.commands.type.conversion; + +import org.jcnc.snow.vm.interfaces.Command; +import org.jcnc.snow.vm.module.CallStack; +import org.jcnc.snow.vm.module.LocalVariableStore; +import org.jcnc.snow.vm.module.OperandStack; + +/** + * S2LCommand Opcode: Represents the type conversion operation from short16 to long64 in the virtual machine. + *This opcode is implemented by the {@link S2LCommand} class, which defines its specific execution logic.
+ * + *Execution Steps:
+ *This opcode is used to widen a short16 value to a long64 type, facilitating subsequent integer arithmetic or comparison operations.
+ */ +public class S2LCommand implements Command { + + /** + * Default constructor for creating an instance of S2LCommand. + */ + public S2LCommand() { + // Empty constructor + } + + /** + * Executes the short16 to long64 conversion operation. + * + * @param parts The array of instruction parameters, which is not used in this operation. + * @param currentPC The current program counter, representing the instruction address. + * @param operandStack The operand stack of the virtual machine. + * @param localVariableStore The local variable store for managing method-local variables. + * @param callStack The call stack of the virtual machine. + * @return The updated program counter after execution. + */ + @Override + public int execute(String[] parts, int currentPC, OperandStack operandStack, + LocalVariableStore localVariableStore, CallStack callStack) { + long convertedValue = (short) operandStack.pop(); + operandStack.push(convertedValue); + return currentPC + 1; + } +} From ccc9e3e50f6f2942d045bb06a806b5a8613845dd Mon Sep 17 00:00:00 2001 From: zhangxun <1958638841@qq.com> Date: Sat, 28 Jun 2025 21:00:09 +0800 Subject: [PATCH 03/37] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81=20double64=20?= =?UTF-8?q?=E8=BD=AC=20byte8=E3=80=81short16?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commands/type/conversion/D2BCommand.java | 48 +++++++++++++++++++ .../commands/type/conversion/D2SCommand.java | 48 +++++++++++++++++++ 2 files changed, 96 insertions(+) create mode 100644 src/main/java/org/jcnc/snow/vm/commands/type/conversion/D2BCommand.java create mode 100644 src/main/java/org/jcnc/snow/vm/commands/type/conversion/D2SCommand.java diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/D2BCommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/D2BCommand.java new file mode 100644 index 0000000..7180d2e --- /dev/null +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/D2BCommand.java @@ -0,0 +1,48 @@ +package org.jcnc.snow.vm.commands.type.conversion; + +import org.jcnc.snow.vm.interfaces.Command; +import org.jcnc.snow.vm.module.CallStack; +import org.jcnc.snow.vm.module.LocalVariableStore; +import org.jcnc.snow.vm.module.OperandStack; + +/** + * D2BCommand Opcode: Represents the type conversion operation from double64 to byte8 in the virtual machine. + *This opcode is implemented by the {@link D2BCommand} class, which defines its specific execution logic.
+ * + *Execution Steps:
+ *This opcode is used to narrow a double64 value to a byte8 type for further integer-based operations.
+ */ +public class D2BCommand implements Command { + + /** + * Default constructor for creating an instance of D2BCommand. + */ + public D2BCommand() { + // Empty constructor + } + + /** + * Executes the double64 to byte8 conversion operation. + * + * @param parts The array of instruction parameters, which is not used in this operation. + * @param currentPC The current program counter, representing the instruction address. + * @param operandStack The operand stack of the virtual machine. + * @param localVariableStore The local variable store for managing method-local variables. + * @param callStack The call stack of the virtual machine. + * @return The updated program counter after execution. + */ + @Override + public int execute(String[] parts, int currentPC, OperandStack operandStack, + LocalVariableStore localVariableStore, CallStack callStack) { + double value = (double) operandStack.pop(); + byte convertedValue = (byte) value; + operandStack.push(convertedValue); + return currentPC + 1; + } +} diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/D2SCommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/D2SCommand.java new file mode 100644 index 0000000..ab11cf0 --- /dev/null +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/D2SCommand.java @@ -0,0 +1,48 @@ +package org.jcnc.snow.vm.commands.type.conversion; + +import org.jcnc.snow.vm.interfaces.Command; +import org.jcnc.snow.vm.module.CallStack; +import org.jcnc.snow.vm.module.LocalVariableStore; +import org.jcnc.snow.vm.module.OperandStack; + +/** + * D2SCommand Opcode: Represents the type conversion operation from double64 to short16 in the virtual machine. + *This opcode is implemented by the {@link D2SCommand} class, which defines its specific execution logic.
+ * + *Execution Steps:
+ *This opcode is used to narrow a double64 value to an short16 type for further integer-based operations.
+ */ +public class D2SCommand implements Command { + + /** + * Default constructor for creating an instance of D2SCommand. + */ + public D2SCommand() { + // Empty constructor + } + + /** + * Executes the double64 to short16 conversion operation. + * + * @param parts The array of instruction parameters, which is not used in this operation. + * @param currentPC The current program counter, representing the instruction address. + * @param operandStack The operand stack of the virtual machine. + * @param localVariableStore The local variable store for managing method-local variables. + * @param callStack The call stack of the virtual machine. + * @return The updated program counter after execution. + */ + @Override + public int execute(String[] parts, int currentPC, OperandStack operandStack, + LocalVariableStore localVariableStore, CallStack callStack) { + double value = (double) operandStack.pop(); + short convertedValue = (short) value; + operandStack.push(convertedValue); + return currentPC + 1; + } +} From ec94191153e0ec2233548b824c7328e5e5b59caa Mon Sep 17 00:00:00 2001 From: zhangxun <1958638841@qq.com> Date: Sat, 28 Jun 2025 21:02:30 +0800 Subject: [PATCH 04/37] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81=20float32=20?= =?UTF-8?q?=E8=BD=AC=20byte8=E3=80=81short16?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commands/type/conversion/F2BCommand.java | 48 +++++++++++++++++++ .../commands/type/conversion/F2SCommand.java | 48 +++++++++++++++++++ 2 files changed, 96 insertions(+) create mode 100644 src/main/java/org/jcnc/snow/vm/commands/type/conversion/F2BCommand.java create mode 100644 src/main/java/org/jcnc/snow/vm/commands/type/conversion/F2SCommand.java diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/F2BCommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/F2BCommand.java new file mode 100644 index 0000000..5240f86 --- /dev/null +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/F2BCommand.java @@ -0,0 +1,48 @@ +package org.jcnc.snow.vm.commands.type.conversion; + +import org.jcnc.snow.vm.interfaces.Command; +import org.jcnc.snow.vm.module.CallStack; +import org.jcnc.snow.vm.module.LocalVariableStore; +import org.jcnc.snow.vm.module.OperandStack; + +/** + * F2BCommand Opcode: Represents the type conversion operation from float32 to byte8 in the virtual machine. + *This opcode is implemented by the {@link F2BCommand} class, which defines its specific execution logic.
+ * + *Execution Steps:
+ *This opcode is used to convert a float32 value to a byte8 type for further integer operations or comparisons.
+ */ +public class F2BCommand implements Command { + + /** + * Default constructor for creating an instance of F2BCommand. + */ + public F2BCommand() { + // Empty constructor + } + + /** + * Executes the float32 to byte8 conversion operation. + * + * @param parts The array of instruction parameters, which is not used in this operation. + * @param currentPC The current program counter, representing the instruction address. + * @param operandStack The operand stack of the virtual machine. + * @param localVariableStore The local variable store for managing method-local variables. + * @param callStack The call stack of the virtual machine. + * @return The updated program counter after execution. + */ + @Override + public int execute(String[] parts, int currentPC, OperandStack operandStack, + LocalVariableStore localVariableStore, CallStack callStack) { + float value = (float) operandStack.pop(); + byte convertedValue = (byte) value; + operandStack.push(convertedValue); + return currentPC + 1; + } +} diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/F2SCommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/F2SCommand.java new file mode 100644 index 0000000..83a79b5 --- /dev/null +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/F2SCommand.java @@ -0,0 +1,48 @@ +package org.jcnc.snow.vm.commands.type.conversion; + +import org.jcnc.snow.vm.interfaces.Command; +import org.jcnc.snow.vm.module.CallStack; +import org.jcnc.snow.vm.module.LocalVariableStore; +import org.jcnc.snow.vm.module.OperandStack; + +/** + * F2SCommand Opcode: Represents the type conversion operation from float32 to short16 in the virtual machine. + *This opcode is implemented by the {@link F2SCommand} class, which defines its specific execution logic.
+ * + *Execution Steps:
+ *This opcode is used to convert a float32 value to a short16 type for further integer operations or comparisons.
+ */ +public class F2SCommand implements Command { + + /** + * Default constructor for creating an instance of F2SCommand. + */ + public F2SCommand() { + // Empty constructor + } + + /** + * Executes the float32 to short16 conversion operation. + * + * @param parts The array of instruction parameters, which is not used in this operation. + * @param currentPC The current program counter, representing the instruction address. + * @param operandStack The operand stack of the virtual machine. + * @param localVariableStore The local variable store for managing method-local variables. + * @param callStack The call stack of the virtual machine. + * @return The updated program counter after execution. + */ + @Override + public int execute(String[] parts, int currentPC, OperandStack operandStack, + LocalVariableStore localVariableStore, CallStack callStack) { + float value = (float) operandStack.pop(); + short convertedValue = (short) value; + operandStack.push(convertedValue); + return currentPC + 1; + } +} From fe9a8e750550617484b133a2c36e705397c1af48 Mon Sep 17 00:00:00 2001 From: zhangxun <1958638841@qq.com> Date: Sat, 28 Jun 2025 21:04:23 +0800 Subject: [PATCH 05/37] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81=20long64=20?= =?UTF-8?q?=E8=BD=AC=20byte8=E3=80=81short16?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commands/type/conversion/L2BCommand.java | 48 +++++++++++++++++++ .../commands/type/conversion/L2SCommand.java | 48 +++++++++++++++++++ 2 files changed, 96 insertions(+) create mode 100644 src/main/java/org/jcnc/snow/vm/commands/type/conversion/L2BCommand.java create mode 100644 src/main/java/org/jcnc/snow/vm/commands/type/conversion/L2SCommand.java diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/L2BCommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/L2BCommand.java new file mode 100644 index 0000000..cde429c --- /dev/null +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/L2BCommand.java @@ -0,0 +1,48 @@ +package org.jcnc.snow.vm.commands.type.conversion; + +import org.jcnc.snow.vm.interfaces.Command; +import org.jcnc.snow.vm.module.CallStack; +import org.jcnc.snow.vm.module.LocalVariableStore; +import org.jcnc.snow.vm.module.OperandStack; + +/** + * L2BCommand Opcode: Represents the type conversion operation from long64 to byte8 in the virtual machine. + *This opcode is implemented by the {@link L2BCommand} class, which defines its specific execution logic.
+ * + *Execution Steps:
+ *This opcode is used to widen a long64 value to a byte8 type for high-precision floating-point computations.
+ */ +public class L2BCommand implements Command { + + /** + * Default constructor for creating an instance of L2BCommand. + */ + public L2BCommand() { + // Empty constructor + } + + /** + * Executes the long64 to byte8 conversion operation. + * + * @param parts The array of instruction parameters, which is not used in this operation. + * @param currentPC The current program counter, representing the instruction address. + * @param operandStack The operand stack of the virtual machine. + * @param localVariableStore The local variable store for managing method-local variables. + * @param callStack The call stack of the virtual machine. + * @return The updated program counter after execution. + */ + @Override + public int execute(String[] parts, int currentPC, OperandStack operandStack, + LocalVariableStore localVariableStore, CallStack callStack) { + long value = (long) operandStack.pop(); + byte convertedValue = (byte) value; + operandStack.push(convertedValue); + return currentPC + 1; + } +} diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/L2SCommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/L2SCommand.java new file mode 100644 index 0000000..54652d6 --- /dev/null +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/L2SCommand.java @@ -0,0 +1,48 @@ +package org.jcnc.snow.vm.commands.type.conversion; + +import org.jcnc.snow.vm.interfaces.Command; +import org.jcnc.snow.vm.module.CallStack; +import org.jcnc.snow.vm.module.LocalVariableStore; +import org.jcnc.snow.vm.module.OperandStack; + +/** + * L2SCommand Opcode: Represents the type conversion operation from long64 to short16 in the virtual machine. + *This opcode is implemented by the {@link L2SCommand} class, which defines its specific execution logic.
+ * + *Execution Steps:
+ *This opcode is used to widen a long64 value to a short16 type for high-precision floating-point computations.
+ */ +public class L2SCommand implements Command { + + /** + * Default constructor for creating an instance of L2SCommand. + */ + public L2SCommand() { + // Empty constructor + } + + /** + * Executes the long64 to short16 conversion operation. + * + * @param parts The array of instruction parameters, which is not used in this operation. + * @param currentPC The current program counter, representing the instruction address. + * @param operandStack The operand stack of the virtual machine. + * @param localVariableStore The local variable store for managing method-local variables. + * @param callStack The call stack of the virtual machine. + * @return The updated program counter after execution. + */ + @Override + public int execute(String[] parts, int currentPC, OperandStack operandStack, + LocalVariableStore localVariableStore, CallStack callStack) { + long value = (long) operandStack.pop(); + short convertedValue = (short) value; + operandStack.push(convertedValue); + return currentPC + 1; + } +} From 3466c27c9e7ac081ff22b6b9bbe34876549305c0 Mon Sep 17 00:00:00 2001 From: zhangxun <1958638841@qq.com> Date: Sat, 28 Jun 2025 21:07:07 +0800 Subject: [PATCH 06/37] =?UTF-8?q?docs:=20=E4=BF=AE=E6=94=B9=E6=8B=BC?= =?UTF-8?q?=E5=86=99=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/jcnc/snow/vm/commands/type/conversion/D2SCommand.java | 4 ++-- .../org/jcnc/snow/vm/commands/type/conversion/S2DCommand.java | 4 ++-- .../org/jcnc/snow/vm/commands/type/conversion/S2FCommand.java | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/D2SCommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/D2SCommand.java index ab11cf0..41a8cec 100644 --- a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/D2SCommand.java +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/D2SCommand.java @@ -12,11 +12,11 @@ import org.jcnc.snow.vm.module.OperandStack; *Execution Steps:
*This opcode is used to narrow a double64 value to an short16 type for further integer-based operations.
+ *This opcode is used to narrow a double64 value to a short16 type for further integer-based operations.
*/ public class D2SCommand implements Command { diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2DCommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2DCommand.java index 2f3381f..7703f26 100644 --- a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2DCommand.java +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2DCommand.java @@ -12,11 +12,11 @@ import org.jcnc.snow.vm.module.OperandStack; *Execution Steps:
*This opcode is used to widen a short16 value to an double64 type, facilitating subsequent integer arithmetic or comparison operations.
+ *This opcode is used to widen a short16 value to a double64 type, facilitating subsequent integer arithmetic or comparison operations.
*/ public class S2DCommand implements Command { diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2FCommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2FCommand.java index 78fbb4a..478e397 100644 --- a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2FCommand.java +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2FCommand.java @@ -12,11 +12,11 @@ import org.jcnc.snow.vm.module.OperandStack; *Execution Steps:
*This opcode is used to widen a short16 value to an float32 type, facilitating subsequent integer arithmetic or comparison operations.
+ *This opcode is used to widen a short16 value to a float32 type, facilitating subsequent integer arithmetic or comparison operations.
*/ public class S2FCommand implements Command { From eee77ea45183276bebadcb8ebff22afdf77939b9 Mon Sep 17 00:00:00 2001 From: zhangxun <1958638841@qq.com> Date: Sat, 28 Jun 2025 21:08:49 +0800 Subject: [PATCH 07/37] =?UTF-8?q?style:=20=E7=BB=9F=E4=B8=80=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/jcnc/snow/vm/commands/type/conversion/S2BCommand.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2BCommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2BCommand.java index fa86e5f..d94eb8a 100644 --- a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2BCommand.java +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2BCommand.java @@ -40,7 +40,8 @@ public class S2BCommand implements Command { @Override public int execute(String[] parts, int currentPC, OperandStack operandStack, LocalVariableStore localVariableStore, CallStack callStack) { - byte convertedValue = (byte) ((short) operandStack.pop()); + short value = (short) operandStack.pop(); + byte convertedValue = (byte) value; operandStack.push(convertedValue); return currentPC + 1; } From fabde0026f79d5a8d88e11fbad1a119b2994e5f3 Mon Sep 17 00:00:00 2001 From: zhangxun <1958638841@qq.com> Date: Tue, 8 Jul 2025 20:19:45 +0800 Subject: [PATCH 08/37] =?UTF-8?q?feat:=20=E8=A1=A5=E5=85=85=E5=9F=BA?= =?UTF-8?q?=E6=9C=AC=E6=95=B0=E5=80=BC=E7=B1=BB=E5=9E=8B=E8=BD=AC=E6=8D=A2?= =?UTF-8?q?=E6=8C=87=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/jcnc/snow/vm/engine/VMOpCode.java | 200 ++++++++++-------- .../snow/vm/factories/CommandFactory.java | 29 ++- 2 files changed, 135 insertions(+), 94 deletions(-) diff --git a/src/main/java/org/jcnc/snow/vm/engine/VMOpCode.java b/src/main/java/org/jcnc/snow/vm/engine/VMOpCode.java index c53f511..8b634ca 100644 --- a/src/main/java/org/jcnc/snow/vm/engine/VMOpCode.java +++ b/src/main/java/org/jcnc/snow/vm/engine/VMOpCode.java @@ -2043,34 +2043,33 @@ public class VMOpCode { // endregion // region Type Conversion (0x00C0-0x00DF) - /** - * I2L Opcode: Represents the type conversion operation from int32 to long64 in the virtual machine. - *This opcode is implemented by the {@link I2LCommand} class, which defines its specific execution logic.
- * - *Execution Steps:
- *This opcode is commonly used to widen an int32 value to a long64 type to accommodate larger numeric ranges.
- */ - public static final int I2L = 0x00C0; - /** - * I2S Opcode: Represents the type conversion operation from int32 to short16 in the virtual machine. - *This opcode is implemented by the {@link I2SCommand} class, which defines its specific execution logic.
- * - *Execution Steps:
- *This opcode is typically used to narrow an int32 value to a short16 type when a smaller data representation is needed.
- */ - public static final int I2S = 0x00C1; + // region Byte8 (0x00C0-0xC4) + + public static final int B2S = 0x00C0; + + public static final int B2I = 0x00C1; + + public static final int B2L = 0x00C2; + + public static final int B2F = 0x00C3; + + public static final int B2D = 0x00C4; + // endregion Byte8 + + // region Short16 (0x00C5-0xC9) + + public static final int S2B = 0x00C5; + + public static final int S2I = 0x00C6; + + public static final int S2L = 0x00C7; + + public static final int S2F = 0x00C8; + + public static final int S2D = 0x00C9; + // endregion Short16 + + // region Int32 (0x00CA-0xCE) /** * I2B Opcode: Represents the type conversion operation from int32 to byte8 in the virtual machine. *This opcode is implemented by the {@link I2BCommand} class, which defines its specific execution logic.
@@ -2084,21 +2083,37 @@ public class VMOpCode { * *This opcode is used to narrow an int32 value to a byte8 type, suitable when a smaller numeric type is required.
*/ - public static final int I2B = 0x00C2; + public static final int I2B = 0x00CA; + /** - * I2D Opcode: Represents the type conversion operation from int32 to double64 in the virtual machine. - *This opcode is implemented by the {@link I2DCommand} class, which defines its specific execution logic.
+ * I2S Opcode: Represents the type conversion operation from int32 to short16 in the virtual machine. + *This opcode is implemented by the {@link I2SCommand} class, which defines its specific execution logic.
* *Execution Steps:
*This opcode is used to widen an int32 value to a double64 type, providing high-precision floating-point calculations.
+ *This opcode is typically used to narrow an int32 value to a short16 type when a smaller data representation is needed.
*/ - public static final int I2D = 0x00C3; + public static final int I2S = 0x00CB; + + /** + * I2L Opcode: Represents the type conversion operation from int32 to long64 in the virtual machine. + *This opcode is implemented by the {@link I2LCommand} class, which defines its specific execution logic.
+ * + *Execution Steps:
+ *This opcode is commonly used to widen an int32 value to a long64 type to accommodate larger numeric ranges.
+ */ + public static final int I2L = 0x00CC; /** * I2F Opcode: Represents the type conversion operation from int32 to float32 in the virtual machine. *This opcode is implemented by the {@link I2FCommand} class, which defines its specific execution logic.
@@ -2112,7 +2127,29 @@ public class VMOpCode { * *This opcode is used to convert an int32 value to a float32 type when floating-point arithmetic is required.
*/ - public static final int I2F = 0x00C4; + public static final int I2F = 0x00CD; + /** + * I2D Opcode: Represents the type conversion operation from int32 to double64 in the virtual machine. + *This opcode is implemented by the {@link I2DCommand} class, which defines its specific execution logic.
+ * + *Execution Steps:
+ *This opcode is used to widen an int32 value to a double64 type, providing high-precision floating-point calculations.
+ */ + public static final int I2D = 0x00CE; + // endregion Int32 + + // region Long64 (0x00CF-0xD3) + + public static final int L2B = 0x00CF; + + public static final int L2S = 0x00D0; + /** * L2I Opcode: Represents the type conversion operation from long64 to int32 in the virtual machine. *This opcode is implemented by the {@link L2ICommand} class, which defines its specific execution logic.
@@ -2126,21 +2163,7 @@ public class VMOpCode { * *This opcode is typically used to narrow a long64 value to an int32 type for further integer operations.
*/ - public static final int L2I = 0x00C5; - /** - * L2D Opcode: Represents the type conversion operation from long64 to double64 in the virtual machine. - *This opcode is implemented by the {@link L2DCommand} class, which defines its specific execution logic.
- * - *Execution Steps:
- *This opcode is used to widen a long64 value to a double64 type for high-precision floating-point computations.
- */ - public static final int L2D = 0x00C6; + public static final int L2I = 0x00D1; /** * L2F Opcode: Represents the type conversion operation from long64 to float32 in the virtual machine. *This opcode is implemented by the {@link L2FCommand} class, which defines its specific execution logic.
@@ -2154,7 +2177,29 @@ public class VMOpCode { * *This opcode is used to convert a long64 value to a float32 type, typically for floating-point arithmetic involving long values.
*/ - public static final int L2F = 0x00C7; + public static final int L2F = 0x00D2; + /** + * L2D Opcode: Represents the type conversion operation from long64 to double64 in the virtual machine. + *This opcode is implemented by the {@link L2DCommand} class, which defines its specific execution logic.
+ * + *Execution Steps:
+ *This opcode is used to widen a long64 value to a double64 type for high-precision floating-point computations.
+ */ + public static final int L2D = 0x00D3; + // endregion Long64 + + // region Float32 (0x00D4-0xD8) + + public static final int F2B = 0x00D4; + + public static final int F2S = 0x00D5; + /** * F2I Opcode: Represents the type conversion operation from float32 to int32 in the virtual machine. *This opcode is implemented by the {@link F2ICommand} class, which defines its specific execution logic.
@@ -2168,7 +2213,7 @@ public class VMOpCode { * *This opcode is used to convert a float32 value to an int32 type for further integer-based operations or comparisons.
*/ - public static final int F2I = 0x00C8; + public static final int F2I = 0x00D6; /** * F2L Opcode: Represents the type conversion operation from float32 to long64 in the virtual machine. *This opcode is implemented by the {@link F2LCommand} class, which defines its specific execution logic.
@@ -2182,7 +2227,7 @@ public class VMOpCode { * *This opcode is used to widen a float32 value to a long64 type, which is useful when operations require a larger numeric range.
*/ - public static final int F2L = 0x00C9; + public static final int F2L = 0x00D7; /** * F2D Opcode: Represents the type conversion operation from float32 to double64 in the virtual machine. *This opcode is implemented by the {@link F2DCommand} class, which defines its specific execution logic.
@@ -2196,7 +2241,15 @@ public class VMOpCode { * *This opcode is used to promote a float32 value to a double64 type, thereby increasing precision for floating-point computations.
*/ - public static final int F2D = 0x00CA; + public static final int F2D = 0x00D8; + // endregion Float32 + + // region Double64 (0x00D9-0xDD) + + public static final int D2B = 0x00D9; + + public static final int D2S = 0x00DA; + /** * D2I Opcode: Represents the type conversion operation from double64 to int32 in the virtual machine. *This opcode is implemented by the {@link D2ICommand} class, which defines its specific execution logic.
@@ -2210,7 +2263,7 @@ public class VMOpCode { * *This opcode is used to narrow a double64 value to an int32 type for further integer-based processing.
*/ - public static final int D2I = 0x00CB; + public static final int D2I = 0x00DB; /** * D2L Opcode: Represents the type conversion operation from double64 to long64 in the virtual machine. *This opcode is implemented by the {@link D2LCommand} class, which defines its specific execution logic.
@@ -2224,7 +2277,7 @@ public class VMOpCode { * *This opcode is used to narrow a double64 value to a long64 type, which can then be used for integer operations.
*/ - public static final int D2L = 0x00CC; + public static final int D2L = 0x00DC; /** * D2F Opcode: Represents the type conversion operation from double64 to float32 in the virtual machine. *This opcode is implemented by the {@link D2FCommand} class, which defines its specific execution logic.
@@ -2238,36 +2291,9 @@ public class VMOpCode { * *This opcode is used to narrow a double64 value to a float32 type when lower precision floating-point arithmetic is acceptable.
*/ - public static final int D2F = 0x00CD; - /** - * S2I Opcode: Represents the type conversion operation from short16 to int32 in the virtual machine. - *This opcode is implemented by the {@link S2ICommand} class, which defines its specific execution logic.
- * - *Execution Steps:
- *This opcode is used to widen a short16 value to an int32 type, facilitating subsequent integer arithmetic or comparison operations.
- */ - public static final int S2I = 0x00CE; - /** - * B2I Opcode: Represents the type conversion operation from byte8 to int32 in the virtual machine. - *This opcode is implemented by the {@link B2ICommand} class, which defines its specific execution logic.
- * - *Execution Steps:
- *This opcode is used to widen a byte8 value to an int32 type to ensure compatibility with integer-based operations.
- */ - public static final int B2I = 0x00CF; - // endregion + public static final int D2F = 0x00DD; + // endregion Double64 + // endregion Conversion // region Stack Control (0x0100-0x01FF) /** diff --git a/src/main/java/org/jcnc/snow/vm/factories/CommandFactory.java b/src/main/java/org/jcnc/snow/vm/factories/CommandFactory.java index a5af00b..4054a11 100644 --- a/src/main/java/org/jcnc/snow/vm/factories/CommandFactory.java +++ b/src/main/java/org/jcnc/snow/vm/factories/CommandFactory.java @@ -207,26 +207,41 @@ public class CommandFactory { // endregion // region Type Conversion (0x00C0-0x00DF) - COMMANDS[VMOpCode.I2L] = new I2LCommand(); - COMMANDS[VMOpCode.I2S] = new I2SCommand(); + COMMANDS[VMOpCode.B2S] = new B2SCommand(); + COMMANDS[VMOpCode.B2I] = new B2ICommand(); + COMMANDS[VMOpCode.B2L] = new B2LCommand(); + COMMANDS[VMOpCode.B2F] = new B2FCommand(); + COMMANDS[VMOpCode.B2D] = new B2DCommand(); + + COMMANDS[VMOpCode.S2B] = new S2BCommand(); + COMMANDS[VMOpCode.S2I] = new S2ICommand(); + COMMANDS[VMOpCode.S2L] = new S2LCommand(); + COMMANDS[VMOpCode.S2F] = new S2FCommand(); + COMMANDS[VMOpCode.S2D] = new S2DCommand(); + COMMANDS[VMOpCode.I2B] = new I2BCommand(); - COMMANDS[VMOpCode.I2D] = new I2DCommand(); + COMMANDS[VMOpCode.I2S] = new I2SCommand(); + COMMANDS[VMOpCode.I2L] = new I2LCommand(); COMMANDS[VMOpCode.I2F] = new I2FCommand(); + COMMANDS[VMOpCode.I2D] = new I2DCommand(); + COMMANDS[VMOpCode.L2B] = new L2BCommand(); + COMMANDS[VMOpCode.L2S] = new L2SCommand(); COMMANDS[VMOpCode.L2I] = new L2ICommand(); - COMMANDS[VMOpCode.L2D] = new L2DCommand(); COMMANDS[VMOpCode.L2F] = new L2FCommand(); + COMMANDS[VMOpCode.L2D] = new L2DCommand(); + COMMANDS[VMOpCode.F2B] = new F2BCommand(); + COMMANDS[VMOpCode.F2S] = new F2SCommand(); COMMANDS[VMOpCode.F2I] = new F2ICommand(); COMMANDS[VMOpCode.F2L] = new F2LCommand(); COMMANDS[VMOpCode.F2D] = new F2DCommand(); + COMMANDS[VMOpCode.D2B] = new D2BCommand(); + COMMANDS[VMOpCode.D2S] = new D2SCommand(); COMMANDS[VMOpCode.D2I] = new D2ICommand(); COMMANDS[VMOpCode.D2L] = new D2LCommand(); COMMANDS[VMOpCode.D2F] = new D2FCommand(); - - COMMANDS[VMOpCode.S2I] = new S2ICommand(); - COMMANDS[VMOpCode.B2I] = new B2ICommand(); // endregion // region Stack Control (0x0100-0x01FF) From 2289cf3ee4b0c6a9fbcd88dbd733ff7092a5577d Mon Sep 17 00:00:00 2001 From: zhangxun <1958638841@qq.com> Date: Sat, 28 Jun 2025 20:28:12 +0800 Subject: [PATCH 09/37] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81=20byte8=20?= =?UTF-8?q?=E8=BD=AC=20short16=E3=80=81long64=E3=80=81float32=E3=80=81doub?= =?UTF-8?q?le64?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commands/type/conversion/B2DCommand.java | 47 +++++++++++++++++++ .../commands/type/conversion/B2FCommand.java | 47 +++++++++++++++++++ .../commands/type/conversion/B2LCommand.java | 47 +++++++++++++++++++ .../commands/type/conversion/B2SCommand.java | 47 +++++++++++++++++++ 4 files changed, 188 insertions(+) create mode 100644 src/main/java/org/jcnc/snow/vm/commands/type/conversion/B2DCommand.java create mode 100644 src/main/java/org/jcnc/snow/vm/commands/type/conversion/B2FCommand.java create mode 100644 src/main/java/org/jcnc/snow/vm/commands/type/conversion/B2LCommand.java create mode 100644 src/main/java/org/jcnc/snow/vm/commands/type/conversion/B2SCommand.java diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/B2DCommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/B2DCommand.java new file mode 100644 index 0000000..1ca0655 --- /dev/null +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/B2DCommand.java @@ -0,0 +1,47 @@ +package org.jcnc.snow.vm.commands.type.conversion; + +import org.jcnc.snow.vm.interfaces.Command; +import org.jcnc.snow.vm.module.CallStack; +import org.jcnc.snow.vm.module.LocalVariableStore; +import org.jcnc.snow.vm.module.OperandStack; + +/** + * B2DCommand Opcode: Represents the type conversion operation from byte8 to double64 in the virtual machine. + *This opcode is implemented by the {@link B2DCommand} class, which defines its specific execution logic.
+ * + *Execution Steps:
+ *This opcode is used to widen a byte8 value to a double64 type to ensure compatibility with integer-based operations.
+ */ +public class B2DCommand implements Command { + + /** + * Default constructor for creating an instance of B2DCommand. + */ + public B2DCommand() { + // Empty constructor + } + + /** + * Executes the byte8 to double64 conversion operation. + * + * @param parts The array of instruction parameters, which is not used in this operation. + * @param currentPC The current program counter, representing the instruction address. + * @param operandStack The operand stack of the virtual machine. + * @param localVariableStore The local variable store for managing method-local variables. + * @param callStack The call stack of the virtual machine. + * @return The updated program counter after execution. + */ + @Override + public int execute(String[] parts, int currentPC, OperandStack operandStack, + LocalVariableStore localVariableStore, CallStack callStack) { + double convertedValue = (byte) operandStack.pop(); + operandStack.push(convertedValue); + return currentPC + 1; + } +} diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/B2FCommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/B2FCommand.java new file mode 100644 index 0000000..c61891b --- /dev/null +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/B2FCommand.java @@ -0,0 +1,47 @@ +package org.jcnc.snow.vm.commands.type.conversion; + +import org.jcnc.snow.vm.interfaces.Command; +import org.jcnc.snow.vm.module.CallStack; +import org.jcnc.snow.vm.module.LocalVariableStore; +import org.jcnc.snow.vm.module.OperandStack; + +/** + * B2FCommand Opcode: Represents the type conversion operation from byte8 to float32 in the virtual machine. + *This opcode is implemented by the {@link B2FCommand} class, which defines its specific execution logic.
+ * + *Execution Steps:
+ *This opcode is used to widen a byte8 value to a float32 type to ensure compatibility with integer-based operations.
+ */ +public class B2FCommand implements Command { + + /** + * Default constructor for creating an instance of B2FCommand. + */ + public B2FCommand() { + // Empty constructor + } + + /** + * Executes the byte8 to float32 conversion operation. + * + * @param parts The array of instruction parameters, which is not used in this operation. + * @param currentPC The current program counter, representing the instruction address. + * @param operandStack The operand stack of the virtual machine. + * @param localVariableStore The local variable store for managing method-local variables. + * @param callStack The call stack of the virtual machine. + * @return The updated program counter after execution. + */ + @Override + public int execute(String[] parts, int currentPC, OperandStack operandStack, + LocalVariableStore localVariableStore, CallStack callStack) { + float convertedValue = (byte) operandStack.pop(); + operandStack.push(convertedValue); + return currentPC + 1; + } +} diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/B2LCommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/B2LCommand.java new file mode 100644 index 0000000..344b49d --- /dev/null +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/B2LCommand.java @@ -0,0 +1,47 @@ +package org.jcnc.snow.vm.commands.type.conversion; + +import org.jcnc.snow.vm.interfaces.Command; +import org.jcnc.snow.vm.module.CallStack; +import org.jcnc.snow.vm.module.LocalVariableStore; +import org.jcnc.snow.vm.module.OperandStack; + +/** + * B2LCommand Opcode: Represents the type conversion operation from byte8 to long64 in the virtual machine. + *This opcode is implemented by the {@link B2LCommand} class, which defines its specific execution logic.
+ * + *Execution Steps:
+ *This opcode is used to widen a byte8 value to a long64 type to ensure compatibility with integer-based operations.
+ */ +public class B2LCommand implements Command { + + /** + * Default constructor for creating an instance of B2LCommand. + */ + public B2LCommand() { + // Empty constructor + } + + /** + * Executes the byte8 to long64 conversion operation. + * + * @param parts The array of instruction parameters, which is not used in this operation. + * @param currentPC The current program counter, representing the instruction address. + * @param operandStack The operand stack of the virtual machine. + * @param localVariableStore The local variable store for managing method-local variables. + * @param callStack The call stack of the virtual machine. + * @return The updated program counter after execution. + */ + @Override + public int execute(String[] parts, int currentPC, OperandStack operandStack, + LocalVariableStore localVariableStore, CallStack callStack) { + long convertedValue = (byte) operandStack.pop(); + operandStack.push(convertedValue); + return currentPC + 1; + } +} diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/B2SCommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/B2SCommand.java new file mode 100644 index 0000000..1f09ff9 --- /dev/null +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/B2SCommand.java @@ -0,0 +1,47 @@ +package org.jcnc.snow.vm.commands.type.conversion; + +import org.jcnc.snow.vm.interfaces.Command; +import org.jcnc.snow.vm.module.CallStack; +import org.jcnc.snow.vm.module.LocalVariableStore; +import org.jcnc.snow.vm.module.OperandStack; + +/** + * B2SCommand Opcode: Represents the type conversion operation from byte8 to short16 in the virtual machine. + *This opcode is implemented by the {@link B2SCommand} class, which defines its specific execution logic.
+ * + *Execution Steps:
+ *This opcode is used to widen a byte8 value to a short16 type to ensure compatibility with integer-based operations.
+ */ +public class B2SCommand implements Command { + + /** + * Default constructor for creating an instance of B2SCommand. + */ + public B2SCommand() { + // Empty constructor + } + + /** + * Executes the byte8 to short16 conversion operation. + * + * @param parts The array of instruction parameters, which is not used in this operation. + * @param currentPC The current program counter, representing the instruction address. + * @param operandStack The operand stack of the virtual machine. + * @param localVariableStore The local variable store for managing method-local variables. + * @param callStack The call stack of the virtual machine. + * @return The updated program counter after execution. + */ + @Override + public int execute(String[] parts, int currentPC, OperandStack operandStack, + LocalVariableStore localVariableStore, CallStack callStack) { + short convertedValue = (byte) operandStack.pop(); + operandStack.push(convertedValue); + return currentPC + 1; + } +} From 9e2eb6731f1029bbe1e14f4aa26b31038395aca0 Mon Sep 17 00:00:00 2001 From: zhangxun <1958638841@qq.com> Date: Sat, 28 Jun 2025 20:31:16 +0800 Subject: [PATCH 10/37] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81=20short16=20?= =?UTF-8?q?=E8=BD=AC=20byte8=E3=80=81long64=E3=80=81float32=E3=80=81double?= =?UTF-8?q?64?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commands/type/conversion/S2BCommand.java | 47 +++++++++++++++++++ .../commands/type/conversion/S2DCommand.java | 47 +++++++++++++++++++ .../commands/type/conversion/S2FCommand.java | 47 +++++++++++++++++++ .../commands/type/conversion/S2LCommand.java | 47 +++++++++++++++++++ 4 files changed, 188 insertions(+) create mode 100644 src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2BCommand.java create mode 100644 src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2DCommand.java create mode 100644 src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2FCommand.java create mode 100644 src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2LCommand.java diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2BCommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2BCommand.java new file mode 100644 index 0000000..fa86e5f --- /dev/null +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2BCommand.java @@ -0,0 +1,47 @@ +package org.jcnc.snow.vm.commands.type.conversion; + +import org.jcnc.snow.vm.interfaces.Command; +import org.jcnc.snow.vm.module.CallStack; +import org.jcnc.snow.vm.module.LocalVariableStore; +import org.jcnc.snow.vm.module.OperandStack; + +/** + * S2BCommand Opcode: Represents the type conversion operation from short16 to byte8 in the virtual machine. + *This opcode is implemented by the {@link S2BCommand} class, which defines its specific execution logic.
+ * + *Execution Steps:
+ *This opcode is used to widen a short16 value to a byte8 type, facilitating subsequent integer arithmetic or comparison operations.
+ */ +public class S2BCommand implements Command { + + /** + * Default constructor for creating an instance of S2BCommand. + */ + public S2BCommand() { + // Empty constructor + } + + /** + * Executes the short16 to byte8 conversion operation. + * + * @param parts The array of instruction parameters, which is not used in this operation. + * @param currentPC The current program counter, representing the instruction address. + * @param operandStack The operand stack of the virtual machine. + * @param localVariableStore The local variable store for managing method-local variables. + * @param callStack The call stack of the virtual machine. + * @return The updated program counter after execution. + */ + @Override + public int execute(String[] parts, int currentPC, OperandStack operandStack, + LocalVariableStore localVariableStore, CallStack callStack) { + byte convertedValue = (byte) ((short) operandStack.pop()); + operandStack.push(convertedValue); + return currentPC + 1; + } +} diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2DCommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2DCommand.java new file mode 100644 index 0000000..2f3381f --- /dev/null +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2DCommand.java @@ -0,0 +1,47 @@ +package org.jcnc.snow.vm.commands.type.conversion; + +import org.jcnc.snow.vm.interfaces.Command; +import org.jcnc.snow.vm.module.CallStack; +import org.jcnc.snow.vm.module.LocalVariableStore; +import org.jcnc.snow.vm.module.OperandStack; + +/** + * S2DCommand Opcode: Represents the type conversion operation from short16 to double64 in the virtual machine. + *This opcode is implemented by the {@link S2DCommand} class, which defines its specific execution logic.
+ * + *Execution Steps:
+ *This opcode is used to widen a short16 value to an double64 type, facilitating subsequent integer arithmetic or comparison operations.
+ */ +public class S2DCommand implements Command { + + /** + * Default constructor for creating an instance of S2DCommand. + */ + public S2DCommand() { + // Empty constructor + } + + /** + * Executes the short16 to double64 conversion operation. + * + * @param parts The array of instruction parameters, which is not used in this operation. + * @param currentPC The current program counter, representing the instruction address. + * @param operandStack The operand stack of the virtual machine. + * @param localVariableStore The local variable store for managing method-local variables. + * @param callStack The call stack of the virtual machine. + * @return The updated program counter after execution. + */ + @Override + public int execute(String[] parts, int currentPC, OperandStack operandStack, + LocalVariableStore localVariableStore, CallStack callStack) { + double convertedValue = (short) operandStack.pop(); + operandStack.push(convertedValue); + return currentPC + 1; + } +} diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2FCommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2FCommand.java new file mode 100644 index 0000000..78fbb4a --- /dev/null +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2FCommand.java @@ -0,0 +1,47 @@ +package org.jcnc.snow.vm.commands.type.conversion; + +import org.jcnc.snow.vm.interfaces.Command; +import org.jcnc.snow.vm.module.CallStack; +import org.jcnc.snow.vm.module.LocalVariableStore; +import org.jcnc.snow.vm.module.OperandStack; + +/** + * S2FCommand Opcode: Represents the type conversion operation from short16 to float32 in the virtual machine. + *This opcode is implemented by the {@link S2FCommand} class, which defines its specific execution logic.
+ * + *Execution Steps:
+ *This opcode is used to widen a short16 value to an float32 type, facilitating subsequent integer arithmetic or comparison operations.
+ */ +public class S2FCommand implements Command { + + /** + * Default constructor for creating an instance of S2FCommand. + */ + public S2FCommand() { + // Empty constructor + } + + /** + * Executes the short16 to float32 conversion operation. + * + * @param parts The array of instruction parameters, which is not used in this operation. + * @param currentPC The current program counter, representing the instruction address. + * @param operandStack The operand stack of the virtual machine. + * @param localVariableStore The local variable store for managing method-local variables. + * @param callStack The call stack of the virtual machine. + * @return The updated program counter after execution. + */ + @Override + public int execute(String[] parts, int currentPC, OperandStack operandStack, + LocalVariableStore localVariableStore, CallStack callStack) { + float convertedValue = (short) operandStack.pop(); + operandStack.push(convertedValue); + return currentPC + 1; + } +} diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2LCommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2LCommand.java new file mode 100644 index 0000000..cec58e6 --- /dev/null +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2LCommand.java @@ -0,0 +1,47 @@ +package org.jcnc.snow.vm.commands.type.conversion; + +import org.jcnc.snow.vm.interfaces.Command; +import org.jcnc.snow.vm.module.CallStack; +import org.jcnc.snow.vm.module.LocalVariableStore; +import org.jcnc.snow.vm.module.OperandStack; + +/** + * S2LCommand Opcode: Represents the type conversion operation from short16 to long64 in the virtual machine. + *This opcode is implemented by the {@link S2LCommand} class, which defines its specific execution logic.
+ * + *Execution Steps:
+ *This opcode is used to widen a short16 value to a long64 type, facilitating subsequent integer arithmetic or comparison operations.
+ */ +public class S2LCommand implements Command { + + /** + * Default constructor for creating an instance of S2LCommand. + */ + public S2LCommand() { + // Empty constructor + } + + /** + * Executes the short16 to long64 conversion operation. + * + * @param parts The array of instruction parameters, which is not used in this operation. + * @param currentPC The current program counter, representing the instruction address. + * @param operandStack The operand stack of the virtual machine. + * @param localVariableStore The local variable store for managing method-local variables. + * @param callStack The call stack of the virtual machine. + * @return The updated program counter after execution. + */ + @Override + public int execute(String[] parts, int currentPC, OperandStack operandStack, + LocalVariableStore localVariableStore, CallStack callStack) { + long convertedValue = (short) operandStack.pop(); + operandStack.push(convertedValue); + return currentPC + 1; + } +} From 4595583ca4bba4e318124536891702cfe81347ed Mon Sep 17 00:00:00 2001 From: zhangxun <1958638841@qq.com> Date: Sat, 28 Jun 2025 21:00:09 +0800 Subject: [PATCH 11/37] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81=20double64=20?= =?UTF-8?q?=E8=BD=AC=20byte8=E3=80=81short16?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commands/type/conversion/D2BCommand.java | 48 +++++++++++++++++++ .../commands/type/conversion/D2SCommand.java | 48 +++++++++++++++++++ 2 files changed, 96 insertions(+) create mode 100644 src/main/java/org/jcnc/snow/vm/commands/type/conversion/D2BCommand.java create mode 100644 src/main/java/org/jcnc/snow/vm/commands/type/conversion/D2SCommand.java diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/D2BCommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/D2BCommand.java new file mode 100644 index 0000000..7180d2e --- /dev/null +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/D2BCommand.java @@ -0,0 +1,48 @@ +package org.jcnc.snow.vm.commands.type.conversion; + +import org.jcnc.snow.vm.interfaces.Command; +import org.jcnc.snow.vm.module.CallStack; +import org.jcnc.snow.vm.module.LocalVariableStore; +import org.jcnc.snow.vm.module.OperandStack; + +/** + * D2BCommand Opcode: Represents the type conversion operation from double64 to byte8 in the virtual machine. + *This opcode is implemented by the {@link D2BCommand} class, which defines its specific execution logic.
+ * + *Execution Steps:
+ *This opcode is used to narrow a double64 value to a byte8 type for further integer-based operations.
+ */ +public class D2BCommand implements Command { + + /** + * Default constructor for creating an instance of D2BCommand. + */ + public D2BCommand() { + // Empty constructor + } + + /** + * Executes the double64 to byte8 conversion operation. + * + * @param parts The array of instruction parameters, which is not used in this operation. + * @param currentPC The current program counter, representing the instruction address. + * @param operandStack The operand stack of the virtual machine. + * @param localVariableStore The local variable store for managing method-local variables. + * @param callStack The call stack of the virtual machine. + * @return The updated program counter after execution. + */ + @Override + public int execute(String[] parts, int currentPC, OperandStack operandStack, + LocalVariableStore localVariableStore, CallStack callStack) { + double value = (double) operandStack.pop(); + byte convertedValue = (byte) value; + operandStack.push(convertedValue); + return currentPC + 1; + } +} diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/D2SCommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/D2SCommand.java new file mode 100644 index 0000000..ab11cf0 --- /dev/null +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/D2SCommand.java @@ -0,0 +1,48 @@ +package org.jcnc.snow.vm.commands.type.conversion; + +import org.jcnc.snow.vm.interfaces.Command; +import org.jcnc.snow.vm.module.CallStack; +import org.jcnc.snow.vm.module.LocalVariableStore; +import org.jcnc.snow.vm.module.OperandStack; + +/** + * D2SCommand Opcode: Represents the type conversion operation from double64 to short16 in the virtual machine. + *This opcode is implemented by the {@link D2SCommand} class, which defines its specific execution logic.
+ * + *Execution Steps:
+ *This opcode is used to narrow a double64 value to an short16 type for further integer-based operations.
+ */ +public class D2SCommand implements Command { + + /** + * Default constructor for creating an instance of D2SCommand. + */ + public D2SCommand() { + // Empty constructor + } + + /** + * Executes the double64 to short16 conversion operation. + * + * @param parts The array of instruction parameters, which is not used in this operation. + * @param currentPC The current program counter, representing the instruction address. + * @param operandStack The operand stack of the virtual machine. + * @param localVariableStore The local variable store for managing method-local variables. + * @param callStack The call stack of the virtual machine. + * @return The updated program counter after execution. + */ + @Override + public int execute(String[] parts, int currentPC, OperandStack operandStack, + LocalVariableStore localVariableStore, CallStack callStack) { + double value = (double) operandStack.pop(); + short convertedValue = (short) value; + operandStack.push(convertedValue); + return currentPC + 1; + } +} From 85fae69c971dabe06a3cebdd7276496d9b115252 Mon Sep 17 00:00:00 2001 From: zhangxun <1958638841@qq.com> Date: Sat, 28 Jun 2025 21:02:30 +0800 Subject: [PATCH 12/37] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81=20float32=20?= =?UTF-8?q?=E8=BD=AC=20byte8=E3=80=81short16?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commands/type/conversion/F2BCommand.java | 48 +++++++++++++++++++ .../commands/type/conversion/F2SCommand.java | 48 +++++++++++++++++++ 2 files changed, 96 insertions(+) create mode 100644 src/main/java/org/jcnc/snow/vm/commands/type/conversion/F2BCommand.java create mode 100644 src/main/java/org/jcnc/snow/vm/commands/type/conversion/F2SCommand.java diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/F2BCommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/F2BCommand.java new file mode 100644 index 0000000..5240f86 --- /dev/null +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/F2BCommand.java @@ -0,0 +1,48 @@ +package org.jcnc.snow.vm.commands.type.conversion; + +import org.jcnc.snow.vm.interfaces.Command; +import org.jcnc.snow.vm.module.CallStack; +import org.jcnc.snow.vm.module.LocalVariableStore; +import org.jcnc.snow.vm.module.OperandStack; + +/** + * F2BCommand Opcode: Represents the type conversion operation from float32 to byte8 in the virtual machine. + *This opcode is implemented by the {@link F2BCommand} class, which defines its specific execution logic.
+ * + *Execution Steps:
+ *This opcode is used to convert a float32 value to a byte8 type for further integer operations or comparisons.
+ */ +public class F2BCommand implements Command { + + /** + * Default constructor for creating an instance of F2BCommand. + */ + public F2BCommand() { + // Empty constructor + } + + /** + * Executes the float32 to byte8 conversion operation. + * + * @param parts The array of instruction parameters, which is not used in this operation. + * @param currentPC The current program counter, representing the instruction address. + * @param operandStack The operand stack of the virtual machine. + * @param localVariableStore The local variable store for managing method-local variables. + * @param callStack The call stack of the virtual machine. + * @return The updated program counter after execution. + */ + @Override + public int execute(String[] parts, int currentPC, OperandStack operandStack, + LocalVariableStore localVariableStore, CallStack callStack) { + float value = (float) operandStack.pop(); + byte convertedValue = (byte) value; + operandStack.push(convertedValue); + return currentPC + 1; + } +} diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/F2SCommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/F2SCommand.java new file mode 100644 index 0000000..83a79b5 --- /dev/null +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/F2SCommand.java @@ -0,0 +1,48 @@ +package org.jcnc.snow.vm.commands.type.conversion; + +import org.jcnc.snow.vm.interfaces.Command; +import org.jcnc.snow.vm.module.CallStack; +import org.jcnc.snow.vm.module.LocalVariableStore; +import org.jcnc.snow.vm.module.OperandStack; + +/** + * F2SCommand Opcode: Represents the type conversion operation from float32 to short16 in the virtual machine. + *This opcode is implemented by the {@link F2SCommand} class, which defines its specific execution logic.
+ * + *Execution Steps:
+ *This opcode is used to convert a float32 value to a short16 type for further integer operations or comparisons.
+ */ +public class F2SCommand implements Command { + + /** + * Default constructor for creating an instance of F2SCommand. + */ + public F2SCommand() { + // Empty constructor + } + + /** + * Executes the float32 to short16 conversion operation. + * + * @param parts The array of instruction parameters, which is not used in this operation. + * @param currentPC The current program counter, representing the instruction address. + * @param operandStack The operand stack of the virtual machine. + * @param localVariableStore The local variable store for managing method-local variables. + * @param callStack The call stack of the virtual machine. + * @return The updated program counter after execution. + */ + @Override + public int execute(String[] parts, int currentPC, OperandStack operandStack, + LocalVariableStore localVariableStore, CallStack callStack) { + float value = (float) operandStack.pop(); + short convertedValue = (short) value; + operandStack.push(convertedValue); + return currentPC + 1; + } +} From 9c69c1f37ba6cd5f718ec1a639e0d6781bc1f0a0 Mon Sep 17 00:00:00 2001 From: zhangxun <1958638841@qq.com> Date: Sat, 28 Jun 2025 21:04:23 +0800 Subject: [PATCH 13/37] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81=20long64=20?= =?UTF-8?q?=E8=BD=AC=20byte8=E3=80=81short16?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commands/type/conversion/L2BCommand.java | 48 +++++++++++++++++++ .../commands/type/conversion/L2SCommand.java | 48 +++++++++++++++++++ 2 files changed, 96 insertions(+) create mode 100644 src/main/java/org/jcnc/snow/vm/commands/type/conversion/L2BCommand.java create mode 100644 src/main/java/org/jcnc/snow/vm/commands/type/conversion/L2SCommand.java diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/L2BCommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/L2BCommand.java new file mode 100644 index 0000000..cde429c --- /dev/null +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/L2BCommand.java @@ -0,0 +1,48 @@ +package org.jcnc.snow.vm.commands.type.conversion; + +import org.jcnc.snow.vm.interfaces.Command; +import org.jcnc.snow.vm.module.CallStack; +import org.jcnc.snow.vm.module.LocalVariableStore; +import org.jcnc.snow.vm.module.OperandStack; + +/** + * L2BCommand Opcode: Represents the type conversion operation from long64 to byte8 in the virtual machine. + *This opcode is implemented by the {@link L2BCommand} class, which defines its specific execution logic.
+ * + *Execution Steps:
+ *This opcode is used to widen a long64 value to a byte8 type for high-precision floating-point computations.
+ */ +public class L2BCommand implements Command { + + /** + * Default constructor for creating an instance of L2BCommand. + */ + public L2BCommand() { + // Empty constructor + } + + /** + * Executes the long64 to byte8 conversion operation. + * + * @param parts The array of instruction parameters, which is not used in this operation. + * @param currentPC The current program counter, representing the instruction address. + * @param operandStack The operand stack of the virtual machine. + * @param localVariableStore The local variable store for managing method-local variables. + * @param callStack The call stack of the virtual machine. + * @return The updated program counter after execution. + */ + @Override + public int execute(String[] parts, int currentPC, OperandStack operandStack, + LocalVariableStore localVariableStore, CallStack callStack) { + long value = (long) operandStack.pop(); + byte convertedValue = (byte) value; + operandStack.push(convertedValue); + return currentPC + 1; + } +} diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/L2SCommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/L2SCommand.java new file mode 100644 index 0000000..54652d6 --- /dev/null +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/L2SCommand.java @@ -0,0 +1,48 @@ +package org.jcnc.snow.vm.commands.type.conversion; + +import org.jcnc.snow.vm.interfaces.Command; +import org.jcnc.snow.vm.module.CallStack; +import org.jcnc.snow.vm.module.LocalVariableStore; +import org.jcnc.snow.vm.module.OperandStack; + +/** + * L2SCommand Opcode: Represents the type conversion operation from long64 to short16 in the virtual machine. + *This opcode is implemented by the {@link L2SCommand} class, which defines its specific execution logic.
+ * + *Execution Steps:
+ *This opcode is used to widen a long64 value to a short16 type for high-precision floating-point computations.
+ */ +public class L2SCommand implements Command { + + /** + * Default constructor for creating an instance of L2SCommand. + */ + public L2SCommand() { + // Empty constructor + } + + /** + * Executes the long64 to short16 conversion operation. + * + * @param parts The array of instruction parameters, which is not used in this operation. + * @param currentPC The current program counter, representing the instruction address. + * @param operandStack The operand stack of the virtual machine. + * @param localVariableStore The local variable store for managing method-local variables. + * @param callStack The call stack of the virtual machine. + * @return The updated program counter after execution. + */ + @Override + public int execute(String[] parts, int currentPC, OperandStack operandStack, + LocalVariableStore localVariableStore, CallStack callStack) { + long value = (long) operandStack.pop(); + short convertedValue = (short) value; + operandStack.push(convertedValue); + return currentPC + 1; + } +} From 872865268b2db68422c0bfc3d8ccb91ae4ca4d65 Mon Sep 17 00:00:00 2001 From: zhangxun <1958638841@qq.com> Date: Sat, 28 Jun 2025 21:07:07 +0800 Subject: [PATCH 14/37] =?UTF-8?q?docs:=20=E4=BF=AE=E6=94=B9=E6=8B=BC?= =?UTF-8?q?=E5=86=99=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/jcnc/snow/vm/commands/type/conversion/D2SCommand.java | 4 ++-- .../org/jcnc/snow/vm/commands/type/conversion/S2DCommand.java | 4 ++-- .../org/jcnc/snow/vm/commands/type/conversion/S2FCommand.java | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/D2SCommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/D2SCommand.java index ab11cf0..41a8cec 100644 --- a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/D2SCommand.java +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/D2SCommand.java @@ -12,11 +12,11 @@ import org.jcnc.snow.vm.module.OperandStack; *Execution Steps:
*This opcode is used to narrow a double64 value to an short16 type for further integer-based operations.
+ *This opcode is used to narrow a double64 value to a short16 type for further integer-based operations.
*/ public class D2SCommand implements Command { diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2DCommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2DCommand.java index 2f3381f..7703f26 100644 --- a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2DCommand.java +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2DCommand.java @@ -12,11 +12,11 @@ import org.jcnc.snow.vm.module.OperandStack; *Execution Steps:
*This opcode is used to widen a short16 value to an double64 type, facilitating subsequent integer arithmetic or comparison operations.
+ *This opcode is used to widen a short16 value to a double64 type, facilitating subsequent integer arithmetic or comparison operations.
*/ public class S2DCommand implements Command { diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2FCommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2FCommand.java index 78fbb4a..478e397 100644 --- a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2FCommand.java +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2FCommand.java @@ -12,11 +12,11 @@ import org.jcnc.snow.vm.module.OperandStack; *Execution Steps:
*This opcode is used to widen a short16 value to an float32 type, facilitating subsequent integer arithmetic or comparison operations.
+ *This opcode is used to widen a short16 value to a float32 type, facilitating subsequent integer arithmetic or comparison operations.
*/ public class S2FCommand implements Command { From f382b2bc5455f680867e49235793e1bb8fce755c Mon Sep 17 00:00:00 2001 From: zhangxun <1958638841@qq.com> Date: Sat, 28 Jun 2025 21:08:49 +0800 Subject: [PATCH 15/37] =?UTF-8?q?style:=20=E7=BB=9F=E4=B8=80=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/jcnc/snow/vm/commands/type/conversion/S2BCommand.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2BCommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2BCommand.java index fa86e5f..d94eb8a 100644 --- a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2BCommand.java +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2BCommand.java @@ -40,7 +40,8 @@ public class S2BCommand implements Command { @Override public int execute(String[] parts, int currentPC, OperandStack operandStack, LocalVariableStore localVariableStore, CallStack callStack) { - byte convertedValue = (byte) ((short) operandStack.pop()); + short value = (short) operandStack.pop(); + byte convertedValue = (byte) value; operandStack.push(convertedValue); return currentPC + 1; } From 4f63f88b400de03baf0e47f09e5fb608960068dc Mon Sep 17 00:00:00 2001 From: zhangxun <1958638841@qq.com> Date: Tue, 8 Jul 2025 20:19:45 +0800 Subject: [PATCH 16/37] =?UTF-8?q?feat:=20=E8=A1=A5=E5=85=85=E5=9F=BA?= =?UTF-8?q?=E6=9C=AC=E6=95=B0=E5=80=BC=E7=B1=BB=E5=9E=8B=E8=BD=AC=E6=8D=A2?= =?UTF-8?q?=E6=8C=87=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/jcnc/snow/vm/engine/VMOpCode.java | 200 ++++++++++-------- .../snow/vm/factories/CommandFactory.java | 29 ++- 2 files changed, 135 insertions(+), 94 deletions(-) diff --git a/src/main/java/org/jcnc/snow/vm/engine/VMOpCode.java b/src/main/java/org/jcnc/snow/vm/engine/VMOpCode.java index c53f511..8b634ca 100644 --- a/src/main/java/org/jcnc/snow/vm/engine/VMOpCode.java +++ b/src/main/java/org/jcnc/snow/vm/engine/VMOpCode.java @@ -2043,34 +2043,33 @@ public class VMOpCode { // endregion // region Type Conversion (0x00C0-0x00DF) - /** - * I2L Opcode: Represents the type conversion operation from int32 to long64 in the virtual machine. - *This opcode is implemented by the {@link I2LCommand} class, which defines its specific execution logic.
- * - *Execution Steps:
- *This opcode is commonly used to widen an int32 value to a long64 type to accommodate larger numeric ranges.
- */ - public static final int I2L = 0x00C0; - /** - * I2S Opcode: Represents the type conversion operation from int32 to short16 in the virtual machine. - *This opcode is implemented by the {@link I2SCommand} class, which defines its specific execution logic.
- * - *Execution Steps:
- *This opcode is typically used to narrow an int32 value to a short16 type when a smaller data representation is needed.
- */ - public static final int I2S = 0x00C1; + // region Byte8 (0x00C0-0xC4) + + public static final int B2S = 0x00C0; + + public static final int B2I = 0x00C1; + + public static final int B2L = 0x00C2; + + public static final int B2F = 0x00C3; + + public static final int B2D = 0x00C4; + // endregion Byte8 + + // region Short16 (0x00C5-0xC9) + + public static final int S2B = 0x00C5; + + public static final int S2I = 0x00C6; + + public static final int S2L = 0x00C7; + + public static final int S2F = 0x00C8; + + public static final int S2D = 0x00C9; + // endregion Short16 + + // region Int32 (0x00CA-0xCE) /** * I2B Opcode: Represents the type conversion operation from int32 to byte8 in the virtual machine. *This opcode is implemented by the {@link I2BCommand} class, which defines its specific execution logic.
@@ -2084,21 +2083,37 @@ public class VMOpCode { * *This opcode is used to narrow an int32 value to a byte8 type, suitable when a smaller numeric type is required.
*/ - public static final int I2B = 0x00C2; + public static final int I2B = 0x00CA; + /** - * I2D Opcode: Represents the type conversion operation from int32 to double64 in the virtual machine. - *This opcode is implemented by the {@link I2DCommand} class, which defines its specific execution logic.
+ * I2S Opcode: Represents the type conversion operation from int32 to short16 in the virtual machine. + *This opcode is implemented by the {@link I2SCommand} class, which defines its specific execution logic.
* *Execution Steps:
*This opcode is used to widen an int32 value to a double64 type, providing high-precision floating-point calculations.
+ *This opcode is typically used to narrow an int32 value to a short16 type when a smaller data representation is needed.
*/ - public static final int I2D = 0x00C3; + public static final int I2S = 0x00CB; + + /** + * I2L Opcode: Represents the type conversion operation from int32 to long64 in the virtual machine. + *This opcode is implemented by the {@link I2LCommand} class, which defines its specific execution logic.
+ * + *Execution Steps:
+ *This opcode is commonly used to widen an int32 value to a long64 type to accommodate larger numeric ranges.
+ */ + public static final int I2L = 0x00CC; /** * I2F Opcode: Represents the type conversion operation from int32 to float32 in the virtual machine. *This opcode is implemented by the {@link I2FCommand} class, which defines its specific execution logic.
@@ -2112,7 +2127,29 @@ public class VMOpCode { * *This opcode is used to convert an int32 value to a float32 type when floating-point arithmetic is required.
*/ - public static final int I2F = 0x00C4; + public static final int I2F = 0x00CD; + /** + * I2D Opcode: Represents the type conversion operation from int32 to double64 in the virtual machine. + *This opcode is implemented by the {@link I2DCommand} class, which defines its specific execution logic.
+ * + *Execution Steps:
+ *This opcode is used to widen an int32 value to a double64 type, providing high-precision floating-point calculations.
+ */ + public static final int I2D = 0x00CE; + // endregion Int32 + + // region Long64 (0x00CF-0xD3) + + public static final int L2B = 0x00CF; + + public static final int L2S = 0x00D0; + /** * L2I Opcode: Represents the type conversion operation from long64 to int32 in the virtual machine. *This opcode is implemented by the {@link L2ICommand} class, which defines its specific execution logic.
@@ -2126,21 +2163,7 @@ public class VMOpCode { * *This opcode is typically used to narrow a long64 value to an int32 type for further integer operations.
*/ - public static final int L2I = 0x00C5; - /** - * L2D Opcode: Represents the type conversion operation from long64 to double64 in the virtual machine. - *This opcode is implemented by the {@link L2DCommand} class, which defines its specific execution logic.
- * - *Execution Steps:
- *This opcode is used to widen a long64 value to a double64 type for high-precision floating-point computations.
- */ - public static final int L2D = 0x00C6; + public static final int L2I = 0x00D1; /** * L2F Opcode: Represents the type conversion operation from long64 to float32 in the virtual machine. *This opcode is implemented by the {@link L2FCommand} class, which defines its specific execution logic.
@@ -2154,7 +2177,29 @@ public class VMOpCode { * *This opcode is used to convert a long64 value to a float32 type, typically for floating-point arithmetic involving long values.
*/ - public static final int L2F = 0x00C7; + public static final int L2F = 0x00D2; + /** + * L2D Opcode: Represents the type conversion operation from long64 to double64 in the virtual machine. + *This opcode is implemented by the {@link L2DCommand} class, which defines its specific execution logic.
+ * + *Execution Steps:
+ *This opcode is used to widen a long64 value to a double64 type for high-precision floating-point computations.
+ */ + public static final int L2D = 0x00D3; + // endregion Long64 + + // region Float32 (0x00D4-0xD8) + + public static final int F2B = 0x00D4; + + public static final int F2S = 0x00D5; + /** * F2I Opcode: Represents the type conversion operation from float32 to int32 in the virtual machine. *This opcode is implemented by the {@link F2ICommand} class, which defines its specific execution logic.
@@ -2168,7 +2213,7 @@ public class VMOpCode { * *This opcode is used to convert a float32 value to an int32 type for further integer-based operations or comparisons.
*/ - public static final int F2I = 0x00C8; + public static final int F2I = 0x00D6; /** * F2L Opcode: Represents the type conversion operation from float32 to long64 in the virtual machine. *This opcode is implemented by the {@link F2LCommand} class, which defines its specific execution logic.
@@ -2182,7 +2227,7 @@ public class VMOpCode { * *This opcode is used to widen a float32 value to a long64 type, which is useful when operations require a larger numeric range.
*/ - public static final int F2L = 0x00C9; + public static final int F2L = 0x00D7; /** * F2D Opcode: Represents the type conversion operation from float32 to double64 in the virtual machine. *This opcode is implemented by the {@link F2DCommand} class, which defines its specific execution logic.
@@ -2196,7 +2241,15 @@ public class VMOpCode { * *This opcode is used to promote a float32 value to a double64 type, thereby increasing precision for floating-point computations.
*/ - public static final int F2D = 0x00CA; + public static final int F2D = 0x00D8; + // endregion Float32 + + // region Double64 (0x00D9-0xDD) + + public static final int D2B = 0x00D9; + + public static final int D2S = 0x00DA; + /** * D2I Opcode: Represents the type conversion operation from double64 to int32 in the virtual machine. *This opcode is implemented by the {@link D2ICommand} class, which defines its specific execution logic.
@@ -2210,7 +2263,7 @@ public class VMOpCode { * *This opcode is used to narrow a double64 value to an int32 type for further integer-based processing.
*/ - public static final int D2I = 0x00CB; + public static final int D2I = 0x00DB; /** * D2L Opcode: Represents the type conversion operation from double64 to long64 in the virtual machine. *This opcode is implemented by the {@link D2LCommand} class, which defines its specific execution logic.
@@ -2224,7 +2277,7 @@ public class VMOpCode { * *This opcode is used to narrow a double64 value to a long64 type, which can then be used for integer operations.
*/ - public static final int D2L = 0x00CC; + public static final int D2L = 0x00DC; /** * D2F Opcode: Represents the type conversion operation from double64 to float32 in the virtual machine. *This opcode is implemented by the {@link D2FCommand} class, which defines its specific execution logic.
@@ -2238,36 +2291,9 @@ public class VMOpCode { * *This opcode is used to narrow a double64 value to a float32 type when lower precision floating-point arithmetic is acceptable.
*/ - public static final int D2F = 0x00CD; - /** - * S2I Opcode: Represents the type conversion operation from short16 to int32 in the virtual machine. - *This opcode is implemented by the {@link S2ICommand} class, which defines its specific execution logic.
- * - *Execution Steps:
- *This opcode is used to widen a short16 value to an int32 type, facilitating subsequent integer arithmetic or comparison operations.
- */ - public static final int S2I = 0x00CE; - /** - * B2I Opcode: Represents the type conversion operation from byte8 to int32 in the virtual machine. - *This opcode is implemented by the {@link B2ICommand} class, which defines its specific execution logic.
- * - *Execution Steps:
- *This opcode is used to widen a byte8 value to an int32 type to ensure compatibility with integer-based operations.
- */ - public static final int B2I = 0x00CF; - // endregion + public static final int D2F = 0x00DD; + // endregion Double64 + // endregion Conversion // region Stack Control (0x0100-0x01FF) /** diff --git a/src/main/java/org/jcnc/snow/vm/factories/CommandFactory.java b/src/main/java/org/jcnc/snow/vm/factories/CommandFactory.java index a5af00b..4054a11 100644 --- a/src/main/java/org/jcnc/snow/vm/factories/CommandFactory.java +++ b/src/main/java/org/jcnc/snow/vm/factories/CommandFactory.java @@ -207,26 +207,41 @@ public class CommandFactory { // endregion // region Type Conversion (0x00C0-0x00DF) - COMMANDS[VMOpCode.I2L] = new I2LCommand(); - COMMANDS[VMOpCode.I2S] = new I2SCommand(); + COMMANDS[VMOpCode.B2S] = new B2SCommand(); + COMMANDS[VMOpCode.B2I] = new B2ICommand(); + COMMANDS[VMOpCode.B2L] = new B2LCommand(); + COMMANDS[VMOpCode.B2F] = new B2FCommand(); + COMMANDS[VMOpCode.B2D] = new B2DCommand(); + + COMMANDS[VMOpCode.S2B] = new S2BCommand(); + COMMANDS[VMOpCode.S2I] = new S2ICommand(); + COMMANDS[VMOpCode.S2L] = new S2LCommand(); + COMMANDS[VMOpCode.S2F] = new S2FCommand(); + COMMANDS[VMOpCode.S2D] = new S2DCommand(); + COMMANDS[VMOpCode.I2B] = new I2BCommand(); - COMMANDS[VMOpCode.I2D] = new I2DCommand(); + COMMANDS[VMOpCode.I2S] = new I2SCommand(); + COMMANDS[VMOpCode.I2L] = new I2LCommand(); COMMANDS[VMOpCode.I2F] = new I2FCommand(); + COMMANDS[VMOpCode.I2D] = new I2DCommand(); + COMMANDS[VMOpCode.L2B] = new L2BCommand(); + COMMANDS[VMOpCode.L2S] = new L2SCommand(); COMMANDS[VMOpCode.L2I] = new L2ICommand(); - COMMANDS[VMOpCode.L2D] = new L2DCommand(); COMMANDS[VMOpCode.L2F] = new L2FCommand(); + COMMANDS[VMOpCode.L2D] = new L2DCommand(); + COMMANDS[VMOpCode.F2B] = new F2BCommand(); + COMMANDS[VMOpCode.F2S] = new F2SCommand(); COMMANDS[VMOpCode.F2I] = new F2ICommand(); COMMANDS[VMOpCode.F2L] = new F2LCommand(); COMMANDS[VMOpCode.F2D] = new F2DCommand(); + COMMANDS[VMOpCode.D2B] = new D2BCommand(); + COMMANDS[VMOpCode.D2S] = new D2SCommand(); COMMANDS[VMOpCode.D2I] = new D2ICommand(); COMMANDS[VMOpCode.D2L] = new D2LCommand(); COMMANDS[VMOpCode.D2F] = new D2FCommand(); - - COMMANDS[VMOpCode.S2I] = new S2ICommand(); - COMMANDS[VMOpCode.B2I] = new B2ICommand(); // endregion // region Stack Control (0x0100-0x01FF) From 9026b2deb336dfb888016faf79008d3cb22dc702 Mon Sep 17 00:00:00 2001 From: zhangxun <1958638841@qq.com> Date: Thu, 10 Jul 2025 16:04:35 +0800 Subject: [PATCH 17/37] =?UTF-8?q?docs:=20=E8=A1=A5=E5=85=85=20long64=20?= =?UTF-8?q?=E8=BD=AC=E6=8D=A2=E6=8C=87=E4=BB=A4=E7=9A=84=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/jcnc/snow/vm/engine/VMOpCode.java | 29 +++++++++++++++++-- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/jcnc/snow/vm/engine/VMOpCode.java b/src/main/java/org/jcnc/snow/vm/engine/VMOpCode.java index 8b634ca..2bf7ec5 100644 --- a/src/main/java/org/jcnc/snow/vm/engine/VMOpCode.java +++ b/src/main/java/org/jcnc/snow/vm/engine/VMOpCode.java @@ -2145,11 +2145,34 @@ public class VMOpCode { // endregion Int32 // region Long64 (0x00CF-0xD3) - + /** + * L2B Opcode: Represents the type conversion operation from long64 to byte8 in the virtual machine. + *This opcode is implemented by the {@link L2BCommand} class, which defines its specific execution logic.
+ * + *Execution Steps:
+ *This opcode is used to narrow a long64 value to a byte8 type, suitable when a smaller numeric type is required.
+ */ public static final int L2B = 0x00CF; - + /** + * L2S Opcode: Represents the type conversion operation from long64 to short16 in the virtual machine. + *This opcode is implemented by the {@link L2SCommand} class, which defines its specific execution logic.
+ * + *Execution Steps:
+ *This opcode is used to narrow a long64 value to a short16 type, suitable when a smaller numeric type is required.
+ */ public static final int L2S = 0x00D0; - /** * L2I Opcode: Represents the type conversion operation from long64 to int32 in the virtual machine. *This opcode is implemented by the {@link L2ICommand} class, which defines its specific execution logic.
From efc88b33e3672435a0ef188f0236e60572d3ce2b Mon Sep 17 00:00:00 2001 From: zhangxun <1958638841@qq.com> Date: Thu, 10 Jul 2025 16:08:21 +0800 Subject: [PATCH 18/37] =?UTF-8?q?docs:=20=E8=A1=A5=E5=85=85=20double64=20?= =?UTF-8?q?=E8=BD=AC=E6=8D=A2=E6=8C=87=E4=BB=A4=E7=9A=84=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/jcnc/snow/vm/engine/VMOpCode.java | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/jcnc/snow/vm/engine/VMOpCode.java b/src/main/java/org/jcnc/snow/vm/engine/VMOpCode.java index 2bf7ec5..fcf9e49 100644 --- a/src/main/java/org/jcnc/snow/vm/engine/VMOpCode.java +++ b/src/main/java/org/jcnc/snow/vm/engine/VMOpCode.java @@ -2268,9 +2268,33 @@ public class VMOpCode { // endregion Float32 // region Double64 (0x00D9-0xDD) - + /** + * D2B Opcode: Represents the type conversion operation from double64 to byte8 in the virtual machine. + *This opcode is implemented by the {@link D2BCommand} class, which defines its specific execution logic.
+ * + *Execution Steps:
+ *This opcode is used to narrow a double64 value to a byte8 type for further integer-based processing.
+ */ public static final int D2B = 0x00D9; - + /** + * D2I Opcode: Represents the type conversion operation from double64 to short16 in the virtual machine. + *This opcode is implemented by the {@link D2ICommand} class, which defines its specific execution logic.
+ * + *Execution Steps:
+ *This opcode is used to narrow a double64 value to a short16 type for further integer-based processing.
+ */ public static final int D2S = 0x00DA; /** From cd61fdf295b2679d7643bddca0b2644071b1575e Mon Sep 17 00:00:00 2001 From: zhangxun <1958638841@qq.com> Date: Thu, 10 Jul 2025 16:10:35 +0800 Subject: [PATCH 19/37] =?UTF-8?q?docs:=20=E8=A1=A5=E5=85=85=20float32=20?= =?UTF-8?q?=E8=BD=AC=E6=8D=A2=E6=8C=87=E4=BB=A4=E7=9A=84=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/jcnc/snow/vm/engine/VMOpCode.java | 30 ++++++++++++++++--- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/jcnc/snow/vm/engine/VMOpCode.java b/src/main/java/org/jcnc/snow/vm/engine/VMOpCode.java index fcf9e49..3fa44e2 100644 --- a/src/main/java/org/jcnc/snow/vm/engine/VMOpCode.java +++ b/src/main/java/org/jcnc/snow/vm/engine/VMOpCode.java @@ -2218,11 +2218,34 @@ public class VMOpCode { // endregion Long64 // region Float32 (0x00D4-0xD8) - + /** + * F2B Opcode: Represents the type conversion operation from float32 to byte8 in the virtual machine. + *This opcode is implemented by the {@link F2BCommand} class, which defines its specific execution logic.
+ * + *Execution Steps:
+ *This opcode is used to convert a float32 value to a byte8 type for further integer-based operations or comparisons.
+ */ public static final int F2B = 0x00D4; - + /** + * F2S Opcode: Represents the type conversion operation from float32 to short16 in the virtual machine. + *This opcode is implemented by the {@link F2SCommand} class, which defines its specific execution logic.
+ * + *Execution Steps:
+ *This opcode is used to convert a float32 value to a short16 type for further integer-based operations or comparisons.
+ */ public static final int F2S = 0x00D5; - /** * F2I Opcode: Represents the type conversion operation from float32 to int32 in the virtual machine. *This opcode is implemented by the {@link F2ICommand} class, which defines its specific execution logic.
@@ -2296,7 +2319,6 @@ public class VMOpCode { *This opcode is used to narrow a double64 value to a short16 type for further integer-based processing.
*/ public static final int D2S = 0x00DA; - /** * D2I Opcode: Represents the type conversion operation from double64 to int32 in the virtual machine. *This opcode is implemented by the {@link D2ICommand} class, which defines its specific execution logic.
From c5810bce7b6c6437a5092ffe55a2a2e8d6ae07a8 Mon Sep 17 00:00:00 2001 From: zhangxun <1958638841@qq.com> Date: Thu, 10 Jul 2025 16:11:41 +0800 Subject: [PATCH 20/37] =?UTF-8?q?docs:=20=E4=BF=AE=E6=AD=A3=20double64=20?= =?UTF-8?q?=E8=BD=AC=E6=8D=A2=E6=8C=87=E4=BB=A4=E7=9A=84=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/org/jcnc/snow/vm/engine/VMOpCode.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/jcnc/snow/vm/engine/VMOpCode.java b/src/main/java/org/jcnc/snow/vm/engine/VMOpCode.java index 3fa44e2..46430d8 100644 --- a/src/main/java/org/jcnc/snow/vm/engine/VMOpCode.java +++ b/src/main/java/org/jcnc/snow/vm/engine/VMOpCode.java @@ -2306,8 +2306,8 @@ public class VMOpCode { */ public static final int D2B = 0x00D9; /** - * D2I Opcode: Represents the type conversion operation from double64 to short16 in the virtual machine. - *This opcode is implemented by the {@link D2ICommand} class, which defines its specific execution logic.
+ * D2S Opcode: Represents the type conversion operation from double64 to short16 in the virtual machine. + *This opcode is implemented by the {@link D2SCommand} class, which defines its specific execution logic.
* *Execution Steps:
*This opcode is implemented by the {@link S2BCommand} class, which defines its specific execution logic.
+ * + *Execution Steps:
+ *This opcode is used to narrow a short16 value to a byte8 type, suitable when a smaller numeric type is required.
+ */ public static final int S2B = 0x00C5; - + /** + * S2I Opcode: Represents the type conversion operation from short16 to int32 in the virtual machine. + *This opcode is implemented by the {@link S2ICommand} class, which defines its specific execution logic.
+ * + *Execution Steps:
+ *This opcode is commonly used to widen a short16 value to an int32 type to accommodate larger numeric ranges.
+ */ public static final int S2I = 0x00C6; - + /** + * S2L Opcode: Represents the type conversion operation from short16 to long64 in the virtual machine. + *This opcode is implemented by the {@link S2LCommand} class, which defines its specific execution logic.
+ * + *Execution Steps:
+ *This opcode is commonly used to widen a short16 value to a long64 type to accommodate larger numeric ranges.
+ */ public static final int S2L = 0x00C7; - + /** + * S2F Opcode: Represents the type conversion operation from short16 to float32 in the virtual machine. + *This opcode is implemented by the {@link S2FCommand} class, which defines its specific execution logic.
+ * + *Execution Steps:
+ *This opcode is used to convert a short16 value to a float32 type when floating-point arithmetic is required.
+ */ public static final int S2F = 0x00C8; - + /** + * S2D Opcode: Represents the type conversion operation from short16 to double64 in the virtual machine. + *This opcode is implemented by the {@link S2DCommand} class, which defines its specific execution logic.
+ * + *Execution Steps:
+ *This opcode is used to widen a short16 value to a double64 type, providing high-precision floating-point calculations.
+ */ public static final int S2D = 0x00C9; // endregion Short16 @@ -2099,7 +2159,6 @@ public class VMOpCode { *This opcode is typically used to narrow an int32 value to a short16 type when a smaller data representation is needed.
*/ public static final int I2S = 0x00CB; - /** * I2L Opcode: Represents the type conversion operation from int32 to long64 in the virtual machine. *This opcode is implemented by the {@link I2LCommand} class, which defines its specific execution logic.
From 9cfd3ba29a50d2319df7d5776f029c1436013219 Mon Sep 17 00:00:00 2001 From: zhangxun <1958638841@qq.com> Date: Thu, 10 Jul 2025 16:26:06 +0800 Subject: [PATCH 22/37] =?UTF-8?q?docs:=20=E8=A1=A5=E5=85=85=20byte8=20?= =?UTF-8?q?=E8=BD=AC=E6=8D=A2=E6=8C=87=E4=BB=A4=E7=9A=84=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/jcnc/snow/vm/engine/VMOpCode.java | 71 +++++++++++++++++-- 1 file changed, 65 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/jcnc/snow/vm/engine/VMOpCode.java b/src/main/java/org/jcnc/snow/vm/engine/VMOpCode.java index f92c83d..4f2cd1a 100644 --- a/src/main/java/org/jcnc/snow/vm/engine/VMOpCode.java +++ b/src/main/java/org/jcnc/snow/vm/engine/VMOpCode.java @@ -2044,15 +2044,75 @@ public class VMOpCode { // region Type Conversion (0x00C0-0x00DF) // region Byte8 (0x00C0-0xC4) - + /** + * B2S Opcode: Represents the type conversion operation from byte8 to short16 in the virtual machine. + *This opcode is implemented by the {@link B2SCommand} class, which defines its specific execution logic.
+ * + *Execution Steps:
+ *This opcode is commonly used to widen a byte8 value to a short16 type to accommodate larger numeric ranges.
+ */ public static final int B2S = 0x00C0; - + /** + * B2I Opcode: Represents the type conversion operation from byte8 to int32 in the virtual machine. + *This opcode is implemented by the {@link B2ICommand} class, which defines its specific execution logic.
+ * + *Execution Steps:
+ *This opcode is commonly used to widen a byte8 value to an int32 type to accommodate larger numeric ranges.
+ */ public static final int B2I = 0x00C1; - + /** + * B2L Opcode: Represents the type conversion operation from byte8 to long64 in the virtual machine. + *This opcode is implemented by the {@link B2LCommand} class, which defines its specific execution logic.
+ * + *Execution Steps:
+ *This opcode is commonly used to widen a byte8 value to a long64 type to accommodate larger numeric ranges.
+ */ public static final int B2L = 0x00C2; - + /** + * B2F Opcode: Represents the type conversion operation from byte8 to float32 in the virtual machine. + *This opcode is implemented by the {@link B2FCommand} class, which defines its specific execution logic.
+ * + *Execution Steps:
+ *This opcode is used to convert a byte8 value to a float32 type when floating-point arithmetic is required.
+ */ public static final int B2F = 0x00C3; - + /** + * B2D Opcode: Represents the type conversion operation from byte8 to double64 in the virtual machine. + *This opcode is implemented by the {@link B2DCommand} class, which defines its specific execution logic.
+ * + *Execution Steps:
+ *This opcode is used to widen a byte8 value to a double64 type, providing high-precision floating-point calculations.
+ */ public static final int B2D = 0x00C4; // endregion Byte8 @@ -2144,7 +2204,6 @@ public class VMOpCode { *This opcode is used to narrow an int32 value to a byte8 type, suitable when a smaller numeric type is required.
*/ public static final int I2B = 0x00CA; - /** * I2S Opcode: Represents the type conversion operation from int32 to short16 in the virtual machine. *This opcode is implemented by the {@link I2SCommand} class, which defines its specific execution logic.
From 609e3806644fc72c495bd2a5aa97dc0a1dbe6817 Mon Sep 17 00:00:00 2001 From: zhangxun <1958638841@qq.com> Date: Thu, 10 Jul 2025 17:13:16 +0800 Subject: [PATCH 23/37] =?UTF-8?q?refactor:=20=E5=90=8C=E6=AD=A5=20VMOpCode?= =?UTF-8?q?=20=E6=8C=87=E4=BB=A4=E5=88=B0=20OpHelper=20=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../snow/compiler/backend/utils/OpHelper.java | 192 +++++++++++------- 1 file changed, 119 insertions(+), 73 deletions(-) diff --git a/src/main/java/org/jcnc/snow/compiler/backend/utils/OpHelper.java b/src/main/java/org/jcnc/snow/compiler/backend/utils/OpHelper.java index 8dc5529..42c29ff 100644 --- a/src/main/java/org/jcnc/snow/compiler/backend/utils/OpHelper.java +++ b/src/main/java/org/jcnc/snow/compiler/backend/utils/OpHelper.java @@ -29,108 +29,154 @@ public final class OpHelper { static { Map- * 仅覆盖目前常见的整数与浮点类型提升与转换,后续有新类型可补充。 - *
- * - * @param from 源类型标记字符 - * @param to 目标类型标记字符 - * @return 转换指令名,如“L2I”;无转换返回 {@code null} - */ - private static String convert(char from, char to) { - if (from == to) return null; - return switch ("" + from + to) { - case "IL" -> "I2L"; - case "ID" -> "I2D"; - case "IF" -> "I2F"; - case "LI" -> "L2I"; - case "LD" -> "L2D"; - case "LF" -> "L2F"; - case "FI" -> "F2I"; - case "FL" -> "F2L"; - case "FD" -> "F2D"; - case "DI" -> "D2I"; - case "DL" -> "D2L"; - case "DF" -> "D2F"; - case "SI" -> "S2I"; - case "BI" -> "B2I"; - default -> null; - }; - } - /** * 生成 IR 条件比较跳转指令的 VM 指令序列。 ** 该类实现了 {@link InstructionGenerator} 接口, * 负责将 IR 中的 {@link IRCompareJumpInstruction}(条件比较并跳转指令) * 转换为目标虚拟机(VM)可执行的指令序列。 *
* - * 主要功能 + * 主要功能 *L/l 判定)选择
- * 正确的 IR 比较指令,保证 int/long 均能正常运行。
+ * 工具类,用于比较运算相关的类型推断和指令选择。
+ * + * 该类主要用于根据左右操作数的静态类型,自动选择正确的 IR 层比较操作码。 + * 支持自动类型提升,保证 int、long、float、double 等类型的比较均能得到正确的 IR 指令。 + *
+ * + * 类型判定支持: + *+ * 在进行数值类型运算、比较等操作时,低优先级的类型会被提升为高优先级类型参与运算。 + * 例如 int + long 运算,int 会被提升为 long,最终运算结果类型为 long。 + *
+ * 类型优先级从高到低依次为: + * D(double):6 + * F(float) :5 + * L(long) :4 + * I(int) :3 + * S(short) :2 + * B(byte) :1 + * 未识别类型 :0 */ public class TypePromoteUtils { + /** - * 类型宽度优先级:D > F > L > I > S > B - *
+ * 支持的类型标记字符包括:B(byte)、S(short)、I(int)、L(long)、F(float)、D(double)。
+ * 所有可能的类型转换均已覆盖,如下所示:
+ * B → S/I/L/F/D
+ * S → B/I/L/F/D
+ * I → B/S/L/F/D
+ * L → B/S/I/F/D
+ * F → B/S/I/L/D
+ * D → B/S/I/L/F
*
* @param from 源类型标记字符
* @param to 目标类型标记字符
- * @return 转换指令名,如“L2I”;无转换返回 {@code null}
+ * @return 类型转换指令名(如 "L2I"),如无须转换则返回 null
*/
public static String convert(char from, char to) {
if (from == to) return null;
From e7d7e7f96feff564303d1cf1c460317e7783c29b Mon Sep 17 00:00:00 2001
From: Luke 主要功能:
+ * 主要功能:
+ * - 解析字面量常量,自动推断类型
+ * - 自动匹配并选择适合的算术/比较操作码
+ * - 表达式类型的合并与类型提升
+ * - 支持线程隔离的函数级默认类型后缀
*/
public final class ExpressionUtils {
private ExpressionUtils() {}
- /* ────────────────── 线程级默认类型后缀 ────────────────── */
+ // ───────────── 线程级默认类型后缀 ─────────────
- /** 默认类型后缀(如当前函数返回类型),线程隔离。 */
+ /**
+ * 当前线程的默认类型后缀(如当前函数返回类型等),用于类型推断兜底。
+ */
private static final ThreadLocal
+ * 支持的字面量后缀有 b/s/l/f/d(大小写均可)。
+ * 无后缀时,优先参考 IRContext 当前变量类型,否则根据字面量格式(含'.'或'e'等)判断为 double,否则为 int。
+ *
+ * @param ctx IRContext,允许参考变量声明类型
+ * @param value 数字字面量字符串
+ * @return 对应类型的 IRConstant 常量
*/
public static IRConstant buildNumberConstant(IRContext ctx, String value) {
char suffix = value.isEmpty() ? '\0'
@@ -56,7 +75,7 @@ public final class ExpressionUtils {
String digits = switch (suffix) {
case 'b','s','l','f','d' -> value.substring(0, value.length() - 1);
default -> {
- /* 如果字面量本身没有后缀,则回退到变量目标类型(如声明语句左值) */
+ // 无后缀,优先参考变量类型
if (ctx.getVarType() != null) {
String t = ctx.getVarType();
suffix = switch (t) {
@@ -73,7 +92,7 @@ public final class ExpressionUtils {
}
};
- /* 创建常量 */
+ // 生成常量对象
return switch (suffix) {
case 'b' -> new IRConstant(Byte.parseByte(digits));
case 's' -> new IRConstant(Short.parseShort(digits));
@@ -86,10 +105,13 @@ public final class ExpressionUtils {
};
}
- /* ────────────────────── 一元运算 ────────────────────── */
+ // ───────────── 一元运算指令匹配 ─────────────
/**
- * 推断一元取负(-)运算应使用的 {@link IROpCode}。
+ * 根据表达式节点的类型后缀,选择对应的取负(-)运算操作码。
+ *
+ * @param operand 操作数表达式
+ * @return 匹配类型的 IROpCode
*/
public static IROpCode negOp(ExpressionNode operand) {
char t = typeChar(operand);
@@ -99,34 +121,54 @@ public final class ExpressionUtils {
case 'l' -> IROpCode.NEG_L64;
case 'f' -> IROpCode.NEG_F32;
case 'd' -> IROpCode.NEG_D64;
- default -> IROpCode.NEG_I32; // '\0' 或 'i'
+ default -> IROpCode.NEG_I32; // 无法推断或为 int
};
}
- /* ────────────────── 比较运算(已适配 long) ────────────────── */
+ // ───────────── 比较运算相关 ─────────────
- /** 判断给定字符串是否是比较运算符(==, !=, <, >, <=, >=)。 */
+ /**
+ * 判断给定字符串是否为支持的比较运算符(==, !=, <, >, <=, >=)。
+ *
+ * @param op 操作符字符串
+ * @return 若为比较运算符返回 true,否则返回 false
+ */
public static boolean isComparisonOperator(String op) {
return ComparisonUtils.isComparisonOperator(op);
}
/**
- * 兼容旧调用:仅凭操作符返回 int32 比较指令。
+ * 兼容旧逻辑:仅凭操作符直接返回 int32 比较指令。
+ *
+ * @param op 比较操作符
+ * @return int32 类型的比较操作码
*/
public static IROpCode cmpOp(String op) {
- return IROpCodeMappings.CMP_I32.get(op); // 旧逻辑:一律 i32
+ return IROpCodeMappings.CMP_I32.get(op);
}
/**
- * 推荐调用:根据左右表达式类型自动选择 int / long 比较指令。
+ * 推荐调用:根据左右表达式类型自动选择 int/long/float/double 等合适的比较操作码。
+ *
+ * @param variables 变量名到类型的映射
+ * @param op 比较符号
+ * @param left 左操作数表达式
+ * @param right 右操作数表达式
+ * @return 匹配类型的比较操作码
*/
public static IROpCode cmpOp(Map
+ * 类型推断优先使用左右表达式的类型后缀,推断失败时回退为线程级默认类型后缀,再失败则默认为 int32。
+ *
+ * @param op 算术操作符
+ * @param left 左表达式
+ * @param right 右表达式
+ * @return 匹配类型的 IROpCode
*/
public static IROpCode resolveOpCode(String op,
ExpressionNode left,
ExpressionNode right) {
-
- /* 1. 尝试根据字面量推断 */
+ // 1. 优先根据表达式类型推断
char suffix = resolveSuffix(left, right);
-
- /* 2. 若失败则使用函数级默认类型 */
+ // 2. 推断失败则使用线程默认类型
if (suffix == '\0') suffix = DEFAULT_SUFFIX.get();
-
- /* 3. 仍失败则默认为 int32 */
+ // 3. 仍失败则默认为 int32
Map
- *
+ * 表达式分析与操作符选择工具类。
+ *
This opcode is used to widen a byte8 value to a double64 type to ensure compatibility with integer-based operations.
+ *This opcode is used to widen a byte8 value to a double64 type.
*/ public class B2DCommand implements Command { diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/B2FCommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/B2FCommand.java index c61891b..c62a202 100644 --- a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/B2FCommand.java +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/B2FCommand.java @@ -16,7 +16,7 @@ import org.jcnc.snow.vm.module.OperandStack; *This opcode is used to widen a byte8 value to a float32 type to ensure compatibility with integer-based operations.
+ *This opcode is used to widen a byte8 value to a float32 type.
*/ public class B2FCommand implements Command { diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/B2ICommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/B2ICommand.java index c5c18a6..2ba6649 100644 --- a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/B2ICommand.java +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/B2ICommand.java @@ -16,7 +16,7 @@ import org.jcnc.snow.vm.module.OperandStack; *This opcode is used to widen a byte8 value to an int32 type to ensure compatibility with integer-based operations.
+ *This opcode is used to widen a byte8 value to an int32 type.
*/ public class B2ICommand implements Command { diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/B2LCommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/B2LCommand.java index 344b49d..3bcff86 100644 --- a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/B2LCommand.java +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/B2LCommand.java @@ -16,7 +16,7 @@ import org.jcnc.snow.vm.module.OperandStack; *This opcode is used to widen a byte8 value to a long64 type to ensure compatibility with integer-based operations.
+ *This opcode is used to widen a byte8 value to a long64 type.
*/ public class B2LCommand implements Command { diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/B2SCommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/B2SCommand.java index 1f09ff9..167d318 100644 --- a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/B2SCommand.java +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/B2SCommand.java @@ -16,7 +16,7 @@ import org.jcnc.snow.vm.module.OperandStack; *This opcode is used to widen a byte8 value to a short16 type to ensure compatibility with integer-based operations.
+ *This opcode is used to widen a byte8 value to a short16 type.
*/ public class B2SCommand implements Command { diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/D2BCommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/D2BCommand.java index 7180d2e..8106ae8 100644 --- a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/D2BCommand.java +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/D2BCommand.java @@ -16,7 +16,7 @@ import org.jcnc.snow.vm.module.OperandStack; *This opcode is used to narrow a double64 value to a byte8 type for further integer-based operations.
+ *This opcode is used to narrow a double64 value to a byte8 type.
*/ public class D2BCommand implements Command { diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/D2FCommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/D2FCommand.java index 7f4bcc0..49d14eb 100644 --- a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/D2FCommand.java +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/D2FCommand.java @@ -16,7 +16,7 @@ import org.jcnc.snow.vm.module.OperandStack; *This opcode is used to narrow a double64 value to a float32 type when lower precision floating-point arithmetic is acceptable.
+ *This opcode is used to narrow a double64 value to a float32 type.
*/ public class D2FCommand implements Command { diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/D2ICommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/D2ICommand.java index 903f6dc..b99dd0a 100644 --- a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/D2ICommand.java +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/D2ICommand.java @@ -16,7 +16,7 @@ import org.jcnc.snow.vm.module.OperandStack; *This opcode is used to narrow a double64 value to an int32 type for further integer-based operations.
+ *This opcode is used to narrow a double64 value to an int32 type.
*/ public class D2ICommand implements Command { diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/D2LCommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/D2LCommand.java index 78d558a..c825d09 100644 --- a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/D2LCommand.java +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/D2LCommand.java @@ -16,7 +16,7 @@ import org.jcnc.snow.vm.module.OperandStack; *This opcode is used to narrow a double64 value to a long64 type, which can then be used for integer operations.
+ *This opcode is used to narrow a double64 value to a long64 type.
*/ public class D2LCommand implements Command { diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/D2SCommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/D2SCommand.java index 41a8cec..49da2f1 100644 --- a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/D2SCommand.java +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/D2SCommand.java @@ -16,7 +16,7 @@ import org.jcnc.snow.vm.module.OperandStack; *This opcode is used to narrow a double64 value to a short16 type for further integer-based operations.
+ *This opcode is used to narrow a double64 value to a short16 type.
*/ public class D2SCommand implements Command { diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/F2BCommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/F2BCommand.java index 5240f86..3277271 100644 --- a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/F2BCommand.java +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/F2BCommand.java @@ -16,7 +16,7 @@ import org.jcnc.snow.vm.module.OperandStack; *This opcode is used to convert a float32 value to a byte8 type for further integer operations or comparisons.
+ *This opcode is used to convert a float32 value to a byte8 type.
*/ public class F2BCommand implements Command { diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/F2DCommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/F2DCommand.java index 7f4dba7..88c1075 100644 --- a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/F2DCommand.java +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/F2DCommand.java @@ -16,7 +16,7 @@ import org.jcnc.snow.vm.module.OperandStack; *This opcode is used to promote a float32 value to a double64 type, thereby increasing precision for floating-point computations.
+ *This opcode is used to promote a float32 value to a double64 type.
*/ public class F2DCommand implements Command { diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/F2ICommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/F2ICommand.java index 24f9192..ced0b27 100644 --- a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/F2ICommand.java +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/F2ICommand.java @@ -16,7 +16,7 @@ import org.jcnc.snow.vm.module.OperandStack; *This opcode is used to convert a float32 value to an int32 type for further integer operations or comparisons.
+ *This opcode is used to convert a float32 value to an int32 type.
*/ public class F2ICommand implements Command { diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/F2LCommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/F2LCommand.java index b4bcb6b..5471c14 100644 --- a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/F2LCommand.java +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/F2LCommand.java @@ -16,7 +16,7 @@ import org.jcnc.snow.vm.module.OperandStack; *This opcode is used to widen a float32 value to a long64 type for operations requiring a larger numeric range.
+ *This opcode is used to widen a float32 value to a long64 type.
*/ public class F2LCommand implements Command { diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/F2SCommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/F2SCommand.java index 83a79b5..312c828 100644 --- a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/F2SCommand.java +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/F2SCommand.java @@ -16,7 +16,7 @@ import org.jcnc.snow.vm.module.OperandStack; *This opcode is used to convert a float32 value to a short16 type for further integer operations or comparisons.
+ *This opcode is used to convert a float32 value to a short16 type.
*/ public class F2SCommand implements Command { diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/I2BCommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/I2BCommand.java index 76ef29c..3ab1503 100644 --- a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/I2BCommand.java +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/I2BCommand.java @@ -16,7 +16,7 @@ import org.jcnc.snow.vm.module.OperandStack; *This opcode is used to narrow an int32 value to a byte8 type when a smaller numeric representation is required.
+ *This opcode is used to narrow an int32 value to a byte8 type.
*/ public class I2BCommand implements Command { diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/I2DCommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/I2DCommand.java index 0147f5b..07a3c9b 100644 --- a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/I2DCommand.java +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/I2DCommand.java @@ -16,7 +16,7 @@ import org.jcnc.snow.vm.module.OperandStack; *This opcode is used to widen an int32 value to a double64 type, providing high-precision floating-point calculations.
+ *This opcode is used to widen an int32 value to a double64 type.
*/ public class I2DCommand implements Command { diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/I2FCommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/I2FCommand.java index 22182dc..6b85e06 100644 --- a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/I2FCommand.java +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/I2FCommand.java @@ -16,7 +16,7 @@ import org.jcnc.snow.vm.module.OperandStack; *This opcode is used to convert an int32 value to a float32 type when floating-point arithmetic is required.
+ *This opcode is used to convert an int32 value to a float32 type.
*/ public class I2FCommand implements Command { diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/I2LCommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/I2LCommand.java index a9d1aae..069fc52 100644 --- a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/I2LCommand.java +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/I2LCommand.java @@ -16,7 +16,7 @@ import org.jcnc.snow.vm.module.OperandStack; *This opcode is commonly used to widen an int32 value to a long64 type to accommodate larger numeric ranges.
+ *This opcode is commonly used to widen an int32 value to a long64 type.
*/ public class I2LCommand implements Command { diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/I2SCommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/I2SCommand.java index ca5987a..b948a8d 100644 --- a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/I2SCommand.java +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/I2SCommand.java @@ -16,7 +16,7 @@ import org.jcnc.snow.vm.module.OperandStack; *This opcode is typically used to narrow an int32 value to a short16 type when a smaller data representation is required.
+ *This opcode is typically used to narrow an int32 value to a short16 type.
*/ public class I2SCommand implements Command { diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/L2BCommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/L2BCommand.java index cde429c..b005ca2 100644 --- a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/L2BCommand.java +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/L2BCommand.java @@ -16,7 +16,7 @@ import org.jcnc.snow.vm.module.OperandStack; *This opcode is used to widen a long64 value to a byte8 type for high-precision floating-point computations.
+ *This opcode is used to widen a long64 value to a byte8 type.
*/ public class L2BCommand implements Command { diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/L2DCommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/L2DCommand.java index 06426ae..2fd9a21 100644 --- a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/L2DCommand.java +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/L2DCommand.java @@ -16,7 +16,7 @@ import org.jcnc.snow.vm.module.OperandStack; *This opcode is used to widen a long64 value to a double64 type for high-precision floating-point computations.
+ *This opcode is used to widen a long64 value to a double64 type.
*/ public class L2DCommand implements Command { diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/L2FCommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/L2FCommand.java index 5cf6a67..b790255 100644 --- a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/L2FCommand.java +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/L2FCommand.java @@ -16,7 +16,7 @@ import org.jcnc.snow.vm.module.OperandStack; *This opcode is used to convert a long64 value to a float32 type, typically for floating-point arithmetic involving long values.
+ *This opcode is used to convert a long64 value to a float32 type.
*/ public class L2FCommand implements Command { diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/L2ICommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/L2ICommand.java index f4f4b41..b96442d 100644 --- a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/L2ICommand.java +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/L2ICommand.java @@ -16,7 +16,7 @@ import org.jcnc.snow.vm.module.OperandStack; *This opcode is typically used to narrow a long64 value to an int32 type for further integer operations.
+ *This opcode is typically used to narrow a long64 value to an int32 typ.
*/ public class L2ICommand implements Command { diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/L2SCommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/L2SCommand.java index 54652d6..70c5e2a 100644 --- a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/L2SCommand.java +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/L2SCommand.java @@ -16,7 +16,7 @@ import org.jcnc.snow.vm.module.OperandStack; *This opcode is used to widen a long64 value to a short16 type for high-precision floating-point computations.
+ *This opcode is used to widen a long64 value to a short16 type.
*/ public class L2SCommand implements Command { diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2BCommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2BCommand.java index d94eb8a..159504f 100644 --- a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2BCommand.java +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2BCommand.java @@ -16,7 +16,7 @@ import org.jcnc.snow.vm.module.OperandStack; *This opcode is used to widen a short16 value to a byte8 type, facilitating subsequent integer arithmetic or comparison operations.
+ *This opcode is used to widen a short16 value to a byte8 type.
*/ public class S2BCommand implements Command { diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2DCommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2DCommand.java index 7703f26..50c6e4e 100644 --- a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2DCommand.java +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2DCommand.java @@ -16,7 +16,7 @@ import org.jcnc.snow.vm.module.OperandStack; *This opcode is used to widen a short16 value to a double64 type, facilitating subsequent integer arithmetic or comparison operations.
+ *This opcode is used to widen a short16 value to a double64 type.
*/ public class S2DCommand implements Command { diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2FCommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2FCommand.java index 478e397..9493a55 100644 --- a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2FCommand.java +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2FCommand.java @@ -16,7 +16,7 @@ import org.jcnc.snow.vm.module.OperandStack; *This opcode is used to widen a short16 value to a float32 type, facilitating subsequent integer arithmetic or comparison operations.
+ *This opcode is used to widen a short16 value to a float32 type.
*/ public class S2FCommand implements Command { diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2ICommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2ICommand.java index fa3ee74..c980d3b 100644 --- a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2ICommand.java +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2ICommand.java @@ -16,7 +16,7 @@ import org.jcnc.snow.vm.module.OperandStack; *This opcode is used to widen a short16 value to an int32 type, facilitating subsequent integer arithmetic or comparison operations.
+ *This opcode is used to widen a short16 value to an int32 type.
*/ public class S2ICommand implements Command { diff --git a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2LCommand.java b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2LCommand.java index cec58e6..194344f 100644 --- a/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2LCommand.java +++ b/src/main/java/org/jcnc/snow/vm/commands/type/conversion/S2LCommand.java @@ -16,7 +16,7 @@ import org.jcnc.snow.vm.module.OperandStack; *This opcode is used to widen a short16 value to a long64 type, facilitating subsequent integer arithmetic or comparison operations.
+ *This opcode is used to widen a short16 value to a long64 type.
*/ public class S2LCommand implements Command { From aa96fc89ab4836e70b2c1e21f9c12f639160d87d Mon Sep 17 00:00:00 2001 From: LukeThis opcode is commonly used to widen a byte8 value to a short16 type to accommodate larger numeric ranges.
+ *This opcode is commonly used to widen a byte8 value to a short16 type.
*/ public static final int B2S = 0x00C0; /** @@ -2069,7 +2069,7 @@ public class VMOpCode { *This opcode is commonly used to widen a byte8 value to an int32 type to accommodate larger numeric ranges.
+ *This opcode is commonly used to widen a byte8 value to an int32 type.
*/ public static final int B2I = 0x00C1; /** @@ -2083,7 +2083,7 @@ public class VMOpCode { *This opcode is commonly used to widen a byte8 value to a long64 type to accommodate larger numeric ranges.
+ *This opcode is commonly used to widen a byte8 value to a long64 type.
*/ public static final int B2L = 0x00C2; /** @@ -2097,7 +2097,7 @@ public class VMOpCode { *This opcode is used to convert a byte8 value to a float32 type when floating-point arithmetic is required.
+ *This opcode is used to convert a byte8 value to a float32 type.
*/ public static final int B2F = 0x00C3; /** @@ -2111,7 +2111,7 @@ public class VMOpCode { *This opcode is used to widen a byte8 value to a double64 type, providing high-precision floating-point calculations.
+ *This opcode is used to widen a byte8 value to a double64 type.
*/ public static final int B2D = 0x00C4; // endregion Byte8 @@ -2128,7 +2128,7 @@ public class VMOpCode { *This opcode is used to narrow a short16 value to a byte8 type, suitable when a smaller numeric type is required.
+ *This opcode is used to narrow a short16 value to a byte8 type.
*/ public static final int S2B = 0x00C5; /** @@ -2142,7 +2142,7 @@ public class VMOpCode { *This opcode is commonly used to widen a short16 value to an int32 type to accommodate larger numeric ranges.
+ *This opcode is commonly used to widen a short16 value to an int32 type.
*/ public static final int S2I = 0x00C6; /** @@ -2156,7 +2156,7 @@ public class VMOpCode { *This opcode is commonly used to widen a short16 value to a long64 type to accommodate larger numeric ranges.
+ *This opcode is commonly used to widen a short16 value to a long64 type.
*/ public static final int S2L = 0x00C7; /** @@ -2170,7 +2170,7 @@ public class VMOpCode { *This opcode is used to convert a short16 value to a float32 type when floating-point arithmetic is required.
+ *This opcode is used to convert a short16 value to a float32 type.
*/ public static final int S2F = 0x00C8; /** @@ -2184,7 +2184,7 @@ public class VMOpCode { *This opcode is used to widen a short16 value to a double64 type, providing high-precision floating-point calculations.
+ *This opcode is used to widen a short16 value to a double64 type.
*/ public static final int S2D = 0x00C9; // endregion Short16 @@ -2201,7 +2201,7 @@ public class VMOpCode { *This opcode is used to narrow an int32 value to a byte8 type, suitable when a smaller numeric type is required.
+ *This opcode is used to narrow an int32 value to a byte8 type.
*/ public static final int I2B = 0x00CA; /** @@ -2215,7 +2215,7 @@ public class VMOpCode { *This opcode is typically used to narrow an int32 value to a short16 type when a smaller data representation is needed.
+ *This opcode is typically used to narrow an int32 value to a short16 type.
*/ public static final int I2S = 0x00CB; /** @@ -2229,7 +2229,7 @@ public class VMOpCode { *This opcode is commonly used to widen an int32 value to a long64 type to accommodate larger numeric ranges.
+ *This opcode is commonly used to widen an int32 value to a long64 type.
*/ public static final int I2L = 0x00CC; /** @@ -2243,7 +2243,7 @@ public class VMOpCode { *This opcode is used to convert an int32 value to a float32 type when floating-point arithmetic is required.
+ *This opcode is used to convert an int32 value to a float32 type.
*/ public static final int I2F = 0x00CD; /** @@ -2257,7 +2257,7 @@ public class VMOpCode { *This opcode is used to widen an int32 value to a double64 type, providing high-precision floating-point calculations.
+ *This opcode is used to widen an int32 value to a double64 type.
*/ public static final int I2D = 0x00CE; // endregion Int32 @@ -2274,7 +2274,7 @@ public class VMOpCode { *This opcode is used to narrow a long64 value to a byte8 type, suitable when a smaller numeric type is required.
+ *This opcode is used to narrow a long64 value to a byte8 type.
*/ public static final int L2B = 0x00CF; /** @@ -2288,7 +2288,7 @@ public class VMOpCode { *This opcode is used to narrow a long64 value to a short16 type, suitable when a smaller numeric type is required.
+ *This opcode is used to narrow a long64 value to a short16 type.
*/ public static final int L2S = 0x00D0; /** @@ -2302,7 +2302,7 @@ public class VMOpCode { *This opcode is typically used to narrow a long64 value to an int32 type for further integer operations.
+ *This opcode is typically used to narrow a long64 value.
*/ public static final int L2I = 0x00D1; /** @@ -2316,7 +2316,7 @@ public class VMOpCode { *This opcode is used to convert a long64 value to a float32 type, typically for floating-point arithmetic involving long values.
+ *This opcode is used to convert a long64 value to a float32 type.
*/ public static final int L2F = 0x00D2; /** @@ -2330,7 +2330,7 @@ public class VMOpCode { *This opcode is used to widen a long64 value to a double64 type for high-precision floating-point computations.
+ *This opcode is used to widen a long64 value to a double64 type.
*/ public static final int L2D = 0x00D3; // endregion Long64 @@ -2347,7 +2347,7 @@ public class VMOpCode { *This opcode is used to convert a float32 value to a byte8 type for further integer-based operations or comparisons.
+ *This opcode is used to convert a float32 value to a byte8 type.
*/ public static final int F2B = 0x00D4; /** @@ -2361,7 +2361,7 @@ public class VMOpCode { *This opcode is used to convert a float32 value to a short16 type for further integer-based operations or comparisons.
+ *This opcode is used to convert a float32 value to a short16 type.
*/ public static final int F2S = 0x00D5; /** @@ -2375,7 +2375,7 @@ public class VMOpCode { *This opcode is used to convert a float32 value to an int32 type for further integer-based operations or comparisons.
+ *This opcode is used to convert a float32 value to an int32 type.
*/ public static final int F2I = 0x00D6; /** @@ -2389,7 +2389,7 @@ public class VMOpCode { *This opcode is used to widen a float32 value to a long64 type, which is useful when operations require a larger numeric range.
+ *This opcode is used to widen a float32 value to a long64 type.
*/ public static final int F2L = 0x00D7; /** @@ -2403,7 +2403,7 @@ public class VMOpCode { *This opcode is used to promote a float32 value to a double64 type, thereby increasing precision for floating-point computations.
+ *This opcode is used to promote a float32 value to a double64 type.
*/ public static final int F2D = 0x00D8; // endregion Float32 @@ -2420,7 +2420,7 @@ public class VMOpCode { *This opcode is used to narrow a double64 value to a byte8 type for further integer-based processing.
+ *This opcode is used to narrow a double64 value to a byte8 type.
*/ public static final int D2B = 0x00D9; /** @@ -2434,7 +2434,7 @@ public class VMOpCode { *This opcode is used to narrow a double64 value to a short16 type for further integer-based processing.
+ *This opcode is used to narrow a double64 value to a short16 type.
*/ public static final int D2S = 0x00DA; /** @@ -2448,7 +2448,7 @@ public class VMOpCode { *This opcode is used to narrow a double64 value to an int32 type for further integer-based processing.
+ *This opcode is used to narrow a double64 value to an int32 type.
*/ public static final int D2I = 0x00DB; /** @@ -2462,7 +2462,7 @@ public class VMOpCode { *This opcode is used to narrow a double64 value to a long64 type, which can then be used for integer operations.
+ *This opcode is used to narrow a double64 value to a long64 type.
*/ public static final int D2L = 0x00DC; /** @@ -2476,7 +2476,7 @@ public class VMOpCode { *This opcode is used to narrow a double64 value to a float32 type when lower precision floating-point arithmetic is acceptable.
+ *This opcode is used to narrow a double64 value to a float32 type.
*/ public static final int D2F = 0x00DD; // endregion Double64 From 68c1e3a4121bfa479be72565d7eb2d47f5daf9c6 Mon Sep 17 00:00:00 2001 From: LukeThis opcode is typically used to narrow a long64 value.
+ *This opcode is typically used to narrow a long64 value to an int32 type .
*/ public static final int L2I = 0x00D1; /**