luajit.h (4677B)
1 /* 2 ** LuaJIT -- a Just-In-Time Compiler for Lua. http://luajit.org/ 3 ** Copyright (C) 2005-2016 Mike Pall. All rights reserved. 4 ** 5 ** LJX - a bastardization of LuaJIT 6 ** Copyright (C) 2014-2016 Karel Tuma, kat@lua.cz 7 ** 8 ** Permission is hereby granted, free of charge, to any person obtaining 9 ** a copy of this software and associated documentation files (the 10 ** "Software"), to deal in the Software without restriction, including 11 ** without limitation the rights to use, copy, modify, merge, publish, 12 ** distribute, sublicense, and/or sell copies of the Software, and to 13 ** permit persons to whom the Software is furnished to do so, subject to 14 ** the following conditions: 15 ** 16 ** The above copyright notice and this permission notice shall be 17 ** included in all copies or substantial portions of the Software. 18 ** 19 ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 21 ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 22 ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 23 ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 24 ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 25 ** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 ** 27 ** [ MIT license: http://www.opensource.org/licenses/mit-license.php ] 28 **/ 29 30 #ifndef _LUAJIT_H 31 #define _LUAJIT_H 32 33 #define MIT_LEGALESE \ 34 "Permission is hereby granted, free of charge, to any person obtaining a copy\n" \ 35 "of this software and associated documentation files (the \"Software\"), to deal\n" \ 36 "in the Software without restriction, including without limitation the rights\n" \ 37 "to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n" \ 38 "copies of the Software, and to permit persons to whom the Software is\n" \ 39 "furnished to do so, subject to the following conditions:\n" \ 40 "\n" \ 41 "The above copyright notice and this permission notice shall be included in\n" \ 42 "all copies or substantial portions of the Software.\n" \ 43 "\n" \ 44 "THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n" \ 45 "IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n" \ 46 "FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n" \ 47 "AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n" \ 48 "LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n" \ 49 "OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n" \ 50 "THE SOFTWARE.\n" 51 52 53 #include "lua.h" 54 55 #define LUAJIT_VERSION "LuaJIT 2.1.0-beta2" 56 #define LJ_LJX_VERSION LUAJIT_VERSION "+" LJX_VERSION 57 #define LUAJIT_VERSION_NUM 20100 /* Version 2.1.0 = 02.01.00. */ 58 #define LUAJIT_VERSION_SYM luaJIT_version_2_1_0_beta2 59 #define LUAJIT_COPYRIGHT "Copyright (C) 2005-2016 Mike Pall" 60 #define LUAJIT_URL "http://luajit.org/" 61 62 /* Let it be known who is responsible for this bastardization */ 63 #define LJX_COPYRIGHT "Copyright (C) 2014-2016 Karel Tuma" 64 #define LJX_URL "http://lua.cz/" 65 66 #define LUA_COPYRIGHTS \ 67 LUA_VERSION " -- " LUA_COPYRIGHT " -- " LUA_URL "\n" \ 68 LUAJIT_VERSION " -- " LUAJIT_COPYRIGHT " -- " LUAJIT_URL "\n" \ 69 LJX_VERSION " -- " LJX_COPYRIGHT " -- " LJX_URL "\n\n" \ 70 MIT_LEGALESE 71 72 73 /* Modes for luaJIT_setmode. */ 74 #define LUAJIT_MODE_MASK 0x00ff 75 76 enum { 77 LUAJIT_MODE_ENGINE, /* Set mode for whole JIT engine. */ 78 LUAJIT_MODE_DEBUG, /* Set debug mode (idx = level). */ 79 80 LUAJIT_MODE_FUNC, /* Change mode for a function. */ 81 LUAJIT_MODE_ALLFUNC, /* Recurse into subroutine protos. */ 82 LUAJIT_MODE_ALLSUBFUNC, /* Change only the subroutines. */ 83 84 LUAJIT_MODE_TRACE, /* Flush a compiled trace. */ 85 86 LUAJIT_MODE_WRAPCFUNC = 0x10, /* Set wrapper mode for C function calls. */ 87 88 LUAJIT_MODE_MAX 89 }; 90 91 /* Flags or'ed in to the mode. */ 92 #define LUAJIT_MODE_OFF 0x0000 /* Turn feature off. */ 93 #define LUAJIT_MODE_ON 0x0100 /* Turn feature on. */ 94 #define LUAJIT_MODE_FLUSH 0x0200 /* Flush JIT-compiled code. */ 95 96 /* LuaJIT public C API. */ 97 98 /* Control the JIT engine. */ 99 LUA_API int luaJIT_setmode(lua_State *L, int idx, int mode); 100 101 /* Low-overhead profiling API. */ 102 typedef void (*luaJIT_profile_callback)(void *data, lua_State *L, 103 int samples, int vmstate); 104 LUA_API void luaJIT_profile_start(lua_State *L, const char *mode, 105 luaJIT_profile_callback cb, void *data); 106 LUA_API void luaJIT_profile_stop(lua_State *L); 107 LUA_API const char *luaJIT_profile_dumpstack(lua_State *L, const char *fmt, 108 int depth, size_t *len); 109 110 /* Enforce (dynamic) linker error for version mismatches. Call from main. */ 111 LUA_API void LUAJIT_VERSION_SYM(void); 112 113 #endif