Path: blob/main/contrib/llvm-project/compiler-rt/lib/orc/jit_dispatch.h
213766 views
//===------ jit_dispatch.h - Call back to an ORC controller -----*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7//8// This file is a part of the ORC runtime support library.9//10//===----------------------------------------------------------------------===//1112#ifndef ORC_RT_JIT_DISPATCH_H13#define ORC_RT_JIT_DISPATCH_H1415#include "common.h"16#include "wrapper_function_utils.h"1718namespace orc_rt {1920class JITDispatch {21public:22JITDispatch(const void *FnTag) : FnTag(FnTag) {}2324WrapperFunctionResult operator()(const char *ArgData, size_t ArgSize) {25// Since the functions cannot be zero/unresolved on Windows, the following26// reference taking would always be non-zero, thus generating a compiler27// warning otherwise.28#if !defined(_WIN32)29if (ORC_RT_UNLIKELY(!&__orc_rt_jit_dispatch_ctx))30return WrapperFunctionResult::createOutOfBandError(31"__orc_rt_jit_dispatch_ctx not set")32.release();33if (ORC_RT_UNLIKELY(!&__orc_rt_jit_dispatch))34return WrapperFunctionResult::createOutOfBandError(35"__orc_rt_jit_dispatch not set")36.release();37#endif3839return __orc_rt_jit_dispatch(&__orc_rt_jit_dispatch_ctx, FnTag, ArgData,40ArgSize);41}4243private:44const void *FnTag;45};4647} // namespace orc_rt4849#endif // ORC_RT_JIT_DISPATCH_H505152