asmjit 0.2.0 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/Rakefile +5 -3
- data/asmjit.gemspec +1 -3
- data/ext/asmjit/asmjit/.editorconfig +10 -0
- data/ext/asmjit/asmjit/.github/FUNDING.yml +1 -0
- data/ext/asmjit/asmjit/.github/workflows/build-config.json +47 -0
- data/ext/asmjit/asmjit/.github/workflows/build.yml +156 -0
- data/ext/asmjit/asmjit/.gitignore +6 -0
- data/ext/asmjit/asmjit/CMakeLists.txt +611 -0
- data/ext/asmjit/asmjit/LICENSE.md +17 -0
- data/ext/asmjit/asmjit/README.md +69 -0
- data/ext/asmjit/asmjit/src/asmjit/a64.h +62 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64archtraits_p.h +81 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64assembler.cpp +5115 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64assembler.h +72 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64builder.cpp +51 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64builder.h +57 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64compiler.cpp +60 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64compiler.h +247 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64emithelper.cpp +464 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64emithelper_p.h +50 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64emitter.h +1228 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64formatter.cpp +298 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64formatter_p.h +59 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64func.cpp +189 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64func_p.h +33 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64globals.h +1894 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64instapi.cpp +278 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64instapi_p.h +41 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64instdb.cpp +1957 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64instdb.h +74 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64instdb_p.h +876 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64operand.cpp +85 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64operand.h +312 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64rapass.cpp +852 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64rapass_p.h +105 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64utils.h +179 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/armformatter.cpp +143 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/armformatter_p.h +44 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/armglobals.h +21 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/armoperand.h +621 -0
- data/ext/asmjit/asmjit/src/asmjit/arm.h +62 -0
- data/ext/asmjit/asmjit/src/asmjit/asmjit-scope-begin.h +17 -0
- data/ext/asmjit/asmjit/src/asmjit/asmjit-scope-end.h +9 -0
- data/ext/asmjit/asmjit/src/asmjit/asmjit.h +33 -0
- data/ext/asmjit/asmjit/src/asmjit/core/api-build_p.h +55 -0
- data/ext/asmjit/asmjit/src/asmjit/core/api-config.h +613 -0
- data/ext/asmjit/asmjit/src/asmjit/core/archcommons.h +229 -0
- data/ext/asmjit/asmjit/src/asmjit/core/archtraits.cpp +160 -0
- data/ext/asmjit/asmjit/src/asmjit/core/archtraits.h +290 -0
- data/ext/asmjit/asmjit/src/asmjit/core/assembler.cpp +406 -0
- data/ext/asmjit/asmjit/src/asmjit/core/assembler.h +129 -0
- data/ext/asmjit/asmjit/src/asmjit/core/builder.cpp +889 -0
- data/ext/asmjit/asmjit/src/asmjit/core/builder.h +1391 -0
- data/ext/asmjit/asmjit/src/asmjit/core/codebuffer.h +113 -0
- data/ext/asmjit/asmjit/src/asmjit/core/codeholder.cpp +1149 -0
- data/ext/asmjit/asmjit/src/asmjit/core/codeholder.h +1035 -0
- data/ext/asmjit/asmjit/src/asmjit/core/codewriter.cpp +175 -0
- data/ext/asmjit/asmjit/src/asmjit/core/codewriter_p.h +179 -0
- data/ext/asmjit/asmjit/src/asmjit/core/compiler.cpp +582 -0
- data/ext/asmjit/asmjit/src/asmjit/core/compiler.h +737 -0
- data/ext/asmjit/asmjit/src/asmjit/core/compilerdefs.h +173 -0
- data/ext/asmjit/asmjit/src/asmjit/core/constpool.cpp +363 -0
- data/ext/asmjit/asmjit/src/asmjit/core/constpool.h +250 -0
- data/ext/asmjit/asmjit/src/asmjit/core/cpuinfo.cpp +1162 -0
- data/ext/asmjit/asmjit/src/asmjit/core/cpuinfo.h +813 -0
- data/ext/asmjit/asmjit/src/asmjit/core/emithelper.cpp +323 -0
- data/ext/asmjit/asmjit/src/asmjit/core/emithelper_p.h +58 -0
- data/ext/asmjit/asmjit/src/asmjit/core/emitter.cpp +333 -0
- data/ext/asmjit/asmjit/src/asmjit/core/emitter.h +741 -0
- data/ext/asmjit/asmjit/src/asmjit/core/emitterutils.cpp +129 -0
- data/ext/asmjit/asmjit/src/asmjit/core/emitterutils_p.h +89 -0
- data/ext/asmjit/asmjit/src/asmjit/core/environment.cpp +46 -0
- data/ext/asmjit/asmjit/src/asmjit/core/environment.h +508 -0
- data/ext/asmjit/asmjit/src/asmjit/core/errorhandler.cpp +14 -0
- data/ext/asmjit/asmjit/src/asmjit/core/errorhandler.h +228 -0
- data/ext/asmjit/asmjit/src/asmjit/core/formatter.cpp +584 -0
- data/ext/asmjit/asmjit/src/asmjit/core/formatter.h +247 -0
- data/ext/asmjit/asmjit/src/asmjit/core/formatter_p.h +34 -0
- data/ext/asmjit/asmjit/src/asmjit/core/func.cpp +286 -0
- data/ext/asmjit/asmjit/src/asmjit/core/func.h +1445 -0
- data/ext/asmjit/asmjit/src/asmjit/core/funcargscontext.cpp +293 -0
- data/ext/asmjit/asmjit/src/asmjit/core/funcargscontext_p.h +199 -0
- data/ext/asmjit/asmjit/src/asmjit/core/globals.cpp +133 -0
- data/ext/asmjit/asmjit/src/asmjit/core/globals.h +393 -0
- data/ext/asmjit/asmjit/src/asmjit/core/inst.cpp +113 -0
- data/ext/asmjit/asmjit/src/asmjit/core/inst.h +772 -0
- data/ext/asmjit/asmjit/src/asmjit/core/jitallocator.cpp +1242 -0
- data/ext/asmjit/asmjit/src/asmjit/core/jitallocator.h +261 -0
- data/ext/asmjit/asmjit/src/asmjit/core/jitruntime.cpp +80 -0
- data/ext/asmjit/asmjit/src/asmjit/core/jitruntime.h +89 -0
- data/ext/asmjit/asmjit/src/asmjit/core/logger.cpp +69 -0
- data/ext/asmjit/asmjit/src/asmjit/core/logger.h +198 -0
- data/ext/asmjit/asmjit/src/asmjit/core/misc_p.h +33 -0
- data/ext/asmjit/asmjit/src/asmjit/core/operand.cpp +132 -0
- data/ext/asmjit/asmjit/src/asmjit/core/operand.h +1611 -0
- data/ext/asmjit/asmjit/src/asmjit/core/osutils.cpp +84 -0
- data/ext/asmjit/asmjit/src/asmjit/core/osutils.h +61 -0
- data/ext/asmjit/asmjit/src/asmjit/core/osutils_p.h +68 -0
- data/ext/asmjit/asmjit/src/asmjit/core/raassignment_p.h +418 -0
- data/ext/asmjit/asmjit/src/asmjit/core/rabuilders_p.h +612 -0
- data/ext/asmjit/asmjit/src/asmjit/core/radefs_p.h +1204 -0
- data/ext/asmjit/asmjit/src/asmjit/core/ralocal.cpp +1166 -0
- data/ext/asmjit/asmjit/src/asmjit/core/ralocal_p.h +254 -0
- data/ext/asmjit/asmjit/src/asmjit/core/rapass.cpp +1969 -0
- data/ext/asmjit/asmjit/src/asmjit/core/rapass_p.h +1183 -0
- data/ext/asmjit/asmjit/src/asmjit/core/rastack.cpp +184 -0
- data/ext/asmjit/asmjit/src/asmjit/core/rastack_p.h +171 -0
- data/ext/asmjit/asmjit/src/asmjit/core/string.cpp +559 -0
- data/ext/asmjit/asmjit/src/asmjit/core/string.h +372 -0
- data/ext/asmjit/asmjit/src/asmjit/core/support.cpp +494 -0
- data/ext/asmjit/asmjit/src/asmjit/core/support.h +1773 -0
- data/ext/asmjit/asmjit/src/asmjit/core/target.cpp +14 -0
- data/ext/asmjit/asmjit/src/asmjit/core/target.h +53 -0
- data/ext/asmjit/asmjit/src/asmjit/core/type.cpp +74 -0
- data/ext/asmjit/asmjit/src/asmjit/core/type.h +419 -0
- data/ext/asmjit/asmjit/src/asmjit/core/virtmem.cpp +722 -0
- data/ext/asmjit/asmjit/src/asmjit/core/virtmem.h +242 -0
- data/ext/asmjit/asmjit/src/asmjit/core/zone.cpp +353 -0
- data/ext/asmjit/asmjit/src/asmjit/core/zone.h +615 -0
- data/ext/asmjit/asmjit/src/asmjit/core/zonehash.cpp +309 -0
- data/ext/asmjit/asmjit/src/asmjit/core/zonehash.h +186 -0
- data/ext/asmjit/asmjit/src/asmjit/core/zonelist.cpp +163 -0
- data/ext/asmjit/asmjit/src/asmjit/core/zonelist.h +209 -0
- data/ext/asmjit/asmjit/src/asmjit/core/zonestack.cpp +176 -0
- data/ext/asmjit/asmjit/src/asmjit/core/zonestack.h +239 -0
- data/ext/asmjit/asmjit/src/asmjit/core/zonestring.h +120 -0
- data/ext/asmjit/asmjit/src/asmjit/core/zonetree.cpp +99 -0
- data/ext/asmjit/asmjit/src/asmjit/core/zonetree.h +380 -0
- data/ext/asmjit/asmjit/src/asmjit/core/zonevector.cpp +356 -0
- data/ext/asmjit/asmjit/src/asmjit/core/zonevector.h +690 -0
- data/ext/asmjit/asmjit/src/asmjit/core.h +1861 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86archtraits_p.h +148 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86assembler.cpp +5110 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86assembler.h +685 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86builder.cpp +52 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86builder.h +351 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86compiler.cpp +61 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86compiler.h +721 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86emithelper.cpp +619 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86emithelper_p.h +60 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86emitter.h +4315 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86formatter.cpp +944 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86formatter_p.h +58 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86func.cpp +503 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86func_p.h +33 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86globals.h +2169 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86instapi.cpp +1732 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86instapi_p.h +41 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86instdb.cpp +4427 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86instdb.h +563 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86instdb_p.h +311 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86opcode_p.h +436 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86operand.cpp +231 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86operand.h +1085 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86rapass.cpp +1509 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86rapass_p.h +94 -0
- data/ext/asmjit/asmjit/src/asmjit/x86.h +93 -0
- data/ext/asmjit/asmjit/src/asmjit.natvis +245 -0
- data/ext/asmjit/asmjit/test/asmjit_test_assembler.cpp +84 -0
- data/ext/asmjit/asmjit/test/asmjit_test_assembler.h +85 -0
- data/ext/asmjit/asmjit/test/asmjit_test_assembler_a64.cpp +4006 -0
- data/ext/asmjit/asmjit/test/asmjit_test_assembler_x64.cpp +17833 -0
- data/ext/asmjit/asmjit/test/asmjit_test_assembler_x86.cpp +8300 -0
- data/ext/asmjit/asmjit/test/asmjit_test_compiler.cpp +253 -0
- data/ext/asmjit/asmjit/test/asmjit_test_compiler.h +73 -0
- data/ext/asmjit/asmjit/test/asmjit_test_compiler_a64.cpp +690 -0
- data/ext/asmjit/asmjit/test/asmjit_test_compiler_x86.cpp +4317 -0
- data/ext/asmjit/asmjit/test/asmjit_test_emitters.cpp +197 -0
- data/ext/asmjit/asmjit/test/asmjit_test_instinfo.cpp +181 -0
- data/ext/asmjit/asmjit/test/asmjit_test_misc.h +257 -0
- data/ext/asmjit/asmjit/test/asmjit_test_perf.cpp +62 -0
- data/ext/asmjit/asmjit/test/asmjit_test_perf.h +61 -0
- data/ext/asmjit/asmjit/test/asmjit_test_perf_a64.cpp +699 -0
- data/ext/asmjit/asmjit/test/asmjit_test_perf_x86.cpp +5032 -0
- data/ext/asmjit/asmjit/test/asmjit_test_unit.cpp +172 -0
- data/ext/asmjit/asmjit/test/asmjit_test_x86_sections.cpp +172 -0
- data/ext/asmjit/asmjit/test/asmjitutils.h +38 -0
- data/ext/asmjit/asmjit/test/broken.cpp +312 -0
- data/ext/asmjit/asmjit/test/broken.h +148 -0
- data/ext/asmjit/asmjit/test/cmdline.h +61 -0
- data/ext/asmjit/asmjit/test/performancetimer.h +41 -0
- data/ext/asmjit/asmjit/tools/configure-makefiles.sh +13 -0
- data/ext/asmjit/asmjit/tools/configure-ninja.sh +13 -0
- data/ext/asmjit/asmjit/tools/configure-sanitizers.sh +13 -0
- data/ext/asmjit/asmjit/tools/configure-vs2019-x64.bat +2 -0
- data/ext/asmjit/asmjit/tools/configure-vs2019-x86.bat +2 -0
- data/ext/asmjit/asmjit/tools/configure-vs2022-x64.bat +2 -0
- data/ext/asmjit/asmjit/tools/configure-vs2022-x86.bat +2 -0
- data/ext/asmjit/asmjit/tools/configure-xcode.sh +8 -0
- data/ext/asmjit/asmjit/tools/enumgen.js +417 -0
- data/ext/asmjit/asmjit/tools/enumgen.sh +3 -0
- data/ext/asmjit/asmjit/tools/tablegen-arm.js +365 -0
- data/ext/asmjit/asmjit/tools/tablegen-arm.sh +3 -0
- data/ext/asmjit/asmjit/tools/tablegen-x86.js +2638 -0
- data/ext/asmjit/asmjit/tools/tablegen-x86.sh +3 -0
- data/ext/asmjit/asmjit/tools/tablegen.js +947 -0
- data/ext/asmjit/asmjit/tools/tablegen.sh +4 -0
- data/ext/asmjit/asmjit.cc +167 -30
- data/ext/asmjit/extconf.rb +9 -9
- data/lib/asmjit/version.rb +1 -1
- data/lib/asmjit.rb +14 -4
- metadata +198 -17
@@ -0,0 +1,148 @@
|
|
1
|
+
// Broken - Lightweight unit testing for C++
|
2
|
+
//
|
3
|
+
// This is free and unencumbered software released into the public domain.
|
4
|
+
//
|
5
|
+
// Anyone is free to copy, modify, publish, use, compile, sell, or
|
6
|
+
// distribute this software, either in source code form or as a compiled
|
7
|
+
// binary, for any purpose, commercial or non-commercial, and by any
|
8
|
+
// means.
|
9
|
+
//
|
10
|
+
// In jurisdictions that recognize copyright laws, the author or authors
|
11
|
+
// of this software dedicate any and all copyright interest in the
|
12
|
+
// software to the public domain. We make this dedication for the benefit
|
13
|
+
// of the public at large and to the detriment of our heirs and
|
14
|
+
// successors. We intend this dedication to be an overt act of
|
15
|
+
// relinquishment in perpetuity of all present and future rights to this
|
16
|
+
// software under copyright law.
|
17
|
+
//
|
18
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
19
|
+
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
20
|
+
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
21
|
+
// IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
22
|
+
// OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
23
|
+
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
24
|
+
// OTHER DEALINGS IN THE SOFTWARE.
|
25
|
+
//
|
26
|
+
// For more information, please refer to <http://unlicense.org>
|
27
|
+
|
28
|
+
#ifndef BROKEN_H_INCLUDED
|
29
|
+
#define BROKEN_H_INCLUDED
|
30
|
+
|
31
|
+
#include <stdio.h>
|
32
|
+
#include <stdlib.h>
|
33
|
+
#include <string.h>
|
34
|
+
#include <utility>
|
35
|
+
|
36
|
+
// Hide everything when using Doxygen. Ideally this can be protected by a macro,
|
37
|
+
// but there is not globally and widely used one across multiple projects.
|
38
|
+
|
39
|
+
//! \cond
|
40
|
+
|
41
|
+
// ============================================================================
|
42
|
+
// [Broken - API]
|
43
|
+
// ============================================================================
|
44
|
+
|
45
|
+
struct BrokenAPI {
|
46
|
+
//! Entry point of a unit test defined by `UNIT` macro.
|
47
|
+
typedef void (*Entry)(void);
|
48
|
+
|
49
|
+
enum Flags : unsigned {
|
50
|
+
kFlagFinished = 0x1
|
51
|
+
};
|
52
|
+
|
53
|
+
//! Test defined by `UNIT` macro.
|
54
|
+
struct Unit {
|
55
|
+
Entry entry;
|
56
|
+
const char* name;
|
57
|
+
int priority;
|
58
|
+
unsigned flags;
|
59
|
+
Unit* next;
|
60
|
+
};
|
61
|
+
|
62
|
+
//! Automatic unit registration by using static initialization.
|
63
|
+
struct AutoUnit : Unit {
|
64
|
+
inline AutoUnit(Entry entry_, const char* name_, int priority_ = 0, int dummy_ = 0) noexcept {
|
65
|
+
// Not used, only to trick `UNIT()` macro.
|
66
|
+
(void)dummy_;
|
67
|
+
|
68
|
+
this->entry = entry_;
|
69
|
+
this->name = name_;
|
70
|
+
this->priority = priority_;
|
71
|
+
this->flags = 0;
|
72
|
+
this->next = nullptr;
|
73
|
+
BrokenAPI::add(this);
|
74
|
+
}
|
75
|
+
};
|
76
|
+
|
77
|
+
static bool hasArg(const char* name) noexcept;
|
78
|
+
|
79
|
+
//! Register a new unit test (called automatically by `AutoUnit` and `UNIT`).
|
80
|
+
static void add(Unit* unit) noexcept;
|
81
|
+
|
82
|
+
//! Set output file to a `file`.
|
83
|
+
static void setOutputFile(FILE* file) noexcept;
|
84
|
+
|
85
|
+
//! Initialize `Broken` framework.
|
86
|
+
//!
|
87
|
+
//! Returns `true` if `run()` should be called.
|
88
|
+
static int run(int argc, const char* argv[], Entry onBeforeRun = nullptr, Entry onAfterRun = nullptr);
|
89
|
+
|
90
|
+
//! Log message, adds automatically new line if not present.
|
91
|
+
static void info(const char* fmt, ...) noexcept;
|
92
|
+
|
93
|
+
//! Called on `EXPECT()` failure.
|
94
|
+
static void fail(const char* file, int line, const char* expression, const char* fmt, ...) noexcept;
|
95
|
+
|
96
|
+
//! Used internally by `EXPECT` macro.
|
97
|
+
template<typename T>
|
98
|
+
static inline void expect(const char* file, int line, const char* expression, const T& result) noexcept {
|
99
|
+
if (!result)
|
100
|
+
fail(file, line, expression, nullptr);
|
101
|
+
}
|
102
|
+
|
103
|
+
//! Used internally by `EXPECT` macro.
|
104
|
+
template<typename T, typename... Args>
|
105
|
+
static inline void expect(const char* file, int line, const char* expression, const T& result, const char* fmt, Args&&... args) noexcept {
|
106
|
+
if (!result)
|
107
|
+
fail(file, line, expression, fmt, std::forward<Args>(args)...);
|
108
|
+
}
|
109
|
+
};
|
110
|
+
|
111
|
+
// ============================================================================
|
112
|
+
// [Broken - Macros]
|
113
|
+
// ============================================================================
|
114
|
+
|
115
|
+
//! Internal macro used by `UNIT()`.
|
116
|
+
#define BROKEN_UNIT_INTERNAL(NAME, PRIORITY) \
|
117
|
+
static void unit_##NAME##_entry(void); \
|
118
|
+
static ::BrokenAPI::AutoUnit unit_##NAME##_autoinit(unit_##NAME##_entry, #NAME, PRIORITY); \
|
119
|
+
static void unit_##NAME##_entry(void)
|
120
|
+
|
121
|
+
//! Stringifies the expression used by EXPECT().
|
122
|
+
#define BROKEN_STRINFIGY_EXPRESSION_INTERNAL(EXP, ...) #EXP
|
123
|
+
|
124
|
+
//! \def UNIT(NAME [, PRIORITY])
|
125
|
+
//!
|
126
|
+
//! Define a unit test with an optional priority.
|
127
|
+
//!
|
128
|
+
//! `NAME` can only contain ASCII characters, numbers and underscore. It has
|
129
|
+
//! the same rules as identifiers in C and C++.
|
130
|
+
//!
|
131
|
+
//! `PRIORITY` specifies the order in which unit tests are run. Lesses value
|
132
|
+
//! increases the priority. At the moment all units are first sorted by
|
133
|
+
//! priority and then by name - this makes the run always deterministic.
|
134
|
+
#define UNIT(NAME, ...) BROKEN_UNIT_INTERNAL(NAME, __VA_ARGS__ + 0)
|
135
|
+
|
136
|
+
//! #define INFO(FORMAT [, ...])
|
137
|
+
//!
|
138
|
+
//! Informative message printed to `stdout`.
|
139
|
+
#define INFO(...) ::BrokenAPI::info(__VA_ARGS__)
|
140
|
+
|
141
|
+
//! #define INFO(EXP [, FORMAT [, ...]])
|
142
|
+
//!
|
143
|
+
//! Expect `EXP` to be true or evaluates to true, fail otherwise.
|
144
|
+
#define EXPECT(...) ::BrokenAPI::expect(__FILE__, __LINE__, BROKEN_STRINFIGY_EXPRESSION_INTERNAL(__VA_ARGS__), __VA_ARGS__)
|
145
|
+
|
146
|
+
//! \endcond
|
147
|
+
|
148
|
+
#endif // BROKEN_H_INCLUDED
|
@@ -0,0 +1,61 @@
|
|
1
|
+
// This file is part of AsmJit project <https://asmjit.com>
|
2
|
+
//
|
3
|
+
// See asmjit.h or LICENSE.md for license and copyright information
|
4
|
+
// SPDX-License-Identifier: Zlib
|
5
|
+
|
6
|
+
#ifndef CMDLINE_H_INCLUDED
|
7
|
+
#define CMDLINE_H_INCLUDED
|
8
|
+
|
9
|
+
#include <stdint.h>
|
10
|
+
#include <stdlib.h>
|
11
|
+
#include <string.h>
|
12
|
+
|
13
|
+
class CmdLine {
|
14
|
+
public:
|
15
|
+
int _argc;
|
16
|
+
const char* const* _argv;
|
17
|
+
|
18
|
+
CmdLine(int argc, const char* const* argv)
|
19
|
+
: _argc(argc),
|
20
|
+
_argv(argv) {}
|
21
|
+
|
22
|
+
bool hasArg(const char* key) const {
|
23
|
+
for (int i = 1; i < _argc; i++)
|
24
|
+
if (strcmp(key, _argv[i]) == 0)
|
25
|
+
return true;
|
26
|
+
return false;
|
27
|
+
}
|
28
|
+
|
29
|
+
const char* valueOf(const char* key, const char* defaultValue) const {
|
30
|
+
size_t keySize = strlen(key);
|
31
|
+
for (int i = 1; i < _argc; i++) {
|
32
|
+
const char* val = _argv[i];
|
33
|
+
if (strlen(val) >= keySize + 1 && val[keySize] == '=' && memcmp(val, key, keySize) == 0)
|
34
|
+
return val + keySize + 1;
|
35
|
+
}
|
36
|
+
|
37
|
+
return defaultValue;
|
38
|
+
}
|
39
|
+
|
40
|
+
int valueAsInt(const char* key, int defaultValue) const {
|
41
|
+
const char* val = valueOf(key, nullptr);
|
42
|
+
if (val == nullptr || val[0] == '\0')
|
43
|
+
return defaultValue;
|
44
|
+
|
45
|
+
return atoi(val);
|
46
|
+
}
|
47
|
+
|
48
|
+
unsigned valueAsUInt(const char* key, unsigned defaultValue) const {
|
49
|
+
const char* val = valueOf(key, nullptr);
|
50
|
+
if (val == nullptr || val[0] == '\0')
|
51
|
+
return defaultValue;
|
52
|
+
|
53
|
+
int v = atoi(val);
|
54
|
+
if (v < 0)
|
55
|
+
return defaultValue;
|
56
|
+
else
|
57
|
+
return unsigned(v);
|
58
|
+
}
|
59
|
+
};
|
60
|
+
|
61
|
+
#endif // CMDLINE_H_INCLUDED
|
@@ -0,0 +1,41 @@
|
|
1
|
+
// This file is part of AsmJit project <https://asmjit.com>
|
2
|
+
//
|
3
|
+
// See asmjit.h or LICENSE.md for license and copyright information
|
4
|
+
// SPDX-License-Identifier: Zlib
|
5
|
+
|
6
|
+
#ifndef PERFORMANCETIMER_H_INCLUDED
|
7
|
+
#define PERFORMANCETIMER_H_INCLUDED
|
8
|
+
|
9
|
+
#include <asmjit/core.h>
|
10
|
+
#include <chrono>
|
11
|
+
|
12
|
+
class PerformanceTimer {
|
13
|
+
public:
|
14
|
+
typedef std::chrono::high_resolution_clock::time_point TimePoint;
|
15
|
+
|
16
|
+
TimePoint _startTime {};
|
17
|
+
TimePoint _endTime {};
|
18
|
+
|
19
|
+
inline void start() {
|
20
|
+
_startTime = std::chrono::high_resolution_clock::now();
|
21
|
+
}
|
22
|
+
|
23
|
+
inline void stop() {
|
24
|
+
_endTime = std::chrono::high_resolution_clock::now();
|
25
|
+
}
|
26
|
+
|
27
|
+
inline double duration() const {
|
28
|
+
std::chrono::duration<double> elapsed = _endTime - _startTime;
|
29
|
+
return elapsed.count() * 1000;
|
30
|
+
}
|
31
|
+
};
|
32
|
+
|
33
|
+
static inline double mbps(double duration, uint64_t outputSize) noexcept {
|
34
|
+
if (duration == 0)
|
35
|
+
return 0.0;
|
36
|
+
|
37
|
+
double bytesTotal = double(outputSize);
|
38
|
+
return (bytesTotal * 1000) / (duration * 1024 * 1024);
|
39
|
+
}
|
40
|
+
|
41
|
+
#endif // PERFORMANCETIMER_H_INCLUDED
|
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
CURRENT_DIR="`pwd`"
|
4
|
+
BUILD_DIR="${CURRENT_DIR}/../build"
|
5
|
+
BUILD_OPTIONS="-DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DASMJIT_TEST=1"
|
6
|
+
|
7
|
+
echo "== [Configuring Build - Debug] =="
|
8
|
+
eval cmake "${CURRENT_DIR}/.." -B "${BUILD_DIR}/Debug" -DCMAKE_BUILD_TYPE=Debug ${BUILD_OPTIONS}
|
9
|
+
echo ""
|
10
|
+
|
11
|
+
echo "== [Configuring Build - Release] =="
|
12
|
+
eval cmake "${CURRENT_DIR}/.." -B "${BUILD_DIR}/Release" -DCMAKE_BUILD_TYPE=Release ${BUILD_OPTIONS}
|
13
|
+
echo ""
|
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
CURRENT_DIR="`pwd`"
|
4
|
+
BUILD_DIR="${CURRENT_DIR}/../build"
|
5
|
+
BUILD_OPTIONS="-G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DASMJIT_TEST=1"
|
6
|
+
|
7
|
+
echo "== [Configuring Build - Debug] =="
|
8
|
+
eval cmake "${CURRENT_DIR}/.." -B "${BUILD_DIR}/Debug" -DCMAKE_BUILD_TYPE=Debug ${BUILD_OPTIONS}
|
9
|
+
echo ""
|
10
|
+
|
11
|
+
echo "== [Configuring Build - Release] =="
|
12
|
+
eval cmake "${CURRENT_DIR}/.." -B "${BUILD_DIR}/Release" -DCMAKE_BUILD_TYPE=Release ${BUILD_OPTIONS}
|
13
|
+
echo ""
|
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
CURRENT_DIR="`pwd`"
|
4
|
+
BUILD_DIR="${CURRENT_DIR}/../build"
|
5
|
+
BUILD_OPTIONS="-DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DASMJIT_TEST=1"
|
6
|
+
|
7
|
+
echo "== [Configuring Build - Release_ASAN] =="
|
8
|
+
eval cmake "${CURRENT_DIR}/.." -B "${BUILD_DIR}/Release_ASAN" ${BUILD_OPTIONS} -DCMAKE_BUILD_TYPE=Release -DASMJIT_SANITIZE=address
|
9
|
+
echo ""
|
10
|
+
|
11
|
+
echo "== [Configuring Build - Release_UBSAN] =="
|
12
|
+
eval cmake "${CURRENT_DIR}/.." -B "${BUILD_DIR}/Release_UBSAN" ${BUILD_OPTIONS} -DCMAKE_BUILD_TYPE=Release -DASMJIT_SANITIZE=undefined
|
13
|
+
echo ""
|