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] =?UTF-8?q?docs:=20=E8=A1=A5=E5=85=85=20byte8=20=E8=BD=AC?= =?UTF-8?q?=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:

+ *
    + *
  1. Pop the top byte8 value from the operand stack.
  2. + *
  3. Convert the byte8 value to a short16 value.
  4. + *
  5. Push the converted short16 value back onto the operand stack for subsequent operations.
  6. + *
+ * + *

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:

+ *
    + *
  1. Pop the top byte8 value from the operand stack.
  2. + *
  3. Convert the byte8 value to an int32 value.
  4. + *
  5. Push the converted int32 value back onto the operand stack for subsequent operations.
  6. + *
+ * + *

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:

+ *
    + *
  1. Pop the top byte8 value from the operand stack.
  2. + *
  3. Convert the byte8 value to a long64 value.
  4. + *
  5. Push the converted long64 value back onto the operand stack for subsequent operations.
  6. + *
+ * + *

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:

+ *
    + *
  1. Pop the top byte8 value from the operand stack.
  2. + *
  3. Convert the byte8 value to a float32 value.
  4. + *
  5. Push the converted float32 value back onto the operand stack for subsequent operations.
  6. + *
+ * + *

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:

+ *
    + *
  1. Pop the top byte8 value from the operand stack.
  2. + *
  3. Convert the byte8 value to a double64 value.
  4. + *
  5. Push the converted double64 value back onto the operand stack for subsequent operations.
  6. + *
+ * + *

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.