lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Solaris, unlike every other x86_64 OS, puts application stacks in the top half of the address space. LuaJIT is not compatible with this.

This should be fixed in LuaJIT. Unfortunately, making this work involves quite a bit of overhead and complexity; I know of several other language runtimes which don't support Solaris due to this oddity.


On Wed, 1 Jun 2016, 15:23 Daurnimator, <quae@daurnimator.com> wrote:
On 2 June 2016 at 00:14, Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:
>> here is a PR for lpeg that fixes some issues we have had with deploying the
>> it on Solaris / OmniOS.
>> Please consider merging this upstream.
>>
>> https://github.com/LuaDist/lpeg/pull/1
>>
>> """
>> On operating systems like Solaris and Illumos where the stack grows down,
>> lightuserdata and user data cannot be assigned from the stack. This commit
>> patch fixes this behaviour by moving the allocations to the heap (using
>> calloc).
>
> Sorry, but this does not seem to make sense. Of course we can allocate
> and use an automatic array in C no matter the direction the stack
> grows. Your fix probably only hides the bug, instead of fixing it.
>
> Do you have a simple example that exercises the bug?
>
> -- Roberto
>

Looking at his commit message, it seems to be a luajit bug:

> Allocate lightuserdata on the heap.
>
> Solaris (OmniOS, Illumos) version of luajit does not support support
> allocation of lightuserdata on the stack. This gives errors like this:
>
> ```
> $ luajit test.lua
> General tests for LPeg library
> version 1.0.0
> luajit: bad light userdata pointer
> stack traceback:
>        [C]: in function 'match'
>        test.lua:58: in main chunk
>        [C]: at 0x00402d50
> ```
>
> This commit patch fixes this behavior by moving the allocations to the heap.

Heinrich, this seems like an issue that should be fixed in luajit, not LPEG.
Have you reported the issue there?