Commit Graph

11 Commits

Author SHA1 Message Date
Janeczko Jakub
cc401c1e5b
fix string type sso computation (#469)
* fix string type sso computation

* fix rest of sbo/sso calculation

* make placement of uintptr_t cast consistent

* separate check-inline into function
2024-01-31 11:19:24 +00:00
Jake Hillion
592e182e0f tbv2: replace DB template param with Ctx (#409)
Summary:
tbv2: replace DB template param with Ctx

TreeBuilder v2 adds a DB template parameter to every function. This is used as
part of the static type to decide what type of DataBuffer is being used:
currently `BackInserterDataBuffer<std::vector<uint8_t>>` for OIL and it would
be `DataSegmentDataBuffer` for OID.

This change replaces the `DB` template parameter with a more general `Ctx`. Due
to issues with dependent naming it also adds a `using DB` to each `TypeHandler`
which has the same function as before. This allows us to add more "static
context" (typedefs and constants) to functions without changing this signature
again, because changing the signature of everything is a massive pain.

Currently this change achieves nothing because Ctx contains only DB in a static
wrapper. In the next change I'm going to pass a reference of type Ctx around to
add a "dynamic context" to invocations which will contain the pointer array. In
future we'll then be able to add either static or dynamic context without any
signature adjustments.


Test Plan:
- CI

---
Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/facebookexperimental/object-introspection/pull/409).
* https://github.com/facebookexperimental/object-introspection/issues/410
* __->__ https://github.com/facebookexperimental/object-introspection/issues/409

Reviewed By: ajor

Differential Revision: D51352092

Pulled By: JakeHillion
2023-11-15 11:52:17 -08:00
Jake Hillion
f9cb0115e1 types: remove now unused handlers
Summary:

Handlers were added in an intermediate form of tbv2 but those intermediate
forms have now been removed. Remove all the handlers to make grepping/find and
replaces easier across the types.

Test Plan:

- CI
2023-11-15 14:27:07 +00:00
Alastair Robertson
4afa2ff190 CodeGen: Add support for key capture 2023-09-28 19:42:49 -07:00
Jake Hillion
5071519e45 oil v2 2023-08-23 15:59:53 +01:00
Jake Hillion
6aead62652 static types: place in own header for testing 2023-06-30 12:54:02 +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
Jon Haslam
db90326c4b Initial commit 2022-12-19 06:37:51 -08:00