RFR Checks in Pointer.cast(LayoutType)
Sundararajan Athijegannathan
sundararajan.athijegannathan at oracle.com
Tue Jun 19 07:19:23 UTC 2018
Hi Samuel,
For now, yes. But we've to revisit to revisit Pointer.cast(LayoutType).
safe vs unsafe casts, "layout vs carrier type cast vs both" casts
options will have to be refactored.
-Sundar
On 19/06/18, 3:17 AM, Samuel Audet wrote:
> Sometimes we do need to cast between incompatible types though. Is the
> idea to first force a cast to void*?
>
> Samuel
>
> On 06/19/2018 12:23 AM, Maurizio Cimadamore wrote:
>> I like it. Very simple, yet it goes a long way in order to prevent
>> silly mistakes.
>>
>> Maurizio
>>
>>
>> On 18/06/18 15:41, Sundararajan Athijegannathan wrote:
>>> Pointer.cast(LayoutType) does not perform any checks as of now. Cast
>>> to any destination pointee LayoutType is allowed. I've added
>>> Layout.equals/.hashCode & simple checks in Pointer.cast(LayoutType)
>>> for now. For now, cast from any pointer to void* and vice versa is
>>> allowed. When pointee layouts are equal, the cast is allowed. Any
>>> other case results in exception.
>>>
>>> Please review:
>>> http://cr.openjdk.java.net/~sundar/pointer_cast_checks/webrev.01/
>>>
>>> Thanks,
>>> -Sundar
>>
>
More information about the panama-dev
mailing list