Lua 5.4 tests?

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

Lua 5.4 tests?

Tony Papadimitriou
I don’t know if there are newer tests for 5.4 but with the previous ones I have I get this:
 
***** FILE 'gc.lua'*****
.testing garbage collection
..................................................................................................................creating many objects
...........................................................functions with errors
.long strings
.......................................steps
steps (2)
....clearing tables
.................weak tables
...............................Lua warning: error in __gc metamethod (gc.lua:364: here)
.lua54: gc.lua:372: assertion failed!
stack traceback:
        [C]: in function 'assert'
        gc.lua:372: in local 'f'
        all.lua:157: in main chunk
        [C]: in ?
.Lua warning: error in __gc metamethod (gc.lua:362: table index is nil)
Reply | Threaded
Open this post in threaded view
|

Re: Lua 5.4 tests?

Roberto Ierusalimschy
> I don’t know if there are newer tests for 5.4 but with the previous ones I have I get this:

There are new tests. You can get them at github or wait a while until
we pack them.

-- Roberto

Reply | Threaded
Open this post in threaded view
|

Re: Lua 5.4 tests?

Tony Papadimitriou
OK, thanks.

With the new tests from GitHub, I run with

lua54 -E -e"_U=true" all.lua
(is this still the correct way to run the tests?)

and get up to this point when it crashes (Win7):

time: 0.931 (+0.01)

***** FILE 'cstack.lua'*****
testing C-stack overflow detection

-----Original Message-----
From: Roberto Ierusalimschy
Sent: Thursday, May 30, 2019 7:00 PM
To: Lua mailing list
Subject: Re: Lua 5.4 tests?

> I don’t know if there are newer tests for 5.4 but with the previous ones I
> have I get this:

There are new tests. You can get them at github or wait a while until
we pack them.

-- Roberto


Reply | Threaded
Open this post in threaded view
|

Re: Lua 5.4 tests?

Roberto Ierusalimschy
> With the new tests from GitHub, I run with
>
> lua54 -E -e"_U=true" all.lua
> (is this still the correct way to run the tests?)
>
> and get up to this point when it crashes (Win7):
>
> time: 0.931 (+0.01)
>
> ***** FILE 'cstack.lua'*****
> testing C-stack overflow detection

Can you change the value of LUAI_MAXCSTACK (defined in luaconf.h,
but you can also define it externally) to a smaller value that
doen't chrash? (And tell us the maximum value that still passes
all tests?)

Many thanks,

-- Roberto

Reply | Threaded
Open this post in threaded view
|

Re: Lua 5.4 tests?

Tony Papadimitriou
TCC compiler:

-DLUAI_MAXCSTACK=454 is the maximum I could have it complete all tests!
-DLUAI_MAXCSTACK=455 and above crashes.

Microsoft compiler (VS2013):

-DLUAI_MAXCSTACK=413 is the maximum I could have it complete all tests!
-DLUAI_MAXCSTACK=414 and above crashes.

Tested on a Win7-64 machine with 6GB RAM (in case it matters).

Both cases the values are far below the luaconf.h default of 2200

-----Original Message-----
From: Roberto Ierusalimschy
Sent: Thursday, May 30, 2019 9:39 PM
To: Lua mailing list
Subject: Re: Lua 5.4 tests?

> With the new tests from GitHub, I run with
>
> lua54 -E -e"_U=true" all.lua
> (is this still the correct way to run the tests?)
>
> and get up to this point when it crashes (Win7):
>
> time: 0.931 (+0.01)
>
> ***** FILE 'cstack.lua'*****
> testing C-stack overflow detection

Can you change the value of LUAI_MAXCSTACK (defined in luaconf.h,
but you can also define it externally) to a smaller value that
doen't chrash? (And tell us the maximum value that still passes
all tests?)

Many thanks,

-- Roberto


Reply | Threaded
Open this post in threaded view
|

Re: Lua 5.4 tests?

actboy168@gmail.com
In reply to this post by Roberto Ierusalimschy
xsy



