Skip to content

Commit 38b22b9

Browse files
committed
Add initial version of CppJIT from the compiler-research cppyy forks
CppJIT is the successor to cppyy, an automatic Python-C++ bindings generator. It is the result of continued research and development on top of cppyy, with a re-engineered backend that relies on CppInterOp, a Clang-based C++ interoperability library, and the clang-repl C++ interpreter from the upstream LLVM compiler framework. cppyy grew out of PyROOT, the Python bindings of the ROOT data analysis framework at CERN, where the project originated. Wim Lavrijsen, the original author of cppyy, continued its development and releases at Lawrence Berkeley National Laboratory. CppJIT decouples the project from these high-energy-physics dependencies: the Cling C++ interpreter and ROOT. CppJIT continues cppyy's design while moving it to modern compiler technology. It no longer ships a modified LLVM compiler and replaces ROOT's string-based type system with efficient and correct reflection over the Clang AST through CppInterOp. As a result, CppJIT has faster runtime performance, improved memory efficiency, smaller Python wheels, and faster installation times. The Python interface is designed to closely resemble cppyy's, but behavior such as overload resolution has changed where CppJIT prioritizes conformance with the C++ standard. CppJIT is the result of the work of many contributors and their supervisors across the compiler-research group, CERN, and LBNL, without whom this project would not have been possible. The authors are listed in pyproject.toml.
0 parents  commit 38b22b9

158 files changed

