Commit Graph

22 Commits

Author SHA1 Message Date
John Naylor 16492df70b Blind attempt to fix LLVM dependency in the backend
Commit ecaf7c5df5 removed gram.h from the backend's generated-headers
target. In LLVM builds, this leads to loss of dependency information
when generating .bc files. To fix, add a rule that mirrors ad-hoc .o
dependencies for .bc files as well.

Per cfbot (no buildfarm failures reported)
Analysis by Tom Lane and Andres Freund
Proposed fix by Andres Freund
Discussion: https://www.postgresql.org/message-id/20220914210427.y26tkagmxo5wwbvp%40awork3.anarazel.de
2022-09-15 10:53:48 +07:00
Andres Freund 05bf551040 Remove SUBSYS.o rule in common.mk, hasn't been used in a long time
Apparently I missed that this SUBSYS.o rule isn't needed anymore in
a4ebbd2752, likely because there still is a reference to it due to AIX - but
that's self contained in src/backend/Makefile

Discussion: https://postgr.es/m/20220820174213.d574qde4ptwdzoqz@awork3.anarazel.de
2022-08-24 20:38:14 -07:00
Andres Freund a4ebbd2752 Remove PARTIAL_LINKING build mode.
In 9956ddc191, ten years ago, the
current objfile.txt based linking model was introduced.  It's time to
retire the old SUBSYS.o based model.

This primarily is pertinent because the bitcode files for LLVM based
inlining are not produced when using PARTIAL_LINKING. It does not seem
worth to fix PARTIAL_LINKING to support that.

Author: Andres Freund
Discussion: https://postgr.es/m/20180121204356.d5oeu34jetqhmdv2@alap3.anarazel.de
2018-03-30 17:33:04 -07:00
Andres Freund 9370462e9a Add inlining support to LLVM JIT provider.
This provides infrastructure to allow JITed code to inline code
implemented in C. This e.g. can be postgres internal functions or
extension code.

This already speeds up long running queries, by allowing the LLVM
optimizer to optimize across function boundaries. The optimization
potential currently doesn't reach its full potential because LLVM
cannot optimize the FunctionCallInfoData argument fully away, because
it's allocated on the heap rather than the stack. Fixing that is
beyond 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 to
to inline functions at runtime. For that the bitcode needs to be
installed. Postgres bitcode goes into $pkglibdir/bitcode/postgres,
extensions go into equivalent directories.  PGXS has been modified so
that happens automatically if postgres has been compiled with LLVM
support.

Currently this isn't the fastest inline implementation, modules are
reloaded from disk during inlining. That's to work around an apparent
LLVM bug, triggering an apparently spurious error in LLVM assertion
enabled builds.  Once that is resolved we can remove the superfluous
read from disk.

Docs will follow in a later commit containing docs for the whole JIT
feature.

Author: Andres Freund
Discussion: https://postgr.es/m/20170901064131.tazjxwus3k2w3ybh@alap3.anarazel.de
2018-03-28 13:19:08 -07:00
Andres Freund b96d550eb0 Support for optimizing and emitting code in LLVM JIT provider.
This commit introduces the ability to actually generate code using
LLVM. In particular, this adds:

- Ability to emit code both in heavily optimized and largely
  unoptimized fashion
- Batching facility to allow functions to be defined in small
  increments, but optimized and emitted in executable form in larger
  batches (for performance and memory efficiency)
- Type and function declaration synchronization between runtime
  generated code and normal postgres code. This is critical to be able
  to access struct fields etc.
- Developer oriented jit_dump_bitcode GUC, for inspecting / debugging
  the generated code.
- per JitContext statistics of number of functions, time spent
  generating code, optimizing, and emitting it.  This will later be
  employed for EXPLAIN support.

This commit doesn't yet contain any code actually generating
functions. That'll follow in later commits.

Documentation for GUCs added, and for JIT in general, will be added in
later commits.

