mirror of
https://github.com/FranzHaidnor/haidnorJVM.git
synced 2026-04-01 04:03:41 +08:00
add return 系列字节码指令的抽象类
This commit is contained in:
@@ -102,8 +102,8 @@ public class JavaExecutionEngine {
|
|||||||
try {
|
try {
|
||||||
// 执行字节码指令
|
// 执行字节码指令
|
||||||
instruction.execute(frame);
|
instruction.execute(frame);
|
||||||
// 若为 return 系列指令则结束当前栈帧
|
// 若为 return 系列指令则结束当前栈帧 (RETURN,ARETURN,DRETURN,FRETURN,IRETURN)
|
||||||
if (instruction instanceof RETURN || instruction instanceof ARETURN || instruction instanceof DRETURN || instruction instanceof FRETURN || instruction instanceof IRETURN) {
|
if (instruction instanceof ReturnableInstruction) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// 程序计数器值增加. 指向下一次执行的字节码行号
|
// 程序计数器值增加. 指向下一次执行的字节码行号
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
package haidnor.jvm.instruction.control;
|
package haidnor.jvm.instruction.control;
|
||||||
|
|
||||||
import haidnor.jvm.instruction.Instruction;
|
|
||||||
import haidnor.jvm.runtime.Frame;
|
import haidnor.jvm.runtime.Frame;
|
||||||
import haidnor.jvm.runtime.StackValue;
|
import haidnor.jvm.runtime.StackValue;
|
||||||
import haidnor.jvm.util.CodeStream;
|
import haidnor.jvm.util.CodeStream;
|
||||||
import haidnor.jvm.util.JvmThreadHolder;
|
import haidnor.jvm.util.JvmThreadHolder;
|
||||||
|
|
||||||
public class ARETURN extends Instruction {
|
public class ARETURN extends ReturnableInstruction {
|
||||||
|
|
||||||
public ARETURN(CodeStream codeStream) {
|
public ARETURN(CodeStream codeStream) {
|
||||||
super(codeStream);
|
super(codeStream);
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
package haidnor.jvm.instruction.control;
|
package haidnor.jvm.instruction.control;
|
||||||
|
|
||||||
import haidnor.jvm.instruction.Instruction;
|
|
||||||
import haidnor.jvm.runtime.Frame;
|
import haidnor.jvm.runtime.Frame;
|
||||||
import haidnor.jvm.runtime.StackValue;
|
import haidnor.jvm.runtime.StackValue;
|
||||||
import haidnor.jvm.util.CodeStream;
|
import haidnor.jvm.util.CodeStream;
|
||||||
import haidnor.jvm.util.JvmThreadHolder;
|
import haidnor.jvm.util.JvmThreadHolder;
|
||||||
|
|
||||||
public class DRETURN extends Instruction {
|
public class DRETURN extends ReturnableInstruction {
|
||||||
|
|
||||||
public DRETURN(CodeStream codeStream) {
|
public DRETURN(CodeStream codeStream) {
|
||||||
super(codeStream);
|
super(codeStream);
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
package haidnor.jvm.instruction.control;
|
package haidnor.jvm.instruction.control;
|
||||||
|
|
||||||
import haidnor.jvm.instruction.Instruction;
|
|
||||||
import haidnor.jvm.runtime.Frame;
|
import haidnor.jvm.runtime.Frame;
|
||||||
import haidnor.jvm.runtime.StackValue;
|
import haidnor.jvm.runtime.StackValue;
|
||||||
import haidnor.jvm.util.CodeStream;
|
import haidnor.jvm.util.CodeStream;
|
||||||
import haidnor.jvm.util.JvmThreadHolder;
|
import haidnor.jvm.util.JvmThreadHolder;
|
||||||
|
|
||||||
public class FRETURN extends Instruction {
|
public class FRETURN extends ReturnableInstruction {
|
||||||
|
|
||||||
public FRETURN(CodeStream codeStream) {
|
public FRETURN(CodeStream codeStream) {
|
||||||
super(codeStream);
|
super(codeStream);
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
package haidnor.jvm.instruction.control;
|
package haidnor.jvm.instruction.control;
|
||||||
|
|
||||||
import haidnor.jvm.instruction.Instruction;
|
|
||||||
import haidnor.jvm.runtime.Frame;
|
import haidnor.jvm.runtime.Frame;
|
||||||
import haidnor.jvm.runtime.StackValue;
|
import haidnor.jvm.runtime.StackValue;
|
||||||
import haidnor.jvm.util.CodeStream;
|
import haidnor.jvm.util.CodeStream;
|
||||||
import haidnor.jvm.util.JvmThreadHolder;
|
import haidnor.jvm.util.JvmThreadHolder;
|
||||||
|
|
||||||
public class IRETURN extends Instruction {
|
public class IRETURN extends ReturnableInstruction {
|
||||||
|
|
||||||
public IRETURN(CodeStream codeStream) {
|
public IRETURN(CodeStream codeStream) {
|
||||||
super(codeStream);
|
super(codeStream);
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
package haidnor.jvm.instruction.control;
|
package haidnor.jvm.instruction.control;
|
||||||
|
|
||||||
import haidnor.jvm.instruction.Instruction;
|
|
||||||
import haidnor.jvm.runtime.Frame;
|
import haidnor.jvm.runtime.Frame;
|
||||||
import haidnor.jvm.runtime.StackValue;
|
import haidnor.jvm.runtime.StackValue;
|
||||||
import haidnor.jvm.util.CodeStream;
|
import haidnor.jvm.util.CodeStream;
|
||||||
import haidnor.jvm.util.JvmThreadHolder;
|
import haidnor.jvm.util.JvmThreadHolder;
|
||||||
|
|
||||||
public class LRETURN extends Instruction {
|
public class LRETURN extends ReturnableInstruction {
|
||||||
|
|
||||||
public LRETURN(CodeStream codeStream) {
|
public LRETURN(CodeStream codeStream) {
|
||||||
super(codeStream);
|
super(codeStream);
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
package haidnor.jvm.instruction.control;
|
package haidnor.jvm.instruction.control;
|
||||||
|
|
||||||
import haidnor.jvm.instruction.Instruction;
|
|
||||||
import haidnor.jvm.runtime.Frame;
|
import haidnor.jvm.runtime.Frame;
|
||||||
import haidnor.jvm.util.CodeStream;
|
import haidnor.jvm.util.CodeStream;
|
||||||
import haidnor.jvm.util.JvmThreadHolder;
|
import haidnor.jvm.util.JvmThreadHolder;
|
||||||
|
|
||||||
public class RETURN extends Instruction {
|
public class RETURN extends ReturnableInstruction {
|
||||||
|
|
||||||
public RETURN(CodeStream codeStream) {
|
public RETURN(CodeStream codeStream) {
|
||||||
super(codeStream);
|
super(codeStream);
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package haidnor.jvm.instruction.control;
|
||||||
|
|
||||||
|
import haidnor.jvm.instruction.Instruction;
|
||||||
|
import haidnor.jvm.util.CodeStream;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* return 系列字节码指令的抽象类
|
||||||
|
*/
|
||||||
|
public abstract class ReturnableInstruction extends Instruction {
|
||||||
|
|
||||||
|
public ReturnableInstruction(CodeStream codeStream) {
|
||||||
|
super(codeStream);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user