Skip to content

Commit 54fc03a

Browse files
committed
holylua: test out a jit bug
1 parent ad00ac8 commit 54fc03a

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

ghostinj-dll/source/dll.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
#include <stdio.h>
44
#include <filesystem>
55

6+
#include "lua.hpp"
7+
#include "lj_obj.h"
8+
#include "luajit_rolling.h"
9+
#include "lauxlib.h"
10+
611
#if SYSTEM_WINDOWS
712
#ifndef DLFCN_H
813
#define DLFCN_H
@@ -60,6 +65,29 @@ void Load()
6065
{
6166
Msg( "--- Holylib-GhostInj Loading ---\n" );
6267

68+
lua_State* state = luaL_newstate();
69+
luaL_openlibs(state);
70+
//luaJIT_setmode(state, 0, 0);
71+
72+
std::string code = "jit.on() local num = 1.7976931348623e308 for i = 1, 9999 do if 1 / num > 0 then --[[print(true, 1 / num)]] else error(\"wtf\") end end error(\"worked\")";
73+
74+
printf("holylib: Loading jit thing\n");
75+
if (luaL_loadbuffer(state, code.c_str(), code.length(), "Test") == 0)
76+
{
77+
printf("holylib: calling jit thing\n");
78+
if (lua_pcall(state, 0, 0, 0) != 0)
79+
{
80+
printf("holylib: lua error: %s\n", lua_tostring(state, -1));
81+
} else {
82+
printf("holylib: Called jit thing\n");
83+
}
84+
} else {
85+
printf("holylib: lua buf error: %s\n", lua_tostring(state, -1));
86+
}
87+
88+
printf("holylib: Closing lua state\n");
89+
lua_close(state);
90+
6391
#ifdef ARCHITECTURE_X86
6492
if ( std::filesystem::exists( "garrysmod/lua/bin/gmsv_holylib_linux_updated.so" ) )
6593
{

0 commit comments

Comments
 (0)