Commit Graph

82 Commits

Author SHA1 Message Date
Jake Hillion
d009f02ecb name contained types properly in treebuilder v2
Types within containers were previously named TODO. This sorts it out so
they're named as their most resolved type. The current implementation
skips Typedef names.
2023-08-25 16:25:14 +01:00
Thierry Treyer
1459433a50 Implement Container V2 for std::multiset 2023-08-25 16:07:10 +02:00
Thierry Treyer
f9b4d65cd8 Implement Container V2 for std::multimap 2023-08-25 16:07:10 +02:00
Thierry Treyer
5117482596 Update std::set container with static element_size 2023-08-25 15:13:55 +02:00
Thierry Treyer
19222a4fe2 Implement Container V2 for std::map 2023-08-25 15:13:55 +02:00
Thierry Treyer
b8cb81e366 std::set implementation for Container V2 2023-08-24 13:57:27 +02:00
Jake Hillion
5071519e45 oil v2 2023-08-23 15:59:53 +01:00
Thierry Treyer
e60d06a321 Fix JIT CodeGen for Try<> 2023-08-21 19:16:13 +02:00
Thierry Treyer
ca0c71fa40
Workaround for #289 missing symbol (#290) 2023-08-17 13:53:14 +01:00
Alastair Robertson
99462b2132 Types: Fix folly::small_vector and folly::sorted_vector_map
folly::sorted_vector_map's results are not completely accurate, but at
least CodeGen v2 matches CodeGen v1 for it now.
2023-07-26 10:07:30 +01:00
Aditya Sarwade
1334e08d05 Specify namespace for IOBuf in IOBufQueue function
Things can fail if there are only IOBufQueue objects but no IOBuf
object. Just specify the namespace too.
2023-07-19 11:13:39 +01:00
Jake Hillion
608880e156 typed data segment: fix vector handler for custom allocators 2023-07-05 19:06:18 +01:00
Jake Hillion
099be82459 thrift isset: add type handler 2023-07-05 17:52:42 +01:00
Alastair Robertson
31050735d6 CodeGen: Add support for capturing Thrift isset data 2023-07-04 15:36:27 +01:00
Jake Hillion
6aead62652 static types: place in own header for testing 2023-06-30 12:54:02 +01:00
Alastair Robertson
cf583700fa Add missing namespace to folly::IOBuf container TOML
Required for CodeGen v2, which does not add "using namespace xxx" and
uses fully qualified names instead.
2023-06-29 11:59:07 +01:00
Alastair Robertson
04715e2015 TypeGraph: Create dummy containers
These represent types which don't store any interesting data for us to
measure, but which are required by a real container so can not be
replaced with our own generated class types.

std::allocator often has bad DWARF, so it must be replaced after the
DWARF is fixed up in Flattener. The others could be replaced earlier in
the transformation process if desired, but I've left them all together
for simplicity for now.

This fixes the folly::fbstring tests.
2023-06-28 16:11:50 +01:00
Jake Hillion
edaf499ced TypedDataSegment: add handlers for all tested types 2023-06-19 19:06:04 +01:00
Alastair Robertson
784b900218 TypeGraph: Replace allocators with DummyAllocator
When we were previously removing allocators, we were only able to work
with containers whose allocators appeared as their last template
parameter.

Now we can replace allocators in the middle of a parameter list.

This fixes tests for folly::sorted_vector_set.
2023-05-31 15:49:37 +01:00
Alastair Robertson
3d91603c8e TypeGraph: Fix std::string container
std::basic_string takes three template parameters:
1. CharT
2. Traits
3. Allocator

The Traits parameter was causing issues, as it requires a type which
exposes certain things, e.g. `Traits::value_type`.

We have a few options to resolve this:
1. Remove this parameter, as we do for allocators
    Cons: removing a template parameter doesn't work if other
    parameters appear after it

2. Stub this parameter, as we do for hashers/comparators
    Cons: we need to hardcode an implementation that satisfies the
    `Traits::value_type` requirements

3. Leave the parameter as-is
    Cons: will not work if a non-standard Traits is used

    By using the real implementation of this Traits parameter
    (normally `std::char_traits<CharT>`), we get one that we know will
    work as long as it is defined in a stdlib header.

Option 3 is what we use in this patch. Instead of adding more
configuration options to the container TOML file format (e.g.
`params_to_keep = [1]`), we add `std::char_traits` as a dummy
container type. Now, whenever `std::char_traits` appears, it will be
left as-is, i.e. not removed, replaced or reverse-engineered.

This is the same approach previously used for Thrift's isset_bitset.
2023-05-30 17:17:29 +01:00
Alastair Robertson
68290655b1 TypeGraph: Update container TOML files to new format
This change is fully backwards compatible with the old ContainerInfo
parser, as it is just adding new fields.

The old fields will continue to be used by legacy OICodeGen until that
is removed.

Also add a README to document the format.
2023-05-26 18:21:59 +01:00
Jake Hillion
cd2fa8c9ef remove treebuilder pointer validation 2023-04-18 16:04:47 +02:00
Jake Hillion
f47628ae2d add test for folly::fbstring 2023-04-06 15:11:09 +01:00
Jay Kamat
e27f725a85 Avoid following weak_ptrs
Previously, we treated weak_ptrs as normal types and we recursed
within them, following the internal data pointer and possibly causing
crashes. We really shouldn't be following them, so I added a custom
type to simply abort processing. If we want to handle them (ie: check
if they are valid, and follow them if so), that should be fairly easy
with the work there is here so far.
2023-03-28 14:10:27 -07:00
Jake Hillion
2e74fa357a std::variant: change to use std::visit 2023-03-24 18:43:37 +00:00
Jake Hillion
3a236aa4f2 sorted_vec_set: finish changing to a container adapter 2023-02-24 10:31:59 -08:00
Jon Haslam
e458ca99eb
Stop enumerating template params for sorted_vector_set (#74) 2023-02-21 11:24:02 -08:00
Jon Haslam
c260586a4e
Fix folly::sorted_vector_set and minor codegen comment change (#63) 2023-02-08 14:34:14 +00:00
Jay Kamat
01abff9019 Update small vec types to reflect folly update
Folly updated the signature of small vec types here:
c0a4e11b31

I needed to add a new 'using' for policy_size_type, as this is commonly
used with this new template parameter.
2023-01-30 19:01:38 -08:00
Jon Haslam
885c2ec369
Support std::multimap with comparator template parameter (#33)
Co-authored-by: Jon Haslam <jonhaslam@meta.com>
2023-01-20 16:30:02 +00:00
Jake Hillion
2dc5479c32 container regex matching 2022-12-21 14:31:05 +00:00
Jon Haslam
db90326c4b Initial commit 2022-12-19 06:37:51 -08:00