[cfe-dev] increase size of function pointer?

Andrew Fish afish at apple.com
Thu Jun 2 09:04:17 PDT 2011


On Jun 1, 2011, at 8:50 PM, ret val wrote:

> I  mean pointers to functions unfortunately. I guess this will be more interesting that I thought. Any specific advice?
> 
This makes me think of the early days of EFI on the Intel(r) Itanium(r) Processors. An indirect procedure call on Itanium is through a Plabel. So a function pointer points to a Plabel that contains the function address and a value to load into the gp register. 

Maybe you could make the first 4-8 bytes of the 4K page contain the pointer to the function, and make the code gen for function calls indirect the extra layer. You would end up needing relocations for both the "Plabel" and the function pointer, which should not be a big deal, but could really confuse what ever linker you are using. This would solve the cast to void* issue, but could create its own set of issues?

Some one else would need to comment on how practical this would be....  Good luck.


Andrew Fish


> Thank again
> 
> On Wed, Jun 1, 2011 at 5:55 PM, John McCall <rjmccall at apple.com> wrote:
> On Jun 1, 2011, at 12:48 PM, ret val wrote:
> > I would like to be able to increase the size allocated for normal function pointers so they each fill a entire (virtual memory) page.
> 
> Do you mean that you want each *function* to occupy its own
> VM page, or do you really mean that you want function *pointers*
> to grow from 4-8 bytes apiece to 4KB?
> 
> The best way of doing the former is to specify a huge alignment for
> the function.  The latter is likely to break a lot of code that assumes
> (yes, technically contrary to the standards) that function pointers
> can be losslessly cast to, say, void*.
> 
> John.
> 
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110602/28624062/attachment.html>


More information about the cfe-dev mailing list