||Thread Tools||Search this Thread||Display Modes|
|Feb 26, 2013, 12:32 AM||#1|
llvm question: big automatics
Some while ago, there was a thread here wherein the author could not figure out why a routine ran fine on the main thread but crashed on any other thread – turned out a huge array, like 2Mb, was being allocated, spilling out all over the local stack space.
So, it occurred to me, could one set the compiler back-end (llvm) to observe excessive stack consumption and convert it to temporary heap allocation? Or is this what it already does? Obviously, if it can handle ARC, this would be even easier (of course, any additional returns would have to have matching free()s), the only real difference is that the local variable would be accessed with a pointer, though the source syntax would be identical.
What I imagine is that with such an option enabled, a main thread routine allocating a big array would have a slightly greater chance of failing (due to a malloc() error), while a secondary thread might fail in an orderly fashion rather than assuredly crashing – in either case, a returned NULL pointer would result in a transparent exception throw added in to the object code.
So, my question is, assuming this is not being done, would it be a good idea? I, personally, regard stack space as sort of valuable, so I would allocate the heap block as a matter of course, but would it be wise to obscure this kind of thing from the programmer? Are the old-school, machine-aware habits just becoming passé?
You got to be a spirit. You can't be no ghost.
|Thread Tools||Search this Thread|
|thread||Thread Starter||Forum||Replies||Last Post|
|We might expect some performance improvements with 10.9.2 due to LLVM 3.4||iBug2||OS X Mavericks (10.9)||11||Jan 8, 2014 06:00 PM|
|LLVM-GCC Compiler issues||rchaud10||iPhone/iPad Programming||1||Jun 12, 2013 12:12 PM|
|So it seems that 10.9 will come with XCode 5.0 and get rid of llvm-gcc altogether.||iBug2||OS X||1||Jan 29, 2013 11:39 AM|
|BIG question||Fasthank||iOS 6||16||Sep 6, 2012 04:41 AM|
|GeekBench 2.7 BIG QUESTION PLEASE HELP||HighEndMac||MacBook Pro||29||Jul 19, 2012 04:01 PM|
All times are GMT -5. The time now is 07:43 PM.