Skip to content

Commit

Permalink
Merge pull request #3313 from fengxue-IS/condyWriterFix
Browse files Browse the repository at this point in the history
Fix Constant_Dynamic index for ldc2_w bytecode
  • Loading branch information
DanHeidinga authored Oct 18, 2018
2 parents 071ef5c + 58662ae commit b037816
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions runtime/bcutil/ClassFileWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1244,8 +1244,14 @@ ClassFileWriter::rewriteBytecode(J9ROMMethod * method, U_32 length, U_8 * code)
case JBldc2lw: {
code[index] = CFR_BC_ldc2_w;
U_16 cpIndex = *(U_16 *)(code + index + 1);
/* Adjust index of double/long CP entry */
cpIndex = cpIndex + (cpIndex - _romClass->ramConstantPoolCount);
U_32 * cpShapeDescription = J9ROMCLASS_CPSHAPEDESCRIPTION(_romClass);

if (J9CPTYPE_CONSTANT_DYNAMIC != J9_CP_TYPE(cpShapeDescription, cpIndex)) {
/* Adjust index of double/long CP entry. Not necessary for Constant_Dynamic as
* its already in the RAM CP while double/long are sorted to the end.
*/
cpIndex = cpIndex + (cpIndex - _romClass->ramConstantPoolCount);
}
writeU16At(cpIndex, code + index + 1);
}
break;
Expand Down

0 comments on commit b037816

Please sign in to comment.