RFR: 8178490: Usages of is_object_aligned with pointers are broken

Kim Barrett kim.barrett at oracle.com
Sat Jun 24 18:03:52 UTC 2017


> On Jun 22, 2017, at 5:16 AM, Stefan Karlsson <stefan.karlsson at oracle.com> wrote:
> 
> Hi all,
> 
> Please review this patch to fix and strengthen is_object_aligned checks when pointers are passed in:
> 
> http://cr.openjdk.java.net/~stefank/8178490/webrev.00/
> https://bugs.openjdk.java.net/browse/JDK-8178490
> 
> is_object_aligned only works correctly for sizes measured in words.
> 
> When a pointer is passed into:
> 
> inline bool is_object_aligned(intptr_t addr) {
>  return addr == align_object_size(addr);
> }
> 
> inline intptr_t align_object_size(intptr_t size) { 
>  return align_size_up(size, MinObjAlignment); 
> }
> 
> the pointer is incorrectly interpreted as a word size and the alignment is checked against MinObjectAligment instead of MinObjectAlignmentInBytes
> 
> Tested with JPRT together with different patches for:
> 8178489 Make align functions more type safe and consistent
> 
> Thanks,
> StefanK

Looks good.




More information about the hotspot-gc-dev mailing list