Commit Graph

391 Commits

Author SHA1 Message Date
Jake Hillion
a49f0e7410 codegenv2: improve multi argument generation (#395)
Summary:
Adds a new function `CodeGen::codegenFromDrgns` which runs multiple drgn root types through one `DrgnParser`. Stores the naming for the output within this function as we previously decided that when doing the actual codegen, which is too late with multiple root types.

This new function is used in `OIGenerator` when you have multiple OIL calls within one input object. Rather than producing separate `.o`s with likely duplicate code for each callsite, we produce a single `.o` that contains both calls. For calls with types with significant overlap this should be a significant reduction in work. The downside is the calls can't have different features, but this could be solved in the future by namespacing the code based on features/config within the generated `.cpp` - the pros seem to outweigh the con.

This should also be used with `oid` in multi probe mode as it would again significantly reduce the work it has to do. I didn't do this yet as it requires changing the cache. As I've got a big refactor cache ongoing at the minute it makes sense to wait until after that's landed to make this change.


Test Plan: Generally tested with GitHub CI. Tested the new multi call OILGen with the new example seen below. Outputs the following code with two root calls: P869569859 - note that `VectorOfStrings_0` is the only instance, whereas previously we'd have generated it in two files.

Differential Revision: D50835153

Pulled By: JakeHillion
2023-10-31 10:22:56 -07:00
Jake Hillion
6e1635ce1e remove oil v1 leftovers 2023-10-30 18:18:13 +00:00
Jake Hillion
6f623e95a4 incomplete: handle drgn returning a nullptr name 2023-10-30 16:47:50 +00:00
Jake Hillion
4563cbe713 tbv2: improve equality for iterator 2023-10-25 17:05:42 +01:00
Alastair Robertson
e7581ad915 TopoSorter: Only allow certain params to be incomplete
For the containers which are allowed to be declared with incomplete
types, it is only the contained types which are allowed to be
incomplete. Other template parameters (e.g. allocators) must always be
defined before use.
2023-10-25 17:01:44 +01:00
Jake Hillion
5daed4cc72 tbv2: add a repeat instruction 2023-10-25 16:05:12 +01:00
Jake Hillion
6f3580143e tbv2: change instruction stack from deque to vector 2023-10-25 15:56:01 +01:00
Jake Hillion
cc6c7bf21f compiler: update to c++20 2023-10-25 15:55:18 +01:00
Jake Hillion
fcb50df611 oil: make AoT introspect noinline 2023-10-25 13:23:47 +01:00
Jake Hillion
67739840fe add portability.h (#386)
Summary:

Spin around our open/closed source checks. Previously we defined `OSS_ENABLE` in open source builds. This change defines `OI_META_INTERNAL` instead. This is nicer, as external users don't have to do anything special to get a working build.

Use this new macro to define a boolean constant in a new header `Portability.h`. This is inspired by Folly, and makes the internal build easier - definitions in Buck2 have to propagate up from a dependency instead of down from one. Annoyingly we can't use `if constexpr` for a lot of the previous `#ifdef` blocks as we conditionally include the headers. Longer term we could fix this by exposing a header interface but no source, allowing these to build but not be compiled in. For now I did something weird: I defined a function style macro in `Portability.h` based on the compile time macro. This forces you to have included `Portability.h` before using it to ensure the definition is everywhere. Open to feedback as I haven't seen anyone else do this.

Reviewed By: tyroguru

Differential Revision: D50000454
2023-10-24 03:03:16 -07:00
Jonathan Haslam
9cef2c82d9 move cea/object-introspection/internal -> object-introspection/internal (#389)
Summary:

More moving code out of the `cea` subdirectory. This is moving the GOBS cache code which is contained in the 'internal' subdirectory. I'm hoping I get some auto generated diffs to push to GitHub for the third party source changes...

Reviewed By: JakeHillion

Differential Revision: D50366591
2023-10-18 09:15:21 -07:00
Jake Hillion
57c1a76228 oil: add fallible build option
Summary: Add a second form for OIL AoT compilation which returns a `std::optional` instead of throwing. This is preferred if it's possible for the symbol to not be defined and you must not throw, instead preferring to handle the failure a different way. This still calls the throwing interface as that's what oilgen depends on, but makes sure the precondition is true first such that it won't throw.

Differential Revision: D50363926
2023-10-17 08:31:26 -07:00
Jake Hillion
f7bb1e75ad tbv2: fix exclusive size of elements in containers 2023-10-16 19:18:42 +01:00
Jake Hillion
e867178ebd capture_keys: include data in type path 2023-10-11 16:32:35 -07:00
Jake Hillion
217f675e30 oilgen: accept multiple config files (#379)
Summary:

Extend the multiple config files system to OILGen, the piece it was originally designed for. This allows for specifying additional configs which say which keys of maps to capture.

Reviewed By: ajor

Differential Revision: D50105138
2023-10-11 16:25:13 -07:00
Jake Hillion
4c6f232766 containers: add required features (#374)
Summary:
Adds the option for required features to container definitions. These cause the container not to be passed to `DrgnParser` if that feature is not enabled during code generation. The thrift isset type does not currently work with `tree-builder-v2` and only provides benefit with `capture-thrift-isset`. This change makes sure the container is ignored if it won't be useful, allowing code generation under `tree-builder-v2`.


Test Plan: - CI

Differential Revision: D49960512

Pulled By: JakeHillion
2023-10-09 17:50:39 -04:00
Thierry Treyer
593a1412d8 Fix exclusive_size for F14NodeMap 2023-10-09 10:41:34 -06:00
Thierry Treyer
7b5baca3b0 Fix exclusive_size for F14FastMap 2023-10-09 10:41:34 -06:00
Thierry Treyer
9ce7bd5fad Fix exclusive_size for F14VectorMap 2023-10-09 10:41:34 -06:00
Thierry Treyer
2d3709da65 Fix exclusive_size for F14ValueMap 2023-10-09 10:41:34 -06:00
Thierry Treyer
7eee6e0871 Add container_type alias in container TypeHandler 2023-10-09 10:41:34 -06:00
Thierry Treyer
37b25bb278 Fix exclusive_size for F14NodeSet 2023-10-09 10:41:34 -06:00
Thierry Treyer
7836134343 Fix exclusive_size for F14VectorSet 2023-10-09 10:41:34 -06:00
Thierry Treyer
cc12264847 Fix exclusive_size for F14FastSet 2023-10-09 10:41:34 -06:00
Thierry Treyer
76adc64723 Fix exclusive_size for F14ValueSet 2023-10-09 10:41:34 -06:00
Thierry Treyer
f4a1bd3d99 Remove Primitive::Kind::Incomplete 2023-10-04 11:23:28 -06:00
Thierry Treyer
3065dd14e9 Maintain type/name of Incomplete type 2023-10-04 11:23:28 -06:00
Jake Hillion
37991140da support 0 to many config files (#371)
Summary:
Previously OID/OIL required exactly one configuration file. This change makes it so you can supply 0 or more configuration files. 0 is useful if you have pre-generated the cache or use some sort of remote generation system. 1 is useful for the common case, where you have a configuration file that describes your entire source and use just that. More are useful if you have supplemental bits of config you wish to apply/override - see the changes to the integration test framework where we do exactly this.


Test Plan:
This isn't super well tested. It works for the test cases which add features via the config or enable `codegen.ignore`.

- CI

Reviewed By: ajor

Differential Revision: D49758032

Pulled By: JakeHillion
2023-10-02 14:06:39 -06:00
Alastair Robertson
35d45c2b4f folly::sorted_vector_map: Add key-capture support 2023-09-29 11:21:41 -07:00
Alastair Robertson
fb66f3ea05 CaptureKeys: Add test for capturing object pointers 2023-09-28 19:42:49 -07:00
Alastair Robertson
d01c32c657 CI: Skip some OIL capture keys tests on Clang 2023-09-28 19:42:49 -07:00
Alastair Robertson
5572e294f7 CaptureKeys: Add support for std::map and std::unordered_map 2023-09-28 19:42:49 -07:00
Alastair Robertson
4afa2ff190 CodeGen: Add support for key capture 2023-09-28 19:42:49 -07:00
Alastair Robertson
3446339358 TypeGraph: Add KeyCapture pass 2023-09-28 19:42:49 -07:00
Alastair Robertson
0ae08addc9 TypeGraph: Add CaptureKeys node 2023-09-28 19:42:49 -07:00
Alastair Robertson
9055c5841d OIUtils: Parse "capture_keys" section from configs 2023-09-28 19:42:49 -07:00
Alastair Robertson
1f66ef064a ContainerInfo: Read "extra" codegen field 2023-09-28 19:42:49 -07:00
Alastair Robertson
4e80dace1a ContainerInfo: Create explicit clone method to copy objects 2023-09-28 19:42:49 -07:00
Alastair Robertson
7361d8fa29 TreeBuilder v2: Extend Element with a data member 2023-09-28 19:42:49 -07:00
Thierry Treyer
c657a41d79 Add CSV Exporter 2023-09-29 03:17:45 +02:00
Jake Hillion
edb7bf5f3f Implement Container V2 for folly::sorted_vector_set 2023-09-27 19:06:20 -07:00
Jake Hillion
8bad704d9c Implement Container V2 for fbstring 2023-09-27 18:16:36 -07:00
Jake Hillion
7a7a9b347a jit logging: fix for codegen v1 2023-09-26 18:41:27 -07:00
Alastair Robertson
bd826f9794 CodeGen: Store list of ContainerInfos in unique_ptrs for reference stability
Lots of places rely on reference stability of ContainerInfo objects
(CodeGen's deduplication, Container nodes' containerInfo_ member).

In the key capture work, we need to be able to append to this list,
which would invalidate references before this change.
2023-09-22 17:10:56 +01:00
Jake Hillion
5632738d97 make StubbedPointer an explicit C++ type 2023-09-22 11:49:50 +01:00
Milian Wolff
9359757fb0 Add missing cstdint include
Otherwise uint64_t won't be defined in this file with newer
libstdc++ from g++13.
2023-09-22 10:59:23 +01:00
Milian Wolff
256ca1202f Minor: fix indentation for FetchContent calls 2023-09-22 10:59:23 +01:00
Milian Wolff
1317aa3cf6 Show progress information for FetchContent
Github is currently extremely slow to load for me for some reason.
Due to that, I first thought that `cmake` is hung up, but tracing
that I realized it's waiting for minutes to download the sources
for tomlplusplus via FetchContent.

This patch enables progress reporting for FetchContent to make it
more obvious what's going on here.
2023-09-22 10:59:23 +01:00
Jake Hillion
53cac53f25 rocksdb: update to v8.5.3 2023-09-22 10:34:57 +01:00
Paul O’Shannessy
5a55e7ad24 Use objectintrospection.org for the website
This updates the docusaurus config and adds the CNAME file for gh pages,
then updates the readme to point at this domain.
2023-09-21 20:59:46 +01:00