[PATCH] Omit frame pointer and fix %ebp by default on x86 (take 3)
Mon Aug 16 20:21:00 GMT 2004
Roger Sayle wrote:
>On Mon, 16 Aug 2004, Andrew Haley wrote:
>>Well, missing some stack frames is, from the Java point of view,
>>failing. We need stack traces for correct functioning.
>>We will work around this in Java by using unwinder info to do a
>>backtrace, but we don't yet do so. Please do not check in this patch.
>libjava currently works around this by using -fno-omit-frame-pointer.
>Presumably, java also disables sibcall optimizations which would also
>potentially miss some stack frames?
Sibcall optimizations do result in missing frames from
Throwable.printStackTrace(), ie the stack traces for debugging dumps.
That can make debugging slightly more difficult, but in practice I don't
think its a big problem. On the other hand, for security checks, we need
to ensure that inlining doesn't occur between classes that could have a
different protection domain. All the classes in libgcj have the same
(system) protection domain, so there won't be an issue for compiling
libgcj itself. If gcj is being used to compile untrusted bytecode at
runtime, then we may need an option to disable sibcalls across class
boundaries. In practice, for most code, its probably enough to ensure
that optimizations do not occur across compilation unit boundaries - and
currently we don't do that anyway.
In general, code that needs to run with restricted privileges will be
interpreted/JITed bytecode, so ensuring that the stack is correct for
those is a runtime issue.
More information about the Gcc-patches