Re: [llvm-commits] Trampoline changes

2007-09-28 Thread Chris Lattner
On Sep 28, 2007, at 2:38 PM, Duncan Sands wrote: > Hi Chris, > >>> Also >>> 5. Within foo, you need to check that nothing too complicated is >>> done to P1, for example it isn't stored in a global or passed to >>> some other function. >> >> Actually, worse case, you could just make a trampoline i

Re: [llvm-commits] Trampoline changes

2007-09-28 Thread Duncan Sands
Hi Chris, > > Also > > 5. Within foo, you need to check that nothing too complicated is > > done to P1, for example it isn't stored in a global or passed to > > some other function. > > Actually, worse case, you could just make a trampoline in foo. > However, you're right that this is only wor

Re: [llvm-commits] Trampoline changes

2007-09-28 Thread Chris Lattner
>> It is very feasible and would be pretty straight-forward. Consider >> this code in C: >> >> static void foo(funcptr_t P) { >>P(); >> } >> >> void a() { >>tmp = maketrampoline(somefunc1, somedata); >>foo(tmp); >> } >> void b() { >>tmp = maketrampoline(somefunc2, somedata); >>

Re: [llvm-commits] Trampoline changes

2007-09-28 Thread Duncan Sands
Hi Chris, > >>> My hope was that some of these trampoline calls could be eliminated > >>> using this optimization. But for... > >> > >> It would be pretty straight-forward to implement an IPO pass that > >> turns trampoline pointers into fat pointers in cases like this. > > > > that's a very inte

Re: [llvm-commits] Trampoline changes

2007-09-28 Thread Chris Lattner
On Sep 17, 2007, at 3:45 AM, Duncan Sands wrote: >>> My hope was that some of these trampoline calls could be eliminated >>> using this optimization. But for... >> >> It would be pretty straight-forward to implement an IPO pass that >> turns trampoline pointers into fat pointers in cases like this

Re: [llvm-commits] Trampoline changes

2007-09-17 Thread Duncan Sands
Hi Chris, > > My hope was that some of these trampoline calls could be eliminated > > using this optimization. But for > > that to happen, the routines in the container library have to be > > small enough to be inlined. They are > > not. In fact they're rather small in terms of lines of cod

Re: [llvm-commits] Trampoline changes

2007-09-11 Thread Chris Lattner
On Sep 9, 2007, at 1:46 AM, Duncan Sands wrote: > Hi Nick, > >>> It is easy to construct testcases for which this works, but sadly >>> I was unable to get >>> the optimization to occur even once in a trampoline heavy real- >>> world program without >>> jacking-up the inlining limit hugely (to

Re: [llvm-commits] Trampoline changes

2007-09-09 Thread Duncan Sands
Hi Nick, > > It is easy to construct testcases for which this works, but sadly I was > > unable to get > > the optimization to occur even once in a trampoline heavy real-world > > program without > > jacking-up the inlining limit hugely (to 10; 1 wasn't enough). > > Still, I'm > > hopi

Re: [llvm-commits] Trampoline changes

2007-09-08 Thread Nick Lewycky
Duncan Sands wrote: > It is easy to construct testcases for which this works, but sadly I was > unable to get > the optimization to occur even once in a trampoline heavy real-world program > without > jacking-up the inlining limit hugely (to 10; 1 wasn't enough). > Still, I'm > hoping t

[llvm-commits] Trampoline changes

2007-09-08 Thread Duncan Sands
Currently LLVM has two intrinsics for supporting trampolines, aka pointers to nested functions: init_trampoline and adjust_trampoline. In essence, init_trampoline fills a block of memory with executable code, and adjust_trampoline returns a suitable function pointer for calling that code. These pa