Please review - Fixed code section alignment in JIT mode

Demikhovsky, Elena elena.demikhovsky at intel.com
Tue Jul 2 05:12:35 PDT 2013


Hi Tim,

I added a test to JIT Memory Manager and fixed the code.

-  Elena

-----Original Message-----
From: Tim Northover [mailto:t.p.northover at gmail.com] 
Sent: Tuesday, July 02, 2013 13:16
To: Demikhovsky, Elena
Cc: llvm-commits at cs.uiuc.edu
Subject: Re: Please review - Fixed code section alignment in JIT mode

Hi Elena,

+      // Alignement handling.

Typo.

+      uintptr_t unalignedAddr = (uintptr_t)CurBlock +
sizeof(MemoryRangeHeader);

This makes the function inconsistent about the extra space needed (at the beginning it's sizeof(CurBlock), here it's sizeof(MemoryRangeHeader)). It's harmless, but also benefitless as far as I can tell. It would probably be better to pick one.

+      return (uint8_t *)((unalignedAddr + Alignment - 1) &
+                     ~(uintptr_t)(Alignment - 1));

There's a nice support function in the llvm namespace called RoundUpToAlignment. I think it would make this line clearer.

Also, does this cause breakage on existing JIT tests or can you add one?

Cheers.

Tim.
---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jit_align.diff
Type: application/octet-stream
Size: 2422 bytes
Desc: jit_align.diff
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130702/afe28409/attachment.obj>


More information about the llvm-commits mailing list