62#define ERROR_HEADER srn_error_t *maybe_error
63#define TRACE_FRAME_DEPTH 32
70#define HAS_ERROR(x) ((x).maybe_error != nullptr)
72#define PUSH_TRACE(ctx, x) srn_error_trace_push(ctx, (x).maybe_error, __builtin_return_address(0))
73#define PUSH_AND_MOVE(ctx, from, to) \
75 (to).maybe_error = (from).maybe_error; \
76 PUSH_TRACE(ctx, to); \
152#ifdef SRN_WITH_SERENE
178#ifdef SRN_WITH_SERENE
217[[nodiscard]] [[gnu::nonnull(1)]]
223#define ERR(ctx, err, msg) srn_errors_make(ctx, err, msg, __builtin_return_address(0))
224#define ERR_FROM(ctx, src) srn_errors_from(ctx, src, __builtin_return_address(0))
225#define FAIL(ctx, T, err, msg) \
226 ((T *)srn_errors_fail(ctx, sizeof(T), alignof(T), err, msg, __builtin_return_address(0)))
232[[nodiscard]] [[gnu::nonnull(1)]]
243#ifdef SRN_WITH_SERENE
srn_error_t * srn_errors_make(const srn_context_t *ctx, srn_error_tag_t tag, const char *msg, void *caller)
Build an error in ctx's memory, tagged tag and carrying msg.
void srn_error_trace_push(const srn_context_t *ctx, srn_error_t *err, void *addr)
Append a return address to the trace of a runtime-layer error.
void * srn_errors_fail(const srn_context_t *ctx, size_t size, size_t alignment, srn_error_tag_t tag, const char *msg, void *caller)
Allocate a size/alignment value in ctx, set its ERROR_HEADER (the first member, srn_error_t *maybe_er...
srn_error_t * srn_errors_from(const srn_context_t *ctx, const srn_error_t *src, void *caller)
Build an error in ctx's memory that carries the layer, tag, message and payload of src,...
srn_error_tag_t
The kind of a failure.
@ JIT_IR_PARSE_FAILED
The JIT could not parse a module's LLVM IR or bitcode.
@ STRING_LENGTH_LIMIT_EXCEEDED
@ INVALID_ARGUMENT
The request itself is malformed (an empty POLL interest mask, for example), so retrying it unchanged ...
@ CHANNEL_BUSY
The channel already has a full ring's worth of operations in flight.
@ JIT_SYMBOL_ALREADY_DEFINED
A JIT symbol definition collided with a name already defined.
@ JIT_SYMBOL_NOT_FOUND
A JIT symbol lookup found no symbol of that name.
srn_error_tag_t srn_errno_to_tag(int errno_value, srn_error_tag_t default_tag)
Map a POSIX errno to error tag.
char * srn_error_to_string(const srn_context_t *ctx, const srn_error_t *err)
Format err as a newly allocated string of the form [TAG]: msg, allocated in ctx.
#define TRACE_FRAME_DEPTH
A runtime error, a tag classifying the failure and a human-readable message.
union srn_error_t::@110141362101221075206211275212023153042233307220 as
srn_trace_frames_t * frames
This is how we create a traceback for the C level code in the runtime lib.
void * return_addrs[TRACE_FRAME_DEPTH]