Skip to content

Commit

Permalink
Adding invariant to check instruction is normal wide
Browse files Browse the repository at this point in the history
Only specific instructions can follow a wide byte.
  • Loading branch information
thk123 committed Feb 26, 2018
1 parent 60af165 commit 004626c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/java_bytecode/java_bytecode_parser.cpp
Expand Up @@ -711,6 +711,13 @@ void java_bytecode_parsert::rbytecode(
wide_instruction=true;
address++;
bytecode=read_u1();
// The only valid instructions following a wide byte are
// [ifald]load, [ifald]store, ret and iinc
// All of these have either format of v, or V
INVARIANT(
bytecodes[bytecode].format == 'v' || bytecodes[bytecode].format == 'V',
"Unexpected wide instruction: " +
id2string(bytecodes[bytecode].mnemonic));
}

instructions.push_back(instructiont());
Expand Down

0 comments on commit 004626c

Please sign in to comment.