forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit9370462
committed
Add inlining support to LLVM JIT provider.
This provides infrastructure to allow JITed code to inline codeimplemented in C. This e.g. can be postgres internal functions orextension code.This already speeds up long running queries, by allowing the LLVMoptimizer to optimize across function boundaries. The optimizationpotential currently doesn't reach its full potential because LLVMcannot optimize the FunctionCallInfoData argument fully away, becauseit's allocated on the heap rather than the stack. Fixing that isbeyond what's realistic for v11.To be able to do that, use CLANG to convert C code to LLVM bitcode,and have LLVM build a summary for it. That bitcode can then be used toto inline functions at runtime. For that the bitcode needs to beinstalled. Postgres bitcode goes into $pkglibdir/bitcode/postgres,extensions go into equivalent directories. PGXS has been modified sothat happens automatically if postgres has been compiled with LLVMsupport.Currently this isn't the fastest inline implementation, modules arereloaded from disk during inlining. That's to work around an apparentLLVM bug, triggering an apparently spurious error in LLVM assertionenabled builds. Once that is resolved we can remove the superfluousread from disk.Docs will follow in a later commit containing docs for the whole JITfeature.Author: Andres FreundDiscussion:https://postgr.es/m/20170901064131.tazjxwus3k2w3ybh@alap3.anarazel.de1 parent8a934d6 commit9370462
File tree
13 files changed
+988
-8
lines changed- src
- backend
- jit
- llvm
- optimizer/plan
- utils/misc
- include/jit
- makefiles
13 files changed
+988
-8
lines changedLines changed: 34 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
171 | 171 |
| |
172 | 172 |
| |
173 | 173 |
| |
| 174 | + | |
174 | 175 |
| |
175 | 176 |
| |
176 | 177 |
| |
| |||
972 | 973 |
| |
973 | 974 |
| |
974 | 975 |
| |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + |
Lines changed: 10 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
252 | 252 |
| |
253 | 253 |
| |
254 | 254 |
| |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
255 | 262 |
| |
256 | 263 |
| |
257 | 264 |
| |
| |||
309 | 316 |
| |
310 | 317 |
| |
311 | 318 |
| |
| 319 | + | |
| 320 | + | |
| 321 | + | |
312 | 322 |
| |
313 | 323 |
| |
314 | 324 |
| |
|
Lines changed: 5 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
30 | 30 |
| |
31 | 31 |
| |
32 | 32 |
| |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
33 | 37 |
| |
34 | 38 |
| |
35 | 39 |
| |
| |||
43 | 47 |
| |
44 | 48 |
| |
45 | 49 |
| |
46 |
| - | |
| 50 | + | |
47 | 51 |
| |
48 | 52 |
| |
49 | 53 |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
40 | 40 |
| |
41 | 41 |
| |
42 | 42 |
| |
| 43 | + | |
43 | 44 |
| |
44 | 45 |
| |
45 | 46 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
37 | 37 |
| |
38 | 38 |
| |
39 | 39 |
| |
40 |
| - | |
| 40 | + | |
41 | 41 |
| |
42 | 42 |
| |
43 | 43 |
| |
|
Lines changed: 16 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
468 | 468 |
| |
469 | 469 |
| |
470 | 470 |
| |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
471 | 475 |
| |
472 | 476 |
| |
473 | 477 |
| |
| |||
491 | 495 |
| |
492 | 496 |
| |
493 | 497 |
| |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
494 | 508 |
| |
495 | 509 |
| |
496 | 510 |
| |
| |||
578 | 592 |
| |
579 | 593 |
| |
580 | 594 |
| |
581 |
| - | |
| 595 | + | |
| 596 | + | |
582 | 597 |
| |
583 | 598 |
| |
584 | 599 |
| |
|
0 commit comments
Comments
(0)