Array access replacement generates invalid bytecode when padding is required
----------------------------------------------------------------------------
Key: JASSIST-71
URL:
https://jira.jboss.org/jira/browse/JASSIST-71
Project: Javassist
Issue Type: Bug
Reporter: Jason T. Greene
Assignee: Shigeru Chiba
When an array access instruction is replaced before a switch instruction, and padding is
added to align the switch, the array instruction remains, which is invalid:
public void test();
Code:
Stack=2, Locals=2, Args_size=1
0: aconst_null
1: astore_1
2: invokestatic #17; //Method $SWITCH_TABLE$RULE_TYPE:()[I
5: aload_1
6: invokevirtual #20; //Method RULE_TYPE.ordinal:()I
9: invokestatic #67; //Method arrayReadInt:(Ljava/lang/Object;I)I
12: nop
13: iaload <===========================
INVALID!!!!!!!!!!!!
14: tableswitch{ //1 to 1
1: 32;
default: 32 }
32: return
This is typically caught by the bytecode verifier
java.lang.VerifyError: (class: com/lm/dataModel/rules/StatusRule, method:
propagateFromHereOnUpTree signature:
(Lcom/lm/dataModel/ANode;Lcom/lm/dataModel/ANode$Source;Lcom/lm/dataModel/ANode$StatusValue;)Z)
Unable to pop operand off an empty stack
at com.lm.dataModel.ANode.setStatusValueWithPropagation(ANode.java:301)
at com.lm.seem.StatusTableModel.setValueAt(StatusTableModel.java:133)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira