Skip to content

Commit

Permalink
Check for boolean array when running bastore bytecode
Browse files Browse the repository at this point in the history
The JVM spec states: "If the arrayref refers to an array whose
components are of type boolean, then the int value is narrowed by taking
the bitwise AND of value and 1; the result is stored as the component of
the array indexed by index"

Signed-off-by: tajila <atobia@ca.ibm.com>
  • Loading branch information
tajila committed May 31, 2018
1 parent fd05df0 commit 71a27ca
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions runtime/vm/BytecodeInterpreter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5543,6 +5543,9 @@ done:;
I_8 value = (I_8)*(I_32*)_sp;
_pc += 1;
_sp += 3;
if (J9OBJECT_CLAZZ(_currentThread, arrayref) == _vm->booleanArrayClass) {
value &= 1;
}
_objectAccessBarrier.inlineIndexableObjectStoreI8(_currentThread, arrayref, index, value);
}
}
Expand Down

0 comments on commit 71a27ca

Please sign in to comment.