mirror of
https://github.com/asmjit/asmjit.git
synced 2025-12-17 12:34:35 +03:00
Improved AsmJit public API to not depend on <windows.h> header
This commit is contained in:
@@ -258,7 +258,8 @@ set(ASMJIT_SRC_LIST
|
||||
asmjit/asmjit.h
|
||||
|
||||
asmjit/core.h
|
||||
asmjit/core/build.h
|
||||
asmjit/core/api-build_p.h
|
||||
asmjit/core/api-config.h
|
||||
asmjit/core/arch.cpp
|
||||
asmjit/core/arch.h
|
||||
asmjit/core/assembler.cpp
|
||||
|
||||
@@ -113,7 +113,7 @@ Supported Environments
|
||||
* **Clang** - tested by Travis-CI - Clang 3.9+ (with C++11 enabled) is officially supported (older Clang versions having C++11 support are probably fine, but are not regularly tested).
|
||||
* **GNU** - tested by Travis-CI - GCC 4.8+ (with C++11 enabled) is officially supported.
|
||||
* **MINGW** - tested by Travis-CI - Use the latest version, if possible.
|
||||
* **MSVC** - tested by Travis-CI - VS2017+ is officially supported, VC2015 is reported to work.
|
||||
* **MSVC** - tested by Travis-CI - VS2017+ is officially supported, VS2015 is reported to work.
|
||||
* Untested:
|
||||
* **Intel** - no maintainers and no CI environment to regularly test this compiler.
|
||||
* Other c++ compilers would require basic support in [core/build.h](./src/asmjit/core/build.h).
|
||||
|
||||
25
src/asmjit/core/api-build_p.h
Normal file
25
src/asmjit/core/api-build_p.h
Normal file
@@ -0,0 +1,25 @@
|
||||
// [AsmJit]
|
||||
// Machine Code Generation for C++.
|
||||
//
|
||||
// [License]
|
||||
// Zlib - See LICENSE.md file in the package.
|
||||
|
||||
#ifndef _ASMJIT_CORE_API_BUILD_P_H
|
||||
#define _ASMJIT_CORE_API_BUILD_P_H
|
||||
|
||||
#define ASMJIT_EXPORTS
|
||||
|
||||
// Dependencies only required for asmjit build, but never exposed through public headers.
|
||||
#ifdef _WIN32
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#ifndef NOMINMAX
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include "./api-config.h"
|
||||
|
||||
#endif // _ASMJIT_CORE_API_BUILD_P_H
|
||||
@@ -4,8 +4,8 @@
|
||||
// [License]
|
||||
// Zlib - See LICENSE.md file in the package.
|
||||
|
||||
#ifndef _ASMJIT_CORE_BUILD_H
|
||||
#define _ASMJIT_CORE_BUILD_H
|
||||
#ifndef _ASMJIT_CORE_API_CONFIG_H
|
||||
#define _ASMJIT_CORE_API_CONFIG_H
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::Version]
|
||||
@@ -96,25 +96,7 @@
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
#if defined(_WIN32)
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define ASMJIT_UNDEF_WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#ifndef NOMINMAX
|
||||
#define NOMINMAX
|
||||
#define ASMJIT_UNDEF_NOMINMAX
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#ifdef ASMJIT_UNDEF_WIN32_LEAN_AND_MEAN
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
#undef ASMJIT_UNDEF_WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#ifdef ASMJIT_UNDEF_NOMINMAX
|
||||
#undef NOMINMAX
|
||||
#undef ASMJIT_UNDEF_NOMINMAX
|
||||
#endif
|
||||
#else
|
||||
#if !defined(_WIN32) && !defined(__EMSCRIPTEN__)
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
|
||||
@@ -316,13 +298,13 @@
|
||||
// API (Export / Import).
|
||||
#if !defined(ASMJIT_STATIC)
|
||||
#if defined(_WIN32) && (defined(_MSC_VER) || defined(__MINGW32__))
|
||||
#if defined(ASMJIT_EXPORTS)
|
||||
#ifdef ASMJIT_EXPORTS
|
||||
#define ASMJIT_API __declspec(dllexport)
|
||||
#else
|
||||
#define ASMJIT_API __declspec(dllimport)
|
||||
#endif
|
||||
#elif defined(_WIN32) && defined(__GNUC__)
|
||||
#if defined(ASMJIT_EXPORTS)
|
||||
#ifdef ASMJIT_EXPORTS
|
||||
#define ASMJIT_API __attribute__((__dllexport__))
|
||||
#else
|
||||
#define ASMJIT_API __attribute__((__dllimport__))
|
||||
@@ -399,6 +381,12 @@
|
||||
#define ASMJIT_ALIGN_TYPE(TYPE, N) TYPE
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#define ASMJIT_MAY_ALIAS __attribute__((__may_alias__))
|
||||
#else
|
||||
#define ASMJIT_MAY_ALIAS
|
||||
#endif
|
||||
|
||||
// Annotations.
|
||||
#if defined(__GNUC__)
|
||||
#define ASMJIT_LIKELY(...) __builtin_expect(!!(__VA_ARGS__), 1)
|
||||
@@ -563,4 +551,4 @@
|
||||
#include "../../../test/broken.h"
|
||||
#endif
|
||||
|
||||
#endif // _ASMJIT_CORE_BUILD_H
|
||||
#endif // _ASMJIT_CORE_API_CONFIG_H
|
||||
@@ -4,8 +4,7 @@
|
||||
// [License]
|
||||
// Zlib - See LICENSE.md file in the package.
|
||||
|
||||
#define ASMJIT_EXPORTS
|
||||
|
||||
#include "../core/api-build_p.h"
|
||||
#include "../core/arch.h"
|
||||
#include "../core/support.h"
|
||||
#include "../core/type.h"
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
// [License]
|
||||
// Zlib - See LICENSE.md file in the package.
|
||||
|
||||
#define ASMJIT_EXPORTS
|
||||
|
||||
#include "../core/api-build_p.h"
|
||||
#include "../core/assembler.h"
|
||||
#include "../core/codebufferwriter_p.h"
|
||||
#include "../core/constpool.h"
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
// [License]
|
||||
// Zlib - See LICENSE.md file in the package.
|
||||
|
||||
#define ASMJIT_EXPORTS
|
||||
|
||||
#include "../core/build.h"
|
||||
#include "../core/api-build_p.h"
|
||||
#ifndef ASMJIT_NO_BUILDER
|
||||
|
||||
#include "../core/builder.h"
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#ifndef _ASMJIT_CORE_BUILDER_H
|
||||
#define _ASMJIT_CORE_BUILDER_H
|
||||
|
||||
#include "../core/build.h"
|
||||
#include "../core/api-config.h"
|
||||
#ifndef ASMJIT_NO_BUILDER
|
||||
|
||||
#include "../core/assembler.h"
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
// [License]
|
||||
// Zlib - See LICENSE.md file in the package.
|
||||
|
||||
#define ASMJIT_EXPORTS
|
||||
|
||||
#include "../core/api-build_p.h"
|
||||
#include "../core/arch.h"
|
||||
#include "../core/func.h"
|
||||
#include "../core/type.h"
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
// [License]
|
||||
// Zlib - See LICENSE.md file in the package.
|
||||
|
||||
#define ASMJIT_EXPORTS
|
||||
|
||||
#include "../core/api-build_p.h"
|
||||
#include "../core/assembler.h"
|
||||
#include "../core/logging.h"
|
||||
#include "../core/support.h"
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
// [License]
|
||||
// Zlib - See LICENSE.md file in the package.
|
||||
|
||||
#define ASMJIT_EXPORTS
|
||||
|
||||
#include "../core/build.h"
|
||||
#include "../core/api-build_p.h"
|
||||
#ifndef ASMJIT_NO_COMPILER
|
||||
|
||||
#include "../core/assembler.h"
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#ifndef _ASMJIT_CORE_COMPILER_H
|
||||
#define _ASMJIT_CORE_COMPILER_H
|
||||
|
||||
#include "../core/build.h"
|
||||
#include "../core/api-config.h"
|
||||
#ifndef ASMJIT_NO_COMPILER
|
||||
|
||||
#include "../core/assembler.h"
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
// [License]
|
||||
// Zlib - See LICENSE.md file in the package.
|
||||
|
||||
#define ASMJIT_EXPORTS
|
||||
|
||||
#include "../core/api-build_p.h"
|
||||
#include "../core/constpool.h"
|
||||
#include "../core/support.h"
|
||||
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
// [License]
|
||||
// Zlib - See LICENSE.md file in the package.
|
||||
|
||||
#define ASMJIT_EXPORTS
|
||||
|
||||
#include "../core/api-build_p.h"
|
||||
#include "../core/cpuinfo.h"
|
||||
|
||||
#if !defined(_WIN32)
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
// [License]
|
||||
// Zlib - See LICENSE.md file in the package.
|
||||
|
||||
#define ASMJIT_EXPORTS
|
||||
|
||||
#include "../core/api-build_p.h"
|
||||
#include "../core/logging.h"
|
||||
#include "../core/support.h"
|
||||
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
// [License]
|
||||
// Zlib - See LICENSE.md file in the package.
|
||||
|
||||
#define ASMJIT_EXPORTS
|
||||
|
||||
#include "../core/api-build_p.h"
|
||||
#include "../core/arch.h"
|
||||
#include "../core/func.h"
|
||||
#include "../core/type.h"
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
// [License]
|
||||
// Zlib - See LICENSE.md file in the package.
|
||||
|
||||
#define ASMJIT_EXPORTS
|
||||
|
||||
#include "../core/api-build_p.h"
|
||||
#include "../core/globals.h"
|
||||
#include "../core/support.h"
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#ifndef _ASMJIT_CORE_GLOBALS_H
|
||||
#define _ASMJIT_CORE_GLOBALS_H
|
||||
|
||||
#include "../core/build.h"
|
||||
#include "../core/api-config.h"
|
||||
|
||||
ASMJIT_BEGIN_NAMESPACE
|
||||
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
// [License]
|
||||
// Zlib - See LICENSE.md file in the package.
|
||||
|
||||
#define ASMJIT_EXPORTS
|
||||
|
||||
#include "../core/build.h"
|
||||
#include "../core/api-build_p.h"
|
||||
#ifdef ASMJIT_BUILD_X86
|
||||
|
||||
#include "../core/arch.h"
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
// [License]
|
||||
// Zlib - See LICENSE.md file in the package.
|
||||
|
||||
#define ASMJIT_EXPORTS
|
||||
|
||||
#include "../core/build.h"
|
||||
#include "../core/api-build_p.h"
|
||||
#ifndef ASMJIT_NO_JIT
|
||||
|
||||
#include "../core/arch.h"
|
||||
@@ -601,7 +599,7 @@ JitAllocator::Statistics JitAllocator::statistics() const noexcept {
|
||||
|
||||
if (ASMJIT_LIKELY(_impl != &JitAllocatorImpl_none)) {
|
||||
JitAllocatorPrivateImpl* impl = static_cast<JitAllocatorPrivateImpl*>(_impl);
|
||||
ScopedLock locked(impl->lock);
|
||||
LockGuard guard(impl->lock);
|
||||
|
||||
size_t poolCount = impl->poolCount;
|
||||
for (size_t poolId = 0; poolId < poolCount; poolId++) {
|
||||
@@ -638,7 +636,7 @@ Error JitAllocator::alloc(void** roPtrOut, void** rwPtrOut, size_t size) noexcep
|
||||
if (ASMJIT_UNLIKELY(size > std::numeric_limits<uint32_t>::max() / 2))
|
||||
return DebugUtils::errored(kErrorTooLarge);
|
||||
|
||||
ScopedLock locked(impl->lock);
|
||||
LockGuard guard(impl->lock);
|
||||
JitAllocatorPool* pool = &impl->pools[JitAllocatorImpl_sizeToPoolId(impl, size)];
|
||||
|
||||
uint32_t areaIndex = kNoIndex;
|
||||
@@ -763,7 +761,7 @@ Error JitAllocator::release(void* ro) noexcept {
|
||||
return DebugUtils::errored(kErrorInvalidArgument);
|
||||
|
||||
JitAllocatorPrivateImpl* impl = static_cast<JitAllocatorPrivateImpl*>(_impl);
|
||||
ScopedLock locked(impl->lock);
|
||||
LockGuard guard(impl->lock);
|
||||
|
||||
JitAllocatorBlock* block = impl->tree.get(static_cast<uint8_t*>(ro));
|
||||
if (ASMJIT_UNLIKELY(!block))
|
||||
@@ -822,7 +820,7 @@ Error JitAllocator::shrink(void* ro, size_t newSize) noexcept {
|
||||
return release(ro);
|
||||
|
||||
JitAllocatorPrivateImpl* impl = static_cast<JitAllocatorPrivateImpl*>(_impl);
|
||||
ScopedLock locked(impl->lock);
|
||||
LockGuard guard(impl->lock);
|
||||
JitAllocatorBlock* block = impl->tree.get(static_cast<uint8_t*>(ro));
|
||||
|
||||
if (ASMJIT_UNLIKELY(!block))
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#ifndef _ASMJIT_CORE_JITALLOCATOR_H
|
||||
#define _ASMJIT_CORE_JITALLOCATOR_H
|
||||
|
||||
#include "../core/build.h"
|
||||
#include "../core/api-config.h"
|
||||
#ifndef ASMJIT_NO_JIT
|
||||
|
||||
#include "../core/globals.h"
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
// [License]
|
||||
// Zlib - See LICENSE.md file in the package.
|
||||
|
||||
#define ASMJIT_EXPORTS
|
||||
|
||||
#include "../core/build.h"
|
||||
#include "../core/api-build_p.h"
|
||||
#ifndef ASMJIT_NO_JIT
|
||||
|
||||
#include "../core/cpuinfo.h"
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#ifndef _ASMJIT_CORE_JITRUNTIME_H
|
||||
#define _ASMJIT_CORE_JITRUNTIME_H
|
||||
|
||||
#include "../core/build.h"
|
||||
#include "../core/api-config.h"
|
||||
#ifndef ASMJIT_NO_JIT
|
||||
|
||||
#include "../core/codeholder.h"
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
// [License]
|
||||
// Zlib - See LICENSE.md file in the package.
|
||||
|
||||
#define ASMJIT_EXPORTS
|
||||
|
||||
#include "../core/build.h"
|
||||
#include "../core/api-build_p.h"
|
||||
#ifndef ASMJIT_NO_LOGGING
|
||||
|
||||
#include "../core/builder.h"
|
||||
|
||||
@@ -316,7 +316,7 @@ struct Logging {
|
||||
#endif
|
||||
|
||||
// Only used by AsmJit internals, not available to users.
|
||||
#if defined(ASMJIT_EXPORTS)
|
||||
#ifdef ASMJIT_EXPORTS
|
||||
enum {
|
||||
// Has to be big to be able to hold all metadata compiler can assign to a
|
||||
// single instruction.
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#ifndef _ASMJIT_CORE_MISC_P_H
|
||||
#define _ASMJIT_CORE_MISC_P_H
|
||||
|
||||
#include "../core/build.h"
|
||||
#include "../core/api-config.h"
|
||||
|
||||
ASMJIT_BEGIN_NAMESPACE
|
||||
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
// [License]
|
||||
// Zlib - See LICENSE.md file in the package.
|
||||
|
||||
#define ASMJIT_EXPORTS
|
||||
|
||||
#include "../core/api-build_p.h"
|
||||
#include "../core/operand.h"
|
||||
|
||||
ASMJIT_BEGIN_NAMESPACE
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
// [License]
|
||||
// Zlib - See LICENSE.md file in the package.
|
||||
|
||||
#define ASMJIT_EXPORTS
|
||||
|
||||
#include "../core/api-build_p.h"
|
||||
#include "../core/osutils.h"
|
||||
#include "../core/support.h"
|
||||
|
||||
|
||||
@@ -31,63 +31,89 @@ namespace OSUtils {
|
||||
//! \cond INTERNAL
|
||||
|
||||
//! Lock.
|
||||
//!
|
||||
//! Lock is internal, it cannot be used outside of AsmJit, however, its internal
|
||||
//! layout is exposed as it's used by some other public classes.
|
||||
class Lock {
|
||||
public:
|
||||
ASMJIT_NONCOPYABLE(Lock)
|
||||
|
||||
#if defined(_WIN32)
|
||||
|
||||
typedef CRITICAL_SECTION Handle;
|
||||
#if defined(_WIN32)
|
||||
#pragma pack(push, 8)
|
||||
struct ASMJIT_MAY_ALIAS Handle {
|
||||
void* DebugInfo;
|
||||
long LockCount;
|
||||
long RecursionCount;
|
||||
void* OwningThread;
|
||||
void* LockSemaphore;
|
||||
unsigned long* SpinCount;
|
||||
};
|
||||
Handle _handle;
|
||||
|
||||
inline Lock() noexcept { InitializeCriticalSection(&_handle); }
|
||||
inline ~Lock() noexcept { DeleteCriticalSection(&_handle); }
|
||||
|
||||
inline void lock() noexcept { EnterCriticalSection(&_handle); }
|
||||
inline void unlock() noexcept { LeaveCriticalSection(&_handle); }
|
||||
|
||||
#elif !defined(__EMSCRIPTEN__)
|
||||
|
||||
#pragma pack(pop)
|
||||
#elif !defined(__EMSCRIPTEN__)
|
||||
typedef pthread_mutex_t Handle;
|
||||
Handle _handle;
|
||||
#endif
|
||||
|
||||
inline Lock() noexcept { pthread_mutex_init(&_handle, nullptr); }
|
||||
inline ~Lock() noexcept { pthread_mutex_destroy(&_handle); }
|
||||
inline Lock() noexcept;
|
||||
inline ~Lock() noexcept;
|
||||
|
||||
inline void lock() noexcept { pthread_mutex_lock(&_handle); }
|
||||
inline void unlock() noexcept { pthread_mutex_unlock(&_handle); }
|
||||
|
||||
#else
|
||||
|
||||
// Browser or other unsupported OS.
|
||||
inline Lock() noexcept {}
|
||||
inline ~Lock() noexcept {}
|
||||
|
||||
inline void lock() noexcept {}
|
||||
inline void unlock() noexcept {}
|
||||
|
||||
#endif
|
||||
inline void lock() noexcept;
|
||||
inline void unlock() noexcept;
|
||||
};
|
||||
|
||||
#ifdef ASMJIT_EXPORTS
|
||||
#if defined(_WIN32)
|
||||
|
||||
// Win32 implementation.
|
||||
static_assert(sizeof(Lock::Handle) == sizeof(CRITICAL_SECTION), "asmjit::Lock::Handle layout must match CRITICAL_SECTION");
|
||||
static_assert(alignof(Lock::Handle) == alignof(CRITICAL_SECTION), "asmjit::Lock::Handle alignment must match CRITICAL_SECTION");
|
||||
|
||||
inline Lock::Lock() noexcept { InitializeCriticalSection(reinterpret_cast<CRITICAL_SECTION*>(&_handle)); }
|
||||
inline Lock::~Lock() noexcept { DeleteCriticalSection(reinterpret_cast<CRITICAL_SECTION*>(&_handle)); }
|
||||
inline void Lock::lock() noexcept { EnterCriticalSection(reinterpret_cast<CRITICAL_SECTION*>(&_handle)); }
|
||||
inline void Lock::unlock() noexcept { LeaveCriticalSection(reinterpret_cast<CRITICAL_SECTION*>(&_handle)); }
|
||||
|
||||
#elif !defined(__EMSCRIPTEN__)
|
||||
|
||||
// PThread implementation.
|
||||
inline Lock::Lock() noexcept { pthread_mutex_init(&_handle, nullptr); }
|
||||
inline Lock::~Lock() noexcept { pthread_mutex_destroy(&_handle); }
|
||||
inline void Lock::lock() noexcept { pthread_mutex_lock(&_handle); }
|
||||
inline void Lock::unlock() noexcept { pthread_mutex_unlock(&_handle); }
|
||||
|
||||
#else
|
||||
|
||||
// Dummy implementation - Emscripten or other unsupported platform.
|
||||
inline Lock::Lock() noexcept {}
|
||||
inline Lock::~Lock() noexcept {}
|
||||
inline void Lock::lock() noexcept {}
|
||||
inline void Lock::unlock() noexcept {}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//! \endcond
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::ScopedLock]
|
||||
// [asmjit::LockGuard]
|
||||
// ============================================================================
|
||||
|
||||
#ifdef ASMJIT_EXPORTS
|
||||
//! \cond INTERNAL
|
||||
|
||||
//! Scoped lock.
|
||||
struct ScopedLock {
|
||||
ASMJIT_NONCOPYABLE(ScopedLock)
|
||||
struct LockGuard {
|
||||
ASMJIT_NONCOPYABLE(LockGuard)
|
||||
|
||||
Lock& _target;
|
||||
|
||||
inline ScopedLock(Lock& target) noexcept : _target(target) { _target.lock(); }
|
||||
inline ~ScopedLock() noexcept { _target.unlock(); }
|
||||
inline LockGuard(Lock& target) noexcept : _target(target) { _target.lock(); }
|
||||
inline ~LockGuard() noexcept { _target.unlock(); }
|
||||
};
|
||||
|
||||
//! \endcond
|
||||
#endif
|
||||
|
||||
//! \}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#ifndef _ASMJIT_CORE_RAASSIGNMENT_P_H
|
||||
#define _ASMJIT_CORE_RAASSIGNMENT_P_H
|
||||
|
||||
#include "../core/build.h"
|
||||
#include "../core/api-config.h"
|
||||
#ifndef ASMJIT_NO_COMPILER
|
||||
|
||||
#include "../core/radefs_p.h"
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#ifndef _ASMJIT_CORE_RABUILDERS_P_H
|
||||
#define _ASMJIT_CORE_RABUILDERS_P_H
|
||||
|
||||
#include "../core/build.h"
|
||||
#include "../core/api-config.h"
|
||||
#ifndef ASMJIT_NO_COMPILER
|
||||
|
||||
#include "../core/rapass_p.h"
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#ifndef _ASMJIT_CORE_RADEFS_P_H
|
||||
#define _ASMJIT_CORE_RADEFS_P_H
|
||||
|
||||
#include "../core/build.h"
|
||||
#include "../core/api-config.h"
|
||||
#ifndef ASMJIT_NO_COMPILER
|
||||
|
||||
#include "../core/compiler.h"
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
// [License]
|
||||
// Zlib - See LICENSE.md file in the package.
|
||||
|
||||
#define ASMJIT_EXPORTS
|
||||
|
||||
#include "../core/build.h"
|
||||
#include "../core/api-build_p.h"
|
||||
#ifndef ASMJIT_NO_COMPILER
|
||||
|
||||
#include "../core/ralocal_p.h"
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#ifndef _ASMJIT_CORE_RALOCAL_P_H
|
||||
#define _ASMJIT_CORE_RALOCAL_P_H
|
||||
|
||||
#include "../core/build.h"
|
||||
#include "../core/api-config.h"
|
||||
#ifndef ASMJIT_NO_COMPILER
|
||||
|
||||
#include "../core/raassignment_p.h"
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
// [License]
|
||||
// Zlib - See LICENSE.md file in the package.
|
||||
|
||||
#define ASMJIT_EXPORTS
|
||||
|
||||
#include "../core/build.h"
|
||||
#include "../core/api-build_p.h"
|
||||
#ifndef ASMJIT_NO_COMPILER
|
||||
|
||||
#include "../core/ralocal_p.h"
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#ifndef _ASMJIT_CORE_RAPASS_P_H
|
||||
#define _ASMJIT_CORE_RAPASS_P_H
|
||||
|
||||
#include "../core/build.h"
|
||||
#include "../core/api-config.h"
|
||||
#ifndef ASMJIT_NO_COMPILER
|
||||
|
||||
#include "../core/raassignment_p.h"
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
// [License]
|
||||
// Zlib - See LICENSE.md file in the package.
|
||||
|
||||
#define ASMJIT_EXPORTS
|
||||
|
||||
#include "../core/build.h"
|
||||
#include "../core/api-build_p.h"
|
||||
#ifndef ASMJIT_NO_COMPILER
|
||||
|
||||
#include "../core/rastack_p.h"
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#ifndef _ASMJIT_CORE_RASTACK_P_H
|
||||
#define _ASMJIT_CORE_RASTACK_P_H
|
||||
|
||||
#include "../core/build.h"
|
||||
#include "../core/api-config.h"
|
||||
#ifndef ASMJIT_NO_COMPILER
|
||||
|
||||
#include "../core/radefs_p.h"
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
// [License]
|
||||
// Zlib - See LICENSE.md file in the package.
|
||||
|
||||
#define ASMJIT_EXPORTS
|
||||
|
||||
#include "../core/api-build_p.h"
|
||||
#include "../core/string.h"
|
||||
#include "../core/support.h"
|
||||
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
// [License]
|
||||
// Zlib - See LICENSE.md file in the package.
|
||||
|
||||
#define ASMJIT_EXPORTS
|
||||
|
||||
#include "../core/api-build_p.h"
|
||||
#include "../core/support.h"
|
||||
|
||||
ASMJIT_BEGIN_NAMESPACE
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
// [License]
|
||||
// Zlib - See LICENSE.md file in the package.
|
||||
|
||||
#define ASMJIT_EXPORTS
|
||||
|
||||
#include "../core/api-build_p.h"
|
||||
#include "../core/target.h"
|
||||
|
||||
ASMJIT_BEGIN_NAMESPACE
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
// [License]
|
||||
// Zlib - See LICENSE.md file in the package.
|
||||
|
||||
#define ASMJIT_EXPORTS
|
||||
|
||||
#include "../core/api-build_p.h"
|
||||
#include "../core/misc_p.h"
|
||||
#include "../core/type.h"
|
||||
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
// [License]
|
||||
// Zlib - See LICENSE.md file in the package.
|
||||
|
||||
#define ASMJIT_EXPORTS
|
||||
|
||||
#include "../core/build.h"
|
||||
#include "../core/api-build_p.h"
|
||||
#ifndef ASMJIT_NO_JIT
|
||||
|
||||
#include "../core/osutils.h"
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#ifndef _ASMJIT_CORE_VIRTMEM_H
|
||||
#define _ASMJIT_CORE_VIRTMEM_H
|
||||
|
||||
#include "../core/build.h"
|
||||
#include "../core/api-config.h"
|
||||
#ifndef ASMJIT_NO_JIT
|
||||
|
||||
#include "../core/globals.h"
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
// [License]
|
||||
// Zlib - See LICENSE.md file in the package.
|
||||
|
||||
#define ASMJIT_EXPORTS
|
||||
|
||||
#include "../core/api-build_p.h"
|
||||
#include "../core/support.h"
|
||||
#include "../core/zone.h"
|
||||
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
// [License]
|
||||
// Zlib - See LICENSE.md file in the package.
|
||||
|
||||
#define ASMJIT_EXPORTS
|
||||
|
||||
#include "../core/api-build_p.h"
|
||||
#include "../core/support.h"
|
||||
#include "../core/zone.h"
|
||||
#include "../core/zonehash.h"
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
// [License]
|
||||
// Zlib - See LICENSE.md file in the package.
|
||||
|
||||
#define ASMJIT_EXPORTS
|
||||
|
||||
#include "../core/api-build_p.h"
|
||||
#include "../core/zone.h"
|
||||
#include "../core/zonelist.h"
|
||||
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
// [License]
|
||||
// Zlib - See LICENSE.md file in the package.
|
||||
|
||||
#define ASMJIT_EXPORTS
|
||||
|
||||
#include "../core/api-build_p.h"
|
||||
#include "../core/zone.h"
|
||||
#include "../core/zonestack.h"
|
||||
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
// [License]
|
||||
// Zlib - See LICENSE.md file in the package.
|
||||
|
||||
#define ASMJIT_EXPORTS
|
||||
|
||||
#include "../core/api-build_p.h"
|
||||
#include "../core/support.h"
|
||||
#include "../core/zone.h"
|
||||
#include "../core/zonetree.h"
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
// [License]
|
||||
// Zlib - See LICENSE.md file in the package.
|
||||
|
||||
#define ASMJIT_EXPORTS
|
||||
|
||||
#include "../core/api-build_p.h"
|
||||
#include "../core/support.h"
|
||||
#include "../core/zone.h"
|
||||
#include "../core/zonevector.h"
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
// [License]
|
||||
// Zlib - See LICENSE.md file in the package.
|
||||
|
||||
#define ASMJIT_EXPORTS
|
||||
|
||||
#include "../core/build.h"
|
||||
#include "../core/api-build_p.h"
|
||||
#ifdef ASMJIT_BUILD_X86
|
||||
|
||||
#include "../core/codebufferwriter_p.h"
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
// [License]
|
||||
// Zlib - See LICENSE.md file in the package.
|
||||
|
||||
#define ASMJIT_EXPORTS
|
||||
|
||||
#include "../core/build.h"
|
||||
#include "../core/api-build_p.h"
|
||||
#if defined(ASMJIT_BUILD_X86) && !defined(ASMJIT_NO_COMPILER)
|
||||
|
||||
#include "../x86/x86assembler.h"
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#ifndef _ASMJIT_X86_X86BUILDER_H
|
||||
#define _ASMJIT_X86_X86BUILDER_H
|
||||
|
||||
#include "../core/build.h"
|
||||
#include "../core/api-config.h"
|
||||
#ifndef ASMJIT_NO_BUILDER
|
||||
|
||||
#include "../core/builder.h"
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
// [License]
|
||||
// Zlib - See LICENSE.md file in the package.
|
||||
|
||||
#define ASMJIT_EXPORTS
|
||||
|
||||
#include "../core/build.h"
|
||||
#include "../core/api-build_p.h"
|
||||
#ifdef ASMJIT_BUILD_X86
|
||||
|
||||
#include "../x86/x86callconv_p.h"
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
// [License]
|
||||
// Zlib - See LICENSE.md file in the package.
|
||||
|
||||
#define ASMJIT_EXPORTS
|
||||
|
||||
#include "../core/build.h"
|
||||
#include "../core/api-build_p.h"
|
||||
#if defined(ASMJIT_BUILD_X86) && !defined(ASMJIT_NO_COMPILER)
|
||||
|
||||
#include "../x86/x86assembler.h"
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#ifndef _ASMJIT_X86_X86COMPILER_H
|
||||
#define _ASMJIT_X86_X86COMPILER_H
|
||||
|
||||
#include "../core/build.h"
|
||||
#include "../core/api-config.h"
|
||||
#ifndef ASMJIT_NO_COMPILER
|
||||
|
||||
#include "../core/compiler.h"
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
// [License]
|
||||
// Zlib - See LICENSE.md file in the package.
|
||||
|
||||
#define ASMJIT_EXPORTS
|
||||
|
||||
#include "../core/build.h"
|
||||
#include "../core/api-build_p.h"
|
||||
#if defined(ASMJIT_BUILD_X86) && ASMJIT_ARCH_X86
|
||||
|
||||
#include "../core/cpuinfo.h"
|
||||
|
||||
@@ -22,9 +22,7 @@
|
||||
// (including registers and flags), and all indexes to all tables.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#define ASMJIT_EXPORTS
|
||||
|
||||
#include "../core/build.h"
|
||||
#include "../core/api-build_p.h"
|
||||
#ifdef ASMJIT_BUILD_X86
|
||||
|
||||
#include "../core/cpuinfo.h"
|
||||
|
||||
@@ -22,9 +22,7 @@
|
||||
// (including registers and flags), and all indexes to all tables.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#define ASMJIT_EXPORTS
|
||||
|
||||
#include "../core/build.h"
|
||||
#include "../core/api-build_p.h"
|
||||
#ifdef ASMJIT_BUILD_X86
|
||||
|
||||
#include "../core/cpuinfo.h"
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
// [License]
|
||||
// Zlib - See LICENSE.md file in the package.
|
||||
|
||||
#define ASMJIT_EXPORTS
|
||||
|
||||
#include "../core/build.h"
|
||||
#include "../core/api-build_p.h"
|
||||
#ifdef ASMJIT_BUILD_X86
|
||||
|
||||
#include "../core/logging.h"
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#ifndef _ASMJIT_X86_X86INTERNAL_P_H
|
||||
#define _ASMJIT_X86_X86INTERNAL_P_H
|
||||
|
||||
#include "../core/build.h"
|
||||
#include "../core/api-config.h"
|
||||
|
||||
#include "../core/func.h"
|
||||
#include "../x86/x86emitter.h"
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
// [License]
|
||||
// Zlib - See LICENSE.md file in the package.
|
||||
|
||||
#define ASMJIT_EXPORTS
|
||||
|
||||
#include "../core/build.h"
|
||||
#include "../core/api-build_p.h"
|
||||
#ifndef ASMJIT_NO_LOGGING
|
||||
|
||||
#include "../core/misc_p.h"
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#ifndef _ASMJIT_X86_X86LOGGING_P_H
|
||||
#define _ASMJIT_X86_X86LOGGING_P_H
|
||||
|
||||
#include "../core/build.h"
|
||||
#include "../core/api-config.h"
|
||||
#ifndef ASMJIT_NO_LOGGING
|
||||
|
||||
#include "../core/logging.h"
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
// [License]
|
||||
// Zlib - See LICENSE.md file in the package.
|
||||
|
||||
#define ASMJIT_EXPORTS
|
||||
|
||||
#include "../core/build.h"
|
||||
#include "../core/api-build_p.h"
|
||||
#ifdef ASMJIT_BUILD_X86
|
||||
|
||||
#include "../core/misc_p.h"
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
// [License]
|
||||
// Zlib - See LICENSE.md file in the package.
|
||||
|
||||
#define ASMJIT_EXPORTS
|
||||
|
||||
#include "../core/build.h"
|
||||
#include "../core/api-build_p.h"
|
||||
#if defined(ASMJIT_BUILD_X86) && !defined(ASMJIT_NO_COMPILER)
|
||||
|
||||
#include "../core/cpuinfo.h"
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#ifndef _ASMJIT_X86_X86RAPASS_P_H
|
||||
#define _ASMJIT_X86_X86RAPASS_P_H
|
||||
|
||||
#include "../core/build.h"
|
||||
#include "../core/api-config.h"
|
||||
#ifndef ASMJIT_NO_COMPILER
|
||||
|
||||
#include "../core/compiler.h"
|
||||
|
||||
@@ -12,6 +12,11 @@
|
||||
#include "./asmjit.h"
|
||||
#include "./asmjit_test_misc.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
// Interaction between '_setjmp' and C++ object destruction is non-portable.
|
||||
#pragma warning(disable: 4611)
|
||||
#endif
|
||||
|
||||
using namespace asmjit;
|
||||
|
||||
// ============================================================================
|
||||
@@ -174,10 +179,11 @@ int X86TestApp::run() {
|
||||
x86::Compiler cc(&code);
|
||||
test->compile(cc);
|
||||
|
||||
void* func = nullptr;
|
||||
Error err = errorHandler._err;
|
||||
|
||||
if (!err)
|
||||
err = cc.finalize();
|
||||
void* func;
|
||||
|
||||
#ifndef ASMJIT_NO_LOGGING
|
||||
if (_dumpAsm) {
|
||||
|
||||
@@ -48,8 +48,8 @@ int main(int argc, char* argv[]) {
|
||||
code.init(codeInfo);
|
||||
code.setLogger(&logger);
|
||||
|
||||
Section* section;
|
||||
Error err = code.newSection(§ion, ".data", SIZE_MAX, 0, 8);
|
||||
Section* dataSection;
|
||||
Error err = code.newSection(&dataSection, ".data", SIZE_MAX, 0, 8);
|
||||
|
||||
if (err) {
|
||||
fail("Failed to create a .data section", err);
|
||||
@@ -82,7 +82,7 @@ int main(int argc, char* argv[]) {
|
||||
|
||||
a.emitEpilog(frame);
|
||||
|
||||
a.section(section);
|
||||
a.section(dataSection);
|
||||
a.bind(data);
|
||||
|
||||
a.embed(dataArray, sizeof(dataArray));
|
||||
|
||||
Reference in New Issue
Block a user