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

Duplicate JITDylib in the Search Order #41282

Closed
llvmbot opened this issue May 19, 2019 · 6 comments
Closed

Duplicate JITDylib in the Search Order #41282

llvmbot opened this issue May 19, 2019 · 6 comments
Labels
bugzilla Issues migrated from bugzilla orcjit

Comments

@llvmbot
Copy link
Collaborator

llvmbot commented May 19, 2019

Bugzilla Link 41937
Resolution FIXED
Resolved on May 21, 2019 20:16
Version trunk
OS Linux
Reporter LLVM Bugzilla Contributor
CC @AlexDenisov,@dwblaikie,@lhames,@weliveindetail

Extended Description

Currently, ORC allows to have a same name for multiple JITDylibs. Well, this can be confusing for clients creating JITDylibs and populating code in it. For a single ExecutionSession instance we should have JITDylib names. Possible solution is have a check in ExecutionSession::createJITDylib method, and return a Expected<JITDylib&>.

Is multiple JITDylibs with same names serve a purpose? Is it a bug or feature?

Thanks

@llvmbot
Copy link
Collaborator Author

llvmbot commented May 19, 2019

  • For a single ExecutionSession instance we should have unique JITDylib names

@lhames
Copy link
Contributor

lhames commented May 19, 2019

For now the JITDylib names are only used for debugging output (I don't have any plans to use them for anything else yet, either), but I think it would be reasonable to add this restriction. It would be an API contract though, so this should be verified by an assertion, rather than returning a runtime error. I would be inclined to add another method to ExecutionSession:

/// Returns the JITDylib with the given name, or nullptr if no such dylib exists.
JITDylib *getDylibByName(StringRef Name);

For now that could be implemented as a linear search through the JITDylibs list.

Then createJITDylib could be written as:

JITDylib &createJITDylib(StringRef Name) {
assert(!getDylibByName(Name) && "A dylib with that name already exists");
...
}

@weliveindetail
Copy link
Contributor

Good point. I agree that the API may enforce unique dylib names and it should be checked with assertions.

In case of createJITDylib(), though, the name must be considered user input (see lli's -jd param as an example). We may deduplicate here, so that subsequent code can relay on uniqueness (and use assertions).

@llvmbot
Copy link
Collaborator Author

llvmbot commented May 21, 2019

Fix: https://reviews.llvm.org/D62139

@lhames
Copy link
Contributor

lhames commented May 21, 2019

In case of createJITDylib(), though, the name must be considered user input
(see lli's -jd param as an example). We may deduplicate here, so that
subsequent code can relay on uniqueness (and use assertions).

Good point. I think the answer is to document the contract and adds checks to lli. I have done this in r361322.

Praveen -- if you're happy with the fix please mark this as RESOLVED/FIXED. :)

@llvmbot
Copy link
Collaborator Author

llvmbot commented May 22, 2019

Closing note:
Assertion added to the createJITDylib method. And the corresponding use cases in lli tool has be updated. (Thanks lang).

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla orcjit
Projects
None yet
Development

No branches or pull requests

3 participants