/**
* Stack : ACONST_NULL, ALOAD,
* @param opcode
*/
private void stackLocalOperator(int opcode, int popNum){
Stackable top;
switch(opcode){
case NOP :
if(log.isDebugEnabled())
log.debug("Instruction : NOP");
break;
case ACONST_NULL :
if(log.isDebugEnabled())
log.debug("Instruction : ACONST_NULL");
if(nextPushTypes == null){
nextPushTypes = new Type[]{OBJECT_TYPE};
//throw new InternalError("please reference a type");
}
break;
case ICONST_M1 :
if(log.isDebugEnabled())
log.debug("Instruction : ICONST_M1");
nextPushTypes = new Type[]{Type.INT_TYPE};
break;
case ICONST_0 :
if(log.isDebugEnabled())
log.debug("Instruction : ICONST_0");
nextPushTypes = new Type[]{Type.INT_TYPE};
break;
case ICONST_1 :
if(log.isDebugEnabled())
log.debug("Instruction : ICONST_1");
nextPushTypes = new Type[]{Type.INT_TYPE};
break;
case ICONST_2 :
if(log.isDebugEnabled())
log.debug("Instruction : ICONST_2");
nextPushTypes = new Type[]{Type.INT_TYPE};
break;
case ICONST_3 :
if(log.isDebugEnabled())
log.debug("Instruction : ICONST_3");
nextPushTypes = new Type[]{Type.INT_TYPE};
break;
case ICONST_4 :
if(log.isDebugEnabled())
log.debug("Instruction : ICONST_4");
nextPushTypes = new Type[]{Type.INT_TYPE};
break;
case ICONST_5 :
if(log.isDebugEnabled())
log.debug("Instruction : ICONST_5");
nextPushTypes = new Type[]{Type.INT_TYPE};
break;
case LCONST_0 :
if(log.isDebugEnabled())
log.debug("Instruction : LCONST_0");
nextPushTypes = new Type[]{Type.LONG_TYPE};
break;
case LCONST_1 :
if(log.isDebugEnabled())
log.debug("Instruction : LCONST_1");
nextPushTypes = new Type[]{Type.LONG_TYPE};
break;
case FCONST_0 :
if(log.isDebugEnabled())
log.debug("Instruction : FCONST_0");
nextPushTypes = new Type[]{Type.FLOAT_TYPE};
break;
case FCONST_1 :
if(log.isDebugEnabled())
log.debug("Instruction : FCONST_1");
nextPushTypes = new Type[]{Type.FLOAT_TYPE};
break;
case FCONST_2 :
if(log.isDebugEnabled())
log.debug("Instruction : FCONST_2");
nextPushTypes = new Type[]{Type.FLOAT_TYPE};
break;
case DCONST_0 :
if(log.isDebugEnabled())
log.debug("Instruction : DCONST_0");
nextPushTypes = new Type[]{Type.DOUBLE_TYPE};
break;
case DCONST_1 :
if(log.isDebugEnabled())
log.debug("Instruction : DCONST_1");
nextPushTypes = new Type[]{Type.DOUBLE_TYPE};
break;
case BIPUSH :
if(log.isDebugEnabled())
log.debug("Instruction : BIPUSH");
nextPushTypes = new Type[]{Type.INT_TYPE};
break;
case SIPUSH :
if(log.isDebugEnabled())
log.debug("Instruction : SIPUSH");
nextPushTypes = new Type[]{Type.INT_TYPE};
break;
case LDC :
if(log.isDebugEnabled())
log.debug("Instruction : LDC");
if(nextPushTypes == null){
throw new InternalError("please reference a type");
}
break;
case ILOAD :
if(log.isDebugEnabled())
log.debug("Instruction : ILOAD");
nextPushTypes = new Type[]{Type.INT_TYPE};
break;
case LLOAD :
if(log.isDebugEnabled())
log.debug("Instruction : LLOAD");
nextPushTypes = new Type[]{Type.LONG_TYPE};
break;
case FLOAD :
if(log.isDebugEnabled())
log.debug("Instruction : FLOAD");
nextPushTypes = new Type[]{Type.FLOAT_TYPE};
break;
case DLOAD :
if(log.isDebugEnabled())
log.debug("Instruction : DLOAD");
nextPushTypes = new Type[]{Type.DOUBLE_TYPE};
break;
case ALOAD :
if(log.isDebugEnabled())
log.debug("Instruction : ALOAD");
if(nextPushTypes == null){
nextPushTypes = new Type[]{OBJECT_TYPE};
//throw new InternalError("please reference a type");
}
break;
case IALOAD :
if(log.isDebugEnabled())
log.debug("Instruction : IALOAD");
//pop index
stack.pop();
//pop array reference
stack.pop();
nextPushTypes = new Type[]{Type.INT_TYPE};
break;
case LALOAD :
if(log.isDebugEnabled())
log.debug("Instruction : LALOAD");
//pop index
stack.pop();
//pop array reference
stack.pop();
nextPushTypes = new Type[]{Type.LONG_TYPE};
break;
case FALOAD :
if(log.isDebugEnabled())
log.debug("Instruction : FALOAD");
//pop index
stack.pop();
//pop array reference
stack.pop();
nextPushTypes = new Type[]{Type.FLOAT_TYPE};
break;
case DALOAD :
if(log.isDebugEnabled())
log.debug("Instruction : DALOAD");
//pop index
stack.pop();
//pop array reference
stack.pop();
nextPushTypes = new Type[]{Type.DOUBLE_TYPE};
break;
case AALOAD :
if(log.isDebugEnabled())
log.debug("Instruction : AALOAD");
//pop index
stack.pop();
//pop array reference
top = stack.pop();
Type nextEleType = Type.getType(top.getType().getDescriptor().substring(1));
this.setNextPushTypes(nextEleType);
break;
case BALOAD :
if(log.isDebugEnabled())
log.debug("Instruction : BALOAD");
//pop index
stack.pop();
//pop array reference
stack.pop();
nextPushTypes = new Type[]{Type.BYTE_TYPE};
break;
case CALOAD :
if(log.isDebugEnabled())
log.debug("Instruction : CALOAD");
//pop index
stack.pop();
//pop array reference
stack.pop();
nextPushTypes = new Type[]{Type.CHAR_TYPE};
break;
case SALOAD :
if(log.isDebugEnabled())
log.debug("Instruction : SALOAD");
//pop index
stack.pop();
//pop array reference
stack.pop();
nextPushTypes = new Type[]{Type.SHORT_TYPE};
break;
case ISTORE :
if(log.isDebugEnabled())
log.debug("Instruction : ISTORE");
stack.pop();
break;
case LSTORE :
if(log.isDebugEnabled())
log.debug("Instruction : LSTORE");
stack.pop();
break;
case FSTORE :
if(log.isDebugEnabled())
log.debug("Instruction : FSTORE");
stack.pop();
break;
case DSTORE :
if(log.isDebugEnabled())
log.debug("Instruction : DSTORE");
stack.pop();
break;
case ASTORE :
if(log.isDebugEnabled())
log.debug("Instruction : ASTORE");
stack.pop();
break;
case IASTORE :
if(log.isDebugEnabled())
log.debug("Instruction : IASTORE");
//pop value
stack.pop();
//pop index
stack.pop();
//pop array reference
stack.pop();
break;
case LASTORE :
if(log.isDebugEnabled())
log.debug("Instruction : LASTORE");
//pop value
stack.pop();
//pop index
stack.pop();
//pop array reference
stack.pop();
break;
case FASTORE :
if(log.isDebugEnabled())
log.debug("Instruction : FASTORE");
//pop value
stack.pop();
//pop index
stack.pop();
//pop array reference
stack.pop();
break;
case DASTORE :
if(log.isDebugEnabled())
log.debug("Instruction : DASTORE");
//pop value
stack.pop();
//pop index
stack.pop();
//pop array reference
stack.pop();
break;
case AASTORE :
if(log.isDebugEnabled())
log.debug("Instruction : AASTORE");
//pop value
stack.pop();
//pop index
stack.pop();
//pop array reference
stack.pop();
break;
case BASTORE :
if(log.isDebugEnabled())
log.debug("Instruction : BASTORE");
//pop value
stack.pop();
//pop index
stack.pop();
//pop array reference
stack.pop();
break;
case CASTORE :
if(log.isDebugEnabled())
log.debug("Instruction : CASTORE");
//pop value
stack.pop();
//pop index
stack.pop();
//pop array reference
stack.pop();
break;
case SASTORE :
if(log.isDebugEnabled())
log.debug("Instruction : SASTORE");
//pop value
stack.pop();
//pop index
stack.pop();
//pop array reference
stack.pop();
break;
case POP :
if(log.isDebugEnabled())
log.debug("Instruction : POP");
stack.pop();
break;
case POP2 :
if(log.isDebugEnabled())
log.debug("Instruction : POP2");
stack.pop(2);
break;
case DUP :
if(log.isDebugEnabled())
log.debug("Instruction : DUP");
top = stack.peek();
if(top.getSize() == 1){
setNextPushTypes(top.getType());
}else{
throw new InstructionException("two word value off the operand stack", DUP, (Stack)stack.clone());
}
break;
case DUP_X1 :
if(log.isDebugEnabled())
log.debug("Instruction : DUP_X1");
top = stack.peek();
if(top.getSize() == 1){
stack.insert(2, top);
}else{
throw new InstructionException("two word value off the operand stack", DUP_X1, (Stack)stack.clone());
}
break;
case DUP_X2 :
if(log.isDebugEnabled())
log.debug("Instruction : DUP_X2");
top = stack.peek();
if(top.getSize() == 1){
stack.insert(3, top);
}else{
throw new InstructionException("two word value off the operand stack", DUP_X2, (Stack)stack.clone());
}
break;