LCOV - code coverage report
Current view: top level - asmjit - globals.cpp (source / functions) Hit Total Coverage
Test: plumed test coverage (other modules) Lines: 0 9 0.0 %
Date: 2024-10-18 14:00:27 Functions: 0 3 0.0 %

          Line data    Source code
       1             : /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
       2             : Copyright (c) 2008-2017, Petr Kobalicek
       3             : 
       4             : This software is provided 'as-is', without any express or implied
       5             : warranty. In no event will the authors be held liable for any damages
       6             : arising from the use of this software.
       7             : 
       8             : Permission is granted to anyone to use this software for any purpose,
       9             : including commercial applications, and to alter it and redistribute it
      10             : freely, subject to the following restrictions:
      11             : 
      12             : 1. The origin of this software must not be misrepresented; you must not
      13             :    claim that you wrote the original software. If you use this software
      14             :    in a product, an acknowledgment in the product documentation would be
      15             :    appreciated but is not required.
      16             : 2. Altered source versions must be plainly marked as such, and must not be
      17             :    misrepresented as being the original software.
      18             : 3. This notice may not be removed or altered from any source distribution.
      19             : +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
      20             : #ifdef __PLUMED_HAS_ASMJIT
      21             : #pragma GCC diagnostic push
      22             : #pragma GCC diagnostic ignored "-Wpedantic"
      23             : // [AsmJit]
      24             : // Complete x86/x64 JIT and Remote Assembler for C++.
      25             : //
      26             : // [License]
      27             : // Zlib - See LICENSE.md file in the package.
      28             : 
      29             : // [Export]
      30             : #define ASMJIT_EXPORTS
      31             : 
      32             : // [Dependencies]
      33             : #include "./globals.h"
      34             : #include "./utils.h"
      35             : 
      36             : // [Api-Begin]
      37             : #include "./asmjit_apibegin.h"
      38             : 
      39             : namespace PLMD {
      40             : namespace asmjit {
      41             : 
      42             : // ============================================================================
      43             : // [asmjit::DebugUtils]
      44             : // ============================================================================
      45             : 
      46             : #if !defined(ASMJIT_DISABLE_TEXT)
      47             : static const char errorMessages[] =
      48             :   "Ok\0"
      49             :   "No heap memory\0"
      50             :   "No virtual memory\0"
      51             :   "Invalid argument\0"
      52             :   "Invalid state\0"
      53             :   "Invalid architecture\0"
      54             :   "Not initialized\0"
      55             :   "Already initialized\0"
      56             :   "Feature not enabled\0"
      57             :   "Slot occupied\0"
      58             :   "No code generated\0"
      59             :   "Code too large\0"
      60             :   "Invalid label\0"
      61             :   "Label index overflow\0"
      62             :   "Label already bound\0"
      63             :   "Label already defined\0"
      64             :   "Label name too long\0"
      65             :   "Invalid label name\0"
      66             :   "Invalid parent label\0"
      67             :   "Non-local label can't have parent\0"
      68             :   "Relocation index overflow\0"
      69             :   "Invalid relocation entry\0"
      70             :   "Invalid instruction\0"
      71             :   "Invalid register type\0"
      72             :   "Invalid register kind\0"
      73             :   "Invalid register's physical id\0"
      74             :   "Invalid register's virtual id\0"
      75             :   "Invalid prefix combination\0"
      76             :   "Invalid lock prefix\0"
      77             :   "Invalid xacquire prefix\0"
      78             :   "Invalid xrelease prefix\0"
      79             :   "Invalid rep prefix\0"
      80             :   "Invalid rex prefix\0"
      81             :   "Invalid mask, expected {k}\0"
      82             :   "Invalid use of {k}\0"
      83             :   "Invalid use of {k}{z}\0"
      84             :   "Invalid broadcast {1tox}\0"
      85             :   "Invalid {er} or {sae} option\0"
      86             :   "Invalid address\0"
      87             :   "Invalid address index\0"
      88             :   "Invalid address scale\0"
      89             :   "Invalid use of 64-bit address\0"
      90             :   "Invalid displacement\0"
      91             :   "Invalid segment\0"
      92             :   "Invalid immediate value\0"
      93             :   "Invalid operand size\0"
      94             :   "Ambiguous operand size\0"
      95             :   "Operand size mismatch\0"
      96             :   "Invalid type-info\0"
      97             :   "Invalid use of a low 8-bit GPB register\0"
      98             :   "Invalid use of a 64-bit GPQ register in 32-bit mode\0"
      99             :   "Invalid use of an 80-bit float\0"
     100             :   "Not consecutive registers\0"
     101             :   "No more physical registers\0"
     102             :   "Overlapped registers\0"
     103             :   "Overlapping register and arguments base-address register\0"
     104             :   "Unknown error\0";
     105             : #endif // ASMJIT_DISABLE_TEXT
     106             : 
     107           0 : ASMJIT_FAVOR_SIZE const char* DebugUtils::errorAsString(Error err) noexcept {
     108             : #if !defined(ASMJIT_DISABLE_TEXT)
     109           0 :   return Utils::findPackedString(errorMessages, std::min<Error>(err, kErrorCount));
     110             : #else
     111             :   static const char noMessage[] = "";
     112             :   return noMessage;
     113             : #endif
     114             : }
     115             : 
     116           0 : ASMJIT_FAVOR_SIZE void DebugUtils::debugOutput(const char* str) noexcept {
     117             : #if ASMJIT_OS_WINDOWS
     118             :   ::OutputDebugStringA(str);
     119             : #else
     120           0 :   ::fputs(str, stderr);
     121             : #endif
     122           0 : }
     123             : 
     124           0 : ASMJIT_FAVOR_SIZE void DebugUtils::assertionFailed(const char* file, int line, const char* msg) noexcept {
     125             :   char str[1024];
     126             : 
     127             :   snprintf(str, 1024,
     128             :     "[asmjit] Assertion failed at %s (line %d):\n"
     129             :     "[asmjit] %s\n", file, line, msg);
     130             : 
     131             :   // Support buggy `snprintf` implementations.
     132           0 :   str[1023] = '\0';
     133             : 
     134           0 :   debugOutput(str);
     135           0 :   ::abort();
     136             : }
     137             : 
     138             : } // asmjit namespace
     139             : } // namespace PLMD
     140             : 
     141             : // [Api-End]
     142             : #include "./asmjit_apiend.h"
     143             : #pragma GCC diagnostic pop
     144             : #endif // __PLUMED_HAS_ASMJIT

Generated by: LCOV version 1.16