nometajit
Dibyendu Majumdar 4 years ago
parent 722e696028
commit ca0d65e786

@ -56,7 +56,7 @@ set(RAVI_AST_SOURCES src/ravi_ast_parse.c src/ravi_ast_print.c src/ravi_ast_type
set(LUA_CORE_SRCS src/lapi.c src/lcode.c src/lctype.c src/ldebug.c src/ldo.c src/ldump.c
src/lfunc.c src/lgc.c src/llex.c src/lmem.c src/lobject.c src/lopcodes.c
src/lparser.c src/lstate.c src/lstring.c src/ltable.c src/ltm.c src/lundump.c
src/lvm.c src/lzio.c src/ravijit.cpp src/ltests.c src/ravi_profile.c
src/lvm.c src/lzio.c src/ravi_jit.c src/ltests.c src/ravi_profile.c
src/ravi_membuf.c src/ravi_jitshared.c src/bit.c src/ravi_alloc.c
${RAVI_AST_SOURCES})
# define the Lua library source files

@ -52,7 +52,7 @@ LUAMOD_API int (luaopen_package) (lua_State *L);
/** RAVI change start **/
#define LUA_RAVILIBNAME "ravi"
LUAMOD_API int (raviopen_llvmjit)(lua_State *L);
LUAMOD_API int (raviopen_jit)(lua_State *L);
#define LUA_ASTLIBNAME "ast"
LUAMOD_API int (raviopen_ast_library)(lua_State *L);

@ -27,6 +27,10 @@
extern "C" {
#endif
/**
* Definition of the API that all JIT backends must implement.
*/
struct lua_State;
struct Proto;
typedef struct ravi_compile_options_t ravi_compile_options_t;
@ -43,7 +47,6 @@ int raviV_compile(struct lua_State *L, struct Proto *p,
/* Compile an array of functions */
int raviV_compile_n(struct lua_State *L, struct Proto *p[], int n,
ravi_compile_options_t *options);
int raviV_iscompiled(struct lua_State *L, struct Proto *p);
/* Free the JIT structures associated with the prototype */
void raviV_freeproto(struct lua_State *L, struct Proto *p);
@ -79,10 +82,6 @@ int raviV_getminexeccount(struct lua_State *L);
/* Enable IR / codegen validations */
void raviV_setvalidation(struct lua_State *L, int enabled);
int raviV_getvalidation(struct lua_State *L);
/* Enable calls to GCSTEP */
void raviV_setgcstep(struct lua_State *L, int value);
int raviV_getgcstep(struct lua_State *L);
/* Enable or disable trace hook */
void raviV_settraceenabled(struct lua_State *L, int enabled);

@ -27,7 +27,7 @@
#ifdef USE_LLVM
#include "ravi_llvm.h"
#include "ravijit.h"
#include "ravi_jit.h"
#include <array>
#include <atomic>

@ -37,7 +37,7 @@
#include "lundump.h"
#include "lvm.h"
#include "lzio.h"
#include "ravijit.h"
#include "ravi_jit.h"
#include "ravi_jitshared.h"

@ -27,7 +27,7 @@
#include "lobject.h"
#include "lstate.h"
#include "ravijit.h"
#include "ravi_jit.h"
CClosure *luaF_newCclosure (lua_State *L, int n) {
GCObject *o = luaC_newobj(L, LUA_TCCL, sizeCclosure(n));

@ -51,7 +51,7 @@ static const luaL_Reg loadedlibs[] = {
{LUA_MATHLIBNAME, luaopen_math},
{LUA_UTF8LIBNAME, luaopen_utf8},
{LUA_DBLIBNAME, luaopen_debug},
{LUA_RAVILIBNAME, raviopen_llvmjit},
{LUA_RAVILIBNAME, raviopen_jit},
#if USE_DMR_C
{ "dmrc", raviopen_dmrcluaapi },
#endif

@ -28,7 +28,7 @@
#include "ltable.h"
#include "ltm.h"
#include "ravijit.h"
#include "ravi_jit.h"
#include "ravi_profile.h"
#include "ravi_alloc.h"

@ -20,7 +20,7 @@
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
******************************************************************************/
#include <ravijit.h>
#include <ravi_jit.h>
#include <ravi_jitshared.h>
#ifdef __cplusplus
@ -46,7 +46,7 @@ static int ravi_is_compiled(lua_State *L) {
luaL_argcheck(L, lua_isfunction(L, 1) && !lua_iscfunction(L, 1), 1,
"argument must be a Lua function");
void *p = (void *)lua_topointer(L, 1);
LClosure *l = reinterpret_cast<LClosure *>(p);
LClosure *l = (LClosure *)(p);
lua_pushboolean(L, l->p->ravi_jit.jit_status == RAVI_JIT_COMPILED);
return 1;
}
@ -78,7 +78,7 @@ static int ravi_compile_n(lua_State *L) {
if (n < MAX_COMPILES && lua_isfunction(L, -1) &&
!lua_iscfunction(L, -1)) {
void *p = (void *)lua_topointer(L, -1);
LClosure *l = reinterpret_cast<LClosure *>(p);
LClosure *l = (LClosure *)(p);
if (!l->p->ravi_jit.jit_function) functions[n++] = l->p;
}
lua_pop(L, 1); // pop value, but keep key
@ -88,7 +88,7 @@ static int ravi_compile_n(lua_State *L) {
luaL_argcheck(L, lua_isfunction(L, 1) && !lua_iscfunction(L, 1), 1,
"argument must be a Lua function");
void *p = (void *)lua_topointer(L, 1);
LClosure *l = reinterpret_cast<LClosure *>(p);
LClosure *l = (LClosure *)(p);
functions[n++] = l->p;
}
ravi_compile_options_t options = {0, 0, 0, RAVI_CODEGEN_NONE};
@ -128,7 +128,7 @@ static int ravi_dump_ir(lua_State *L) {
luaL_argcheck(L, lua_isfunction(L, 1) && !lua_iscfunction(L, 1), 1,
"argument must be a Lua function");
void *p = (void *)lua_topointer(L, 1);
LClosure *l = reinterpret_cast<LClosure *>(p);
LClosure *l = (LClosure *)(p);
raviV_dumpIR(L, l->p);
return 0;
}
@ -141,7 +141,7 @@ static int ravi_dump_asm(lua_State *L) {
luaL_argcheck(L, lua_isfunction(L, 1) && !lua_iscfunction(L, 1), 1,
"argument must be a Lua function");
void *p = (void *)lua_topointer(L, 1);
LClosure *l = reinterpret_cast<LClosure *>(p);
LClosure *l = (LClosure *)(p);
raviV_dumpASM(L, l->p);
return 0;
}
@ -208,18 +208,6 @@ static int ravi_validation(lua_State *L) {
return 1;
}
// Set GC step when JIT compiling
static int ravi_gcstep(lua_State *L) {
int n = lua_gettop(L);
int oldvalue = raviV_getgcstep(L);
if (n == 1) {
int value = lua_tointeger(L, 1);
raviV_setgcstep(L, value);
}
lua_pushboolean(L, oldvalue);
return 1;
}
// Turn on/off the trace hook
static int ravi_traceenable(lua_State *L) {
int n = lua_gettop(L);
@ -263,7 +251,6 @@ static const luaL_Reg ravilib[] = {{"iscompiled", ravi_is_compiled},
{"sizelevel", ravi_sizelevel},
{"verbosity", ravi_verbosity},
{"validation", ravi_validation},
{"gcstep", ravi_gcstep},
{"tracehook", ravi_traceenable},
{"listcode", ravi_listcode},
{"limits", ravi_get_limits},
@ -271,7 +258,7 @@ static const luaL_Reg ravilib[] = {{"iscompiled", ravi_is_compiled},
#include <math.h>
LUAMOD_API int raviopen_llvmjit(lua_State *L) {
LUAMOD_API int raviopen_jit(lua_State *L) {
luaL_newlib(L, ravilib);
/* faster calls some maths functions */
ravi_pushcfastcall(L, NULL, RAVI_TFCF_EXP);

@ -20,7 +20,7 @@
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
******************************************************************************/
#include <ravijit.h>
#include <ravi_jit.h>
#include <ravi_llvmcodegen.h>
#include <ravi_jitshared.h>
#include <dmr_c.h>

@ -21,7 +21,6 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
******************************************************************************/
#include <ravi_llvmcodegen.h>
#include <ravijit.h>
// Important to include the C++ header files (ravi_llvmcodegen.h) before following
// (ravi_jitshared.h) as the Lua headers define macros that mess with C++ headers
#include <ravi_jitshared.h>
@ -1014,18 +1013,6 @@ int raviV_getvalidation(lua_State *L) {
return G->ravi_state->jit->get_validation();
}
void raviV_setgcstep(lua_State *L, int value) {
global_State *G = G(L);
if (!G->ravi_state)
return;
G->ravi_state->jit->set_gcstep(value);
}
int raviV_getgcstep(lua_State *L) {
global_State *G = G(L);
if (!G->ravi_state)
return 0;
return G->ravi_state->jit->get_gcstep();
}
// Turn on/off the JIT compiler
void raviV_settraceenabled(lua_State *L, int value) {

@ -22,7 +22,7 @@
******************************************************************************/
#include <ravi_mirjit.h>
#include <ravijit.h>
#include <ravi_jit.h>
#include <stddef.h>
#include <assert.h>
@ -319,15 +319,6 @@ int raviV_getverbosity(lua_State *L) {
return G->ravi_state->verbosity_;
}
void raviV_setgcstep(lua_State *L, int value) {
(void)L;
(void)value;
}
int raviV_getgcstep(lua_State *L) {
(void)L;
return 0;
}
// Turn on/off the JIT compiler
void raviV_settraceenabled(lua_State *L, int value) {
(void)L;

@ -21,7 +21,7 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
******************************************************************************/
#include <ravijit.h>
#include <ravi_jit.h>
#include <ravi_jitshared.h>
int raviV_compile(struct lua_State *L, struct Proto *p,

@ -22,7 +22,7 @@
******************************************************************************/
#include <ravi_omrjit.h>
#include <ravijit.h>
#include <ravi_jit.h>
#include <stddef.h>
#include <assert.h>
@ -453,15 +453,6 @@ int raviV_getverbosity(lua_State *L) {
return G->ravi_state->verbosity_;
}
void raviV_setgcstep(lua_State *L, int value) {
(void)L;
(void)value;
}
int raviV_getgcstep(lua_State *L) {
(void)L;
return 0;
}
// Turn on/off the JIT compiler
void raviV_settraceenabled(lua_State *L, int value) {
(void)L;

@ -1,5 +1,5 @@
#include <ravi_omrjit.h>
#include <ravijit.h>
#include <ravi_jit.h>
#include <stddef.h>
#include <assert.h>

Loading…
Cancel
Save