Skip to content

Add TakeInterpreter to release interpreter ownership - #1189

Open
AdityaDRathore wants to merge 3 commits into
compiler-research:mainfrom
AdityaDRathore:feat/take-interpreter
Open

AdityaDRathore wants to merge 3 commits into
compiler-research:mainfrom
AdityaDRathore:feat/take-interpreter

Conversation

@AdityaDRathore

@AdityaDRathore AdityaDRathore commented Nov 29, 2026 •

Copy link
Copy Markdown

Fixes #732

Adds TakeInterpreter to detach a tracked interpreter and hand ownership back to the caller without destroying it

I went with InterpRef as the return type (similar to unique_ptr release()) so TakeInterpreter() with the default nullptr returns the active handle directly while still working in boolean checks. can switch it if you'd prefer a different signature @vgvassilev @aaronj0 @Vipul-Cariappa

i tested locally with all the test passing and cppjit pytest suite

Screenshot from 2026-11-29 21-56-10

Releases an interpreter from CppInterOp's tracked stack without
destroying it, uninstalling CppInteropDiagConsumer and suppressing
process-exit llvm_shutdown when releasing an owned interpreter.

Fixes: compiler-research#732
@codecov

codecov Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.99%. Comparing base (3ab124a) to head (704d945).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1189      +/-   ##
==========================================
+ Coverage   88.86%   88.99%   +0.12%     
==========================================
  Files          24       24              
  Lines        7014     7059      +45     
==========================================
+ Hits         6233     6282      +49     
+ Misses        781      777       -4     
Files with missing lines Coverage Δ
lib/CppInterOp/CppInterOp.cpp 91.38% <100.00%> (+0.15%) ⬆️
lib/CppInterOp/ErrorInternal.cpp 85.58% <100.00%> (+1.31%) ⬆️
lib/CppInterOp/InterpreterInfo.h 100.00% <100.00%> (ø)
Files with missing lines Coverage Δ
lib/CppInterOp/CppInterOp.cpp 91.38% <100.00%> (+0.15%) ⬆️
lib/CppInterOp/ErrorInternal.cpp 85.58% <100.00%> (+1.31%) ⬆️
lib/CppInterOp/InterpreterInfo.h 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions github-actions Bot 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.

clang-tidy made some suggestions

There were too many comments to post at once. Showing the first 10 out of 15. Check the log or trigger a new build to see more.

Comment thread lib/CppInterOp/ErrorInternal.cpp Resolved
Comment thread lib/CppInterOp/ErrorInternal.cpp Resolved
Comment thread lib/CppInterOp/ErrorInternal.cpp Resolved
Comment thread unittests/CppInterOp/CAPITest.cpp Resolved
Comment thread unittests/CppInterOp/CAPITest.cpp Resolved
Comment thread unittests/CppInterOp/CAPITest.cpp Resolved

@github-actions github-actions Bot 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.

clang-tidy made some suggestions

@github-actions

Copy link
Copy Markdown
Contributor

clang-tidy review says "All clean, LGTM! 👍"

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request]: TakeInterpreter functionality to use be UseExternalInterpreter

1 participant