Lines changed: 59057 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.clang-format‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
BasedOnStyle: LLVM
2+
3+
Language: Cpp
4+
Standard: c++17
5+
PointerAlignment: Left
6+
7+
IncludeCategories:
8+
- Regex: '^"[^/]+\"'
9+
Priority: 10
10+
- Regex: '^"clang/'
11+
Priority: 30
12+
- Regex: '^"llvm/'
13+
Priority: 40
14+
- Regex: '^<'
15+
Priority: 50
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Valgrind suppressions for clang-21 builds.
2+
#
3+
# Tracks llvm/llvm-project#194147 ("clang-21+ reads uninitialised
4+
# bytes in many AST/Sema paths"). The same regression class as
5+
# clang-22; the per-major file lets each binary's specific report
6+
# set drift without entries from one major silencing the other's
7+
# coverage.
8+
#
9+
# `flavor: system` consumers (CppInterOp's llvm-21 vg row) get this
10+
# file applied automatically by Build_and_Test_CppInterOp's loader,
11+
# which loads `etc/clang${CLANG_VERSION}-valgrind.supp` whenever it
12+
# exists. apt-llvm.org's clang-21 binary is what trips the reports
13+
# below.
14+
#
15+
# What's *actually* in here is what fired on a real local valgrind
16+
# run (validated via `bin/repro --save-temps` + targeted
17+
# `--gtest_filter` re-runs against the saved container, watching the
18+
# `used_suppression` summary). Earlier iterations carried ~17 more
19+
# blocks targeting symbols I'd extracted from "Uninitialised value
20+
# was created by" allocation-origin frames; valgrind's matcher only
21+
# considers the read-site top frame, so every one of those blocks
22+
# was dead. Removed.
23+
#
24+
# Drop this whole file once #194147 lands upstream and apt-llvm.org's
25+
# clang-21 packages refresh.
26+
27+
# clang::FunctionProtoType::FunctionProtoType(...) is the read-site
28+
# top frame for the bulk of #194147 reports on this binary
29+
# (54k+ errors over 51 contexts in our wider test sample).
30+
#
31+
# Three patterns considered, only one fires:
32+
# *FunctionProtoType::FunctionProtoType* -- demangled, didn't match
33+
# _ZN5clang17FunctionProtoTypeC* -- mangled, didn't match
34+
# *FunctionProtoType* -- single substring, MATCHES
35+
#
36+
# The single-substring form over-matches by design: every method on
37+
# the FunctionProtoType class (getCallConv, getReturnType, etc.)
38+
# would also be silenced if it ever surfaces a real bug. Tolerated
39+
# because (a) the constructor is the only top frame seen today, (b)
40+
# the more specific patterns demonstrably don't match valgrind's
41+
# matcher despite reading correctly to a human, (c) dropping the
42+
# whole file when #194147 lands restores precision. Documented so
43+
# the next maintainer doesn't waste time on the same investigation.
44+
{
45+
llvm/llvm-project#194147: FunctionProtoType (any method, see comment)
46+
Memcheck:Cond
47+
fun:*FunctionProtoType*
48+
...
49+
}
50+
51+
# Two more #194147 patterns that fire on lower-frequency code paths
52+
# (~14 errors each on the sampled tests). Wildcards on two distinct
53+
# identifiers, which matches valgrind's matcher reliably.
54+
{
55+
llvm/llvm-project#194147: CodeGenFunction::EmitCall
56+
Memcheck:Cond
57+
fun:*CodeGenFunction*EmitCall*
58+
...
59+
}
60+
{
61+
llvm/llvm-project#194147: EHScopeStack::requiresLandingPad
62+
Memcheck:Cond
63+
fun:*EHScopeStack*requiresLandingPad*
64+
...
65+
}
Lines changed: 219 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,219 @@
1+
# Upstream LLVM write(buf) uninit-bytes via the EPC transport, still
2+
# present in release/22.x. No llvm/llvm-project issue filed yet; if you
3+
# touch this file, please file one and add a reference here.
4+
{
5+
Clang 22 Out of Process: uninitialised bytes in FDSimpleRemoteEPCTransport::sendMessage
6+
Memcheck:Param
7+
write(buf)
8+
fun:__libc_write
9+
fun:write
10+
fun:_ZN4llvm3orc26FDSimpleRemoteEPCTransport11sendMessageENS0_21SimpleRemoteEPCOpcodeEmNS0_12ExecutorAddrENS_8ArrayRefIcEE
11+
...
12+
}
13+
14+
# llvm/llvm-project#194147: clang-22 reads uninitialised bytes in many
15+
# AST/Sema/CodeGen paths (regression vs clang-20). Was x86_64-only at
16+
# first; aarch64 caught up after a release/22.x advance and now trips
17+
# its own set (TreeTransform, SemaCUDA, AsmPrinter, ValueEnumerator).
18+
# Drop the whole #194147 family of blocks once the upstream issue lands.
19+
20+
{
21+
llvm/llvm-project#194147: InitListExpr::isTransparent
22+
Memcheck:Cond
23+
fun:_ZNK5clang12InitListExpr13isTransparentEv
24+
...
25+
}
26+
{
27+
llvm/llvm-project#194147: InitListExpr::getInit
28+
Memcheck:Cond
29+
fun:_ZN5clang12InitListExpr7getInitEj
30+
...
31+
}
32+
{
33+
llvm/llvm-project#194147: InitListExpr::getInit const
34+
Memcheck:Cond
35+
fun:_ZNK5clang12InitListExpr7getInitEj
36+
...
37+
}
38+
{
39+
llvm/llvm-project#194147: InitListExpr::setInit
40+
Memcheck:Cond
41+
fun:_ZN5clang12InitListExpr7setInitEjPNS_4ExprE
42+
...
43+
}
44+
{
45+
llvm/llvm-project#194147: InitListExpr::resizeInits
46+
Memcheck:Cond
47+
fun:_ZN5clang12InitListExpr11resizeInitsERKNS_10ASTContextEj
48+
...
49+
}
50+
{
51+
llvm/llvm-project#194147: InitListExpr::resizeInits via memset
52+
Memcheck:Cond
53+
fun:memset
54+
fun:_ZN5clang12InitListExpr11resizeInitsERKNS_10ASTContextEj
55+
...
56+
}
57+
58+
{
59+
llvm/llvm-project#194147: Sema::CheckForIntOverflow Cond
60+
Memcheck:Cond
61+
fun:_ZN5clang4Sema19CheckForIntOverflowEPKNS_4ExprE
62+
...
63+
}
64+
{
65+
llvm/llvm-project#194147: Sema::CheckForIntOverflow Value8
66+
Memcheck:Value8
67+
fun:_ZN5clang4Sema19CheckForIntOverflowEPKNS_4ExprE
68+
...
69+
}
70+
{
71+
llvm/llvm-project#194147: SequenceChecker::SequenceExpressionsInOrder
72+
Memcheck:Cond
73+
fun:*SequenceChecker*SequenceExpressionsInOrder*
74+
...
75+
}
76+
77+
{
78+
llvm/llvm-project#194147: Stmt::children via AnalyzeImplicitConversions
79+
Memcheck:Cond
80+
fun:_ZN5clang4Stmt8childrenEv
81+
fun:*AnalyzeImplicitConversions*
82+
...
83+
}
84+
{
85+
llvm/llvm-project#194147: AnalyzeImplicitConversions leaf
86+
Memcheck:Cond
87+
fun:*AnalyzeImplicitConversions*
88+
...
89+
}
90+
{
91+
llvm/llvm-project#194147: CFGBuilder::Visit Cond
92+
Memcheck:Cond
93+
fun:*CFGBuilder*Visit*
94+
...
95+
}
96+
{
97+
llvm/llvm-project#194147: CFGBuilder::Visit Value8
98+
Memcheck:Value8
99+
fun:*CFGBuilder*Visit*
100+
...
101+
}
102+
103+
{
104+
llvm/llvm-project#194147: RecordExprEvaluator::VisitCXXParenListOrInitListExpr
105+
Memcheck:Cond
106+
fun:*RecordExprEvaluator*VisitCXXParenListOrInitListExpr*
107+
...
108+
}
109+
{
110+
llvm/llvm-project#194147: AggExprEmitter init-list visits
111+
Memcheck:Cond
112+
fun:*AggExprEmitter*Visit*InitListExpr*
113+
...
114+
}
115+
116+
{
117+
llvm/llvm-project#194147: InitListChecker::FillInEmptyInitForField
118+
Memcheck:Cond
119+
fun:*InitListChecker*FillInEmptyInitForField*
120+
...
121+
}
122+
{
123+
llvm/llvm-project#194147: InitListChecker::FillInEmptyInitializations
124+
Memcheck:Cond
125+
fun:*InitListChecker*FillInEmptyInitializations*
126+
...
127+
}
128+
129+
# llvm/llvm-project#194147 (continued): symbols newly tripped after
130+
# release/22.x advanced and the llvm-release recipe republished. The
131+
# FunctionProtoType ctor is the dominant top frame on x86_64; the
132+
# CodeGen + EHScope entries cover the lower-frequency paths.
133+
#
134+
# Earlier iterations of this file carried ~17 more blocks targeting
135+
# symbols extracted from "Uninitialised value was created by"
136+
# allocation-origin frames; valgrind's matcher only considers the
137+
# read-site top frame, so every one of those blocks was dead.
138+
# Removed. (See the matching comment in clang21-valgrind.supp for
139+
# why the over-broad `*FunctionProtoType*` is the only pattern that
140+
# matches the constructor in valgrind's wildcard matcher.)
141+
{
142+
llvm/llvm-project#194147: FunctionProtoType (any method, see comment)
143+
Memcheck:Cond
144+
fun:*FunctionProtoType*
145+
...
146+
}
147+
{
148+
llvm/llvm-project#194147: CodeGenFunction::EmitCall
149+
Memcheck:Cond
150+
fun:*CodeGenFunction*EmitCall*
151+
...
152+
}
153+
{
154+
llvm/llvm-project#194147: EHScopeStack::requiresLandingPad
155+
Memcheck:Cond
156+
fun:*EHScopeStack*requiresLandingPad*
157+
...
158+
}
159+
{
160+
# Top frame for every unsuppressed error in the llvm22-vg
161+
# x86_64 row after FunctionProtoType started being silenced --
162+
# 21->173 errors all surfaced here, across 3->5 contexts
163+
# depending on which CppInterOpTests' OutOfProcessJIT subtests
164+
# ran. Origin frame is llvm::Module::setDataLayout (stack
165+
# allocation) but valgrind matches read-site, so suppress
166+
# by the read-site symbol.
167+
llvm/llvm-project#194147: CodeGenModule::SetLLVMFunctionAttributesForDefinition
168+
Memcheck:Cond
169+
fun:*CodeGenModule*SetLLVMFunctionAttributesForDefinition*
170+
...
171+
}
172+
173+
# llvm/llvm-project#194147 (continued): symbols newly tripped on
174+
# the arm64 cell after recipe republish. The aarch64 cell was
175+
# previously documented as clean for #194147 (per the existing
176+
# top-of-file note); that's now stale. Different code paths than
177+
# x86_64 trips, mainly TreeTransform / SemaCUDA / AsmPrinter /
178+
# bitcode writer.
179+
{
180+
llvm/llvm-project#194147: TreeTransform::TransformIfStmt
181+
Memcheck:Cond
182+
fun:*TreeTransform*TransformIfStmt*
183+
...
184+
}
185+
{
186+
llvm/llvm-project#194147: SemaCUDA::inferTargetForImplicitSpecialMember
187+
Memcheck:Cond
188+
fun:*SemaCUDA*inferTargetForImplicitSpecialMember*
189+
...
190+
}
191+
{
192+
llvm/llvm-project#194147: AsmPrinter::emitPatchableFunctionEntries
193+
Memcheck:Cond
194+
fun:*AsmPrinter*emitPatchableFunctionEntries*
195+
...
196+
}
197+
{
198+
llvm/llvm-project#194147: ValueEnumerator::getAttributeGroupID Cond
199+
Memcheck:Cond
200+
fun:*ValueEnumerator*getAttributeGroupID*
201+
...
202+
}
203+
{
204+
# Same symbol, different error class: BitcodeWriter reads an
205+
# 8-byte uninit field (AttributeSet pointer pair) when the
206+
# ModuleBitcodeWriter::write() path serializes the module. Cond
207+
# alone doesn't catch Memcheck:Value8 — value-load errors are
208+
# tracked separately by valgrind.
209+
llvm/llvm-project#194147: ValueEnumerator::getAttributeGroupID Value8
210+
Memcheck:Value8
211+
fun:*ValueEnumerator*getAttributeGroupID*
212+
...
213+
}
214+
{
215+
llvm/llvm-project#194147: TargetLowering::LowerCallTo
216+
Memcheck:Cond
217+
fun:*TargetLowering*LowerCallTo*
218+
...
219+
}

0 commit comments

Comments
 (0)