Skip to content
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

Add support for an external interpreter #346

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

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

Copy link

@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

lib/Interpreter/CppInterOp.cpp Show resolved Hide resolved
lib/Interpreter/CppInterOp.cpp Show resolved Hide resolved
lib/Interpreter/CppInterOp.cpp Show resolved Hide resolved
lib/Interpreter/CppInterOp.cpp Outdated Show resolved Hide resolved
@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

@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

lib/Interpreter/CppInterOp.cpp Show resolved Hide resolved
Copy link

codecov bot commented Oct 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.47%. Comparing base (b2d787b) to head (fcfab29).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #346      +/-   ##
==========================================
+ Coverage   74.43%   74.47%   +0.03%     
==========================================
  Files           8        8              
  Lines        3204     3208       +4     
==========================================
+ Hits         2385     2389       +4     
  Misses        819      819              
Files with missing lines Coverage Δ
include/clang/Interpreter/CppInterOp.h 96.29% <ø> (ø)
lib/Interpreter/CppInterOp.cpp 80.04% <100.00%> (+0.05%) ⬆️

... and 1 file with indirect coverage changes

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

... 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?

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 2 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 5 times, most recently from 5935eaf to 2996beb Compare October 31, 2024 11:20
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