Skip to content

[cppinterop] Upgrade to latest for cppyy migration#22728

Open
aaronj0 wants to merge 7 commits into
root-project:masterfrom
aaronj0:cppinterop-upgrade
Open

[cppinterop] Upgrade to latest for cppyy migration#22728
aaronj0 wants to merge 7 commits into
root-project:masterfrom
aaronj0:cppinterop-upgrade

Conversation

@aaronj0

@aaronj0 aaronj0 commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Test and land the latest upgrade, required to rebase the cppyy migration PR on top

@aaronj0 aaronj0 requested a review from guitargeek June 29, 2026 12:18
@aaronj0 aaronj0 self-assigned this Jun 29, 2026
@github-actions

github-actions Bot commented Jun 29, 2026

Copy link
Copy Markdown

Test Results

    23 files      23 suites   3d 13h 41m 12s ⏱️
 3 874 tests  3 851 ✅   0 💤 23 ❌
78 801 runs  78 670 ✅ 108 💤 23 ❌

For more details on these failures, see this check.

Results for commit a0a483b.

♻️ This comment has been updated with latest results.

@vgvassilev

Copy link
Copy Markdown
Member

@aaronj0, I believe we need to also move Box.h to ROOTSYS/etc

@aaronj0

aaronj0 commented Jun 29, 2026

Copy link
Copy Markdown
Contributor Author

@aaronj0, I believe we need to also move Box.h to ROOTSYS/etc

Yes, I have that obvious change and more patches in the pipeline.. (adapting to the new types, etc)
Will push all at once, when my local build is green

aaronj0 added 5 commits July 3, 2026 13:54
The latest CppInterOp upgrade introduces opaque-handle structs Cpp::ObjectRef, Cpp::DeclRef, and Cpp::InterpRef (CppInterOpTypes.h) to replace void*/typedef pointer arguments.
The latest CppInterOp upgrade changes UseExternalInterpreter
to also install a CppInteropDiagConsumer onto Cling's DiagnosticsEngine.
Rootcling later wraps the current diag client with CheckModuleBuildClient via
DiagnosticsEngine::setClient which deletes CppInterOp's previously-owned client.
This leads to CheckModuleBuildClient holding a dangling fChild pointer.

Without this patch, cling::Interpreter::ShutDown crashes. Since rootcling does not use CppInterOp, we can avoid registering the
interpreter with CppInterOp if we are running in rootcling.
In this test, the handle-taking pointer comes from dlsym at runtime, so
the compiler cannot see through it. Here the pointer is a compile-time
constant and GCC 11 exploits the type mismatch (which is UB) to constant-
fold the call giving a wrong reslt. Route the call through a volatile local so the
compiler treats the pointer as runtime-opaque, matching dispatch
@aaronj0 aaronj0 force-pushed the cppinterop-upgrade branch from 09a28ec to 4dbc826 Compare July 3, 2026 11:54
@aaronj0

aaronj0 commented Jul 3, 2026

Copy link
Copy Markdown
Contributor Author

I believe this upgrade now passes the CI, the windows x64 failures are visible on master. I will upstream the required patches and bump this upgrade to the latest commit. cc @guitargeek

aaronj0 added 2 commits July 3, 2026 14:16
… MSVC

Add __thiscall to the bitcast type on _M_IX86 so the caller reproduces the compiler's virtual-dispatch ABI
CreateInterpreter built ClingArgv from pointers of function-local strings
(main executable path, extracted resource dir, libc++ include dir,
CPPINTEROP_EXTRA_INTERPRETER_ARGS). But the interpreter keeps the raw argv
pointers for its whole lifetime (cling::CompilerOptions, analagous for
clang-repl), so asan reports accesses to them after CreateInterpreter returns.

Fix: Collect owned copies of every argument and store it as a part of
per-interpreter info, so it is released when DeleteInterpreter is called
@aaronj0 aaronj0 force-pushed the cppinterop-upgrade branch from 4dbc826 to a0a483b Compare July 3, 2026 12:22
@aaronj0 aaronj0 added the clean build Ask CI to do non-incremental build on PR label Jul 3, 2026
return static_cast<int>(static_cast<B*>(self)->m_x +
static_cast<B*>(self)->m_d);
// Replacement functions installed into vtable slots.
struct Repl {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why we changed that to a struct?

@guitargeek guitargeek left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for the update. Unfortunately we don't have green builds on Windows, but that problem is also present in the nightlies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clean build Ask CI to do non-incremental build on PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants