Skip to content

Add support for an external interpreter #346

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 4, 2024

Conversation

aaronj0
Copy link
Collaborator

@aaronj0 aaronj0 commented Oct 29, 2024

The new interface can be called by an external library like ROOT, that manages it's own TInterpreter instance. In this case the cling::Interpreter* initialized by TCling is passed to InterOp and a flag indicates that InterOp does not have ownership

@aaronj0 aaronj0 requested a review from vgvassilev October 29, 2024 10:39
Copy link
Contributor

@github-actions github-actions bot left a comment

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

@aaronj0 aaronj0 force-pushed the add-external-interpreter branch 2 times, most recently from fe324fa to 95bd490 Compare October 29, 2024 18:14
Copy link
Contributor

@github-actions github-actions bot left a comment

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

Copy link

codecov bot commented Oct 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.45%. Comparing base (b2d787b) to head (4dd1e41).
Report is 2 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #346      +/-   ##
==========================================
+ Coverage   74.43%   74.45%   +0.01%     
==========================================
  Files           8        8              
  Lines        3204     3206       +2     
==========================================
+ Hits         2385     2387       +2     
  Misses        819      819              
Files with missing lines Coverage Δ
include/clang/Interpreter/CppInterOp.h 96.29% <ø> (ø)
lib/Interpreter/CppInterOp.cpp 80.02% <100.00%> (+0.03%) ⬆️

... and 1 file with indirect coverage changes

Files with missing lines Coverage Δ
include/clang/Interpreter/CppInterOp.h 96.29% <ø> (ø)
lib/Interpreter/CppInterOp.cpp 80.02% <100.00%> (+0.03%) ⬆️

... and 1 file with indirect coverage changes

void UseExternalInterpreter(TInterp_t I) {
assert(sInterpreter && "sInterpreter already in use!");
sInterpreter = static_cast<compat::Interpreter*>(I);
OwningSInterpreter = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we write a test for this?

@aaronj0 aaronj0 force-pushed the add-external-interpreter branch 3 times, most recently from 417bcd7 to 002ba81 Compare October 30, 2024 19:48

EXPECT_NE(ExtInterp, nullptr);
Cpp::UseExternalInterpreter(ExtInterp);
EXPECT_FALSE(Cpp::OwnsInterpreter());
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't need this probably. We can delete ExtInterp and write a death test.

@aaronj0 aaronj0 force-pushed the add-external-interpreter branch 7 times, most recently from fcfab29 to 9725d94 Compare November 4, 2024 13:17
@aaronj0 aaronj0 force-pushed the add-external-interpreter branch from 9725d94 to 2df347c Compare November 4, 2024 13:36
@aaronj0 aaronj0 force-pushed the add-external-interpreter branch from 2df347c to 13669e1 Compare November 4, 2024 13:48
The new interface can be called by an external library like ROOT, that manages it's own `TInterpreter` instance.
In this case the `cling::Interpreter*` initialised by TCling is passed to InterOp and a flag indicates that InterOp does not have ownership
@aaronj0 aaronj0 force-pushed the add-external-interpreter branch from 13669e1 to 4dd1e41 Compare November 4, 2024 14:00
Copy link
Contributor

@vgvassilev vgvassilev left a comment

Choose a reason for hiding this comment

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

LGTM!

@aaronj0 aaronj0 merged commit 9da7679 into compiler-research:main Nov 4, 2024
55 checks passed
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.

2 participants