[LLVMbugs] [Bug 177] NEW: [JIT] Functions pointed to by global variables should be lazily compiled!
bugzilla-daemon at zion.cs.uiuc.edu
bugzilla-daemon at zion.cs.uiuc.edu
Thu Dec 11 23:09:38 PST 2003
http://llvm.cs.uiuc.edu/bugs/show_bug.cgi?id=177
Summary: [JIT] Functions pointed to by global variables should be
lazily compiled!
Product: libraries
Version: 1.0
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: Generic Execution Engine Support
AssignedTo: sabre at nondot.org
ReportedBy: sabre at nondot.org
The LLVM JIT currently compiles a functions pointed to by global variables
immediately, though they probably won't ever be referenced, especially in C++
programs. Here's a simple C program that demonstrates what is going on.
Multiply it a thousand fold for a medium-sized C++ program that has vtables
pointing to LOTS of functions.
---
void bar() {}
void baz() {}
void (*P1)(void) = bar; // P1 is never used, should not codegen bar
void (*P2)(void) = baz;
void qux() {
P2();
}
int main(int argc, char**argv) {
if (argc > 1)
qux();
}
---
Use like so:
$ llvmgcc test.c -c -Wa,-disable-inlining
$ lli -debug-only=jit test.o <optional arg>
Currently I get this on the testcase:
$ lli -debug-only=jit test.o
Global 'P1' -> 0x84e3808
Global 'P2' -> 0x84e3818
Finished CodeGen of [0x4018e000] Function: bar: 7 bytes of text
Finished CodeGen of [0x4018e008] Function: baz: 7 bytes of text
Finished CodeGen of [0x4018e010] Function: main: 57 bytes of text
WARNING: Cannot resolve fn '__main' using a dummy noop function instead!
$ lli -debug-only=jit test.o x
Global 'P1' -> 0x84e3808
Global 'P2' -> 0x84e3818
Finished CodeGen of [0x4018e000] Function: bar: 7 bytes of text
Finished CodeGen of [0x4018e008] Function: baz: 7 bytes of text
Finished CodeGen of [0x4018e010] Function: main: 57 bytes of text
WARNING: Cannot resolve fn '__main' using a dummy noop function instead!
Finished CodeGen of [0x4018e04c] Function: qux: 16 bytes of text
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
More information about the llvm-bugs
mailing list