发自我的小米手机
在 Roberto Ierusalimschy <[hidden email]>,2019年5月31日 00:01写道:

> I don’t know if there are newer tests for 5.4 but with the previous ones I have I get this:

There are new tests. You can get them at github or wait a while until
we pack them.

-- Roberto

Reply | Threaded
Open this post in threaded view
|

Re: Lua 5.4 tests?

Roberto Ierusalimschy
In reply to this post by Tony Papadimitriou
> TCC compiler:
>
> -DLUAI_MAXCSTACK=454 is the maximum I could have it complete all tests!
> -DLUAI_MAXCSTACK=455 and above crashes.
>
> Microsoft compiler (VS2013):
>
> -DLUAI_MAXCSTACK=413 is the maximum I could have it complete all tests!
> -DLUAI_MAXCSTACK=414 and above crashes.
>
> Tested on a Win7-64 machine with 6GB RAM (in case it matters).
>
> Both cases the values are far below the luaconf.h default of 2200

Many thanks. This seems a remarkably small C stack for such a machine.
Are you compiling Lua in debug mode or release mode?

-- Roberto


Reply | Threaded
Open this post in threaded view
|

Re: Lua 5.4 tests?

Tony Papadimitriou
-----Original Message-----
From: Roberto Ierusalimschy

>> TCC compiler:
>>
>> -DLUAI_MAXCSTACK=454 is the maximum I could have it complete all tests!
>> -DLUAI_MAXCSTACK=455 and above crashes.
>>
>> Microsoft compiler (VS2013):
>>
>> -DLUAI_MAXCSTACK=413 is the maximum I could have it complete all tests!
>> -DLUAI_MAXCSTACK=414 and above crashes.
>>
>> Tested on a Win7-64 machine with 6GB RAM (in case it matters).
>>
>> Both cases the values are far below the luaconf.h default of 2200
>
>Many thanks. This seems a remarkably small C stack for such a machine.
>Are you compiling Lua in debug mode or release mode?
>
>-- Roberto

I'm using whatever your defaults are.  I only added the above define for
compilation.
Now, I ran cstack.lua with 5.3.5 and 5.4.0 compiled with the exact same
compiler:

>lua -E -e"_U=true" cstack.lua
testing C-stack overflow detection
  maximum recursion: 999977
  maximum 'gsub' nest (calls): 197
  maximum 'gsub' nest (metamethods): 197
OK

>lua54 -E -e"_U=true" cstack.lua
testing C-stack overflow detection
  maximum recursion: 420
  maximum 'gsub' nest (calls): 35
  maximum 'gsub' nest (metamethods): 35
OK

cstack.lua refers to changing LUAI_MAXCCALLS which is the same (200) in both
versions.
LUAI_MAXCSTACK does seem to be available in 5.3.5

Assuming the cstack.lua tests are valid also for 5.3.5, my guess from the
above results is that it's not my system or compiler configurations but
something in 5.4 is causing this dramatic reduction in maximum recursion.
But, that's for you to decide.


Reply | Threaded
Open this post in threaded view
|

Re: Lua 5.4 tests?

Tony Papadimitriou
>LUAI_MAXCSTACK does seem to be available in 5.3.5

I meant does NOT


Reply | Threaded
Open this post in threaded view
|

Re: Lua 5.4 tests?

Andrew Gierth
In reply to this post by Tony Papadimitriou
>>>>> "Tony" == Tony Papadimitriou <[hidden email]> writes:

 Tony> Assuming the cstack.lua tests are valid also for 5.3.5, my guess
 Tony> from the above results is that it's not my system or compiler
 Tony> configurations but something in 5.4 is causing this dramatic
 Tony> reduction in maximum recursion. But, that's for you to decide.

Function calls from Lua code to lua functions in 5.3 don't consume the C
stack at all, i.e. they are handled by saving state information and
continuing within the same interpreter loop, whereas in 5.4, the
interpreter recursively invokes itself for every function call. This is
a problem because the stack usage for the interpreter is surprisingly
large, I believe thanks to the number of temporary values introduced by
inlining of function calls.

