Re: compiling LuaJIT in VC++ 06 environment

  • From: Ajay Shinde <a.b.shinde321@xxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Tue, 3 Nov 2015 11:53:22 +0530

Hi,
Thank you for your intrest.

Here is the stack trace for the crash

STACK_TEXT:
lua51!lj_alloc_free+0x472 [lj_alloc.c @ 1326]
lua51!lj_alloc_f+0x17 [lj_alloc.c @ 1388]
lua51!lj_tab_free+0x2a [lj_tab.c @ 205]
lua51!gc_sweep+0x88 [lj_gc.c @ 405]
lua51!lj_gc_freeall+0x1a [lj_gc.c @ 561]
lua51!close_state+0x19 [lj_state.c @ 162]
lua51!lua_close+0x98 [lj_state.c @ 258]
luajit!main+0x57 [luajit.c @ 568]
luajit!mainCRTStartup+0xb4

also the implementation of _BitScanForward is a simple while loop searching
for first set bit

while(Mask)
{
if (iIndex >= 32) break;

if (Mask & 1)
{
*pIndex = iIndex;
return 1;
}
iIndex++;
Mask >>= 1;
}

pIndex = 0;
return 0;

For _BitScanReverse I have just reversed the loop
i.e indesx from 32 to 0 & shifting Mask to left

iIndex = sizeof(Mask) * 8 - 1;
while(Mask)
{
if (iIndex == 0) break;
if (Mask & (1 << (sizeof(Mask) * 8 - 1)))
{
*pIndex = iIndex;
return 1;
}
iIndex--;
Mask <<= 1;
}

pIndex = 0;
return 0;

Please suggest If i can do anything.

Thank you,
Ajay S.


On Mon, Nov 2, 2015 at 9:31 PM, Vyacheslav Egorov <
dmarc-noreply@xxxxxxxxxxxxx> wrote:

MSVC 6.0 is ancient, it was released in 1998!

It would be hard to help you figure this out because I personally
don't really have any access to something this old.

Please suggest any solutions or where am I going wrong.

I'd start by posting more information:

1) your implementations of _BitScanForward and _BitScanReverse.

2) stack trace for your crash.

Error suggests that your _BitScanForward/_BitScanReverse replacements
have a bug.


// Vyacheslav Egorov


On Mon, Nov 2, 2015 at 4:05 PM, Ajay Shinde <a.b.shinde321@xxxxxxxxx>
wrote:
Hi,

I am trying to compile luaJIT in Visual C++ 06. I had following few
problems:
First of all I got errors regarding _BitScanForward, _BitScanReverse()
as
they are not intrinsic in this compiler.
So to resolve this I tried to implement these functions & made them force
inline.
But after doing this Now I am getting exception if I try to run any lua
script through luajit.exe.
I get error LuaJIT: table overflow & then LuaJIT crasheh.

Please suggest any solutions or where am I going wrong.


Thank you in advance!

Ajay S.


Other related posts: