Commit Graph

483 Commits

Author SHA1 Message Date
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
Alastair Robertson
bbc4cb822b Printer: Make prefix() [[nodiscard]] and fix bug printing Dummy nodes
Dummy and DummyAllocator nodes had been changed to use NodeIds, but
were still printed out in full when visited for a second time.

[[nodiscard]] prevents future bugs of this type by turning them into
compilation errors.

Example of the now-fixed bug:
    [1]  Container: std::map<int32_t, int32_t, DummySizedOperator<0, 0, 8>, std::allocator<std::pair<int32_t const, int32_t>>>
            Param
              Primitive: int32_t
            Param
              Primitive: int32_t
            Param
    [2]       Dummy [less<int>]
            Param
              ...
    [3]   Container: std::map<int32_t, int32_t, DummySizedOperator<0, 0, 8>, std::allocator<std::pair<int32_t const, int32_t>>>
            Param
              Primitive: int32_t
            Param
              Primitive: int32_t
            Param
              [2]
    Dummy [less<int>]
            Param
              ...

With this patch, the second "Dummy" line will not be printed.
2023-09-21 17:01:35 +01:00
Jake Hillion
c766d7b572 codegen: generate enums as enum class 2023-09-20 18:13:45 +01:00
Jake Hillion
c6723a4381 oilgen: add missing gflags header 2023-09-20 17:59:24 +01:00
Jake Hillion
929a2e68f8 oilgen: avoid demangling empty symbols 2023-09-19 20:27:10 +01:00
Alastair Robertson
a509354624 DrgnParser: Options should default to false
We only want to do the extra work if it's explicitly requested.

chaseRawPointers is already explicitly requested whenever it's needed
and readEnumValues currently isn't needed at all.
2023-09-19 18:32:37 +01:00
Jake Hillion
78b1a6c840 oilgen: hash linkage names in output path 2023-09-18 17:26:21 +01:00
Jake Hillion
6abeb0c723 oilgen: add debug flag
Summary: Current output of OILGen is always without debug. This hides things like the printed type graph from the end user, which would be useful in the logs of a build failure. Also rename the `-d` flag which was for jumping JIT code to `-j`, as `-d` is used in all the other tools for debug output level.
2023-09-18 15:32:06 +01:00
Jake Hillion
8dd1182323 static types: add consume function similar to delegate 2023-09-15 14:43:09 +01:00