Skip to content

Move DynamicLibraryManager from function-local static to per-interpreter member.#900

Open
vgvassilev wants to merge 1 commit intocompiler-research:mainfrom
vgvassilev:statics-p2
Open

Move DynamicLibraryManager from function-local static to per-interpreter member.#900
vgvassilev wants to merge 1 commit intocompiler-research:mainfrom
vgvassilev:statics-p2

Conversation

@vgvassilev
Copy link
Copy Markdown
Contributor

The DLM was a function-local static shared across all interpreter instances, causing search paths added in one interpreter to leak into all others. Move it to a mutable unique_ptr member of CppInternal::Interpreter so each instance owns its DLM and search path state is properly isolated.

Add a test that creates two interpreters, adds a search path to the first, and verifies the second cannot find a library through that path.

Copy link
Copy Markdown
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

auto* I1 = TestFixture::CreateInterpreter();
ASSERT_NE(I1, nullptr);
Cpp::ActivateInterpreter(I1);
Cpp::AddSearchPath(BinDir.str().c_str());
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.

warning: too few arguments to function call, expected 3, have 1 [clang-diagnostic-error]

  Cpp::AddSearchPath(BinDir.str().c_str());
                                         ^

@vgvassilev vgvassilev force-pushed the statics-p2 branch 2 times, most recently from 28aabdd to fb7ec74 Compare April 23, 2026 04:45
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.82%. Comparing base (d23a821) to head (a926162).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #900      +/-   ##
==========================================
+ Coverage   81.73%   81.82%   +0.08%     
==========================================
  Files          15       15              
  Lines        4759     4758       -1     
==========================================
+ Hits         3890     3893       +3     
+ Misses        869      865       -4     
Files with missing lines Coverage Δ
lib/CppInterOp/CppInterOpInterpreter.h 86.16% <100.00%> (-0.07%) ⬇️

... and 1 file with indirect coverage changes

Files with missing lines Coverage Δ
lib/CppInterOp/CppInterOpInterpreter.h 86.16% <100.00%> (-0.07%) ⬇️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions
Copy link
Copy Markdown
Contributor

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

…ter member.

The DLM was a function-local static shared across all interpreter instances,
causing search paths added in one interpreter to leak into all others. Move it
to a mutable unique_ptr member of CppInternal::Interpreter so each instance
owns its DLM and search path state is properly isolated.

Add a test that creates two interpreters, adds a search path to the first, and
verifies the second cannot find a library through that path.
@github-actions
Copy link
Copy Markdown
Contributor

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

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.

1 participant