mirror of
https://github.com/intel/llvm.git
synced 2026-01-20 01:58:44 +08:00
[ORC-RT] Remove double underscore from the orc_rt namespace.
We should use `orc_rt` as the public C++ API namespace for the ORC runtime and control symbol visibility to hide implementation details, rather than rely on the '__' prefix.
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
#include <ostream>
|
||||
#include <string>
|
||||
|
||||
namespace __orc_rt {
|
||||
namespace orc_rt {
|
||||
|
||||
constexpr std::size_t dynamic_extent = std::numeric_limits<std::size_t>::max();
|
||||
|
||||
@@ -58,6 +58,6 @@ private:
|
||||
size_type Size = 0;
|
||||
};
|
||||
|
||||
} // end namespace __orc_rt
|
||||
} // namespace orc_rt
|
||||
|
||||
#endif // ORC_RT_ADT_H
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include <cassert>
|
||||
#include <type_traits>
|
||||
|
||||
namespace __orc_rt {
|
||||
namespace orc_rt {
|
||||
|
||||
/// ORC_RT_MARK_AS_BITMASK_ENUM lets you opt in an individual enum type so you
|
||||
/// can perform bitwise operations on it without putting static_cast everywhere.
|
||||
@@ -146,6 +146,6 @@ E &operator^=(E &LHS, E RHS) {
|
||||
return LHS;
|
||||
}
|
||||
|
||||
} // end namespace __orc_rt
|
||||
} // namespace orc_rt
|
||||
|
||||
#endif // ORC_RT_BITMASK_ENUM_H
|
||||
|
||||
@@ -29,9 +29,9 @@
|
||||
|
||||
#define DEBUG_TYPE "coff_platform"
|
||||
|
||||
using namespace __orc_rt;
|
||||
using namespace orc_rt;
|
||||
|
||||
namespace __orc_rt {
|
||||
namespace orc_rt {
|
||||
|
||||
using COFFJITDylibDepInfo = std::vector<ExecutorAddr>;
|
||||
using COFFJITDylibDepInfoMap =
|
||||
@@ -45,7 +45,7 @@ using SPSCOFFJITDylibDepInfo = SPSSequence<SPSExecutorAddr>;
|
||||
using SPSCOFFJITDylibDepInfoMap =
|
||||
SPSSequence<SPSTuple<SPSExecutorAddr, SPSCOFFJITDylibDepInfo>>;
|
||||
|
||||
} // namespace __orc_rt
|
||||
} // namespace orc_rt
|
||||
|
||||
ORC_RT_JIT_DISPATCH_TAG(__orc_rt_coff_symbol_lookup_tag)
|
||||
ORC_RT_JIT_DISPATCH_TAG(__orc_rt_coff_push_initializers_tag)
|
||||
@@ -752,7 +752,7 @@ ORC_RT_INTERFACE int64_t __orc_rt_coff_run_program(const char *JITDylibName,
|
||||
using MainTy = int (*)(int, char *[]);
|
||||
|
||||
void *H =
|
||||
__orc_rt_coff_jit_dlopen(JITDylibName, __orc_rt::coff::ORC_RT_RTLD_LAZY);
|
||||
__orc_rt_coff_jit_dlopen(JITDylibName, orc_rt::coff::ORC_RT_RTLD_LAZY);
|
||||
if (!H) {
|
||||
__orc_rt_log_error(__orc_rt_coff_jit_dlerror());
|
||||
return -1;
|
||||
|
||||
@@ -23,7 +23,7 @@ ORC_RT_INTERFACE int __orc_rt_coff_jit_dlclose(void *header);
|
||||
ORC_RT_INTERFACE void *__orc_rt_coff_jit_dlsym(void *header,
|
||||
const char *symbol);
|
||||
|
||||
namespace __orc_rt {
|
||||
namespace orc_rt {
|
||||
namespace coff {
|
||||
|
||||
enum dlopen_mode : int {
|
||||
@@ -33,7 +33,7 @@ enum dlopen_mode : int {
|
||||
ORC_RT_RTLD_GLOBAL = 0x8
|
||||
};
|
||||
|
||||
} // end namespace coff
|
||||
} // end namespace __orc_rt
|
||||
} // namespace coff
|
||||
} // namespace orc_rt
|
||||
|
||||
#endif
|
||||
|
||||
@@ -18,8 +18,7 @@
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
|
||||
namespace __orc_rt {
|
||||
namespace orc_rt {
|
||||
|
||||
#ifndef NDEBUG
|
||||
|
||||
@@ -80,4 +79,4 @@ void printdbg(const char *format, ...) {
|
||||
|
||||
#endif // !NDEBUG
|
||||
|
||||
} // end namespace __orc_rt
|
||||
} // namespace orc_rt
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
#ifndef NDEBUG
|
||||
|
||||
namespace __orc_rt {
|
||||
namespace orc_rt {
|
||||
|
||||
extern std::atomic<const char *> DebugTypes;
|
||||
extern char DebugTypesAll;
|
||||
@@ -27,18 +27,16 @@ const char *initializeDebug();
|
||||
bool debugTypeEnabled(const char *Type, const char *Types);
|
||||
void printdbg(const char *format, ...);
|
||||
|
||||
} // namespace __orc_rt
|
||||
} // namespace orc_rt
|
||||
|
||||
#define ORC_RT_DEBUG_WITH_TYPE(TYPE, X) \
|
||||
do { \
|
||||
const char *Types = \
|
||||
::__orc_rt::DebugTypes.load(std::memory_order_relaxed); \
|
||||
const char *Types = ::orc_rt::DebugTypes.load(std::memory_order_relaxed); \
|
||||
if (!Types) \
|
||||
Types = initializeDebug(); \
|
||||
if (Types == &DebugTypesNone) \
|
||||
break; \
|
||||
if (Types == &DebugTypesAll || \
|
||||
::__orc_rt::debugTypeEnabled(TYPE, Types)) { \
|
||||
if (Types == &DebugTypesAll || ::orc_rt::debugTypeEnabled(TYPE, Types)) { \
|
||||
X; \
|
||||
} \
|
||||
} while (false)
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
using namespace __orc_rt;
|
||||
using namespace orc_rt;
|
||||
|
||||
extern "C" const char *__orc_rt_jit_dlerror();
|
||||
extern "C" void *__orc_rt_jit_dlopen(const char *path, int mode);
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
using namespace __orc_rt;
|
||||
using namespace __orc_rt::elfnix;
|
||||
using namespace orc_rt;
|
||||
using namespace orc_rt::elfnix;
|
||||
|
||||
// Declare function tags for functions in the JIT process.
|
||||
ORC_RT_JIT_DISPATCH_TAG(__orc_rt_elfnix_get_initializers_tag)
|
||||
@@ -601,7 +601,7 @@ ORC_RT_INTERFACE int64_t __orc_rt_elfnix_run_program(
|
||||
using MainTy = int (*)(int, char *[]);
|
||||
|
||||
void *H = __orc_rt_elfnix_jit_dlopen(JITDylibName,
|
||||
__orc_rt::elfnix::ORC_RT_RTLD_LAZY);
|
||||
orc_rt::elfnix::ORC_RT_RTLD_LAZY);
|
||||
if (!H) {
|
||||
__orc_rt_log_error(__orc_rt_elfnix_jit_dlerror());
|
||||
return -1;
|
||||
|
||||
@@ -29,7 +29,7 @@ ORC_RT_INTERFACE int __orc_rt_elfnix_jit_dlclose(void *dso_handle);
|
||||
ORC_RT_INTERFACE void *__orc_rt_elfnix_jit_dlsym(void *dso_handle,
|
||||
const char *symbol);
|
||||
|
||||
namespace __orc_rt {
|
||||
namespace orc_rt {
|
||||
namespace elfnix {
|
||||
|
||||
struct ELFNixPerObjectSectionsToRegister {
|
||||
@@ -65,7 +65,7 @@ enum dlopen_mode : int {
|
||||
ORC_RT_RTLD_GLOBAL = 0x8
|
||||
};
|
||||
|
||||
} // end namespace elfnix
|
||||
} // namespace elfnix
|
||||
|
||||
using SPSELFNixPerObjectSectionsToRegister =
|
||||
SPSTuple<SPSExecutorAddrRange, SPSExecutorAddrRange>;
|
||||
@@ -126,6 +126,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
} // end namespace __orc_rt
|
||||
} // namespace orc_rt
|
||||
|
||||
#endif // ORC_RT_ELFNIX_PLATFORM_H
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
namespace __orc_rt {
|
||||
namespace orc_rt {
|
||||
|
||||
/// ByteSwap_16 - This function returns a byte-swapped representation of
|
||||
/// the 16-bit argument.
|
||||
@@ -138,6 +138,6 @@ template <typename T> inline void swapByteOrder(T &Value) {
|
||||
Value = getSwappedBytes(Value);
|
||||
}
|
||||
|
||||
} // end namespace __orc_rt
|
||||
} // namespace orc_rt
|
||||
|
||||
#endif // ORC_RT_ENDIAN_H
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
|
||||
namespace __orc_rt {
|
||||
namespace orc_rt {
|
||||
|
||||
/// Base class for all errors.
|
||||
class ErrorInfoBase : public RTTIExtends<ErrorInfoBase, RTTIRoot> {
|
||||
@@ -421,6 +421,6 @@ private:
|
||||
std::string ErrMsg;
|
||||
};
|
||||
|
||||
} // end namespace __orc_rt
|
||||
} // namespace orc_rt
|
||||
|
||||
#endif // ORC_RT_ERROR_H
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include <cassert>
|
||||
#include <type_traits>
|
||||
|
||||
namespace __orc_rt {
|
||||
namespace orc_rt {
|
||||
|
||||
using ExecutorAddrDiff = uint64_t;
|
||||
|
||||
@@ -30,7 +30,7 @@ using ExecutorAddrDiff = uint64_t;
|
||||
class ExecutorAddr {
|
||||
public:
|
||||
/// A wrap/unwrap function that leaves pointers unmodified.
|
||||
template <typename T> using rawPtr = __orc_rt::identity<T *>;
|
||||
template <typename T> using rawPtr = orc_rt::identity<T *>;
|
||||
|
||||
/// Default wrap function to use on this host.
|
||||
template <typename T> using defaultWrap = rawPtr<T>;
|
||||
@@ -247,13 +247,13 @@ public:
|
||||
|
||||
using SPSExecutorAddrRangeSequence = SPSSequence<SPSExecutorAddrRange>;
|
||||
|
||||
} // End namespace __orc_rt
|
||||
} // End namespace orc_rt
|
||||
|
||||
namespace std {
|
||||
|
||||
// Make ExecutorAddr hashable.
|
||||
template <> struct hash<__orc_rt::ExecutorAddr> {
|
||||
size_t operator()(const __orc_rt::ExecutorAddr &A) const {
|
||||
template <> struct hash<orc_rt::ExecutorAddr> {
|
||||
size_t operator()(const orc_rt::ExecutorAddr &A) const {
|
||||
return hash<uint64_t>()(A.getValue());
|
||||
}
|
||||
};
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include "executor_address.h"
|
||||
#include "simple_packed_serialization.h"
|
||||
|
||||
namespace __orc_rt {
|
||||
namespace orc_rt {
|
||||
|
||||
/// Flags for symbols in the JIT.
|
||||
class JITSymbolFlags {
|
||||
@@ -146,6 +146,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
} // End namespace __orc_rt
|
||||
} // End namespace orc_rt
|
||||
|
||||
#endif // ORC_RT_EXECUTOR_SYMBOL_DEF_H
|
||||
|
||||
@@ -16,9 +16,9 @@
|
||||
|
||||
#include "extensible_rtti.h"
|
||||
|
||||
namespace __orc_rt {
|
||||
namespace orc_rt {
|
||||
|
||||
char RTTIRoot::ID = 0;
|
||||
void RTTIRoot::anchor() {}
|
||||
|
||||
} // end namespace __orc_rt
|
||||
} // namespace orc_rt
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
#ifndef ORC_RT_EXTENSIBLE_RTTI_H
|
||||
#define ORC_RT_EXTENSIBLE_RTTI_H
|
||||
|
||||
namespace __orc_rt {
|
||||
namespace orc_rt {
|
||||
|
||||
template <typename ThisT, typename ParentT> class RTTIExtends;
|
||||
|
||||
@@ -140,6 +140,6 @@ template <typename To, typename From> bool isa(const From &Value) {
|
||||
return To::classof(&Value);
|
||||
}
|
||||
|
||||
} // end namespace __orc_rt
|
||||
} // namespace orc_rt
|
||||
|
||||
#endif // ORC_RT_EXTENSIBLE_RTTI_H
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include <cassert>
|
||||
#include <map>
|
||||
|
||||
namespace __orc_rt {
|
||||
namespace orc_rt {
|
||||
|
||||
enum class IntervalCoalescing { Enabled, Disabled };
|
||||
|
||||
@@ -163,6 +163,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
} // End namespace __orc_rt
|
||||
} // End namespace orc_rt
|
||||
|
||||
#endif // ORC_RT_INTERVAL_MAP_H
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
#include "interval_map.h"
|
||||
|
||||
namespace __orc_rt {
|
||||
namespace orc_rt {
|
||||
|
||||
/// Implements a coalescing interval set.
|
||||
///
|
||||
@@ -82,6 +82,6 @@ private:
|
||||
ImplMap Map;
|
||||
};
|
||||
|
||||
} // End namespace __orc_rt
|
||||
} // End namespace orc_rt
|
||||
|
||||
#endif // ORC_RT_INTERVAL_SET_H
|
||||
|
||||
@@ -30,8 +30,8 @@
|
||||
|
||||
#define DEBUG_TYPE "macho_platform"
|
||||
|
||||
using namespace __orc_rt;
|
||||
using namespace __orc_rt::macho;
|
||||
using namespace orc_rt;
|
||||
using namespace orc_rt::macho;
|
||||
|
||||
// Declare function tags for functions in the JIT process.
|
||||
ORC_RT_JIT_DISPATCH_TAG(__orc_rt_macho_push_initializers_tag)
|
||||
@@ -82,7 +82,7 @@ using MachOJITDylibDepInfoMap =
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
namespace __orc_rt {
|
||||
namespace orc_rt {
|
||||
|
||||
using SPSMachOObjectPlatformSectionsMap =
|
||||
SPSSequence<SPSTuple<SPSString, SPSExecutorAddrRange>>;
|
||||
@@ -139,7 +139,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace __orc_rt
|
||||
} // namespace orc_rt
|
||||
|
||||
namespace {
|
||||
struct TLVDescriptor {
|
||||
@@ -406,7 +406,7 @@ private:
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
namespace __orc_rt {
|
||||
namespace orc_rt {
|
||||
|
||||
class SPSMachOExecutorSymbolFlags;
|
||||
|
||||
@@ -441,7 +441,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace __orc_rt
|
||||
} // namespace orc_rt
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -1532,8 +1532,8 @@ ORC_RT_INTERFACE int64_t __orc_rt_macho_run_program(const char *JITDylibName,
|
||||
int argc, char *argv[]) {
|
||||
using MainTy = int (*)(int, char *[]);
|
||||
|
||||
void *H = __orc_rt_macho_jit_dlopen(JITDylibName,
|
||||
__orc_rt::macho::ORC_RT_RTLD_LAZY);
|
||||
void *H =
|
||||
__orc_rt_macho_jit_dlopen(JITDylibName, orc_rt::macho::ORC_RT_RTLD_LAZY);
|
||||
if (!H) {
|
||||
__orc_rt_log_error(__orc_rt_macho_jit_dlerror());
|
||||
return -1;
|
||||
|
||||
@@ -28,7 +28,7 @@ ORC_RT_INTERFACE int __orc_rt_macho_jit_dlclose(void *dso_handle);
|
||||
ORC_RT_INTERFACE void *__orc_rt_macho_jit_dlsym(void *dso_handle,
|
||||
const char *symbol);
|
||||
|
||||
namespace __orc_rt {
|
||||
namespace orc_rt {
|
||||
namespace macho {
|
||||
|
||||
enum dlopen_mode : int {
|
||||
@@ -38,7 +38,7 @@ enum dlopen_mode : int {
|
||||
ORC_RT_RTLD_GLOBAL = 0x8
|
||||
};
|
||||
|
||||
} // end namespace macho
|
||||
} // end namespace __orc_rt
|
||||
} // namespace macho
|
||||
} // namespace orc_rt
|
||||
|
||||
#endif // ORC_RT_MACHO_PLATFORM_H
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
using namespace __orc_rt;
|
||||
using namespace orc_rt;
|
||||
|
||||
extern "C" int64_t __orc_rt_run_program(const char *JITDylibName,
|
||||
const char *EntrySymbolName, int argc,
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace __orc_rt {
|
||||
namespace orc_rt {
|
||||
|
||||
/// Output char buffer with overflow check.
|
||||
class SPSOutputBuffer {
|
||||
@@ -576,7 +576,7 @@ Expected<T> fromSPSSerializable(SPSSerializableExpected<T> BSE) {
|
||||
return make_error<StringError>(BSE.ErrMsg);
|
||||
}
|
||||
|
||||
} // end namespace detail
|
||||
} // namespace detail
|
||||
|
||||
/// Serialize to a SPSError from a detail::SPSSerializableError.
|
||||
template <>
|
||||
@@ -684,6 +684,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
} // end namespace __orc_rt
|
||||
} // namespace orc_rt
|
||||
|
||||
#endif // ORC_RT_SIMPLE_PACKED_SERIALIZATION_H
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include <utility>
|
||||
#include <tuple>
|
||||
|
||||
namespace __orc_rt {
|
||||
namespace orc_rt {
|
||||
|
||||
/// Substitute for std::identity.
|
||||
/// Switch to std::identity once we can use c++20.
|
||||
@@ -40,6 +40,6 @@ constexpr uint64_t bit_ceil(uint64_t Val) noexcept {
|
||||
return Val + 1;
|
||||
}
|
||||
|
||||
} // namespace __orc_rt
|
||||
} // namespace orc_rt
|
||||
|
||||
#endif // ORC_RT_STL_EXTRAS
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace __orc_rt {
|
||||
namespace orc_rt {
|
||||
|
||||
class PooledStringPtr;
|
||||
|
||||
@@ -156,7 +156,7 @@ inline bool StringPool::empty() const {
|
||||
return Pool.empty();
|
||||
}
|
||||
|
||||
} // end namespace __orc_rt
|
||||
} // namespace orc_rt
|
||||
|
||||
namespace std {
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include "simple_packed_serialization.h"
|
||||
#include <type_traits>
|
||||
|
||||
namespace __orc_rt {
|
||||
namespace orc_rt {
|
||||
|
||||
/// C++ wrapper function result: Same as CWrapperFunctionResult but
|
||||
/// auto-releases memory.
|
||||
@@ -504,6 +504,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
} // end namespace __orc_rt
|
||||
} // namespace orc_rt
|
||||
|
||||
#endif // ORC_RT_WRAPPER_FUNCTION_UTILS_H
|
||||
|
||||
Reference in New Issue
Block a user