diff options
| author | 2016-06-29 21:45:10 +0100 | |
|---|---|---|
| committer | 2016-06-29 21:45:10 +0100 | |
| commit | 350cc99ff3937260ff933d6bc6b033882add2adb (patch) | |
| tree | 4c87d07d6f2291f35d256e00fd983a2b5375108c | |
| parent | 8bf8117c6b421d4e81c2be76825ffc83703f1ef1 (diff) | |
Also add the monitor offset as a potential implicit NPE.
We access the monitor in read barrier configurations.
Change-Id: Ifbdf8ec7734a10cd7d1e965875d72a59960d13ca
| -rw-r--r-- | runtime/common_throws.cc | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/runtime/common_throws.cc b/runtime/common_throws.cc index 60f45cd633..912a74a52a 100644 --- a/runtime/common_throws.cc +++ b/runtime/common_throws.cc @@ -438,11 +438,11 @@ static bool IsValidImplicitCheck(uintptr_t addr, ArtMethod* method, const Instru case Instruction::IPUT_BYTE: case Instruction::IPUT_CHAR: case Instruction::IPUT_SHORT: { - // Check that the fault address is at the offset of the field or null. The compiler - // can generate both. ArtField* field = Runtime::Current()->GetClassLinker()->ResolveField(instr.VRegC_22c(), method, false); - return (addr == 0) || (addr == field->GetOffset().Uint32Value()); + return (addr == 0) || + (addr == field->GetOffset().Uint32Value()) || + (kEmitCompilerReadBarrier && (addr == mirror::Object::MonitorOffset().Uint32Value())); } case Instruction::IGET_QUICK: @@ -459,9 +459,9 @@ static bool IsValidImplicitCheck(uintptr_t addr, ArtMethod* method, const Instru case Instruction::IPUT_SHORT_QUICK: case Instruction::IPUT_WIDE_QUICK: case Instruction::IPUT_OBJECT_QUICK: { - // Check that the fault address is at the offset in the quickened instruction or null. - // The compiler can generate both. - return (addr == 0u) || (addr == instr.VRegC_22c()); + return (addr == 0u) || + (addr == instr.VRegC_22c()) || + (kEmitCompilerReadBarrier && (addr == mirror::Object::MonitorOffset().Uint32Value())); } case Instruction::AGET: @@ -477,21 +477,14 @@ static bool IsValidImplicitCheck(uintptr_t addr, ArtMethod* method, const Instru case Instruction::APUT_BOOLEAN: case Instruction::APUT_BYTE: case Instruction::APUT_CHAR: - case Instruction::APUT_SHORT: { - // The length access should crash. We currently do not do implicit checks on - // the array access itself. - return (addr == 0u) || (addr == mirror::Array::LengthOffset().Uint32Value()); - } - - case Instruction::FILL_ARRAY_DATA: { + case Instruction::APUT_SHORT: + case Instruction::FILL_ARRAY_DATA: + case Instruction::ARRAY_LENGTH: { // The length access should crash. We currently do not do implicit checks on // the array access itself. - return (addr == 0u) || (addr == mirror::Array::LengthOffset().Uint32Value()); - } - - case Instruction::ARRAY_LENGTH: { - // The length access should crash. - return (addr == 0u) || (addr == mirror::Array::LengthOffset().Uint32Value()); + return (addr == 0u) || + (addr == mirror::Array::LengthOffset().Uint32Value()) || + (kEmitCompilerReadBarrier && (addr == mirror::Object::MonitorOffset().Uint32Value())); } default: { |