mirror of
https://github.com/FranzHaidnor/haidnorJVM.git
synced 2026-03-14 06:03:50 +08:00
add WIDE Instruction
This commit is contained in:
@@ -607,7 +607,7 @@ public abstract class InstructionFactory {
|
|||||||
return new MONITOREXIT(codeStream);
|
return new MONITOREXIT(codeStream);
|
||||||
}
|
}
|
||||||
case Const.WIDE -> {
|
case Const.WIDE -> {
|
||||||
throw new Error("Not support JavaVM opcode WIDE");
|
return new WIDE(codeStream);
|
||||||
}
|
}
|
||||||
case Const.MULTIANEWARRAY -> {
|
case Const.MULTIANEWARRAY -> {
|
||||||
return new MULTIANEWARRAY(codeStream);
|
return new MULTIANEWARRAY(codeStream);
|
||||||
|
|||||||
40
src/main/java/haidnor/jvm/instruction/extended/WIDE.java
Normal file
40
src/main/java/haidnor/jvm/instruction/extended/WIDE.java
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
package haidnor.jvm.instruction.extended;
|
||||||
|
|
||||||
|
import haidnor.jvm.instruction.Instruction;
|
||||||
|
import haidnor.jvm.instruction.loads.*;
|
||||||
|
import haidnor.jvm.instruction.math.IINC;
|
||||||
|
import haidnor.jvm.instruction.stores.*;
|
||||||
|
import haidnor.jvm.runtime.Frame;
|
||||||
|
import haidnor.jvm.util.CodeStream;
|
||||||
|
|
||||||
|
public class WIDE extends Instruction {
|
||||||
|
|
||||||
|
private final Instruction instruction;
|
||||||
|
|
||||||
|
public WIDE(CodeStream codeStream) {
|
||||||
|
super(codeStream);
|
||||||
|
int wideOpcode = codeStream.readShort(this);
|
||||||
|
|
||||||
|
switch (wideOpcode) {
|
||||||
|
case 0x84 -> instruction = new IINC(codeStream);
|
||||||
|
case 0x15 -> instruction = new ILOAD(codeStream);
|
||||||
|
case 0x17 -> instruction = new FLOAD(codeStream);
|
||||||
|
case 0x19 -> instruction = new ALOAD(codeStream);
|
||||||
|
case 0x16 -> instruction = new LLOAD(codeStream);
|
||||||
|
case 0x18 -> instruction = new DLOAD(codeStream);
|
||||||
|
case 0x36 -> instruction = new ISTORE(codeStream);
|
||||||
|
case 0x38 -> instruction = new FSTORE(codeStream);
|
||||||
|
case 0x3a -> instruction = new ASTORE(codeStream);
|
||||||
|
case 0x37 -> instruction = new LSTORE(codeStream);
|
||||||
|
case 0x39 -> instruction = new DSTORE(codeStream);
|
||||||
|
case 0xa9 -> throw new UnsupportedOperationException(); // ret, ignore
|
||||||
|
default -> throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(Frame frame) {
|
||||||
|
instruction.execute(frame);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user