asmjit/test/asmjit_test_unit.cpp

173 lines
4.3 KiB
C++
Raw Permalink Normal View History

// This file is part of AsmJit project <https://asmjit.com>
2017-01-26 15:55:03 +01:00
//
// See asmjit.h or LICENSE.md for license and copyright information
// SPDX-License-Identifier: Zlib
2017-01-26 15:55:03 +01:00
#include <asmjit/core.h>
2017-01-26 15:55:03 +01:00
#if !defined(ASMJIT_NO_X86)
#include <asmjit/x86.h>
#endif
2017-01-26 15:55:03 +01:00
#include "asmjitutils.h"
#include "broken.h"
using namespace asmjit;
Refactored register allocator asm Compiler. (#249) Refactored build system macros (ASMJIT_BUILD_STATIC -> ASMJIT_STATIC) Refactored AVX512 broadcast {1toN} - moved to operand from instruction. Refactored naming - renamed getters to not use get prefix. Refactored code structure - move arch-specific stuff into x86 namespace. Refactored some compiler/arch-specific macros, respect rel/abs option in mov REG, [ADDR]. Refactored StringBuilder (Renamed to String, added small string optimization). Refactored LabelId<->LabelEntry mapping, force label offset to 64-bits on all archs. Renamed Runtime to Target (JitRuntime kept for now). Renamed VirtMemManager to JitAllocator. Renamed VirtMem to JitUtils. Renamed FuncSignatureX to FuncSignatureBuilder. Fixed xchg [mem], rex-lo, refactored RelocEntry. Fixed Logger to always show abs|rel when formatting a memory operand Fixed Logger to prefix HEX numbers with 0x prefix Fixed Support::ctzGeneric to always return uint32_t, T doesn't matter. Fixed LightCall to not save MMX and K registers Fixed CpuInfo constructor to propagate NoInit (#243) Added VAES, AVX512_VBMI2, AVX512_VNNI, and AVX512_BITALG cpu-features and instructions. Added emscripten support (asmjit can be now compiled by emscripten). Added asmjit.natvis for better MSVC experience Added x86::ptr_abs|ptr_rel Added support for multibyte nop r/m (#135) Added support for 32-bit to 64-bit zero-extended addresses, improved validation of memory addresses, and removed wrt address type as this will be reworked Added support for multiple sections, reworked address table support (previously known as trampolines) Added the following x86 modifiers to the x86::Emitter - xacquire(), xrelease(), and k(kreg) Added a possibility to use REP prefix with RET instruction Added a possibility to relocate [rel addr] during relocate() Added a variadic function-call support (Compiler), argument duplication (Compiler), better /dev/shm vs /tmp shared memory handling (VirtMem). Removed imm_u imm_ptr helpers, imm() can now accept any integer and pointer. Changed the default behavior of optimizing instructions to disabled with a possibility to enable that feature through kOptionOptimizedForSize Use default copy construction / assignment to prevent new kind of warnings introduced by GCC 9
2019-07-16 01:24:22 +02:00
static void dumpCpu(void) noexcept {
const CpuInfo& cpu = CpuInfo::host();
2017-01-26 15:55:03 +01:00
// CPU Information
// ---------------
2020-05-31 23:38:22 +02:00
INFO("CPU Info:");
Refactored register allocator asm Compiler. (#249) Refactored build system macros (ASMJIT_BUILD_STATIC -> ASMJIT_STATIC) Refactored AVX512 broadcast {1toN} - moved to operand from instruction. Refactored naming - renamed getters to not use get prefix. Refactored code structure - move arch-specific stuff into x86 namespace. Refactored some compiler/arch-specific macros, respect rel/abs option in mov REG, [ADDR]. Refactored StringBuilder (Renamed to String, added small string optimization). Refactored LabelId<->LabelEntry mapping, force label offset to 64-bits on all archs. Renamed Runtime to Target (JitRuntime kept for now). Renamed VirtMemManager to JitAllocator. Renamed VirtMem to JitUtils. Renamed FuncSignatureX to FuncSignatureBuilder. Fixed xchg [mem], rex-lo, refactored RelocEntry. Fixed Logger to always show abs|rel when formatting a memory operand Fixed Logger to prefix HEX numbers with 0x prefix Fixed Support::ctzGeneric to always return uint32_t, T doesn't matter. Fixed LightCall to not save MMX and K registers Fixed CpuInfo constructor to propagate NoInit (#243) Added VAES, AVX512_VBMI2, AVX512_VNNI, and AVX512_BITALG cpu-features and instructions. Added emscripten support (asmjit can be now compiled by emscripten). Added asmjit.natvis for better MSVC experience Added x86::ptr_abs|ptr_rel Added support for multibyte nop r/m (#135) Added support for 32-bit to 64-bit zero-extended addresses, improved validation of memory addresses, and removed wrt address type as this will be reworked Added support for multiple sections, reworked address table support (previously known as trampolines) Added the following x86 modifiers to the x86::Emitter - xacquire(), xrelease(), and k(kreg) Added a possibility to use REP prefix with RET instruction Added a possibility to relocate [rel addr] during relocate() Added a variadic function-call support (Compiler), argument duplication (Compiler), better /dev/shm vs /tmp shared memory handling (VirtMem). Removed imm_u imm_ptr helpers, imm() can now accept any integer and pointer. Changed the default behavior of optimizing instructions to disabled with a possibility to enable that feature through kOptionOptimizedForSize Use default copy construction / assignment to prevent new kind of warnings introduced by GCC 9
2019-07-16 01:24:22 +02:00
INFO(" Vendor : %s", cpu.vendor());
INFO(" Brand : %s", cpu.brand());
INFO(" Model ID : %u", cpu.modelId());
INFO(" Brand ID : %u", cpu.brandId());
INFO(" Family ID : %u", cpu.familyId());
INFO(" Stepping : %u", cpu.stepping());
INFO(" Processor Type : %u", cpu.processorType());
INFO(" Max logical Processors : %u", cpu.maxLogicalProcessors());
INFO(" Cache-Line Size : %u", cpu.cacheLineSize());
INFO(" HW-Thread Count : %u", cpu.hwThreadCount());
2017-01-26 15:55:03 +01:00
INFO("");
// CPU Features
// ------------
2017-01-26 15:55:03 +01:00
2020-06-01 10:16:33 +02:00
#ifndef ASMJIT_NO_LOGGING
2020-05-31 23:38:22 +02:00
INFO("CPU Features:");
CpuFeatures::Iterator it(cpu.features().iterator());
2020-05-31 23:38:22 +02:00
while (it.hasNext()) {
uint32_t featureId = uint32_t(it.next());
StringTmp<64> featureString;
Formatter::formatFeature(featureString, cpu.arch(), featureId);
INFO(" %s\n", featureString.data());
2017-01-26 15:55:03 +01:00
};
INFO("");
2020-06-01 10:16:33 +02:00
#endif // !ASMJIT_NO_LOGGING
2017-01-26 15:55:03 +01:00
}
#define DUMP_TYPE(...) \
INFO(" %-26s: %u", #__VA_ARGS__, uint32_t(sizeof(__VA_ARGS__)))
2017-01-26 15:55:03 +01:00
static void dumpSizeOf(void) noexcept {
Refactored register allocator asm Compiler. (#249) Refactored build system macros (ASMJIT_BUILD_STATIC -> ASMJIT_STATIC) Refactored AVX512 broadcast {1toN} - moved to operand from instruction. Refactored naming - renamed getters to not use get prefix. Refactored code structure - move arch-specific stuff into x86 namespace. Refactored some compiler/arch-specific macros, respect rel/abs option in mov REG, [ADDR]. Refactored StringBuilder (Renamed to String, added small string optimization). Refactored LabelId<->LabelEntry mapping, force label offset to 64-bits on all archs. Renamed Runtime to Target (JitRuntime kept for now). Renamed VirtMemManager to JitAllocator. Renamed VirtMem to JitUtils. Renamed FuncSignatureX to FuncSignatureBuilder. Fixed xchg [mem], rex-lo, refactored RelocEntry. Fixed Logger to always show abs|rel when formatting a memory operand Fixed Logger to prefix HEX numbers with 0x prefix Fixed Support::ctzGeneric to always return uint32_t, T doesn't matter. Fixed LightCall to not save MMX and K registers Fixed CpuInfo constructor to propagate NoInit (#243) Added VAES, AVX512_VBMI2, AVX512_VNNI, and AVX512_BITALG cpu-features and instructions. Added emscripten support (asmjit can be now compiled by emscripten). Added asmjit.natvis for better MSVC experience Added x86::ptr_abs|ptr_rel Added support for multibyte nop r/m (#135) Added support for 32-bit to 64-bit zero-extended addresses, improved validation of memory addresses, and removed wrt address type as this will be reworked Added support for multiple sections, reworked address table support (previously known as trampolines) Added the following x86 modifiers to the x86::Emitter - xacquire(), xrelease(), and k(kreg) Added a possibility to use REP prefix with RET instruction Added a possibility to relocate [rel addr] during relocate() Added a variadic function-call support (Compiler), argument duplication (Compiler), better /dev/shm vs /tmp shared memory handling (VirtMem). Removed imm_u imm_ptr helpers, imm() can now accept any integer and pointer. Changed the default behavior of optimizing instructions to disabled with a possibility to enable that feature through kOptionOptimizedForSize Use default copy construction / assignment to prevent new kind of warnings introduced by GCC 9
2019-07-16 01:24:22 +02:00
INFO("Size of C++ types:");
DUMP_TYPE(int8_t);
DUMP_TYPE(int16_t);
DUMP_TYPE(int32_t);
DUMP_TYPE(int64_t);
DUMP_TYPE(int);
DUMP_TYPE(long);
DUMP_TYPE(size_t);
DUMP_TYPE(intptr_t);
DUMP_TYPE(float);
DUMP_TYPE(double);
DUMP_TYPE(void*);
2017-01-26 15:55:03 +01:00
INFO("");
Refactored register allocator asm Compiler. (#249) Refactored build system macros (ASMJIT_BUILD_STATIC -> ASMJIT_STATIC) Refactored AVX512 broadcast {1toN} - moved to operand from instruction. Refactored naming - renamed getters to not use get prefix. Refactored code structure - move arch-specific stuff into x86 namespace. Refactored some compiler/arch-specific macros, respect rel/abs option in mov REG, [ADDR]. Refactored StringBuilder (Renamed to String, added small string optimization). Refactored LabelId<->LabelEntry mapping, force label offset to 64-bits on all archs. Renamed Runtime to Target (JitRuntime kept for now). Renamed VirtMemManager to JitAllocator. Renamed VirtMem to JitUtils. Renamed FuncSignatureX to FuncSignatureBuilder. Fixed xchg [mem], rex-lo, refactored RelocEntry. Fixed Logger to always show abs|rel when formatting a memory operand Fixed Logger to prefix HEX numbers with 0x prefix Fixed Support::ctzGeneric to always return uint32_t, T doesn't matter. Fixed LightCall to not save MMX and K registers Fixed CpuInfo constructor to propagate NoInit (#243) Added VAES, AVX512_VBMI2, AVX512_VNNI, and AVX512_BITALG cpu-features and instructions. Added emscripten support (asmjit can be now compiled by emscripten). Added asmjit.natvis for better MSVC experience Added x86::ptr_abs|ptr_rel Added support for multibyte nop r/m (#135) Added support for 32-bit to 64-bit zero-extended addresses, improved validation of memory addresses, and removed wrt address type as this will be reworked Added support for multiple sections, reworked address table support (previously known as trampolines) Added the following x86 modifiers to the x86::Emitter - xacquire(), xrelease(), and k(kreg) Added a possibility to use REP prefix with RET instruction Added a possibility to relocate [rel addr] during relocate() Added a variadic function-call support (Compiler), argument duplication (Compiler), better /dev/shm vs /tmp shared memory handling (VirtMem). Removed imm_u imm_ptr helpers, imm() can now accept any integer and pointer. Changed the default behavior of optimizing instructions to disabled with a possibility to enable that feature through kOptionOptimizedForSize Use default copy construction / assignment to prevent new kind of warnings introduced by GCC 9
2019-07-16 01:24:22 +02:00
INFO("Size of base classes:");
DUMP_TYPE(BaseAssembler);
DUMP_TYPE(BaseEmitter);
DUMP_TYPE(CodeBuffer);
DUMP_TYPE(CodeHolder);
DUMP_TYPE(ConstPool);
DUMP_TYPE(LabelEntry);
DUMP_TYPE(RelocEntry);
DUMP_TYPE(Section);
DUMP_TYPE(String);
DUMP_TYPE(Target);
DUMP_TYPE(Zone);
DUMP_TYPE(ZoneAllocator);
DUMP_TYPE(ZoneBitVector);
DUMP_TYPE(ZoneHashNode);
DUMP_TYPE(ZoneHash<ZoneHashNode>);
DUMP_TYPE(ZoneList<int>);
DUMP_TYPE(ZoneVector<int>);
2017-01-26 15:55:03 +01:00
INFO("");
Refactored register allocator asm Compiler. (#249) Refactored build system macros (ASMJIT_BUILD_STATIC -> ASMJIT_STATIC) Refactored AVX512 broadcast {1toN} - moved to operand from instruction. Refactored naming - renamed getters to not use get prefix. Refactored code structure - move arch-specific stuff into x86 namespace. Refactored some compiler/arch-specific macros, respect rel/abs option in mov REG, [ADDR]. Refactored StringBuilder (Renamed to String, added small string optimization). Refactored LabelId<->LabelEntry mapping, force label offset to 64-bits on all archs. Renamed Runtime to Target (JitRuntime kept for now). Renamed VirtMemManager to JitAllocator. Renamed VirtMem to JitUtils. Renamed FuncSignatureX to FuncSignatureBuilder. Fixed xchg [mem], rex-lo, refactored RelocEntry. Fixed Logger to always show abs|rel when formatting a memory operand Fixed Logger to prefix HEX numbers with 0x prefix Fixed Support::ctzGeneric to always return uint32_t, T doesn't matter. Fixed LightCall to not save MMX and K registers Fixed CpuInfo constructor to propagate NoInit (#243) Added VAES, AVX512_VBMI2, AVX512_VNNI, and AVX512_BITALG cpu-features and instructions. Added emscripten support (asmjit can be now compiled by emscripten). Added asmjit.natvis for better MSVC experience Added x86::ptr_abs|ptr_rel Added support for multibyte nop r/m (#135) Added support for 32-bit to 64-bit zero-extended addresses, improved validation of memory addresses, and removed wrt address type as this will be reworked Added support for multiple sections, reworked address table support (previously known as trampolines) Added the following x86 modifiers to the x86::Emitter - xacquire(), xrelease(), and k(kreg) Added a possibility to use REP prefix with RET instruction Added a possibility to relocate [rel addr] during relocate() Added a variadic function-call support (Compiler), argument duplication (Compiler), better /dev/shm vs /tmp shared memory handling (VirtMem). Removed imm_u imm_ptr helpers, imm() can now accept any integer and pointer. Changed the default behavior of optimizing instructions to disabled with a possibility to enable that feature through kOptionOptimizedForSize Use default copy construction / assignment to prevent new kind of warnings introduced by GCC 9
2019-07-16 01:24:22 +02:00
INFO("Size of operand classes:");
DUMP_TYPE(Operand);
DUMP_TYPE(BaseReg);
DUMP_TYPE(BaseMem);
DUMP_TYPE(Imm);
DUMP_TYPE(Label);
2017-01-26 15:55:03 +01:00
INFO("");
Refactored register allocator asm Compiler. (#249) Refactored build system macros (ASMJIT_BUILD_STATIC -> ASMJIT_STATIC) Refactored AVX512 broadcast {1toN} - moved to operand from instruction. Refactored naming - renamed getters to not use get prefix. Refactored code structure - move arch-specific stuff into x86 namespace. Refactored some compiler/arch-specific macros, respect rel/abs option in mov REG, [ADDR]. Refactored StringBuilder (Renamed to String, added small string optimization). Refactored LabelId<->LabelEntry mapping, force label offset to 64-bits on all archs. Renamed Runtime to Target (JitRuntime kept for now). Renamed VirtMemManager to JitAllocator. Renamed VirtMem to JitUtils. Renamed FuncSignatureX to FuncSignatureBuilder. Fixed xchg [mem], rex-lo, refactored RelocEntry. Fixed Logger to always show abs|rel when formatting a memory operand Fixed Logger to prefix HEX numbers with 0x prefix Fixed Support::ctzGeneric to always return uint32_t, T doesn't matter. Fixed LightCall to not save MMX and K registers Fixed CpuInfo constructor to propagate NoInit (#243) Added VAES, AVX512_VBMI2, AVX512_VNNI, and AVX512_BITALG cpu-features and instructions. Added emscripten support (asmjit can be now compiled by emscripten). Added asmjit.natvis for better MSVC experience Added x86::ptr_abs|ptr_rel Added support for multibyte nop r/m (#135) Added support for 32-bit to 64-bit zero-extended addresses, improved validation of memory addresses, and removed wrt address type as this will be reworked Added support for multiple sections, reworked address table support (previously known as trampolines) Added the following x86 modifiers to the x86::Emitter - xacquire(), xrelease(), and k(kreg) Added a possibility to use REP prefix with RET instruction Added a possibility to relocate [rel addr] during relocate() Added a variadic function-call support (Compiler), argument duplication (Compiler), better /dev/shm vs /tmp shared memory handling (VirtMem). Removed imm_u imm_ptr helpers, imm() can now accept any integer and pointer. Changed the default behavior of optimizing instructions to disabled with a possibility to enable that feature through kOptionOptimizedForSize Use default copy construction / assignment to prevent new kind of warnings introduced by GCC 9
2019-07-16 01:24:22 +02:00
INFO("Size of function classes:");
DUMP_TYPE(CallConv);
DUMP_TYPE(FuncFrame);
DUMP_TYPE(FuncValue);
DUMP_TYPE(FuncDetail);
DUMP_TYPE(FuncSignature);
DUMP_TYPE(FuncArgsAssignment);
INFO("");
2017-01-26 15:55:03 +01:00
#if !defined(ASMJIT_NO_BUILDER)
Refactored register allocator asm Compiler. (#249) Refactored build system macros (ASMJIT_BUILD_STATIC -> ASMJIT_STATIC) Refactored AVX512 broadcast {1toN} - moved to operand from instruction. Refactored naming - renamed getters to not use get prefix. Refactored code structure - move arch-specific stuff into x86 namespace. Refactored some compiler/arch-specific macros, respect rel/abs option in mov REG, [ADDR]. Refactored StringBuilder (Renamed to String, added small string optimization). Refactored LabelId<->LabelEntry mapping, force label offset to 64-bits on all archs. Renamed Runtime to Target (JitRuntime kept for now). Renamed VirtMemManager to JitAllocator. Renamed VirtMem to JitUtils. Renamed FuncSignatureX to FuncSignatureBuilder. Fixed xchg [mem], rex-lo, refactored RelocEntry. Fixed Logger to always show abs|rel when formatting a memory operand Fixed Logger to prefix HEX numbers with 0x prefix Fixed Support::ctzGeneric to always return uint32_t, T doesn't matter. Fixed LightCall to not save MMX and K registers Fixed CpuInfo constructor to propagate NoInit (#243) Added VAES, AVX512_VBMI2, AVX512_VNNI, and AVX512_BITALG cpu-features and instructions. Added emscripten support (asmjit can be now compiled by emscripten). Added asmjit.natvis for better MSVC experience Added x86::ptr_abs|ptr_rel Added support for multibyte nop r/m (#135) Added support for 32-bit to 64-bit zero-extended addresses, improved validation of memory addresses, and removed wrt address type as this will be reworked Added support for multiple sections, reworked address table support (previously known as trampolines) Added the following x86 modifiers to the x86::Emitter - xacquire(), xrelease(), and k(kreg) Added a possibility to use REP prefix with RET instruction Added a possibility to relocate [rel addr] during relocate() Added a variadic function-call support (Compiler), argument duplication (Compiler), better /dev/shm vs /tmp shared memory handling (VirtMem). Removed imm_u imm_ptr helpers, imm() can now accept any integer and pointer. Changed the default behavior of optimizing instructions to disabled with a possibility to enable that feature through kOptionOptimizedForSize Use default copy construction / assignment to prevent new kind of warnings introduced by GCC 9
2019-07-16 01:24:22 +02:00
INFO("Size of builder classes:");
DUMP_TYPE(BaseBuilder);
DUMP_TYPE(BaseNode);
DUMP_TYPE(InstNode);
DUMP_TYPE(InstExNode);
DUMP_TYPE(AlignNode);
DUMP_TYPE(LabelNode);
DUMP_TYPE(EmbedDataNode);
DUMP_TYPE(EmbedLabelNode);
DUMP_TYPE(ConstPoolNode);
DUMP_TYPE(CommentNode);
DUMP_TYPE(SentinelNode);
INFO("");
#endif
2017-01-26 15:55:03 +01:00
#if !defined(ASMJIT_NO_COMPILER)
Refactored register allocator asm Compiler. (#249) Refactored build system macros (ASMJIT_BUILD_STATIC -> ASMJIT_STATIC) Refactored AVX512 broadcast {1toN} - moved to operand from instruction. Refactored naming - renamed getters to not use get prefix. Refactored code structure - move arch-specific stuff into x86 namespace. Refactored some compiler/arch-specific macros, respect rel/abs option in mov REG, [ADDR]. Refactored StringBuilder (Renamed to String, added small string optimization). Refactored LabelId<->LabelEntry mapping, force label offset to 64-bits on all archs. Renamed Runtime to Target (JitRuntime kept for now). Renamed VirtMemManager to JitAllocator. Renamed VirtMem to JitUtils. Renamed FuncSignatureX to FuncSignatureBuilder. Fixed xchg [mem], rex-lo, refactored RelocEntry. Fixed Logger to always show abs|rel when formatting a memory operand Fixed Logger to prefix HEX numbers with 0x prefix Fixed Support::ctzGeneric to always return uint32_t, T doesn't matter. Fixed LightCall to not save MMX and K registers Fixed CpuInfo constructor to propagate NoInit (#243) Added VAES, AVX512_VBMI2, AVX512_VNNI, and AVX512_BITALG cpu-features and instructions. Added emscripten support (asmjit can be now compiled by emscripten). Added asmjit.natvis for better MSVC experience Added x86::ptr_abs|ptr_rel Added support for multibyte nop r/m (#135) Added support for 32-bit to 64-bit zero-extended addresses, improved validation of memory addresses, and removed wrt address type as this will be reworked Added support for multiple sections, reworked address table support (previously known as trampolines) Added the following x86 modifiers to the x86::Emitter - xacquire(), xrelease(), and k(kreg) Added a possibility to use REP prefix with RET instruction Added a possibility to relocate [rel addr] during relocate() Added a variadic function-call support (Compiler), argument duplication (Compiler), better /dev/shm vs /tmp shared memory handling (VirtMem). Removed imm_u imm_ptr helpers, imm() can now accept any integer and pointer. Changed the default behavior of optimizing instructions to disabled with a possibility to enable that feature through kOptionOptimizedForSize Use default copy construction / assignment to prevent new kind of warnings introduced by GCC 9
2019-07-16 01:24:22 +02:00
INFO("Size of compiler classes:");
DUMP_TYPE(BaseCompiler);
DUMP_TYPE(FuncNode);
DUMP_TYPE(FuncRetNode);
2020-05-31 23:38:22 +02:00
DUMP_TYPE(InvokeNode);
2017-01-26 15:55:03 +01:00
INFO("");
#endif
2017-01-26 15:55:03 +01:00
#if !defined(ASMJIT_NO_X86)
Refactored register allocator asm Compiler. (#249) Refactored build system macros (ASMJIT_BUILD_STATIC -> ASMJIT_STATIC) Refactored AVX512 broadcast {1toN} - moved to operand from instruction. Refactored naming - renamed getters to not use get prefix. Refactored code structure - move arch-specific stuff into x86 namespace. Refactored some compiler/arch-specific macros, respect rel/abs option in mov REG, [ADDR]. Refactored StringBuilder (Renamed to String, added small string optimization). Refactored LabelId<->LabelEntry mapping, force label offset to 64-bits on all archs. Renamed Runtime to Target (JitRuntime kept for now). Renamed VirtMemManager to JitAllocator. Renamed VirtMem to JitUtils. Renamed FuncSignatureX to FuncSignatureBuilder. Fixed xchg [mem], rex-lo, refactored RelocEntry. Fixed Logger to always show abs|rel when formatting a memory operand Fixed Logger to prefix HEX numbers with 0x prefix Fixed Support::ctzGeneric to always return uint32_t, T doesn't matter. Fixed LightCall to not save MMX and K registers Fixed CpuInfo constructor to propagate NoInit (#243) Added VAES, AVX512_VBMI2, AVX512_VNNI, and AVX512_BITALG cpu-features and instructions. Added emscripten support (asmjit can be now compiled by emscripten). Added asmjit.natvis for better MSVC experience Added x86::ptr_abs|ptr_rel Added support for multibyte nop r/m (#135) Added support for 32-bit to 64-bit zero-extended addresses, improved validation of memory addresses, and removed wrt address type as this will be reworked Added support for multiple sections, reworked address table support (previously known as trampolines) Added the following x86 modifiers to the x86::Emitter - xacquire(), xrelease(), and k(kreg) Added a possibility to use REP prefix with RET instruction Added a possibility to relocate [rel addr] during relocate() Added a variadic function-call support (Compiler), argument duplication (Compiler), better /dev/shm vs /tmp shared memory handling (VirtMem). Removed imm_u imm_ptr helpers, imm() can now accept any integer and pointer. Changed the default behavior of optimizing instructions to disabled with a possibility to enable that feature through kOptionOptimizedForSize Use default copy construction / assignment to prevent new kind of warnings introduced by GCC 9
2019-07-16 01:24:22 +02:00
INFO("Size of x86-specific classes:");
DUMP_TYPE(x86::Assembler);
#if !defined(ASMJIT_NO_BUILDER)
Refactored register allocator asm Compiler. (#249) Refactored build system macros (ASMJIT_BUILD_STATIC -> ASMJIT_STATIC) Refactored AVX512 broadcast {1toN} - moved to operand from instruction. Refactored naming - renamed getters to not use get prefix. Refactored code structure - move arch-specific stuff into x86 namespace. Refactored some compiler/arch-specific macros, respect rel/abs option in mov REG, [ADDR]. Refactored StringBuilder (Renamed to String, added small string optimization). Refactored LabelId<->LabelEntry mapping, force label offset to 64-bits on all archs. Renamed Runtime to Target (JitRuntime kept for now). Renamed VirtMemManager to JitAllocator. Renamed VirtMem to JitUtils. Renamed FuncSignatureX to FuncSignatureBuilder. Fixed xchg [mem], rex-lo, refactored RelocEntry. Fixed Logger to always show abs|rel when formatting a memory operand Fixed Logger to prefix HEX numbers with 0x prefix Fixed Support::ctzGeneric to always return uint32_t, T doesn't matter. Fixed LightCall to not save MMX and K registers Fixed CpuInfo constructor to propagate NoInit (#243) Added VAES, AVX512_VBMI2, AVX512_VNNI, and AVX512_BITALG cpu-features and instructions. Added emscripten support (asmjit can be now compiled by emscripten). Added asmjit.natvis for better MSVC experience Added x86::ptr_abs|ptr_rel Added support for multibyte nop r/m (#135) Added support for 32-bit to 64-bit zero-extended addresses, improved validation of memory addresses, and removed wrt address type as this will be reworked Added support for multiple sections, reworked address table support (previously known as trampolines) Added the following x86 modifiers to the x86::Emitter - xacquire(), xrelease(), and k(kreg) Added a possibility to use REP prefix with RET instruction Added a possibility to relocate [rel addr] during relocate() Added a variadic function-call support (Compiler), argument duplication (Compiler), better /dev/shm vs /tmp shared memory handling (VirtMem). Removed imm_u imm_ptr helpers, imm() can now accept any integer and pointer. Changed the default behavior of optimizing instructions to disabled with a possibility to enable that feature through kOptionOptimizedForSize Use default copy construction / assignment to prevent new kind of warnings introduced by GCC 9
2019-07-16 01:24:22 +02:00
DUMP_TYPE(x86::Builder);
#endif
#if !defined(ASMJIT_NO_COMPILER)
Refactored register allocator asm Compiler. (#249) Refactored build system macros (ASMJIT_BUILD_STATIC -> ASMJIT_STATIC) Refactored AVX512 broadcast {1toN} - moved to operand from instruction. Refactored naming - renamed getters to not use get prefix. Refactored code structure - move arch-specific stuff into x86 namespace. Refactored some compiler/arch-specific macros, respect rel/abs option in mov REG, [ADDR]. Refactored StringBuilder (Renamed to String, added small string optimization). Refactored LabelId<->LabelEntry mapping, force label offset to 64-bits on all archs. Renamed Runtime to Target (JitRuntime kept for now). Renamed VirtMemManager to JitAllocator. Renamed VirtMem to JitUtils. Renamed FuncSignatureX to FuncSignatureBuilder. Fixed xchg [mem], rex-lo, refactored RelocEntry. Fixed Logger to always show abs|rel when formatting a memory operand Fixed Logger to prefix HEX numbers with 0x prefix Fixed Support::ctzGeneric to always return uint32_t, T doesn't matter. Fixed LightCall to not save MMX and K registers Fixed CpuInfo constructor to propagate NoInit (#243) Added VAES, AVX512_VBMI2, AVX512_VNNI, and AVX512_BITALG cpu-features and instructions. Added emscripten support (asmjit can be now compiled by emscripten). Added asmjit.natvis for better MSVC experience Added x86::ptr_abs|ptr_rel Added support for multibyte nop r/m (#135) Added support for 32-bit to 64-bit zero-extended addresses, improved validation of memory addresses, and removed wrt address type as this will be reworked Added support for multiple sections, reworked address table support (previously known as trampolines) Added the following x86 modifiers to the x86::Emitter - xacquire(), xrelease(), and k(kreg) Added a possibility to use REP prefix with RET instruction Added a possibility to relocate [rel addr] during relocate() Added a variadic function-call support (Compiler), argument duplication (Compiler), better /dev/shm vs /tmp shared memory handling (VirtMem). Removed imm_u imm_ptr helpers, imm() can now accept any integer and pointer. Changed the default behavior of optimizing instructions to disabled with a possibility to enable that feature through kOptionOptimizedForSize Use default copy construction / assignment to prevent new kind of warnings introduced by GCC 9
2019-07-16 01:24:22 +02:00
DUMP_TYPE(x86::Compiler);
#endif
DUMP_TYPE(x86::InstDB::InstInfo);
DUMP_TYPE(x86::InstDB::CommonInfo);
DUMP_TYPE(x86::InstDB::OpSignature);
DUMP_TYPE(x86::InstDB::InstSignature);
2017-01-26 15:55:03 +01:00
INFO("");
#endif
Refactored register allocator asm Compiler. (#249) Refactored build system macros (ASMJIT_BUILD_STATIC -> ASMJIT_STATIC) Refactored AVX512 broadcast {1toN} - moved to operand from instruction. Refactored naming - renamed getters to not use get prefix. Refactored code structure - move arch-specific stuff into x86 namespace. Refactored some compiler/arch-specific macros, respect rel/abs option in mov REG, [ADDR]. Refactored StringBuilder (Renamed to String, added small string optimization). Refactored LabelId<->LabelEntry mapping, force label offset to 64-bits on all archs. Renamed Runtime to Target (JitRuntime kept for now). Renamed VirtMemManager to JitAllocator. Renamed VirtMem to JitUtils. Renamed FuncSignatureX to FuncSignatureBuilder. Fixed xchg [mem], rex-lo, refactored RelocEntry. Fixed Logger to always show abs|rel when formatting a memory operand Fixed Logger to prefix HEX numbers with 0x prefix Fixed Support::ctzGeneric to always return uint32_t, T doesn't matter. Fixed LightCall to not save MMX and K registers Fixed CpuInfo constructor to propagate NoInit (#243) Added VAES, AVX512_VBMI2, AVX512_VNNI, and AVX512_BITALG cpu-features and instructions. Added emscripten support (asmjit can be now compiled by emscripten). Added asmjit.natvis for better MSVC experience Added x86::ptr_abs|ptr_rel Added support for multibyte nop r/m (#135) Added support for 32-bit to 64-bit zero-extended addresses, improved validation of memory addresses, and removed wrt address type as this will be reworked Added support for multiple sections, reworked address table support (previously known as trampolines) Added the following x86 modifiers to the x86::Emitter - xacquire(), xrelease(), and k(kreg) Added a possibility to use REP prefix with RET instruction Added a possibility to relocate [rel addr] during relocate() Added a variadic function-call support (Compiler), argument duplication (Compiler), better /dev/shm vs /tmp shared memory handling (VirtMem). Removed imm_u imm_ptr helpers, imm() can now accept any integer and pointer. Changed the default behavior of optimizing instructions to disabled with a possibility to enable that feature through kOptionOptimizedForSize Use default copy construction / assignment to prevent new kind of warnings introduced by GCC 9
2019-07-16 01:24:22 +02:00
}
2017-01-26 15:55:03 +01:00
#undef DUMP_TYPE
Refactored register allocator asm Compiler. (#249) Refactored build system macros (ASMJIT_BUILD_STATIC -> ASMJIT_STATIC) Refactored AVX512 broadcast {1toN} - moved to operand from instruction. Refactored naming - renamed getters to not use get prefix. Refactored code structure - move arch-specific stuff into x86 namespace. Refactored some compiler/arch-specific macros, respect rel/abs option in mov REG, [ADDR]. Refactored StringBuilder (Renamed to String, added small string optimization). Refactored LabelId<->LabelEntry mapping, force label offset to 64-bits on all archs. Renamed Runtime to Target (JitRuntime kept for now). Renamed VirtMemManager to JitAllocator. Renamed VirtMem to JitUtils. Renamed FuncSignatureX to FuncSignatureBuilder. Fixed xchg [mem], rex-lo, refactored RelocEntry. Fixed Logger to always show abs|rel when formatting a memory operand Fixed Logger to prefix HEX numbers with 0x prefix Fixed Support::ctzGeneric to always return uint32_t, T doesn't matter. Fixed LightCall to not save MMX and K registers Fixed CpuInfo constructor to propagate NoInit (#243) Added VAES, AVX512_VBMI2, AVX512_VNNI, and AVX512_BITALG cpu-features and instructions. Added emscripten support (asmjit can be now compiled by emscripten). Added asmjit.natvis for better MSVC experience Added x86::ptr_abs|ptr_rel Added support for multibyte nop r/m (#135) Added support for 32-bit to 64-bit zero-extended addresses, improved validation of memory addresses, and removed wrt address type as this will be reworked Added support for multiple sections, reworked address table support (previously known as trampolines) Added the following x86 modifiers to the x86::Emitter - xacquire(), xrelease(), and k(kreg) Added a possibility to use REP prefix with RET instruction Added a possibility to relocate [rel addr] during relocate() Added a variadic function-call support (Compiler), argument duplication (Compiler), better /dev/shm vs /tmp shared memory handling (VirtMem). Removed imm_u imm_ptr helpers, imm() can now accept any integer and pointer. Changed the default behavior of optimizing instructions to disabled with a possibility to enable that feature through kOptionOptimizedForSize Use default copy construction / assignment to prevent new kind of warnings introduced by GCC 9
2019-07-16 01:24:22 +02:00
static void onBeforeRun(void) noexcept {
2017-01-26 15:55:03 +01:00
dumpCpu();
dumpSizeOf();
}
int main(int argc, const char* argv[]) {
#if defined(ASMJIT_BUILD_DEBUG)
Refactored register allocator asm Compiler. (#249) Refactored build system macros (ASMJIT_BUILD_STATIC -> ASMJIT_STATIC) Refactored AVX512 broadcast {1toN} - moved to operand from instruction. Refactored naming - renamed getters to not use get prefix. Refactored code structure - move arch-specific stuff into x86 namespace. Refactored some compiler/arch-specific macros, respect rel/abs option in mov REG, [ADDR]. Refactored StringBuilder (Renamed to String, added small string optimization). Refactored LabelId<->LabelEntry mapping, force label offset to 64-bits on all archs. Renamed Runtime to Target (JitRuntime kept for now). Renamed VirtMemManager to JitAllocator. Renamed VirtMem to JitUtils. Renamed FuncSignatureX to FuncSignatureBuilder. Fixed xchg [mem], rex-lo, refactored RelocEntry. Fixed Logger to always show abs|rel when formatting a memory operand Fixed Logger to prefix HEX numbers with 0x prefix Fixed Support::ctzGeneric to always return uint32_t, T doesn't matter. Fixed LightCall to not save MMX and K registers Fixed CpuInfo constructor to propagate NoInit (#243) Added VAES, AVX512_VBMI2, AVX512_VNNI, and AVX512_BITALG cpu-features and instructions. Added emscripten support (asmjit can be now compiled by emscripten). Added asmjit.natvis for better MSVC experience Added x86::ptr_abs|ptr_rel Added support for multibyte nop r/m (#135) Added support for 32-bit to 64-bit zero-extended addresses, improved validation of memory addresses, and removed wrt address type as this will be reworked Added support for multiple sections, reworked address table support (previously known as trampolines) Added the following x86 modifiers to the x86::Emitter - xacquire(), xrelease(), and k(kreg) Added a possibility to use REP prefix with RET instruction Added a possibility to relocate [rel addr] during relocate() Added a variadic function-call support (Compiler), argument duplication (Compiler), better /dev/shm vs /tmp shared memory handling (VirtMem). Removed imm_u imm_ptr helpers, imm() can now accept any integer and pointer. Changed the default behavior of optimizing instructions to disabled with a possibility to enable that feature through kOptionOptimizedForSize Use default copy construction / assignment to prevent new kind of warnings introduced by GCC 9
2019-07-16 01:24:22 +02:00
const char buildType[] = "Debug";
#else
Refactored register allocator asm Compiler. (#249) Refactored build system macros (ASMJIT_BUILD_STATIC -> ASMJIT_STATIC) Refactored AVX512 broadcast {1toN} - moved to operand from instruction. Refactored naming - renamed getters to not use get prefix. Refactored code structure - move arch-specific stuff into x86 namespace. Refactored some compiler/arch-specific macros, respect rel/abs option in mov REG, [ADDR]. Refactored StringBuilder (Renamed to String, added small string optimization). Refactored LabelId<->LabelEntry mapping, force label offset to 64-bits on all archs. Renamed Runtime to Target (JitRuntime kept for now). Renamed VirtMemManager to JitAllocator. Renamed VirtMem to JitUtils. Renamed FuncSignatureX to FuncSignatureBuilder. Fixed xchg [mem], rex-lo, refactored RelocEntry. Fixed Logger to always show abs|rel when formatting a memory operand Fixed Logger to prefix HEX numbers with 0x prefix Fixed Support::ctzGeneric to always return uint32_t, T doesn't matter. Fixed LightCall to not save MMX and K registers Fixed CpuInfo constructor to propagate NoInit (#243) Added VAES, AVX512_VBMI2, AVX512_VNNI, and AVX512_BITALG cpu-features and instructions. Added emscripten support (asmjit can be now compiled by emscripten). Added asmjit.natvis for better MSVC experience Added x86::ptr_abs|ptr_rel Added support for multibyte nop r/m (#135) Added support for 32-bit to 64-bit zero-extended addresses, improved validation of memory addresses, and removed wrt address type as this will be reworked Added support for multiple sections, reworked address table support (previously known as trampolines) Added the following x86 modifiers to the x86::Emitter - xacquire(), xrelease(), and k(kreg) Added a possibility to use REP prefix with RET instruction Added a possibility to relocate [rel addr] during relocate() Added a variadic function-call support (Compiler), argument duplication (Compiler), better /dev/shm vs /tmp shared memory handling (VirtMem). Removed imm_u imm_ptr helpers, imm() can now accept any integer and pointer. Changed the default behavior of optimizing instructions to disabled with a possibility to enable that feature through kOptionOptimizedForSize Use default copy construction / assignment to prevent new kind of warnings introduced by GCC 9
2019-07-16 01:24:22 +02:00
const char buildType[] = "Release";
#endif
Refactored register allocator asm Compiler. (#249) Refactored build system macros (ASMJIT_BUILD_STATIC -> ASMJIT_STATIC) Refactored AVX512 broadcast {1toN} - moved to operand from instruction. Refactored naming - renamed getters to not use get prefix. Refactored code structure - move arch-specific stuff into x86 namespace. Refactored some compiler/arch-specific macros, respect rel/abs option in mov REG, [ADDR]. Refactored StringBuilder (Renamed to String, added small string optimization). Refactored LabelId<->LabelEntry mapping, force label offset to 64-bits on all archs. Renamed Runtime to Target (JitRuntime kept for now). Renamed VirtMemManager to JitAllocator. Renamed VirtMem to JitUtils. Renamed FuncSignatureX to FuncSignatureBuilder. Fixed xchg [mem], rex-lo, refactored RelocEntry. Fixed Logger to always show abs|rel when formatting a memory operand Fixed Logger to prefix HEX numbers with 0x prefix Fixed Support::ctzGeneric to always return uint32_t, T doesn't matter. Fixed LightCall to not save MMX and K registers Fixed CpuInfo constructor to propagate NoInit (#243) Added VAES, AVX512_VBMI2, AVX512_VNNI, and AVX512_BITALG cpu-features and instructions. Added emscripten support (asmjit can be now compiled by emscripten). Added asmjit.natvis for better MSVC experience Added x86::ptr_abs|ptr_rel Added support for multibyte nop r/m (#135) Added support for 32-bit to 64-bit zero-extended addresses, improved validation of memory addresses, and removed wrt address type as this will be reworked Added support for multiple sections, reworked address table support (previously known as trampolines) Added the following x86 modifiers to the x86::Emitter - xacquire(), xrelease(), and k(kreg) Added a possibility to use REP prefix with RET instruction Added a possibility to relocate [rel addr] during relocate() Added a variadic function-call support (Compiler), argument duplication (Compiler), better /dev/shm vs /tmp shared memory handling (VirtMem). Removed imm_u imm_ptr helpers, imm() can now accept any integer and pointer. Changed the default behavior of optimizing instructions to disabled with a possibility to enable that feature through kOptionOptimizedForSize Use default copy construction / assignment to prevent new kind of warnings introduced by GCC 9
2019-07-16 01:24:22 +02:00
INFO("AsmJit Unit-Test v%u.%u.%u [Arch=%s] [Mode=%s]\n\n",
unsigned((ASMJIT_LIBRARY_VERSION >> 16) ),
unsigned((ASMJIT_LIBRARY_VERSION >> 8) & 0xFF),
unsigned((ASMJIT_LIBRARY_VERSION ) & 0xFF),
asmjitArchAsString(Arch::kHost),
Refactored register allocator asm Compiler. (#249) Refactored build system macros (ASMJIT_BUILD_STATIC -> ASMJIT_STATIC) Refactored AVX512 broadcast {1toN} - moved to operand from instruction. Refactored naming - renamed getters to not use get prefix. Refactored code structure - move arch-specific stuff into x86 namespace. Refactored some compiler/arch-specific macros, respect rel/abs option in mov REG, [ADDR]. Refactored StringBuilder (Renamed to String, added small string optimization). Refactored LabelId<->LabelEntry mapping, force label offset to 64-bits on all archs. Renamed Runtime to Target (JitRuntime kept for now). Renamed VirtMemManager to JitAllocator. Renamed VirtMem to JitUtils. Renamed FuncSignatureX to FuncSignatureBuilder. Fixed xchg [mem], rex-lo, refactored RelocEntry. Fixed Logger to always show abs|rel when formatting a memory operand Fixed Logger to prefix HEX numbers with 0x prefix Fixed Support::ctzGeneric to always return uint32_t, T doesn't matter. Fixed LightCall to not save MMX and K registers Fixed CpuInfo constructor to propagate NoInit (#243) Added VAES, AVX512_VBMI2, AVX512_VNNI, and AVX512_BITALG cpu-features and instructions. Added emscripten support (asmjit can be now compiled by emscripten). Added asmjit.natvis for better MSVC experience Added x86::ptr_abs|ptr_rel Added support for multibyte nop r/m (#135) Added support for 32-bit to 64-bit zero-extended addresses, improved validation of memory addresses, and removed wrt address type as this will be reworked Added support for multiple sections, reworked address table support (previously known as trampolines) Added the following x86 modifiers to the x86::Emitter - xacquire(), xrelease(), and k(kreg) Added a possibility to use REP prefix with RET instruction Added a possibility to relocate [rel addr] during relocate() Added a variadic function-call support (Compiler), argument duplication (Compiler), better /dev/shm vs /tmp shared memory handling (VirtMem). Removed imm_u imm_ptr helpers, imm() can now accept any integer and pointer. Changed the default behavior of optimizing instructions to disabled with a possibility to enable that feature through kOptionOptimizedForSize Use default copy construction / assignment to prevent new kind of warnings introduced by GCC 9
2019-07-16 01:24:22 +02:00
buildType
);
2017-01-26 15:55:03 +01:00
return BrokenAPI::run(argc, argv, onBeforeRun);
}