diff --git a/README.md b/README.md index 343cab3..3221b66 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,7 @@ # 局限性 * 不支持多线程 +* 不支持多维数组 * 垃圾回收依靠宿主 JVM # 快速体验 diff --git a/src/main/java/haidnor/jvm/instruction/InstructionFactory.java b/src/main/java/haidnor/jvm/instruction/InstructionFactory.java index c559f8e..f841378 100644 --- a/src/main/java/haidnor/jvm/instruction/InstructionFactory.java +++ b/src/main/java/haidnor/jvm/instruction/InstructionFactory.java @@ -4,10 +4,7 @@ import haidnor.jvm.instruction.comparisons.*; import haidnor.jvm.instruction.constants.*; import haidnor.jvm.instruction.control.*; import haidnor.jvm.instruction.conversions.*; -import haidnor.jvm.instruction.extended.GOTO; -import haidnor.jvm.instruction.extended.GOTO_W; -import haidnor.jvm.instruction.extended.IFNONNULL; -import haidnor.jvm.instruction.extended.IFNULL; +import haidnor.jvm.instruction.extended.*; import haidnor.jvm.instruction.loads.*; import haidnor.jvm.instruction.math.*; import haidnor.jvm.instruction.references.*; @@ -613,7 +610,7 @@ public abstract class InstructionFactory { throw new Error("Not support JavaVM opcode WIDE"); } case Const.MULTIANEWARRAY -> { - throw new Error("Not support JavaVM opcode MULTIANEWARRAY"); + return new MULTIANEWARRAY(codeStream); } case Const.IFNULL -> { return new IFNULL(codeStream); diff --git a/src/main/java/haidnor/jvm/instruction/extended/MULTIANEWARRAY.java b/src/main/java/haidnor/jvm/instruction/extended/MULTIANEWARRAY.java new file mode 100644 index 0000000..1833c97 --- /dev/null +++ b/src/main/java/haidnor/jvm/instruction/extended/MULTIANEWARRAY.java @@ -0,0 +1,25 @@ +package haidnor.jvm.instruction.extended; + +import haidnor.jvm.instruction.Instruction; +import haidnor.jvm.runtime.Frame; +import haidnor.jvm.util.CodeStream; + +public class MULTIANEWARRAY extends Instruction { + + public final int index; + public final int dimensions; + + public MULTIANEWARRAY(CodeStream codeStream) { + super(codeStream); + this.index = codeStream.readUnsignedShort(this); + this.dimensions = codeStream.readUnsignedByte(this); + + throw new UnsupportedOperationException("MULTIANEWARRAY"); + } + + @Override + public void execute(Frame frame) { + throw new UnsupportedOperationException("MULTIANEWARRAY"); + } + +}