Author: Andres Freund, with contributions by Pierre Ducroquet
Testing-By: Thomas Munro, Peter Eisentraut
Discussion: https://postgr.es/m/20170901064131.tazjxwus3k2w3ybh@alap3.anarazel.de
2018-03-22 11:05:22 -07:00
Peter Eisentraut 94c2ed0ebe Add ICU_CFLAGS to global CPPFLAGS
The original code only added ICU_CFLAGS to the backend build.  But it is
also needed for building external modules that include pg_locale.h.  So
add it to the global CPPFLAGS.  (This is only relevant if ICU is not in
a compiler default path, so it apparently hasn't bitten many.)
2017-06-12 15:57:22 -04:00
Peter Eisentraut eccfef81e1 ICU support
Add a column collprovider to pg_collation that determines which library
provides the collation data.  The existing choices are default and libc,
and this adds an icu choice, which uses the ICU4C library.

The pg_locale_t type is changed to a union that contains the
provider-specific locale handles.  Users of locale information are
changed to look into that struct for the appropriate handle to use.

Also add a collversion column that records the version of the collation
when it is created, and check at run time whether it is still the same.
This detects potentially incompatible library upgrades that can corrupt
indexes and other structures.  This is currently only supported by
ICU-provided collations.

initdb initializes the default collation set as before from the `locale
-a` output but also adds all available ICU locales with a "-x-icu"
appended.

Currently, ICU-provided collations can only be explicitly named
collations.  The global database locales are still always libc-provided.

ICU support is enabled by configure --with-icu.

Reviewed-by: Thomas Munro <thomas.munro@enterprisedb.com>
Reviewed-by: Andreas Karlsson <andreas@proxel.se>
2017-03-23 15:28:48 -04:00
Peter Eisentraut 5dd41f3574 Remove maintainer-check target, fold into normal build
make maintainer-check was obscure and rarely called in practice, and
many breakages were missed.  Fold everything that make maintainer-check
used to do into the normal build.  Specifically:

- Call duplicate_oids when genbki.pl is called.

- Check for tabs in SGML files when the documentation is built.

- Run msgfmt with the -c option during the regular build.  Add an
  additional configure check to see whether we are using the GNU
  version.  (make maintainer-check probably used to fail with non-GNU
  msgfmt.)

Keep maintainer-check as around as phony target for the time being in
case anyone is calling it.  But it won't do anything anymore.
2013-10-10 20:11:56 -04:00
Peter Eisentraut 9bf8603c7a Call check_keywords.pl in maintainer-check
For that purpose, have check_keywords.pl print errors to stderr and
return a useful exit status.
2012-02-27 13:53:12 +02:00
Peter Eisentraut c667cc24e8 Workaround for recursive make breakage
Changing a file two directory levels deep under src/backend/ would not
cause the postgres binary to be rebuilt.  This change fixes it, but no
one knows why.
2011-01-13 09:32:06 +02:00
Peter Eisentraut e3094fd3a8 Re-add recursive coverage target in src/backend/
This was lost during the recent recursive make change.
2011-01-12 00:26:20 +02:00
Peter Eisentraut 19e231bbda Improved parallel make support
Replace for loops in makefiles with proper dependencies.  Parallel
make can now span across directories.  Also, make -k and make -q work
properly.

GNU make 3.80 or newer is now required.
2010-11-12 22:15:16 +02:00
Magnus Hagander 9f2e211386 Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
Peter Eisentraut 7798147a76 Expand test coverage support to entire tree
Test coverage support now covers the entire source tree, including
contrib, instead of just src/backend.  In a related but independent
development, the commands make coverage and make coverage-html can be run
in any directory.

This turned out to be much easier than feared.  Besides a few ad hoc fixes
to pass the make target down the tree, change all affected makefiles to
list their directories in the SUBDIRS variable, changed from variants like
DIRS and WANTED_DIRS.  MSVC build fix was attempted as well.
2009-08-07 20:50:22 +00:00
Peter Eisentraut 11f53b1063 Code coverage testing with gcov. Documentation is in the regression test
chapter.

Author: Michelle Caisse <Michelle.Caisse@Sun.COM>
2008-09-05 12:11:18 +00:00
Peter Eisentraut e7115a224a We need to rebuild objfiles.txt when one of the subdirectories' objfiles.txt
changed in case a new file got added.
2008-03-17 18:24:56 +00:00
Peter Eisentraut 02504dfd0a Write the objfiles.txt rules in a way that is compatible with GNU make 3.78,
and simpler, too.
2008-02-29 10:34:51 +00:00
Peter Eisentraut b8eef28353 Change expand_subsys function so that it preserves the relative order of
the files passed as argument.  This is desirable so that the dtrace rule
in src/backend/Makefile works.
2008-02-27 20:31:01 +00:00
Peter Eisentraut d391bdac50 Need more dependencies to get the build order right when objfiles.txt
doesn't exist yet.
2008-02-26 08:23:31 +00:00
Peter Eisentraut 3690019da8 We don't need to rebuild objfiles.txt every time an object file changes.
So only rebuild when a makefile changes (which presumably defines the
file list somewhere), and only touch the file if an object changed. The
touch is necessary so the parent make knows something changed and
ultimately rebuilds postgres.
2008-02-26 07:20:38 +00:00
Peter Eisentraut 9956ddc191 Link postgres from all object files at once, to avoid the error-prone
SUBSYS.o step and allow for better optimization by the linker.

Instead of partial linking into SUBSYS.o, the list of object files is
assembled in objfiles.txt files that are expanded when the final
linking is done.

Because we are not yet sure how long command lines different platforms
can handle, the old way of linking is still available, by defining the
make variable PARTIAL_LINKING (e.g., make all PARTIAL_LINKING=1).  If
we determine that this is necessary for some platforms, then we will
document this in a more prominent place.
2008-02-25 17:55:42 +00:00
Peter Eisentraut 0474dcb608 Refactor backend makefiles to remove lots of duplicate code 2008-02-19 10:30:09 +00:00