RFR 8191278: MappedByteBuffer bulk access memory failures are not handled gracefully

Daniel D. Daugherty daniel.daugherty at oracle.com
Sat Jun 1 12:59:28 UTC 2019


That's even better. Thanks.

Dan


On 6/1/19 5:11 AM, Jamsheed wrote:
>
> Hi Dan,
>
> updated webrev in place
>
> added only assert
>
> +  BasicType doing_unsafe_access_bt = T_BYTE;
> +  assert((sizeof(bool) * CHAR_BIT) == 8, "not implemented");
>
> Best regards,
>
> Jamsheed
>
> On 01/06/19 12:56 PM, Jamsheed wrote:
>>
>> Hi Dan,
>>
>> i understand it is incorrect to assume bool(cpp compiler) 
>> implementation above byte level.
>>
>> in that case i will just put an assert.
>>
>> +  BasicType doing_unsafe_access_bt = T_BYTE;
>>
>> + assert(sizeof(bool) == 1, "not implemented");
>>
>> Best regards,
>>
>> Jamsheed
>>
>> On 31/05/19 10:34 PM, Jamsheed wrote:
>>>> src/hotspot/share/opto/library_call.cpp
>>>>     In src/hotspot/share/runtime/thread.hpp:
>>>>     L1090:   volatile bool         _doing_unsafe_access;
>>>>
>>>>     L4220:   store_to_memory(control(), doing_unsafe_access_addr, 
>>>> intcon(1), T_BYTE, Compile::AliasIdxRaw, MemNode::unordered);
>>>>     L4230:   store_to_memory(control(), doing_unsafe_access_addr, 
>>>> intcon(0), T_BYTE, Compile::AliasIdxRaw, MemNode::unordered);
>>>>         Is T_BYTE a safe assumption (size wise) for writing to a 
>>>> C++ bool?
>>>
>>> Thanks for pointing this.
>>>
>>> hope [1] will work ?
>> [1]
>> +  BasicType doing_unsafe_access_bt = T_BYTE;
>> +  switch(sizeof(bool)) {
>> +    case 1: doing_unsafe_access_bt = T_BYTE;  break;
>> +    case 2: doing_unsafe_access_bt = T_SHORT; break;
>> +    case 4: doing_unsafe_access_bt = T_INT;   break;
>> +    case 8: doing_unsafe_access_bt = T_LONG;  break;
>> +    default: ShouldNotReachHere();
>> +  }
>>
>>    // update volatile field
>> -  store_to_memory(control(), doing_unsafe_access_addr, intcon(1), 
>> T_BYTE, Compile::AliasIdxRaw, MemNode::unordered);
>> +  store_to_memory(control(), doing_unsafe_access_addr, intcon(1), 
>> doing_unsafe_access_bt, Compile::AliasIdxRaw, MemNode::unordered);
>>
>>    // Call it.  Note that the length argument is not scaled.
>>    make_runtime_call(RC_LEAF|RC_NO_FP,
>>                      OptoRuntime::fast_arraycopy_Type(),
>>                      StubRoutines::unsafe_arraycopy(),
>>                      "unsafe_arraycopy",
>>                      TypeRawPtr::BOTTOM,
>>                      src, dst, size XTOP);
>>
>> -  store_to_memory(control(), doing_unsafe_access_addr, intcon(0), 
>> T_BYTE, Compile::AliasIdxRaw, MemNode::unordered);
>> +  store_to_memory(control(), doing_unsafe_access_addr, intcon(0), 
>> doing_unsafe_access_bt, Compile::AliasIdxRaw, MemNode::unordered); 



More information about the hotspot-dev mailing list