--
Andrew.

Reply | Threaded
Open this post in threaded view
|

Re: Lua 5.4 tests?

Roberto Ierusalimschy
In reply to this post by Tony Papadimitriou
> [...]
>
> Assuming the cstack.lua tests are valid also for 5.3.5, my guess from the
> above results is that it's not my system or compiler configurations but
> something in 5.4 is causing this dramatic reduction in maximum recursion.
> But, that's for you to decide.

As already explained, there are strong reasons for the difference
between Lua 5.3 and 5.4. However, I tested Lua 5.4 in a smaller
Windows 7 (32 bits, 512 MB), with VS 2010; it passed all tests with
that limit of 2200. So, my concern is why your system or compiler
configuration in Windows 7 needs a limit which is less than 4x
mine. (Even assuming that they did not correct the default stack size to
compensate for 64-bit words, that could explain a difference of 2x, not
4x.)

So, either the code from VS 2013 uses much more stack than VS 2010, or
there is some other difference. My code was compiled with command lines,
roughly this:

  E:\> cl /O2 /W3 /c /DLUA_BUILD_AS_DLL l*.c
  E:\> link /DLL /out:lua54.dll l*.obj


For reference, in my Linux machine that limit could be 10x larger
(22000) without problems.

-- Roberto

Reply | Threaded
Open this post in threaded view
|

Re: Lua 5.4 tests?

Viacheslav Usov
On Mon, Jun 3, 2019 at 3:44 PM Roberto Ierusalimschy <[hidden email]> wrote:

>  E:\> link /DLL /out:lua54.dll l*.obj

On Windows, the stack size is per-thread. The default stack size, which is always the main thread's stack size, is set when linking the main application's executable (say lua.exe, not the lua54.dll as above). Unless an application has the defaults changed, the stack size is 1 megabyte regardless of the platform [1]. This is several times smaller than a typical Linux stack.

Cheers,
V.

Reply | Threaded
Open this post in threaded view
|

Re: Lua 5.4 tests?

Tony Papadimitriou
In reply to this post by Roberto Ierusalimschy
I compiled with your switches (cl /O2 /W3) but as an EXE (not DLL) and with
VS2013 (Win7-64) and I get this:

c:\temp>lua54.exe cstack.lua
testing C-stack overflow detection
testing simple recursion:
2164            final count:    2165
testing stack overflow in message handling
2413            final count:    2414
testing recursion inside pattern matching
testing stack-overflow in recursive 'gsub'
181             final count:    181
testing stack-overflow in recursive 'gsub' with metatables
272             final count:    272
OK

and it also passes all the tests when run with: lua54.exe -E -e"_U=true"
all.lua

So, the switch /O2 makes a difference!

-----Original Message-----
From: Roberto Ierusalimschy
Sent: Monday, June 03, 2019 4:44 PM
To: Lua mailing list
Subject: Re: Lua 5.4 tests?

> [...]
>
> Assuming the cstack.lua tests are valid also for 5.3.5, my guess from the
> above results is that it's not my system or compiler configurations but
> something in 5.4 is causing this dramatic reduction in maximum recursion.
> But, that's for you to decide.

As already explained, there are strong reasons for the difference
between Lua 5.3 and 5.4. However, I tested Lua 5.4 in a smaller
Windows 7 (32 bits, 512 MB), with VS 2010; it passed all tests with
that limit of 2200. So, my concern is why your system or compiler
configuration in Windows 7 needs a limit which is less than 4x
mine. (Even assuming that they did not correct the default stack size to
compensate for 64-bit words, that could explain a difference of 2x, not
4x.)

So, either the code from VS 2013 uses much more stack than VS 2010, or
there is some other difference. My code was compiled with command lines,
roughly this:

  E:\> cl /O2 /W3 /c /DLUA_BUILD_AS_DLL l*.c
  E:\> link /DLL /out:lua54.dll l*.obj


For reference, in my Linux machine that limit could be 10x larger
(22000) without problems.

-- Roberto