1 package jrre.instructionset.controlflow;
2
3 import jrre.Stack;
4 import jrre.types.*;
5
6 public class If_icmpeq extends jrre.instructionset.Instruction {
7
8 int operandOne;
9 int operandTwo;
10
11 public If_icmpeq(int operandOne, int operandTwo){
12
13 this.operandOne = operandOne;
14 this.operandTwo = operandTwo;
15
16 name = "if_icmpeq";
17 description = "foo foo moo poo";
18 length = 2;
19 }
20
21 public void execute(){
22
23 Type valueTwo = Stack.popOperand();
24 Type valueOne = Stack.popOperand();
25
26 if(valueTwo instanceof CharType) {
27 if(((CharType)valueOne).getValue() == ((CharType)valueTwo).getValue()){
28
29 int offset = (operandOne << 8) | operandTwo;
30 Stack.branch(offset - 2);
31 }
32 }
33 else {
34 if(((PrimitiveType)valueOne).getValue() == ((PrimitiveType)valueTwo).getValue()){
35
36 int offset = (operandOne << 8) | operandTwo;
37 Stack.branch(offset - 2);
38 }
39 }
40 }
41
42 public String toString(){
43 return "if_icmpeq";
44 }
45 }
This page was automatically generated by Maven