Skip to content

Commit

Permalink
added ByteCodeUtil.getLoadOpCode(int)
Browse files Browse the repository at this point in the history
  • Loading branch information
nbauma109 committed May 5, 2023
1 parent e065061 commit a57610b
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -364,4 +364,15 @@ public static boolean getArrayRefIndex(byte[] code) {
&& (code[1] & 255) == Const.ANEWARRAY
&& (code[4] & 255) == Const.ARETURN;
}

public static int getLoadOpCode(int storeOpCode) {
return switch (storeOpCode) {
case Const.ASTORE -> Const.ALOAD;
case Const.ISTORE -> Const.ILOAD;
case ByteCodeConstants.STORE -> ByteCodeConstants.LOAD;
case Const.PUTFIELD -> Const.GETFIELD;
case Const.PUTSTATIC -> Const.GETSTATIC;
default -> -1;
};
}
}

0 comments on commit a57610b

Please sign in to comment.