Object Introspection (OI) enables on-demand, hierarchical profiling of objects in arbitrary C/C++ programs with no recompilation.
Go to file
Jake Hillion a931d2f52f oilgen: migrate to source parsing (#421)
Summary:
oilgen: migrate to source parsing

Using debug information generated from partial source (that is, not the final
binary) has been insufficient to generally generate OIL code.

A particular example is pointers to templates:
```cpp
#include <oi/oi.h>
template <typename T>
struct Foo {
  T t;
};
template <typename T>
struct Bar {
  Foo<T>& f;
};
void foo(const Bar<int>& b) {
  oi::introspect(b);
}
```

The pointer/reference to `Foo<int>` appears in DWARF with
`DW_AT_declaration(true)` because it could be specialised before its usage.
However, with OIL, we are creating an implicit usage site in the
`oi::introspect` call that the compiler is unable to see.

This change reworks OILGen to work from a Clang command line rather than debug
information. We setup and run a compiler on the source, giving us access to an
AST and Semantic Analyser. We then:
- Find the `oi::introspect` template.
- Iterate through each of its callsites for their type.
- Run `ClangTypeParser::parse` on each type.
- Run codegen.
- Compile into an object file.

Having access to the semantic analyser allows us to forcefully complete a type,
as it would be if it was used in the initial code.


Test Plan:
hope

`buck2 run fbcode//mode/opt fbcode//object-introspection/oil/examples/compile-time:compile-time`

Reviewed By: tyroguru

Differential Revision: D51854477

Pulled By: JakeHillion
2023-12-19 11:57:44 -08:00
.circleci OID: Make CodeGen v2 (TypeGraph) the default 2023-12-14 17:42:03 +00:00
.github Add website deployment script 2022-12-20 08:40:51 -08:00
cmake Enable compiler warnings globally 2023-05-23 10:36:42 +01:00
examples clang-format: set BinPackParameters=false 2023-04-24 11:28:22 +02:00
extern Update drgn to Omar's branch 2023-12-13 11:59:21 +00:00
include/oi capture_keys: store dynamic type path components more efficiently 2023-12-14 16:05:33 +00:00
oi oilgen: migrate to source parsing (#421) 2023-12-19 11:57:44 -08:00
resources Compile Time OIL for OIL v2 2023-08-30 04:28:02 -07:00
test CodeGen v2: Enable independent running without CodeGen v1 2023-12-15 14:57:24 +00:00
tools oilgen: migrate to source parsing (#421) 2023-12-19 11:57:44 -08:00
types oilgen: migrate to source parsing (#421) 2023-12-19 11:57:44 -08:00
website Use objectintrospection.org for the website 2023-09-21 20:59:46 +01:00
.clang-format clang-format: disable bin packing 2023-11-13 18:19:53 +00:00
.clang-tidy Initial commit 2022-12-19 06:37:51 -08:00
.editorconfig Initial commit 2022-12-19 06:37:51 -08:00
.git-blame-ignore-revs Initial commit 2022-12-19 06:37:51 -08:00
.gitignore Delete old files from test/ 2023-01-27 12:45:35 +00:00
.gitmodules drgn: add split dwarf support 2023-06-02 17:52:53 +02:00
CHANGELOG.md Initial commit 2022-12-19 06:37:51 -08:00
CMakeLists.txt oilgen: migrate to source parsing (#421) 2023-12-19 11:57:44 -08:00
CODE_OF_CONDUCT.md Initial commit 2022-12-19 06:37:51 -08:00
CONTRIBUTING.md Initial commit 2022-12-19 06:37:51 -08:00
dev.oid.toml Implement new container for F14ValueMap 2023-09-08 16:31:36 +02:00
flake.lock ci: move formatting checks to nix 2023-12-14 15:31:07 +00:00
flake.nix ci: move formatting checks to nix 2023-12-14 15:31:07 +00:00
LICENSE Initial commit 2022-12-19 06:37:51 -08:00
oss.oid.toml Initial commit 2022-12-19 06:37:51 -08:00
README.md Use objectintrospection.org for the website 2023-09-21 20:59:46 +01:00

object-introspection

Matrix Chat

OI Logo

Object Introspection is a memory profiling technology for C++ objects. It provides the ability to dynamically instrument applications to capture the precise memory occupancy of entire object hierarchies including all containers and dynamic allocations. All this with no code modification or recompilation!

For more information on the technology and how to get started applying it to your applications please check out the Object Introspection website.

Join the Object Introspection community

See the CONTRIBUTING file for how to help out.

License

Object Introspection is licensed under the Apache 2.0 License.