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 dad55af..40ff6f3 100644 --- a/src/main/java/org/jcnc/snow/vm/engine/VMOpCode.java +++ b/src/main/java/org/jcnc/snow/vm/engine/VMOpCode.java @@ -1,7 +1,7 @@ package org.jcnc.snow.vm.engine; import org.jcnc.snow.vm.commands.arithmetic.byte8.*; -import org.jcnc.snow.vm.commands.arithmetic.conversion.I2LCommand; +import org.jcnc.snow.vm.commands.arithmetic.conversion.*; import org.jcnc.snow.vm.commands.arithmetic.double64.*; import org.jcnc.snow.vm.commands.arithmetic.float32.*; import org.jcnc.snow.vm.commands.arithmetic.int32.*; @@ -18,7 +18,18 @@ import org.jcnc.snow.vm.commands.control.int32.*; import org.jcnc.snow.vm.commands.function.CallCommand; import org.jcnc.snow.vm.commands.function.RetCommand; import org.jcnc.snow.vm.commands.memory.all.MovCommand; +import org.jcnc.snow.vm.commands.memory.byte8.BLoadCommand; +import org.jcnc.snow.vm.commands.memory.byte8.BStoreCommand; +import org.jcnc.snow.vm.commands.memory.double64.DLoadCommand; +import org.jcnc.snow.vm.commands.memory.double64.DStoreCommand; +import org.jcnc.snow.vm.commands.memory.float32.FLoadCommand; +import org.jcnc.snow.vm.commands.memory.float32.FStoreCommand; import org.jcnc.snow.vm.commands.memory.int32.ILoadCommand; +import org.jcnc.snow.vm.commands.memory.int32.IStoreCommand; +import org.jcnc.snow.vm.commands.memory.long64.LLoadCommand; +import org.jcnc.snow.vm.commands.memory.long64.LStoreCommand; +import org.jcnc.snow.vm.commands.memory.short16.SLoadCommand; +import org.jcnc.snow.vm.commands.memory.short16.SStoreCommand; import org.jcnc.snow.vm.commands.stack.all.DupCommand; import org.jcnc.snow.vm.commands.stack.all.PopCommand; import org.jcnc.snow.vm.commands.stack.all.SwapCommand; @@ -507,7 +518,7 @@ public class VMOpCode { * * *

This opcode is a fundamental arithmetic operation within the virtual machine's instruction set, - * primarily used to handle basic double precision floating-point addition tasks.

+ * primarily used to handle basic double64 precision floating-point addition tasks.

*/ public static final int D_ADD = 41; @@ -517,13 +528,13 @@ public class VMOpCode { * *

Execution Steps:

*
    - *
  1. Pops the top two double values from the operand stack (the first value popped is the subtrahend, and the second value popped is the minuend).
  2. - *
  3. Performs the double precision floating-point subtraction operation by subtracting the subtrahend from the minuend (i.e., minuend - subtrahend).
  4. + *
  5. Pops the top two double64 values from the operand stack (the first value popped is the subtrahend, and the second value popped is the minuend).
  6. + *
  7. Performs the double64 precision floating-point subtraction operation by subtracting the subtrahend from the minuend (i.e., minuend - subtrahend).
  8. *
  9. Pushes the result of the subtraction back onto the operand stack for later instructions to use.
  10. *
* *

This opcode is a fundamental arithmetic operation within the virtual machine's instruction set, - * primarily used to handle basic double precision floating-point subtraction tasks.

+ * primarily used to handle basic double64 precision floating-point subtraction tasks.

*/ public static final int D_SUB = 42; @@ -1412,126 +1423,132 @@ public class VMOpCode { // 5. Memory Operations (151–) /** - * I_STORE Opcode: Represents a load operation that retrieves an int32 value from the local variable store and pushes it onto the operand stack. - *

This opcode is implemented by the {@link ILoadCommand} class, which defines its specific execution logic.

+ * I_STORE Opcode: Represents a store operation that saves an int32 value from the operand stack into the local variable store. + * + *

This opcode is implemented by the {@link IStoreCommand} class, which defines its specific execution logic.

* *

Execution Steps:

*
    *
  1. Retrieves the index for the local variable from the instruction parameters.
  2. - *
  3. Retrieves the corresponding value from the local variable store of the current method frame.
  4. - *
  5. Pushes the retrieved value onto the operand stack for later operations.
  6. + *
  7. Pops the int32 value from the operand stack.
  8. + *
  9. Stores the value into the local variable store at the specified index of the current method frame.
  10. *
  11. Increments the program counter (PC) to proceed with the next sequential instruction.
  12. *
* *

This opcode is commonly used for:

* */ public static final int I_STORE = 151; + + /** - * L_STORE Opcode: Represents a load operation that retrieves a long64 value from the local variable store and pushes it onto the operand stack. - *

This opcode is implemented by the {@link ILoadCommand} class, which defines its specific execution logic.

+ * L_STORE Opcode: Represents a store operation that stores a long64 value from the operand stack into the local variable store. + *

This opcode is implemented by the {@link LStoreCommand} class, which defines its specific execution logic.

* *

Execution Steps:

*
    *
  1. Retrieves the index for the local variable from the instruction parameters.
  2. - *
  3. Retrieves the corresponding value from the local variable store of the current method frame.
  4. - *
  5. Pushes the retrieved value onto the operand stack for later operations.
  6. + *
  7. Pops a long64 value from the operand stack.
  8. + *
  9. Stores the value into the local variable store at the specified index of the current method frame.
  10. *
  11. Increments the program counter (PC) to proceed with the next sequential instruction.
  12. *
* *

This opcode is commonly used for:

* */ public static final int L_STORE = 152; + /** - * S_LOAD Opcode: Represents a load operation that retrieves a short16 value from the local variable store and pushes it onto the operand stack. - *

This opcode is implemented by the {@link ILoadCommand} class, which defines its specific execution logic.

+ * S_STORE Opcode: Represents a store operation that stores a short16 value from the operand stack into the local variable store. + *

This opcode is implemented by the {@link SStoreCommand} class, which defines its specific execution logic.

* *

Execution Steps:

*
    *
  1. Retrieves the index for the local variable from the instruction parameters.
  2. - *
  3. Retrieves the corresponding value from the local variable store of the current method frame.
  4. - *
  5. Pushes the retrieved value onto the operand stack for later operations.
  6. + *
  7. Pops a short16 value from the operand stack.
  8. + *
  9. Stores the value into the local variable store at the specified index of the current method frame.
  10. *
  11. Increments the program counter (PC) to proceed with the next sequential instruction.
  12. *
* *

This opcode is commonly used for:

* */ public static final int S_STORE = 153; + /** - * B_STORE Opcode: Represents a load operation that retrieves a byte8 value from the local variable store and pushes it onto the operand stack. - *

This opcode is implemented by the {@link ILoadCommand} class, which defines its specific execution logic.

+ * B_STORE Opcode: Represents a store operation that stores a byte8 value from the operand stack into the local variable store. + *

This opcode is implemented by the {@link BStoreCommand} class, which defines its specific execution logic.

* *

Execution Steps:

*
    *
  1. Retrieves the index for the local variable from the instruction parameters.
  2. - *
  3. Retrieves the corresponding value from the local variable store of the current method frame.
  4. - *
  5. Pushes the retrieved value onto the operand stack for later operations.
  6. + *
  7. Pops a byte8 value from the operand stack.
  8. + *
  9. Stores the value into the local variable store at the specified index of the current method frame.
  10. *
  11. Increments the program counter (PC) to proceed with the next sequential instruction.
  12. *
* *

This opcode is commonly used for:

* */ public static final int B_STORE = 154; + /** - * D_STORE Opcode: Represents a load operation that retrieves a double64 value from the local variable store and pushes it onto the operand stack. - *

This opcode is implemented by the {@link ILoadCommand} class, which defines its specific execution logic.

+ * D_STORE Opcode: Represents a store operation that stores a double64 value from the operand stack into the local variable store. + *

This opcode is implemented by the {@link DStoreCommand} class, which defines its specific execution logic.

* *

Execution Steps:

*
    *
  1. Retrieves the index for the local variable from the instruction parameters.
  2. - *
  3. Retrieves the corresponding value from the local variable store of the current method frame.
  4. - *
  5. Pushes the retrieved value onto the operand stack for later operations.
  6. + *
  7. Pops a double64 value from the operand stack.
  8. + *
  9. Stores the value into the local variable store at the specified index of the current method frame.
  10. *
  11. Increments the program counter (PC) to proceed with the next sequential instruction.
  12. *
* *

This opcode is commonly used for:

* */ public static final int D_STORE = 155; /** - * F_STORE Opcode: Represents a load operation that retrieves a float32 value from the local variable store and pushes it onto the operand stack. - *

This opcode is implemented by the {@link ILoadCommand} class, which defines its specific execution logic.

+ * F_STORE Opcode: Represents a store operation that stores a float32 value from the operand stack into the local variable store. + *

This opcode is implemented by the {@link FStoreCommand} class, which defines its specific execution logic.

* *

Execution Steps:

*
    *
  1. Retrieves the index for the local variable from the instruction parameters.
  2. - *
  3. Retrieves the corresponding value from the local variable store of the current method frame.
  4. - *
  5. Pushes the retrieved value onto the operand stack for later operations.
  6. + *
  7. Pops a float32 value from the operand stack.
  8. + *
  9. Stores the value into the local variable store at the specified index of the current method frame.
  10. *
  11. Increments the program counter (PC) to proceed with the next sequential instruction.
  12. *
* *

This opcode is commonly used for:

* */ public static final int F_STORE = 156; @@ -1559,7 +1576,7 @@ public class VMOpCode { public static final int I_LOAD = 161; /** * L_LOAD Opcode: Represents a load operation that retrieves a long64 value from the local variable store and pushes it onto the operand stack. - *

This opcode is implemented by the {@link ILoadCommand} class, which defines its specific execution logic.

+ *

This opcode is implemented by the {@link LLoadCommand} class, which defines its specific execution logic.

* *

Execution Steps:

*
    @@ -1579,7 +1596,7 @@ public class VMOpCode { public static final int L_LOAD = 162; /** * S_LOAD Opcode: Represents a load operation that retrieves a short16 value from the local variable store and pushes it onto the operand stack. - *

    This opcode is implemented by the {@link ILoadCommand} class, which defines its specific execution logic.

    + *

    This opcode is implemented by the {@link SLoadCommand} class, which defines its specific execution logic.

    * *

    Execution Steps:

    *
      @@ -1599,7 +1616,7 @@ public class VMOpCode { public static final int S_LOAD = 163; /** * B_LOAD Opcode: Represents a load operation that retrieves a byte8 value from the local variable store and pushes it onto the operand stack. - *

      This opcode is implemented by the {@link ILoadCommand} class, which defines its specific execution logic.

      + *

      This opcode is implemented by the {@link BLoadCommand} class, which defines its specific execution logic.

      * *

      Execution Steps:

      *
        @@ -1619,7 +1636,7 @@ public class VMOpCode { public static final int B_LOAD = 164; /** * D_LOAD Opcode: Represents a load operation that retrieves a double64 value from the local variable store and pushes it onto the operand stack. - *

        This opcode is implemented by the {@link ILoadCommand} class, which defines its specific execution logic.

        + *

        This opcode is implemented by the {@link DLoadCommand} class, which defines its specific execution logic.

        * *

        Execution Steps:

        *
          @@ -1639,7 +1656,7 @@ public class VMOpCode { public static final int D_LOAD = 165; /** * F_LOAD Opcode: Represents a load operation that retrieves a float32 value from the local variable store and pushes it onto the operand stack. - *

          This opcode is implemented by the {@link ILoadCommand} class, which defines its specific execution logic.

          + *

          This opcode is implemented by the {@link FLoadCommand} class, which defines its specific execution logic.

          * *

          Execution Steps:

          *
            diff --git a/test b/test index 2d4c5b3..f1f4d9f 100644 --- a/test +++ b/test @@ -3,10 +3,11 @@ module: CommonTasks parameter: declare num1: int declare num2: int - return_type:void + return_type:int body: num1 = 10 + return num1 end body end function end module