LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 22612 - Add Orc Error Handling
Summary: Add Orc Error Handling
Status: RESOLVED FIXED
Alias: None
Product: libraries
Classification: Unclassified
Component: OrcJIT (show other bugs)
Version: trunk
Hardware: Other All
: P normal
Assignee: Unassigned LLVM Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-02-16 20:28 PST by Lang Hames
Modified: 2019-05-20 14:55 PDT (History)
9 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lang Hames 2015-02-16 20:28:53 PST
There's currently no way for Orc to report errors to the user.

We sould add a JITErrorLog class and make sure a reference to it is available in each layer. Straw man implementation:

class JITErrorLog {
public:
  void addError(std::string ErrMsg) { Errors.push_back(std::move(ErrMsg); }
  bool allOk() const { return Errors.empty(); }
  void reset() { Errors.clear(); }
private:
  std::vector<std::string> Errors;
};

More information can be added as required.

Possible gotchas: We want Orc to run multi-threaded day, but we don't want cross-talk between threads. Syncronisation and extra support will be required to ensure that errors are reported and responded to on the appropriate thread.
Comment 1 Reid Kleckner 2015-02-17 13:49:50 PST
Don't we have error reporting on the LLVMContext now? Is that appropriate?
Comment 2 Lang Hames 2015-02-17 15:34:17 PST
Hrm. I hadn't thought of that.

Off the top of my head I have a couple of (potentially minor) objections:

(1) RuntimeDyld doesn't need/want an LLVMContext. In *most* contexts where you're using it you'll already have an LLVMContext too, but not everywhere. See e.g. llvm-rtdyld. Also I'm told people are using it in isolation in the real world. (That's scary in its own right, but still - apparently a thing...).

(2) I eventually want Orc to support threaded compilation, so there would be multiple LLVMContexts in play. In that case we'd still want one global error reporting mechanism.

Have I overlooked anything obvious there? If we *don't* go for LLVMContext I'd certainly be happy to make sure that whatever error reporting mechanism we do have can be optionally forwarded to a given context. That will make life easy in the common case where there's just one LLVMContext.
Comment 3 Rafael Ávila de Espíndola 2015-02-18 14:51:32 PST
(In reply to comment #2)
> Hrm. I hadn't thought of that.
> 
> Off the top of my head I have a couple of (potentially minor) objections:
> 
> (1) RuntimeDyld doesn't need/want an LLVMContext. In *most* contexts where
> you're using it you'll already have an LLVMContext too, but not everywhere.
> See e.g. llvm-rtdyld. Also I'm told people are using it in isolation in the
> real world. (That's scary in its own right, but still - apparently a
> thing...).

Note that there is some desire to move the diagnostic reporting code out of lib/IR into lib/Support so that it can be used in places where a LLVMContext is not easy to get.
Comment 4 Lang Hames 2016-05-03 12:49:02 PDT
We can use the new Error class (include/Support/Error.h) for this now.

I've started threading Error through the implementation of RuntimeDyld. The next step is to actually tackle the SymbolResolver/MemoryManager/ORC interface redesign.
Comment 5 Stefan Gränitz 2019-05-20 06:38:33 PDT
Most of the Orc code should be errorized nowadays, right? Are there any particular pieces missing?
Comment 6 Lang Hames 2019-05-20 14:55:53 PDT
> Are there any particular pieces missing?

I don't think so (maybe there is some missing plumbing in ORCv1, but we're deprecating that now anyway). ORCv2 was written from the ground up with llvm::Error and has pretty thorough error plumbing. I'm calling this fixed. :)